ipv6: IPv6 Address Handling

## Data Structures

struct | ipv6addr

## Typedefs

typedef uint16 | ipv6port

## Functions

const char * | ipv6_scan (const char *s, ipv6addr *addr)
const char * | ipv6_format (const ipv6addr *addr)
unsigned | fmt_ipv6addr (char *buffer, const ipv6addr *addr)
int | ipv6_isv4mapped (const ipv6addr *addr)

## Variables

const ipv6addr | IPV6ADDR_ANY
const ipv6addr | IPV6ADDR_LOOPBACK
const ipv6addr | IPV6ADDR_V4PREFIX

## Detailed Description

## Typedef Documentation

## ipv6port

typedef uint16 ipv6port

IPv6 port number.

## Function Documentation

## fmt_ipv6addr()

unsigned fmt_ipv6addr | ( | char * | buffer,
|  | const ipv6addr * | addr )

extern

Produce a formatted string from an IPv6 address.

The given buffer must be at least 39 bytes long, or 40 bytes if it needs to contain the standard trailing `NUL` byte.

Returns
  The number of bytes written to the buffer.

Note
  This routine is thread and recursion safe.

References ipv6addr::addr.

Referenced by ipv6_format().

## ipv6_format()

const char * ipv6_format | ( | const ipv6addr * | addr | ) |

extern

Produce a formatted C string from an IPv6 address.

Note
  The return value is statically allocated. Multiple calls to this function will return pointers to the same string.

References fmt_ipv6addr().

## ipv6_isv4mapped()

int ipv6_isv4mapped | ( | const ipv6addr * | addr | ) |

extern

Return true if the IPv6 address is actually a wrapped IPv4 address.

References IPV6ADDR_V4PREFIX.

Referenced by dns_name6_r().

## ipv6_scan()

const char * ipv6_scan | ( | const char * | s,
|  | ipv6addr * | addr )

extern

Scan a C string for an IPv6 address.

Returns
  `NULL` if parsing failed, otherwise a pointer to the first character after the end of the address.

References ipv4addr::addr, ipv6addr::addr, and ipv4_scan().

Referenced by dns_ip6_r().

## Variable Documentation

## IPV6ADDR_ANY

const ipv6addr IPV6ADDR_ANY

extern

IPv6 "any" address constant.

## IPV6ADDR_LOOPBACK

const ipv6addr IPV6ADDR_LOOPBACK

extern

IPv6 loopback address constant.

## IPV6ADDR_V4PREFIX

const ipv6addr IPV6ADDR_V4PREFIX

extern

IPv4-in-IPv6 address prefix constant.

Referenced by dns_ip6_r(), and ipv6_isv4mapped().