* Added the ASYN command
authorArt Cancro <ajc@citadel.org>
Sat, 13 Jan 2001 06:12:19 +0000 (06:12 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 13 Jan 2001 06:12:19 +0000 (06:12 +0000)
citadel/ChangeLog
citadel/citserver.c
citadel/server.h
citadel/techdoc/session.txt

index f6c8789bc806f0ede0793104ec26e3bbc7390758..34e0e812946a2f82929ea2a7222b8580d4975b31 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 573.64  2001/01/13 06:12:15  ajc
+ * Added the ASYN command
+
  Revision 573.63  2001/01/12 22:05:46  ajc
  * Fixed a bug that caused bogus wholist lines to be displayed when a non-aide
    reads a list containing stealth mode sessions.
@@ -2266,3 +2269,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index f635a19985ca2b12bdf7e3292c5db74ad97316b4..5b671d0fba90ad7d8dcf35faf7902677a6404ae9 100644 (file)
@@ -730,7 +730,22 @@ void cmd_scdn(char *argbuf)
                ScheduledShutdown = new_state;
                }
        cprintf("%d %d\n", OK, ScheduledShutdown);
+}
+
+
+/*
+ * Set or unset asynchronous protocol mode
+ */
+void cmd_asyn(char *argbuf)
+{
+       int new_state;
+
+       new_state = extract_int(argbuf, 0);
+       if ((new_state == 0) || (new_state == 1)) {
+               CC->is_async = new_state;
        }
+       cprintf("%d %d\n", OK, CC->is_async);
+}
 
 
 /*
@@ -869,6 +884,10 @@ void do_command_loop(void) {
                CC->kill_me = 1;
                }
 
+       else if (!strncasecmp(cmdbuf,"ASYN",4)) {
+               cmd_asyn(&cmdbuf[5]);
+               }
+
        else if (!strncasecmp(cmdbuf,"LOUT",4)) {
                if (CC->logged_in) logout(CC);
                cprintf("%d logged out.\n",OK);
index bfb95ccba49bfb391d78ba3f48efa87786df422e..c66e8fca7ce343f45d8b55cc8a4b9bb6709ace3e 100644 (file)
@@ -74,6 +74,7 @@ struct CitContext {
        char lastcmdname[5];    /* name of last command executed */
        unsigned cs_flags;      /* miscellaneous flags */
        void (*h_command_function) (void) ;     /* service command function */
+       int is_async;           /* Nonzero if client accepts async msgs */
 
        /* feeping creaturisms... */
        int cs_clientdev;       /* client developer ID */
@@ -83,7 +84,7 @@ struct CitContext {
        char cs_host[26];       /* host logged in from */
 
        /* Beginning of cryptography - session nonce */
-       char cs_nonce[NONCE_SIZE];              /* The nonce for this session's next auth transaction */
+       char cs_nonce[NONCE_SIZE];      /* The nonce for this session's next auth transaction */
 
        FILE *download_fp;      /* Fields relating to file transfer */
        FILE *upload_fp;
@@ -103,11 +104,10 @@ struct CitContext {
        int disable_exp;        /* Set to 1 to disable incoming pages */
 
        /* Masquerade... */
-       char fake_username[USERNAME_SIZE];      /* Fake username <bc>                */
-       char fake_postname[USERNAME_SIZE];      /* Fake postname <bc>                */
-       char fake_hostname[25]; /* Name of the fake hostname <bc>    */
-       char fake_roomname[ROOMNAMELEN];        /* Name of the fake room <bc> */
-       
+       char fake_username[USERNAME_SIZE];      /* Fake username <bc> */ 
+       char fake_postname[USERNAME_SIZE];      /* Fake postname <bc> */
+       char fake_hostname[25];                 /* Fake hostname <bc> */
+       char fake_roomname[ROOMNAMELEN];        /* Fake roomname <bc> */
 
        /* Dynamically allocated session data */
        struct CtdlSessData *FirstSessData;
@@ -269,7 +269,6 @@ extern struct SessionFunctionHook *SessionHookTable;
 #define EVT_CMD                6       /* Called after each server command */
 #define EVT_RWHO       7       /* An RWHO command is being executed */
 
-
 #define EVT_TIMER      50      /* Timer events are called once per minute
                                   and are not tied to any session */
 
@@ -288,7 +287,6 @@ extern struct UserFunctionHook *UserHookTable;
 #define EVT_PURGEUSER  100     /* Deleting a user */
 #define EVT_OUTPUTMSG  101     /* Outputting a message */
 
-
 /*
  * MessageFunctionHook extensions are used for hooks which implement handlers
  * for various types of message operations (save, read, etc.)
index 65405f416bc854b05938641f88469228b7312bfb..8a5d1eb6aa5dc33fa94f64bec3f2531a6e13934c 100644 (file)
@@ -92,7 +92,15 @@ it wants to or not.  The end of the listing is signified by the string
 should begin sending a listing of some sort.  The client *must* send something,
 even if it is an empty listing.  Again, the listing ends with "000" on a line
 by itself.
-  
+ BINARY_FOLLOWS and SEND_BINARY mean that the client must immediately send
+or receive a block of binary data.  The first parameter will always be the
+number of bytes.
+ ASYNC_MESSAGE_FOLLOWS means that an asynchronous, or unsolicited, message
+follows.  The next line will be one of the above codes, and if a data transfer
+is involved it must be handled immediately.  Note that the client will not
+receive this type of response unless it indicates to the server that it is
+capable of handling them; see the writeup of the ASYN command later in this
+document.
   
  PARAMETERIZATION
  ----------------
@@ -1811,4 +1819,21 @@ issue a REQT command, then wait a little while (from 30 seconds up to a few
 minutes) for well-behaved clients to voluntarily terminate, and then issue a
 TERM command to forcibly disconnect the client (or perhaps a DOWN command, if
 you are logging off users for the purpose of shutting down the server).
-
+    
+  
+ ASYN   (ASYNchronous message support)
+ Negotiate the use of asynchronous, or unsolicited, protocol messages.  The
+only parameter specified should be 1 or 0 to indicate that the client can or
+cannot handle this type of messages.  The server will reply OK followed by a
+1 or 0 to tell the client which mode it is now operating in.
+ If the command is not available on the server (i.e. it returns ERROR), or
+if the command has not been executed by the client, it should be assumed that
+this mode of operation is NOT in effect.
+ The client may also send any value other than 0 or 1 to simply cause the
+server to output its current state without changing it.
+ When asynchronous protocol mode is in effect, the client MUST handle any
+asynchronous messages as they arrive, before doing anything else.