1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
---
version: tip
layout: manpage_v2
title: nng_ipc(7)
---
<h1>nng_ipc(7)</h1>
<div class="sect1">
<h2 id="_name">NAME</h2>
<div class="sectionbody">
<div class="paragraph">
<p>nng_ipc - IPC transport</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></span><span class="tok-cp">#include</span><span class="tok-w"> </span><span class="tok-cpf"><nng/transport/ipc/ipc.h></span>
<span class="tok-kt">int</span><span class="tok-w"> </span><span class="tok-nf">nng_ipc_register</span><span class="tok-p">(</span><span class="tok-kt">void</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 <em>ipc</em> transport provides communication support between
sockets within different processes on the same host.
For POSIX platforms, this is implemented using UNIX domain sockets.
For Windows, this is implemented using Windows Named Pipes.
Other platforms may have different implementation strategies.</p>
</div>
<div class="sect2">
<h3 id="_registration">Registration</h3>
<div class="paragraph">
<p>This transport is generally built-in to the core, so
no extra steps to use it should be necessary.</p>
</div>
</div>
<div class="sect2">
<h3 id="_uri_formats">URI Formats</h3>
<div class="sect3">
<h4 id="_traditional_names">Traditional Names</h4>
<div class="paragraph">
<p>
This transport uses URIs using the scheme <code>ipc://</code>, followed by a path
name in the file system where the socket or named pipe should be created.</p>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
On Windows, all names are prefixed by <code>\\.\pipe\</code> and do not
reside in the normal file system.
On POSIX platforms, the path is taken literally, and is relative to
the current directory, unless it begins with <code>/</code>, in which case it is
relative to the root directory.
</td>
</tr>
</table>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
When using relative paths on POSIX systems, the address used and returned
in properties like <code>NNG_OPT_LOCADDR</code> and <code>NNG_OPT_URL</code> will also be relative.
Consequently, they will only be interpreted the same by processes that have
the same working directory.
To ensure maximum portability and safety, absolute paths are recommended
whenever possible.
</td>
</tr>
</table>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
If compatibility with legacy <em>nanomsg</em> applications is required,
then path names must not be longer than 122 bytes, including the final
<code>NUL</code> byte.
This is because legacy versions of <em>nanomsg</em> cannot express URLs
longer than 128 bytes, including the <code>ipc://</code> prefix.
</td>
</tr>
</table>
</div>
</div>
<div class="sect3">
<h4 id="_unix_aliases">UNIX Aliases</h4>
<div class="paragraph">
<p>
The <code>unix://</code> scheme is an alias for <code>ipc://</code> and can be used inter-changeably, but only
on POSIX systems.</p>
</div>
<div class="paragraph">
<p>The purpose of this scheme is to support a future transport making use of <code>AF_UNIX</code>
on Windows systems, at which time it will be necessary to discriminate between
the Named Pipes and the <code>AF_UNIX</code> based transports.</p>
</div>
</div>
<div class="sect3">
<h4 id="_abstract_names">Abstract Names</h4>
<div class="paragraph">
<p>
On Linux, this transport also can support abstract sockets.
Abstract sockets use a URI-encoded name after the scheme, which allows arbitrary values to be conveyed
in the path, including embedded <code>NUL</code> bytes.
For example, the name <code>"a\0b"</code> would be represented as <code>abstract://a%00b</code>.</p>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
An empty name may be used with a listener to request “auto bind” be used to select a name.
In this case the system will allocate a free name.
The name assigned may be retrieved using <code>NNG_OPT_LOCADDR</code>.
</td>
</tr>
</table>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<em>NNG</em> cannot represent an abstract socket with the empty name.
</td>
</tr>
</table>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
Abstract names do not include the leading <code>NUL</code> byte used in the low-level socket address.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>Abstract sockets do not have any representation in the file system, and are automatically freed by
the system when no longer in use.
Abstract sockets ignore socket permissions, but it is still possible to determine the credentials
of the peer with <code>NNG_OPT_PEER_UID</code>, etc.</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_socket_address">Socket Address</h3>
<div class="paragraph">
<p>When using an <a href="nng_sockaddr.5.html"><code>nng_sockaddr</code></a> structure,
the actual structure is of type <a href="nng_sockaddr_ipc.5.html"><code>nng_sockaddr_ipc</code></a>,
except for abstract sockets, which use <a href="nng_sockaddr_abstract.5.html"><code>nng_sockaddr_abstract</code></a>.</p>
</div>
</div>
<div class="sect2">
<h3 id="_transport_options">Transport Options</h3>
<div class="paragraph">
<p>The following transport options are supported by this transport,
where supported by the underlying platform.</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="nng_ipc_options.5.html#NNG_OPT_IPC_PERMISSIONS"><code>NNG_OPT_IPC_PERMISSIONS</code></a></p>
</li>
<li>
<p><a href="nng_ipc_options.5.html#NNG_OPT_IPC_SECURITY_DESCRIPTOR"><code>NNG_OPT_IPC_SECURITY_DESCRIPTOR</code></a></p>
</li>
<li>
<p><a href="nng_options.5.html#NNG_OPT_LOCADDR"><code>NNG_OPT_LOCADDR</code></a></p>
</li>
<li>
<p><a href="nng_options.5.html#NNG_OPT_REMADDR"><code>NNG_OPT_REMADDR</code></a></p>
</li>
<li>
<p><a href="nng_options.5.html#NNG_OPT_PEER_GID"><code>NNG_OPT_PEER_GID</code></a></p>
</li>
<li>
<p><a href="nng_options.5.html#NNG_OPT_PEER_PID"><code>NNG_OPT_PEER_PID</code></a></p>
</li>
<li>
<p><a href="nng_options.5.html#NNG_OPT_PEER_UID"><code>NNG_OPT_PEER_UID</code></a></p>
</li>
<li>
<p><a href="nng_options.5.html#NNG_OPT_PEER_ZONEID"><code>NNG_OPT_PEER_ZONEID</code></a></p>
</li>
<li>
<p><a href="nng_options.5.html#NNG_OPT_URL"><code>NNG_OPT_URL</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_sockaddr.5.html">nng_sockaddr(5)</a>,
<a href="nng_ipc_options.5.html">nng_ipc_options(5)</a>,
<a href="nng_options.5.html">nng_options(5)</a>,
<a href="nng.7.html">nng(7)</a></p>
</div>
</div>
</div>
|