From 6274913455be87cbe598b5d0534e1e80972c8efd Mon Sep 17 00:00:00 2001
From: gdamore struct nn_cmsghdr eq
nn_sendnng_sendnn_recvnng_recv
-nn_sendmsgnng_sendmsg
-nn_getsockoptnng_socket_getNNG has typed accessors for options, and also separate functions for dialers and listeners.
+nn_setsockoptnng_socket_set
+nn_getsockopt[ nng_socket_get]NNG has typed accessors for options, and also separate functions for dialers and listeners. nn_setsockopt[ nng_socket_set]nn_devicenng_devicenn_pollNone Can be constructed using nng_aio. Few if any applications ever used this API.
diff --git a/ref/migrate/nng1.html b/ref/migrate/nng1.html
index 58dd6b29..75b37dd1 100644
--- a/ref/migrate/nng1.html
+++ b/ref/migrate/nng1.html
@@ -386,6 +386,12 @@ to when dialing, by using the local address in front of the destination
address separated by a semicolon. This was provided for legacy libnanomsg
compatibility, and is no longer offered. The correct way to specify a
local address is by setting nn_termnng_finiThe nng_fini API can do this, but is not recommended except when debugging memory leaks.NNG_OPT_LOCADDR on the dialer.
The NNG_OPT_REMADDR and NNG_OPT_LOCADDR options are removed. For streams and pipes, there are
+nng_stream_peer_addr and nng_pipe_peer_addr functions. For dialers
+and stream dialers, the application should track the relevant information
+used to configure the listener. Functions formerly used to configure these are
+removed as well.
The types of NNG_OPT_PEER_GID, NNG_OPT_PEER_PID, NNG_OPT_PEER_UID, and NNG_OPT_PEER_ZONEID
have changed from uint64_t to int. The underlying platforms all use 32-bit quantities for these.
nng_stream_listener_set_ptrnng_stream_listener_get_uint64nng_stream_listener_set_uint64nng_stream_listener_get_addrnng_ctx_get_ptr (not documented)nng_ctx_set_ptr (not documented)_bool (to access a bool
nng_stream_listener_set
Stream Options
+The nng_stream_get_addr function is removed.
+Use the new nng_stream_peer_addr or [nng_stream_peer_self_addr] instead.
The ability to set options on streams after they have been created is no longer present.
(It turns out that this was not very useful.) All functions nng_stream_set_xxx are removed.
For tuning the NNG_OPT_TCP_NODELAY or similar properties, set the option on the listener
@@ -475,6 +484,11 @@ directly:
The latter option is a hint for transports and intended to facilitate early
detection (and possibly avoidance of extra allocations) of oversize messages,
before bringing them into the socket itself.
+The NNG_OPT_TCP_BOUND_PORT port is renamed to just [NNG_OPT_BOUND_PORT],
+and is available for listeners using transports based on either TCP or UDP.
+The nng_pipe_get_addr function has been removed, and replaced with the new
+nng_pipe_peer_addr and nng_pipe_self_addr functions. These should be
+easier to use.
Socket Options
The NNG_OPT_PROTO, NNG_OPT_PROTONAME, NNG_OPT_PEER, and NNG_OPT_PEERNAME options
have been replaced by functions instead of options.
@@ -546,6 +560,9 @@ They may silently truncate data.
The HTTP handler objects may not be modified once in use. Previously this would fail with NNG_EBUSY.
These checks are removed now, but debug builds will assert if an application tries to do so.
+The nng_http_server_get_addr function is removed. Instead there is now
+[nng_http_server_get_port] which can be used to obtain the port actually bound if the server
+was configured with port 0.
WebSocket API
The NNG_OPT_WSS_REQUEST_HEADERS, NNG_OPT_WSS_RESPONSE_HEADERS and
NNG_OPT_WS_OPT_WS_REQUEST_HEADERS, NNG_OPT_WS_RESPONSE_HEADERS have been removed.
@@ -571,6 +588,15 @@ See nng_args_parse
The Layer 2 special ZeroTier transport has been removed.
It is possible to use NNG with ZeroTier using TCP/IP, and a future update
is planned to provided coexistence between ZeroTier & the native stack’s TCP/IP using lwIP.
+Abstract Autobinding No Longer Supported
+As we have removed NNG_OPT_LOCADDR, it is no longer possible to meaningfully
+use autobinding with abstract sockets on Linux. This is trivially worked around by using a
+large (say 128-bit) random integer as the name.
+This can be done via using of nng_random combined with sprintf, as the following example demonstrates:
+char url[256];
+snprintf(url, sizeof (url), `abstract://my-app-%08x-%08x-%08x-%08x",
+ nni_random(), nni_random(), nni_random(), nni_random());
+