xpamacros(3)
π 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) π
π¦ where this page comes from
- debian bookworm: libxpa-dev 2.1.20-1 Β· MIT
- debian trixie: libxpa-dev 2.1.20-3 Β· MIT
- ubuntu jammy: libxpa-dev 2.1.20-1 Β· MIT
- ubuntu noble: libxpa-dev 2.1.20-1build1 Β· MIT
- ubuntu questing: libxpa-dev 2.1.20-3
- ubuntu resolute: libxpa-dev 2.1.20-3build1 Β· MIT
- ubuntu stonking: libxpa-dev 2.1.20-3build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms