@@ -810,7 +814,7 @@ mode may need to access the header of messages.
Asynchronous Operations
Most applications will interact with nng synchronously; that is that
-functions such as nng_send() will block the calling
+functions such as nng_send(3) will block the calling
thread until the operation has completed.
The nng_alloc() function allocates a contiguous memory region of
+at least size bytes. The memory will be 64-bit aligned.
+
+
+
The returned memory can be used to hold message buffers, in which
+case it can be directly passed to nng_send(3) using
+the flag NNG_FLAG_ALLOC. Alternatively, it can be freed when no
+longer needed using nng_free(3).
+
+
+
+
+
+
+
+
+Do not use the system free() function to release this memory.
+On some platforms this may work, but it is not guaranteed and may lead
+to a crash or other undesirable and unpredictable behavior.
+
+
+
+
+
+
+
+
RETURN VALUES
+
+
+
This function returns 0 on success, and non-zero otherwise.
The nng_free() function deallocates a memory region of size size,
+that was previously allocated by nng_alloc(3) or
+nng_recv(3) with the NNG_FLAG_ALLOC flag.
+
+
+
+
+
+
+
+
+It is very important that size match the allocation size
+used to allocate the memory.
+
+
+
+
+
+
+
+
+
+
+
+Do not attempt to use this function to deallocate memory
+obtained by a call to the system malloc() or calloc() functions,
+or the C++ new operator. Doing so may result in unpredictable
+behavior, including corruption of application memory.
+
+
+
diff --git a/man/v0.5.0/nng_http_conn_close.html b/man/v0.5.0/nng_http_conn_close.html
index 47b60631..39227d51 100644
--- a/man/v0.5.0/nng_http_conn_close.html
+++ b/man/v0.5.0/nng_http_conn_close.html
@@ -566,7 +566,7 @@ including any disposing of any underlying file descriptors or related resources.
diff --git a/man/v0.5.0/nng_http_conn_read.html b/man/v0.5.0/nng_http_conn_read.html
index 4481f241..3eaeb366 100644
--- a/man/v0.5.0/nng_http_conn_read.html
+++ b/man/v0.5.0/nng_http_conn_read.html
@@ -557,7 +557,7 @@ called first, to set the scatter/gather vector for aio.
This function returns immediately, with no return value. Completion of
the operation is signaled via the aio, and the final result may be
-obtained via nng_aio_result. That result will
+obtained via nng_aio_result(3). That result will
either be zero or an error code.
This function returns immediately, with no return value. Completion of
the operation is signaled via the aio, and the final result may be
-obtained via nng_aio_result. That result will
+obtained via nng_aio_result(3). That result will
either be zero or an error code.
This function returns immediately, with no return value. Completion of
the operation is signaled via the aio, and the final result may be
-obtained via nng_aio_result. That result will
+obtained via nng_aio_result(3). That result will
either be zero or an error code.
@@ -612,7 +612,6 @@ either be zero or an error code.
This function returns immediately, with no return value. Completion of
the operation is signaled via the aio, and the final result may be
-obtained via nng_aio_result. That result will
+obtained via nng_aio_result(3). That result will
either be zero or an error code.
@@ -612,7 +612,6 @@ either be zero or an error code.
This function returns immediately, with no return value. Completion of
the operation is signaled via the aio, and the final result may be
-obtained via nng_aio_result. That result will
+obtained via nng_aio_result(3). That result will
either be zero or an error code.
diff --git a/man/v0.5.0/nng_http_conn_write_all.html b/man/v0.5.0/nng_http_conn_write_all.html
index 1a7878c9..01de114c 100644
--- a/man/v0.5.0/nng_http_conn_write_all.html
+++ b/man/v0.5.0/nng_http_conn_write_all.html
@@ -557,7 +557,7 @@ called first, to set the scatter/gather vector for aio.
This function returns immediately, with no return value. Completion of
the operation is signaled via the aio, and the final result may be
-obtained via nng_aio_result. That result will
+obtained via nng_aio_result(3). That result will
either be zero or an error code.
This function returns immediately, with no return value. Completion of
the operation is signaled via the aio, and the final result may be
-obtained via nng_aio_result. That result will
+obtained via nng_aio_result(3). That result will
either be zero or an error code.
@@ -600,7 +600,6 @@ either be zero or an error code.
nng_aio_alloc(3),
nng_aio_result(3),
-nng_http_alloc_handler(3),
nng_http_client_connect(3),
nng_http_conn_read_all(3),
nng_strerror(3),
diff --git a/man/v0.5.0/nng_http_conn_write_res.html b/man/v0.5.0/nng_http_conn_write_res.html
index 892a94bb..974f6503 100644
--- a/man/v0.5.0/nng_http_conn_write_res.html
+++ b/man/v0.5.0/nng_http_conn_write_res.html
@@ -546,13 +546,13 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
the HTTP response res to the connection conn. The entire response is sent,
including headers, and if present, the response body data. (The
response body can be set with
-nng_http_res_set_data or
-nng_http_res_copy_data.)
This function returns immediately, with no return value. Completion of
the operation is signaled via the aio, and the final result may be
-obtained via nng_aio_result. That result will
+obtained via nng_aio_result(3). That result will
either be zero or an error code.
@@ -616,7 +616,6 @@ then the connection is immediately after sending the response.
Additionally each handler has a method it is registered to handle
(the default is "GET", see
-<<nng_http_handler_set_method#,nng_http_handler_set_method(3)), and
+nng_http_handler_set_method(3)), and
optionally a 'Host' header it can be matched against (see
<<nng_http_handler_set_host#,nng_http_handler_set_host(3)).
diff --git a/man/v0.5.0/nng_http_hijack.html b/man/v0.5.0/nng_http_hijack.html
index 54d16b8c..f4f8980e 100644
--- a/man/v0.5.0/nng_http_hijack.html
+++ b/man/v0.5.0/nng_http_hijack.html
@@ -547,7 +547,7 @@ some other purpose, and should not be used any further by the server.
This function is most useful when called from a handler function.
-(See <<nng_http_alloc_handler#,nng_http_alloc_handler(3).)
diff --git a/man/v0.5.0/nng_http_res_alloc.html b/man/v0.5.0/nng_http_res_alloc.html
index c4ce0545..0cbd1aa7 100644
--- a/man/v0.5.0/nng_http_res_alloc.html
+++ b/man/v0.5.0/nng_http_res_alloc.html
@@ -589,7 +589,7 @@ When an error response is needed, consider using
The nng_recvmsg() receives a message on socket s, storing the
+received message at the location pointed to by msgp.
+
+
+
+
+
+
+
+
+Using this function gives access to the message structure, and thus may
+offer more functionality than the simpler nng_recv(3) function.
+
+
+
+
+
+
The flags may contain the following value:
+
+
+
+
NNG_FLAG_NONBLOCK
+
+
The function returns immediately, even if no message is available. Without
+this flag, the function will wait until a message is received by the socket
+s, or any configured timer expires.
+
+
+
+
+
+
+
+
+
+
+The semantics of what receiving a message means vary from protocol to
+protocol, so examination of the protocol documentation is encouraged. (For
+example, with an nng_req(7) socket a message may only be received
+after a request has been sent, and an nng_sub(7) socket
+may only receive messages corresponding to topics to which it has subscribed.)
+Furthermore, some protocols may not support receiving data at all, such as
+nng_pub(7).
+
+
+
+
+
+
+
+
RETURN VALUES
+
+
+
This function returns 0 on success, and non-zero otherwise.
+
+
+
+
+
ERRORS
+
+
+
+
NNG_EAGAIN
+
+
The socket s cannot accept data for sending.
+
+
NNG_ECLOSED
+
+
The socket s is not open.
+
+
NNG_EINVAL
+
+
An invalid set of flags was specified.
+
+
NNG_ENOMEM
+
+
Insufficient memory is available.
+
+
NNG_ENOTSUP
+
+
The protocol for socket s does not support receiving.
The nng_sendmsg() sends message msg using the socket s.
+
+
+
If the function returns zero, indicating it has accepted the message for
+delivery, then the msg is “owned” by the socket s, and the caller
+must not make any further use of it. The socket will free the message
+when it is finished.
+
+
+
If the function returns non-zero, then it is the caller’s responsibility
+to dispose of the msg, which may include freeing it, sending it to
+another socket, or simply trying again later.
+
+
+
+
+
+
+
+
+Using this function gives access to the message structure, and may
+offer more functionality than the simpler nng_send(3) function.
+
+
+
+
+
+
+
+
+
+
+
+The semantics of what sending a message means vary from protocol to
+protocol, so examination of the protocol documentation is encouraged. (For
+example, with an nng_pub(7) socket the data is broadcast, so that
+any peers who have a suitable subscription will be able to receive it using
+nng_recv(3) or a similar function.) Furthermore, some protocols
+may not support sending (such as nng_sub(7)) or may
+require other conditions. (For example, nng_rep(7) sockets
+cannot normally send data, which are responses to requests, until they have
+first received a request.)
+
+
+
+
+
+
The flags may contain the following value:
+
+
+
+
NNG_FLAG_NONBLOCK
+
+
The function returns immediately, regardless of whether
+the socket is able to accept the data or not. If the socket is unable
+to accept the data (such as if backpressure exists because the peers
+are consuming messages too slowly, or no peer is present), then the
+function will return with NNG_EAGAIN. If this flag is not specified,
+then the function will block if such a condition exists.
+
+
+
+
+
+
+
+
+
+
+Regardless of the presence or absence of NNG_FLAG_NONBLOCK, there may
+be queues between the sender and the receiver. Furthermore, there is no
+guarantee that the message has actually been delivered. Finally, with some
+protocols, the semantic is implictly NNG_FLAG_NONBLOCK, such as with
+nng_pub(7) sockets, which are best-effort delivery only.
+
+
+
+
+
+
+
+
RETURN VALUES
+
+
+
This function returns 0 on success, and non-zero otherwise.
+
+
+
+
+
ERRORS
+
+
+
+
NNG_EAGAIN
+
+
The socket s cannot accept data for sending.
+
+
NNG_ECLOSED
+
+
The socket s is not open.
+
+
NNG_EINVAL
+
+
An invalid set of flags was specified.
+
+
NNG_EMSGSIZE
+
+
The value of size is too large.
+
+
NNG_ENOMEM
+
+
Insufficient memory is available.
+
+
NNG_ENOTSUP
+
+
The protocol for socket s does not support sending.
The nng_version() function returns a human readable version
+number for the nng library. This is intended for output in
+programs, and so forth.
+
+
+
Additionally, compile time version information is available
+via some predefined macros:
+
+
+
+
NNG_MAJOR_VERSION
+
+
Major version number.
+
+
NNG_MINOR_VERSION
+
+
Minor version number.
+
+
NNG_PATCH_VERSION
+
+
Patch version number.
+
+
+
+
+
The nng library is developed and released using
+Semantic Versioning 2.0, and
+the version numbers reported refer to both the API and the
+library itself. (The ABI — binary interface — between the
+library and the application is controlled in a similar, but different
+manner depending upon the link options and how the library is built.)
+
+
+
+
+
RETURN VALUES
+
+
+
C string (NUL-terminated) containing the library version number.
+
+
diff --git a/man/v0.5.0/nng_zerotier.html b/man/v0.5.0/nng_zerotier.html
index c49649f8..330c8d18 100644
--- a/man/v0.5.0/nng_zerotier.html
+++ b/man/v0.5.0/nng_zerotier.html
@@ -546,11 +546,11 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
nng applications over a ZeroTier network,
using a Virtual Layer 2 packet facility.
-
+
-
+
This transport is very experimental. To utilize it at
@@ -561,11 +561,11 @@ linking against a suitable libzerotiercore static library.
-
+
-
+
The libzerotiercore library at present is covered under different
@@ -575,6 +575,22 @@ and adhere to the licensing terms.
+
+
+
+
+
+
+
+The ZeroTier transport can take a long time to establish an
+initial connection — up to even a minute in extreme cases, while the network
+topology is configured. Consequently, this transport is not recommended
+for use cases involving short-lived programs, but is better for long-running
+programs such as background daemons or agents.
+
+
+
+
While ZeroTier makes use of the host’s IP stack (and UDP in particular),
this transport does not use or require an IP stack on the virtual
@@ -651,6 +667,20 @@ members are, unlike TCP socket address, in native byte order. Only the
lower 24-bits of the sa_port may be used. Likewise only the lower 40-bits
of the sa_nodeid may be used.
+
+
+
+
+
+
+
+The fields of this structure are in native byte order,
+unlike the other socket address structures associated with NNG_AF_INET or
+NNG_AF_INET6.
+
+
+
+
Node Presence
@@ -716,8 +746,8 @@ provides a uint64_t in native byte order representing the ZeroTier
Valid values for this are:
-
-
+
+
@@ -752,13 +782,26 @@ Valid values for this are:
This is a read-only ASCIIZ string containing the name of the network
as established by the ZeroTier network administrator.
+
NNG_OPT_ZT_CONN_TIME
+
+
The time to wait between sending connection attempts. This is an
+nng_duration (msec), and is only used with dialers. The default is 500 msec.
+
+
NNG_OPT_ZT_CONN_TRIES
+
+
The maximum number (int) of attempts to try to establish a connection
+before reporting a timeout, and is only used with dialers. The default
+is 240, which results in a 2 minute timeout if NNG_OPT_ZT_CONN_TIME is at
+it’s default of 500. If the value is set to 0, then the connection
+attempts will keep retrying forever.
+
NNG_OPT_ZT_PING_TIME
If no traffic has been received from the ZeroTier peer after this
period of time, then a "ping" message is sent to check if the peer
is still alive. This is an nng_duration (msec).
-
NNG_OPT_ZT_PING_COUNT
+
NNG_OPT_ZT_PING_TRIES
If this number (int) of consecutive "ping" requests are sent to the
peer with no response (and no other intervening traffic), then the
diff --git a/man/v0.5.0/nngcat.html b/man/v0.5.0/nngcat.html
index 74026a9c..6731ce0b 100644
--- a/man/v0.5.0/nngcat.html
+++ b/man/v0.5.0/nngcat.html
@@ -517,6 +517,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
Compatible mode. This cause nngcat to behave more like the legacy
nanocat application. In this mode connections are made asynchronously,
-and the --pair option selects version 0 of the PAIR protocol
-instead of version 1.
+and the --pair option selects version 0 of the nng_pair(7)
+protocol instead of version 1.
--subscribe=TOPIC
Subscribe to TOPIC. This option can only be used with the
-SUBv0 protocol. The TOPIC is checked against the first bytes
+nng_sub(7) protocol. The TOPIC is checked against the
+first bytes
of messages received, and messages are discarded if they do not match.
This may be specified multiple times to subscribe to multiple topics. If
not specified at all, then a default subscription to everything is assumed.
@@ -628,50 +637,53 @@ At least one protocol must be selected.
--bus, --bus0
-
Select the BUSv0 protocol. This protocol can send
-and receive messages to and from other BUSv0 peers.
+
Select the nng_bus(7) version 0 protocol. This protocol can send
+and receive messages to and from other BUS version 0 peers.
--req, --req0
-
Select the REQv0 protocol. This protocol sends
-messages to REPv0 peers and receives replies from them.
+
Select the nng_req(7) version 0 protocol. This protocol sends
+messages to nng_rep(7) version 0 peers and receives replies
+from them.
--rep, --rep0
-
Select the REPv0 protocol. This protocol receives
-messages from REQv0 peers and can send replies to them.
+
Select the nng_rep(7) version 0 protocol. This protocol
+receives messages from nng_req(7) version 0 peers and can send
+replies to them.
--pub, --pub0
-
Select the PUBv0 protocol. This protocol sends
-messages to SUBv0 peers.
+
Select the nng_pub(7) version 0 protocol. This protocol sends
+messages to nng_sub(7) version peers.
--sub, --sub0
-
Select the SUBv0 protocol. This protocol receives
-messages from PUBv0 peers, and filters them based on
-subscriptions set with --subscribe.
+
Select the nng_sub(7) version 0 protocol.
+This protocol receives messages from nng_pub(7) version 0 peers,
+and filters them based on subscriptions set with --subscribe.
--push, --push0
-
Select the PUSHv0 protocol. This protocol sends
-messages to PULLv0 peers. A given message is normally
-only delivered to a single peer.
+
Select the nng_push(7) version 0 protocol.
+This protocol sends messages to nng_pull(7) version 0 peers.
+A given message is normally only delivered to a single peer.
--pull, --pull0
-
Select the PULLv0 protocol. This protocol receives
-messages from PUSHv0 peers.
+
Select the nng_pull(7) version 0 protocol.
+This protocol receives
+messages from nng_push(7) version 0 peers.
--pair0
-
Select the PAIRv0 protocol. This protocol can send and
-receive messages with one connected PAIRv0 peer.
+
Select the nng_pair(7) veresion 0 protocol. This protocol
+can send and receive messages with one connected PAIR version 0 peer.
--pair1
-
Select the PAIRv1 protocol. This protocol can send and
-receive messages with one connected PAIRv1 peer. It
+
Select the nng_pair(7) version 1 protocol. This protocol
+can send and receive messages with one connected PAIR version 1 peer. It
is not supported in --compat mode. (Polyamorous mode is not supported
in nngcat, although peers may be using polyamorous mode.)
@@ -682,15 +694,15 @@ which case it acts as an alias for --pair0.
--surveyor, --surveyor0
-
Select the SURVEYORv0 protocol. This protocol sends
-a survey request to RESPONDENTv0 peers, and then
-receives replies from them.
+
Select the nng_surveyor(7) version 0 protocol.
+This protocol sends a survey request to nng_respondent(7)
+version 0 peers, and then receives replies from them.
--respondent, --respondent0
-
Select the RESPONDENTv0 protocol. This protocol receives
-survey requests from SURVEYORv0 peers, and can send a reply
-to them.
+
Select the nng_respondent(7) version 0 protocol.
+This protocol receives survey requests from nng_surveyor(7)
+version 0 peers, and can send a reply to them.
@@ -891,6 +903,23 @@ used as trust roots when validating certificates presented by peers.
+
+
ZeroTier Options
+
+
These options are only present if ZeroTier is configured; they are ignored
+otherwise.
+
+
+
+
--zt-home=DIRECTORY
+
+
Directory for persistent ZeroTier node (key material, etc.) This directory
+must already exist. Only one program may use a ZeroTier node at a time;
+file locking is used to prevent this.