NNG_MSG_HEADER_TRIM(3)

πŸ“¦
version 1.12.0 Β· 4 versions
, in ubuntu stonking

✨ 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(), removes size bytes. that's it. just size bytes, 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 🌈


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