38 #include "lwip/pbuf.h"
39 #include "lwip/ip_addr.h"
41 #include "lwip/netif.h"
48 #define IP_OPTIONS_SEND LWIP_IGMP
52 #define IP_PROTO_ICMP 1
53 #define IP_PROTO_IGMP 2
54 #define IP_PROTO_UDP 17
55 #define IP_PROTO_UDPLITE 136
56 #define IP_PROTO_TCP 6
64 #define IP_HDRINCL NULL
66 #if LWIP_NETIF_HWADDRHINT
67 #define IP_PCB_ADDRHINT ;u8_t addr_hint
69 #define IP_PCB_ADDRHINT
79 ip_addr_t remote_ip; \
98 #define SOF_ACCEPTCONN (u8_t)0x02U
99 #define SOF_REUSEADDR (u8_t)0x04U
100 #define SOF_KEEPALIVE (u8_t)0x08U
102 #define SOF_BROADCAST (u8_t)0x20U
104 #define SOF_LINGER (u8_t)0x80U
109 #define SOF_INHERITED (SOF_REUSEADDR|SOF_KEEPALIVE|SOF_LINGER)
112 #ifdef PACK_STRUCT_USE_INCLUDES
113 # include "arch/bpstruct.h"
128 #define IP_OFFMASK 0x1fff
138 } PACK_STRUCT_STRUCT;
140 #ifdef PACK_STRUCT_USE_INCLUDES
141 # include "arch/epstruct.h"
144 #define IPH_V(hdr) (ntohs((hdr)->_v_hl_tos) >> 12)
145 #define IPH_HL(hdr) ((ntohs((hdr)->_v_hl_tos) >> 8) & 0x0f)
146 #define IPH_TOS(hdr) (ntohs((hdr)->_v_hl_tos) & 0xff)
147 #define IPH_LEN(hdr) ((hdr)->_len)
148 #define IPH_ID(hdr) ((hdr)->_id)
149 #define IPH_OFFSET(hdr) ((hdr)->_offset)
150 #define IPH_TTL(hdr) ((hdr)->_ttl)
151 #define IPH_PROTO(hdr) ((hdr)->_proto)
152 #define IPH_CHKSUM(hdr) ((hdr)->_chksum)
154 #define IPH_VHLTOS_SET(hdr, v, hl, tos) (hdr)->_v_hl_tos = (htons(((v) << 12) | ((hl) << 8) | (tos)))
155 #define IPH_LEN_SET(hdr, len) (hdr)->_len = (len)
156 #define IPH_ID_SET(hdr, id) (hdr)->_id = (id)
157 #define IPH_OFFSET_SET(hdr, off) (hdr)->_offset = (off)
158 #define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl = (u8_t)(ttl)
159 #define IPH_PROTO_SET(hdr, proto) (hdr)->_proto = (u8_t)(proto)
160 #define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum)
163 extern struct netif *current_netif;
165 extern const struct ip_hdr *current_header;
167 extern ip_addr_t current_iphdr_src;
169 extern ip_addr_t current_iphdr_dest;
172 struct netif *ip_route(ip_addr_t *dest)ICACHE_FLASH_ATTR;
173 struct netif *ip_router(ip_addr_t *dest, ip_addr_t *source);
175 err_t ip_input(
struct pbuf *p,
struct netif *inp)ICACHE_FLASH_ATTR;
176 err_t ip_output(
struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
177 u8_t ttl, u8_t tos, u8_t proto)ICACHE_FLASH_ATTR;
178 err_t ip_output_if(
struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
179 u8_t ttl, u8_t tos, u8_t proto,
181 #if LWIP_NETIF_HWADDRHINT
182 err_t ip_output_hinted(
struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
183 u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint)ICACHE_FLASH_ATTR;
186 err_t ip_output_if_opt(
struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
187 u8_t ttl, u8_t tos, u8_t proto,
struct netif *
netif,
void *ip_options,
188 u16_t optlen)ICACHE_FLASH_ATTR;
193 #define ip_current_netif() (current_netif)
197 #define ip_current_header() (current_header)
199 #define ip_current_src_addr() (¤t_iphdr_src)
201 #define ip_current_dest_addr() (¤t_iphdr_dest)
204 void ip_debug_print(
struct pbuf *p)ICACHE_FLASH_ATTR;
206 #define ip_debug_print(p)
PACK_STRUCT_FIELD(u16_t _v_hl_tos)