ip_header.h File Reference

IP header and options definitions. More...

#include <byteorder.h>
#include <sys/types.h>
Include dependency graph for ip_header.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  ip_header
 Internet header. More...
struct  ip_option
 Internet option header. More...
struct  ipv4_pseudo_header
 Internet version 4 pseudo header. More...

Defines

#define IP_COMPUTE_FRAGMENT_OFFSET_HIGH(length)   ((((length) / 8u) &0x1F00) >> 8)
 Returns the fragment offest high bits.
#define IP_COMPUTE_FRAGMENT_OFFSET_LOW(length)   (((length) / 8u) &0xFF)
 Returns the fragment offest low bits.
#define IP_COMPUTE_HEADER_LENGTH(length)   ((uint8_t) ((length) / 4u))
 Returns the IP header length.
#define IP_FRAGMENT_OFFSET(header)   ((((header)->fragment_offset_high << 8) + (header)->fragment_offset_low) * 8u)
 Returns the fragment offest.
#define IP_HEADER_CHECKSUM(header)   (htons(ip_checksum((uint8_t *)(header), IP_HEADER_LENGTH(header))))
 Returns the IP packet header checksum.
#define IP_HEADER_DATA_LENGTH(header)   (IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header))
 Returns the actual IP packet data length.
#define IP_HEADER_LENGTH(header)   ((header)->header_length * 4u)
 Returns the actual IP header length in bytes.
#define IP_TOTAL_LENGTH(header)   ntohs((header)->total_length)
 Returns the actual IP packet total length.
IP flags definitions



#define IPFLAG_FRAGMENT_SHIFT   1
 Fragment flag field shift.
#define IPFLAG_FRAGMENTED_SHIFT   0
 Fragmented flag field shift.
#define IPFLAG_DONT_FRAGMENT   (0x1 << IPFLAG_FRAGMENT_SHIFT)
 Don't fragment flag value.
#define IPFLAG_LAST_FRAGMENT   (0x0 << IPFLAG_FRAGMENTED_SHIFT)
 Last fragment flag value.
#define IPFLAG_MAY_FRAGMENT   (0x0 << IPFLAG_FRAGMENT_SHIFT)
 May fragment flag value.
#define IPFLAG_MORE_FRAGMENTS   (0x1 << IPFLAG_FRAGMENTED_SHIFT)
 More fragments flag value.

Typedefs

typedef struct ip_header ip_header_t
 Type definition of the internet header.
typedef ip_header_tip_header_ref
 Type definition of the internet header pointer.
typedef struct ip_option ip_option_t
 Type definition of the internet option header.
typedef ip_option_tip_option_ref
 Type definition of the internet option header pointer.
typedef struct ipv4_pseudo_header ipv4_pseudo_header_t
 Type definition of the internet version 4 pseudo header.
typedef ipv4_pseudo_header_tipv4_pseudo_header_ref
 Type definition of the internet version 4 pseudo header pointer.

Detailed Description

IP header and options definitions.

Based on the RFC~791.


Generated on Thu Mar 11 20:45:59 2010 for Networking and TCP/IP stack for HelenOS system by  doxygen 1.6.1