Convert IP address type numbers to an enum to improve documentation

This commit is contained in:
Dirk Ziegelmeier 2016-09-27 09:46:51 +02:00
parent 97b774ceb9
commit 6abcd00f71
4 changed files with 14 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;