EVE 1.0
uIP packet forwarding
Collaboration diagram for uIP packet forwarding:

Files

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

Data Structures

struct  uip_fw_netif
 

Macros

#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)
 
bool uip_fw_quote (const uip_ipaddr_t *destipaddr)
 
uint8_t uip_fw_output (void)
 
uint8_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)
 

Detailed Description

Macro Definition Documentation

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

Instantiating macro for a uIP network interface.

Example:

1 struct uip_fw_netif slipnetif =
2  {UIP_FW_NETIF(192,168,76,1, 255,255,255,0, slip_output)};
Parameters
ip1,ip2,ip3,ip4The IP address of the network interface.
nm1,nm2,nm3,nm4The netmask of the network interface.
outputfuncA pointer to the output function of the network interface.

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

#define uip_fw_setipaddr (   netif,
  addr 
)

Set the IP address of a network interface.

Parameters
netifA pointer to the uip_fw_netif structure for the network interface.
addrA pointer to an IP address.

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

#define uip_fw_setnetmask (   netif,
  addr 
)

Set the netmask of a network interface.

Parameters
netifA pointer to the uip_fw_netif structure for the network interface.
addrA pointer to an IP address representing the netmask.

Definition at line 108 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 127 of file uip-fw.h.

Referenced by tcpip_output(), and uip_fw_forward().

#define UIP_FW_OK

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

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

Referenced by slipdev_send(), and uip_fw_output().

#define UIP_FW_FORWARDED

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

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

Referenced by uip_fw_forward().

#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 149 of file uip-fw.h.

Referenced by uip_fw_output().

#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 157 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 165 of file uip-fw.h.

Referenced by uip_fw_output().

#define UIP_FW_DROPPED

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

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

Function Documentation

void uip_fw_init ( void  )

Initialize the uIP packet forwarding module.

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

References uip_fw_netif::ipaddr, uip_fw_netif::netmask, uip_fw_netif::next, uip_chksum(), uip_ipaddr_copy, uip_ipchksum(), uip_len, and UIP_TTL.

bool uip_fw_quote ( const uip_ipaddr_t destipaddr)

TODO: describe me!!!

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

References uip_fw_netif::quote.

uint8_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_ZEROLENIndicates that a zero-length packet transmission was attempted and that no packet was sent.
UIP_FW_NOROUTENo 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.

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

References uip_fw_netif::next, uip_fw_netif::output, UIP_FW_NOROUTE, UIP_FW_OK, UIP_FW_ZEROLEN, and uip_len.

Referenced by uip_fw_forward().

uint8_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.

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

References uip_appdata, UIP_FW_FORWARDED, UIP_FW_LOCAL, uip_fw_output(), UIP_HTONS, uip_len, UIP_LLH_LEN, and UIP_REASSEMBLY.

Referenced by tcpip_output().

void uip_fw_register ( struct uip_fw_netif netif)

Register a network interface with the forwarding module.

Parameters
netifA pointer to the network interface that is to be registered.

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

References uip_fw_netif::next.

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
netifA pointer to the network interface that is to be registered.

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

void uip_fw_periodic ( void  )

Perform periodic processing.

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

Referenced by tcpip_output().