NNG_MSG_HEADER_CHOP(3)

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

πŸ’– nng_msg_header_chop(3) πŸ’–

okay bestie, buckle up, we're talking about nng_msg_header_chop β€” straight outta the NNG Reference Manual β€” aka remove data from end of message header. yes she's a chopper, she chops the end of a header, and she does it with main character energy. πŸŽ€


✨ NAME ✨

nng_msg_header_chop β€” literally just remove data from the end of a message header. that's it, that's the tweet. πŸ’…


🌸 SYNOPSIS 🌸

#include <nng/nng.h>

int nng_msg_header_chop(nng_msg *msg, size_t size);
int nng_msg_header_chop_u16(nng_msg *msg, uint16_t *val16);
int nng_msg_header_chop_u32(nng_msg *msg, uint32_t *val32);
int nng_msg_header_chop_u64(nng_msg *msg, uint64_t *val64);

four little functions, one whole squad. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so the nng_msg_header_chop() family removes data from the end of the header of message msg. not the front, not the middle β€” the end. chopping from the end is the vibe, iykyk.

  • the first one, nng_msg_header_chop(), just yeets size bytes. gone. poof. πŸ’€
  • the rest of the girlies β€” nng_msg_header_chop_u16(), nng_msg_header_chop_u32(), and nng_msg_header_chop_u64() β€” remove 2, 4, or 8 bytes respectively, and then store what they yoinked into the value (like val32), after converting it from network-byte order (big-endian) to native byte order. she's bilingual fr fr. 🌈

⭐ RETURN VALUES ⭐

these functions return 0 on success, and non-zero otherwise. iconic when it's 0, sad when it's not. 😭


πŸ’€ ERRORS πŸ’€

  • NNG_EINVAL β€” the message header is too short to remove the requested data. like bestie there is nothing there, you cannot chop an empty header, it's giving delulu. πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

nng_msg_alloc(3), nng_msg_header(3), nng_msg_header_append(3), nng_msg_header_insert(3), nng_msg_header_len(3), nng_msg_header_trim(3), nng_msg_free(3), nng_strerror(3), nng(7)

the whole friend group, go say hi. πŸ’œ


mwah πŸ’‹ that's a wrap on this one β€” page dropped on 2026-06-30 as part of the NNG_MSG_HEADER_CHOP(3) era. chop responsibly, bestie. πŸŽ€βœ¨

πŸ“¦ where this page comes from