Data Structures | Files | Defines | Functions | Variables

uIP packet forwarding
[The uIP TCP/IP stack]

Collaboration diagram for uIP packet forwarding:

Data Structures

struct  tcpip_hdr
struct  icmpip_hdr
struct  fwcache_entry
struct  uip_fw_netif

Files

file  uip-fw.c
file  uip-fw.h

Defines

#define ICMP_ECHO   8
#define ICMP_TE   11
#define BUF   ((struct tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
#define ICMPBUF   ((struct icmpip_hdr *)&uip_buf[UIP_LLH_LEN])
#define FWCACHE_SIZE   2
#define FW_TIME   20
#define UIP_FW_NETIF(ip1, ip2, ip3, ip4, nm1, nm2, nm3, nm4, outputfunc)
#define uip_fw_setipaddr(netif, addr)
#define uip_fw_setnetmask(netif, addr)
#define UIP_FW_LOCAL
#define UIP_FW_OK
#define UIP_FW_FORWARDED
#define UIP_FW_ZEROLEN
#define UIP_FW_TOOLARGE
#define UIP_FW_NOROUTE
#define UIP_FW_DROPPED

Functions

void uip_fw_init (void)
u8_t uip_fw_output (void)
u8_t uip_fw_forward (void)
void uip_fw_register (struct uip_fw_netif *netif)
void uip_fw_default (struct uip_fw_netif *netif)
void uip_fw_periodic (void)

Variables

u16_t tcpip_hdr::len
u16_t tcpip_hdr::ipid
u16_t tcpip_hdr::ipoffset
u8_t tcpip_hdr::ttl
u8_t tcpip_hdr::proto
u16_t tcpip_hdr::ipchksum
u16_t tcpip_hdr::srcipaddr [2]
u16_t tcpip_hdr::destipaddr [2]
u16_t tcpip_hdr::srcport
u16_t tcpip_hdr::destport
u8_t tcpip_hdr::seqno [4]
u8_t tcpip_hdr::ackno [4]
u8_t tcpip_hdr::tcpoffset
u8_t tcpip_hdr::flags
u8_t tcpip_hdr::wnd [2]
u16_t tcpip_hdr::tcpchksum
u8_t tcpip_hdr::urgp [2]
u8_t tcpip_hdr::optdata [4]
struct tcpip_hdr PACK_STRUCT_END
u16_t icmpip_hdr::ipchksum
u16_t icmpip_hdr::srcipaddr [2]
u16_t icmpip_hdr::destipaddr [2]
u8_t icmpip_hdr::type
u8_t icmpip_hdr::icode
u16_t icmpip_hdr::icmpchksum
u16_t icmpip_hdr::id
u16_t icmpip_hdr::seqno
u8_t icmpip_hdr::payload [1]
u16_t fwcache_entry::srcipaddr [2]
u16_t fwcache_entry::destipaddr [2]
u16_t fwcache_entry::ipid
u8_t fwcache_entry::proto
u8_t fwcache_entry::unused

Project-specific configuration options

uIP has a number of configuration options that can be overridden for each project. These are kept in a project-specific uip-conf.h file and all configuration names have the prefix UIP_CONF.



#define PACK_STRUCT_END   __attribute__((packed))
#define ALIGN_STRUCT_END   __attribute__((aligned(4)))
#define UIP_CONF_MAX_CONNECTIONS
#define UIP_CONF_MAX_LISTENPORTS
#define UIP_CONF_BUFFER_SIZE
#define UIP_CONF_BYTE_ORDER
#define UIP_CONF_LOGGING
#define UIP_CONF_UDP
#define UIP_CONF_UDP_CHECKSUMS
#define UIP_CONF_STATISTICS
typedef uint8_t u8_t
typedef uint16_t u16_t
typedef uint32_t u32_t
typedef unsigned short uip_stats_t

Define Documentation

#define ALIGN_STRUCT_END   __attribute__((aligned(4)))

Representation of a 48-bit Ethernet address.

Definition at line 61 of file uip-conf.h.

#define BUF   ((struct tcpip_hdr *)&uip_buf[UIP_LLH_LEN])

Definition at line 126 of file uip-fw.c.

#define FW_TIME   20

