LibXenon
Bare-metal Xbox 360 homebrew library
|
#include "lwip/opt.h"
#include "lwip/def.h"
#include "lwip/pbuf.h"
#include "lwip/ip_addr.h"
#include "lwip/err.h"
#include "lwip/netif.h"
Go to the source code of this file.
Data Structures | |
struct | ip_pcb |
struct | ip_hdr |
Macros | |
#define | IP_OPTIONS_SEND LWIP_IGMP |
#define | IP_HLEN 20 |
#define | IP_PROTO_ICMP 1 |
#define | IP_PROTO_IGMP 2 |
#define | IP_PROTO_UDP 17 |
#define | IP_PROTO_UDPLITE 136 |
#define | IP_PROTO_TCP 6 |
#define | IP_HDRINCL NULL |
#define | IP_PCB_ADDRHINT |
#define | IP_PCB |
#define | SOF_ACCEPTCONN 0x02U /* socket has had listen() */ |
#define | SOF_REUSEADDR 0x04U /* allow local address reuse */ |
#define | SOF_KEEPALIVE 0x08U /* keep connections alive */ |
#define | SOF_BROADCAST 0x20U /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */ |
#define | SOF_LINGER 0x80U /* linger on close if data present */ |
#define | SOF_INHERITED (SOF_REUSEADDR|SOF_KEEPALIVE|SOF_LINGER/*|SOF_DEBUG|SOF_DONTROUTE|SOF_OOBINLINE*/) |
#define | IP_RF 0x8000U /* reserved fragment flag */ |
#define | IP_DF 0x4000U /* dont fragment flag */ |
#define | IP_MF 0x2000U /* more fragments flag */ |
#define | IP_OFFMASK 0x1fffU /* mask for fragmenting bits */ |
#define | IPH_V(hdr) ((hdr)->_v_hl >> 4) |
#define | IPH_HL(hdr) ((hdr)->_v_hl & 0x0f) |
#define | IPH_TOS(hdr) ((hdr)->_tos) |
#define | IPH_LEN(hdr) ((hdr)->_len) |
#define | IPH_ID(hdr) ((hdr)->_id) |
#define | IPH_OFFSET(hdr) ((hdr)->_offset) |
#define | IPH_TTL(hdr) ((hdr)->_ttl) |
#define | IPH_PROTO(hdr) ((hdr)->_proto) |
#define | IPH_CHKSUM(hdr) ((hdr)->_chksum) |
#define | IPH_VHL_SET(hdr, v, hl) (hdr)->_v_hl = (((v) << 4) | (hl)) |
#define | IPH_TOS_SET(hdr, tos) (hdr)->_tos = (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 = (u8_t)(ttl) |
#define | IPH_PROTO_SET(hdr, proto) (hdr)->_proto = (u8_t)(proto) |
#define | IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum) |
#define | ip_init() /* Compatibility define, not init needed. */ |
#define | ip_current_netif() (current_netif) |
#define | ip_current_header() (current_header) |
#define | ip_current_src_addr() (¤t_iphdr_src) |
#define | ip_current_dest_addr() (¤t_iphdr_dest) |
#define | ip_get_option(pcb, opt) ((pcb)->so_options & (opt)) |
#define | ip_set_option(pcb, opt) ((pcb)->so_options |= (opt)) |
#define | ip_reset_option(pcb, opt) ((pcb)->so_options &= ~(opt)) |
#define | ip_debug_print(p) |
Functions | |
struct netif * | ip_route (ip_addr_t *dest) |
err_t | ip_input (struct pbuf *p, struct netif *inp) |
err_t | ip_output (struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto) |
err_t | ip_output_if (struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto, struct netif *netif) |
Variables | |
PACK_STRUCT_BEGIN struct ip_hdr | PACK_STRUCT_STRUCT |
struct netif * | current_netif |
const struct ip_hdr * | current_header |
ip_addr_t | current_iphdr_src |
ip_addr_t | current_iphdr_dest |
#define ip_current_dest_addr | ( | ) | (¤t_iphdr_dest) |
#define ip_current_header | ( | ) | (current_header) |
#define ip_current_netif | ( | ) | (current_netif) |
#define ip_current_src_addr | ( | ) | (¤t_iphdr_src) |
#define ip_get_option | ( | pcb, | |
opt | |||
) | ((pcb)->so_options & (opt)) |
#define ip_init | ( | void | ) | /* Compatibility define, not init needed. */ |
#define IP_OPTIONS_SEND LWIP_IGMP |
#define IP_PCB |
#define ip_reset_option | ( | pcb, | |
opt | |||
) | ((pcb)->so_options &= ~(opt)) |
#define ip_set_option | ( | pcb, | |
opt | |||
) | ((pcb)->so_options |= (opt)) |
#define IPH_CHKSUM_SET | ( | hdr, | |
chksum | |||
) | (hdr)->_chksum = (chksum) |
#define IPH_PROTO_SET | ( | hdr, | |
proto | |||
) | (hdr)->_proto = (u8_t)(proto) |
#define IPH_VHL_SET | ( | hdr, | |
v, | |||
hl | |||
) | (hdr)->_v_hl = (((v) << 4) | (hl)) |
#define SOF_BROADCAST 0x20U /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */ |
#define SOF_INHERITED (SOF_REUSEADDR|SOF_KEEPALIVE|SOF_LINGER/*|SOF_DEBUG|SOF_DONTROUTE|SOF_OOBINLINE*/) |
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 |
err_t ip_output | ( | struct pbuf * | p, |
ip_addr_t * | src, | ||
ip_addr_t * | 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.
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 |
err_t ip_output_if | ( | struct pbuf * | p, |
ip_addr_t * | src, | ||
ip_addr_t * | 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. 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 |
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 |
|
extern |
|
extern |
|
extern |
|
extern |
PACK_STRUCT_BEGIN struct ip_hdr PACK_STRUCT_STRUCT |