diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-10-12 12:30:54 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-10-12 12:30:54 -0700 |
| commit | 11c33cd32f09a4cb3f18960aeb140e5efe96c181 (patch) | |
| tree | eef62e80bd7140b7c0457f98833d283377bb7d17 /docs | |
| parent | f26952c3bcbc83358e3a69d5d2e613f61fd657e1 (diff) | |
| download | nng-11c33cd32f09a4cb3f18960aeb140e5efe96c181.tar.gz nng-11c33cd32f09a4cb3f18960aeb140e5efe96c181.tar.bz2 nng-11c33cd32f09a4cb3f18960aeb140e5efe96c181.zip | |
nng message header converted to mdbook
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/man/libnng.3.adoc | 14 | ||||
| -rw-r--r-- | docs/man/nng_msg_append.3.adoc | 58 | ||||
| -rw-r--r-- | docs/man/nng_msg_body.3.adoc | 62 | ||||
| -rw-r--r-- | docs/man/nng_msg_chop.3.adoc | 61 | ||||
| -rw-r--r-- | docs/man/nng_msg_clear.3.adoc | 41 | ||||
| -rw-r--r-- | docs/man/nng_msg_insert.3.adoc | 63 | ||||
| -rw-r--r-- | docs/man/nng_msg_len.3.adoc | 43 | ||||
| -rw-r--r-- | docs/man/nng_msg_trim.3.adoc | 60 | ||||
| -rw-r--r-- | docs/ref/SUMMARY.md | 1 | ||||
| -rw-r--r-- | docs/ref/api/msg/index.md | 1 | ||||
| -rw-r--r-- | docs/ref/api/msg/nng_msg.md | 2 | ||||
| -rw-r--r-- | docs/ref/api/msg/nng_msg_body.md | 112 |
12 files changed, 122 insertions, 396 deletions
diff --git a/docs/man/libnng.3.adoc b/docs/man/libnng.3.adoc index e13ddf0b..7f1850cc 100644 --- a/docs/man/libnng.3.adoc +++ b/docs/man/libnng.3.adoc @@ -99,20 +99,20 @@ Most applications will only interact with the body. |=== // |xref:nng_msg_alloc.3.adoc[nng_msg_alloc()]|allocate a message -|xref:nng_msg_append.3.adoc[nng_msg_append()]|append to message body -|xref:nng_msg_body.3.adoc[nng_msg_body()]|return message body +// |xref:nng_msg_append.3.adoc[nng_msg_append()]|append to message body +// |xref:nng_msg_body.3.adoc[nng_msg_body()]|return message body // |xref:nng_msg_capacity.3.adoc[nng_msg_capacity()]|return capacity allocated for message body -|xref:nng_msg_chop.3.adoc[nng_msg_chop()]|remove data from end of message body -|xref:nng_msg_clear.3.adoc[nng_msg_clear()]|clear message body +// |xref:nng_msg_chop.3.adoc[nng_msg_chop()]|remove data from end of message body +// |xref:nng_msg_clear.3.adoc[nng_msg_clear()]|clear message body // |xref:nng_msg_dup.3.adoc[nng_msg_dup()]|duplicate a message // |xref:nng_msg_free.3.adoc[nng_msg_free()]|free a message |xref:nng_msg_get_pipe.3.adoc[nng_msg_get_pipe()]|get pipe for message -|xref:nng_msg_insert.3.adoc[nng_msg_insert()]|prepend to message body -|xref:nng_msg_len.3.adoc[nng_msg_len()]|return the message body length +// |xref:nng_msg_insert.3.adoc[nng_msg_insert()]|prepend to message body +// |xref:nng_msg_len.3.adoc[nng_msg_len()]|return the message body length // |xref:nng_msg_realloc.3.adoc[nng_msg_realloc()]|reallocate a message // |xref:nng_msg_reserve.3.adoc[nng_msg_reserve()]|reserve storage for message body |xref:nng_msg_set_pipe.3.adoc[nng_msg_set_pipe()]|set pipe for message -|xref:nng_msg_trim.3.adoc[nng_msg_trim()]|remove data from start of message body +// |xref:nng_msg_trim.3.adoc[nng_msg_trim()]|remove data from start of message body |xref:nng_recvmsg.3.adoc[nng_recvmsg()]|receive a message |xref:nng_sendmsg.3.adoc[nng_sendmsg()]|send a message |=== diff --git a/docs/man/nng_msg_append.3.adoc b/docs/man/nng_msg_append.3.adoc deleted file mode 100644 index 9ed3741d..00000000 --- a/docs/man/nng_msg_append.3.adoc +++ /dev/null @@ -1,58 +0,0 @@ -= nng_msg_append(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_msg_append - append to message body - -== SYNOPSIS - -[source, c] ----- -#include <nng/nng.h> - -int nng_msg_append(nng_msg *msg, const void *val, size_t size); -int nng_msg_append_u16(nng_msg *msg, uint16_t val16); -int nng_msg_append_u32(nng_msg *msg, uint32_t val32); -int nng_msg_append_u64(nng_msg *msg, uint64_t val64); ----- - -== DESCRIPTION - -The `nng_msg_append()` family of functions appends data to -the end of the body of message _msg_, reallocating it if necessary. -The first function appends _size_ bytes, copying them from _val_. -The remaining functions append the value specified (such as _val32_) in -network-byte order (big-endian). - -== RETURN VALUES - -These functions return 0 on success, and non-zero otherwise. - -== ERRORS - -[horizontal] -`NNG_ENOMEM`:: Insufficient free memory exists. - -== SEE ALSO - -[.text-left] -xref:nng_msg_alloc.3.adoc[nng_msg_alloc(3)], -xref:nng_msg_body.3.adoc[nng_msg_body(3)], -xref:nng_msg_chop.3.adoc[nng_msg_chop(3)], -xref:nng_msg_free.3.adoc[nng_msg_free(3)], -xref:nng_msg_insert.3.adoc[nng_msg_insert(3)], -xref:nng_msg_len.3.adoc[nng_msg_len(3)], -xref:nng_msg_realloc.3.adoc[nng_msg_realloc(3)], -xref:nng_msg_trim.3.adoc[nng_msg_trim(3)], -xref:nng_strerror.3.adoc[nng_strerror(3)], -xref:nng_msg.5.adoc[nng_msg(5)], -xref:nng.7.adoc[nng(7)] diff --git a/docs/man/nng_msg_body.3.adoc b/docs/man/nng_msg_body.3.adoc deleted file mode 100644 index ad0fa7b3..00000000 --- a/docs/man/nng_msg_body.3.adoc +++ /dev/null @@ -1,62 +0,0 @@ -= nng_msg_body(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_msg_body - return message body - -== SYNOPSIS - -[source, c] ----- -#include <nng/nng.h> - -void *nng_msg_body(nng_msg *msg); ----- - -== DESCRIPTION - -The `nng_msg_body()` function returns a pointer to the start of the body -content of the message _msg_. - -NOTE: The value returned by this is invalidated by a call to any of the -functions that modify the message itself. -Such functions are -xref:nng_msg_free.3.adoc[`nng_msg_free()`], -xref:nng_msg_realloc.3.adoc[`nng_msg_realloc()`], -any of the xref:nng_msg_trim.3.adoc[`nng_msg_trim()`], -xref:nng_msg_chop.3.adoc[`nng_msg_chop()`], -xref:nng_msg_append.3.adoc[`nng_msg_append()`], -or xref:nng_msg_insert.3.adoc[`nng_msg_insert()`] variants. - -== RETURN VALUES - -Pointer to start of message body. - -== ERRORS - -None. - -== SEE ALSO - -[.text-left] -xref:nng_msg_alloc.3.adoc[nng_msg_alloc(3)], -xref:nng_msg_append.3.adoc[nng_msg_append(3)], -xref:nng_msg_chop.3.adoc[nng_msg_chop(3)], -xref:nng_msg_free.3.adoc[nng_msg_free(3)], -xref:nng_msg_insert.3.adoc[nng_msg_insert(3)], -xref:nng_msg_len.3.adoc[nng_msg_len(3)], -xref:nng_msg_capacity.3.adoc[nng_msg_capacity(3)], -xref:nng_msg_reserve.3.adoc[nng_msg_reserve(3)], -xref:nng_msg_realloc.3.adoc[nng_msg_realloc(3)], -xref:nng_msg_trim.3.adoc[nng_msg_trim(3)], -xref:nng_msg.5.adoc[nng_msg(5)], -xref:nng.7.adoc[nng(7)] diff --git a/docs/man/nng_msg_chop.3.adoc b/docs/man/nng_msg_chop.3.adoc deleted file mode 100644 index b945f0bb..00000000 --- a/docs/man/nng_msg_chop.3.adoc +++ /dev/null @@ -1,61 +0,0 @@ -= nng_msg_chop(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_msg_chop - remove data from end of message body - -== SYNOPSIS - -[source, c] ----- -#include <nng/nng.h> - -int nng_msg_chop(nng_msg *msg, size_t size); -int nng_msg_chop_u16(nng_msg *msg, uint16_t *val16); -int nng_msg_chop_u32(nng_msg *msg, uint32_t *val32); -int nng_msg_chop_u64(nng_msg *msg, uint64_t *val64); ----- - -== DESCRIPTION - -The `nng_msg_chop()` family of functions removes data from -the end of the body of message _msg_. -The first function removes _size_ bytes. -The remaining functions remove 2, 4, or 8 bytes, and stores them in the value -(such as _val32_), -after converting them from network-byte order (big-endian) to native byte order. - -== RETURN VALUES - -These functions return 0 on success, and non-zero otherwise. - -== ERRORS - -[horizontal] -`NNG_EINVAL`:: The message body is too short to remove the requested data. - -== SEE ALSO - -[.text-left] -xref:nng_msg_alloc.3.adoc[nng_msg_alloc(3)], -xref:nng_msg_append.3.adoc[nng_msg_append(3)], -xref:nng_msg_body.3.adoc[nng_msg_body(3)], -xref:nng_msg_free.3.adoc[nng_msg_free(3)], -xref:nng_msg_insert.3.adoc[nng_msg_insert(3)], -xref:nng_msg_len.3.adoc[nng_msg_len(3)], -xref:nng_msg_capacity.3.adoc[nng_msg_capacity(3)], -xref:nng_msg_reserve.3.adoc[nng_msg_reserve(3)], -xref:nng_msg_realloc.3.adoc[nng_msg_realloc(3)], -xref:nng_msg_trim.3.adoc[nng_msg_trim(3)], -xref:nng_strerror.3.adoc[nng_strerror(3)], -xref:nng_msg.5.adoc[nng_msg(5)], -xref:nng.7.adoc[nng(7)] diff --git a/docs/man/nng_msg_clear.3.adoc b/docs/man/nng_msg_clear.3.adoc deleted file mode 100644 index e5b3bf47..00000000 --- a/docs/man/nng_msg_clear.3.adoc +++ /dev/null @@ -1,41 +0,0 @@ -= nng_msg_clear(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_msg_clear - clear message body content - -== SYNOPSIS - -[source, c] ----- -#include <nng/nng.h> - -void nng_msg_clear(nng_msg *msg); ----- - -== DESCRIPTION - -The `nng_msg_clear()` function resets the body length of _msg_ to zero. - -== RETURN VALUES - -None. - -== ERRORS - -None. - -== SEE ALSO - -[.text-left] -xref:nng_msg.5.adoc[nng_msg(5)], -xref:nng.7.adoc[nng(7)] diff --git a/docs/man/nng_msg_insert.3.adoc b/docs/man/nng_msg_insert.3.adoc deleted file mode 100644 index 25f98fce..00000000 --- a/docs/man/nng_msg_insert.3.adoc +++ /dev/null @@ -1,63 +0,0 @@ -= nng_msg_insert(3) -// -// Copyright 2020 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_msg_insert - prepend to message body - -== SYNOPSIS - -[source, c] ----- -#include <nng/nng.h> - -int nng_msg_insert(nng_msg *msg, const void *val, size_t size); -int nng_msg_insert_u16(nng_msg *msg, uint16_t val16); -int nng_msg_insert_u32(nng_msg *msg, uint32_t val32); -int nng_msg_insert_u64(nng_msg *msg, uint64_t val64); ----- - -== DESCRIPTION - -The `nng_msg_insert()` family of functions prepends data to -the front of the body of message _msg_, reallocating it if necessary. -The first function prepends _size_ bytes, copying them from _val_. -The remaining functions prepend the specified value (such as _val32_) -in network-byte order (big-endian). - -TIP: These functions make use of space pre-allocated in front of the -message body if available, so they can often avoid performing any reallocation. -Applications should use these instead of reallocating and copying message -content themselves, in order to benefit from this capability. - -== RETURN VALUES - -These functions return 0 on success, and non-zero otherwise. - -== ERRORS - -[horizontal] -`NNG_ENOMEM`:: Insufficient free memory exists. - -== SEE ALSO - -[.text-left] -xref:nng_msg_alloc.3.adoc[nng_msg_alloc(3)], -xref:nng_msg_append.3.adoc[nng_msg_append(3)], -xref:nng_msg_body.3.adoc[nng_msg_body(3)], -xref:nng_msg_chop.3.adoc[nng_msg_chop(3)], -xref:nng_msg_free.3.adoc[nng_msg_free(3)], -xref:nng_msg_len.3.adoc[nng_msg_len(3)], -xref:nng_msg_realloc.3.adoc[nng_msg_realloc(3)], -xref:nng_msg_trim.3.adoc[nng_msg_trim(3)], -xref:nng_strerror.3.adoc[nng_strerror(3)], -xref:nng_msg.5.adoc[nng_msg(5)], -xref:nng.7.adoc[nng(7)] diff --git a/docs/man/nng_msg_len.3.adoc b/docs/man/nng_msg_len.3.adoc deleted file mode 100644 index 2a3dfe67..00000000 --- a/docs/man/nng_msg_len.3.adoc +++ /dev/null @@ -1,43 +0,0 @@ -= nng_msg_len(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_msg_len - return message body length - -== SYNOPSIS - -[source, c] ----- -#include <nng/nng.h> - -size_t nng_msg_len(nng_msg *msg); ----- - -== DESCRIPTION - -The `nng_msg_len()` returns the length of the body of message _msg_. - -== RETURN VALUES - -Length of message body. - -== ERRORS - -None. - -== SEE ALSO - -[.text-left] -xref:nng_msg_alloc.3.adoc[nng_msg_alloc(3)], -xref:nng_msg_body.3.adoc[nng_msg_body(3)], -xref:nng_msg.5.adoc[nng_msg(5)], -xref:nng.7.adoc[nng(7)] diff --git a/docs/man/nng_msg_trim.3.adoc b/docs/man/nng_msg_trim.3.adoc deleted file mode 100644 index aa482958..00000000 --- a/docs/man/nng_msg_trim.3.adoc +++ /dev/null @@ -1,60 +0,0 @@ -= nng_msg_trim(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_msg_trim - remove data from start of message body - -== SYNOPSIS - -[source, c] ----- -#include <nng/nng.h> - -int nng_msg_trim(nng_msg *msg, size_t size); -int nng_msg_trim_u16(nng_msg *msg, uint16_t *val16); -int nng_msg_trim_u32(nng_msg *msg, uint32_t *val32); -int nng_msg_trim_u64(nng_msg *msg, uint64_t *val64); ----- - -== DESCRIPTION - -The `nng_msg_trim()` family of functions removes data from -the start of the body of message _msg_. -The first function removes _size_ bytes. -The remaining functions remove 2, 4, or 8 bytes, and stores them in the value -(such as _val32_), -after converting them from network-byte order (big-endian) to native -byte order. - -== RETURN VALUES - -These functions return 0 on success, and non-zero otherwise. - -== ERRORS - -[horizontal] -`NNG_EINVAL`:: The message body is too short to remove the requested data. - -== SEE ALSO - -[.text-left] -xref:nng_msg_alloc.3.adoc[nng_msg_alloc(3)], -xref:nng_msg_append.3.adoc[nng_msg_append(3)], -xref:nng_msg_body.3.adoc[nng_msg_body(3)], -xref:nng_msg_chop.3.adoc[nng_msg_chop(3)], -xref:nng_msg_free.3.adoc[nng_msg_free(3)], -xref:nng_msg_insert.3.adoc[nng_msg_insert(3)], -xref:nng_msg_len.3.adoc[nng_msg_len(3)], -xref:nng_msg_realloc.3.adoc[nng_msg_realloc(3)], -xref:nng_strerror.3.adoc[nng_strerror(3)], -xref:nng_msg.5.adoc[nng_msg(5)], -xref:nng.7.adoc[nng(7)] diff --git a/docs/ref/SUMMARY.md b/docs/ref/SUMMARY.md index 7e9bcc2d..0415cad8 100644 --- a/docs/ref/SUMMARY.md +++ b/docs/ref/SUMMARY.md @@ -5,6 +5,7 @@ - [Messages](./api/msg/index.md) - [nng_msg](./api/msg/nng_msg.md) + - [nng_msg_body](./api/msg/nng_msg_body.md) - [Threading and Synchronization](./api/thr/index.md) diff --git a/docs/ref/api/msg/index.md b/docs/ref/api/msg/index.md index 18a3f620..5772cec8 100644 --- a/docs/ref/api/msg/index.md +++ b/docs/ref/api/msg/index.md @@ -3,3 +3,4 @@ These interfaces deal with messages, used in the Scalability Protocols. - [nng_msg](./nng_msg.md) --- message +- [nng_msg_body](./nng_msg_body.md) --- message body diff --git a/docs/ref/api/msg/nng_msg.md b/docs/ref/api/msg/nng_msg.md index 84d6c273..8d8b8686 100644 --- a/docs/ref/api/msg/nng_msg.md +++ b/docs/ref/api/msg/nng_msg.md @@ -87,7 +87,7 @@ by making use of scratch areas at the beginning and end of the message. These scratch areas, the "{{i:headroom}}" and "{{i:tailroom}}", are automatically included when allocating a message. -Using `nng_msg_reserve` to ensure that adequate buffer space is availabe +Using `nng_msg_reserve` to ensure that adequate buffer space is available in advance can reduce repeated allocations and data copies when modifying messages. ## RETURN VALUES diff --git a/docs/ref/api/msg/nng_msg_body.md b/docs/ref/api/msg/nng_msg_body.md new file mode 100644 index 00000000..ff78e852 --- /dev/null +++ b/docs/ref/api/msg/nng_msg_body.md @@ -0,0 +1,112 @@ +# nng_msg_body + +## NAME + +nng_msg_body --- message body + +## SYNOPSIS + +```c +#include <nng/nng.h> + +void *nng_msg_body(nng_msg *msg); +size_t nng_msg_len(nng_msg *msg); +void nng_msg_clear(nng_msg *msg); +int nng_msg_append(nng_msg *msg, const void *val, size_t size); +int nng_msg_append_u16(nng_msg *msg, uint16_t val16); +int nng_msg_append_u32(nng_msg *msg, uint32_t val32); +int nng_msg_append_u64(nng_msg *msg, uint64_t val64); +int nng_msg_insert(nng_msg *msg, const void *val, size_t size); +int nng_msg_insert_u16(nng_msg *msg, uint16_t val16); +int nng_msg_insert_u32(nng_msg *msg, uint32_t val32); +int nng_msg_insert_u64(nng_msg *msg, uint64_t val64); +int nng_msg_chop(nng_msg *msg, size_t size); +int nng_msg_chop_u16(nng_msg *msg, uint16_t *val16); +int nng_msg_chop_u32(nng_msg *msg, uint32_t *val32); +int nng_msg_chop_u64(nng_msg *msg, uint64_t *val64); +int nng_msg_trim(nng_msg *msg, size_t size); +int nng_msg_trim_u16(nng_msg *msg, uint16_t *val16); +int nng_msg_trim_u32(nng_msg *msg, uint32_t *val32); +int nng_msg_trim_u64(nng_msg *msg, uint64_t *val64); +``` + +## DESCRIPTION + +The {{i:body}} of a message is the part of the message that is used +for the application payload, and does not normally include protocol +or transport-specific data. + +The `nng_msg_body` function returns a pointer to the start of the body +content of the message _msg_. + +The `nng_msg_len` function returns the length of the message body in bytes. + +> [!IMPORTANT] +> The value returned by `nng_msg_body` is invalidated by a call to any of the +> functions that modify the message itself. + +The rest of these functions allow modifying the message body. + +### Clearing the Message Body + +The message body can be entirely cleared using {{i:`nng_msg_clear`}}. +The underlying buffers are left intact, and the bytes may remain at their original values, so +this function should not be relied upon for zeroizing sensitive data. + +### Appending and Inserting Data + +Appending data to a message body is done by using the {{i:`nng_msg_append`}} functions. +The base `nng_msg_append` function appends _size_ bytes of untyped data to the end of the +message. + +> [!TIP] +> Using [`nng_msg_reserve`][nng_msg] to preallocate space before appending or inserting +> can reduce allocations and data copies, for a significant performance benefit. + +Use of the typed versions, ending in suffixes `_u16`, `_u32`, and `_u64` allows +for unsigned integers to be appended directly. The integers are encoded in network byte order, with +the most significant byte appearing first. The message body will by two, four, or eight +bytes accordingly. + +Data may inserted before the rest of the message body by using the {{i:`nng_msg_insert`}} functions. +This will attempt to use "headroom" in the message to avoid a data copy. + +> [!TIP] +> Message headroom is limited, so `nng_msg_insert` is best used sparingly. +> It is much more efficient to build the message content from start to end +> using `nng_msg_append`. + +Typed versions and the untyped base function behave similarly to the `nng_msg_append` functions. + +### Consuming Data + +The {{i:`nng_msg_trim`}} functions remove data from the beginning of the message body. +This is accomplished by incrementing the pointer to start of the message by the appropriate size. + +Additionally, functions with typed suffixes (`_u16`, `_u32`, `_u64`) allow the data obtained to be decoded and returned. +The data is assumed to have been in network byte order in the message, but is returned in +the native machine byte order. The appropriate number of bytes is consumed for each of these types, +so two bytes for `_u16`, four bytes for `_u32`, and eight bytes for `_u64`. + +The {{i:`nng_msg_chop`}} functions behave in a similar fashion, but consume data from the +end of the message body. + +## RETURN VALUES + +The `nng_msg_body` function returns a pointer to the start of the message body. +The `nng_msg_len` function returns the length of the message in bytes. +The `nng_msg_clear` function does not return anything. +The remaining functions return zero on success, or a non-zero error value on failure. + +## ERRORS + +- `NNG_ENOMEM`: Insufficient memory exists to grow the message. +- `NNG_EINVAL`: The message body is too short to remove the requested data. + +## SEE ALSO + +[nng_msg][nng_msg], +[nng_msg_header][nng_msg_header] + +[nng_msg]: ./nng_msg.md +[nng_msg_header]: ./nng_msg_header.md |
