--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/protocol.txt Wed Jan 16 22:39:43 2008 +0100
@@ -0,0 +1,43 @@
+Client-Server interaction
+-------------------------
+
+To execute a server call, the client opens the daemon's UNIX domain
+socket (as specified by SYSCONFDIR/socket-file), and sends across the
+following data:
+
+Size Type Description
+1 int Protocol number (always 2)
+2 int Total length of all data
+1 int Number of arguments following the command
+varies string Command name
+varies strings Arguments
+
+It then receives the following response from the server:
+
+Size Type Description
+1 int Response code: one of the following
+ 0: OK -- operation succeeded
+ 1: Bad -- error in format or syntax
+ 2: Error -- operation failed
+varies string Message
+
+
+Strings are encoded as:
+
+Size Type Description
+2 int Length of string
+length char String data (no trailing NUL byte)
+
+All integers are unsigned, sent MSB first.
+
+Example:
+0x02 Protocol version
+0x00 0x2E Length of everything from this point on
+0x02 Number of arguments to command
+0x00 0x0A Length of command name (command name will become a
+ number later)
+listdomain Command name
+0x00 0x15 Length of first argument
+mailtest.somesuch.dom First argument
+0x00 0x08 Length of second argument
+mailtest Second argument