summaryrefslogtreecommitdiff
path: root/docs/ref/compat/nn_allocmsg.adoc
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-04-05 08:40:25 -0700
committerGarrett D'Amore <garrett@damore.org>2024-04-05 08:40:25 -0700
commit1b825b063da65fe3d88c1ca97afded0d6f6ccc14 (patch)
tree3d422dc27dc2a2c1146df0153ea9c97b17d28134 /docs/ref/compat/nn_allocmsg.adoc
parent4d178a9eb65b973d18c80afa328a070ee09fd768 (diff)
downloadnng-1b825b063da65fe3d88c1ca97afded0d6f6ccc14.tar.gz
nng-1b825b063da65fe3d88c1ca97afded0d6f6ccc14.tar.bz2
nng-1b825b063da65fe3d88c1ca97afded0d6f6ccc14.zip
Compat pages converted.
Diffstat (limited to 'docs/ref/compat/nn_allocmsg.adoc')
-rw-r--r--docs/ref/compat/nn_allocmsg.adoc40
1 files changed, 40 insertions, 0 deletions
diff --git a/docs/ref/compat/nn_allocmsg.adoc b/docs/ref/compat/nn_allocmsg.adoc
new file mode 100644
index 00000000..273f17e6
--- /dev/null
+++ b/docs/ref/compat/nn_allocmsg.adoc
@@ -0,0 +1,40 @@
+## nn_allocmsg
+
+Allocate message (compatible API).
+
+### Synopsis
+
+```c
+#include <nanomsg/nn.h>
+
+void *nn_allocmsg(size_t size, int type);
+```
+
+### Description
+
+The `nn_allocmsg` allocates a message structure of size _size_, and is primarily used to support zero-copy send operations, making use of the `NNG_MSG` special size indicator.
+The value returned is a pointer to the start of the message payload buffer.
+
+The value of _size_ must be positive, and small enough to hold reasonable message data plus book-keeping information.
+
+The value of _type_ *must* be zero.
+
+The returned message must be disposed of by either xref:nn_freemsg.adoc[`nn_freemsg`] or xref:nn_send.adoc[`nn_send`] when the caller is finished with it.
+
+### Return Values
+
+This function returns a pointer to message buffer space, or `NULL` on failure.
+
+### Errors
+
+[horizontal]
+`ENOMEM`:: Insufficient memory is available.
+`EINVAL`:: An invalid _size_ or _type_ was specified.
+`ETERM`:: The library is shutting down.
+
+### See Also
+
+xref:nn_errno.adoc[nn_errno],
+xref:nn_freemsg.adoc[nn_freemsg],
+xref:nn_reallocmsg.adoc[nn_reallocmsg],
+xref:nn_send.adoc[nn_send]