aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/man/libnng.adoc1
-rw-r--r--docs/man/nng_alloc.adoc52
-rw-r--r--docs/man/nng_free.adoc51
-rw-r--r--docs/man/nng_version.adoc56
4 files changed, 160 insertions, 0 deletions
diff --git a/docs/man/libnng.adoc b/docs/man/libnng.adoc
index 0c5ee75f..3be2e86b 100644
--- a/docs/man/libnng.adoc
+++ b/docs/man/libnng.adoc
@@ -32,6 +32,7 @@ The following common functions exist in _libnng_.
|<<nng_alloc#,nng_alloc(3)>>|allocate memory
|<<nng_free#,nng_free(3)>>|free memory
|<<nng_strerror#,nng_strerror(3)>>|return an error description
+|<<nng_version#,nng_version(3)>>|report library version
|===
=== Socket Functions
diff --git a/docs/man/nng_alloc.adoc b/docs/man/nng_alloc.adoc
new file mode 100644
index 00000000..af81aff9
--- /dev/null
+++ b/docs/man/nng_alloc.adoc
@@ -0,0 +1,52 @@
+= nng_alloc(3)
+//
+// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2018 Capitar IT Group BV <info@capitar.com>
+//
+// This document is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+== NAME
+
+nng_alloc - allocate memory
+
+== SYNOPSIS
+
+[source, c]
+-----------
+#include <nng/nng.h>
+
+void *nng_alloc(size_t size);
+-----------
+
+== DESCRIPTION
+
+The `nng_alloc()` function allocates a contiguous memory region of
+at least _size_ bytes. The memory will be 64-bit aligned.
+
+The returned memory can be used to hold message buffers, in which
+case it can be directly passed to <<nng_send#,nng_send(3)>> using
+the flag `NNG_FLAG_ALLOC`. Alternatively, it can be freed when no
+longer needed using <<nng_free#,nng_free(3)>>.
+
+WARNING: Do not use the system `free()` function to release this memory.
+On some platforms this may work, but it is not guaranteed and may lead
+to a crash or other undesirable and unpredictable behavior.
+
+== RETURN VALUES
+
+This function returns 0 on success, and non-zero otherwise.
+
+== ERRORS
+
+`NNG_ENOMEM`:: Insufficient free memory exists.
+
+== SEE ALSO
+
+<<nng_free#,nng_free(3)>>,
+<<nng_send#,nng_send(3)>>,
+<<nng_strerror#,nng_strerror(3)>>,
+<<nng#,nng(7)>>
diff --git a/docs/man/nng_free.adoc b/docs/man/nng_free.adoc
new file mode 100644
index 00000000..2b7b09a5
--- /dev/null
+++ b/docs/man/nng_free.adoc
@@ -0,0 +1,51 @@
+= nng_free(3)
+//
+// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2018 Capitar IT Group BV <info@capitar.com>
+//
+// This document is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+== NAME
+
+nng_free - free memory
+
+== SYNOPSIS
+
+[source, c]
+-----------
+#include <nng/nng.h>
+
+void nng_free(void *ptr, size_t size);
+-----------
+
+== DESCRIPTION
+
+The `nng_free()` function deallocates a memory region of size _size_,
+that was previously allocated by <<nng_alloc#,nng_alloc(3)>> or
+<<nng_recv#,nng_recv(3)>> with the `NNG_FLAG_ALLOC` flag.
+
+WARNING: It is very important that _size_ match the allocation size
+used to allocate the memory.
+
+WARNING: Do not attempt to use this function to deallocate memory
+obtained by a call to the system `malloc()` or `calloc()` functions,
+or the {cpp} `new` operator. Doing so may result in unpredictable
+behavior, including corruption of application memory.
+
+== RETURN VALUES
+
+None.
+
+== ERRORS
+
+None.
+
+== SEE ALSO
+
+<<nng_alloc#,nng_alloc(3)>>,
+<<nng_recv#,nng_recv(3)>>,
+<<nng#,nng(7)>>
diff --git a/docs/man/nng_version.adoc b/docs/man/nng_version.adoc
new file mode 100644
index 00000000..3f69b0ca
--- /dev/null
+++ b/docs/man/nng_version.adoc
@@ -0,0 +1,56 @@
+= nng_version(3)
+//
+// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2018 Capitar IT Group BV <info@capitar.com>
+//
+// This document is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+== NAME
+
+nng_version - report library version
+
+== SYNOPSIS
+
+[source, c]
+-----------
+#include <nng/nng.h>
+
+const char * nng_version(void);
+-----------
+
+== DESCRIPTION
+
+The `nng_version()` function returns a human readable version
+number for the _nng_ library. This is intended for output in
+programs, and so forth.
+
+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.
+
+The _nng_ library is developed and released using
+http:///www.semver.org[Semantic Versioning 2.0], and
+the version numbers reported refer to both the API and the
+library itself. (The ABI -- 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.)
+
+== RETURN VALUES
+
+C string (NUL-terminated) containing the library version number.
+
+== ERRORS
+
+None.
+
+== SEE ALSO
+
+<<libnng#,libnng(3)>>,
+<<nng#,nng(7)>>