'\" t
.\"     Title: nng_ipc
.\"    Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.23
.\"      Date: 2025-02-02
.\"    Manual: NNG Reference Manual
.\"    Source: \ \&
.\"  Language: English
.\"
.TH "NNG_IPC" "7" "2025-02-02" "\ \&" "NNG Reference Manual"
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.ss \n[.ss] 0
.nh
.ad l
.de URL
\fI\\$2\fP <\\$1>\\$3
..
.als MTO URL
.if \n[.g] \{\
.  mso www.tmac
.  am URL
.    ad l
.  .
.  am MTO
.    ad l
.  .
.  LINKSTYLE blue R < >
.\}
.SH "NAME"
nng_ipc \- IPC transport
.SH "SYNOPSIS"
.sp
.if n .RS 4
.nf
.fam C
#include <nng/transport/ipc/ipc.h>

int nng_ipc_register(void);
.fam
.fi
.if n .RE
.SH "DESCRIPTION"
.sp

The \fIipc\fP 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.
.SS "Registration"
.sp
This transport is generally built\-in to the core, so
no extra steps to use it should be necessary.
.SS "URI Formats"
.SS "Traditional Names"
.sp

This transport uses URIs using the scheme \f(CRipc://\fP, followed by a path
name in the file system where the socket or named pipe should be created.
.if n .sp
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
.B Tip
.ps -1
.br
.sp
On Windows, all names are prefixed by \f(CR\(rs\(rs.\(rspipe\(rs\fP 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 \f(CR/\fP, in which case it is
relative to the root directory.
.sp .5v
.RE
.if n .sp
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
.B Note
.ps -1
.br
.sp
When using relative paths on POSIX systems, the address used and returned
in properties like \f(CRNNG_OPT_LOCADDR\fP and \f(CRNNG_OPT_URL\fP 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.
.sp .5v
.RE
.if n .sp
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
.B Note
.ps -1
.br
.sp
If compatibility with legacy \fInanomsg\fP applications is required,
then path names must not be longer than 122 bytes, including the final
\f(CRNUL\fP byte.
This is because legacy versions of \fInanomsg\fP cannot express URLs
longer than 128 bytes, including the \f(CRipc://\fP prefix.
.sp .5v
.RE
.SS "UNIX Aliases"
.sp

The \f(CRunix://\fP scheme is an alias for \f(CRipc://\fP and can be used inter\-changeably, but only
on POSIX systems.
.sp
The purpose of this scheme is to support a future transport making use of \f(CRAF_UNIX\fP
on Windows systems, at which time it will be necessary to discriminate between
the Named Pipes and the \f(CRAF_UNIX\fP based transports.
.SS "Abstract Names"
.sp

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 \f(CRNUL\fP bytes.
For example, the name \f(CR"a\(rs0b"\fP  would be represented as \f(CRabstract://a%00b\fP.
.if n .sp
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
.B Tip
.ps -1
.br
.sp
An empty name may be used with a listener to request \(lqauto bind\(rq be used to select a name.
In this case the system will allocate a free name.
The name assigned may be retrieved using \f(CRNNG_OPT_LOCADDR\fP.
.sp .5v
.RE
.if n .sp
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
.B Note
.ps -1
.br
.sp
\fINNG\fP cannot represent an abstract socket with the empty name.
.sp .5v
.RE
.if n .sp
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
.B Note
.ps -1
.br
.sp
Abstract names do not include the leading \f(CRNUL\fP byte used in the low\-level socket address.
.sp .5v
.RE
.sp
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 \f(CRNNG_OPT_PEER_UID\fP, etc.
.SS "Socket Address"
.sp
When using an \f(CRnng_sockaddr\fP structure,
the actual structure is of type \f(CRnng_sockaddr_ipc\fP,
except for abstract sockets, which use \f(CRnng_sockaddr_abstract\fP.
.SS "Transport Options"
.sp
The following transport options are supported by this transport,
where supported by the underlying platform.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\f(CRNNG_OPT_IPC_PERMISSIONS\fP
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\f(CRNNG_OPT_IPC_SECURITY_DESCRIPTOR\fP
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\f(CRNNG_OPT_LOCADDR\fP
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\f(CRNNG_OPT_REMADDR\fP
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\f(CRNNG_OPT_PEER_GID\fP
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\f(CRNNG_OPT_PEER_PID\fP
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\f(CRNNG_OPT_PEER_UID\fP
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\f(CRNNG_OPT_PEER_ZONEID\fP
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.  sp -1
.  IP \(bu 2.3
.\}
\f(CRNNG_OPT_URL\fP
.RE
.SH "SEE ALSO"
.sp
nng_sockaddr(5),
nng_ipc_options(5),
nng_options(5),
nng(7)