Microchip® Advanced Software Framework

ip.h File Reference
#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"
#include "lwip/ip4.h"
#include "lwip/ip6.h"

Data Structures

struct  ip_globals
 
struct  ip_pcb
 

Macros

#define ip6_current_dest_addr()   (ipX_2_ip6(&ip_data.current_iphdr_dest))
 Destination IPv6 address of current_header. More...
 
#define ip6_current_header()   (ip_data.current_ip6_header)
 Get the IPv6 header of the current packet. More...
 
#define ip6_current_src_addr()   (ipX_2_ip6(&ip_data.current_iphdr_src))
 Source IPv6 address of current_header. More...
 
#define ip_current_dest_addr()   (ipX_2_ip(&ip_data.current_iphdr_dest))
 Destination IP4 address of current_header. More...
 
#define ip_current_header()   (ip_data.current_ip4_header)
 Get the IP header of the current packet. More...
 
#define ip_current_header_proto()
 Get the transport layer protocol. More...
 
#define ip_current_header_tot_len()   (ip_data.current_ip_header_tot_len)
 Total header length of ip(6)_current_header() (i.e. More...
 
#define ip_current_is_v6()   (ip6_current_header() != NULL)
 Returns TRUE if the current IP input packet is IPv6, FALSE if it is IPv4. More...
 
#define ip_current_netif()   (ip_data.current_netif)
 Get the interface that received the current packet. More...
 
#define ip_current_src_addr()   (ipX_2_ip(&ip_data.current_iphdr_src))
 Source IP4 address of current_header. More...
 
#define ip_get_option(pcb, opt)   ((pcb)->so_options & (opt))
 Gets an IP pcb option (SOF_* flags) More...
 
#define IP_HDRINCL   NULL
 
#define IP_PCB
 
#define IP_PCB_ADDRHINT
 
#define IP_PCB_IPVER_EQ(pcb1, pcb2)   ((pcb1)->isipv6 == (pcb2)->isipv6)
 
#define IP_PCB_IPVER_INPUT_MATCH(pcb)
 
#define IP_PCB_ISIPV6_MEMBER   u8_t isipv6;
 
#define ip_reset_option(pcb, opt)   ((pcb)->so_options &= ~(opt))
 Resets an IP pcb option (SOF_* flags) More...
 
#define ip_set_option(pcb, opt)   ((pcb)->so_options |= (opt))
 Sets an IP pcb option (SOF_* flags) More...
 
#define ip_set_v6(pcb, val)   do{if(pcb != NULL) { pcb->isipv6 = val; }}while(0)
 Set an IP_PCB to IPv6 (IPv4 is the default) More...
 
#define ipX_current_dest_addr()   (&ip_data.current_iphdr_dest)
 Destination IP address of current_header. More...
 
#define ipX_current_dest_addr()   (&ip_data.current_iphdr_dest)
 Destination IP address of current_header. More...
 
#define ipX_current_src_addr()   (&ip_data.current_iphdr_src)
 Source IP address of current_header. More...
 
#define ipX_current_src_addr()   (&ip_data.current_iphdr_src)
 Source IP address of current_header. More...
 
#define ipX_debug_print(is_ipv6, p)   ((is_ipv6) ? ip6_debug_print(p) : ip_debug_print(p))
 
#define ipX_netif_get_local_ipX(isipv6, netif, dest)
 
#define ipX_next_header_ptr()
 Get the transport layer header. More...
 
#define ipX_output(isipv6, p, src, dest, ttl, tos, proto)
 
#define ipX_output_hinted(isipv6, p, src, dest, ttl, tos, proto, addr_hint)
 
#define ipX_output_if(isipv6, p, src, dest, ttl, tos, proto, netif)
 
#define ipX_output_if_src(isipv6, p, src, dest, ttl, tos, proto, netif)
 
#define ipX_route(isipv6, src, dest)
 
#define ipX_route_get_local_ipX(isipv6, src, dest, netif, ipXaddr)
 
#define LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p)   LWIP_ASSERT("p->ref == 1", (p)->ref == 1)
 pbufs passed to IP must have a ref-count of 1 as their payload pointer gets altered as the packet is passed down the stack More...
 
#define PCB_ISIPV6(pcb)   ((pcb)->isipv6)
 
#define SOF_BROADCAST   0x20U /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */
 
#define SOF_INHERITED   (SOF_REUSEADDR|SOF_KEEPALIVE)
 
#define SOF_KEEPALIVE   0x08U /* keep connections alive */
 
#define SOF_REUSEADDR   0x04U /* allow local address reuse */
 

Variables

struct ip_globals ip_data
 Global data for both IPv4 and IPv6. More...
 

#define ip6_current_dest_addr ( )    (ipX_2_ip6(&ip_data.current_iphdr_dest))

Destination IPv6 address of current_header.

Referenced by icmp6_input(), ip6_input(), ip6_reass(), mld6_input(), nd6_input(), nd6_send_q(), and udp_input().

#define ip6_current_header ( )    (ip_data.current_ip6_header)

Get the IPv6 header of the current packet.

This function must only be called from a receive callback (udp_recv, raw_recv, tcp_accept). It will return NULL otherwise.

Referenced by ip6_reass().

#define ip6_current_src_addr ( )    (ipX_2_ip6(&ip_data.current_iphdr_src))
#define ip_current_dest_addr ( )    (ipX_2_ip(&ip_data.current_iphdr_dest))

Destination IP4 address of current_header.

Referenced by icmp_input(), ip_input(), raw_input(), tcp_input(), and udp_input().

#define ip_current_header ( )    (ip_data.current_ip4_header)

Get the IP header of the current packet.

This function must only be called from a receive callback (udp_recv, raw_recv, tcp_accept). It will return NULL otherwise.

Referenced by icmp_input(), and udp_input().

#define ip_current_header_proto ( )
Value:
#define ip_current_is_v6()
Returns TRUE if the current IP input packet is IPv6, FALSE if it is IPv4.
Definition: ip.h:158
#define ip6_current_header()
Get the IPv6 header of the current packet.
Definition: ip.h:156
#define IP6H_NEXTH(hdr)
Definition: ip6.h:154
#define ip_current_header()
Get the IP header of the current packet.
Definition: ip.h:144
#define IPH_PROTO(hdr)
Definition: ip4.h:101

Get the transport layer protocol.

Referenced by udp_input().

#define ip_current_header_tot_len ( )    (ip_data.current_ip_header_tot_len)

Total header length of ip(6)_current_header() (i.e.

after this, the UDP/TCP header starts)

Referenced by udp_input().

#define ip_current_is_v6 ( )    (ip6_current_header() != NULL)

Returns TRUE if the current IP input packet is IPv6, FALSE if it is IPv4.

Referenced by recv_udp(), tcp_input(), tcp_listen_input(), tcp_process(), tcp_timewait_input(), and udp_input().

#define ip_current_netif ( )    (ip_data.current_netif)

Get the interface that received the current packet.

This function must only be called from a receive callback (udp_recv, raw_recv, tcp_accept). It will return NULL otherwise.

Referenced by icmp6_send_response().

#define ip_current_src_addr ( )    (ipX_2_ip(&ip_data.current_iphdr_src))

Source IP4 address of current_header.

Referenced by icmp_input(), ip_input(), raw_input(), and udp_input().

#define ip_get_option (   pcb,
  opt 
)    ((pcb)->so_options & (opt))
#define IP_HDRINCL   NULL
#define IP_PCB
Value:
/* ip addresses in network byte order */ \
ipX_addr_t local_ip; \
ipX_addr_t remote_ip; \
/* Socket options */ \
u8_t so_options; \
/* Type Of Service */ \
u8_t tos; \
/* Time To Live */ \
u8_t ttl \
/* link layer address resolution hint */ \
unsigned char u8_t
Definition: cc.h:47
#define IP_PCB_ISIPV6_MEMBER
Definition: ip.h:70
#define IP_PCB_ADDRHINT
Definition: ip.h:66
#define IP_PCB_ADDRHINT
#define IP_PCB_IPVER_EQ (   pcb1,
  pcb2 
)    ((pcb1)->isipv6 == (pcb2)->isipv6)
#define IP_PCB_IPVER_INPUT_MATCH (   pcb)
Value:
((pcb)->isipv6 != 0) : \
((pcb)->isipv6 == 0))
#define ip_current_is_v6()
Returns TRUE if the current IP input packet is IPv6, FALSE if it is IPv4.
Definition: ip.h:158

