libafdt
|
libafdt is a library for "a"synchronous "f"ile "d"escriptor "t"ransfers. It provides a simple interface that allows libevent-based programs to set up a Unix domain socket to accept connections and transfer file descriptors to clients, or to be a client and request a file descriptor from a libafdt server. Low-level and synchronous interfaces are also provided for programs that do not use libevent.
See Advanced Programming in the UNIX(R) Environment for more information about transferring file descriptors between processes using Unix domain sockets.
libafdt's has two high-level interfaces: an Asynchronous Interface and a Synchronous Interface . The former is best for clients or servers that are based on libevent. It uses callbacks to allow the program to process high-level events. The latter is for clients that don't use libevent and are willing to block while waiting to receive a response. It does not require libevent, and is much more convenient when blocking is acceptable.
There is also a Low-level Interface . It does not require libevent, but can still be used without blocking. It can also be used to change the simple protocol used by the high-level interfaces. It requires a bit more bookkeeping to use.
The test programs are good examples of how to use the high-level interfaces.
The high-level interfaces are good examples of how to use the low-level interface.