The \s-1xpa\s0 server-side programming interface
A description of the \s-1XPA\s0 server-side programming interface.
Introduction to \s-1XPA\s0 Server Programming
Creating an \s-1XPA\s0 server is easy: you generally only need to call the XPANew() subroutine to define a named \s-1XPA\s0 access point and set up the send and receive callback routines. You then enter an event loop such as XPAMainLoop() to field \s-1XPA\s0 requests.
#include <xpa.h>
XPA XPANew(char *class, char *name, char *help,
int (*send_callback)(), void *send_data, char *send_mode,
int (*rec_callback)(), void *rec_data, char *rec_mode);
XPA XPACmdNew(char *class, char *name);
XPACmd XPACmdAdd(XPA xpa,
char *name, char *help,
int (*send_callback)(), void *send_data, char *send_mode,
int (*rec_callback)(), void *rec_data, char *rec_mode);
void XPACmdDel(XPA xpa, XPACmd cmd);
XPA XPAInfoNew(char *class, char *name,
int (*info_callback)(), void *info_data, char *info_mode);
int XPAFree(XPA xpa);
void XPAMainLoop(void);
int XPAPoll(int msec, int maxreq);
void XPAAtExit(void);
void XPACleanup(void);
Introduction
To use the \s-1XPA\s0 application programming interface, a software developer generally will include the xpa.h definitions file:
#include <xpa.h>
in the software module that defines or accesses an \s-1XPA\s0 access point, and then will link against the libxpa.a library:
gcc \-o foo foo.c libxpa.a
\s-1XPA\s0 has been compiled using both C and \*(C+ compilers.
A server program generally defines an \s-1XPA\s0 access point by calling the XPANew() routine and specifies \*(L"send\*(R" and/or \*(L"receive\*(R" callback procedures to be executed by the program when an external process either sends data or commands to this access point or requests data or information from this access point. A program also can define several sub-commands for a single access point by calling XPACmdNew() and XPACmdAdd() instead. Having defined one or more public access points in this way, an \s-1XPA\s0 server program enters its usual event loop (or uses the standard \s-1XPA\s0 event loop).
See xpa(7) for a list of \s-1XPA\s0 help pages