Referenced by raw_input(), tcp_input(), and udp_input().

#define IP_PCB_ISIPV6_MEMBER   u8_t isipv6;
#define ip_reset_option (   pcb,
  opt 
)    ((pcb)->so_options &= ~(opt))

Resets an IP pcb option (SOF_* flags)

Referenced by lwip_setsockopt_impl().

#define ip_set_option (   pcb,
  opt 
)    ((pcb)->so_options |= (opt))

Sets an IP pcb option (SOF_* flags)

Referenced by dhcp_inform(), dhcp_start(), and lwip_setsockopt_impl().

#define ip_set_v6 (   pcb,
  val 
)    do{if(pcb != NULL) { pcb->isipv6 = val; }}while(0)

Set an IP_PCB to IPv6 (IPv4 is the default)

Referenced by pcb_new(), raw_new_ip6(), tcp_new_ip6(), and udp_new_ip6().

#define ipX_current_dest_addr ( )    (&ip_data.current_iphdr_dest)

Destination IP address of current_header.

Union destination address of current_header.

Referenced by raw_input(), recv_udp(), tcp_input(), tcp_listen_input(), tcp_process(), tcp_timewait_input(), and udp_input().

#define ipX_current_dest_addr ( )    (&ip_data.current_iphdr_dest)

