Data Structures | |
struct | fwcache_entry |
struct | icmpip_hdr |
struct | tcpip_hdr |
struct | uip_fw_netif |
Representation of a uIP network interface. More... | |
Files | |
file | uip-fw.c |
uIP packet forwarding. | |
file | uip-fw.h |
uIP packet forwarding header file. | |
Macros | |
#define | BUF ((struct tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) |
#define | FW_TIME 20 |
#define | FWCACHE_SIZE 2 |
#define | ICMP_ECHO 8 |
#define | ICMP_TE 11 |
#define | ICMPBUF ((struct icmpip_hdr *)&uip_buf[UIP_LLH_LEN]) |
#define | notdef 0 |
#define | UIP_FW_DROPPED |
An error message that indicates that a packet that should be forwarded or output was dropped. More... | |
#define | UIP_FW_FORWARDED |
A non-error message that indicates that a packet was forwarded. More... | |
#define | UIP_FW_LOCAL |
A non-error message that indicates that a packet should be processed locally. More... | |
#define | UIP_FW_NETIF(ip1, ip2, ip3, ip4, nm1, nm2, nm3, nm4, outputfunc) |
Instantiating macro for a uIP network interface. More... | |
#define | UIP_FW_NOROUTE |
An error message that indicates that no suitable interface could be found for an outbound packet. More... | |
#define | UIP_FW_OK |
A non-error message that indicates that something went OK. More... | |
#define | uip_fw_setipaddr(netif, addr) |
Set the IP address of a network interface. More... | |
#define | uip_fw_setnetmask(netif, addr) |
Set the netmask of a network interface. More... | |
#define | UIP_FW_TOOLARGE |
An error message that indicates that a packet that was too large for the outbound network interface was detected. More... | |
#define | UIP_FW_ZEROLEN |
A non-error message that indicates that a zero-length packet transmission was attempted, and that no packet was sent. More... | |
Functions | |
static struct uip_fw_netif * | find_netif (void) |
static void | fwcache_register (void) |
static unsigned char | ipaddr_maskcmp (uip_ipaddr_t *ipaddr, uip_ipaddr_t *netipaddr, uip_ipaddr_t *netmask) |
static void | time_exceeded (void) |
void | uip_fw_default (struct uip_fw_netif *netif) |
Register a default network interface. More... | |
uint8_t | uip_fw_forward (void) |
Forward an IP packet in the uip_buf buffer. More... | |
void | uip_fw_init (void) |
Initialize the uIP packet forwarding module. More... | |
uint8_t | uip_fw_output (void) |
Output an IP packet on the correct network interface. More... | |
void | uip_fw_periodic (void) |
Perform periodic processing. More... | |
void | uip_fw_register (struct uip_fw_netif *netif) |
Register a network interface with the forwarding module. More... | |
Variables | |
static struct uip_fw_netif * | defaultnetif = NULL |
static struct fwcache_entry | fwcache [FWCACHE_SIZE] |
static struct uip_fw_netif * | netifs = NULL |
#define BUF ((struct tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) |
Referenced by find_netif(), fwcache_register(), time_exceeded(), uip_fw_forward(), and uip_fw_output().
#define FW_TIME 20 |
The time that a packet cache is active.
Referenced by fwcache_register().
#define FWCACHE_SIZE 2 |
Referenced by fwcache_register(), uip_fw_forward(), and uip_fw_periodic().
#define ICMP_ECHO 8 |
Referenced by time_exceeded(), and uip_fw_forward().
#define ICMP_TE 11 |
Referenced by time_exceeded().
#define ICMPBUF ((struct icmpip_hdr *)&uip_buf[UIP_LLH_LEN]) |
Referenced by time_exceeded(), and uip_fw_forward().
#define notdef 0 |
Referenced by uip_fw_forward().
#define UIP_FW_DROPPED |
An error message that indicates that a packet that should be forwarded or output was dropped.
Referenced by uip_over_mesh_send().
#define UIP_FW_FORWARDED |
A non-error message that indicates that a packet was forwarded.
Referenced by uip_fw_forward().
#define UIP_FW_LOCAL |
A non-error message that indicates that a packet should be processed locally.
Referenced by packet_input(), and uip_fw_forward().
#define UIP_FW_NETIF | ( | ip1, | |
ip2, | |||
ip3, | |||
ip4, | |||
nm1, | |||
nm2, | |||
nm3, | |||
nm4, | |||
outputfunc | |||
) |
Instantiating macro for a uIP network interface.
Example:
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. |
#define UIP_FW_NOROUTE |
An error message that indicates that no suitable interface could be found for an outbound packet.
Referenced by uip_fw_output().
#define UIP_FW_OK |
A non-error message that indicates that something went OK.
Referenced by slip_send(), uip_fw_output(), and uip_over_mesh_send().
Set the IP address of a network interface.
netif | A pointer to the uip_fw_netif structure for the network interface. |
addr | A pointer to an IP address. |
Set the netmask of a network interface.
netif | A pointer to the uip_fw_netif structure for the network interface. |
addr | A pointer to an IP address representing the netmask. |
#define UIP_FW_TOOLARGE |
An error message that indicates that a packet that was too large for the outbound network interface was detected.
#define UIP_FW_ZEROLEN |
A non-error message that indicates that a zero-length packet transmission was attempted, and that no packet was sent.
Referenced by uip_fw_output().
|
static |
Find a network interface for the IP packet in uip_buf.
References BUF, defaultnetif, uip_fw_netif::ipaddr, ipaddr_maskcmp(), uip_fw_netif::netmask, uip_fw_netif::next, and NULL.
Referenced by uip_fw_output().
|
static |
Register a packet in the forwarding cache so that it won't be forwarded again.
References BUF, fwcache_entry::destipaddr, FW_TIME, fwcache, FWCACHE_SIZE, i, fwcache_entry::ipid, NULL, fwcache_entry::proto, fwcache_entry::srcipaddr, fwcache_entry::timer, and uip_ipaddr_copy.
Referenced by uip_fw_output().
|
static |
Check if an IP address is within the network defined by an IP address and a netmask.
ipaddr | The IP address to be checked. |
netipaddr | The IP address of the network. |
netmask | The netmask of the network. |
References uip_ip6addr_t::u16.
Referenced by find_netif().
|
static |
Send out an ICMP TIME-EXCEEDED message.
This function replaces the packet in the uip_buf buffer with the ICMP packet.
References BUF, ICMP_ECHO, ICMP_TE, ICMPBUF, uip_chksum(), uip_hostaddr, uip_ipaddr_copy, uip_ipchksum(), UIP_IPH_LEN, uip_len, UIP_PROTO_ICMP, and UIP_TTL.
Referenced by uip_fw_forward().
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.
netif | A pointer to the network interface that is to be registered. |
uint8_t uip_fw_forward | ( | void | ) |
Forward an IP packet in the uip_buf buffer.
References BUF, fwcache_entry::destipaddr, fwcache, FWCACHE_SIZE, ICMP_ECHO, ICMPBUF, fwcache_entry::ipid, notdef, fwcache_entry::proto, fwcache_entry::srcipaddr, time_exceeded(), fwcache_entry::timer, UAODV_UDPPORT, uip_all_zeroes_addr, uip_appdata, uip_broadcast_addr, uip_buf, UIP_FW_FORWARDED, UIP_FW_LOCAL, uip_fw_output(), uip_hostaddr, UIP_HTONS, uip_ipaddr_cmp, uip_len, UIP_LLH_LEN, UIP_PROTO_ICMP, UIP_PROTO_UDP, UIP_REASSEMBLY, and UIP_TCPIP_HLEN.
Referenced by packet_input().
void uip_fw_init | ( | void | ) |
Initialize the uIP packet forwarding module.
References netifs, uip_fw_netif::next, and NULL.
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.
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. |
References BUF, uip_udpip_hdr::destipaddr, find_netif(), fwcache_register(), uip_fw_netif::next, NULL, uip_fw_netif::output, uip_broadcast_addr, UIP_FW_NOROUTE, UIP_FW_OK, UIP_FW_ZEROLEN, uip_ipaddr_cmp, and uip_len.
Referenced by uip_fw_forward().
void uip_fw_periodic | ( | void | ) |
Perform periodic processing.
References fwcache, FWCACHE_SIZE, and fwcache_entry::timer.
Referenced by eventhandler().
void uip_fw_register | ( | struct uip_fw_netif * | netif | ) |
Register a network interface with the forwarding module.
netif | A pointer to the network interface that is to be registered. |
References netifs, and uip_fw_netif::next.
|
static |
Referenced by find_netif().
|
static |
Referenced by fwcache_register(), uip_fw_forward(), and uip_fw_periodic().
|
static |
Referenced by uip_fw_init(), and uip_fw_register().