#include <nng/nng.h>
+
+enum sockaddr_family {
+ NNG_AF_ABSTRACT = 6,
+};
+
+typedef struct {
+ uint16_t sa_family;
+ uint16_t sa_len;
+ char sa_name[107];
+} nng_sockaddr_abstract;
+From 09bf59112e559c3addba3dc22ea864324a1d24be Mon Sep 17 00:00:00 2001
From: Garrett D'Amore
reap thread
set thread name
socket address
abstract IPC socket address
IPv4 socket address
reap thread
set thread name
(URI, ipc://)
This transport uses URIs using the scheme ipc://, followed by a path
@@ -89,7 +91,7 @@ whenever possible.
NUL byte.
This is because legacy versions of nanomsg cannot express URLs
longer than 128 bytes, including the ipc:// prefix.
@@ -98,11 +100,80 @@ longer than 128 bytes, including the ipc:// prefix.
+(URI, unix://)
+The unix:// scheme is an alias for ipc:// and can be used inter-changeably, but only
+on POSIX systems.
The purpose of this scheme is to support a future transport making use of AF_UNIX
+on Windows systems, at which time it will be necessary to discriminate between
+the Named Pipes and the AF_UNIX based transports.
(URI, abstract://)
+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 NUL bytes.
+For example, the name "a\0b" would be represented as abstract://a%00b.
| + + | +
+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 NNG_OPT_LOCADDR.
+ |
+
| + + | ++NNG cannot represent an abstract socket with the empty name. + | +
| + + | +
+Abstract names do not include the leading NUL byte used in the low-level socket address.
+ |
+
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 NNG_OPT_PEER_UID, etc.
When using an nng_sockaddr structure,
-the actual structure is of type nng_sockaddr_ipc.
nng_sockaddr_ipc,
+except for abstract sockets, which use nng_sockaddr_abstract.
#include <nng/nng.h>
typedef union nng_sockaddr {
- uint16_t s_family;
- nng_sockaddr_ipc s_ipc;
- nng_sockaddr_inproc s_inproc;
- nng_sockaddr_in s_in;
- nng_sockaddr_in6 s_in6;
- nng_sockaddr_zt s_zt;
+ uint16_t s_family;
+ nng_sockaddr_ipc s_ipc;
+ nng_sockaddr_inproc s_inproc;
+ nng_sockaddr_in s_in;
+ nng_sockaddr_in6 s_in6;
+ nng_sockaddr_zt s_zt;
+ nng_sockaddr_abstract s_abstract;
} nng_sockaddr;
enum sockaddr_family {
- NNG_AF_UNSPEC = 0,
- NNG_AF_INPROC = 1,
- NNG_AF_IPC = 2,
- NNG_AF_INET = 3,
- NNG_AF_INET6 = 4,
- NNG_AF_ZT = 5,
+ NNG_AF_UNSPEC = 0,
+ NNG_AF_INPROC = 1,
+ NNG_AF_IPC = 2,
+ NNG_AF_INET = 3,
+ NNG_AF_INET6 = 4,
+ NNG_AF_ZT = 5,
+ NNG_AF_ABSTRACT = 6
};
Address for ZeroTier transport (nng_zerotier(7)). The s_zt member is valid.
NNG_AF_ABSTRACT
+Address for an abstract UNIX domain socket. The s_abstract member is valid.
nng_sockaddr_abstract(5), +nng_sockaddr_in(5), nng_sockaddr_in6(5), nng_sockaddr_inproc(5), nng_sockaddr_ipc(5), diff --git a/man/tip/nng_sockaddr_abstract.5.html b/man/tip/nng_sockaddr_abstract.5.html new file mode 100644 index 00000000..1eec3a30 --- /dev/null +++ b/man/tip/nng_sockaddr_abstract.5.html @@ -0,0 +1,127 @@ +--- +version: tip +layout: manpage_v2 +--- +
nng_sockaddr_abstract - abstract IPC socket address
+#include <nng/nng.h>
+
+enum sockaddr_family {
+ NNG_AF_ABSTRACT = 6,
+};
+
+typedef struct {
+ uint16_t sa_family;
+ uint16_t sa_len;
+ char sa_name[107];
+} nng_sockaddr_abstract;
+ An nng_sockaddr_abstract is the flavor of nng_sockaddr
+used to represent addresses associated with IPC communication using “abstract” sockets.
Abstract sockets are only supported on Linux at present. +These sockets have a name that is simply an array of bytes, with no special meaning. +Abstract sockets also have no presence in the file system, do not honor any permissions, and are automatically +cleaned up by the operating system when no longer in use.
+| + + | ++Support for abstract sockets is a new feature in NNG, and it is only available on Linux. +As such their use is not recommended for portable applications. + | +
The following structure members are present:
+sa_familyThis field will always have the value NNG_AF_ABSTRACT.
sa_lenThis field provides the name of the length stored in sa_name.
sa_nameThis field holds the name of the abstract socket. +The bytes of name can have any value, including zero.
+| + + | +
+The name does not include the leading NUL byte used on Linux to discriminate between
+abstract and path name sockets.
+ |
+
An empty value (sa_len equal to zero) can be used on listening sockets to request the
+system allocate a name.
+On Linux systems, this will result in a name with either 5 or 8 hexadecimal ASCII characters.
+The name chosen can be obtained by retrieving the NNG_OPT_LOCADDR option on the listening entity.
| + + | ++Because a zero length name is used to indicate auto bind be used, it is impossible to specify +an actual empty name. This name are not supported by NNG, although the underlying system can support it. +The use of that name is inadvisable anyway. + | +
This field holds the IP address in network-byte order.
+sa_scopeThis is the scope, and is typically used with link local + addresses to identify a specific interface. The details of + this are specific to the operating system. This value is + presented identically to the underlying system’s, including + any byte order considerations.
+An nng_sockaddr_ipc is the flavor of nng_sockaddr
-used to represent addresses associated with IPC communication
-using the ipc transport.
An nng_sockaddr_ipc is the flavor of nng_sockaddr
+used to represent addresses associated with IPC communication using the ipc transport.
The following structure members are present:
@@ -49,12 +48,9 @@ using the ipc transport.sa_pathThis field holds the C string corresponding to path name where the
- IPC socket is located.
- For systems using UNIX domain sockets, this will be an absolute
- path name in the file system, where the UNIX domain socket is located.
- For Windows systems, this is the path name of the Named Pipe, without
- the leading \\.pipe\ portion, which will be automatically added.
This field holds the C string corresponding to path name where the IPC socket is located.
+For systems using UNIX domain sockets, this will be a path name in the file system, where the UNIX domain socket is located.
+For Windows systems, this is the path name of the Named Pipe, without the leading \\.pipe\ portion, which will be automatically added.
sa_path member explicitly, but use the
+In order to ensure maximum compatibility, applications should avoid hard coding the size of the sa_path member explicitly, but use the
sizeof operator to determine its actual size at compile time.
-Furthermore, the size is guaranteed to be at least 128, but paths of
-this length may not be supported on all systems.
+Furthermore, the size is guaranteed to be at least 128, but paths of this length may not be supported on all systems.
+| + + | +
+Portable applications should restrict themselves to path names of not more than 90 bytes. Most systems have
+limits around 100 bytes, but at least one system (HP-UX) is restricted to not more than 92 bytes including the NUL.
|
NUL byte.
-This is because legacy versions of nanomsg cannot express URLs
-longer than 128 bytes, including the ipc:// prefix.
+This is because legacy versions of nanomsg cannot express URLs longer than 128 bytes, including the ipc:// prefix.
nng_thread_set_name - set thread name
+#include <nng/nng.h>
+#include <nng/supplemental/util/platform.h>
+
+void nng_set_thread_name(nng_thread *thread, const char *name);
+The nng_thread_set_name() function attempts to set the name for the thread to name.
If thread is NULL, then the name is set for the current thread.
Support for this, and how names are exposed, varies between platform implementations. +This function is intended to facilitate debugging applications that may have many threads.
+| + + | +
+Internal threads created by NNG will have names beginning with nng:.
+ |
+
None.
+None.
+/app/pubsub.
Otherwise the format is the same as for regular WebSockets.
A URI may be restricted to IPv6 using the scheme ws6:// or wss6://, and may
+be restricted to IPv4 using the scheme ws4:// or wss4://.
| + + | +
+Specifying ws6:// or wss6:// may not prevent IPv4 hosts from being used with
+IPv4-in-IPv6 addresses, particularly when using a wildcard hostname with
+listeners.
+The details of this varies across operating systems.
+ |
+
| + + | +
+The ws4:// , ws6://, wss4:// and wss6:// schemes are specific to NNG,
+and might not be understood by other implementations.
+ |
+
| + + | ++We recommend using either numeric IP addresses, or names that are +specific to either IPv4 or IPv6 to prevent confusion and surprises. + | +
When specifying IPv6 addresses, the address must be enclosed in
square brackets ([]) to avoid confusion with the final colon
separating the port.
wss:// endpoints.
NNG_OPT_WS_REQUEST_HEADERS(string) Concentation of multiple lines terminated +
(string) Concatenation of multiple lines terminated by CRLF sequences, that can be used to add further headers to the HTTP request sent when connecting. This option can be set on dialers, and retrieved from pipes.
@@ -169,6 +214,68 @@ by CRLF sequences, that can be used to add further headers to the HTTP response sent when connecting. This option can be set on listeners, and retrieved from pipes.NNG_OPT_WS_RECV_TEXT(bool) Enable receiving of TEXT frames at the WebSocket layer.
+This option should only be used with the low level
+nng_stream API.
+When set, the stream will accept in-bound TEXT frames as well as BINARY frames.
| + + | ++The SP protocols (such as REQ) require BINARY frames as they pass binary protocol data. +Hence this option should not be used with such protocols. + | +
| + + | ++RFC 6455 requires that TEXT frames be discarded and the connection closed if the frame does not contain valid UTF-8 data. +NNG does not perform any such validation. +Applications that need to be strictly conformant should check for this themselves. + | +
NNG_OPT_WS_SEND_TEXT(bool) Enable sending of TEXT frames at the WebSocket layer.
+This option should only be used with the low level
+nng_stream API.
+When set, the stream will send TEXT frames instead of BINARY frames.
| + + | ++NNG does not check the frame data, and will attempt to send whatever the client requests. +Peers that are compliant with RFC 6455 will discard TEXT frames (and break the connection) if they do not contain valid UTF-8. + | +
NNG_OPT_TLS_CONFIG(nng_tls_config *) The underlying TLS
--
cgit v1.2.3-70-g09d2