NAME
pop3d - Tcl POP3 server implementation
SYNOPSIS
package require TTccll 88..33 package require ppoopp33dd ??11..00..22?? ::::ppoopp33dd::::nneeww ?serverName? sseerrvveerrNNaammee option ?arg arg ...? serverName uupp serverName ddoowwnn serverName ddeessttrrooyy ?mode? serverName ccoonnffiigguurreeserverName ccoonnffiigguurree -option
serverName ccoonnffiigguurree -option value...
serverName ccggeett -option
serverName ccoonnnn list serverName ccoonnnn state id authCmd llooookkuupp name storageCmd ddeellee mbox msgList storageCmd lloocckk mbox storageCmd uunnlloocckk mbox storageCmd ssiizzee mbox ?msgId? storageCmd ssttaatt mbox storageCmd ggeett mbox msgIdDESCRIPTION
::::ppoopp33dd::::nneeww ?serverName? This command creates a new server object with an associated global Tcl command whose name is serverName. The command sseerrvveerrNNaammee may be used to invoke various operations on the server. It has the following general form: sseerrvveerrNNaammee option ?arg arg ...? Option and the args determine the exact behavior of the command. A pop3 server can be started on any port the caller has permission for from the operating system. The default port will be 110, which is theport defined by the standard specified in RFC 1939 (http://www.rfc-edi-
tor.org/rfc/rfc1939.txt). After creating, configuring and starting a the server object will listen for and accept connections on that port and handle them according to the POP3 protocol. Note: The server provided by this module will handle only the basic protocol by itself. For the higher levels of user authentication and handling of the actual mailbox contents callbacks will be invoked. The following commands are possible for server objects: serverName uupp After this call the server will listen for connections on its configured port. serverName ddoowwnn After this call the server will stop listening for connections. This does not affect existing connections. serverName ddeessttrrooyy ?mode?Destroys the server object. Currently open connections are han-
dled depending on the chosen mode. The provided modes are: kkiillll Destroys the server immediately, and forcefully closes all currently open connections. This is the default mode. ddeeffeerr Stops the server from accepting new connections and will actually destroy it only after the last of the currently open connections for the server is closed. serverName ccoonnffiigguurree Returns a list containing all options and their current values in a format suitable for use by the command aarrrraayy sseett. The options themselves are described in section OOPPTTIIOONNSS.serverName ccoonnffiigguurree -option
Returns the current value of the specified option. This is an alias for the method ccggeett. The options themselves are described in section OOPPTTIIOONNSS.serverName ccoonnffiigguurree -option value...
Sets the specified option to the provided value. The options themselves are described in section OOPPTTIIOONNSS.serverName ccggeett -option
Returns the current value of the specified option. The options themselves are described in section OOPPTTIIOONNSS. serverName ccoonnnn list Returns a list containing the ids of all connections currently open. serverName ccoonnnn state id Returns a list suitable for [aarrrraayy sseett] containing the state of the connection referenced by id. OOPPTTIIOONNSS The following options are available to pop3 server objects.-ppoorrtt port
Defines the port to listen on for new connections. Default is 110. This option is a bit special. If port is set to "0" the server, or rather the operating system, will select a free porton its own. When querying -ppoorrtt the id of this chosen port will
be returned. Changing the port while the server is up will nei-
ther change the returned value, nor will it change on which port the server is listening on. Only after resetting the server via a call to ddoowwnn followed by a call to uupp will the new port take effect. It is at that time that the value returned when querying-ppoorrtt will change too.
-aauutthh command
Defines a command prefix to call whenever the authentication of a user is required. If no such command is specified the server will reject all users. The interface which has to be provided by the command prefix is described in section AAUUTTHHEENNTTIICCAATTIIOONN.-ssttoorraaggee command
Defines a command prefix to call whenever the handling of mail-
box contents is required. If no such command is specified the server will claim that all mailboxes are empty. The interface which has to be provided by the command prefix is described in section MMAAIILLBBOOXXEESS. AAUUTTHHEENNTTIICCAATTIIOONNHere we describe the interface which has to be provided by the authen-
tication callback so that pop3 servers following the interface of this module are able to use it. authCmd llooookkuupp nameThis method is given a username and has to return a two-element
list containing the password for this user and a storage refer-
ence, in this order.The storage reference is passed unchanged to the storage call-
back, see sections OOPPTTIIOONNSS and MMAAIILLBBOOXXEESS for either the option defining it and or the interface to provide, respectively. MMAAIILLBBOOXXEESS Here we describe the interface which has to be provided by the storage callback so that pop3 servers following the interface of this module are able to use it. The mbox argument is the storage reference asreturned by the llooookkuupp method of the authentication command, see sec-
tion AAUUTTHHEENNTTIICCAATTIIOONN. storageCmd ddeellee mbox msgList] Deletes the messages whose numeric ids are contained in the msgList from the mailbox specified via mbox. storageCmd lloocckk mboxThis method locks the specified mailbox for use by a single con-
nection to the server. This is necessary to prevent havoc ifseveral connections to the same mailbox are open. The complemen-
tary method is uunnlloocckk. The command will return true if the lock could be set successfully or false if not. storageCmd uunnlloocckk mbox This is the complementary method to lloocckk, it revokes the lock on the specified mailbox. storageCmd ssiizzee mbox ?msgId? Determines the size of the message specified through its id in msgId, in bytes, and returns this number. The command willreturn the size of the whole maildrop if no message id was spec-
ified. storageCmd ssttaatt mbox Determines the number of messages in the specified mailbox and returns this number. storageCmd ggeett mbox msgId Returns a handle for the specified message. This handle is amime token following the interface described in the documenta-
tion of package mmiimmee. The pop3 server will use the functionality of the mime token to send the mail to the requestor at the other end of a pop3 connection. KKEEYYWWOORRDDSS internet, network, pop3, protocol, rfc 1939 COPYRIGHT Copyright (c) 2002 Andreas Kupriespop3d 1.0.2 pop3d(n)