#include <nng/nng.h>
#define NNG_OPT_IPC_PEER_GID "ipc:peer-gid"
#define NNG_OPT_IPC_PEER_PID "ipc:peer-pid"
#define NNG_OPT_IPC_PEER_UID "ipc:peer-uid"
#define NNG_OPT_IPC_PEER_ZONEID "ipc:peer-zoneid"
#define NNG_OPT_IPC_PERMISSIONS "ipc:permissions"
#define NNG_OPT_IPC_SECURITY_DESCRIPTOR "ipc:security-descriptor"
This page documents the various standard options that can be set or retrieved on objects using IPC.
The option names should always be used by their symbolic definitions.
In the following list of options, the name of the option is supplied, along with the data type of the underlying value.
Some options are only meaningful or supported in certain contexts, or may have other access restrictions. An attempt has been made to include details about such restrictions in the description of the option.
Note
|
The availability of any of the following options is platform-specific, as the implementations of IPC are quite different on Windows and POSIX systems. |
NNG_OPT_IPC_PEER_GID
-
(
uint64_t
) This read-only option provides a connected peer’s primary group id. This is the effective group id of the peer when either the underlyinglisten()
orconnect()
calls were made, and is not forgeable. This option is generally only available on POSIX systems. NNG_OPT_IPC_PEER_PID
-
(
uint64_t
) 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.NoteApplications 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. NNG_OPT_IPC_PEER_UID
-
(
uint64_t
) This read-only option provides a connected peer’s user id. This is the effective user id of the peer when either the underlyinglisten()
orconnect()
calls were made, and is not forgeable. This option is generally only available on POSIX systems. NNG_OPT_IPC_PEER_ZONEID
-
(
uint64_t
) This read-only option provides a connected peer’s the zone id. Zones (and this option) are only supported on Solaris and illumos systems. NNG_OPT_IPC_PERMISSIONS
-
(
int
) This write-only option may be applied to a listener to configure the permissions that are used on the UNIX domain socket created by that listener. This property is only supported on POSIX systems. The value is of typeint
, representing the normal permission bits on a file, such as0600
(typically meaning read-write to the owner, and no permissions for anyone else.) The default is system-specific, most often0644
.ImportantNot all systems validate these permissions. In particular, illumos and Solaris are known to ignore these permission settings when connecting. NoteNormally both read and write permission will be necessary for a peer dialer to connect. See your system documentation for UNIX domain sockets for more information. NoteThe umask of the process is not applied to these bits. TipThe best practice for limiting access is to place the socket in a directory writable only by the server, and only readable and searchable by clients. All mainstream POSIX systems will fail to permit a client to connect to a socket located in a directory for which the client lacks search (execute) permission. NNG_OPT_IPC_SECURITY_DESCRIPTOR
-
(
PSECURITY_DESCRIPTOR
) This write-only option may be used on listeners on Windows platforms to configure theSECURITY_DESCRIPTOR
that is used when creating the underlying named pipe. The value is a pointer,PSECURITY_DESCRIPTOR
, and may only be applied to listeners that have not been started yet.
Generally, the following option values are also available for TLS objects, when appropriate for the context: