ip.h File Reference

#include "net/arch.h"
#include "net/def.h"
#include "net/pbuf.h"
#include "net/ipv4/ip_addr.h"
#include "net/netif.h"
#include "net/err.h"

Go to the source code of this file.

Data Structures

struct  ip_hdr

Defines

#define IP_DF   0x4000
#define IP_HDRINCL   NULL
#define IP_HLEN   20
#define IP_MF   0x2000
#define IP_OFFMASK   0x1fff
#define IP_PROTO_ICMP   1
#define IP_PROTO_TCP   6
#define IP_PROTO_UDP   17
#define IP_PROTO_UDPLITE   170
#define IP_RF   0x8000
#define IPH_CHKSUM(hdr)   ((hdr)->_chksum)
#define IPH_CHKSUM_SET(hdr, chksum)   (hdr)->_chksum = (chksum)
#define IPH_HL(hdr)   ((NTOHS((hdr)->_v_hl_tos) >> 8) & 0x0f)
#define IPH_ID(hdr)   ((hdr)->_id)
#define IPH_ID_SET(hdr, id)   (hdr)->_id = (id)
#define IPH_LEN(hdr)   ((hdr)->_len)
#define IPH_LEN_SET(hdr, len)   (hdr)->_len = (len)
#define IPH_OFFSET(hdr)   ((hdr)->_offset)
#define IPH_OFFSET_SET(hdr, off)   (hdr)->_offset = (off)
#define IPH_PROTO(hdr)   (NTOHS((hdr)->_ttl_proto) & 0xff)
#define IPH_PROTO_SET(hdr, proto)   (hdr)->_ttl_proto = HTONS((proto) | (IPH_TTL(hdr) << 8))
#define IPH_TOS(hdr)   HTONS((NTOHS((hdr)->_v_hl_tos) & 0xff))
#define IPH_TTL(hdr)   (NTOHS((hdr)->_ttl_proto) >> 8)
#define IPH_TTL_SET(hdr, ttl)   (hdr)->_ttl_proto = HTONS(IPH_PROTO(hdr) | ((ttl) << 8))
#define IPH_V(hdr)   (NTOHS((hdr)->_v_hl_tos) >> 12)
#define IPH_VHLTOS_SET(hdr, v, hl, tos)   (hdr)->_v_hl_tos = HTONS(((v) << 12) | ((hl) << 8) | (tos))

Functions

void ip_init (void)
err_t ip_input (struct pbuf *p, struct netif *inp)
uInt8 ip_lookup (void *header, struct netif *inp)
err_t ip_output (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, uInt8 ttl, uInt8 proto)
err_t ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, uInt8 ttl, uInt8 proto, struct netif *netif)
netifip_route (struct ip_addr *dest)

Variables

ip_hdr PACK_STRUCT_STRUCT


Define Documentation

#define IP_DF   0x4000

Definition at line 82 of file ip.h.

#define IP_HDRINCL   NULL

Definition at line 70 of file ip.h.

#define IP_HLEN   20

Definition at line 57 of file ip.h.

#define IP_MF   0x2000

Definition at line 83 of file ip.h.

#define IP_OFFMASK   0x1fff

Definition at line 84 of file ip.h.

#define IP_PROTO_ICMP   1

Definition at line 59 of file ip.h.

#define IP_PROTO_TCP   6

Definition at line 62 of file ip.h.

#define IP_PROTO_UDP   17

Definition at line 60 of file ip.h.

#define IP_PROTO_UDPLITE   170

Definition at line 61 of file ip.h.

#define IP_RF   0x8000

Definition at line 81 of file ip.h.

#define IPH_CHKSUM ( hdr   )     ((hdr)->_chksum)

Definition at line 102 of file ip.h.

#define IPH_CHKSUM_SET ( hdr,
chksum   )     (hdr)->_chksum = (chksum)

Definition at line 110 of file ip.h.

#define IPH_HL ( hdr   )     ((NTOHS((hdr)->_v_hl_tos) >> 8) & 0x0f)

Definition at line 95 of file ip.h.

#define IPH_ID ( hdr   )     ((hdr)->_id)

Definition at line 98 of file ip.h.

#define IPH_ID_SET ( hdr,
id   )     (hdr)->_id = (id)

Definition at line 106 of file ip.h.

#define IPH_LEN ( hdr   )     ((hdr)->_len)

Definition at line 97 of file ip.h.

#define IPH_LEN_SET ( hdr,
len   )     (hdr)->_len = (len)

Definition at line 105 of file ip.h.

#define IPH_OFFSET ( hdr   )     ((hdr)->_offset)

Definition at line 99 of file ip.h.

#define IPH_OFFSET_SET ( hdr,
off   )     (hdr)->_offset = (off)

Definition at line 107 of file ip.h.

#define IPH_PROTO ( hdr   )     (NTOHS((hdr)->_ttl_proto) & 0xff)

Definition at line 101 of file ip.h.

#define IPH_PROTO_SET ( hdr,
proto   )     (hdr)->_ttl_proto = HTONS((proto) | (IPH_TTL(hdr) << 8))

Definition at line 109 of file ip.h.

#define IPH_TOS ( hdr   )     HTONS((NTOHS((hdr)->_v_hl_tos) & 0xff))

Definition at line 96 of file ip.h.

#define IPH_TTL ( hdr   )     (NTOHS((hdr)->_ttl_proto) >> 8)

Definition at line 100 of file ip.h.

#define IPH_TTL_SET ( hdr,
ttl   )     (hdr)->_ttl_proto = HTONS(IPH_PROTO(hdr) | ((ttl) << 8))

Definition at line 108 of file ip.h.

#define IPH_V ( hdr   )     (NTOHS((hdr)->_v_hl_tos) >> 12)

Definition at line 94 of file ip.h.

#define IPH_VHLTOS_SET ( hdr,
v,
hl,
tos   )     (hdr)->_v_hl_tos = HTONS(((v) << 12) | ((hl) << 8) | (tos))

Definition at line 104 of file ip.h.


Function Documentation

void ip_init ( void   ) 

Referenced by tcpip_thread().

err_t ip_input ( struct pbuf p,
struct netif inp 
)

Referenced by tcpip_thread().

uInt8 ip_lookup ( void *  header,
struct netif inp 
)

err_t ip_output ( struct pbuf p,
struct ip_addr src,
struct ip_addr dest,
uInt8  ttl,
uInt8  proto 
)

err_t ip_output_if ( struct pbuf p,
struct ip_addr src,
struct ip_addr dest,
uInt8  ttl,
uInt8  proto,
struct netif netif 
)

struct netif* ip_route ( struct ip_addr dest  ) 


Variable Documentation

struct ip_hdr PACK_STRUCT_STRUCT


Generated on Sun Dec 3 02:38:06 2006 for UbixOS V2 by  doxygen 1.4.7