inet_ntop6_zone Subroutine

Purpose

Converts a binary IPv6 address with the possible zone ID into a text string that is suitable for presentation.

Syntax

const char
  inet_ntop6_zone (const void src, char dst, size_t size)

Description

The inet_ntop6_zone subroutine is preferred over the inet_ntop subroutine because it can infer the zone ID (defined in Section 11 of RFC 4007) that might be present in the sin6_scope_id field of the sockaddr_in6 structure.

Functionally, this subroutine uses the inet_ntop subroutine to generate the textual representation of the address. It appends the %zoneid suffix to the string if the sin6_scope_id field is non-zero.

Parameters

Item Description
src Specifies the sockaddr_in6 structure that contains the address in the sin6_addr field and the zone ID in the sin6_scope_id field.
dst Specifies a buffer where the textual representation of the address is stored, and if non-zero, the zone ID is stored.
size Specifies the size (in bytes) of the buffer pointed to by the dst parameter.

Return Values

If successful, a pointer to the buffer containing the converted address is returned. If unsuccessful, NULL is returned. Upon failure, the errno global variable is set to ENOSPC if the size parameter indicates that the destination buffer is small.