AUPARSE_INIT(3)

πŸ“¦
version 4.2.1 Β· 3 versions
, in alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, fedora 43, fedora 44, nixpkgs unstable, ubuntu resolute, ubuntu stonking

πŸ’– AUPARSE_INIT(3) β€” Linux Audit API πŸ’–

okay bestie, gather round, because this one is the starting point of the whole audit-parsing saga. This is the manual page for auparse_init, from the Linux Audit API section 3, and yes, it's the one you call first before literally anything else works. ✨


✨ NAME ✨

auparse_init β€” initialize an instance of the audit parsing library πŸŽ€


🌸 SYNOPSIS 🌸

#include <auparse.h>

auparse_state_t * auparse_init(ausource_tsource,constvoid*"b);"

(yeah that's literally how it's written in the source page, we do not editorialize, we copy exactly πŸ’…)


πŸ¦‹ DESCRIPTION πŸ¦‹

auparse_init initializes an instance of the audit parsing library. That's it, that's the whole job, and it's iconic for it.

The function returns an opaque pointer to the parser's internal state. You then hand that pointer into subsequent calls to the library, so keep it somewhere safe, bestie β€” losing it is giving "lost my keys at 3am" energy 😭.

The source variable decides where the library looks for data. Legal values can be:

  • AUSOURCE_LOGS β€” use audit logs πŸ“œ
  • AUSOURCE_FILE β€” use a file πŸ“
  • AUSOURCE_FILE_ARRAY β€” use several files πŸ—‚οΈ
  • AUSOURCE_BUFFER β€” use a buffer 🧺
  • AUSOURCE_BUFFER_ARRAY β€” use an array of buffers 🧺🧺
  • AUSOURCE_DESCRIPTOR β€” use a particular descriptor πŸ”Œ
  • AUSOURCE_FILE_POINTER β€” use a stdio FILE pointer πŸ–‡οΈ
  • AUSOURCE_FEED β€” feed data to parser with auparse_feed() 🌊

The pointer b is used to set the file name, array of filenames, the buffer address, or an array of pointers to buffers, or the descriptor number β€” depending on what source you gave it. So like, b is doing a lot of jobs, it's the main character fr fr πŸ‘‘.

When the data source is an array of files or buffers, you would create an array of pointers with the last one being a NULL pointer. That NULL is your little "and that's the end bestie" flag. πŸ›‘

Buffers should be NUL terminated. no cap, do not skip this one.

The data structure returned by auparse_init is not thread-safe. If you need to use it in a multithreaded program, you will need to add locking around any use of the data structure. That's not a suggestion, that's the vibe check, and it will not pass without locks πŸ’€


⭐ RETURN VALUE ⭐

Returns a NULL pointer if an error occurs; otherwise, the return value is an opaque pointer to the parser's internal state. So: NULL = bad news πŸ™ˆ, anything else = slay, you're in business πŸ’…


🌈 SEE ALSO 🌈


πŸ’œ AUTHOR πŸ’œ

Steve Grubb πŸ‘‘


Red Hat, Jan 2023 β€” and that's the whole page, bestie! go forth, init your parser, and remember: no locks, no peace πŸ«ΆπŸ’–βœ¨