From 6673b8ab9f0b9df8140141b034ac3055b5b897f8 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sat, 13 Jan 2001 06:12:19 +0000 Subject: [PATCH] * Added the ASYN command --- citadel/ChangeLog | 4 ++++ citadel/citserver.c | 19 +++++++++++++++++++ citadel/server.h | 14 ++++++-------- citadel/techdoc/session.txt | 29 +++++++++++++++++++++++++++-- 4 files changed, 56 insertions(+), 10 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index f6c8789bc..34e0e8129 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -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 Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/citserver.c b/citadel/citserver.c index f635a1998..5b671d0fb 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -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); diff --git a/citadel/server.h b/citadel/server.h index bfb95ccba..c66e8fca7 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -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 */ - char fake_postname[USERNAME_SIZE]; /* Fake postname */ - char fake_hostname[25]; /* Name of the fake hostname */ - char fake_roomname[ROOMNAMELEN]; /* Name of the fake room */ - + char fake_username[USERNAME_SIZE]; /* Fake username */ + char fake_postname[USERNAME_SIZE]; /* Fake postname */ + char fake_hostname[25]; /* Fake hostname */ + char fake_roomname[ROOMNAMELEN]; /* Fake roomname */ /* 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.) diff --git a/citadel/techdoc/session.txt b/citadel/techdoc/session.txt index 65405f416..8a5d1eb6a 100644 --- a/citadel/techdoc/session.txt +++ b/citadel/techdoc/session.txt @@ -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. -- 2.39.2