X-Istence wrote:
why? We could talk to it using normal sockets. I dont see why it would require a special API to talk to a normal deamon on a TCP/IP. Even Unix sockets.
Here is my $0.02 on how to best implement a daemon...
The daemon is in C [1] and runs under tcpserver. It opens a unix socket on the local machine, and/or a TCP port if we want to get into off machine access to the mail server. The deamon links to the vpopmail library, and makes calls to the library.
The daemon MUST require all connections to be authenticated, preferably against the vpopmail user base.
There isn't much use in a binary interface to the daemon, because almost all of the data it must pass is already ascii. I think about the only thing you could encode into a binary format is the identifier for which function you want to call. Domain names, user names, alias lines and everything else vpopail deals with is ASCII data, so that is the natural way to communicate with the daemon. I would suggest something like pop3:
You send: It replies
user rwidmer ok password mypassword ok addomain developersdesk.com mypassowrd ok adduser [EMAIL PROTECTED] mypassword ok addalias [EMAIL PROTECTED] ok enter alias addr? [EMAIL PROTECTED] enter alias addr? [EMAIL PROTECTED] enter alias addr? [EMAIL PROTECTED] enter alias addr? [EMAIL PROTECTED] enter alias addr? [EMAIL PROTECTED] enter alias addr? ok list developersdesk.com minimaillist alias postmaster user rick user
ok list [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]
ok list inter7.com err - no such domain list [EMAIL PROTECTED] err - no such domain list [EMAIL PROTECTED] err - no such address exit ok
Make it something that is conversational enough to telnet in to test the daemon without having to code both sides of the interface, and make sure . This syntax may not be exactly what it ends up using, but it should be close.
Then you write a tidy little library in PHP, that uses sockets to open the daemon, and provides functions that make it look like you are accessing the vpopmail extension directly.
I was hoping to report the list on sourceforge was up and running, but it seems to be taking a long time for my messages to be accepted. Even though I have already received the welcome message.
Riok
[1] Maybe it is my age showing, but it seems to me you want daemons lean and mean, and having to load the whole PHP interpreter just doesn't do it for me. (This is from someone who usually prefers to do everything in PHP.)