This address family provides support for the Internet Protocol version 6 (IPv6). AF_INET6 address family uses a 128 bit (16 byte) address.
The basic architecture of these addresses includes 64 bits for a network number and another 64 bits for the host number. You can specify AF_INET6 addresses as x:x:x:x:x:x:x:x, where the x's are the hexadecimal values of eight 16–bit pieces of the address. For example, a valid address looks like this: FEDC:BA98:7654:3210:FEDC:BA98:7654:3210.
For a socket application that uses TCP, User Datagram Protocol (UDP) or RAW, the AF_INET6 address family uses the sockaddr_in6 address structure. This address structure changes if you use _XOPEN_SOURCE macro to implement BSD 4.4/ UNIX® 98 specifications. For the sockaddr_in6 address structure, these differences are summarized in this table:
BSD 4.3 sockaddr_in6 address structure | BSD 4.4/ UNIX 98 sockaddr_in6 address structure |
---|---|
struct sockaddr_in6 { sa_family_t sin6_family; in_port_t sin6_port; uint32_t sin6_flowinfo; struct in6_addr sin6_addr; uint32_t sin6_scope_id; }; |
struct sockaddr_in6 { uint8_t sin6_len; sa_family_t sin6_family; in_port_t sin6_port; uint32_t sin6_flowinfo; struct in6_addr sin6_addr; uint32_t sin6_scope_id; }; |
Address structure field | Definition |
---|---|
sin6_len | This field contains the length of the address for UNIX 98
specifications. Note: The: sin6_len field is only provided for BSD 4.4 compatibility.
It is not necessary to use this field even when using BSD 4.4/ UNIX 98 compatibility.
The field is ignored on input addresses.
|
sin6_family | This field specifies the AF_INET6 address family. |
sin6_port | This field contains the transport layer port. |
sin6_flowinfo | This field contains two pieces of information: the traffic
class and the flow label. Note: This field is currently not supported and
should be set to zero for upward compatibility.
|
sin6_addr | This field specifies the IPv6 address. |
sin6_scope_id | This field identifies a set of interfaces as appropriate for the scope of the address carried in the sin6_addr field. |