Documentation

Documentation

Includes

lwip/opt.h

#include "lwip/opt.h"
#include "lwip/opt.h"

lwip/def.h

#include "lwip/def.h"
#include "lwip/def.h"

lwip/pbuf.h

#include "lwip/pbuf.h"
#include "lwip/pbuf.h"

lwip/ip_addr.h

#include "lwip/ip_addr.h"
#include "lwip/ip_addr.h"

lwip/err.h

#include "lwip/err.h"
#include "lwip/err.h"

lwip/netif.h

#include "lwip/netif.h"
#include "lwip/netif.h"

lwip/ip4.h

#include "lwip/ip4.h"
#include "lwip/ip4.h"

lwip/ip6.h

#include "lwip/ip6.h"
#include "lwip/ip6.h"

lwip/prot/ip.h

#include "lwip/prot/ip.h"
#include "lwip/prot/ip.h"

Macros

Marco LWIP_HDR_IP_H

#define LWIP_HDR_IP_H


      

Marco LWIP_IP_HDRINCL

#define LWIP_IP_HDRINCL NULL
/* This is passed as the destination address to ip_output_if (not
   to ip_output), meaning that an IP header already is constructed
   in the pbuf. This is used when TCP retransmits. */

Marco LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p)

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


      

Marco IP_PCB_NETIFHINT

#define IP_PCB_NETIFHINT ;struct netif_hint netif_hints


      

Marco IP_PCB_NETIFHINT

#define IP_PCB_NETIFHINT


      

Marco IP_PCB

#define IP_PCB                            \
 /* ip addresses in network byte order */ \
 ip_addr_t local_ip;                     \
 ip_addr_t remote_ip;                    \
 /* Bound netif index */                 \
 u8_t netif_idx;                         \
 /* Socket options */                    \
 u8_t so_options;                        \
 /* Type Of Service */                   \
 u8_t tos;                               \
 /* Time To Live */                      \
 u8_t ttl                                \
 /* link layer address resolution hint */ \
 IP_PCB_NETIFHINT
/** This is the common part of all PCB types. It needs to be at the
   beginning of a PCB type definition. It is located here so that
   changes to this common part are made in one location instead of
   having to change all PCB structs. */

Marco SOF_REUSEADDR

#define SOF_REUSEADDR    0x04U /* allow local address reuse */
/*
 * Option flags per-socket. These are the same like SO_XXX in sockets.h
 */

Marco SOF_KEEPALIVE

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


      

Marco SOF_BROADCAST

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


      

Marco SOF_INHERITED

#define SOF_INHERITED  (SOF_REUSEADDR|SOF_KEEPALIVE)
/* These flags are inherited (e.g. from a listen-pcb to a connection-pcb): */

Marco ip_current_netif()

#define ip_current_netif()     (ip_data.current_netif)
/** Get the interface that accepted the current packet.
 * This may or may not be the receiving netif, depending on your netif/network setup.
 * This function must only be called from a receive callback (udp_recv,
 * raw_recv, tcp_accept). It will return NULL otherwise. */

Marco ip_current_input_netif()

#define ip_current_input_netif() (ip_data.current_input_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. */

Marco ip_current_header_tot_len()

#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) */

Marco ip_current_src_addr()

#define ip_current_src_addr()  (&ip_data.current_iphdr_src)
/** Source IP address of current_header */

Marco ip_current_dest_addr()

#define ip_current_dest_addr() (&ip_data.current_iphdr_dest)
/** Destination IP address of current_header */

Marco ip4_current_header()

#define ip4_current_header()    ip_data.current_ip4_header
/** Get the IPv4 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. */

Marco ip6_current_header()

#define ip6_current_header()     ((const struct ip6_hdr*)(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. */

Marco ip_current_is_v6()

#define ip_current_is_v6()       (ip6_current_header() != NULL)
/** Returns TRUE if the current IP input packet is IPv6, FALSE if it is IPv4 */

Marco ip6_current_src_addr()

#define ip6_current_src_addr()   (ip_2_ip6(&ip_data.current_iphdr_src))
/** Source IPv6 address of current_header */

Marco ip6_current_dest_addr()

#define ip6_current_dest_addr()  (ip_2_ip6(&ip_data.current_iphdr_dest))
/** Destination IPv6 address of current_header */

Marco ip_current_header_proto()

#define ip_current_header_proto() (ip_current_is_v6() ? \
                                  IP6H_NEXTH(ip6_current_header()) :\
                                  IPH_PROTO(ip4_current_header()))
/** Get the transport layer protocol */

Marco ip_next_header_ptr()

#define ip_next_header_ptr()    ((const void*)((ip_current_is_v6() ? \
 (const u8_t*)ip6_current_header() : (const u8_t*)ip4_current_header()) + ip_current_header_tot_len()))
/** Get the transport layer header */

Marco ip4_current_src_addr()

#define ip4_current_src_addr()    (ip_2_ip4(&ip_data.current_iphdr_src))
/** Source IP4 address of current_header */

Marco ip4_current_dest_addr()

