From 3ce5573ea72f1b8b29736fa9be594fe71c904bdb Mon Sep 17 00:00:00 2001
From: cvs
diff --git a/event.h b/event.h index 72d02790..2221a13f 100644 --- a/event.h +++ b/event.h @@ -1,5 +1,5 @@ -#line 77 "event.w" +#line 79 "event.w" /*---------------------------------------------------------------------------- E V E N T @@ -18,7 +18,7 @@ int Text2Event(char *pText); -#line 90 "event.w" +#line 92 "event.w" @@ -39,18 +39,18 @@ #define FILELOADED 12 #define MOTEND 13 -#line 92 "event.w" +#line 94 "event.w" /*--------------- Signals for the Signalfunction of each task ------------*/ -#line 62 "event.w" +#line 64 "event.w" #define SICSINT 300 #define SICSBROADCAST 301 #define TOKENGRAB 302 #define TOKENRELEASE 303 -#line 95 "event.w" +#line 97 "event.w" #endif diff --git a/event.tex b/event.tex index 97651ecb..6cfab932 100644 --- a/event.tex +++ b/event.tex @@ -48,6 +48,7 @@ $\langle$VE {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@#define COUNTSTART 10@\\ \mbox{}\verb@#define COUNTEND 11@\\ \mbox{}\verb@#define FILELOADED 12@\\ +\mbox{}\verb@#define MOTEND 13@\\ \mbox{}\verb@@$\diamond$ \end{list} \vspace{-1ex} @@ -76,6 +77,7 @@ fiffractometer has been measured. \item[COUNTSTART] is an event which signals the start of a counting operation. \item[COUNTEND] is an event signalling the end of a counting operation. +\item[MOTEND] signals the end of a driving operation. \end{description} Furthermore event contains system wide signal codes which are interpreted in diff --git a/event.w b/event.w index d25582b5..3c96e085 100644 --- a/event.w +++ b/event.w @@ -31,6 +31,7 @@ if the event code is not known, else the apropriate event code. #define COUNTSTART 10 #define COUNTEND 11 #define FILELOADED 12 +#define MOTEND 13 @} \begin{description} \item[VALUECHANGE] This is a variable changing its value. As event data a pointer to the @@ -51,6 +52,7 @@ fiffractometer has been measured. \item[COUNTSTART] is an event which signals the start of a counting operation. \item[COUNTEND] is an event signalling the end of a counting operation. +\item[MOTEND] signals the end of a driving operation. \end{description} Furthermore event contains system wide signal codes which are interpreted in diff --git a/hmcontrol.w b/hmcontrol.w index 75c625a3..634e7f18 100644 --- a/hmcontrol.w +++ b/hmcontrol.w @@ -15,6 +15,7 @@ The modules data structure: int nSlaves; float fPreset; CounterMode eMode; + pICallBack pCall; } HMcontrol, *pHMcontrol; @} The fields are: @@ -27,6 +28,7 @@ is always the neutron counter. \item[nSlaves] The number of active slaves. \item[fPreset] The counting preset. \item[eMode] The counting mode. +\item[pCall] The callback interface. \end{description} diff --git a/nconman.tex b/nconman.tex index 032652ac..94d3653c 100644 --- a/nconman.tex +++ b/nconman.tex @@ -44,7 +44,7 @@ Clients can choose to suppress certain types of messages in order to reduce I/O. The logic is mostly implemented in the -file static function SCNormalWrite. The follwoing conditions are +file static function SCNormalWrite. The following conditions are implemented: \begin{itemize} \item Any output is logged to the @@ -60,17 +60,17 @@ type error or warning are printed to the socket even during macro evaluation. \item In the normal case the output is printed to the socket and all log files configured for the connection. -\item As of recent the output function can be modified by setting a -new function. One sich function exists which supresses all output to -the socket. This is done in order to help when the connection gets -lost. For instance with the cron command. \end{itemize} -This aspect of the connection object could do with a cleanup. A -possible cleanup path is the implementation of the different output - strategies in different functions and devise a SCsetOutMode function which -switches between the various possibilities. Also, it can be argued if -the client specific log files are still needed. Then this part of the -code can be cleaned out as well. +The above described the default. It turned out that many special cases +exist where it is feasible to suppress parts of the output. In order +to take care of this, SCWrite calls a configurable write +function. This write function can be retrieved and set with +SCGetWriteFunc and SCSetWriteFunc. SCnoSock, SConlySock, SCnotWrite +select some predefined write functions for special cases. Please note +that each of these calls switches the write function for the lifetime +of the connection or until it is set to a new one through +SCSetWriteFunc. + \subsubsection{Command Execution Path} @@ -120,6 +120,9 @@ $\langle$condat {\footnotesize ?}$\rangle\equiv$ \vspace{-1ex} \begin{list}{}{} \item \mbox{}\verb@@\\ +\mbox{}\verb@typedef int (*writeFunc)(struct __SConnection *pCon,@\\ +\mbox{}\verb@ char *pMessage, int iCode);@\\ +\mbox{}\verb@@\\ \mbox{}\verb@ typedef struct __SConnection {@\\ \mbox{}\verb@ /* object basics */@\\ \mbox{}\verb@ pObjectDescriptor pDes;@\\ @@ -133,8 +136,7 @@ $\langle$condat {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ int iTelnet;@\\ \mbox{}\verb@ int iOutput; @\\ \mbox{}\verb@ int iFiles;@\\ -\mbox{}\verb@ int (*write)(struct __SConnection *pCon,@\\ -\mbox{}\verb@ char *pMessage, int iCode);@\\ +\mbox{}\verb@ writeFunc write;@\\ \mbox{}\verb@ mkChannel *pDataSock;@\\ \mbox{}\verb@ char *pDataComp;@\\ \mbox{}\verb@ int iDataPort;@\\ @@ -146,6 +148,7 @@ $\langle$condat {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ int iDummy;@\\ \mbox{}\verb@ int iGrab;@\\ \mbox{}\verb@ int iErrCode;@\\ +\mbox{}\verb@ int parameterChange;@\\ \mbox{}\verb@ SicsInterp *pSics;@\\ \mbox{}\verb@ @\\ \mbox{}\verb@ /* a FIFO */@\\ @@ -153,9 +156,15 @@ $\langle$condat {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@@\\ \mbox{}\verb@ /* callback registry */@\\ \mbox{}\verb@ int iList;@\\ -\mbox{}\verb@ @\\ +\mbox{}\verb@@\\ \mbox{}\verb@ /* Tasking Stuff */@\\ \mbox{}\verb@ int iEnd;@\\ +\mbox{}\verb@ /* for keeping track of the login@\\ +\mbox{}\verb@ process on a non telnet connection.@\\ +\mbox{}\verb@ Should only be used in SCTaskFunction@\\ +\mbox{}\verb@ */@\\ +\mbox{}\verb@ int iLogin;@\\ +\mbox{}\verb@ time_t conStart;@\\ \mbox{}\verb@ }SConnection;@\\ \mbox{}\verb@@$\diamond$ \end{list} @@ -214,6 +223,10 @@ registered on this connection object. \item[iEnd] iEnd is a flag which is usually 0. It is set by certain interrupts or if the connection is broken and causes the connection task to end and the connection data structure to be removed from the system. +\item[iLogin] A flag which is set when we are not yet logged in. +\item[conStart] The time the connection was established. Used to +timeout connections when no valid login comes within a decent time +intervall. \end{description} Quite a few places in SICS refer to this data structure directly, without a function interface. The reason for this is performance. Therefore @@ -247,6 +260,11 @@ $\langle$conint {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ int SCSendOK(SConnection *self);@\\ \mbox{}\verb@ int SCnoSock(SConnection *pCon);@\\ \mbox{}\verb@ int SCWriteUUencoded(SConnection *pCon, char *pName, void *iData, int iLen);@\\ +\mbox{}\verb@ int SCWriteZipped(SConnection *pCon, char *pName, void *pData, int iDataLen);@\\ +\mbox{}\verb@ writeFunc SCGetWriteFunc(SConnection *pCon);@\\ +\mbox{}\verb@ void SCSetWriteFunc(SConnection *pCon, writeFunc x);@\\ +\mbox{}\verb@ int SCOnlySockWrite(SConnection *self, char *buffer, int iOut);@\\ +\mbox{}\verb@ int SCNotWrite(SConnection *self, char *buffer, int iOut);@\\ \mbox{}\verb@/************************* CallBack *********************************** */@\\ \mbox{}\verb@ int SCRegister(SConnection *pCon, SicsInterp *pSics,@\\ \mbox{}\verb@ void *pInter, long lID);@\\ @@ -254,19 +272,20 @@ $\langle$conint {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@/******************************* Error **************************************/@\\ \mbox{}\verb@ void SCSetInterrupt(SConnection *self, int eCode);@\\ \mbox{}\verb@ int SCGetInterrupt(SConnection *self); @\\ -\mbox{}\verb@ void SCSetError(SConnection *pCon, int iCode);@\\ -\mbox{}\verb@ int SCGetError(SConnection *pCon); @\\ \mbox{}\verb@/****************************** Macro ***************************************/@\\ \mbox{}\verb@ int SCinMacro(SConnection *pCon);@\\ \mbox{}\verb@ int SCsetMacro(SConnection *pCon, int iMode); @\\ -\mbox{}\verb@@\\ +\mbox{}\verb@/************************** parameters changed ? **************************/@\\ +\mbox{}\verb@ void SCparChange(SConnection *pCon);@\\ \mbox{}\verb@/* *************************** Info *************************************** */@\\ \mbox{}\verb@ int SCGetRights(SConnection *self);@\\ \mbox{}\verb@ int SCSetRights(SConnection *pCon, int iNew);@\\ \mbox{}\verb@ int SCMatchRights(SConnection *pCon, int iCode);@\\ \mbox{}\verb@ int SCGetOutClass(SConnection *self);@\\ \mbox{}\verb@ int SCGetGrab(SConnection *pCon);@\\ -\mbox{}\verb@@\\ +\mbox{}\verb@/********************* simulation mode ************************************/@\\ +\mbox{}\verb@ void SCSetSimMode(SConnection *pCon, int value);@\\ +\mbox{}\verb@ int SCinSimMode(SConnection *pCon);@\\ \mbox{}\verb@/* **************************** Invocation ******************************** */@\\ \mbox{}\verb@ int SCInvoke(SConnection *self,SicsInterp *pInter,char *pCommand);@\\ \mbox{}\verb@ @\\ @@ -318,6 +337,20 @@ timeout period. pPrompt is the prompt for the client, pResult is the buffer with the client reply. Maximum iLen bytes will be copied to pResult. Returns true (1) on a successfull read, else 0 (false). \item[SCSendOK] A short cut which sends OK to the client. +\item[SCnoSock] Suppress output onto the client socket but keeps on +logging output to file. This is mostly used when the socket connection +closes with a batch file still being active. +\item[SCWriteUUencoded] sends iData in UU encoded form. For +communication with status clients. +\item[SCWriteZipped] writes pData in zipped form. Works only if the +connection is a plain connection, no telnet mode. This first sends a +line: SICSBIN ZIP dataname datalength followed by datalength bytes of +zipped data after the newline. Used for transferring larger amounts of +data to status clients. +\item[SCGetWriteFunc] gets the currently active write function. +\item[SCSetWriteFunc] sets a new write function. +\item[SCOnlySockWrite] write only to socket, not to log files. +\item[SCNotWrite] do not write at all. \item[SCRegister] registers a callback with the connection. Parameters are: The interpreter to use, the interface with which the callback was registered and the ID of the callback. All automatic notifications to a @@ -329,11 +362,11 @@ happen. \item[SCSetInterrupt] sets an interrupt on the connection. \item[SCGetInterrupt] retrives the current interrupt status of the connection. -\item[SCSetError] sets an error code in the connection. -\item[SCGetError] retreives the current error code on the connection. \item[SCinMacro] returns true if the connection is executing a tcl script, returns false otherwise. \item[SCsetMacro] sets the iMacro flag. +\item[SCparChange] sets the flag that a parameter was changed and the +status file needs to be rewritten. \item[SCGetRights] returns the current user rights associated with the connection. \item[SCGetGrab] gets the status of the control token for this connection. @@ -344,6 +377,8 @@ connection has the control token. rights of the connection, 0 (false) otherwise. SCMatchRights also checks for the status of the control token. Suitable error messages are written to pCon if the user rights do not match. +\item[SCSetSimMode] sets this connection into simulation mode. +\item[SCinSimMode] checks for the simulation mode flag. \item[SCInvoke] invokes pCommand in the SICS interpreter pSics for the connection pCon. This function also prints the executed command into logfiles and into the commandlog. @@ -366,6 +401,8 @@ logfiles and into the commandlog. \mbox{}\verb@@\\ \mbox{}\verb@ Mark Koennecke, September 1997@\\ \mbox{}\verb@@\\ +\mbox{}\verb@ Mark Koennecke, Aprl 2003@\\ +\mbox{}\verb@@\\ \mbox{}\verb@ copyright: see copyright.h@\\ \mbox{}\verb@----------------------------------------------------------------------------*/@\\ \mbox{}\verb@#ifndef SICSCONNECT@\\ diff --git a/nconman.w b/nconman.w index dd2281db..3a5ca50b 100644 --- a/nconman.w +++ b/nconman.w @@ -44,7 +44,7 @@ Clients can choose to suppress certain types of messages in order to reduce I/O. The logic is mostly implemented in the -file static function SCNormalWrite. The follwoing conditions are +file static function SCNormalWrite. The following conditions are implemented: \begin{itemize} \item Any output is logged to the @@ -60,17 +60,17 @@ type error or warning are printed to the socket even during macro evaluation. \item In the normal case the output is printed to the socket and all log files configured for the connection. -\item As of recent the output function can be modified by setting a -new function. One sich function exists which supresses all output to -the socket. This is done in order to help when the connection gets -lost. For instance with the cron command. \end{itemize} -This aspect of the connection object could do with a cleanup. A -possible cleanup path is the implementation of the different output - strategies in different functions and devise a SCsetOutMode function which -switches between the various possibilities. Also, it can be argued if -the client specific log files are still needed. Then this part of the -code can be cleaned out as well. +The above described the default. It turned out that many special cases +exist where it is feasible to suppress parts of the output. In order +to take care of this, SCWrite calls a configurable write +function. This write function can be retrieved and set with +SCGetWriteFunc and SCSetWriteFunc. SCnoSock, SConlySock, SCnotWrite +select some predefined write functions for special cases. Please note +that each of these calls switches the write function for the lifetime +of the connection or until it is set to a new one through +SCSetWriteFunc. + \subsubsection{Command Execution Path} @@ -115,6 +115,9 @@ Given the plethora of things to take care of, each connection is represented by a rather large data structure. @d condat @{ +typedef int (*writeFunc)(struct __SConnection *pCon, + char *pMessage, int iCode); + typedef struct __SConnection { /* object basics */ pObjectDescriptor pDes; @@ -128,8 +131,7 @@ represented by a rather large data structure. int iTelnet; int iOutput; int iFiles; - int (*write)(struct __SConnection *pCon, - char *pMessage, int iCode); + writeFunc write; mkChannel *pDataSock; char *pDataComp; int iDataPort; @@ -141,6 +143,7 @@ represented by a rather large data structure. int iDummy; int iGrab; int iErrCode; + int parameterChange; SicsInterp *pSics; /* a FIFO */ @@ -148,9 +151,15 @@ represented by a rather large data structure. /* callback registry */ int iList; - + /* Tasking Stuff */ int iEnd; + /* for keeping track of the login + process on a non telnet connection. + Should only be used in SCTaskFunction + */ + int iLogin; + time_t conStart; }SConnection; @} @@ -202,6 +211,10 @@ registered on this connection object. \item[iEnd] iEnd is a flag which is usually 0. It is set by certain interrupts or if the connection is broken and causes the connection task to end and the connection data structure to be removed from the system. +\item[iLogin] A flag which is set when we are not yet logged in. +\item[conStart] The time the connection was established. Used to +timeout connections when no valid login comes within a decent time +intervall. \end{description} Quite a few places in SICS refer to this data structure directly, without a function interface. The reason for this is performance. Therefore @@ -230,6 +243,11 @@ The interface to this data structure is defined by the following functions: int SCSendOK(SConnection *self); int SCnoSock(SConnection *pCon); int SCWriteUUencoded(SConnection *pCon, char *pName, void *iData, int iLen); + int SCWriteZipped(SConnection *pCon, char *pName, void *pData, int iDataLen); + writeFunc SCGetWriteFunc(SConnection *pCon); + void SCSetWriteFunc(SConnection *pCon, writeFunc x); + int SCOnlySockWrite(SConnection *self, char *buffer, int iOut); + int SCNotWrite(SConnection *self, char *buffer, int iOut); /************************* CallBack *********************************** */ int SCRegister(SConnection *pCon, SicsInterp *pSics, void *pInter, long lID); @@ -237,19 +255,20 @@ The interface to this data structure is defined by the following functions: /******************************* Error **************************************/ void SCSetInterrupt(SConnection *self, int eCode); int SCGetInterrupt(SConnection *self); - void SCSetError(SConnection *pCon, int iCode); - int SCGetError(SConnection *pCon); /****************************** Macro ***************************************/ int SCinMacro(SConnection *pCon); int SCsetMacro(SConnection *pCon, int iMode); - +/************************** parameters changed ? **************************/ + void SCparChange(SConnection *pCon); /* *************************** Info *************************************** */ int SCGetRights(SConnection *self); int SCSetRights(SConnection *pCon, int iNew); int SCMatchRights(SConnection *pCon, int iCode); int SCGetOutClass(SConnection *self); int SCGetGrab(SConnection *pCon); - +/********************* simulation mode ************************************/ + void SCSetSimMode(SConnection *pCon, int value); + int SCinSimMode(SConnection *pCon); /* **************************** Invocation ******************************** */ int SCInvoke(SConnection *self,SicsInterp *pInter,char *pCommand); @@ -293,6 +312,20 @@ timeout period. pPrompt is the prompt for the client, pResult is the buffer with the client reply. Maximum iLen bytes will be copied to pResult. Returns true (1) on a successfull read, else 0 (false). \item[SCSendOK] A short cut which sends OK to the client. +\item[SCnoSock] Suppress output onto the client socket but keeps on +logging output to file. This is mostly used when the socket connection +closes with a batch file still being active. +\item[SCWriteUUencoded] sends iData in UU encoded form. For +communication with status clients. +\item[SCWriteZipped] writes pData in zipped form. Works only if the +connection is a plain connection, no telnet mode. This first sends a +line: SICSBIN ZIP dataname datalength followed by datalength bytes of +zipped data after the newline. Used for transferring larger amounts of +data to status clients. +\item[SCGetWriteFunc] gets the currently active write function. +\item[SCSetWriteFunc] sets a new write function. +\item[SCOnlySockWrite] write only to socket, not to log files. +\item[SCNotWrite] do not write at all. \item[SCRegister] registers a callback with the connection. Parameters are: The interpreter to use, the interface with which the callback was registered and the ID of the callback. All automatic notifications to a @@ -304,11 +337,11 @@ happen. \item[SCSetInterrupt] sets an interrupt on the connection. \item[SCGetInterrupt] retrives the current interrupt status of the connection. -\item[SCSetError] sets an error code in the connection. -\item[SCGetError] retreives the current error code on the connection. \item[SCinMacro] returns true if the connection is executing a tcl script, returns false otherwise. \item[SCsetMacro] sets the iMacro flag. +\item[SCparChange] sets the flag that a parameter was changed and the +status file needs to be rewritten. \item[SCGetRights] returns the current user rights associated with the connection. \item[SCGetGrab] gets the status of the control token for this connection. @@ -319,6 +352,8 @@ connection has the control token. rights of the connection, 0 (false) otherwise. SCMatchRights also checks for the status of the control token. Suitable error messages are written to pCon if the user rights do not match. +\item[SCSetSimMode] sets this connection into simulation mode. +\item[SCinSimMode] checks for the simulation mode flag. \item[SCInvoke] invokes pCommand in the SICS interpreter pSics for the connection pCon. This function also prints the executed command into logfiles and into the commandlog. @@ -336,6 +371,8 @@ logfiles and into the commandlog. Mark Koennecke, September 1997 + Mark Koennecke, Aprl 2003 + copyright: see copyright.h ----------------------------------------------------------------------------*/ #ifndef SICSCONNECT diff --git a/nserver.tex b/nserver.tex index 20fe70a3..ce49d23d 100644 --- a/nserver.tex +++ b/nserver.tex @@ -19,6 +19,7 @@ $\langle$servdat {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ mkChannel *pServerPort;@\\ \mbox{}\verb@ pNetRead pReader;@\\ \mbox{}\verb@ int simMode;@\\ +\mbox{}\verb@ SConnection *dummyCon;@\\ \mbox{}\verb@ } SicsServer;@\\ \mbox{}\verb@@$\diamond$ \end{list} @@ -43,6 +44,8 @@ the SICS server is listening for connections. communication object. \item[simMode] a flag which is true when the SICS server is a simulation server. +\item[dummyCon] A dummy connection to use when no other connection is +available for some reason. \end{description} diff --git a/nserver.w b/nserver.w index 84bcbef2..9b6ec6c1 100644 --- a/nserver.w +++ b/nserver.w @@ -14,6 +14,7 @@ the system: mkChannel *pServerPort; pNetRead pReader; int simMode; + SConnection *dummyCon; } SicsServer; @} @@ -31,6 +32,8 @@ the SICS server is listening for connections. communication object. \item[simMode] a flag which is true when the SICS server is a simulation server. +\item[dummyCon] A dummy connection to use when no other connection is +available for some reason. \end{description} diff --git a/serialwait.tex b/serialwait.tex index b556ed13..7234e24d 100644 --- a/serialwait.tex +++ b/serialwait.tex @@ -46,7 +46,7 @@ Just one function is exported: \mbox{}\verb@#ifndef SERIALSICSWAIT@\\ \mbox{}\verb@#define SERIALSICSWAIT@\\ \mbox{}\verb@#include "sics.h"@\\ -\mbox{}\verb@#include "hardsup/serialsinq.h"@\\ +\mbox{}\verb@#include "psi/hardsup/serialsinq.h"@\\ \mbox{}\verb@ int SerialSicsExecute(void **pData, char *pCommand, char *pReply, @\\ \mbox{}\verb@ int iBufLen);@\\ \mbox{}\verb@@\\ diff --git a/serialwait.w b/serialwait.w index cb0d45bb..0b590c1b 100644 --- a/serialwait.w +++ b/serialwait.w @@ -41,7 +41,7 @@ Just one function is exported: #ifndef SERIALSICSWAIT #define SERIALSICSWAIT #include "sics.h" -#include "hardsup/serialsinq.h" +#include "psi/hardsup/serialsinq.h" int SerialSicsExecute(void **pData, char *pCommand, char *pReply, int iBufLen);