diff --git a/src/core/raw.c b/src/core/raw.c index a3a90778..244ab40a 100644 --- a/src/core/raw.c +++ b/src/core/raw.c @@ -471,7 +471,7 @@ raw_new(u8_t proto) * @return The RAW PCB which was created. NULL if the PCB data structure * could not be allocated. * - * @param type IP address type, see IPADDR_TYPE_XX definitions. + * @param type IP address type, see @ref lwip_ip_addr_type definitions. * If you want to listen to IPv4 and IPv6 (dual-stack) packets, * supply @ref IPADDR_TYPE_ANY as argument and bind to @ref IP_ANY_TYPE. * @param proto the protocol number (next header) of the IPv6 packet payload diff --git a/src/core/tcp.c b/src/core/tcp.c index 50aa31f2..9c31f4b8 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -1602,7 +1602,7 @@ tcp_new(void) * place it on any of the TCP PCB lists. * The pcb is not put on any list until binding using tcp_bind(). * - * @param type IP address type, see IPADDR_TYPE_XX definitions. + * @param type IP address type, see @ref lwip_ip_addr_type definitions. * If you want to listen to IPv4 and IPv6 (dual-stack) connections, * supply @ref IPADDR_TYPE_ANY as argument and bind to @ref IP_ANY_TYPE. * @return a new tcp_pcb that initially is in state CLOSED diff --git a/src/core/udp.c b/src/core/udp.c index 20e97da6..34fbdd14 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -1143,7 +1143,7 @@ udp_new(void) * @ingroup udp_raw * Create a UDP PCB for specific IP type. * - * @param type IP address type, see IPADDR_TYPE_XX definitions. + * @param type IP address type, see @ref lwip_ip_addr_type definitions. * If you want to listen to IPv4 and IPv6 (dual-stack) packets, * supply @ref IPADDR_TYPE_ANY as argument and bind to @ref IP_ANY_TYPE. * @return The UDP PCB which was created. NULL if the PCB data structure diff --git a/src/include/lwip/ip_addr.h b/src/include/lwip/ip_addr.h index 4b13e702..864f12f9 100644 --- a/src/include/lwip/ip_addr.h +++ b/src/include/lwip/ip_addr.h @@ -47,14 +47,18 @@ extern "C" { #endif -/** Value for ip_addr_t.type: IPv4 */ -#define IPADDR_TYPE_V4 0U -/** Value for ip_addr_t.type: IPv6 */ -#define IPADDR_TYPE_V6 6U -/** Value for ip_addr_t.type: IPv4+IPv6 ("dual-stack") +/** @ingroup ipaddr + * IP address types for use in ip_addr_t.type member. * @see tcp_new_ip_type(), udp_new_ip_type(), raw_new_ip_type(). */ -#define IPADDR_TYPE_ANY 46U +enum lwip_ip_addr_type { + /** IPv4 */ + IPADDR_TYPE_V4 = 0U, + /** IPv6 */ + IPADDR_TYPE_V6 = 6U, + /** IPv4+IPv6 ("dual-stack") */ + IPADDR_TYPE_ANY = 46U +}; #if LWIP_IPV4 && LWIP_IPV6 /** @@ -67,6 +71,7 @@ typedef struct _ip_addr { ip6_addr_t ip6; ip4_addr_t ip4; } u_addr; + /** @ref lwip_ip_addr_type */ u8_t type; } ip_addr_t;