Loading...
Searching...
No Matches
hdr.h File Reference

IPv4 header type and helper function definitions. More...

Detailed Description

IPv4 header type and helper function definitions.

Author
José Ignacio Alamos jiala.nosp@m.mos@.nosp@m.uc.cl
Bas Stottelaar basst.nosp@m.otte.nosp@m.laar@.nosp@m.gmai.nosp@m.l.com

Definition in file hdr.h.

#include <assert.h>
#include "byteorder.h"
#include "net/ipv4/addr.h"
+ Include dependency graph for hdr.h:

Go to the source code of this file.

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 4.
 
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)
 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)
 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)
 Gets the value of the Fragment Offset field of hdr.
 

IPv4 Header Flags

See also
RFC 791, section 3.1
#define IPV4_HDR_FLAGS_RESERVED   (0x04)
 reserved
 
#define IPV4_HDR_FLAGS_DF   (0x02)
 do not fragment
 
#define IPV4_HDR_FLAGS_MF   (0x01)
 more fragments