Printing(3)

πŸ’– Printing β€” the nflog_snprintf_xml moment πŸ’–

okay bestie, so this is a page from the libnetfilter_log library manual (that's the Library Functions Manual vibe), and it's all about one lil function that turns your logged packets into pretty XML. it's giving "glow up for netlink data" fr fr ✨


πŸŽ€ NAME πŸŽ€

nflog_snprintf_xml β€” Printing. that's it, that's the name, she's literally called Printing πŸ’…


🌸 SYNOPSIS 🌸

#include <libnetfilter_log/libnetfilter_log.h>

int nflog_snprintf_xml (char *buf, size_t rem, struct nflog_data *tb, int flags)

like, that's the whole incantation. include the header, call the function, slay πŸ¦‹


πŸ‘‘ Function Documentation πŸ‘‘

✨ int nflog_snprintf_xml (char * buf, size_t rem, struct nflog_data * tb, int flags) ✨

so nflog_snprintf_xml β€” print the logged packet in XML format into a buffer. she takes your packet and makes it aesthetic, XML-style πŸŽ€

🌈 Parameters 🌈

  • buf β€” the buffer that you want to use to print the logged packet. that's your canvas bestie 🎨
  • rem β€” the size of the buffer that you have passed. yes, you have to tell her how much room she's working with πŸ™ˆ
  • tb β€” Netlink packet data handle passed to callback function. this is the packet's whole identity πŸ’«
  • flags β€” the flag that tell what to print into the buffer. pick your faves πŸ‘‘

πŸ’… This function supports the following flags πŸ’…

  • NFLOG_XML_PREFIX: include the string prefix
  • NFLOG_XML_HW: include the hardware link layer address
  • NFLOG_XML_MARK: include the packet mark
  • NFLOG_XML_DEV: include the device information
  • NFLOG_XML_PHYSDEV: include the physical device information
  • NFLOG_XML_PAYLOAD: include the payload (in hexadecimal)
  • NFLOG_XML_TIME: include the timestamp
  • NFLOG_XML_CTID: include conntrack id
  • NFLOG_XML_ALL: include all the logging information (all flags set)

You can combine these flags with a bitwise OR. that's the "why choose one when you can have them all" energy, lowkey iconic 🫢

⭐ Returns ⭐

-1 in case of failure, otherwise the length of the string that would have been printed into the buffer (in case that there is enough room in it). See snprintf() return value for more information. no cap, she'll tell you how much space she wanted even if she didn't get it 😭

πŸ’€ Errors πŸ’€

from underlying calls, in exceptional circumstances. so like, rare, but not never πŸ‘€

🧚 Definition 🧚

Definition at line 1066 of file libnetfilter_log.c. she's literally in the source code, go say hi ✨


🌸 Author 🌸

Generated automatically by Doxygen for libnetfilter_log from the source code. not a human, just a very dedicated robot doing the most πŸ€–πŸ’–


bestie reminder: every flag, every parameter, every number up there is verbatim from the page. don't be out here inventing new flags, that's not the vibe πŸ’…

mwah πŸ’‹ this was libnetfilter_log, Version 1.0.2, dated the Printing(3) era of the manual. thanks for reading my lil yap session, ily, go log some packets πŸ¦‹πŸŽ€βœ¨

πŸ“¦ where this page comes from