RetroArch
|
#include "lwip/arch.h"
#include "lwip/def.h"
#include "lwip/pbuf.h"
#include "lwip/ip_addr.h"
#include "lwip/err.h"
Go to the source code of this file.
Classes | |
struct | ip_hdr |
Macros | |
#define | IP_HLEN 20 |
#define | IP_PROTO_ICMP 1 |
#define | IP_PROTO_UDP 17 |
#define | IP_PROTO_UDPLITE 170 |
#define | IP_PROTO_TCP 6 |
#define | IP_HDRINCL NULL |
#define | IP_PCB |
#define | SOF_DEBUG (u16_t)0x0001U /* turn on debugging info recording */ |
#define | SOF_ACCEPTCONN (u16_t)0x0002U /* socket has had listen() */ |
#define | SOF_REUSEADDR (u16_t)0x0004U /* allow local address reuse */ |
#define | SOF_KEEPALIVE (u16_t)0x0008U /* keep connections alive */ |
#define | SOF_DONTROUTE (u16_t)0x0010U /* just use interface addresses */ |
#define | SOF_BROADCAST (u16_t)0x0020U /* permit sending of broadcast msgs */ |
#define | SOF_USELOOPBACK (u16_t)0x0040U /* bypass hardware when possible */ |
#define | SOF_LINGER (u16_t)0x0080U /* linger on close if data present */ |
#define | SOF_OOBINLINE (u16_t)0x0100U /* leave received OOB data in line */ |
#define | SOF_REUSEPORT (u16_t)0x0200U /* allow local address & port reuse */ |
#define | IP_RF 0x8000 /* reserved fragment flag */ |
#define | IP_DF 0x4000 /* dont fragment flag */ |
#define | IP_MF 0x2000 /* more fragments flag */ |
#define | IP_OFFMASK 0x1fff /* mask for fragmenting bits */ |
#define | IPH_V(hdr) (ntohs((hdr)->_v_hl_tos) >> 12) |
#define | IPH_HL(hdr) ((ntohs((hdr)->_v_hl_tos) >> 8) & 0x0f) |
#define | IPH_TOS(hdr) (ntohs((hdr)->_v_hl_tos) & 0xff) |
#define | IPH_LEN(hdr) ((hdr)->_len) |
#define | IPH_ID(hdr) ((hdr)->_id) |
#define | IPH_OFFSET(hdr) ((hdr)->_offset) |
#define | IPH_TTL(hdr) (ntohs((hdr)->_ttl_proto) >> 8) |
#define | IPH_PROTO(hdr) (ntohs((hdr)->_ttl_proto) & 0xff) |
#define | IPH_CHKSUM(hdr) ((hdr)->_chksum) |
#define | IPH_VHLTOS_SET(hdr, v, hl, tos) (hdr)->_v_hl_tos = (htons(((v) << 12) | ((hl) << 8) | (tos))) |
#define | IPH_LEN_SET(hdr, len) (hdr)->_len = (len) |
#define | IPH_ID_SET(hdr, id) (hdr)->_id = (id) |
#define | IPH_OFFSET_SET(hdr, off) (hdr)->_offset = (off) |
#define | IPH_TTL_SET(hdr, ttl) (hdr)->_ttl_proto = (htons(IPH_PROTO(hdr) | ((ttl) << 8))) |
#define | IPH_PROTO_SET(hdr, proto) (hdr)->_ttl_proto = (htons((proto) | (IPH_TTL(hdr) << 8))) |
#define | IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum) |
#define | ip_debug_print(p) |
Functions | |
void | ip_init (void) |
struct netif * | ip_route (struct ip_addr *dest) |
err_t | ip_input (struct pbuf *p, struct netif *inp) |
err_t | ip_output (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, u8_t ttl, u8_t tos, u8_t proto) |
err_t | ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, u8_t ttl, u8_t tos, u8_t proto, struct netif *netif) |
Variables | |
PACK_STRUCT_BEGIN struct ip_hdr | PACK_STRUCT_STRUCT |
#define ip_debug_print | ( | p | ) |
#define IP_DF 0x4000 /* dont fragment flag */ |
#define IP_HDRINCL NULL |
#define IP_HLEN 20 |
#define IP_MF 0x2000 /* more fragments flag */ |
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ |
#define IP_PCB |
#define IP_PROTO_ICMP 1 |
#define IP_PROTO_TCP 6 |
#define IP_PROTO_UDP 17 |
#define IP_PROTO_UDPLITE 170 |
#define IP_RF 0x8000 /* reserved fragment flag */ |
#define IPH_CHKSUM | ( | hdr | ) | ((hdr)->_chksum) |
#define IPH_HL | ( | hdr | ) | ((ntohs((hdr)->_v_hl_tos) >> 8) & 0x0f) |
#define IPH_ID | ( | hdr | ) | ((hdr)->_id) |
#define IPH_LEN | ( | hdr | ) | ((hdr)->_len) |
#define IPH_OFFSET | ( | hdr | ) | ((hdr)->_offset) |
#define IPH_OFFSET_SET | ( | hdr, | |
off | |||
) | (hdr)->_offset = (off) |
#define IPH_PROTO | ( | hdr | ) | (ntohs((hdr)->_ttl_proto) & 0xff) |
#define IPH_TOS | ( | hdr | ) | (ntohs((hdr)->_v_hl_tos) & 0xff) |
#define IPH_TTL | ( | hdr | ) | (ntohs((hdr)->_ttl_proto) >> 8) |
#define IPH_V | ( | hdr | ) | (ntohs((hdr)->_v_hl_tos) >> 12) |
#define IPH_VHLTOS_SET | ( | hdr, | |
v, | |||
hl, | |||
tos | |||
) | (hdr)->_v_hl_tos = (htons(((v) << 12) | ((hl) << 8) | (tos))) |
#define SOF_ACCEPTCONN (u16_t)0x0002U /* socket has had listen() */ |
#define SOF_BROADCAST (u16_t)0x0020U /* permit sending of broadcast msgs */ |
#define SOF_DEBUG (u16_t)0x0001U /* turn on debugging info recording */ |
#define SOF_DONTROUTE (u16_t)0x0010U /* just use interface addresses */ |
#define SOF_KEEPALIVE (u16_t)0x0008U /* keep connections alive */ |
#define SOF_LINGER (u16_t)0x0080U /* linger on close if data present */ |
#define SOF_OOBINLINE (u16_t)0x0100U /* leave received OOB data in line */ |
#define SOF_REUSEADDR (u16_t)0x0004U /* allow local address reuse */ |
#define SOF_REUSEPORT (u16_t)0x0200U /* allow local address & port reuse */ |
#define SOF_USELOOPBACK (u16_t)0x0040U /* bypass hardware when possible */ |
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.
err_t ip_output | ( | struct pbuf * | p, |
struct ip_addr * | src, | ||
struct ip_addr * | dest, | ||
u8_t | ttl, | ||
u8_t | tos, | ||
u8_t | proto | ||
) |
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_if | ( | struct pbuf * | p, |
struct ip_addr * | src, | ||
struct ip_addr * | dest, | ||
u8_t | ttl, | ||
u8_t | tos, | ||
u8_t | proto, | ||
struct netif * | netif | ||
) |
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.
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.
PACK_STRUCT_BEGIN struct ip_hdr PACK_STRUCT_STRUCT |