Skip to content

Latest commit

 

History

History
82 lines (65 loc) · 2.35 KB

nng_sockaddr_zt.5.adoc

File metadata and controls

82 lines (65 loc) · 2.35 KB

nng_sockaddr_zt(5)

NAME

nng_sockaddr_zt - ZeroTier socket address

SYNOPSIS

#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

An nng_sockaddr_zt is the flavor of nng_sockaddr used to represent ZeroTier addresses, including the port number used by the 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

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. 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 zt transport to distinguish different sockets. This value in native byte order. 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.