mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-26 03:16:18 +00:00
patch #8021 Add INET[6]_ADDRSTRLEN Preprocessor Definitions If Not Previously Defined
This commit is contained in:
parent
29824f9baa
commit
db472c73c1
@ -94,6 +94,15 @@ struct in_addr {
|
|||||||
|
|
||||||
#define IN_LOOPBACKNET IP_LOOPBACKNET
|
#define IN_LOOPBACKNET IP_LOOPBACKNET
|
||||||
|
|
||||||
|
#ifndef INET_ADDRSTRLEN
|
||||||
|
#define INET_ADDRSTRLEN IP4ADDR_STRLEN_MAX
|
||||||
|
#endif
|
||||||
|
#if LWIP_IPV6
|
||||||
|
#ifndef INET6_ADDRSTRLEN
|
||||||
|
#define INET6_ADDRSTRLEN IP6ADDR_STRLEN_MAX
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define inet_addr_from_ipaddr(target_inaddr, source_ipaddr) ((target_inaddr)->s_addr = ip4_addr_get_u32(source_ipaddr))
|
#define inet_addr_from_ipaddr(target_inaddr, source_ipaddr) ((target_inaddr)->s_addr = ip4_addr_get_u32(source_ipaddr))
|
||||||
#define inet_addr_to_ipaddr(target_ipaddr, source_inaddr) (ip4_addr_set_u32(target_ipaddr, (source_inaddr)->s_addr))
|
#define inet_addr_to_ipaddr(target_ipaddr, source_inaddr) (ip4_addr_set_u32(target_ipaddr, (source_inaddr)->s_addr))
|
||||||
/* ATTENTION: the next define only works because both s_addr and ip_addr_t are an u32_t effectively! */
|
/* ATTENTION: the next define only works because both s_addr and ip_addr_t are an u32_t effectively! */
|
||||||
|
@ -228,6 +228,9 @@ u8_t ip4_addr_netmask_valid(u32_t netmask);
|
|||||||
#define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr))
|
#define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr))
|
||||||
#define ip4_addr4_16(ipaddr) ((u16_t)ip4_addr4(ipaddr))
|
#define ip4_addr4_16(ipaddr) ((u16_t)ip4_addr4(ipaddr))
|
||||||
|
|
||||||
|
#define IP4ADDR_STRLEN_MAX 16
|
||||||
|
#define IPADDR_STRLEN_MAX IP4ADDR_STRLEN_MAX
|
||||||
|
|
||||||
/** For backwards compatibility */
|
/** For backwards compatibility */
|
||||||
#define ip_ntoa(ipaddr) ipaddr_ntoa(ipaddr)
|
#define ip_ntoa(ipaddr) ipaddr_ntoa(ipaddr)
|
||||||
|
|
||||||
|
@ -85,8 +85,6 @@ extern const ip6_addr_t ip6_addr_any;
|
|||||||
#define IP6_ADDR_ANY ((ip6_addr_t *)&ip6_addr_any)
|
#define IP6_ADDR_ANY ((ip6_addr_t *)&ip6_addr_any)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if BYTE_ORDER == BIG_ENDIAN
|
#if BYTE_ORDER == BIG_ENDIAN
|
||||||
/** Set an IPv6 partial address given by byte-parts. */
|
/** Set an IPv6 partial address given by byte-parts. */
|
||||||
#define IP6_ADDR(ip6addr, index, a,b,c,d) \
|
#define IP6_ADDR(ip6addr, index, a,b,c,d) \
|
||||||
@ -146,7 +144,6 @@ Little-endian version, stored in network order (no htonl). */
|
|||||||
(dest)->addr[3] = (src) == NULL ? 0 : htonl((src)->addr[3]);}while(0)
|
(dest)->addr[3] = (src) == NULL ? 0 : htonl((src)->addr[3]);}while(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if two IPv6 address are on the same network.
|
* Determine if two IPv6 address are on the same network.
|
||||||
*
|
*
|
||||||
@ -264,7 +261,7 @@ Little-endian version, stored in network order (no htonl). */
|
|||||||
#define ip6_addr_isdeprecated(addr_state) (addr_state == IP6_ADDR_DEPRECATED)
|
#define ip6_addr_isdeprecated(addr_state) (addr_state == IP6_ADDR_DEPRECATED)
|
||||||
|
|
||||||
#define ip6_addr_debug_print(debug, ipaddr) \
|
#define ip6_addr_debug_print(debug, ipaddr) \
|
||||||
LWIP_DEBUGF(debug, ("%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F, \
|
LWIP_DEBUGF(debug, ("%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F ":%" X16_F, \
|
||||||
ipaddr != NULL ? IP6_ADDR_BLOCK1(ipaddr) : 0, \
|
ipaddr != NULL ? IP6_ADDR_BLOCK1(ipaddr) : 0, \
|
||||||
ipaddr != NULL ? IP6_ADDR_BLOCK2(ipaddr) : 0, \
|
ipaddr != NULL ? IP6_ADDR_BLOCK2(ipaddr) : 0, \
|
||||||
ipaddr != NULL ? IP6_ADDR_BLOCK3(ipaddr) : 0, \
|
ipaddr != NULL ? IP6_ADDR_BLOCK3(ipaddr) : 0, \
|
||||||
@ -274,6 +271,8 @@ Little-endian version, stored in network order (no htonl). */
|
|||||||
ipaddr != NULL ? IP6_ADDR_BLOCK7(ipaddr) : 0, \
|
ipaddr != NULL ? IP6_ADDR_BLOCK7(ipaddr) : 0, \
|
||||||
ipaddr != NULL ? IP6_ADDR_BLOCK8(ipaddr) : 0))
|
ipaddr != NULL ? IP6_ADDR_BLOCK8(ipaddr) : 0))
|
||||||
|
|
||||||
|
#define IP6ADDR_STRLEN_MAX 46
|
||||||
|
|
||||||
int ip6addr_aton(const char *cp, ip6_addr_t *addr);
|
int ip6addr_aton(const char *cp, ip6_addr_t *addr);
|
||||||
/** returns ptr to static buffer; not reentrant! */
|
/** returns ptr to static buffer; not reentrant! */
|
||||||
char *ip6addr_ntoa(const ip6_addr_t *addr);
|
char *ip6addr_ntoa(const ip6_addr_t *addr);
|
||||||
|
Loading…
Reference in New Issue
Block a user