From 45ac4fa56b6e5c31a28fd08eaad14a09bf3934f6 Mon Sep 17 00:00:00 2001 From: gdamore Date: Sun, 27 Oct 2024 18:55:51 +0000 Subject: deploy: ffeb31c64ea72c4eb287f75b641ca2a707df90b0 --- ref/api/misc.html | 350 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 350 insertions(+) create mode 100644 ref/api/misc.html (limited to 'ref/api/misc.html') diff --git a/ref/api/misc.html b/ref/api/misc.html new file mode 100644 index 00000000..3968b7ff --- /dev/null +++ b/ref/api/misc.html @@ -0,0 +1,350 @@ + + + + + + Miscellaneous - NNG Reference Manual (DRAFT) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+
+ +

Miscellaneous

+

This chapter discusses some interfaces that don’t really +fit anywhere else.

+

Get Random Number

+
uint32_t nng_random(void);
+
+

The nng_random returns a random number. +The value returned is suitable for use with cryptographic functions such as +key generation, and is obtained using platform-specific cryptographically strong random +number facilities when available.

+

Create Socket Pair

+
int nng_socket_pair(int fds[2]);
+
+

The nng_socket_pair function creates a pair of connected file descriptors. +These file descriptors, which are returned in the fds array, are suitable for +use with the Socket transport.

+

On POSIX platforms, this is a thin wrapper around the standard socketpair function, +using the AF_UNIX family and the SOCK_STREAM socket type. +1

+

This will return zero on success, or an error number. On platforms that lack this +capability, such as Windows, it will return NNG_ENOTSUP.

+
+

+ + tip +

+

This function may be useful for creating a shared connection between a parent process and +a child process on UNIX platforms, without requiring the processes use a shared filesystem or TCP connection.

+
+

Report Library Version

+
const char * nng_version(void);
+
+

The nng_version function returns a human readable version number +for NNG, formatted as a NUL-terminated string.

+

Additionally, compile time version information is available +via some predefined macros:

+
    +
  • NNG_MAJOR_VERSION: Major version number.
  • +
  • NNG_MINOR_VERSION: Minor version number.
  • +
  • NNG_PATCH_VERSION: Patch version number.
  • +
+

NNG is developed and released using +Semantic Versioning 2.0, and +the version numbers reported refer to both the API and the library itself. +(The ABI – application binary interface – between the +library and the application is controlled in a similar, but different +manner depending upon the link options and how the library is built.)

+ + + + + +


+

1: At present only POSIX platforms implementing socketpair support this function.

+ +
+ + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + +
+ + -- cgit v1.2.3-70-g09d2