diff options
Diffstat (limited to 'ref/migrate/nng1.html')
| -rw-r--r-- | ref/migrate/nng1.html | 26 |
1 files changed, 26 insertions, 0 deletions
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 & 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 |
