callback(3)

πŸ“¦
version 1.0.5 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing

callback(3) πŸ’–

okay bestie, so this is a page from the Library Functions Manual β€” it's callback(3), the callback helpers situation, and it's literally all about running your netlink message callbacks. no cap, it's giving very "small file, big power" energy. let's get into it ✨


🌸 NAME 🌸

callback β€” Callback helpers πŸŽ€

like. the helpers. for your callbacks. that's the vibe. πŸ¦‹


✨ SYNOPSIS ✨

Functions πŸ’…

int mnl_cb_run2 (const void *buf, size_t numbytes, unsigned int seq,
    unsigned int portid, mnl_cb_t cb_data, void *data, const mnl_cb_t
    *cb_ctl_array, unsigned int cb_ctl_array_len)
int mnl_cb_run (const void *buf, size_t numbytes, unsigned int seq,
    unsigned int portid, mnl_cb_t cb_data, void *data)

two functions. two icons. they're sisters fr fr πŸ’œ


🌈 Detailed Description 🌈

(this part is just vibes, the real tea is below in the function docs πŸ“)


πŸ‘‘ Function Documentation πŸ‘‘

int mnl_cb_run (const void * buf, size_t numbytes, unsigned int seq, unsigned int portid, mnl_cb_t cb_data, void * data) 🫢

mnl_cb_run β€” callback runqueue for netlink messages (simplified version) 😌✨

Parameters

  • buf β€” buffer that contains the netlink messages πŸ“¦
  • numbytes β€” number of bytes stored in the buffer πŸ”’
  • seq β€” sequence number that we expect to receive πŸ”
  • portid β€” Netlink PortID that we expect to receive πŸ›°οΈ
  • cb_data β€” callback handler for data messages πŸ“ž
  • data β€” pointer to data that will be passed to the data callback handler 🫴

so this function is like mnl_cb_run2() but it does not let you set the control callback handlers. that's the whole difference bestie, it's the low-maintenance sibling πŸ’…

Your callback may return three possible values:

  • MNL_CB_ERROR (<=-1): an error has occurred. Stop callback runqueue. πŸ’€
  • MNL_CB_STOP (=0): stop callback runqueue. βœ‹
  • MNL_CB_OK (>=1): no problems has occurred. βœ…

This function propagates the callback return value. like, it hands it right back to you, no editing, no notes πŸŽ€

Definition at line 159 of file callback.c. πŸ“

int mnl_cb_run2 (const void * buf, size_t numbytes, unsigned int seq, unsigned int portid, mnl_cb_t cb_data, void * data, const mnl_cb_t * cb_ctl_array, unsigned int cb_ctl_array_len) 🧚

mnl_cb_run2 β€” callback runqueue for netlink messages πŸ”₯

Parameters

  • buf β€” buffer that contains the netlink messages πŸ“¦
  • numbytes β€” number of bytes stored in the buffer πŸ”’
  • seq β€” sequence number that we expect to receive πŸ”
  • portid β€” Netlink PortID that we expect to receive πŸ›°οΈ
  • cb_data β€” callback handler for data messages πŸ“ž
  • data β€” pointer to data that will be passed to the data callback handler 🫴
  • cb_ctl_array β€” array of custom callback handlers from control messages πŸŽ›οΈ
  • cb_ctl_array_len β€” array length of custom control callback handlers πŸ“

You can set the cb_ctl_array to NULL if you want to use the default control callback handlers β€” and in that case, the parameter cb_ctl_array_len is not checked. so don't stress about it, it's literally not being read πŸ‘€

Your callback may return three possible values:

  • MNL_CB_ERROR (<=-1): an error has occurred. Stop callback runqueue. πŸ’€
  • MNL_CB_STOP (=0): stop callback runqueue. βœ‹
  • MNL_CB_OK (>=1): no problem has occurred. βœ…

This function propagates the callback return value. On error, it returns -1 and errno is explicitly set. πŸ‘‡

  • If the portID is not the expected, errno is set to ESRCH. 😭
  • If the sequence number is not the expected, errno is set to EPROTO. πŸ™ˆ
  • If the dump was interrupted, errno is set to EINTR and you should request a new fresh dump again. πŸ”„βœ¨
Definition at line 130 of file callback.c. πŸ“

πŸŽ€ Author πŸŽ€

Generated automatically by Doxygen for libmnl from the source code. πŸ€–βœ¨ (yes bestie, a robot wrote it, and it ate πŸ’…)


and that's the whole page, periodt πŸ’– this was libmnl, Version 1.0.5, callback(3) β€” mwah, take care of your callbacks and they'll take care of you 🫢🌸

πŸ“¦ where this page comes from