diff options
| -rw-r--r-- | man/tip/_toc.html | 3 | ||||
| -rw-r--r-- | man/tip/index.html | 12 | ||||
| -rw-r--r-- | man/tip/libnng.3.html | 8 | ||||
| -rw-r--r-- | man/tip/nng.7.html | 8 | ||||
| -rw-r--r-- | man/tip/nng_aio_wait.3.html | 14 | ||||
| -rw-r--r-- | man/tip/nng_id_map.3supp.html | 165 | ||||
| -rw-r--r-- | man/tip/nng_ipc.7.html | 16 | ||||
| -rw-r--r-- | man/tip/nng_ipc_options.5.html | 88 | ||||
| -rw-r--r-- | man/tip/nng_options.5.html | 90 | ||||
| -rw-r--r-- | man/tip/nng_pipe_notify.3.html | 14 | ||||
| -rw-r--r-- | man/tip/nng_rep.7.html | 4 | ||||
| -rw-r--r-- | man/tip/nng_req.7.html | 24 | ||||
| -rw-r--r-- | man/tip/nng_socket.7.html | 129 | ||||
| -rw-r--r-- | man/tip/nng_socket_pair.3supp.html | 108 |
14 files changed, 599 insertions, 84 deletions
diff --git a/man/tip/_toc.html b/man/tip/_toc.html index c788149d..505d9a16 100644 --- a/man/tip/_toc.html +++ b/man/tip/_toc.html @@ -280,6 +280,7 @@ <li><a href="nng_cv_wait.3supp.html">nng_cv_wait</a></li> <li><a href="nng_cv_wake.3supp.html">nng_cv_wake</a></li> <li><a href="nng_cv_wake1.3supp.html">nng_cv_wake1</a></li> +<li><a href="nng_id_map.3supp.html">nng_id_map</a></li> <li><a href="nng_msleep.3supp.html">nng_msleep</a></li> <li><a href="nng_mtx_alloc.3supp.html">nng_mtx_alloc</a></li> <li><a href="nng_mtx_free.3supp.html">nng_mtx_free</a></li> @@ -287,6 +288,7 @@ <li><a href="nng_mtx_unlock.3supp.html">nng_mtx_unlock</a></li> <li><a href="nng_opts_parse.3supp.html">nng_opts_parse</a></li> <li><a href="nng_random.3supp.html">nng_random</a></li> +<li><a href="nng_socket_pair.3supp.html">nng_socket_pair</a></li> <li><a href="nng_thread_create.3supp.html">nng_thread_create</a></li> <li><a href="nng_thread_destroy.3supp.html">nng_thread_destroy</a></li> <li><a href="nng_thread_set_name.3supp.html">nng_thread_set_name</a></li> @@ -353,6 +355,7 @@ <li><a href="nng_rep.7.html">nng_rep</a></li> <li><a href="nng_req.7.html">nng_req</a></li> <li><a href="nng_respondent.7.html">nng_respondent</a></li> +<li><a href="nng_socket.7.html">nng_socket</a></li> <li><a href="nng_sub.7.html">nng_sub</a></li> <li><a href="nng_surveyor.7.html">nng_surveyor</a></li> <li><a href="nng_tcp.7.html">nng_tcp</a></li> diff --git a/man/tip/index.html b/man/tip/index.html index 5492cbae..9e9f7316 100644 --- a/man/tip/index.html +++ b/man/tip/index.html @@ -1184,6 +1184,10 @@ mutual exclusion locks, threading, time keeping, and similar needs.</p> <td class="tableblock halign-left valign-top"><p class="tableblock">wake one waiter</p></td> </tr> <tr> +<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="nng_id_map.3supp.html">nng_id_map(3supp)</a></p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">identifier based mapping table</p></td> +</tr> +<tr> <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="nng_msleep.3supp.html">nng_msleep(3supp)</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">sleep milliseconds</p></td> </tr> @@ -1212,6 +1216,10 @@ mutual exclusion locks, threading, time keeping, and similar needs.</p> <td class="tableblock halign-left valign-top"><p class="tableblock">get random number</p></td> </tr> <tr> +<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="nng_socket_pair.3supp.html">nng_socket_pair(3supp)</a></p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">create a connected pair of BSD sockets</p></td> +</tr> +<tr> <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="nng_thread_create.3supp.html">nng_thread_create(3supp)</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">create thread</p></td> </tr> @@ -1521,6 +1529,10 @@ time.</p> <td class="tableblock halign-left valign-top"><p class="tableblock">respondent protocol</p></td> </tr> <tr> +<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="nng_socket.7.html">nng_socket(7)</a></p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">BSD Socket transport (experimental)</p></td> +</tr> +<tr> <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="nng_sub.7.html">nng_sub(7)</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">subscriber protocol</p></td> </tr> diff --git a/man/tip/libnng.3.html b/man/tip/libnng.3.html index 61b5b3ae..f12e7949 100644 --- a/man/tip/libnng.3.html +++ b/man/tip/libnng.3.html @@ -850,6 +850,10 @@ as a convenience to aid in creating portable applications.</p> <td class="tableblock halign-left valign-top"><p class="tableblock">wake one waiter</p></td> </tr> <tr> +<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="nng_id_map.3supp.html">nng_id_map</a></p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">identifier based mapping table</p></td> +</tr> +<tr> <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="nng_msleep.3supp.html">nng_msleep()</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">sleep for milliseconds</p></td> </tr> @@ -878,6 +882,10 @@ as a convenience to aid in creating portable applications.</p> <td class="tableblock halign-left valign-top"><p class="tableblock">get random number</p></td> </tr> <tr> +<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="nng_socket_pair.3supp.html">nng_socket_pair()</a></p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">create connected pair of BSD sockets</p></td> +</tr> +<tr> <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="nng_thread_create.3supp.html">nng_thread_create()</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">create thread</p></td> </tr> diff --git a/man/tip/nng.7.html b/man/tip/nng.7.html index 310a85e2..50f87a62 100644 --- a/man/tip/nng.7.html +++ b/man/tip/nng.7.html @@ -170,6 +170,14 @@ other languages please check the <a href="http://nanomsg.org/">website</a>.</p> </tr> <tr> <td class="hdlist1"> +<a href="nng_socket.7.html">nng_socket(7)</a> +</td> +<td class="hdlist2"> +<p>BSD socket transport</p> +</td> +</tr> +<tr> +<td class="hdlist1"> <a href="nng_tls.7.html">nng_tls(7)</a> </td> <td class="hdlist2"> diff --git a/man/tip/nng_aio_wait.3.html b/man/tip/nng_aio_wait.3.html index ed547232..f248e868 100644 --- a/man/tip/nng_aio_wait.3.html +++ b/man/tip/nng_aio_wait.3.html @@ -37,6 +37,20 @@ completed, then it returns immediately.</p> <p>If a callback was set with <em>aio</em> when it was allocated, then this function will not be called until the callback has completed.</p> </div> +<div class="admonitionblock important"> +<table> +<tr> +<td class="icon"> +<i class="fa icon-important" title="Important"></i> +</td> +<td class="content"> +This function should never be called from a function that itself +is a callback of an <a href="nng_aio.5.html"><code>aio</code></a>, either this one or any other. +Doing so may result in a deadlock. +</td> +</tr> +</table> +</div> </div> </div> <div class="sect1"> diff --git a/man/tip/nng_id_map.3supp.html b/man/tip/nng_id_map.3supp.html new file mode 100644 index 00000000..256bf6d4 --- /dev/null +++ b/man/tip/nng_id_map.3supp.html @@ -0,0 +1,165 @@ +--- +version: tip +layout: manpage_v2 +title: nng_id_map(3supp) +--- +<h1>nng_id_map(3supp)</h1> +<div class="sect1"> +<h2 id="_name">NAME</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>nng_id_map - identifier based mapping table</p> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_synopsis">SYNOPSIS</h2> +<div class="sectionbody"> +<div class="listingblock"> +<div class="content"> +<pre class="pygments highlight"><code data-lang="c"><span class="tok-cp">#include</span> <span class="tok-cpf"><nng/nng.h></span> +<span class="tok-cp">#include</span> <span class="tok-cpf"><nng/supplemental/idhash/idhash.h></span> + +<span class="tok-k">typedef</span> <span class="tok-k">struct</span> <span class="tok-n">nng_id_map_s</span> <span class="tok-n">nng_id_map</span><span class="tok-p">;</span> + +<span class="tok-cp">#define NNG_MAP_RANDOM 1</span> + +<span class="tok-kt">int</span> <span class="tok-nf">nng_id_map_alloc</span><span class="tok-p">(</span><span class="tok-n">nng_id_map</span> <span class="tok-o">**</span><span class="tok-n">map_p</span><span class="tok-p">,</span> <span class="tok-kt">uint64_t</span> <span class="tok-n">lo</span><span class="tok-p">,</span> <span class="tok-kt">uint64_t</span> <span class="tok-n">hi</span><span class="tok-p">,</span> <span class="tok-kt">int</span> <span class="tok-n">flags</span><span class="tok-p">);</span> +<span class="tok-kt">void</span> <span class="tok-nf">nng_id_map_free</span><span class="tok-p">(</span><span class="tok-n">nng_id_map</span> <span class="tok-o">*</span><span class="tok-n">map</span><span class="tok-p">);</span> +<span class="tok-kt">void</span> <span class="tok-o">*</span><span class="tok-nf">nng_id_get</span><span class="tok-p">(</span><span class="tok-n">nng_id_map</span> <span class="tok-o">*</span><span class="tok-n">map</span><span class="tok-p">,</span> <span class="tok-kt">uint64_t</span> <span class="tok-n">id</span><span class="tok-p">);</span> +<span class="tok-kt">int</span> <span class="tok-nf">nng_id_set</span><span class="tok-p">(</span><span class="tok-n">nng_id_map</span> <span class="tok-o">*</span><span class="tok-n">map</span><span class="tok-p">,</span> <span class="tok-kt">uint64_t</span><span class="tok-p">,</span> <span class="tok-kt">void</span> <span class="tok-o">*</span><span class="tok-n">value</span><span class="tok-p">);</span> +<span class="tok-kt">int</span> <span class="tok-nf">nng_id_alloc</span><span class="tok-p">(</span><span class="tok-n">nng_id_map</span> <span class="tok-o">*</span><span class="tok-n">map</span><span class="tok-p">,</span> <span class="tok-kt">uint64_t</span> <span class="tok-o">*</span><span class="tok-n">id_p</span><span class="tok-p">,</span> <span class="tok-kt">void</span> <span class="tok-o">*</span><span class="tok-n">value</span><span class="tok-p">);</span> +<span class="tok-kt">int</span> <span class="tok-nf">nng_id_remove</span><span class="tok-p">(</span><span class="tok-n">nng_id_map</span> <span class="tok-o">*</span><span class="tok-n">map</span><span class="tok-p">,</span> <span class="tok-kt">uint64_t</span> <span class="tok-n">id</span><span class="tok-p">);</span></code></pre> +</div> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_description">DESCRIPTION</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>These functions provide support for managing tables of data based on +identifiers, ensuring that identifiers are allocated uniquely and within +specified range limits.</p> +</div> +<div class="paragraph"> +<p>The table stores data pointers (which must not be <code>NULL</code>) at a logical numeric index. +It does so efficiently, even if large gaps exist, and it provides a means to efficiently +allocate a numeric identifier from a pool of unused identifiers.</p> +</div> +<div class="paragraph"> +<p>Identifiers are allocated in increasing order, without reusing old identifiers until the +largest possible identifier is allocated. After wrapping, only identifiers that are no longer +in use will be considered. +No effort to order the availability of identifiers based on when they were freed is made.</p> +</div> +<div class="paragraph"> +<p>An initial table is allocated with <code>nng_id_map_alloc()</code>, which takes the lowest legal identifier in <em>lo</em>, +and the largest legal identifier in <em>hi</em>. +The new table is returned in <em>map_p</em>, and should be used as the <em>map</em> argument to the rest of these functions.</p> +</div> +<div class="sidebarblock"> +<div class="content"> +<div class="paragraph"> +<p>As a special convenience, if these are specified as zero, then a full range of 32-bit identifiers is assumed. +If identifiers larger than or equal to 2<sup>32</sup> are required, then both <em>lo</em> and <em>hi</em> must be specified with the +exact values desired.</p> +</div> +</div> +</div> +<div class="paragraph"> +<p>The <em>flags</em> argument is a bit mask of flags for the table. +If <code>NNG_MAP_RANDOM</code> is specified, then the starting point for allocations is randomized, but subsequent allocations will then be monotonically increasing. +This is useful to reduce the odds of different instances of an application using the same identifiers at the same time.</p> +</div> +<div class="paragraph"> +<p>The <code>nng_id_get()</code> function returns the value previously stored with the given identifier. +If no value is currently associated with the identifer, it returns <code>NULL</code>.</p> +</div> +<div class="paragraph"> +<p>The <code>nng_id_set()</code> function sets the value with the associated identifier. +This can be used to replace a previously allocated identifier. +If the identifier was not previously allocated, then it is allocated as part of the call. +This function does not necessarily honor the identifier range limits set for the map when it was allocated.</p> +</div> +<div class="paragraph"> +<p>The <code>nng_id_alloc()</code> function allocates a new identifier from the range for the map, and associates it with +the supplied <em>value</em>.</p> +</div> +<div class="paragraph"> +<p>The <code>nng_id_remove()</code> function removes the identifier and its associated value from the table.</p> +</div> +<div class="admonitionblock note"> +<table> +<tr> +<td class="icon"> +<i class="fa icon-note" title="Note"></i> +</td> +<td class="content"> +These functions are limited to storing at most 2<sup>32</sup> identifiers, even though the identifers may +themselves be larger than 2<sup>32</sup>. +</td> +</tr> +</table> +</div> +<div class="admonitionblock important"> +<table> +<tr> +<td class="icon"> +<i class="fa icon-important" title="Important"></i> +</td> +<td class="content"> +These functions are <strong>not</strong> thread-safe. +Callers should use a <a href="nng_mtx_lock.html">mutex</a> or similar approach when thread-safety is needed. +</td> +</tr> +</table> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_return_values">RETURN VALUES</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>The <code>nng_id_map_alloc()</code>, <code>nng_id_set()</code>, <code>nng_id_alloc()</code>, and <code>nng_id_remove()</code> functions +return 0 on success, or -1 on failure.</p> +</div> +<div class="paragraph"> +<p>The <code>nng_id_map_get()</code> function returns the requested data pointer, or <code>NULL</code> if the identifier was not found.</p> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_errors">ERRORS</h2> +<div class="sectionbody"> +<div class="hdlist"> +<table> +<tr> +<td class="hdlist1"> +<code>NNG_ENOENT</code> +</td> +<td class="hdlist2"> +<p>The <em>id</em> does not exist in the table.</p> +</td> +</tr> +<tr> +<td class="hdlist1"> +<code>NNG_ENOMEM</code> +</td> +<td class="hdlist2"> +<p>Insufficient memory is available, or the table is full.</p> +</td> +</tr> +</table> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_see_also">SEE ALSO</h2> +<div class="sectionbody"> +<div class="paragraph text-left"> +<p><a href="nng_mtx_lock.3supp.html">nng(7)</a> +<a href="nng.7.html">nng(7)</a></p> +</div> +</div> +</div> diff --git a/man/tip/nng_ipc.7.html b/man/tip/nng_ipc.7.html index c872246c..833dd61c 100644 --- a/man/tip/nng_ipc.7.html +++ b/man/tip/nng_ipc.7.html @@ -186,28 +186,28 @@ where supported by the underlying platform.</p> <div class="ulist"> <ul> <li> -<p><a href="nng_ipc_options.5.html"><code>NNG_OPT_IPC_PEER_GID</code></a></p> +<p><a href="nng_ipc_options.5.html"><code>NNG_OPT_IPC_PERMISSIONS</code></a></p> </li> <li> -<p><a href="nng_ipc_options.5.html"><code>NNG_OPT_IPC_PEER_PID</code></a></p> +<p><a href="nng_ipc_options.5.html"><code>NNG_OPT_IPC_SECURITY_DESCRIPTOR</code></a></p> </li> <li> -<p><a href="nng_ipc_options.5.html"><code>NNG_OPT_IPC_PEER_UID</code></a></p> +<p><a href="nng_options.5.html"><code>NNG_OPT_LOCADDR</code></a></p> </li> <li> -<p><a href="nng_ipc_options.5.html"><code>NNG_OPT_IPC_PEER_ZONEID</code></a></p> +<p><a href="nng_options.5.html"><code>NNG_OPT_REMADDR</code></a></p> </li> <li> -<p><a href="nng_ipc_options.5.html"><code>NNG_OPT_IPC_PERMISSIONS</code></a></p> +<p><a href="nng_options.5.html"><code>NNG_OPT_PEER_GID</code></a></p> </li> <li> -<p><a href="nng_ipc_options.5.html"><code>NNG_OPT_IPC_SECURITY_DESCRIPTOR</code></a></p> +<p><a href="nng_options.5.html"><code>NNG_OPT_PEER_PID</code></a></p> </li> <li> -<p><a href="nng_options.5.html"><code>NNG_OPT_LOCADDR</code></a></p> +<p><a href="nng_options.5.html"><code>NNG_OPT_PEER_UID</code></a></p> </li> <li> -<p><a href="nng_options.5.html"><code>NNG_OPT_REMADDR</code></a></p> +<p><a href="nng_options.5.html"><code>NNG_OPT_PEER_ZONEID</code></a></p> </li> <li> <p><a href="nng_options.5.html"><code>NNG_OPT_URL</code></a></p> diff --git a/man/tip/nng_ipc_options.5.html b/man/tip/nng_ipc_options.5.html index e7c91d49..5c774b81 100644 --- a/man/tip/nng_ipc_options.5.html +++ b/man/tip/nng_ipc_options.5.html @@ -56,62 +56,14 @@ description of the option.</p> <i class="fa icon-note" title="Note"></i> </td> <td class="content"> -The availability of any of the following options is platform-specific, +The availability of the following options is platform-specific, as the implementations of IPC are quite different on Windows and POSIX systems. </td> </tr> </table> </div> -<div class="sect2"> -<h3 id="_ipc_options">IPC Options</h3> <div class="dlist"> <dl> -<dt class="hdlist1"><a id="NNG_OPT_IPC_PEER_GID"></a><code>NNG_OPT_IPC_PEER_GID</code></dt> -<dd> -<p>(<code>uint64_t</code>) -This read-only option provides a connected peer’s primary -group id. -This is the effective group id of the peer when either the underlying -<code>listen()</code> or <code>connect()</code> calls were made, and is not forgeable. -This option is generally only available on POSIX systems.</p> -</dd> -<dt class="hdlist1"><a id="NNG_OPT_IPC_PEER_PID"></a><code>NNG_OPT_IPC_PEER_PID</code></dt> -<dd> -<p>(<code>uint64_t</code>) -This read-only option provides the the process id -of the connected peer. -This option is only available on Windows, Linux, and certain other systems.</p> -<div class="admonitionblock note"> -<table> -<tr> -<td class="icon"> -<i class="fa icon-note" title="Note"></i> -</td> -<td class="content"> -Applications should not assume that the process ID does not change, -as it is possible (although unsupported!) for a nefarious process to pass a -file descriptor between processes. -However, it is not possible for a nefarious application to forge the identity -of a well-behaved one using this method. -</td> -</tr> -</table> -</div> -</dd> -<dt class="hdlist1"><a id="NNG_OPT_IPC_PEER_UID"></a><code>NNG_OPT_IPC_PEER_UID</code></dt> -<dd> -<p>(<code>uint64_t</code>) -This read-only option provides a connected peer’s user id. -This is the effective user id of the peer when either the underlying -<code>listen()</code> or <code>connect()</code> calls were made, and is not forgeable. -This option is generally only available on POSIX systems.</p> -</dd> -<dt class="hdlist1"><a id="NNG_OPT_IPC_PEER_ZONEID"></a><code>NNG_OPT_IPC_PEER_ZONEID</code></dt> -<dd> -<p>(<code>uint64_t</code>) -This read-only option provides a connected peer’s the zone id. -Zones (and this option) are only supported on Solaris and illumos systems.</p> -</dd> <dt class="hdlist1"><a id="NNG_OPT_IPC_PERMISSIONS"></a><code>NNG_OPT_IPC_PERMISSIONS</code></dt> <dd> <p>(<code>int</code>) @@ -191,12 +143,32 @@ applied to listeners that have not been started yet.</p> </dd> </dl> </div> +<div class="sect2"> +<h3 id="_common_platform_specific_options">Common Platform Specific Options</h3> +<div class="paragraph"> +<p>The following options are supported by this transport when the underlying platform supports them:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p><a href="nng_options.5.html"><code>NNG_OPT_PEER_GID</code></a> (also available as <code>NNG_OPT_IPC_PEER_GID</code>)</p> +</li> +<li> +<p><a href="nng_options.5.html"><code>NNG_OPT_PEER_PID</code></a> (also available as <code>NNG_OPT_IPC_PEER_PID</code>)</p> +</li> +<li> +<p><a href="nng_options.5.html"><code>NNG_OPT_PEER_UID</code></a> (also available as <code>NNG_OPT_IPC_PEER_UID</code>)</p> +</li> +<li> +<p><a href="nng_options.5.html"><code>NNG_OPT_PEER_ZONEID</code></a> (also available as <code>NNG_OPT_IPC_PEER_ZONEID</code>)</p> +</li> +</ul> +</div> </div> <div class="sect2"> <h3 id="_inherited_options">Inherited Options</h3> <div class="paragraph"> -<p>Generally, the following option values are also available for TLS objects, -when appropriate for the context:</p> +<p>Generally, the following option values are also available when appropriate for the context:</p> </div> <div class="ulist"> <ul> @@ -215,14 +187,14 @@ when appropriate for the context:</p> <h2 id="_see_also">SEE ALSO</h2> <div class="sectionbody"> <div class="paragraph text-left"> -<p><a href="nng_ipc_dialer_getopt.3ipc.html">nng_ipc_dialer_getopt(3ipc)</a>, -<a href="nng_ipc_dialer_setopt.3ipc.html">nng_ipc_dialer_setopt(3ipc)</a>, -<a href="nng_ipc_getopt.3ipc.html">nng_ipc_getopt(3ipc)</a>, -<a href="nng_ipc_listener_getopt.3ipc.html">nng_ipc_listener_getopt(3ipc)</a>, -<a href="nng_ipc_listener_setopt.3ipc.html">nng_ipc_listener_setopt(3ipc)</a>, -<a href="nng_ipc_setopt.3ipc.html">nng_ipc_setopt(3ipc)</a>, +<p><a href="nng_dialer_get.3.html">nng_dialer_get(3)</a>, +<a href="nng_dialer_set.3.html">nng_dialer_set(3)</a>, +<a href="nng_listener_get.3.html">nng_listener_get(3)</a>, +<a href="nng_listener_set.3.html">nng_listener_set(3)</a>, +<a href="nng_pipe_get.3.html">nng_pipe_get(3)</a>, <a href="nng_options.5.html">nng_options(5)</a> -<a href="nng.7.html">nng(7)</a></p> +<a href="nng.7.html">nng(7)</a>, +<a href="nng_ipc.7.html">nng_ipc(7)</a></p> </div> </div> </div> diff --git a/man/tip/nng_options.5.html b/man/tip/nng_options.5.html index 582f5519..c6459c28 100644 --- a/man/tip/nng_options.5.html +++ b/man/tip/nng_options.5.html @@ -37,7 +37,11 @@ title: nng_options(5) <span class="tok-cp">#define NNG_OPT_MAXTTL "ttl-max"</span> <span class="tok-cp">#define NNG_OPT_RECVMAXSZ "recv-size-max"</span> <span class="tok-cp">#define NNG_OPT_RECONNMINT "reconnect-time-min"</span> -<span class="tok-cp">#define NNG_OPT_RECONNMAXT "reconnect-time-max"</span></code></pre> +<span class="tok-cp">#define NNG_OPT_RECONNMAXT "reconnect-time-max"</span> +<span class="tok-cp">#define NNG_OPT_PEER_GID "ipc:peer-gid"</span> +<span class="tok-cp">#define NNG_OPT_PEER_PID "ipc:peer-pid"</span> +<span class="tok-cp">#define NNG_OPT_PEER_UID "ipc:peer-uid"</span> +<span class="tok-cp">#define NNG_OPT_PEER_ZONEID "ipc:peer-zoneid"</span></code></pre> </div> </div> </div> @@ -540,12 +544,62 @@ peer protocol for the socket.</p> </dd> </dl> </div> -<div id="NNG_OPT_PROTONAME" class="dlist"> +<div id="NNG_OPT_PEER_GID" class="dlist"> <dl> -<dt class="hdlist1"><code>NNG_OPT_PROTONAME</code></dt> +<dt class="hdlist1"><code>NNG_OPT_PEER_GID</code></dt> <dd> -<p>(string) -This read-only option is used to obtain the name of the socket’s protocol.</p> +<p>(<code>uint64_t</code>) +This read-only option provides a connected peer’s primary group id, when known. +This is the effective group id of the peer when either the underlying +<code>listen()</code> or <code>connect()</code> calls were made, and is not forgeable. +This option is generally only available on POSIX systems, only on certain transports.</p> +</dd> +</dl> +</div> +<div id="NNG_OPT_PEER_PID" class="dlist"> +<dl> +<dt class="hdlist1"><code>NNG_OPT_PEER_PID</code></dt> +<dd> +<p>(<code>uint64_t</code>) +This read-only option provides the process id of the connected peer, when known. +This option is only available on certain platforms and transports.</p> +<div class="admonitionblock note"> +<table> +<tr> +<td class="icon"> +<i class="fa icon-note" title="Note"></i> +</td> +<td class="content"> +Applications should not assume that the process ID does not change, +as it may be possible for a process to pass a file descriptor between processes. +However, it is not possible for a nefarious application to forge the identity +of a well-behaved one using this method. +</td> +</tr> +</table> +</div> +</dd> +</dl> +</div> +<div id="NNG_OPT_PEER_UID" class="dlist"> +<dl> +<dt class="hdlist1"><code>NNG_OPT_PEER_UID</code></dt> +<dd> +<p>(<code>uint64_t</code>) +This read-only option provides a connected peer’s user id. +This is the effective user id of the peer when either the underlying +<code>listen()</code> or <code>connect()</code> calls were made, and cannot be forged. +This option is generally only available on POSIX systems, on certain transports.</p> +</dd> +</dl> +</div> +<div id="NNG_OPT_PEER_ZONEID" class="dlist"> +<dl> +<dt class="hdlist1"><code>NNG_OPT_PEER_ZONEID</code></dt> +<dd> +<p>(<code>uint64_t</code>) +This read-only option provides a connected peer’s the zone id. +Zones (and this option) are only supported on Solaris and illumos systems, on select transports.</p> </dd> </dl> </div> @@ -554,8 +608,16 @@ This read-only option is used to obtain the name of the socket’s protocol. <dt class="hdlist1"><code>NNG_OPT_PEERNAME</code></dt> <dd> <p>(string) -This read-only option is used to obtain the name of the peer protocol for -the socket.</p> +This read-only option is used to obtain the name of the peer protocol for the socket.</p> +</dd> +</dl> +</div> +<div id="NNG_OPT_PROTONAME" class="dlist"> +<dl> +<dt class="hdlist1"><code>NNG_OPT_PROTONAME</code></dt> +<dd> +<p>(string) +This read-only option is used to obtain the name of the socket’s protocol.</p> </dd> </dl> </div> @@ -566,13 +628,13 @@ the socket.</p> <h2 id="_see_also">SEE ALSO</h2> <div class="sectionbody"> <div class="paragraph text-left"> -<p><a href="nng_dialer_getopt.3.html">nng_dialer_getopt(3)</a>, -<a href="nng_dialer_setopt.3.html">nng_dialer_setopt(3)</a>, -<a href="nng_getopt.3.html">nng_getopt(3)</a>, -<a href="nng_listener_getopt.3.html">nng_listener_getopt(3)</a>, -<a href="nng_listener_setopt.3.html">nng_listener_setopt(3)</a>, -<a href="nng_pipe_getopt.3.html">nng_pipe_getopt(3)</a>, -<a href="nng_setopt.3.html">nng_setopt(3)</a>, +<p><a href="nng_dialer_get.3.html">nng_dialer_get(3)</a>, +<a href="nng_dialer_set.3.html">nng_dialer_set(3)</a>, +<a href="nng_listener_get.3.html">nng_listener_get(3)</a>, +<a href="nng_listener_set.3.html">nng_listener_set(3)</a>, +<a href="nng_pipe_get.3.html">nng_pipe_get(3)</a>, +<a href="nng_socket_get.3.html">nng_socket_get(3)</a>, +<a href="nng_socket_set.3.html">nng_socket_set(3)</a>, <a href="nng_ipc_options.5.html">nng_ipc_options(5)</a>, <a href="nng_tcp_options.5.html">nng_tcp_options(5)</a>, <a href="nng_tls_options.5.html">nng_tls_options(5)</a>, diff --git a/man/tip/nng_pipe_notify.3.html b/man/tip/nng_pipe_notify.3.html index ad477be1..e96acdab 100644 --- a/man/tip/nng_pipe_notify.3.html +++ b/man/tip/nng_pipe_notify.3.html @@ -75,6 +75,20 @@ possible communicate using this pipe.</p> </dd> </dl> </div> +<div class="admonitionblock warning"> +<table> +<tr> +<td class="icon"> +<i class="fa icon-warning" title="Warning"></i> +</td> +<td class="content"> +The callback <em>cb</em> function must <strong>not</strong> attempt to perform any +accesses to the socket, as it is called with a lock on the socket held! +Doing so would thus result in a deadlock. +</td> +</tr> +</table> +</div> <div class="admonitionblock tip"> <table> <tr> diff --git a/man/tip/nng_rep.7.html b/man/tip/nng_rep.7.html index c883e56f..f81bf6e6 100644 --- a/man/tip/nng_rep.7.html +++ b/man/tip/nng_rep.7.html @@ -41,7 +41,7 @@ until a reply is received or the request times out.</p> </td> <td class="content"> This protocol is useful in setting up RPC-like services. -It is also reliable, in that a the requester will keep retrying until +It is also reliable, in that a requester will keep retrying until a reply is received. </td> </tr> @@ -81,7 +81,7 @@ use cases using <a href="nng_ctx_open.3.html"><code>nng_ctx_open()</code></a>.</ </div> <div class="paragraph"> <p>Each context may have at most one outstanding request, and operates -independently from the others. +independently of the others. The restrictions for order of operations with sockets apply equally well for contexts, except that each context will be treated as if it were a separate socket.</p> diff --git a/man/tip/nng_req.7.html b/man/tip/nng_req.7.html index 32ca4dfe..3d4fb26c 100644 --- a/man/tip/nng_req.7.html +++ b/man/tip/nng_req.7.html @@ -152,10 +152,30 @@ a separate socket.</p> <p>(<a href="nng_duration.5.html"><code>nng_duration</code></a>) When a new request is started, a timer of this duration is also started. If no reply is received before this timer expires, then the request will -be resent. -(Requests are also automatically resent if the peer to whom +be resent.</p> +<div class="paragraph"> +<p>(Requests are also automatically resent if the peer to whom the original request was sent disconnects, or if a peer becomes available while the requester is waiting for an available peer.)</p> +</div> +<div class="paragraph"> +<p>Resending may be deferred up to the value of the <code>NNG_OPT_RESENDTICK</code> parameter.</p> +</div> +</dd> +<dt class="hdlist1"><code>NNG_OPT_REQ_RESENDTICK</code></dt> +<dd> +<p>(<a href="nng_duration.5.html"><code>nng_duration</code></a>) +This is the granularity of the clock that is used to check for resending. +The default is a second. Setting this to a higher rate will allow for +more timely resending to occur, but may incur significant additional +overhead when the socket has many outstanding requests (contexts).</p> +<div class="paragraph"> +<p>When there are no requests outstanding that have a resend set, then +the clock does not tick at all.</p> +</div> +<div class="paragraph"> +<p>This option is shared for all contexts on a socket, and is only available for the socket itself.</p> +</div> </dd> </dl> </div> diff --git a/man/tip/nng_socket.7.html b/man/tip/nng_socket.7.html new file mode 100644 index 00000000..9139ab84 --- /dev/null +++ b/man/tip/nng_socket.7.html @@ -0,0 +1,129 @@ +--- +version: tip +layout: manpage_v2 +title: nng_socket(7) +--- +<h1>nng_socket(7)</h1> +<div class="sect1"> +<h2 id="_name">NAME</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>nng_socket - BSD Socket transport (experimental)</p> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_description">DESCRIPTION</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>(transport, <em>socket</em>) +The <em>socket</em> transport provides communication support between +peers across a arbitrary BSD sockets, such as those that are +created with <a href="nng_socket_pair.3supp.html"><code>nng_socket_pair()</code></a>.</p> +</div> +<div class="paragraph"> +<p>This transport only supports <a href="nng_listener.5.html">listeners</a>, using <a href="nng_listener_create.3.html"><code>nng_listener_create()</code></a>.</p> +</div> +<div class="admonitionblock note"> +<table> +<tr> +<td class="icon"> +<i class="fa icon-note" title="Note"></i> +</td> +<td class="content"> +Attempts to create a <a href="nng_dialer.5.html">dialer</a> using this transport will result in <code>NNG_ENOTSUP</code>. +</td> +</tr> +</table> +</div> +<div class="paragraph"> +<p>The socket file descriptor is passed to the listener using the <code>NNG_OPT_SOCKET_FD</code> option (as an integer). +Setting this option (which is read-only and can be set multiple times) will cause the listener +to create a <a href="nng_pipe.5.html">pipe</a> associated backed by the file descriptor.</p> +</div> +<div class="paragraph"> +<p>The protocol between peers using this pipe is at present compatible with the protocol used for the +<a href="nng_tcp.7.html">TCP</a> transport, but this is an implementation detail and subject to change without notice.</p> +</div> +<div class="admonitionblock note"> +<table> +<tr> +<td class="icon"> +<i class="fa icon-note" title="Note"></i> +</td> +<td class="content"> +This transport is <strong>experimental</strong>, and at present is only supported on POSIX platforms. +</td> +</tr> +</table> +</div> +<div class="sect2"> +<h3 id="_registration">Registration</h3> +<div class="paragraph"> +<p>No special action is necessary to register this transport.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_uri_format">URI Format</h3> +<div class="paragraph"> +<p>(URI, <code>socket://</code>) +This transport uses the URL <code>socket://</code>, without further qualification.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_socket_address">Socket Address</h3> +<div class="paragraph"> +<p>The socket address will be of family <code>NNG_AF_UNSPEC</code>. +There are no further socket details available.</p> +</div> +</div> +<div class="sect2"> +<h3 id="_transport_options">Transport Options</h3> +<div class="paragraph"> +<p>The following transport option is available:</p> +</div> +<div class="dlist"> +<dl> +<dt class="hdlist1"><code>NNG_OPT_SOCKET_FD</code></dt> +<dd> +<p>(int) This is a write-only option, that may be set multiple times on a listener. +The listener will create a pipe backed by the given file descriptor passed as an argument.</p> +</dd> +</dl> +</div> +<div class="paragraph"> +<p>Additionally, the following options may be supported on pipes when the platform supports them:</p> +</div> +<div class="ulist"> +<ul> +<li> +<p><a href="nng_options.5.html"><code>NNG_OPT_PEER_GID</code></a></p> +</li> +<li> +<p><a href="nng_options.5.html"><code>NNG_OPT_PEER_PID</code></a></p> +</li> +<li> +<p><a href="nng_options.5.html"><code>NNG_OPT_PEER_UID</code></a></p> +</li> +<li> +<p><a href="nng_options.5.html"><code>NNG_OPT_PEER_ZONEID</code></a></p> +</li> +</ul> +</div> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_see_also">SEE ALSO</h2> +<div class="sectionbody"> +<div class="paragraph text-left"> +<p><a href="nng_socket_pair.3supp.html">nng_socket_pair(3)</a>, +<a href="nng_dialer.5.html">nng_dialer(5)</a>, +<a href="nng_listener.5.html">nng_listener(5)</a>, +<a href="nng_options.5.html">nng_options(5)</a>, +<a href="nng_pipe.5.html">nng_pipe(5)</a>, +<a href="nng_sockaddr.5.html">nng_sockaddr(5)</a>, +<a href="nng.7.html">nng(7)</a></p> +</div> +</div> +</div> diff --git a/man/tip/nng_socket_pair.3supp.html b/man/tip/nng_socket_pair.3supp.html new file mode 100644 index 00000000..a11f5009 --- /dev/null +++ b/man/tip/nng_socket_pair.3supp.html @@ -0,0 +1,108 @@ +--- +version: tip +layout: manpage_v2 +title: nng_socket_pair(3supp) +--- +<h1>nng_socket_pair(3supp)</h1> +<div class="sect1"> +<h2 id="_name">NAME</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>nng_socket_pair - create a connected pair of BSD sockets</p> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_synopsis">SYNOPSIS</h2> +<div class="sectionbody"> +<div class="listingblock"> +<div class="content"> +<pre class="pygments highlight"><code data-lang="c"><span class="tok-cp">#include</span> <span class="tok-cpf"><nng/nng.h></span> +<span class="tok-cp">#include</span> <span class="tok-cpf"><nng/supplemental/util/platform.h></span> + +<span class="tok-kt">int</span> <span class="tok-nf">nng_socket_pair</span><span class="tok-p">(</span><span class="tok-kt">int</span> <span class="tok-n">fds</span><span class="tok-p">[</span><span class="tok-mi">2</span><span class="tok-p">]);</span></code></pre> +</div> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_description">DESCRIPTION</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>The <code>nng_socket_pair()</code> function creates a pair of connected BSD sockets. +These sockets, which are returned in the <em>fds</em> array, are suitable for +use with the <a href="nng_socket.7.html"><em>socket</em></a> transport.</p> +</div> +<div class="paragraph"> +<p>On POSIX platforms, this is a thin wrapper around the standard <code>socketpair()</code> function, +using the <code>AF_UNIX</code> family and the <code>SOCK_STREAM</code> socket type.</p> +</div> +<div class="admonitionblock note"> +<table> +<tr> +<td class="icon"> +<i class="fa icon-note" title="Note"></i> +</td> +<td class="content"> +At present only POSIX platforms implementing <code>socketpair()</code> are supported with this function. +</td> +</tr> +</table> +</div> +<div class="admonitionblock tip"> +<table> +<tr> +<td class="icon"> +<i class="fa icon-tip" title="Tip"></i> +</td> +<td class="content"> +This function may be useful for creating a shared connection between a parent process and +a child process on UNIX platforms, without requiring the processes use a shared filesystem or TCP connection. +</td> +</tr> +</table> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_return_values">RETURN VALUES</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>This function returns 0 on success, and non-zero otherwise.</p> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_errors">ERRORS</h2> +<div class="sectionbody"> +<div class="hdlist"> +<table> +<tr> +<td class="hdlist1"> +<code>NNG_ENOMEM</code> +</td> +<td class="hdlist2"> +<p>Insufficient memory exists.</p> +</td> +</tr> +<tr> +<td class="hdlist1"> +<code>NNG_ENOTSUP</code> +</td> +<td class="hdlist2"> +<p>This platform does not support socket pairs.</p> +</td> +</tr> +</table> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="_see_also">SEE ALSO</h2> +<div class="sectionbody"> +<div class="paragraph text-left"> +<p><a href="nng_socket.7.html">nng_socket(7)</a>, +<a href="nng.7.html">nng(7)</a></p> +</div> +</div> +</div> |
