diff options
Diffstat (limited to 'src/nng.h')
| -rw-r--r-- | src/nng.h | 43 |
1 files changed, 30 insertions, 13 deletions
@@ -557,6 +557,23 @@ NNG_DECL void nng_thread_destroy(void *); // Error codes. These may happen to align to errnos used on your platform, // but do not count on this. +// +// NNG_SYSERR is a special code, which allows us to wrap errors from the +// underlying operating system. We generally prefer to map errors to one +// of the above, but if we cannot, then we just encode an error this way. +// The bit is large enough to accommodate all known UNIX and Win32 error +// codes. We try hard to match things semantically to one of our standard +// errors. For example, a connection reset or aborted we treat as a +// closed connection, because that's basically what it means. (The remote +// peer closed the connection.) For certain kinds of resource exhaustion +// we treat it the same as memory. But for files, etc. that's OS-specific, +// and we use the generic below. Some of the above error codes we use +// internally, and the application should never see (e.g. NNG_EINTR). +// +// NNG_ETRANERR is like ESYSERR, but is used to wrap transport specific +// errors, from different transports. It should only be used when none +// of the other options are available. + enum nng_errno_enum { NNG_EINTR = 1, NNG_ENOMEM = 2, @@ -582,21 +599,11 @@ enum nng_errno_enum { NNG_ENOSPC = 22, NNG_EEXIST = 23, NNG_EINTERNAL = 24, + NNG_ETRANSPORT = 25, + NNG_ESYSERR = 0x10000000, + NNG_ETRANERR = 0x20000000, }; -// NNG_SYSERR is a special code, which allows us to wrap errors from the -// underlyuing operating system. We generally prefer to map errors to one -// of the above, but if we cannot, then we just encode an error this way. -// The bit is large enough to accommodate all known UNIX and Win32 error -// codes. We try hard to match things semantically to one of our standard -// errors. For example, a connection reset or aborted we treat as a -// closed connection, because that's basically what it means. (The remote -// peer closed the connection.) For certain kinds of resource exhaustion -// we treat it the same as memory. But for files, etc. that's OS-specific, -// and we use the generic below. Some of the above error codes we use -// internally, and the application should never see (e.g. NNG_EINTR). -#define NNG_ESYSERR (0x10000000) - // Maximum length of a socket address. This includes the terminating NUL. // This limit is built into other implementations, so do not change it. #define NNG_MAXADDRLEN (128) @@ -627,9 +634,17 @@ struct nng_sockaddr_in { uint16_t sa_port; uint32_t sa_addr; }; + +struct nng_sockaddr_zt { + uint64_t sa_nwid; + uint64_t sa_nodeid; + uint32_t sa_port; +}; + typedef struct nng_sockaddr_in nng_sockaddr_in; typedef struct nng_sockaddr_in nng_sockaddr_udp; typedef struct nng_sockaddr_in nng_sockaddr_tcp; +typedef struct nng_sockaddr_zt nng_sockaddr_zt; typedef struct nng_sockaddr { union { @@ -637,6 +652,7 @@ typedef struct nng_sockaddr { nng_sockaddr_path s_path; nng_sockaddr_in6 s_in6; nng_sockaddr_in s_in; + nng_sockaddr_zt s_zt; } s_un; } nng_sockaddr; @@ -646,6 +662,7 @@ enum nng_sockaddr_family { NNG_AF_IPC = 2, NNG_AF_INET = 3, NNG_AF_INET6 = 4, + NNG_AF_ZT = 5, // ZeroTier }; #ifdef __cplusplus |
