= nng_sockaddr_zt(5)
//
// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This document is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
// file was obtained (LICENSE.txt).  A copy of the license may also be
// found online at https://opensource.org/licenses/MIT.
//

== NAME

nng_sockaddr_zt - ZeroTier socket address

== SYNOPSIS

[source, c]
----
#include <nng/nng.h>

enum sockaddr_family {
    NNG_AF_ZT = 5,
};

typedef struct {
    uint16_t sa_family;
    uint64_t sa_nwid;
    uint64_t sa_nodeid;
    uint32_t sa_port;
} nng_sockaddr_zt;
----

== DESCRIPTION

(((socket, address, ZeroTier)))
An `nng_sockaddr_zt` is the flavor of xref:nng_sockaddr.5.adoc[`nng_sockaddr`]
used to represent ZeroTier addresses, including the
(((port number, ZeroTier)))port number used by the
xref:nng_zerotier.7.adoc[_zt_] transport.

IMPORTANT: The ZeroTier transport, and the details of this structure,
are still considered experimental, and subject to change.

The following structure members are present:

`sa_family`::
    This field will always have the value ((`NNG_AF_ZT`)).

`sa_nwid`::
    (((network number, ZeroTier)))
    This field holds the ZeroTier network number (or ID).
    This value is in native byte order.

`sa_nodeid`::
    This field holds the ZeroTier node ID.(((node ID, ZeroTier)))
    This value is in native byte order, and only the lower 40 bits
    are significant.
    (ZeroTier node numbers are 40 bits long.)
    A zero value here is used for a wild-card to indicate that the
    caller's own node number be used.

`sa_port`::
    This field holds the port number used by the
    xref:nng_zerotier.7.adoc[_zt_] transport to distinguish different
    sockets.
    This value in native byte order.(((port number, ZeroTier)))
    A zero value here indicates that a port number should be chosen
    randomly from the ephemeral ports.
    Only the lower 24 bits of the port number are used.

NOTE: ZeroTier port numbers are in *native* byte order, and are larger
than TCP/IP port numbers.
They are also not part of the ZeroTier protocol itself, but defined by
the Scalability Protocols binding for them.

== SEE ALSO

[.text-left]
xref:nng_sockaddr.5.adoc[nng_sockaddr(5)],
xref:nng_zerotier.7.adoc[nng_zerotier(7)],
xref:nng.7.adoc[nng(7)]
