83 lines
3.4 KiB
TeX
83 lines
3.4 KiB
TeX
\subsection{Token Management}
|
|
In SICS any client can issue commands to the SICS server. This
|
|
is a potential cause for trouble with users issuing conflicting
|
|
commands without knowing. In order to deal with this problem a
|
|
token mechanism has been developed. A connection can grab a
|
|
token and then has full control over the SICS server. Any other
|
|
connection will not be priviledged to do anything useful, except
|
|
looking at things. A token can be released manually with a
|
|
special command or is automatically released when the connection
|
|
dies. Another command exists which allows a SICS manager to
|
|
force his way into the SICS server.
|
|
|
|
This token scheme is implemented using the signal system of the
|
|
task management facility and the connection object. The connection
|
|
object has a field called iGrap which is true if the connection is the
|
|
ultimate and only control connection. This field will be modified
|
|
either directly through commands or via the signal system of the SICS
|
|
task manager. This must be so as all connections need to be notified
|
|
if one connection has grabbed control.
|
|
|
|
This object implements the user interface to the token system.
|
|
It checks privileges and issues the necessary signals. No own
|
|
data structure is needed. Just a wrapper function is
|
|
implemented.
|
|
|
|
\begin{flushleft} \small
|
|
\begin{minipage}{\linewidth} \label{scrap1}
|
|
\verb@"token.h"@ {\footnotesize ? }$\equiv$
|
|
\vspace{-1ex}
|
|
\begin{list}{}{} \item
|
|
\mbox{}\verb@@\\
|
|
\mbox{}\verb@/*---------------------------------------------------------------@\\
|
|
\mbox{}\verb@ S I C S T O K E N@\\
|
|
\mbox{}\verb@ @\\
|
|
\mbox{}\verb@ This is the header file for the SICS token management@\\
|
|
\mbox{}\verb@ functions. It implements the token command.@\\
|
|
\mbox{}\verb@ @\\
|
|
\mbox{}\verb@ Mark Koenencke, January 1998@\\
|
|
\mbox{}\verb@ @\\
|
|
\mbox{}\verb@ copyright: see copyright.h@\\
|
|
\mbox{}\verb@ @\\
|
|
\mbox{}\verb@----------------------------------------------------------------*/@\\
|
|
\mbox{}\verb@#ifndef SICSTOKEN@\\
|
|
\mbox{}\verb@#define SICSTOKEN@\\
|
|
\mbox{}\verb@ int TokenInit(SConnection *pCon, SicsInterp *pSics, @\\
|
|
\mbox{}\verb@ void *pData, int argc, char *argv[]);@\\
|
|
\mbox{}\verb@ /*@\\
|
|
\mbox{}\verb@ The Token Factory function.@\\
|
|
\mbox{}\verb@ */ @\\
|
|
\mbox{}\verb@ int TokenWrapper(SConnection *pCon, SicsInterp *pSics, @\\
|
|
\mbox{}\verb@ void *pData, int argc, char *argv[]);@\\
|
|
\mbox{}\verb@ @\\
|
|
\mbox{}\verb@ /* @\\
|
|
\mbox{}\verb@ The wrapper function for the token command.@\\
|
|
\mbox{}\verb@ */ @\\
|
|
\mbox{}\verb@ @\\
|
|
\mbox{}\verb@ int TokenGrabActive(void);@\\
|
|
\mbox{}\verb@ /*@\\
|
|
\mbox{}\verb@ Returns 1, if a token grab is active, else 0@\\
|
|
\mbox{}\verb@ */ @\\
|
|
\mbox{}\verb@ @\\
|
|
\mbox{}\verb@ void TokenRelease(void);@\\
|
|
\mbox{}\verb@ /* @\\
|
|
\mbox{}\verb@ Releases a Token Grab@\\
|
|
\mbox{}\verb@ */ @\\
|
|
\mbox{}\verb@#endif @\\
|
|
\mbox{}\verb@@$\diamond$
|
|
\end{list}
|
|
\vspace{-2ex}
|
|
\end{minipage}\\[4ex]
|
|
\end{flushleft}
|
|
The functions are:
|
|
\begin{description}
|
|
\item[TokenInit] is the installation routine which configures the
|
|
token system into SICS. Called from the initialisation script.
|
|
\item[TokenWrapper] is the interpreter interface function for the
|
|
token system. Implements the active run time commands.
|
|
\item[TokenGrapActive] returns true (1) if a connection has grabbed
|
|
control or false (0) otherwise.
|
|
\item[TokenRelease] releases the current control token.
|
|
\end{description}
|
|
|