xpamacros(3)

πŸ“¦
version 2.1.20 Β· 2 versions
  • 2.1.20 Β· debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 2.1.20 Β· fedora 43, fedora 44
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’… xpamacros(3) β€” the SAORD Documentation glow-up

okay bestie, welcome to xpamacros from the SAORD Documentation collection, and no cap this one is a lil snack. it's all about the Server Callback Macros β€” the little magic spells your server routine gets to peek at when somebody calls it. πŸ¦‹


✨ NAME ✨

XPAMacros β€” Server Callback Macros. that's it, that's the name, she's iconic πŸ’…


🌸 SYNOPSIS 🌸

#include <xpa.h>

xpa_class, xpa_name, xpa_method, xpa_cmdfd, xpa_datafd,
xpa_sendian, xpa_cendian

πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the tea πŸ“: when your server routines get called, they have access to all the deets about the XPA that's being called β€” and they get them through these macros. every single one of them takes the xpa handle as its argument. periodt.

  • xpa_class β€” the class of this xpa πŸŽ€
  • xpa_name β€” the name of this xpa ✨
  • xpa_method β€” the method string, aka the inet or local connect info 🌐
  • xpa_cmdfd β€” the fd of the command socket πŸ’Œ
  • xpa_datafd β€” the fd of the data socket πŸ“¦
  • xpa_sendian β€” the endian-ness of the server, which is either "little" or "big" 🧚
  • xpa_cendian β€” the endian-ness of the client, which is either "little" or "big" 🫢

the argument you feed these macros is the call_data pointer that gets passed to the server procedure. and lowkey you HAVE to type cast that pointer to XPA inside your server routine, like so:

XPA xpa = (XPA)call_data;

now, the most important one of the whole squad? that's xpa_datafd(), hands down, main character energy fr fr. if your server routine sets "fillbuf=false" in receive_mode or send_mode, you can use this macro to do I/O directly to/from the client instead of going through buf. slay. πŸ’…

and the duo xpa_cendian + xpa_sendian? use them together to figure out if the data coming over from the client is byte swapped compared to the server. values for these macros are: "little", "big", or "?". 😭

okay but real talk bestie β€” even with those two, to do a proper conversion you still need to know the format of the data. byte swapping is dependent on the size of the data element being converted. so don't come for me when your bytes get scrambled, iykyk. πŸ’€

🌈 SEE ALSO 🌈

see xpa(n) for a list of XPA help pages πŸ“š


and that's the whole vibe, babe β€” this was version 2.1.15, dated July 23, 2013, and yes she is still serving after all these years. bye bestie, go read xpa(n) πŸ’–