Definition at line 175 of file uip-fw.c.

#define FWCACHE_SIZE   2

Definition at line 161 of file uip-fw.c.

#define ICMP_ECHO   8

Definition at line 118 of file uip-fw.c.

#define ICMP_TE   11

Definition at line 121 of file uip-fw.c.

#define ICMPBUF   ((struct icmpip_hdr *)&uip_buf[UIP_LLH_LEN])

Definition at line 131 of file uip-fw.c.

struct ethip_hdr PACK_STRUCT_END   __attribute__((packed))

Representation of a 48-bit Ethernet address.

Definition at line 60 of file uip-conf.h.

#define UIP_CONF_BUFFER_SIZE

uIP buffer size.

Definition at line 119 of file uip-conf.h.

#define UIP_CONF_BYTE_ORDER

CPU byte order.

Definition at line 126 of file uip-conf.h.

#define UIP_CONF_LOGGING

Logging on or off

Definition at line 133 of file uip-conf.h.

#define UIP_CONF_MAX_CONNECTIONS

Maximum number of TCP connections.

Definition at line 105 of file uip-conf.h.

#define UIP_CONF_MAX_LISTENPORTS

Maximum number of listening TCP ports.

Definition at line 112 of file uip-conf.h.

#define UIP_CONF_STATISTICS

uIP statistics on or off

Definition at line 154 of file uip-conf.h.

#define UIP_CONF_UDP

UDP support on or off

Definition at line 140 of file uip-conf.h.

#define UIP_CONF_UDP_CHECKSUMS

UDP checksums on or off

Definition at line 147 of file uip-conf.h.

#define UIP_FW_DROPPED

An error message that indicates that a packet that should be forwarded or output was dropped.

Definition at line 171 of file uip-fw.h.

#define UIP_FW_FORWARDED

A non-error message that indicates that a packet was forwarded.

Definition at line 139 of file uip-fw.h.

#define UIP_FW_LOCAL

A non-error message that indicates that a packet should be processed locally.

Definition at line 125 of file uip-fw.h.

#define UIP_FW_NETIF (   ip1,
  ip2,
  ip3,
  ip4,
  nm1,
  nm2,
  nm3,
  nm4,
  outputfunc 
)

Intantiating macro for a uIP network interface.

Example:

 struct uip_fw_netif slipnetif =
   {UIP_FW_NETIF(192,168,76,1, 255,255,255,0, slip_output)};
Parameters:
ip1,ip2,ip3,ip4 The IP address of the network interface.
nm1,nm2,nm3,nm4 The netmask of the network interface.
outputfunc A pointer to the output function of the network interface.

Definition at line 80 of file uip-fw.h.

#define UIP_FW_NOROUTE

An error message that indicates that no suitable interface could be found for an outbound packet.

Definition at line 163 of file uip-fw.h.

#define UIP_FW_OK

A non-error message that indicates that something went OK.

Definition at line 132 of file uip-fw.h.

#define uip_fw_setipaddr (   netif,
  addr 
)

Set the IP address of a network interface.

Parameters:
netif A pointer to the uip_fw_netif structure for the network interface.
addr A pointer to an IP address.

Definition at line 95 of file uip-fw.h.

#define uip_fw_setnetmask (   netif,
  addr 
)

Set the netmask of a network interface.

Parameters:
netif A pointer to the uip_fw_netif structure for the network interface.
addr A pointer to an IP address representing the netmask.

Definition at line 107 of file uip-fw.h.

#define UIP_FW_TOOLARGE

An error message that indicates that a packet that was too large for the outbound network interface was detected.

Definition at line 155 of file uip-fw.h.

#define UIP_FW_ZEROLEN

A non-error message that indicates that a zero-length packet transmission was attempted, and that no packet was sent.

Definition at line 147 of file uip-fw.h.


Typedef Documentation

typedef uint16_t u16_t

16 bit datatype

This typedef defines the 16-bit type used throughout uIP.

Definition at line 79 of file uip-conf.h.

typedef uint32_t u32_t

32 bit datatype

This typedef defines the 16-bit type used throughout uIP.

Definition at line 88 of file uip-conf.h.

typedef uint8_t u8_t

8 bit datatype

