]> code.citadel.org Git - citadel.git/blobdiff - citadel/techdoc/session.txt
* cmd_msg3() now uses serialize_message() for its output. All message
[citadel.git] / citadel / techdoc / session.txt
index 9b80b37381a92b104c9b9ed6c0007f7afbd4db23..809ed3a39ff0128a6b8a0ec20469b1c805b04ebc 100644 (file)
@@ -1,5 +1,5 @@
                   SESSION LAYER PROTOCOL FOR CITADEL/UX
-         (c) 1995-1998 by Art Cancro et. al.    All Rights Reserved
+         (c) 1995-1999 by Art Cancro et. al.    All Rights Reserved
    
   
  INTRODUCTION
@@ -30,30 +30,15 @@ what you did, so that your new commands can be added to this document.
  ----------------------
   
  The protocols used below the session layer are beyond the scope of this
-document, but we will briefly cover a few of the currently used methods. 
-Keep in mind that the server program itself does not speak any protocols
-lower than the session layer.  Instead, it reads all input from stdin, and
-writes all output to stdout.  This implies that it is the responsibility of
-other programs to provide a usable transport to the client programs.
- One way to connect to a server is to use a set of pipes.  This does of
-course assume that the client and server are running on the same computer. 
-When the client starts up, the first thing that it does is create two pipes,
-which it temporarily dup()'s to stdin and stdout.  Then it proceeds to
-fork() and exec() to a copy of the server program, which inherits the
-pipes as its standard input and output - exactly the desired effect.  The
-client program can then re-connect its own stdin and stdout to where they're
-supposed to be, and use the pipes to send and receive server messages.
- Another way is to use TCP/IP.  Under Unix-like systems this is easily
-accomplished using the "inetd" superserver program, which can take programs
-like the Citadel/UX server and offer connections to clients over a TCP or
-UDP port.  See the install documentation (or the inetd documentation from
-your OS) for information on how to do this.  Always use TCP ports for
-Citadel/UX sessions.  Since our session layer assumes a clean, reliable,
-sequenced connection, the use of UDP would render the server unstable and
-unusable.  When operating in a TCP/IP environment, the port number officially
-assigned to Citadel is 504.
+document, but we will briefly cover the methodology employed by Citadel/UX.
+ Citadel/UX offers Citadel BBS service using TCP/IP.  It does so via a
+multithreaded server listening on a TCP port.  Older (4.xx) versions employed
+an inetd-based server.
+ The port number officially assigned to Citadel by the IANA is TCP/504.  Since
+our session layer assumes a clean, reliable, sequenced connection, the use
+of UDP would render the server unstable and unusable, so we stick with TCP.
    
    
  GENERAL INFORMATION ABOUT THE SERVER
@@ -197,14 +182,6 @@ logged in, or ERROR if another user already exists with this name.  If OK,
 it will also return the same parameters that PASS returns.
  
   
- AUTO   (AUTOmatic login   **OBSLETE** )
-   
- Citadel/UX no longer supports this type of authentication.  It was formerly
-used to automatically authenticate a user based on the user ID under which
-the server was running.  Due to the new multithreaded architecture of the
-server, this is no longer possible.
-  
-   
  SETP   (SET new Password)
  
  This command sets a new password for the currently logged in user.  The
@@ -239,8 +216,6 @@ by the '|' symbol, and then a number that may contain the following bits:
  Other bits may be defined in the future.  The listing terminates, as with
 all listings, with "000" on a line by itself.
  
- Version 4.01 and above only:
-
  Starting with version 4.01 and above, floors are supported.  The first 
 argument to LKRN should be the number of the floor to list rooms from.  Only
 rooms from this floor will be listed.  If no arguments are passed to LKRN, or
@@ -249,6 +224,10 @@ if the floor number requested is (-1), rooms on all floors will be listed.
  The third field displayed on each line is the number of the floor the room
 is on.  The LFLR command should be used to associate floor numbers with
 floor names.
+ The fourth field displayed on each line is a "room listing order."  Unless
+there is a compelling reason not to, clients should sort any received room
+listings by this value.
 
  
  
