The namespace PoC.net.ipv4 offers an "Internet Protocol - Version 4" (IPv6) implementation.
The following ASCII art shows the basic structure of an IPv4 paket:
Endianess: big-endian
Alignment: 4 byte
Byte 0 Byte 1 Byte 2 Byte 3
+----------------+---------------+--------------------------------+--------------------------------+--------------------------------+
| IPVers. (0x04) | IHL(HeaderLen)| TypeOfService | TotalLength |
+----------------+---------------+--------------------------------+-------+------------------------+--------------------------------+
| Identification |R DF MF| FragmentOffset |
+--------------------------------+--------------------------------+-------+------------------------+--------------------------------+
| TimeToLive | Protocol | HeaderChecksum |
+--------------------------------+--------------------------------+--------------------------------+--------------------------------+
| SourceAddress |
+--------------------------------+--------------------------------+--------------------------------+--------------------------------+
| DestinationAddress |
+--------------------------------+--------------------------------+--------------------------------+--------------------------------+
| Options | Padding |
+--------------------------------+--------------------------------+--------------------------------+--------------------------------+
| Payload |
~ ~ ~ ~ ~
| |
~ ~ ~ ~ ~
| |
~ ~ ~ ~ ~
| |
+--------------------------------+--------------------------------+--------------------------------+--------------------------------+