AU_BSM_TO_SOCKET_TYPE(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’… au_bsm_to_socket_type, au_socket_type_to_bsm πŸ’…

okay bestie, so this is a page from libbsm β€” that's the Basic Security Module Library β€” and it lives in section 3 of the manual, the whole "library functions" girlie section. buckle up, we're talking socket types today 🧦


🌸 NAME 🌸

au_bsm_to_socket_type, au_socket_type_to_bsm β€” the glow-up translators that convert between BSM and local socket types ✨

πŸ¦‹ LIBRARY πŸ¦‹

Basic Security Module Library (libbsm, -lbsm) β€” she's giving main character energy, link her with -lbsm πŸ’–

πŸŽ€ SYNOPSIS πŸŽ€

#include <bsm/libbsm.h>

int
au_bsm_to_socket_type(u_short bsm_socket_type, int *local_socket_typep);

u_short
au_socket_type_to_bsm(int local_socket_type);

✨ DESCRIPTION ✨

so these two interfaces are literally your little conversion duo 🫢 they take you back and forth between local socket types and BSM socket types, no cap.

au_bsm_to_socket_type() takes a BSM socket type, bsm_socket_type, and converts it into a local socket type β€” like the ones you'd pass to socket(2) β€” and if it works, that converted value gets stored in the integer that local_socket_typep points at πŸ’Ύ. but listen: this call will fail if the BSM socket type can't be mapped into a local socket type 😭 and that can happen when the socket token was generated on a different operating system. so like, cross-OS drama, not her fault.

au_socket_type_to_bsm() is the chill one πŸ’… she takes a local socket type and returns the BSM socket type for it. this call cannot fail β€” instead it returns a BSM socket type that tells a later decoder "yeah bestie, the socket type could not be encoded" πŸ™ˆ iconic behavior honestly.

⭐ RETURN VALUES ⭐

on success, au_bsm_to_socket_type() returns 0 plus a converted socket type πŸŽ‰ on failure, it returns -1 β€” but it does not set errno(2). yes, you read that right, no errno for you 🫠

on success, au_strerror() returns a pointer to an error string; on failure it will return NULL πŸ•³οΈ

ngl that second paragraph is straight from the page and it does talk about au_strerror(), not the socket functions. keep that in your notes, don't @ me πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

🌈 HISTORY 🌈

au_bsm_to_socket_type() and au_socket_type_to_bsm() were introduced in OpenBSM 1.1 β€” vintage, but make it cute πŸŽ€

πŸ‘‘ AUTHORS πŸ‘‘

these functions were implemented by Robert Watson under contract to Apple Inc. 🍎

and the Basic Security Module (BSM) interface to audit records and audit event stream format were defined by Sun Microsystems β˜€οΈ


mwah πŸ’‹ this page came from the Debian crew, dated December 28, 2008 β€” yeah she's an elder but she still slays, and that's the whole manual page, periodt. πŸŒΈπŸ¦‹πŸ’œ

πŸ“¦ where this page comes from