@@ -336,11 +315,11 @@ GOTO command to _BASEROOM_ is guaranteed to succeed.  This is useful to
 allow client software to return to the base room when it doesn't know
 where else to go.
  
- Citadel/UX server v4.01 and above, also has two additional reserved room
-names.  "_MAIL_" translates to the system's designated room for e-mail
-messages, and "_BITBUCKET_" goes to whatever room has been chosen for messages
+ There are also two additional reserved room names:
+ "_MAIL_" translates to the system's designated room for e-mail messages.
+ "_BITBUCKET_" goes to whatever room has been chosen for messages
 without a home.
+
  The second (and optional) parameter is a password, if one is required for
 access to the room.  This allows for all types of rooms to be accessed via
 this command: for public rooms, invitation-only rooms to which the user
@@ -387,12 +366,8 @@ in.
    7. Boolean flag: 1 if this is a Mail> room, 0 otherwise.
    8. Aide flag: 1 if the user is either the Room Aide for this room, *or* is
 a regular Aide (this makes access checks easy).
-  ...and in server 4.01 and above:
    9. The number of new Mail messages the user has (useful for alerting the
 user to the arrival of new mail during a session)
-  
-  ...and in server 4.03 and above:
   10. The floor number this room resides on
   
   
@@ -424,9 +399,7 @@ other MSG commands (MSG1, MSG2, etc.) will probably be added later on to read
 messages in more robust formats.  This command should be passed two arguments.
 The first is the message number of the message being requested.  In server 
 version 4.04 and above, the second argument may be set to either 0 to read the
-entire message, or 1 to read the headers only.  In server version 6.00 and
-above, the third argument may be set to the desired section of the message (if
-there are attachments).
+entire message, or 1 to read the headers only.
  
  The server should, of course, make sure that the client actually has access
 to the message being requested before honoring this request.  Citadel/UX does
@@ -437,15 +410,17 @@ it's not there, the request is denied.
 LISTING_FOLLOWS code will be returned, followed by the contents of the message.
 The following fields may be sent:
   
- type=   Formatting type.  Currently, there are two defined types.  Type 0 is
-"traditional" Citadel formatting.  This means that newlines should be treated
-as spaces UNLESS the first character on the next line is a space.  In other
-words, only indented lines should generate a newline on the user's screen when
-the message is being displayed.  This allows a message to be formatted to the
-reader's screen width.  It also allows the use of proportional fonts.
-Type 1 is a simple fixed-format message.  The message should be displayed to
+ type=   Formatting type.  The currently defined types are:
+  0 = "traditional" Citadel formatting.  This means that newlines should be
+treated as spaces UNLESS the first character on the next line is a space.  In
+other words, only indented lines should generate a newline on the user's screen 
+when the message is being displayed.  This allows a message to be formatted to
+the reader's screen width.  It also allows the use of proportional fonts.
+  1 = a simple fixed-format message.  The message should be displayed to
 the user's screen as is, preferably in a fixed-width font that will fit 80
 columns on a screen.
+  4 = MIME format message.  The message text is expected to contain a header
+with the "Content-type:" directive (and possibly others).
   
  msgn=   The message ID of this message on the system it originated on.
  path=   An e-mailable path back to the user who wrote the message.
@@ -485,13 +460,14 @@ parts of the listing:
  Line 4  - The fully-qualified domain name (FQDN) of the server
  Line 5  - The name of the server software, i.e. "Citadel/UX 4.00"
  Line 6  - (The revision level of the server code) * 100
- Line 7  - The geographical location of the BBS (for USA: city and state)
+ Line 7  - The geographical location of the BBS (city and state if in the US)
  Line 8  - The name of the system administrator
  Line 9  - A number identifying the server type (see below)
  Line 10 - The text of the system's paginator prompt
- (version 4.01 and above only)
  Line 11 - Floor Flag.  1 if the system supports floors, 0 otherwise.
