NGATMBASE(4)

πŸ’– NGATMBASE(4) πŸ’–

okay bestie, sit down, hydrate, because we're talking about ngatmbase β€” the netgraph ATM utility module from the Kernel Interfaces Manual. yes, it's a manual page. yes, it's giving utility-module energy. let's go πŸ¦‹


✨ NAME ✨

ngatmbase β€” netgraph ATM utility module

🌸 SYNOPSIS 🌸

#include <netnatm/unimsg.h>
#include <netgraph/atm/ngatmbase.h>

struct mbuf *
uni_msg_pack_mbuf(struct uni_msg *msg, void *hdr, size_t len);

struct uni_msg *
uni_msg_alloc(size_t len);

struct uni_msg *
uni_msg_build(void *buf, ...);

void
uni_msg_destroy(struct uni_msg *msg);

int
uni_msg_unpack_mbuf(struct mbuf *m, struct uni_msg *msgp);

πŸ‘‘ DESCRIPTION πŸ‘‘

so this module is literally the little helper squad 🫢 that handles signalling messages for all the NgATM modules. it's the backstage crew. the main character energy is elsewhere, but nothing works without it.


πŸŽ€ uni_msg_pack_mbuf()

this one packs a message into one or several mbufs, and optionally it'll prepend a header for you πŸ’…

  • the header is given by its address hdr and its length len
  • if hdr is NULL or len equals 0, then no header gets prepended. periodt.
  • either msg or hdr may be NULL, but not both β€” that's the rule, no cap
  • it returns a pointer to the allocated mbuf chain, or NULL if something went wrong 😭

🧚 uni_msg_alloc()

allocates a brand new message with space for at least len bytes ✨

if there's an error, NULL comes back. that's it, that's the whole function, she's simple and she's iconic.

πŸ“ uni_msg_build()

constructs a message out of pieces 🧩

each piece is handed over as a pair of arguments β€” first one is of type void *, second one is a size_t.

and the list of pieces must be terminated by (void *)NULL. do not forget the terminator, bestie, that's the vibe check 🚨

πŸ’€ uni_msg_destroy()

destroys the messages and frees all of the message's memory. bye queen, you served 🫑

🌈 uni_msg_unpack_mbuf()

unpacks an mbuf chain into a uni_msg πŸ¦‹

a pointer to the newly allocated message gets stored in msgp, and 0 is returned. slay.

but if there's an error β€” either when no packet header is found in the first mbuf, or when memory cannot be allocated β€” the function returns an appropriate error code. so check your return value, i'm begging πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯

πŸ’œ AUTHORS πŸ’œ

Harti Brandt <harti@FreeBSD.org> β€” the icon, the legend, the moment ⭐


and that's the whole page, bestie!! this one's from the Debian distribution and it's dated August 24, 2004 β€” vintage, lowkey a classic, and honestly? still serving πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from