summaryrefslogtreecommitdiff
path: root/ref/migrate
diff options
context:
space:
mode:
authorgdamore <gdamore@users.noreply.github.com>2025-10-28 05:39:18 +0000
committergdamore <gdamore@users.noreply.github.com>2025-10-28 05:39:18 +0000
commit6274913455be87cbe598b5d0534e1e80972c8efd (patch)
tree39efff99c914c2eb164a30db1cd2b5d4dba8cf53 /ref/migrate
parentfd320bbff94ed12a9db8e2ccb250dfa0d333f04c (diff)
downloadnng-gh-pages.tar.gz
nng-gh-pages.tar.bz2
nng-gh-pages.zip
deploy: 1d69c8f0393337d4f222cc1af1af813d77922c84gh-pages
Diffstat (limited to 'ref/migrate')
-rw-r--r--ref/migrate/nanomsg.html4
-rw-r--r--ref/migrate/nng1.html26
2 files changed, 28 insertions, 2 deletions
diff --git a/ref/migrate/nanomsg.html b/ref/migrate/nanomsg.html
index 62cf684d..5120f6f2 100644
--- a/ref/migrate/nanomsg.html
+++ b/ref/migrate/nanomsg.html
@@ -278,8 +278,8 @@ NNG approach to messages. Likewise there is no <code>struct nn_cmsghdr</code> eq
<tr><td><code>nn_send</code></td><td><a href="../api/sock.html#nng_send"><code>nng_send</code></a></td><td></td></tr>
<tr><td><code>nn_recv</code></td><td><a href="../TODO.html"><code>nng_recv</code></a></td><td></td></tr>
<tr><td><code>nn_sendmsg</code></td><td><a href="../api/sock.html#nng_sendmsg"><code>nng_sendmsg</code></a></td><td></td></tr>
-<tr><td><code>nn_getsockopt</code></td><td><a href="../api/sock.html#socket-options"><code>nng_socket_get</code></a></td><td>NNG has typed accessors for options, and also separate functions for dialers and listeners.</td></tr>
-<tr><td><code>nn_setsockopt</code></td><td><a href="../api/sock.html#socket-options"><code>nng_socket_set</code></a></td><td></td></tr>
+<tr><td><code>nn_getsockopt</code></td><td>[<code>nng_socket_get</code>]</td><td>NNG has typed accessors for options, and also separate functions for dialers and listeners.</td></tr>
+<tr><td><code>nn_setsockopt</code></td><td>[<code>nng_socket_set</code>]</td><td></td></tr>
<tr><td><code>nn_device</code></td><td><a href="../TODO.html"><code>nng_device</code></a></td><td></td></tr>
<tr><td><code>nn_poll</code></td><td>None</td><td>Can be constructed using <code>nng_aio</code>. Few if any applications ever used this API.</td></tr>
<tr><td><code>nn_term</code></td><td><a href="../api/init.html#finalization"><code>nng_fini</code></a></td><td>The <code>nng_fini</code> API can do this, but is not recommended except when debugging memory leaks.</td></tr>
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 <code>NNG_OPT_LOCADDR</code> on the dialer.</p>
+<h2 id="support-for-address-options-removed"><a class="header" href="#support-for-address-options-removed">Support for Address Options Removed</a></h2>
+<p>The <code>NNG_OPT_REMADDR</code> and <code>NNG_OPT_LOCADDR</code> options are removed. For streams and pipes, there are
+<a href="../api/stream.html#stream-addresses"><code>nng_stream_peer_addr</code></a> and <a href="../api/pipe.html#pipe-socket-addresses"><code>nng_pipe_peer_addr</code></a> 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.</p>
<h2 id="ipc-option-type-changes"><a class="header" href="#ipc-option-type-changes">IPC Option Type Changes</a></h2>
<p>The types of <a href="../tran/ipc.html#NNG_OPT_PEER_GID"><code>NNG_OPT_PEER_GID</code></a>, <a href="../tran/ipc.html#NNG_OPT_PEER_PID"><code>NNG_OPT_PEER_PID</code></a>, <a href="../tran/ipc.html#NNG_OPT_PEER_UID"><code>NNG_OPT_PEER_UID</code></a>, and <a href="../tran/ipc.html#NNG_OPT_PEER_ZONEID"><code>NNG_OPT_PEER_ZONEID</code></a>
have changed from <code>uint64_t</code> to <code>int</code>. The underlying platforms all use 32-bit quantities for these.</p>
@@ -428,6 +434,7 @@ and are thus removed:</p>
<li><code>nng_stream_listener_set_ptr</code></li>
<li><code>nng_stream_listener_get_uint64</code></li>
<li><code>nng_stream_listener_set_uint64</code></li>
+<li><code>nng_stream_listener_get_addr</code></li>
<li><code>nng_ctx_get_ptr</code> (not documented)</li>
<li><code>nng_ctx_set_ptr</code> (not documented)</li>
</ul>
@@ -452,6 +459,8 @@ such as one ending in a suffix like <code>_bool</code> (to access a <code>bool</
<li><code>nng_stream_listener_set</code></li>
</ul>
<h2 id="stream-options"><a class="header" href="#stream-options">Stream Options</a></h2>
+<p>The <code>nng_stream_get_addr</code> function is removed.
+Use the new <a href="../api/stream.html#stream-addresses"><code>nng_stream_peer_addr</code></a> or [<code>nng_stream_peer_self_addr</code>] instead.</p>
<p>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 <code>nng_stream_set_xxx</code> are removed.
For tuning the <code>NNG_OPT_TCP_NODELAY</code> or similar properties, set the option on the listener
@@ -475,6 +484,11 @@ directly:</p>
<p>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.</p>
+<p>The <code>NNG_OPT_TCP_BOUND_PORT</code> port is renamed to just [<code>NNG_OPT_BOUND_PORT</code>],
+and is available for listeners using transports based on either TCP or UDP.</p>
+<p>The <code>nng_pipe_get_addr</code> function has been removed, and replaced with the new
+<a href="../api/pipe.html#pipe-socket-addresses"><code>nng_pipe_peer_addr</code></a> and <a href="../api/pipe.html#pipe-socket-addresses"><code>nng_pipe_self_addr</code></a> functions. These should be
+easier to use.</p>
<h2 id="socket-options"><a class="header" href="#socket-options">Socket Options</a></h2>
<p>The <code>NNG_OPT_PROTO</code>, <code>NNG_OPT_PROTONAME</code>, <code>NNG_OPT_PEER</code>, and <code>NNG_OPT_PEERNAME</code> options
have been replaced by functions instead of options.
@@ -546,6 +560,9 @@ They may silently truncate data.</p>
</ul>
<p>The HTTP handler objects may not be modified once in use. Previously this would fail with <code>NNG_EBUSY</code>.
These checks are removed now, but debug builds will assert if an application tries to do so.</p>
+<p>The <code>nng_http_server_get_addr</code> function is removed. Instead there is now
+[<code>nng_http_server_get_port</code>] which can be used to obtain the port actually bound if the server
+was configured with port 0.</p>
<h2 id="websocket-api"><a class="header" href="#websocket-api">WebSocket API</a></h2>
<p>The <code>NNG_OPT_WSS_REQUEST_HEADERS</code>, <code>NNG_OPT_WSS_RESPONSE_HEADERS</code> and
<code>NNG_OPT_WS_OPT_WS_REQUEST_HEADERS</code>, <code>NNG_OPT_WS_RESPONSE_HEADERS</code> have been removed.</p>
@@ -571,6 +588,15 @@ See <a href="../api/args.html#parse-command-line-arguments"><code>nng_args_parse
<p>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 &amp; the native stack’s TCP/IP using lwIP.</p>
+<h2 id="abstract-autobinding-no-longer-supported"><a class="header" href="#abstract-autobinding-no-longer-supported">Abstract Autobinding No Longer Supported</a></h2>
+<p>As we have removed <code>NNG_OPT_LOCADDR</code>, 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.</p>
+<p>This can be done via using of <a href="../api/misc.html#get-random-number"><code>nng_random</code></a> combined with <code>sprintf</code>, as the following example demonstrates:</p>
+<pre><code class="language-c">char url[256];
+snprintf(url, sizeof (url), `abstract://my-app-%08x-%08x-%08x-%08x",
+ nni_random(), nni_random(), nni_random(), nni_random());
+</code></pre>
<!-- NOTE: This assumes that any page referencing this is located
in a directory two levels down. Meaning ./api/somefile.md or
similar. mdbook cannot accommodate links that are called from