aboutsummaryrefslogtreecommitdiff
path: root/docs/ref/migrate
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-10-26 10:54:58 -0700
committerGarrett D'Amore <garrett@damore.org>2025-10-27 07:13:40 -0700
commitbe13c2e8845423cec17af429fc4e16a5d9749e47 (patch)
tree82614e403a41aac6581a9a223ef9eba5be557222 /docs/ref/migrate
parent11c53f3d7f747d14fd69ce98c63d629bc821ef68 (diff)
downloadnng-be13c2e8845423cec17af429fc4e16a5d9749e47.tar.gz
nng-be13c2e8845423cec17af429fc4e16a5d9749e47.tar.bz2
nng-be13c2e8845423cec17af429fc4e16a5d9749e47.zip
Replace nng_pipe_get_addr, nng_stream_get_addr, and the NNG_OPT_REMADDR option.
More direct access methods are provided instead. This results in much lower friction when using, and is a step on the path to removing NNG_OPT_LOCADDR as well. We need to figure a solution for NNG_OPT_LOCADDR for dialers; for listeners there is little use in it either, and it will be removed. (Dialers will probably get a new NNG_OPT_BIND_IP option.)
Diffstat (limited to 'docs/ref/migrate')
-rw-r--r--docs/ref/migrate/nng1.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/docs/ref/migrate/nng1.md b/docs/ref/migrate/nng1.md
index 52b786cc..6e0a1143 100644
--- a/docs/ref/migrate/nng1.md
+++ b/docs/ref/migrate/nng1.md
@@ -173,6 +173,13 @@ 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 `NNG_OPT_LOCADDR` on the dialer.
+## Support for Remote Address Options Removed
+
+The `NNG_OPT_REMADDR` option is 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.
+
## IPC Option Type Changes
The types of [`NNG_OPT_PEER_GID`], [`NNG_OPT_PEER_PID`], [`NNG_OPT_PEER_UID`], and [`NNG_OPT_PEER_ZONEID`]
@@ -247,6 +254,9 @@ such as one ending in a suffix like `_bool` (to access a `bool` typed option).
## 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
@@ -277,6 +287,10 @@ 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
@@ -401,4 +415,18 @@ 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` for listeners, 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:
+
+```c
+char url[256];
+snprintf(url, sizeof (url), `abstract://my-app-%08x-%08x-%08x-%08x",
+ nni_random(), nni_random(), nni_random(), nni_random());
+```
+
{{#include ../xref.md}}