- Updates to the documentation

SKIPPED:
	psi/velodorn.h
This commit is contained in:
cvs
2003-12-11 10:52:00 +00:00
parent 350a5ad063
commit 3ce5573ea7
18 changed files with 281 additions and 110 deletions

View File

@ -10,6 +10,8 @@
Mark Koennecke, September 1997
Mark Koennecke, Aprl 2003
copyright: see copyright.h
----------------------------------------------------------------------------*/
#ifndef SICSCONNECT
@ -23,7 +25,7 @@
#define MAXLOGFILES 10
typedef int (*writeFunc)(struct __SConnection *pCon,
char *pMessage, int iCode);
char *pMessage, int iCode);
typedef struct __SConnection {
/* object basics */
@ -47,24 +49,24 @@ typedef int (*writeFunc)(struct __SConnection *pCon,
int eInterrupt;
int iUserRights;
int inUse;
int iDummy;
int iGrab;
SicsInterp *pSics;
/* flag for parameter change */
int iErrCode;
int parameterChange;
SicsInterp *pSics;
/* a FIFO */
pCosta pStack;
/* 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;
@ -99,7 +101,7 @@ typedef int (*writeFunc)(struct __SConnection *pCon,
int SCRegister(SConnection *pCon, SicsInterp *pSics,
void *pInter, long lID);
int SCUnregister(SConnection *pCon, void *pInter);
/******************************* Interrupt *********************************/
/******************************* Error **************************************/
void SCSetInterrupt(SConnection *self, int eCode);
int SCGetInterrupt(SConnection *self);
/****************************** Macro ***************************************/

View File

@ -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

View File

@ -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@\\

View File

@ -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}

View File

@ -76,42 +76,76 @@ recommended.
\end{description}
\subsection{Building SICS}
This document describes how to build the SICS software and where to find it.
There are two sections: Building the SICS applications and building the Java
clients. For both categories tarballs with all necessary files can be
found in the /data/lnslib/src/sics directory. There are two tar files:
sics.tar which contains the sources for the SICS server and additional C or
F77 applications and java.tar which contains the code for the Java clients.
A SICS distribution is best be obtained from the cvs
repository. Access details are available on demand from Mark.Koennecke@psi.ch.
A source distribution can be downloaded with:
\begin{verbatim}
cvs checkout sics
\end{verbatim}
This creates a new directory, sics, and copies a lot of files.
\subsubsection{Building the SICS Server and Applications}
The first step is to untar the sics.tar file. As a result a directory sics
with several subdirectories will be created. These subdirectories are:
\subsubsection{SICS Directory Layout}
Underneath the sics directory there are further sub directories:
\begin{description}
\item[psi]PSI specific commands and code.
\item[hardsup] contains David Madens and other hardware drivers.
\item[motor] contains the unix version of David Madens el734\_test program.
\item[doc/programmer]holds programming documentation for SICS.
\item[doc/user] The html sources for the user documentation. Also everything
necessary for creating the printed documentation.
\item[bin] Holds the final binary files.
\item[tcl] Some Tcl helper code.
\item[doc/manager]The SICS managers documentation.
\item[difrac] The DIFRAC four circle diffraction subsystem. This is
not used anymore.
\item[matrix] A matrix manipulation package.
\end{description}
For most programs makefiles are provided.
Makefiles may need a little editing to correct the location of libraries.
All necessary headers should be available in /data/lnslib/include and the
libraries in /data/lnslib/lib.
Building things within this hierarchy basically require to steps:
\begin{enumerate}
\item cd into the hardsup and difrac directories and type make in
each. This builds required libraries for linking other applications.
\item cd into the directory of the program you wish to compile and type make.
For instance for building the SICServer, move into the main sics directory and
type make.
\end{enumerate}
\item[doc] Contains documentation. Further subdirectories to doc:
\begin{description}
\item[user] User documentation.
\item[manager] Manager documentation
\item[programmer] Reference documentation for SICS programmers.
\end{description}
\item[matrix]A package for matrix manipulations
\item[tcl]Tcl scripts
\item[dummy]An example directory for a new site
\item[psi]PSI specific parts of SICS
\begin{description}
\item[hardsup] Hardware support routines
\item[sinqhm]The vxWorks histogram memory software
\item[tecs]The tecs environment control software
\item[motor]Utilities for the motor controller
\item[utils]various utilities
\begin{description}
\item[check]The Tcl syntax checker for SICS
\end{description}
\end{description}
\end{description}
The sics directory is meant to contain the generic parts of
SICS. Then there are site specific directories (dummy, psi) which hold
code special for particular instruments or hardware. The selection for
which configuration SICS is being compiled is made in the makefile, by
linking against the appropriate site specific libraries.
\subsubsection{SICS Makefiles}
The SICS makefile system is not perfect but is far better then
compiling the whole stuff manually. There are various makefiles:
\begin{description}
\item[linux\_def, alpha\_def] contains the path to the HDF libraries,
the flags necessary to run sub makefiles in sub directories etc. This
is included by all other makefiles.
\item[make\_gen] and children contains most of the makefile content and
is included by the other makefiles.
\item[makefile\_linux, makefile\_alpha] are makefiles for their
respective platforms.
\end{description}
Some editing of makefiles will always be necessary. The path to the
HDF libraries has usually to be adapted in the \_def files. If there
is a different platfrom a new makefile has to be cloned from the
existing ones. In order to support a new site a new make\_gen and a new
makefile are have to be cloned. This system is similar in the
subdirectories to the SICS directory. Once this has been setup typing:
\begin{verbatim}
make -f makefile_alpha clean
\end{verbatim}
will clean all object files etc. and
\begin{verbatim}
make -f makefile_alpha
\end{verbatim}
will build everything. May be you need to replace alpha by linux on
some platforms. Please note, that I have been to lazy to generate
dependencies for all the SICS files. This means that if you make
changes to the major SICS header files (especially the kernel files)
it is better do recompile everything. Otherwise you might find
yourself chasing obscure bugs.
\subsubsection{Building Java Clients}
Again the first step is the untaring of tha java.tar file. This creates a
@ -139,6 +173,10 @@ Again the first step is the untaring of tha java.tar file. This creates a
\item[amor] The AMOR user interface program.
\item[tas] The Triple Axis user interface program.
\item[trics] The TRICS user interface program.
\item[JQF] A state machine framework used for implementing a new I/O
system.
\item[psi] The start of a new hierarchy of SICS applications and
library classes.
\end{description}
Furthermore there are some Java source file in the main directory together
with some htm files and makefiles. For each of the Java clients a makefile

View File

@ -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@@\\

View File

@ -27,7 +27,7 @@ $\langle$logint {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ int VarlogGetVal(pVarLog self, float *fValues);@\\
\mbox{}\verb@ int VarlogGetMean(pVarLog self, float *fMean, float *fStdDev);@\\
\mbox{}\verb@/*------------------------------ interpreter ---------------------------*/@\\
\mbox{}\verb@ int VarlogWrapper(pVarLog self, int *iSwitch, SConnection *pCon, @\\
\mbox{}\verb@ int VarlogWrapper(pVarLog self,SConnection *pCon, @\\
\mbox{}\verb@ char *subcommand, char *sub2,char *pVarName);@\\
\mbox{}\verb@@$\diamond$
\end{list}

View File

@ -79,6 +79,9 @@ for its number type.
<DD> determines the size of a single bin in histogram memory in bytes.
<DT>dim0, dim1, dim2, ... dimn
<DD>define the logical dimensions of the histogram.
<dt>extrachan
<dd>Extra time channels as used at AMOR and SANS for time-of-flight
monitors. They get appended to the main hm data but are treated separately.
</DL>
</p>
<p>

10
event.h
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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}

View File

@ -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@\\

View File

@ -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

View File

@ -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}

View File

@ -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}

View File

@ -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@@\\

View File

@ -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);