IPv4 header types and helper functions.
More...
IPv4 header types and helper functions.
The authoritative source on the IPv4 header is RFC 791. In this RFC, the bit positions are noted left to right, with the most significant bit on the left (bit 0). Refer to Appendix B of the RFC for more information.
|
| file | hdr.h |
| | IPv4 header type and helper function definitions.
|
| |
◆ IPV4_HDR_FLAGS_DF
| #define IPV4_HDR_FLAGS_DF (0x02) |
do not fragment
Definition at line 43 of file hdr.h.
◆ IPV4_HDR_FLAGS_MF
| #define IPV4_HDR_FLAGS_MF (0x01) |
more fragments
Definition at line 44 of file hdr.h.
◆ IPV4_HDR_FLAGS_RESERVED
| #define IPV4_HDR_FLAGS_RESERVED (0x04) |
reserved
Definition at line 42 of file hdr.h.
◆ ipv4_hdr_get_flags()
| static uint8_t ipv4_hdr_get_flags |
( |
ipv4_hdr_t * | hdr | ) |
|
|
inlinestatic |
Gets the value of the Version Control Flags field of hdr.
- Parameters
-
| [in] | hdr | Pointer to an IPv4 header. |
- Returns
- Value of the Version Control field of
hdr
Definition at line 186 of file hdr.h.
◆ ipv4_hdr_get_fo()
| static uint16_t ipv4_hdr_get_fo |
( |
ipv4_hdr_t * | hdr | ) |
|
|
inlinestatic |
Gets the value of the Fragment Offset field of hdr.
- Parameters
-
| [in] | hdr | Pointer to an IPv4 header. |
- Returns
- Value of the Fragment Offset field of
hdr
Definition at line 211 of file hdr.h.
◆ ipv4_hdr_get_ihl()
| static uint16_t ipv4_hdr_get_ihl |
( |
ipv4_hdr_t * | hdr | ) |
|
|
inlinestatic |
Gets the value of the Internet Header Length field of hdr.
- Parameters
-
| [in] | hdr | Pointer to an IPv4 header. |
- Returns
- Size in bytes of the Internet Header Length field of
hdr
Definition at line 162 of file hdr.h.
◆ ipv4_hdr_get_version()
| static uint8_t ipv4_hdr_get_version |
( |
ipv4_hdr_t * | hdr | ) |
|
|
inlinestatic |
Gets the value of the version field of hdr.
- Parameters
-
| [in] | hdr | Pointer to an IPv4 header. |
- Returns
- Value of the version field of
hdr.
Definition at line 135 of file hdr.h.
◆ ipv4_hdr_set_flags()
| static void ipv4_hdr_set_flags |
( |
ipv4_hdr_t * | hdr, |
|
|
uint8_t | flags ) |
|
inlinestatic |
Sets the Version Control Flags field of hdr.
- Parameters
-
| [out] | hdr | Pointer to an IPv4 header. |
| [in] | flags | The new value of flags |
Definition at line 173 of file hdr.h.
◆ ipv4_hdr_set_fo()
| static void ipv4_hdr_set_fo |
( |
ipv4_hdr_t * | hdr, |
|
|
uint16_t | fo ) |
|
inlinestatic |
Sets the Fragment Offset field of hdr.
- Parameters
-
| [out] | hdr | Pointer to an IPv4 header. |
| [in] | fo | The new value of fragment offset |
Definition at line 197 of file hdr.h.
◆ ipv4_hdr_set_ihl()
| static void ipv4_hdr_set_ihl |
( |
ipv4_hdr_t * | hdr, |
|
|
uint16_t | ihl ) |
|
inlinestatic |
Sets the Internet Header Length field of hdr.
- Parameters
-
| [out] | hdr | Pointer to an IPv4 header. |
| [in] | ihl | Size in bytes of the Internet Header Length (including padding) |
Definition at line 146 of file hdr.h.
◆ ipv4_hdr_set_version()
| static void ipv4_hdr_set_version |
( |
ipv4_hdr_t * | hdr | ) |
|
|
inlinestatic |
Sets the version field of hdr to 4.
- Parameters
-
| [out] | hdr | Pointer to an IPv4 header. |
Definition at line 122 of file hdr.h.