threadhead
04-24-2003, 11:16 AM
heyho everyone!
i wondered how packet encapsulation works in detail.
i wanted to implement such encapsulation in C.
well in general you can say that a packet is nothing more than a structure filled with the needed infos sent over the wire with write().
lets assume we want to build an arp packet.
struct pseudoarp
{
struct arpheader
{
{
...
...
...
} arp;
struct etherheader
{
{
...
....
.....
} eth;
} arppacket;
so wouldnt be an encapsulation something like putting more "around" that structure to hide it?
something like this?
struct encapsulated
{
struct pseudoarp
{
struct arpheader
{
{
...
...
...
} arp;
struct etherheader
{
{
...
....
.....
} eth;
} arppacket;
} encapsulated;
think of that data being sent to a client connected to a stream server.
how would that client recognize the arp packet within the encapsulated one? or is there no need to recognize because that additional structure is not seen by the client?
and if yes, how are packets encapsulated then?
thanks alot for your time!
i wondered how packet encapsulation works in detail.
i wanted to implement such encapsulation in C.
well in general you can say that a packet is nothing more than a structure filled with the needed infos sent over the wire with write().
lets assume we want to build an arp packet.
struct pseudoarp
{
struct arpheader
{
{
...
...
...
} arp;
struct etherheader
{
{
...
....
.....
} eth;
} arppacket;
so wouldnt be an encapsulation something like putting more "around" that structure to hide it?
something like this?
struct encapsulated
{
struct pseudoarp
{
struct arpheader
{
{
...
...
...
} arp;
struct etherheader
{
{
...
....
.....
} eth;
} arppacket;
} encapsulated;
think of that data being sent to a client connected to a stream server.
how would that client recognize the arp packet within the encapsulated one? or is there no need to recognize because that additional structure is not seen by the client?
and if yes, how are packets encapsulated then?
thanks alot for your time!