#define ip4_current_dest_addr()   (ip_2_ip4(&ip_data.current_iphdr_dest))
/** Destination IP4 address of current_header */

Marco ip4_current_header()

#define ip4_current_header()    ip_data.current_ip4_header
/** Get the IPv4 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. */

Marco ip_current_is_v6()

#define ip_current_is_v6()       0
/** Always returns FALSE when only supporting IPv4 only */

Marco ip_current_header_proto()

#define ip_current_header_proto() IPH_PROTO(ip4_current_header())
/** Get the transport layer protocol */

Marco ip_next_header_ptr()

#define ip_next_header_ptr()    ((const void*)((const u8_t*)ip4_current_header() + ip_current_header_tot_len()))
/** Get the transport layer header */

Marco ip4_current_src_addr()

#define ip4_current_src_addr()    (&ip_data.current_iphdr_src)
/** Source IP4 address of current_header */

Marco ip4_current_dest_addr()

#define ip4_current_dest_addr()   (&ip_data.current_iphdr_dest)
/** Destination IP4 address of current_header */

Marco ip6_current_header()

#define ip6_current_header()     ((const struct ip6_hdr*)(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. */

Marco ip_current_is_v6()

#define ip_current_is_v6()       1
/** Always returns TRUE when only supporting IPv6 only */

Marco ip_current_header_proto()

#define ip_current_header_proto() IP6H_NEXTH(ip6_current_header())
/** Get the transport layer protocol */

Marco ip_next_header_ptr()

#define ip_next_header_ptr()    ((const void*)(((const u8_t*)ip6_current_header()) + ip_current_header_tot_len()))
/** Get the transport layer header */

Marco ip6_current_src_addr()

#define ip6_current_src_addr()   (&ip_data.current_iphdr_src)
/** Source IP6 address of current_header */

Marco ip6_current_dest_addr()

#define ip6_current_dest_addr()  (&ip_data.current_iphdr_dest)
/** Destination IP6 address of current_header */

Marco ip_current_src_addr()

#define ip_current_src_addr()   (&ip_data.current_iphdr_src)
/** Union source address of current_header */

Marco ip_current_dest_addr()

#define ip_current_dest_addr()  (&ip_data.current_iphdr_dest)
/** Union destination address of current_header */

Marco ip_get_option(pcb, opt)

#define ip_get_option(pcb, opt)  ((pcb)->so_options & (opt))
/** Gets an IP pcb option (SOF_* flags) */

Marco ip_set_option(pcb, opt)

#define ip_set_option(pcb, opt)  ((pcb)->so_options = (u8_t)((pcb)->so_options | (opt)))
/** Sets an IP pcb option (SOF_* flags) */

Marco ip_reset_option(pcb, opt)

#define ip_reset_option(pcb, opt) ((pcb)->so_options = (u8_t)((pcb)->so_options & ~(opt)))
/** Resets an IP pcb option (SOF_* flags) */

Marco ip_output(p, src, dest, ttl, tos, proto)

#define ip_output(p, src, dest, ttl, tos, proto) \
       (IP_IS_V6(dest) ? \
       ip6_output(p, ip_2_ip6(src), ip_2_ip6(dest), ttl, tos, proto) : \
       ip4_output(p, ip_2_ip4(src), ip_2_ip4(dest), ttl, tos, proto))
/**
 * @ingroup ip
 * Output IP packet, netif is selected by source address
 */

Marco ip_output_if(p, src, dest, ttl, tos, proto, netif)

#define ip_output_if(p, src, dest, ttl, tos, proto, netif) \
       (IP_IS_V6(dest) ? \
       ip6_output_if(p, ip_2_ip6(src), ip_2_ip6(dest), ttl, tos, proto, netif) : \
       ip4_output_if(p, ip_2_ip4(src), ip_2_ip4(dest), ttl, tos, proto, netif))
/**
 * @ingroup ip
 * Output IP packet to specified interface
 */

Marco ip_output_if_src(p, src, dest, ttl, tos, proto, netif)

#define ip_output_if_src(p, src, dest, ttl, tos, proto, netif) \
       (IP_IS_V6(dest) ? \
       ip6_output_if_src(p, ip_2_ip6(src), ip_2_ip6(dest), ttl, tos, proto, netif) : \
       ip4_output_if_src(p, ip_2_ip4(src), ip_2_ip4(dest), ttl, tos, proto, netif))
/**
 * @ingroup ip
 * Output IP packet to interface specifying source address
 */

Marco ip_output_if_hdrincl(p, src, dest, netif)

#define ip_output_if_hdrincl(p, src, dest, netif) \
       (IP_IS_V6(dest) ? \
       ip6_output_if(p, ip_2_ip6(src), LWIP_IP_HDRINCL, 0, 0, 0, netif) : \
       ip4_output_if(p, ip_2_ip4(src), LWIP_IP_HDRINCL, 0, 0, 0, netif))
/** Output IP packet that already includes an IP header. */

Marco ip_output_hinted(p, src, dest, ttl, tos, proto, netif_hint)

