ON Semiconductor / mbed-os

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

Embed: (wiki syntax)

« Back to documentation index

ip.c File Reference

ip.c File Reference

Common IPv4 and IPv6 code. More...

Go to the source code of this file.

Functions

struct netifip_route (ip_addr_t *dest)
 Finds the appropriate network interface for a given IP address.
static void ip_forward (struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
 Forwards an IP packet.
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.

Variables

struct netifcurrent_netif
 The interface that provided the packet for the current callback invocation.
struct ip_hdr * current_header
 Header of the input packet currently being processed.
ip_addr_t current_iphdr_src
 Source IP address of current_header.
ip_addr_t current_iphdr_dest
 Destination IP address of current_header.
static u16_t ip_id
 The IP header ID of the next outgoing IP packet.

Detailed Description

Common IPv4 and IPv6 code.

This is the IPv4 layer implementation for incoming and outgoing IP traffic.

See also:
ip_frag.c

Definition in file ip.c.


Function Documentation

static void ip_forward ( struct pbuf p,
struct ip_hdr *  iphdr,
struct netif inp 
) [static]

Forwards an IP packet.

It finds an appropriate route for the packet, decrements the TTL value of the packet, adjusts the checksum and outputs the packet on the appropriate interface.

Parameters:
pthe packet to forward (p->payload points to IP header)
iphdrthe IP header of the input packet
inpthe netif on which this packet was received

Definition at line 160 of file ip.c.

struct netif* ip_route ( ip_addr_t 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.

Parameters:
destthe destination IP address for which to find the route
Returns:
the netif on which to send to reach dest

Definition at line 124 of file ip.c.


Variable Documentation

struct ip_hdr* current_header

Header of the input packet currently being processed.

Definition at line 105 of file ip.c.

Destination IP address of current_header.

Definition at line 109 of file ip.c.

Source IP address of current_header.

Definition at line 107 of file ip.c.

The interface that provided the packet for the current callback invocation.

Definition at line 100 of file ip.c.

u16_t ip_id [static]

The IP header ID of the next outgoing IP packet.

Definition at line 112 of file ip.c.