Ucspi-tcp
From Qmail Info Wiki
ucspi-tcp is an implementation of DJB's UNIX Client-Server Program Interface (http://cr.yp.to/proto/ucspi.txt) for the TCP protocol. It is a package which includes the tcpserver, tcprules, and rblsmtpd programs (which are all commonly used on qmail servers) as well as other programs such as tcpclient, fixcrio, and recordio.
The idea behind UCSPI is that a program should not have to worry about the low-level details of handling sockets. For example, to set up a TCP-based service, the tcpserver program manages the socket details, running a separate client program to provide the actual service on the port.
There are alternate implementations of UCSPI out there, notably ucspi-ssl which handles SSL-encrypted TCP sockets.
Programs
The tcpserver program creates, binds, and listens to a socket. When it detects an incoming connection, it runs a client program with the socket connected to that client's "standard in" and "standard out" channels.
The tcprules program can be used to create a cdb file which tells tcpserver which IP addresses it should and should not accept connections from, as well as any environment variables which need to be set on a per-client basis.
The rblsmtpd program was designed to be used by a mail server- it sits between tcpserver and qmail-smtpd and checks the client's IP address against one or more RBL's. If the IP is found, it will engage the client in something which looks like an SMTP connection but only returns errors. Otherwise, it passes the connection along to the normal qmail-smtpd program.
The recordio program can be used to keep a raw log of the traffic being sent between two programs. By inserting it between tcpserver and qmail-smtpd, you can keep a log of the actual SMTP conversations when somebody connects to your server.
Links
Home page for the ucspi-tcp package (http://cr.yp.to/ucspi-tcp.html)

