NNG_MSG_HEADER_TRIM(3)
β¨ NNG_MSG_HEADER_TRIM β¨
okay so bestie, imagine you're holding a message header and you've got some bytes at the front of it that you literally do not need anymore. this is the page for you, and it lives in the NNG Reference Manual π
πΈ NAME πΈ
nng_msg_header_trim β remove data from start of message header π
π SYNOPSIS π
#include <nng/nng.h>
int nng_msg_header_trim(nng_msg *msg, size_t size);
int nng_msg_header_trim_u16(nng_msg *msg, uint16_t *val16);
int nng_msg_header_trim_u32(nng_msg *msg, uint32_t *val32);
int nng_msg_header_trim_u64(nng_msg *msg, uint64_t *val64);
π¦ DESCRIPTION π¦
so the nng_msg_header_trim() fam (it's a whole family, they're all icons) removes data from the start of the header of the message msg. like, the front. the beginning. the opening act. it's giving "yeet the prefix." β¨
here's the breakdown, one function at a time:
- the first one,
nng_msg_header_trim(), removessizebytes. that's it. justsizebytes, gone, bye π«Ά - the rest of them remove 2, 4, or 8 bytes respectively, and they store those bytes in the value pointer you hand them (like
val32), after converting them from network-byte order (big-endian) to native byte order.
so yeah, you're not just deleting β the _u16 / _u32 / _u64 versions are also little read-and-remove machines, and they hand you back a nice native-endian number, no cap π₯
π RETURN VALUES π
this function returns 0 on success, and non-zero otherwise. that's the whole vibe check. 0 = slay, not-0 = we have a problem π
π ERRORS π
NNG_EINVALβ the message header is way too short to remove the data you asked for. like bestie, there's not enough there to trim. the header said "not me getting asked for bytes i don't have" π
π SEE ALSO π
nng_msg_alloc(3)nng_msg_header(3)nng_msg_header_append(3)nng_msg_header_chop(3)nng_msg_header_insert(3)nng_msg_header_len(3)nng_msg_free(3)nng_strerror(3)nng_msg(5)nng(7)
and that's the whole page, periodt π go forth and trim responsibly β this was NNG_MSG_HEADER_TRIM(3) from the NNG Reference Manual, dated 2026-06-30. mwah, ily, drink water ππ§ββοΈ
π¦ where this page comes from
- ubuntu stonking: libnng-dev 1.12.0-1 Β· MIT OR Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms