*/
-/*-----------------------------------------------------------------------------------*/
+
/* ip.c
*
* This is the code for the IP layer for IPv6.
*
*/
-/*-----------------------------------------------------------------------------------*/
+
#include "lwip/opt.h"
#include "lwip/stats.h"
#include "arch/perf.h"
-/*-----------------------------------------------------------------------------------*/
+
/* ip_init:
*
* Initializes the IP layer.
*/
-/*-----------------------------------------------------------------------------------*/
+
void
ip_init(void)
{
}
-/*-----------------------------------------------------------------------------------*/
+
/* ip_route:
*
* 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.
*/
-/*-----------------------------------------------------------------------------------*/
+
struct netif *
ip_route(struct ip_addr *dest)
{
return netif_default;
}
-/*-----------------------------------------------------------------------------------*/
+
/* ip_forward:
*
* 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.
*/
-/*-----------------------------------------------------------------------------------*/
+
static void
ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
{
netif->output(netif, p, (struct ip_addr *)&(iphdr->dest));
}
-/*-----------------------------------------------------------------------------------*/
+
/* ip_input:
*
* This function is called by the network interface device driver when an IP packet is
*
* Finally, the packet is sent to the upper layer protocol input function.
*/
-/*-----------------------------------------------------------------------------------*/
+
void
ip_input(struct pbuf *p, struct netif *inp) {
struct ip_hdr *iphdr;
PERF_STOP("ip_input");
}
-/*-----------------------------------------------------------------------------------*/
+
/* ip_output_if:
*
* 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.
*/
-/*-----------------------------------------------------------------------------------*/
+
err_t
ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
u8_t ttl,
PERF_STOP("ip_output_if");
return netif->output(netif, p, dest);
}
-/*-----------------------------------------------------------------------------------*/
+
/* ip_output:
*
* Simple interface to ip_output_if. It finds the outgoing network interface and
* calls upon ip_output_if to do the actual work.
*/
-/*-----------------------------------------------------------------------------------*/
+
err_t
ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
u8_t ttl, u8_t proto)
return ip_output_if (p, src, dest, ttl, proto, netif);
}
-/*-----------------------------------------------------------------------------------*/
+
#if IP_DEBUG
void
ip_debug_print(struct pbuf *p)
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
}
#endif /* IP_DEBUG */
-/*-----------------------------------------------------------------------------------*/
+