From 1a808eb90bbea075aa40ff40ee29507d37f41a10 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 6 Jan 2019 15:51:27 -0800 Subject: fixes #853 Move IPC options to nng.h --- include/nng/nng.h | 36 +++++++++++++++++++++++++++++++++++- include/nng/transport/ipc/ipc.h | 33 +-------------------------------- 2 files changed, 36 insertions(+), 33 deletions(-) (limited to 'include') diff --git a/include/nng/nng.h b/include/nng/nng.h index 5ea9d374..3063a652 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -1,5 +1,5 @@ // -// Copyright 2018 Staysail Systems, Inc. +// Copyright 2019 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a @@ -754,6 +754,40 @@ enum nng_flag_enum { // state current). This is a boolean. #define NNG_OPT_TCP_KEEPALIVE "tcp-keepalive" +// IPC options. These will largely vary depending on the platform, +// as POSIX systems have very different options than Windows. + +// Security Descriptor. This option may only be set on listeners +// on the Windows platform, where the object is a pointer to a +// a Windows SECURITY_DESCRIPTOR. +#define NNG_OPT_IPC_SECURITY_DESCRIPTOR "ipc:security-descriptor" + +// Permissions bits. This option is only valid for listeners on +// POSIX platforms and others that honor UNIX style permission bits. +// Note that some platforms may not honor the permissions here, although +// at least Linux and macOS seem to do so. Check before you rely on +// this for security. +#define NNG_OPT_IPC_PERMISSIONS "ipc:permissions" + +// Peer UID. This is only available on POSIX style systems. +#define NNG_OPT_IPC_PEER_UID "ipc:peer-uid" + +// Peer GID (primary group). This is only available on POSIX style systems. +#define NNG_OPT_IPC_PEER_GID "ipc:peer-gid" + +// Peer process ID. Available on Windows, Linux, and SunOS. +// In theory we could obtain this with the first message sent, +// but we have elected not to do this for now. (Nice RFE for a FreeBSD +// guru though.) +#define NNG_OPT_IPC_PEER_PID "ipc:peer-pid" + +// Peer Zone ID. Only on SunOS systems. (Linux containers have no +// definable kernel identity; they are a user-land fabrication made up +// from various pieces of different namespaces. FreeBSD does have +// something called JailIDs, but it isn't obvious how to determine this, +// or even if processes can use IPC across jail boundaries.) +#define NNG_OPT_IPC_PEER_ZONEID "ipc:peer-zoneid" + // XXX: TBD: priorities, ipv4only // Statistics. These are for informational purposes only, and subject diff --git a/include/nng/transport/ipc/ipc.h b/include/nng/transport/ipc/ipc.h index 497fb2b5..c69c4dc9 100644 --- a/include/nng/transport/ipc/ipc.h +++ b/include/nng/transport/ipc/ipc.h @@ -1,5 +1,5 @@ // -// Copyright 2018 Staysail Systems, Inc. +// Copyright 2019 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a @@ -16,35 +16,4 @@ NNG_DECL int nng_ipc_register(void); -// Security Descriptor. This option may only be set on listeners -// on the Windows platform, where the object is a pointer to a -// a Windows SECURITY_DESCRIPTOR. -#define NNG_OPT_IPC_SECURITY_DESCRIPTOR "ipc:security-descriptor" - -// Permissions bits. This option is only valid for listeners on -// POSIX platforms and others that honor UNIX style permission bits. -// Note that some platforms may not honor the permissions here, although -// at least Linux and macOS seem to do so. Check before you rely on -// this for security. -#define NNG_OPT_IPC_PERMISSIONS "ipc:permissions" - -// Peer UID. This is only available on POSIX style systems. -#define NNG_OPT_IPC_PEER_UID "ipc:peer-uid" - -// Peer GID (primary group). This is only available on POSIX style systems. -#define NNG_OPT_IPC_PEER_GID "ipc:peer-gid" - -// Peer process ID. Available on Windows, Linux, and SunOS. -// In theory we could obtain this with the first message sent, -// but we have elected not to do this for now. (Nice RFE for a FreeBSD -// guru though.) -#define NNG_OPT_IPC_PEER_PID "ipc:peer-pid" - -// Peer Zone ID. Only on SunOS systems. (Linux containers have no -// definable kernel identity; they are a user-land fabrication made up -// from various pieces of different namespaces. FreeBSD does have -// something called JailIDs, but it isn't obvious how to determine this, -// or even if processes can use IPC across jail boundaries.) -#define NNG_OPT_IPC_PEER_ZONEID "ipc:peer-zoneid" - #endif // NNG_TRANSPORT_IPC_IPC_H -- cgit v1.2.3-70-g09d2