Functions | |
struct netif * | ip_route (struct ip_addr *dest) |
err_t | ip_input (struct pbuf *p, struct netif *inp) |
err_t ip_input | ( | struct pbuf * | p, | |
struct netif * | inp | |||
) |
This function is called by the network interface device driver when an IP packet is received. The function does the basic checks of the IP header such as packet size being at least larger than the header size etc. If the packet was not destined for us, the packet is forwarded (using ip_forward). The IP checksum is always checked.
Finally, the packet is sent to the upper layer protocol input function.
p | the received IP packet (p->payload points to IP header) | |
inp | the netif on which this packet was received |
Sends an IP packet on a network interface. This function constructs the IP header and calculates the IP header checksum. If the source IP address is NULL, the IP address of the outgoing network interface is filled in as source address. If the destination IP address is IP_HDRINCL, p is assumed to already include an IP header and p->payload points to it instead of the data.
p | the packet to send (p->payload points to the data, e.g. next protocol header; if dest == IP_HDRINCL, p already includes an IP header and p->payload points to that IP header) | |
src | the source IP address to send from (if src == IP_ADDR_ANY, the IP address of the netif used to send is used as source address) | |
dest | the destination IP address to send the packet to | |
ttl | the TTL value to be set in the IP header | |
tos | the TOS value to be set in the IP header | |
proto | the PROTOCOL to be set in the IP header | |
netif | the netif on which to send this packet |
p | the packet to send (p->payload points to the data, e.g. next protocol header; if dest == IP_HDRINCL, p already includes an IP header and p->payload points to that IP header) | |
src | the source IP address to send from (if src == IP_ADDR_ANY, the IP address of the netif used to send is used as source address) | |
dest | the destination IP address to send the packet to | |
ttl | the TTL value to be set in the IP header | |
tos | the TOS value to be set in the IP header | |
proto | the PROTOCOL to be set in the IP header |
struct netif* ip_route | ( | struct ip_addr * | dest | ) | [read] |
Finds the appropriate network interface for a given IP address. It searches the list of network interfaces linearly. A match is found if the masked IP address of the network interface equals the masked IP address given to the function.
dest | the destination IP address for which to find the route |