lwIP  2.1.2
Lightweight IP stack
IP address handling

Modules

 IPv4 only
 
 IPv6 only
 

Data Structures

struct  ip_addr
 

Typedefs

typedef struct ip_addr ip_addr_t
 

Enumerations

enum  lwip_ip_addr_type { IPADDR_TYPE_V4 = 0U, IPADDR_TYPE_V6 = 6U, IPADDR_TYPE_ANY = 46U }
 

Functions

char * ipaddr_ntoa (const ip_addr_t *addr)
 
char * ipaddr_ntoa_r (const ip_addr_t *addr, char *buf, int buflen)
 
int ipaddr_aton (const char *cp, ip_addr_t *addr)
 

Detailed Description

Typedef Documentation

◆ ip_addr_t

typedef struct ip_addr ip_addr_t

A union struct for both IP version's addresses. ATTENTION: watch out for its size when adding IPv6 address scope!

Enumeration Type Documentation

◆ lwip_ip_addr_type

IP address types for use in ip_addr_t.type member.

See also
tcp_new_ip_type(), udp_new_ip_type(), raw_new_ip_type().
Enumerator
IPADDR_TYPE_V4 

IPv4

IPADDR_TYPE_V6 

IPv6

IPADDR_TYPE_ANY 

IPv4+IPv6 ("dual-stack")

Function Documentation

◆ ipaddr_aton()

int ipaddr_aton ( const char *  cp,
ip_addr_t addr 
)

Convert IP address string (both versions) to numeric. The version is auto-detected from the string.

Parameters
cpIP address string to convert
addrconversion result is stored here
Returns
1 on success, 0 on error

◆ ipaddr_ntoa()

char* ipaddr_ntoa ( const ip_addr_t addr)

Convert numeric IP address (both versions) into ASCII representation. returns ptr to static buffer; not reentrant!

Parameters
addrip address in network order to convert
Returns
pointer to a global static (!) buffer that holds the ASCII representation of addr

◆ ipaddr_ntoa_r()

char* ipaddr_ntoa_r ( const ip_addr_t addr,
char *  buf,
int  buflen 
)

Same as ipaddr_ntoa, but reentrant since a user-supplied buffer is used.

Parameters
addrip address in network order to convert
buftarget buffer where the string is stored
buflenlength of buf
Returns
either pointer to buf which now holds the ASCII representation of addr or NULL if buf was too small