inet_pton6_zone Subroutine
Purpose
Converts an IPv6 address in its standard text form which might include a zone ID suffix, into its numeric binary form.
Syntax
int
inet_pton6_zone (const char *src, void *dst)
Description
The inet_pton6_zone subroutine is preferred over the inet_pton subroutine because it can infer the zone ID suffix (defined in Section 11 of RFC 4007) that might be present in the textual representation of an IPv6 address.
Functionally, this subroutine removes the zone ID, if present, and stores it in the sin6_scope_id field of the sockaddr_in6 structure pointed to by the dst parameter. It uses the inet_pton subroutine to convert the removed address, and stores it in the sin6_addr field.
Parameters
Item | Description |
---|---|
src | The string that contains the textual representation of the address. |
dst | A pointer to the sockaddr_in6 structure where the numeric representation is stored. The zone ID, if present, is stored in the sin6_scope_id field, and the address is stored in the sin6_addr field. |
Return Values
If successful, one is returned. If the input is not a valid IPv6 address, zero is returned.