Data type to represent an IPv4 packet header. More...
Data type to represent an IPv4 packet header.
The structure of the header is as follows:
#include <hdr.h>
| Data Fields | |
| uint8_t | v_ih | 
| Version and Internet Header Length. | |
| uint8_t | ts | 
| type of service of packet | |
| network_uint16_t | tl | 
| total length of the datagram | |
| network_uint16_t | id | 
| identification value of packet | |
| network_uint16_t | fl_fo | 
| version control flags and Fragment Offset. | |
| uint8_t | ttl | 
| time to live for this packet | |
| uint8_t | protocol | 
| protocol of this packet | |
| network_uint16_t | csum | 
| checksum of this packet | |
| ipv4_addr_t | src | 
| source address of this packet | |
| ipv4_addr_t | dst | 
| destination address of this packet | |
| network_uint16_t ipv4_hdr_t::csum | 
| ipv4_addr_t ipv4_hdr_t::dst | 
| network_uint16_t ipv4_hdr_t::fl_fo | 
version control flags and Fragment Offset.
The flags are the 3 most significant bits, and the remaining 13 bits are the fragment offset
This module provides helper functions to set, get, and check these fields accordingly:
| network_uint16_t ipv4_hdr_t::id | 
| ipv4_addr_t ipv4_hdr_t::src | 
| network_uint16_t ipv4_hdr_t::tl | 
| uint8_t ipv4_hdr_t::v_ih | 
Version and Internet Header Length.
The version are the 4 most significant bits and the Internet Header Length the 4 next bit (see above).
This module provides helper functions to set, get, and check these fields accordingly: