#include <byteorder.h>
#include <sys/types.h>
Go to the source code of this file.
Data Structures | |
| struct | ip_header |
| Internet header. More... | |
| struct | ip_option |
| Internet option header. More... | |
| struct | ipv4_pseudo_header |
| Internet version 4 pseudo header. More... | |
IP flags definitions | |
| #define | IPFLAG_DONT_FRAGMENT (0x1 << IPFLAG_FRAGMENT_SHIFT) |
| Don't fragment flag value. | |
| #define | IPFLAG_FRAGMENT_SHIFT 1 |
| Fragment flag field shift. | |
| #define | IPFLAG_FRAGMENTED_SHIFT 0 |
| Fragmented flag field shift. | |
| #define | IPFLAG_LAST_FRAGMENT (0x0 << IPFLAG_FRAGMENTED_SHIFT) |
| Last fragment flag value. | |
| #define | IPFLAG_MAY_FRAGMENT (0x0 << IPFLAG_FRAGMENT_SHIFT) |
| May fragment flag value. | |
| #define | IPFLAG_MORE_FRAGMENTS (0x1 << IPFLAG_FRAGMENTED_SHIFT) |
| More fragments flag value. | |
Defines | |
| #define | GET_IP_HEADER_FLAGS(header) (((header)->ffoh & 0xe0) >> 5) |
| #define | GET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header) ((header)->ffoh & 0x1f) |
| #define | GET_IP_HEADER_LENGTH(header) ((header)->vhl & 0x0f) |
| #define | GET_IP_HEADER_VERSION(header) (((header)->vhl & 0xf0) >> 4) |
| #define | GET_IP_OPTION_FLAGS(option) ((option)->of & 0x0f) |
| #define | GET_IP_OPTION_OVERFLOW(option) (((option)->of & 0xf0) >> 4) |
| #define | IP_COMPUTE_FRAGMENT_OFFSET_HIGH(length) ((((length) / 8U) & 0x1f00) >> 8) |
| Returns the fragment offest high bits. | |
| #define | IP_COMPUTE_FRAGMENT_OFFSET_LOW(length) (((length) / 8U) & 0xff) |
| Returns the fragment offest low bits. | |
| #define | IP_COMPUTE_HEADER_LENGTH(length) ((uint8_t) ((length) / 4U)) |
| Returns the IP header length. | |
| #define | IP_FRAGMENT_OFFSET(header) |
| Returns the fragment offest. | |
| #define | IP_HEADER_CHECKSUM(header) (htons(ip_checksum((uint8_t *) (header), IP_HEADER_LENGTH(header)))) |
| Returns the IP packet header checksum. | |
| #define | IP_HEADER_DATA_LENGTH(header) (IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header)) |
| Returns the actual IP packet data length. | |
| #define | IP_HEADER_LENGTH(header) (GET_IP_HEADER_LENGTH(header) * 4U) |
| Returns the actual IP header length in bytes. | |
| #define | IP_TOTAL_LENGTH(header) ntohs((header)->total_length) |
| Returns the actual IP packet total length. | |
| #define | SET_IP_HEADER_FLAGS(header, flags) |
| #define | SET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header, fragment_offset_high) |
| #define | SET_IP_HEADER_LENGTH(header, length) |
| #define | SET_IP_HEADER_VERSION(header, version) |
| #define | SET_IP_OPTION_FLAGS(option, flags) |
| #define | SET_IP_OPTION_OVERFLOW(option, overflow) |
Typedefs | |
| typedef ip_header | ip_header_t |
| Type definition of the internet header. | |
| typedef ip_option | ip_option_t |
| Type definition of the internet option header. | |
| typedef ipv4_pseudo_header | ipv4_pseudo_header_t |
| Type definition of the internet version 4 pseudo header. | |
Based on the RFC 791.
Definition in file ip_header.h.
1.4.7