40 #ifndef LWIP_HDR_INET_H
41 #define LWIP_HDR_INET_H
54 #if !defined(in_addr_t) && !defined(IN_ADDR_T_DEFINED)
67 #define s6_addr un.u8_addr
71 #define INADDR_NONE IPADDR_NONE
73 #define INADDR_LOOPBACK IPADDR_LOOPBACK
75 #define INADDR_ANY IPADDR_ANY
77 #define INADDR_BROADCAST IPADDR_BROADCAST
81 #define IN6ADDR_ANY_INIT {{{0,0,0,0}}}
84 #define IN6ADDR_LOOPBACK_INIT {{{0,0,0,PP_HTONL(1)}}}
92 #define IN_CLASSA(a) IP_CLASSA(a)
93 #define IN_CLASSA_NET IP_CLASSA_NET
94 #define IN_CLASSA_NSHIFT IP_CLASSA_NSHIFT
95 #define IN_CLASSA_HOST IP_CLASSA_HOST
96 #define IN_CLASSA_MAX IP_CLASSA_MAX
98 #define IN_CLASSB(b) IP_CLASSB(b)
99 #define IN_CLASSB_NET IP_CLASSB_NET
100 #define IN_CLASSB_NSHIFT IP_CLASSB_NSHIFT
101 #define IN_CLASSB_HOST IP_CLASSB_HOST
102 #define IN_CLASSB_MAX IP_CLASSB_MAX
104 #define IN_CLASSC(c) IP_CLASSC(c)
105 #define IN_CLASSC_NET IP_CLASSC_NET
106 #define IN_CLASSC_NSHIFT IP_CLASSC_NSHIFT
107 #define IN_CLASSC_HOST IP_CLASSC_HOST
108 #define IN_CLASSC_MAX IP_CLASSC_MAX
110 #define IN_CLASSD(d) IP_CLASSD(d)
111 #define IN_CLASSD_NET IP_CLASSD_NET
112 #define IN_CLASSD_NSHIFT IP_CLASSD_NSHIFT
113 #define IN_CLASSD_HOST IP_CLASSD_HOST
114 #define IN_CLASSD_MAX IP_CLASSD_MAX
116 #define IN_MULTICAST(a) IP_MULTICAST(a)
118 #define IN_EXPERIMENTAL(a) IP_EXPERIMENTAL(a)
119 #define IN_BADCLASS(a) IP_BADCLASS(a)
121 #define IN_LOOPBACKNET IP_LOOPBACKNET
124 #ifndef INET_ADDRSTRLEN
125 #define INET_ADDRSTRLEN IP4ADDR_STRLEN_MAX
128 #ifndef INET6_ADDRSTRLEN
129 #define INET6_ADDRSTRLEN IP6ADDR_STRLEN_MAX
135 #define inet_addr_from_ip4addr(target_inaddr, source_ipaddr) ((target_inaddr)->s_addr = ip4_addr_get_u32(source_ipaddr))
136 #define inet_addr_to_ip4addr(target_ipaddr, source_inaddr) (ip4_addr_set_u32(target_ipaddr, (source_inaddr)->s_addr))
139 #define inet_addr(cp) ipaddr_addr(cp)
140 #define inet_aton(cp, addr) ip4addr_aton(cp, (ip4_addr_t*)addr)
141 #define inet_ntoa(addr) ip4addr_ntoa((const ip4_addr_t*)&(addr))
142 #define inet_ntoa_r(addr, buf, buflen) ip4addr_ntoa_r((const ip4_addr_t*)&(addr), buf, buflen)
147 #define inet6_addr_from_ip6addr(target_in6addr, source_ip6addr) {(target_in6addr)->un.u32_addr[0] = (source_ip6addr)->addr[0]; \
148 (target_in6addr)->un.u32_addr[1] = (source_ip6addr)->addr[1]; \
149 (target_in6addr)->un.u32_addr[2] = (source_ip6addr)->addr[2]; \
150 (target_in6addr)->un.u32_addr[3] = (source_ip6addr)->addr[3];}
151 #define inet6_addr_to_ip6addr(target_ip6addr, source_in6addr) {(target_ip6addr)->addr[0] = (source_in6addr)->un.u32_addr[0]; \
152 (target_ip6addr)->addr[1] = (source_in6addr)->un.u32_addr[1]; \
153 (target_ip6addr)->addr[2] = (source_in6addr)->un.u32_addr[2]; \
154 (target_ip6addr)->addr[3] = (source_in6addr)->un.u32_addr[3]; \
155 ip6_addr_clear_zone(target_ip6addr);}
158 #define inet6_aton(cp, addr) ip6addr_aton(cp, (ip6_addr_t*)addr)
159 #define inet6_ntoa(addr) ip6addr_ntoa((const ip6_addr_t*)&(addr))
160 #define inet6_ntoa_r(addr, buf, buflen) ip6addr_ntoa_r((const ip6_addr_t*)&(addr), buf, buflen)
uint32_t u32_t
Definition: arch.h:129
uint8_t u8_t
Definition: arch.h:125
u32_t in_addr_t
Definition: inet.h:55
const struct in6_addr in6addr_any
u32_t u32_addr[4]
Definition: inet.h:64
u8_t u8_addr[16]
Definition: inet.h:65
in_addr_t s_addr
Definition: inet.h:59