+ Line 12 - Paging level.  0 if the system only supports inline paging,
+           1 if the system supports "extended" paging (check-only and
+           multiline modes).  See the SEXP command for further information.
  
  *** NOTE! ***   The "server type" code is intended to promote global
 compatibility in a scenario in which developers have added proprietary
@@ -513,18 +489,10 @@ yet, just work with the Citadel development team on the main source tree.
  If everyone follows this scheme, we can avoid a chaotic situation with lots
 of confusion about which client program works with which server, etc.  Client
 software can simply check the server type (and perhaps the revision level)
-to determine ahead of time what commands may be utilized.  The server type
-codes currently defined are:
- Type             Developer
- ---- ---------------------------------------
- 0    Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
- 1    Brian Ledbetter <brian@amaranth.com>
- 2    Matthew Scott <gldnspud@telcomplus.com>
- 3    Jesse Vincent <jrvincent@wesleyan.edu>
- 4    Brian Costello <btx@calyx.net>
- 5    Robert Abatecola <robert@tsgus.com>
-    
+to determine ahead of time what commands may be utilized. 
+ Please refer to "developers.txt" for information on what codes belong to whom.
+
   
    
  RDIR   (Read room DIRectory)
@@ -603,9 +571,8 @@ and the room aide associated with the current room, can access this command.
  1. The room's password (if it's a passworded room)
  2. The name of the room's directory (if it's a directory room)
  3. Various flags (bits) associated with the room (see LKRN cmd above)
-
- (And on server version 4.01 and above ... )
  4. The floor number on which the room resides
+ 5. The room listing order
   
   
  SETR   (SET Room attributes)
@@ -618,9 +585,8 @@ should be passed the following arguments:
  2. The name of the room's directory (if it's a directory room)
  3. Various flags (bits) associated with the room (see LKRN cmd above)
  4. "Bump" flag (see below)
- (And on server version 4.01 and above, the client may also send ... )
  5. The floor number on which the room should reside
+ 6. The room listing order
  
  *Important: You should always use GETR to retrieve the current attributes of
 the room, then change what you want to change, and then use SETR to write it
@@ -678,8 +644,6 @@ message as anonymous, otherwise 0 for a normal message.
 typically be 0; see the MSG0 command above).
   4  -  Post name.  When postflag is 2, this is the name you are posting as.
 This is an Aide only command.
