Internet header. More...
#include <ip_header.h>
Data Fields | |
uint8_t | header_length:4 |
Internet Header Length is the length of the internet header in 32~bit words, and thus points to the beginning of the data. | |
uint8_t | version:4 |
The Version field indicates the format of the internet header. | |
uint8_t | tos |
The Type of Service provides an indication of the abstract parameters of the quality of service desired. | |
uint16_t | total_length |
Total Length is the length of the datagram, measured in octets, including internet header and data. | |
uint16_t | identification |
An identifying value assigned by the sender to aid in assembling the fragments of a~datagram. | |
uint8_t | fragment_offset_high:5 |
This field indicates where in the datagram this fragment belongs. | |
uint8_t | flags:3 |
Various control flags. | |
uint8_t | fragment_offset_low |
This field indicates where in the datagram this fragment belongs. | |
uint8_t | ttl |
This field indicates the maximum time the datagram is allowed to remain in the internet system. | |
uint8_t | protocol |
This field indicates the next level protocol used in the data portion of the internet datagram. | |
uint16_t | header_checksum |
A checksum of the header only. | |
uint32_t | source_address |
The source address. | |
uint32_t | destination_address |
The destination address. |
Internet header.
The variable options should be included after the header itself and indicated by the increased header length value.
uint32_t ip_header::destination_address |
The destination address.
Referenced by ip_deliver_local(), ip_get_destination(), and ip_prepare_packet().
uint8_t ip_header::flags |
Various control flags.
Referenced by ip_create_middle_header(), ip_deliver_local(), ip_fragment_packet(), and ip_prepare_packet().
uint8_t ip_header::fragment_offset_high |
This field indicates where in the datagram this fragment belongs.
High bits.
Referenced by ip_fragment_packet_data(), and ip_prepare_packet().
uint8_t ip_header::fragment_offset_low |
This field indicates where in the datagram this fragment belongs.
Low bits.
Referenced by ip_fragment_packet_data(), and ip_prepare_packet().
uint16_t ip_header::header_checksum |
A checksum of the header only.
Since some header fields change (e.g., time to live), this is recomputed and verified at each point that the internet header is processed. The checksum algorithm is: The checksum field is the 16~bit one's complement of the one's complement sum of all 16~bit words in the header. For purposes of computing the checksum, the value of the checksum field is zero.
Referenced by ip_create_last_header(), ip_fragment_packet(), ip_fragment_packet_data(), ip_prepare_packet(), and ip_process_packet().
uint8_t ip_header::header_length |
Internet Header Length is the length of the internet header in 32~bit words, and thus points to the beginning of the data.
Note that the minimum value for a~correct header is~5.
Referenced by ip_create_last_header().
uint16_t ip_header::identification |
An identifying value assigned by the sender to aid in assembling the fragments of a~datagram.
Referenced by ip_prepare_packet().
uint8_t ip_header::protocol |
This field indicates the next level protocol used in the data portion of the internet datagram.
Referenced by ip_deliver_local(), and ip_prepare_icmp().
uint32_t ip_header::source_address |
The source address.
Referenced by ip_deliver_local(), ip_prepare_icmp(), and ip_prepare_packet().
uint8_t ip_header::tos |
The Type of Service provides an indication of the abstract parameters of the quality of service desired.
These parameters are to be used to guide the selection of the actual service parameters when transmitting a~datagram through a~particular network. Several networks offer service precedence, which somehow treats high precedence traffic as more important than other traffic (generally by accepting only traffic above a~certain precedence at time of high load). The major choice is a~three way tradeoff between low-delay, high-reliability, and high-throughput.
uint16_t ip_header::total_length |
Total Length is the length of the datagram, measured in octets, including internet header and data.
This field allows the length of a~datagram to be up to 65,535~octets.
Referenced by ip_fragment_packet_data(), and ip_prepare_packet().
uint8_t ip_header::ttl |
This field indicates the maximum time the datagram is allowed to remain in the internet system.
If this field contains the value zero, then the datagram must be destroyed. This field is modified in internet header processing. The time is measured in units of seconds, but since every module that processes a~datagram must decrease the TTL by at least one even if it process the datagram in less than a~second, the TTL must be thought of only as an upper bound on the time a~datagram may exist. The intention is to cause undeliverable datagrams to be discarded, and to bound the maximum datagram lifetime.
Referenced by ip_process_packet().
uint8_t ip_header::version |
The Version field indicates the format of the internet header.
Referenced by ip_deliver_local(), ip_prepare_icmp(), ip_prepare_packet(), and ip_process_packet().