Destination IP address of current_header.

Union destination address of current_header.

#define ipX_current_src_addr ( )    (&ip_data.current_iphdr_src)

Source IP address of current_header.

Union source address of current_header.

Referenced by recv_raw(), tcp_input(), tcp_listen_input(), tcp_process(), tcp_timewait_input(), and udp_input().

#define ipX_current_src_addr ( )    (&ip_data.current_iphdr_src)

Source IP address of current_header.

Union source address of current_header.

#define ipX_debug_print (   is_ipv6,
 
)    ((is_ipv6) ? ip6_debug_print(p) : ip_debug_print(p))
#define ipX_netif_get_local_ipX (   isipv6,
  netif,
  dest 
)
Value:
((isipv6) ? \
#define ip6_netif_get_local_ipX(netif, dest)
Definition: ip6.h:182
Generic data structure used for all lwIP network interfaces.
Definition: netif.h:160
#define ipX_2_ip6(ip6addr)
Definition: ip_addr.h:69
#define ip_netif_get_local_ipX(netif)
Definition: ip4.h:136

Referenced by raw_sendto().

#define ipX_next_header_ptr ( )
Value:
((void*)((ip_current_is_v6() ? \
#define ip_current_is_v6()
Returns TRUE if the current IP input packet is IPv6, FALSE if it is IPv4.
Definition: ip.h:158
#define ip_current_header_tot_len()
Total header length of ip(6)_current_header() (i.e.
Definition: ip.h:146
#define ip6_current_header()
Get the IPv6 header of the current packet.
Definition: ip.h:156
#define ip_current_header()
Get the IP header of the current packet.
Definition: ip.h:144
unsigned char u8_t
Definition: cc.h:47

Get the transport layer header.

Referenced by recv_udp().

#define ipX_output (   isipv6,
  p,
  src,
  dest,
  ttl,
  tos,
  proto 
)
Value:
((isipv6) ? \
ip6_output(p, ipX_2_ip6(src), ipX_2_ip6(dest), ttl, tos, proto) : \
ip_output(p, ipX_2_ip(src), ipX_2_ip(dest), ttl, tos, proto))
#define ipX_2_ip(ipaddr)
Definition: ip_addr.h:70
err_t ip6_output(struct pbuf *p, ip6_addr_t *src, ip6_addr_t *dest, u8_t hl, u8_t tc, u8_t nexth)
Simple interface to ip6_output_if.
Definition: ip6.c:861
#define ipX_2_ip6(ip6addr)
Definition: ip_addr.h:69
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.
Definition: ip4.c:863

Referenced by tcp_keepalive(), tcp_output_segment(), tcp_rst_impl(), tcp_send_empty_ack(), and tcp_zero_window_probe().

#define ipX_output_hinted (   isipv6,
  p,
  src,
  dest,
  ttl,
  tos,
  proto,
  addr_hint 
)
Value:
((isipv6) ? \
ip6_output_hinted(p, ipX_2_ip6(src), ipX_2_ip6(dest), ttl, tos, proto, addr_hint) : \
ip_output_hinted(p, ipX_2_ip(src), ipX_2_ip(dest), ttl, tos, proto, addr_hint))
#define ipX_2_ip(ipaddr)
Definition: ip_addr.h:70
#define ipX_2_ip6(ip6addr)
Definition: ip_addr.h:69

Referenced by tcp_keepalive(), tcp_output_segment(), tcp_send_empty_ack(), and tcp_zero_window_probe().

#define ipX_output_if (   isipv6,
  p,
  src,
  dest,
  ttl,
  tos,
  proto,
  netif 
)
Value:
((isipv6) ? \
ip6_output_if(p, ip_2_ip6(src), ip_2_ip6(dest), ttl, tos, proto, netif) : \
ip_output_if(p, (src), (dest), ttl, tos, proto, netif))
err_t ip6_output_if(struct pbuf *p, ip6_addr_t *src, ip6_addr_t *dest, u8_t hl, u8_t tc, u8_t nexth, struct netif *netif)
Sends an IPv6 packet on a network interface.
Definition: ip6.c:745
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.
Definition: ip4.c:651
Generic data structure used for all lwIP network interfaces.
Definition: netif.h:160
#define ip_2_ip6(ipaddr)
These functions only exist for type-safe conversion from ip_addr_t to ip6_addr_t and back...
Definition: ip_addr.h:64

Referenced by raw_sendto().

#define ipX_output_if_src (   isipv6,
  p,
  src,
  dest,
  ttl,
  tos,
  proto,
  netif 
)
Value:
((isipv6) ? \
ip6_output_if_src(p, ip_2_ip6(src), ip_2_ip6(dest), ttl, tos, proto, netif) : \
ip_output_if_src(p, (src), (dest), ttl, tos, proto, netif))
err_t ip6_output_if_src(struct pbuf *p, ip6_addr_t *src, ip6_addr_t *dest, u8_t hl, u8_t tc, u8_t nexth, struct netif *netif)
Same as ip6_output_if() but 'src' address is not replaced by netif address when it is 'any'...
Definition: ip6.c:769
Generic data structure used for all lwIP network interfaces.
Definition: netif.h:160
err_t ip_output_if_src(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto, struct netif *netif)
Same as ip_output_if() but 'src' address is not replaced by netif address when it is 'any'...
Definition: ip4.c:690
#define ip_2_ip6(ipaddr)
These functions only exist for type-safe conversion from ip_addr_t to ip6_addr_t and back...
Definition: ip_addr.h:64
#define ipX_route (   isipv6,
  src,
  dest 
)
Value:
((isipv6) ? \
ip6_route(ipX_2_ip6(src), ipX_2_ip6(dest)) : \
#define ipX_2_ip(ipaddr)
Definition: ip_addr.h:70
struct netif * ip6_route(struct ip6_addr *src, struct ip6_addr *dest)
Finds the appropriate network interface for a given IPv6 address.
Definition: ip6.c:81
#define ipX_2_ip6(ip6addr)
Definition: ip_addr.h:69
struct netif * ip_route(ip_addr_t *dest)
Finds the appropriate network interface for a given IP address.
Definition: ip4.c:112

Referenced by raw_sendto(), and tcp_eff_send_mss_impl().

#define ipX_route_get_local_ipX (   isipv6,
  src,
  dest,
  netif,
  ipXaddr 
)
Value:
do { \
(netif) = ipX_route(isipv6, src, dest); \
(ipXaddr) = ipX_netif_get_local_ipX(isipv6, netif, dest); \
}while(0)
#define ipX_netif_get_local_ipX(isipv6, netif, dest)
Definition: ip.h:227
Generic data structure used for all lwIP network interfaces.
Definition: netif.h:160
#define ipX_route(isipv6, src, dest)
Definition: ip.h:223

Referenced by tcp_connect(), and tcp_output_segment().

#define LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX (   p)    LWIP_ASSERT("p->ref == 1", (p)->ref == 1)

pbufs passed to IP must have a ref-count of 1 as their payload pointer gets altered as the packet is passed down the stack

Referenced by ip6_output(), ip6_output_if_src(), and ip_output().

#define SOF_BROADCAST   0x20U /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */
#define SOF_INHERITED   (SOF_REUSEADDR|SOF_KEEPALIVE)

Referenced by tcp_listen_input().

#define SOF_KEEPALIVE   0x08U /* keep connections alive */

Referenced by tcp_slowtmr().

#define SOF_REUSEADDR   0x04U /* allow local address reuse */

struct ip_globals ip_data

Global data for both IPv4 and IPv6.

Referenced by ip6_input(), and ip_input().