My Kernel v0.1.0
Layer 3 - Internet Protocol (IPv4)

TCP/IP Illustrated Vol I - Chapter 5 - IP RFC 791 More...

Collaboration diagram for Layer 3 - Internet Protocol (IPv4):

Macros

#define IPV4_VERSION   4
 Version field inside the IP header.
 
#define IPV4_MIN_LENGTH   20
 Minimum size of an IP header.
 
#define IPV4_DEFAULT_TTL   64
 TTL value used when creating packets.
 

Functions

struct PACKED ALIGNED (sizeof(uint16_t)) ipv4_header
 An IPv4 header. More...
 
static uint16_t ipv4_fragment_offset (const struct ipv4_header *iphdr)
 
static bool ipv4_more_framents (const struct ipv4_header *iphdr)
 
static bool ipv4_is_fragmented (const struct ipv4_header *iphdr)
 
error_t ipv4_receive_packet (struct packet *packet)
 Process a newly received IP packet.
 
struct packetipv4_build_packet (const struct net_route *, u8 protocol, const void *payload, size_t)
 Build an IP packet The L2/L3 headers are filled using the routing information.
 
static __be ipv4_t IPV4 (uint8_t a, uint8_t b, uint8_t c, uint8_t d)
 Helper to quickly generate an IPv4 address.
 

Detailed Description

Function Documentation

◆ ALIGNED()

struct PACKED ALIGNED ( sizeof(uint16_t)  )
Note
All fields are in big endian

◆ ipv4_fragment_offset()

static uint16_t ipv4_fragment_offset ( const struct ipv4_header *  iphdr)
inlinestatic
Returns
An IPv4 fragment's offset

◆ ipv4_is_fragmented()

static bool ipv4_is_fragmented ( const struct ipv4_header *  iphdr)
inlinestatic
Returns
Whether this header's packet is fragmented

◆ ipv4_more_framents()

static bool ipv4_more_framents ( const struct ipv4_header *  iphdr)
inlinestatic
Returns
Whether this header's packet has more fragments remaining