server/init.cxx

Go to the documentation of this file.
00001 /**********************************************************************
00002  * Copyright 2002 Jeff Rush <jrush@taupro.com>
00003  * Original Copyright 1979-2002 Udanax.com
00004  *
00005  * This file is part of the Udanax xanalogical storage system.
00006  *
00007  * Udanax is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * Udanax is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with Udanax; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  **********************************************************************/
00021 
00030 /* Modification History:
00031  * $Log: init.cxx,v $
00032  * Revision 1.8  2004/09/04 16:02:18  jrush
00033  * Added Doxygen headers before each and every function definition.
00034  *
00035  * Revision 1.7  2002/05/28 03:58:42  jrush
00036  * Sources modified to comply with GPL licensing.
00037  *
00038  * Revision 1.6  2002/04/12 11:48:50  jrush
00039  * Major reorganization of includes into a single base-include style.
00040  *
00041  * Revision 1.5  2002/04/09 21:45:47  jrush
00042  * Renamed class 'tumbler' to 'Tumbler', for consistency with Python sources,
00043  * and changed typeisa from typedef to a subclass, in preparation for cleaning
00044  * up the type/class tree.
00045  *
00046  * Revision 1.4  2002/04/07 13:10:55  jrush
00047  * Relocated init.cxx from libsrc to server directory
00048  *
00049  * Revision 1.4  2002/04/06 17:05:57  jrush
00050  * Switched from referring to 'task' for a client connection to 'session',
00051  * and converted the typetask typedef/struct into a Session C++ class.
00052  *
00053  * Revision 1.3  2002/04/06 15:01:17  jrush
00054  * Changed INT to just 'int'.
00055  *
00056  * Revision 1.2  2002/02/14 09:27:43  jrush
00057  * Cleaned up source:
00058  *
00059  * 1. ran thru the indent tool to achieve a standard look,
00060  * 2. added structured comments at top for use with DOxygen reporting
00061  *    as well as CVS keywords,
00062  * 3. fixed compiler warnings re ambiguous assign/compares,
00063  *    needed casts and unused/uninitialized variables,
00064  * 4. fixed funcs that didn't specify a return type,
00065  * 5. centralized prototypes in protos.h, removing incomplete ones,
00066  * 6. cleaned up use of bool/BOOLEAN type to suit C++ type,
00067  * 7. fixed initializer nesting in tumbler constants,
00068  * 8. renamed vars that conflict with C++ keywords (new, this),
00069  * 9. fixed global/extern confusion re some global vars.
00070  *
00071  */
00072 
00073 #include <time.h>
00074 #include "udanax.h"
00075 #include "requests.h"
00076 
00077 extern FILE *febelog;
00078 extern bool isxumain;
00079 void (*requestfns[NREQUESTS]) (Session *sess);
00080 
00081 long nsessorcommand;
00082 
00083 void  putrequestfailed(Session * sess);
00084 
00085 extern void finddocscontaining(Session *sess);
00086 extern void copy(Session *sess);
00087 extern void insert(Session *sess);
00088 extern void createlink(Session *sess);
00089 extern void followlink(Session *sess);
00090 extern void retrievedocvspanset(Session *sess);
00091 extern void rearrange(Session *sess);
00092 extern void retrievev(Session *sess);
00093 extern void findlinksfromtothree(Session *sess);
00094 extern void findnumoflinksfromtothree(Session *sess);
00095 extern void findnextnlinksfromtothree(Session *sess);
00096 extern void navigateonht(Session *sess);
00097 extern void showrelationof2versions(Session *sess);
00098 extern void createnewdocument(Session *sess);
00099 extern void createnewversion(Session *sess);
00100 extern void retrievedocvspan(Session *sess);
00101 extern void deletevspan(Session *sess);
00102 extern void retrieveendsets(Session *sess);
00103 extern void xaccount(Session *sess);
00104 extern void createnode_or_account(Session *sess);
00105 extern void myopen(Session *sess);
00106 extern void myclose(Session *sess);
00107 extern void quitxanadu(Session *sess);
00108 extern void examine(Session *sess);
00109 extern void showorgl(Session *sess);
00110 extern void showenfilades(Session *sess);
00111 extern void sourceunixcommand(Session *sess);
00112 
00120     void
00121 nullfun(
00122     Session *sess)
00123 {
00124     putrequestfailed(sess);
00125 }
00126 
00134     void
00135 init(
00136     bool safe)
00137 {
00138 /* Debugging stuff */
00139 
00140 //UNUSED    long        start_time = time((long *) 0);
00141 //UNUSED    struct tm  *tm         = gmtime(&start_time);
00142 
00143     int i;
00144     for (i = 0; i < NREQUESTS; ++i)
00145         requestfns[i] = nullfun;
00146 
00147     requestfns[COPY] = copy;
00148     requestfns[INSERT] = insert;
00149     requestfns[RETRIEVEDOCVSPANSET] = retrievedocvspanset;
00150     requestfns[REARRANGE] = rearrange;
00151     requestfns[RETRIEVEV] = retrievev;
00152     requestfns[NAVIGATEONHT] = navigateonht;
00153     requestfns[SHOWRELATIONOF2VERSIONS] = showrelationof2versions;
00154     requestfns[CREATENEWDOCUMENT] = createnewdocument;
00155     requestfns[DELETEVSPAN] = deletevspan;
00156     requestfns[CREATENEWVERSION] = createnewversion;
00157     requestfns[RETRIEVEDOCVSPAN] = retrievedocvspan;
00158     requestfns[QUIT] = quitxanadu;
00159     requestfns[SOURCEUNIXCOMMAND] = sourceunixcommand;
00160     requestfns[FOLLOWLINK] = followlink;
00161     requestfns[FINDDOCSCONTAINING] = finddocscontaining;
00162     requestfns[CREATELINK] = createlink;
00163     requestfns[RETRIEVEENDSETS] = retrieveendsets;
00164     requestfns[FINDNUMOFLINKSFROMTOTHREE] = findnumoflinksfromtothree;
00165     requestfns[FINDLINKSFROMTOTHREE] = findlinksfromtothree;
00166     requestfns[FINDNEXTNLINKSFROMTOTHREE] = findnextnlinksfromtothree;
00167     requestfns[CREATENODE_OR_ACCOUNT] = createnode_or_account;
00168     requestfns[OPEN] = myopen;
00169     requestfns[CLOSE] = myclose;
00170     requestfns[XACCOUNT] = xaccount;
00171 
00172     if (safe) {
00173         requestfns[SOURCEUNIXCOMMAND] = nullfun;
00174         requestfns[NAVIGATEONHT] = nullfun;
00175         requestfns[FINDNUMOFLINKSFROMTOTHREE] = nullfun;
00176         requestfns[FINDNEXTNLINKSFROMTOTHREE] = nullfun;
00177     }
00178 
00179     nsessorcommand = 0;
00180 }

Generated on Sun Aug 21 04:18:15 2005 for Udanax-Green by doxygen1.3.4