Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

IP address handling

Data Structures

struct  ip_addr
 A union struct for both IP version's addresses. More...

Modules

 IPv4 only
 IPv6 only

Typedefs

typedef struct ip_addr ip_addr_t
 A union struct for both IP version's addresses.

Enumerations

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

IP address types for use in ip_addr_t.type member.

More...

Functions

char * ipaddr_ntoa (const ip_addr_t *addr)
 Convert numeric IP address (both versions) into ASCII representation.
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.
int ipaddr_aton (const char *cp, ip_addr_t *addr)
 Convert IP address string (both versions) to numeric.

Typedef Documentation

A union struct for both IP version's addresses.

ATTENTION: watch out for its size when adding IPv6 address scope!

Definition at line 270 of file ip_addr.h.


Enumeration Type Documentation

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")

Definition at line 54 of file ip_addr.h.


Function Documentation

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

Definition at line 123 of file lwip_ip.c.

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

Definition at line 79 of file lwip_ip.c.

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

Definition at line 101 of file lwip_ip.c.