libevnet library provides a suite of interfaces, all built around libevent [http://www.monkey.org/~provos/libevent] , useful to network daemons.
bufio.h: Non-blocking line and block buffered I/O routines, providing tail recursive behavior so callers cannot overflow their stack with multiple back-to-back I/O issues (i.e. attempting unbounded recursive I/O operations before falling into the event loop).
This feature preserves the natural way to code in an asychronous manner by safeguarding against certain types of pathological behavior and malicious attacks.
socket.h: Asychronous accept(2) and connect(2), supporting IPv4, IPv6 and Unix Domain sockets transparently. Also supports encapsulated host address lookups for "one-shot" connection handling with automatic fallback (for MX and SRV hosts).
tls.h: OpenSSL interface which plugs into the buffered I/O API in bufio.h and socket.h API.
thread.h: Threading implementation for running "blocking" routines asychronously. Run a function in a separate thread, and have the return value collected and passed back asynchronously to the original caller.
lookup.h: Comprehensive DNS resolver with a dead simple interface. Supports PTR, A, AAAA, CNAME, NS, MX, TXT, SOA and SRV records, as well as "compound queries".
A lookup of A+AAAA+SRV first queries the SRV records, sorts them, then resolves each SRV host to an A and/or AAAA host (with a configurable CNAME chaining limit). The response is a linked list of lookup structures, beginning with an SRV record, associated A/AAAA sockaddr structures, the next SRV record, and so on. A+MX has similar behavior. This feature actually reduces network traffic, since most of the time the initial DNS query response contains all the necessary information in the additional section.
DNS SRV records are compliantly sorted according to RFC 2782 [http://rfc-ref.org/RFC-TEXTS/2782/]