-  5  -  Boundary string to be used when there are MIME attachments following
-the normal message text.
 
  Possible result codes:
   OK  -  The request is valid.  (Client did not set the "post" flag, so the
@@ -772,8 +736,7 @@ or ERROR or ERROR+HIGHER_ACCESS_REQUIRED if the command will not succeed.
        2  -  Private; can be entered by knowing the name *and* password
        3  -  Private; invitation only (sometimes called "exclusive")
  3  -  Password for new room (if it is a type 2 room)
- 4  -  Floor number on which the room should reside (optional, and in server
-       version 4.01 and above only)
+ 4  -  Floor number on which the room should reside (optional)
  
  If the create flag is set to 1, the room is created (unless something
 went wrong and an ERROR return is sent), and the server returns OK, but
@@ -1038,8 +1001,8 @@ file resides.  Possible return codes are:
  OK                            (file is open)
  
  If the file is successfully opened, OK will be returned, along with the
-size (in bytes) of the file, and (in version 5.00 and above) the time of last
-modification.
+size (in bytes) of the file, the time of last modification (if applicable),
+the filename (if known), and the MIME type of the file (if known).
  
  
  CLOS   (CLOSe the download file)
@@ -1143,12 +1106,6 @@ images which are likely to exist on most servers:
                 opposed to the floor picture's use in a floor listing).
  
    
-  
- ---------------------------------------------------------------------------
- The following commands are available only in Citadel/UX server version 4.01
- and above.
- ---------------------------------------------------------------------------
  NETP   (authenticate as network session with system NET Password) 
  
  This command is used by client software to identify itself as a transport
@@ -1240,10 +1197,6 @@ floor name would change the floor's name.
  If the command succeeds, it will return OK.  Otherwise it will return
 ERROR (plus perhaps HIGHER_ACCESS_REQUIRED or INVALID_FLOOR_OPERATION)
   
- ---------------------------------------------------------------------------
- The following commands are available only in Citadel/UX server version 4.02
- and above.
- ---------------------------------------------------------------------------
 
 IDEN (IDENtify the client software)
 
@@ -1268,10 +1221,6 @@ otherwise it should use the host name it has detected itself.
  IDEN always returns OK, but since that's the only way it ever returns
 there's no point in checking the result code.
   
- ---------------------------------------------------------------------------
- The following commands are available only in Citadel/UX server version 4.03
- and above.
- ---------------------------------------------------------------------------
 
 IPGM (identify as an Internal ProGraM)
  
@@ -1329,25 +1278,33 @@ to other users currently in chat.
  This is one of two commands which implement "express messages" (also known
 as "paging").  An express message is a near-real-time message sent from one
 logged in user to another.  When an express message is sent, it will be
-displayed the next time the target user executes a PEXP command.
+displayed the next time the target user executes a PEXP or GEXP command.
  
  The SEXP command accepts two arguments: the name of the user to send the
 message to, and the text of the message.  If the message is successfully
 transmitted, OK is returned.  If the target user is not logged in or if
 anything else goes wrong, ERROR is returned.
+  
+ If the server supports extended paging, sending a zero-length message
+merely checks for the presence of the requested user without actually sending
+a message.  Sending a message consisting solely of a "-" (hyphen) will cause
+the server to return SEND_LISTING if the requested user is logged in, and the
+client can then transmit a multi-line page.
  
- In Citadel/UX 5.00 and above, the reserved name "broadcast" may be used
-instead of a user name, to broadcast an express message to all users
-currently connected to the server.
+ The reserved name "broadcast" may be used instead of a user name, to
+broadcast an express message to all users currently connected to the server.
  
  Do be aware that if an express message is transmitted to a user who is logged
 in using a client that does not check for express messages, the message will
 never be received.
  
  
- PEXP   (Print EXPress messages)
+ PEXP   (Print EXPress messages)   ***DEPRECATED***
  
- This command, called without any arguments, simply dumps out the contents
+ This command is deprecated; it will eventually disappear from the protocol and
+its use is not recommended.  Please use the GEXP command instead.
+ Called without any arguments, PEXP simply dumps out the contents
 of any waiting express messages.  It returns ERROR if there is a problem,
 otherwise it returns LISTING_FOLLOWS followed by all messages.
  
@@ -1357,10 +1314,6 @@ server return code messages, between the return code and the parameters.  In
 much the same way as FTP uses "-" to signify a continuation, Citadel uses
 an "*" in this position to signify the presence of waiting express messages.
   
- ---------------------------------------------------------------------------
- The following commands are available only in Citadel/UX server version 4.10
- and above.
- ---------------------------------------------------------------------------
  
  EBIO   (Enter BIOgraphy)
  
@@ -1379,10 +1332,6 @@ LISTING_FOLLOWS plus the bio file if the user exists and has a bio on file,
 ERROR+NO_SUCH_USER if the named user does not exist, or ERROR+FILE_NOT_FOUND
 if the user exists but has no bio on file.
   
- ---------------------------------------------------------------------------
- The following commands are available only in Citadel/UX server version 4.11
- and above.
- ---------------------------------------------------------------------------
   
  STEL   (enter STEaLth mode)
  
@@ -1416,10 +1365,6 @@ easier to implement, and to provide some sort of multimedia support in the
 future.  Keep in mind that when this command is used, all messages will be
 output in fixed 80-column format.
   
- ---------------------------------------------------------------------------
- The following commands are available only in Citadel/UX server version 5.00
- and above.
- ---------------------------------------------------------------------------
    
  MSG3   (read MeSsaGe, mode 3 -- internal command)
  
@@ -1580,15 +1525,11 @@ addition, the RWHO listing will include both the spoofed and real usernames.
  TIME  (get server local TIME)
 
  TIME returns OK followed by the current time measured in seconds since
-00:00:00 GMT, Jan 1, 1970.
+00:00:00 GMT, Jan 1, 1970 (standard Unix format).
 
  This is used in allowing a client to calculate idle times.
 
 
-----------------------------------------------
-The following are for citserver 5.50 and above
-----------------------------------------------
-
  AGUP   (Administrative Get User Parameters)
  ASUP   (Administrative Set User Parameters)
   
@@ -1677,3 +1618,102 @@ fails for any reason, ERROR is returned.
  15. Number of maximum concurrent sessions allowed on the server
  16. Password for server-to-server networking
  17. Default purge time (in days) for users
+ 18. Default purge time (in days) for rooms
+ 19. Name of room to log express messages to (or a zero-length name for none)
+ 20. Access level required to create rooms
+ 21. Maximum message length which may be entered into the system
+  
+ EXPI   (EXPIre system objects)
+ Begins purge operations for objects which, according to site policy, are
+"old" and should be removed.  EXPI should be called with one argument, one of:
+    "messages"     (purge old messages out of each room)
+    "users"        (purge old users from the userlog)
+    "rooms"        (remove rooms which have not been posted in for some time)
+    "visits"       (purge dereferenced user/room relationship records)
+  
+ EXPI returns OK (probably after a long delay while it does its work) if it
+succeeds; otherwise it returns an ERROR code.
+ This command is probably temporary, until we can work some sort of scheduler
+into the system.  It is implemented in the serv_expire module.
+  
+ MSG4   (read MeSsaGe, mode 4 -- enumerate MIME parts)
+     FIX ... do the writeup for this once it's done.
+
+  
+ OPNA   (OPeN Attachment)
+ Opens, as a download file, a component of a MIME-encoded message.  The two
+parameters which must be passed to this command are the message number and the
+name of the desired section.  If the message or section does not exist, an
+appropriate ERROR code will be returned; otherwise, if the open is successful,
+this command will succeed returning the same information as an OPEN command.
+ GEXP   (Get EXPress messages)
+ This is a more sophisticated way of retrieving express messages than the old
+PEXP method.  If there are no express messages waiting, PEXP returns ERROR;
+otherwise, it returns LISTING_FOLLOWS and the following arguments:
+   
+ 0 - a boolean value telling the client whether there are any additional
+     express messages waiting following this one
+ 1 - a Unix-style timestamp
+ 2 - flags (see server.h for more info)
+ 3 - the name of the sender
+ 4 - the node this message originated on (for future support of PIP, ICQ, etc.)
+  
+ The text sent to the client will be the body of the express message.
+      
+ So how does the client know there are express messages waiting?  It could
+execute a random GEXP every now and then.  Or, it can check the byte in
+server return code messages, between the return code and the parameters.  In
+much the same way as FTP uses "-" to signify a continuation, Citadel uses
+an "*" in this position to signify the presence of waiting express messages.
+  
+ CICQ   (Citadel ICQ metaclient setup)
+ ** WARNING **
+ This command is most likely a temporary one.  Citadel will eventually have
+more robust functionality for abstract configuration screens, and when that
+happens, this command will certainly be migrated there.  If you're developing
+a client, don't spend a lot of time working on ICQ screens.
+ If a Citadel server has the ICQ Metaclient installed, this command is used
+to configure it.  It has several usages:
+ CICQ login|uin|pass
+  This tells Citadel the user's ICQ uin (second argument) and password (third
+argument).  When called in this fashion, CICQ will return either OK or ERROR.
+It should be noted, however, that the only way an ERROR code can be returned
+is if the uin and/or password is not supplied.  Authentication failures cannot
+be immediately detected, because the ICQ protocol is asynchronous.
+ CICQ getcl
+ Request the current contact list.  If successful, CICQ will return
+LISTING_FOLLOWS followed by zero or more contacts in the format 
+   
+   uin|nickname|status
+ CICQ putcl
+ Upload a new contact list.  If successful, CICQ will return SEND_LISTING
+after which the client should transmit zero or more uin's, one per line.  The
+server will then attempt to contact the ICQ server to determine nicknames
+and statuses.
+ CICQ status
+ Always returns OK followed by a 1 (connected to ICQ) or 0 (not connected).