lwIP  2.1.0
Lightweight IP stack
ip6_addr.c File Reference
#include "lwip/opt.h"
#include "lwip/ip_addr.h"
#include "lwip/def.h"
#include <string.h>
#include "lwip/ip4_addr.h"

Functions

int ip6addr_aton (const char *cp, ip6_addr_t *addr)
 
char * ip6addr_ntoa (const ip6_addr_t *addr)
 
char * ip6addr_ntoa_r (const ip6_addr_t *addr, char *buf, int buflen)
 

Detailed Description

IPv6 addresses.

Function Documentation

◆ ip6addr_aton()

int ip6addr_aton ( const char *  cp,
ip6_addr_t addr 
)

Check whether "cp" is a valid ascii representation of an IPv6 address and convert to a binary address. Returns 1 if the address is valid, 0 if not.

Parameters
cpIPv6 address in ascii representation (e.g. "FF01::1")
addrpointer to which to save the ip address in network order
Returns
1 if cp could be converted to addr, 0 on failure

◆ ip6addr_ntoa()

char* ip6addr_ntoa ( const ip6_addr_t addr)

Convert numeric IPv6 address into ASCII representation. returns ptr to static buffer; not reentrant!

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

◆ ip6addr_ntoa_r()

char* ip6addr_ntoa_r ( const ip6_addr_t addr,
char *  buf,
int  buflen 
)

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

Parameters
addrip6 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