#define ip_output_hinted(p, src, dest, ttl, tos, proto, netif_hint) \
       (IP_IS_V6(dest) ? \
       ip6_output_hinted(p, ip_2_ip6(src), ip_2_ip6(dest), ttl, tos, proto, netif_hint) : \
       ip4_output_hinted(p, ip_2_ip4(src), ip_2_ip4(dest), ttl, tos, proto, netif_hint))
/** Output IP packet with netif_hint */

Marco ip_route(src, dest)

#define ip_route(src, dest) \
       (IP_IS_V6(dest) ? \
       ip6_route(ip_2_ip6(src), ip_2_ip6(dest)) : \
       ip4_route_src(ip_2_ip4(src), ip_2_ip4(dest)))
/**
 * @ingroup ip
 * Get netif for address combination. See \ref ip6_route and \ref ip4_route
 */

Marco ip_netif_get_local_ip(netif, dest)

#define ip_netif_get_local_ip(netif, dest) (IP_IS_V6(dest) ? \
       ip6_netif_get_local_ip(netif, ip_2_ip6(dest)) : \
       ip4_netif_get_local_ip(netif))
/**
 * @ingroup ip
 * Get netif for IP.
 */

Marco ip_debug_print(is_ipv6, p)

#define ip_debug_print(is_ipv6, p) ((is_ipv6) ? ip6_debug_print(p) : ip4_debug_print(p))


      

Marco ip_output(p, src, dest, ttl, tos, proto)

#define ip_output(p, src, dest, ttl, tos, proto) \
       ip4_output(p, src, dest, ttl, tos, proto)


      

Marco ip_output_if(p, src, dest, ttl, tos, proto, netif)

#define ip_output_if(p, src, dest, ttl, tos, proto, netif) \
       ip4_output_if(p, src, dest, ttl, tos, proto, netif)


      

Marco ip_output_if_src(p, src, dest, ttl, tos, proto, netif)

#define ip_output_if_src(p, src, dest, ttl, tos, proto, netif) \
       ip4_output_if_src(p, src, dest, ttl, tos, proto, netif)


      

Marco ip_output_hinted(p, src, dest, ttl, tos, proto, netif_hint)

#define ip_output_hinted(p, src, dest, ttl, tos, proto, netif_hint) \
       ip4_output_hinted(p, src, dest, ttl, tos, proto, netif_hint)


      

Marco ip_output_if_hdrincl(p, src, dest, netif)

#define ip_output_if_hdrincl(p, src, dest, netif) \
       ip4_output_if(p, src, LWIP_IP_HDRINCL, 0, 0, 0, netif)


      

Marco ip_route(src, dest)

#define ip_route(src, dest) \
       ip4_route_src(src, dest)


      

Marco ip_netif_get_local_ip(netif, dest)

#define ip_netif_get_local_ip(netif, dest) \
       ip4_netif_get_local_ip(netif)


      

Marco ip_debug_print(is_ipv6, p)

#define ip_debug_print(is_ipv6, p) ip4_debug_print(p)


      

Marco ip_input

#define ip_input ip4_input


      

Marco ip_output(p, src, dest, ttl, tos, proto)

#define ip_output(p, src, dest, ttl, tos, proto) \
       ip6_output(p, src, dest, ttl, tos, proto)


      

Marco ip_output_if(p, src, dest, ttl, tos, proto, netif)

#define ip_output_if(p, src, dest, ttl, tos, proto, netif) \
       ip6_output_if(p, src, dest, ttl, tos, proto, netif)


      

Marco ip_output_if_src(p, src, dest, ttl, tos, proto, netif)

#define ip_output_if_src(p, src, dest, ttl, tos, proto, netif) \
       ip6_output_if_src(p, src, dest, ttl, tos, proto, netif)


      

Marco ip_output_hinted(p, src, dest, ttl, tos, proto, netif_hint)

#define ip_output_hinted(p, src, dest, ttl, tos, proto, netif_hint) \
       ip6_output_hinted(p, src, dest, ttl, tos, proto, netif_hint)


      

Marco ip_output_if_hdrincl(p, src, dest, netif)

#define ip_output_if_hdrincl(p, src, dest, netif) \
       ip6_output_if(p, src, LWIP_IP_HDRINCL, 0, 0, 0, netif)


      

Marco ip_route(src, dest)

#define ip_route(src, dest) \
       ip6_route(src, dest)


      

Marco ip_netif_get_local_ip(netif, dest)

#define ip_netif_get_local_ip(netif, dest) \
       ip6_netif_get_local_ip(netif, dest)


      

Marco ip_debug_print(is_ipv6, p)

#define ip_debug_print(is_ipv6, p) ip6_debug_print(p)


      

Marco ip_input

#define ip_input ip6_input


      

Marco ip_route_get_local_ip(src, dest, netif, ipaddr)

#define ip_route_get_local_ip(src, dest, netif, ipaddr) do { \
 (netif) = ip_route(src, dest); \
 (ipaddr) = ip_netif_get_local_ip(netif, dest); \
}while(0)

      

Functions

Func ip_input

err_t ip_input(struct pbuf *p, struct netif *inp);

      

Vars

Consts

Types

Typedefs