This typedef defines the 8-bit type used throughout uIP.

Definition at line 70 of file uip-conf.h.

typedef unsigned short uip_stats_t

Statistics datatype

This typedef defines the dataype used for keeping statistics in uIP.

Definition at line 98 of file uip-conf.h.


Function Documentation

void uip_fw_default ( struct uip_fw_netif netif  ) 

Register a default network interface.

All packets that don't go out on any of the other interfaces will be routed to the default interface.

Parameters:
netif A pointer to the network interface that is to be registered.
u8_t uip_fw_forward ( void   ) 

Forward an IP packet in the uip_buf buffer.

Returns:
UIP_FW_FORWARDED if the packet was forwarded, UIP_FW_LOCAL if the packet should be processed locally.
void uip_fw_init ( void   ) 

Initialize the uIP packet forwarding module.

u8_t uip_fw_output ( void   ) 

Output an IP packet on the correct network interface.

The IP packet should be present in the uip_buf buffer and its length in the global uip_len variable.

Return values:
UIP_FW_ZEROLEN Indicates that a zero-length packet transmission was attempted and that no packet was sent.
UIP_FW_NOROUTE No suitable network interface could be found for the outbound packet, and the packet was not sent.
Returns:
The return value from the actual network interface output function is passed unmodified as a return value.
void uip_fw_periodic ( void   ) 

Perform periodic processing.

void uip_fw_register ( struct uip_fw_netif netif  ) 

Register a network interface with the forwarding module.

Parameters:
netif A pointer to the network interface that is to be registered.

Variable Documentation

u8_t tcpip_hdr::ackno[4] [inherited]

Definition at line 88 of file uip-fw.c.

u16_t tcpip_hdr::destipaddr[2] [inherited]

Definition at line 82 of file uip-fw.c.

Definition at line 141 of file uip-fw.c.

u16_t icmpip_hdr::destipaddr[2] [inherited]

Definition at line 108 of file uip-fw.c.

Definition at line 86 of file uip-fw.c.

u8_t tcpip_hdr::flags [inherited]

Definition at line 88 of file uip-fw.c.

Definition at line 112 of file uip-fw.c.

u8_t icmpip_hdr::icode [inherited]

Definition at line 111 of file uip-fw.c.

u16_t icmpip_hdr::id [inherited]

Definition at line 113 of file uip-fw.c.

Definition at line 81 of file uip-fw.c.

Definition at line 107 of file uip-fw.c.

u16_t tcpip_hdr::ipid [inherited]

Definition at line 76 of file uip-fw.c.

Definition at line 142 of file uip-fw.c.

Definition at line 76 of file uip-fw.c.

u16_t tcpip_hdr::len [inherited]

Definition at line 76 of file uip-fw.c.

u8_t tcpip_hdr::optdata[4] [inherited]

Definition at line 95 of file uip-fw.c.

u8_t icmpip_hdr::payload[1] [inherited]

Definition at line 114 of file uip-fw.c.

Definition at line 143 of file uip-fw.c.

u8_t tcpip_hdr::proto [inherited]

Definition at line 79 of file uip-fw.c.

u16_t icmpip_hdr::seqno [inherited]

Definition at line 113 of file uip-fw.c.

u8_t tcpip_hdr::seqno[4] [inherited]

Definition at line 88 of file uip-fw.c.

Definition at line 140 of file uip-fw.c.

u16_t tcpip_hdr::srcipaddr[2] [inherited]

Definition at line 82 of file uip-fw.c.

u16_t icmpip_hdr::srcipaddr[2] [inherited]

Definition at line 108 of file uip-fw.c.

Definition at line 86 of file uip-fw.c.

Definition at line 93 of file uip-fw.c.

Definition at line 88 of file uip-fw.c.

u8_t tcpip_hdr::ttl [inherited]

Definition at line 79 of file uip-fw.c.

u8_t icmpip_hdr::type [inherited]

Definition at line 111 of file uip-fw.c.

Definition at line 144 of file uip-fw.c.

u8_t tcpip_hdr::urgp[2] [inherited]

Definition at line 94 of file uip-fw.c.

u8_t tcpip_hdr::wnd[2] [inherited]

Definition at line 88 of file uip-fw.c.