Loading...
Searching...
No Matches
IPv4 header

IPv4 header types and helper functions. More...

Detailed Description

IPv4 header types and helper functions.

Files

file  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.
 
static uint8_t ipv4_hdr_get_version (ipv4_hdr_t *hdr)
 Gets the value of the version field of hdr.
 
static void ipv4_hdr_set_ihl (ipv4_hdr_t *hdr, uint16_t ihl)
 Sets the Internet Header Length field of hdr.
 
static uint16_t ipv4_hdr_get_ihl (ipv4_hdr_t *hdr)
 brief Gets the value of the Internet Header Length field of hdr
 
static void ipv4_hdr_set_flags (ipv4_hdr_t *hdr, uint8_t flags)
 Sets the Version Control Flags field of hdr.
 
static uint8_t ipv4_hdr_get_flags (ipv4_hdr_t *hdr)
 brief Gets the value of the Version Control Flags field of hdr
 
static void ipv4_hdr_set_fo (ipv4_hdr_t *hdr, uint16_t fo)
 Sets the Fragment Offset field of hdr.
 
static uint16_t ipv4_hdr_get_fo (ipv4_hdr_t *hdr)
 brief Gets the value of the Fragment Offset field of hdr
 

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 159 of file 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 184 of file 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 135 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]hdrPointer to an IPv4 header.
Returns
Value of the version field of hdr.

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

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

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

Definition at line 122 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 6.

Parameters
[out]hdrPointer to an IPv4 header.

Definition at line 98 of file hdr.h.