IPv4 header

IPv4 header types and helper functions. More...

Detailed Description

IPv4 header types and helper functions.

Files

file  ipv4/hdr.h
 IPv4 header type and helper function definitions.
 

Data Structures

struct  ipv4_hdr_t
 Data type to represent an IPv4 packet header. More...
 

Functions

static void ipv4_hdr_set_version (ipv4_hdr_t *hdr)
 Sets the version field of hdr to 6. More...
 
static uint8_t ipv4_hdr_get_version (ipv4_hdr_t *hdr)
 Gets the value of the version field of hdr. More...
 
static void ipv4_hdr_set_ihl (ipv4_hdr_t *hdr, uint16_t ihl)
 Sets the Internet Header Length field of hdr. More...
 
static uint16_t ipv4_hdr_get_ihl (ipv4_hdr_t *hdr)
 brief Gets the value of the Internet Header Length field of hdr More...
 
static void ipv4_hdr_set_flags (ipv4_hdr_t *hdr, uint8_t flags)
 Sets the Version Control Flags field of hdr. More...
 
static uint8_t ipv4_hdr_get_flags (ipv4_hdr_t *hdr)
 brief Gets the value of the Version Control Flags field of hdr More...
 
static void ipv4_hdr_set_fo (ipv4_hdr_t *hdr, uint16_t fo)
 Sets the Fragment Offset field of hdr. More...
 
static uint16_t ipv4_hdr_get_fo (ipv4_hdr_t *hdr)
 brief Gets the value of the Fragment Offset field of hdr More...
 

Function Documentation

◆ ipv4_hdr_get_flags()

static uint8_t ipv4_hdr_get_flags ( ipv4_hdr_t hdr)
inlinestatic

brief Gets the value of the Version Control Flags field of hdr

Parameters
[in]hdrPointer to an IPv4 header.
Returns
Value of the Version Control field of hdr

Definition at line 160 of file ipv4/hdr.h.

◆ ipv4_hdr_get_fo()

static uint16_t ipv4_hdr_get_fo ( ipv4_hdr_t hdr)
inlinestatic

brief Gets the value of the Fragment Offset field of hdr

Parameters
[in]hdrPointer to an IPv4 header.
Returns
Value of the Fragment Offset field of hdr

Definition at line 185 of file ipv4/hdr.h.

◆ ipv4_hdr_get_ihl()

static uint16_t ipv4_hdr_get_ihl ( ipv4_hdr_t hdr)
inlinestatic

brief Gets the value of the Internet Header Length field of hdr

Parameters
[in]hdrPointer to an IPv4 header.
Returns
Size in bytes of the Internet Header Length field of hdr

Definition at line 136 of file ipv4/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]hdrPointer to an IPv4 header.
Returns
Value of the version field of hdr.

Definition at line 112 of file ipv4/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]hdrPointer to an IPv4 header.
[in]flagsThe new value of flags

Definition at line 147 of file ipv4/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]hdrPointer to an IPv4 header.
[in]foThe new value of fragment offset

Definition at line 171 of file ipv4/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]hdrPointer to an IPv4 header.
[in]ihlSize in bytes of the Internet Header Length (including padding)

Definition at line 123 of file ipv4/hdr.h.

◆ ipv4_hdr_set_version()

static void ipv4_hdr_set_version ( ipv4_hdr_t hdr)
inlinestatic

Sets the version field of hdr to 6.

Parameters
[out]hdrPointer to an IPv4 header.

Definition at line 99 of file ipv4/hdr.h.