PSI sics-cvs-psi-2006
This commit is contained in:
107
conman.h
107
conman.h
@@ -12,6 +12,8 @@
|
||||
|
||||
Mark Koennecke, Aprl 2003
|
||||
|
||||
Mark Koennecke, December 2004
|
||||
|
||||
copyright: see copyright.h
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef SICSCONNECT
|
||||
@@ -21,6 +23,7 @@
|
||||
#include "SCinter.h"
|
||||
#include "network.h"
|
||||
#include "obdes.h"
|
||||
#include "commandcontext.h"
|
||||
|
||||
#define MAXLOGFILES 10
|
||||
|
||||
@@ -30,46 +33,58 @@ typedef int (*writeFunc)(struct __SConnection *pCon,
|
||||
typedef struct __SConnection {
|
||||
/* object basics */
|
||||
pObjectDescriptor pDes;
|
||||
char *pName;
|
||||
long lMagic;
|
||||
|
||||
long ident;
|
||||
struct __SConnection *next;
|
||||
|
||||
/* I/O control */
|
||||
/* our socket */
|
||||
mkChannel *pSock;
|
||||
|
||||
/* per connection log files */
|
||||
FILE *pFiles[MAXLOGFILES];
|
||||
int iMacro;
|
||||
int iTelnet;
|
||||
int iOutput;
|
||||
int iFiles;
|
||||
writeFunc write;
|
||||
mkChannel *pDataSock;
|
||||
char *pDataComp;
|
||||
int iDataPort;
|
||||
|
||||
int iMacro; /* suppress I/O in macro*/
|
||||
int iTelnet; /* telnet flag */
|
||||
int iOutput;
|
||||
writeFunc write; /* function doing
|
||||
writing */
|
||||
int listening; /* for listening to commandlog or other data */
|
||||
|
||||
/* execution context */
|
||||
int eInterrupt;
|
||||
int eInterrupt;
|
||||
int iUserRights;
|
||||
int inUse;
|
||||
int iDummy;
|
||||
int iGrab;
|
||||
int iErrCode;
|
||||
int inUse;
|
||||
int iGrab; /* grab flag for token*/
|
||||
int parameterChange;
|
||||
SicsInterp *pSics;
|
||||
|
||||
int sicsError;
|
||||
|
||||
/*
|
||||
stuff supporting the sycamore protocol and a
|
||||
command context
|
||||
*/
|
||||
long iCmdCtr;
|
||||
int conEventType;
|
||||
int conStatus; /* should use status enum ffr */
|
||||
int iProtocolID;
|
||||
int contextStack;
|
||||
|
||||
/* 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;
|
||||
/* 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;
|
||||
|
||||
#include "nserver.h"
|
||||
|
||||
@@ -87,6 +102,7 @@ typedef int (*writeFunc)(struct __SConnection *pCon,
|
||||
int SCDelLogFile(SConnection *pCon, int iFile);
|
||||
void SCSetOutputClass(SConnection *self, int iClass);
|
||||
int SCWrite(SConnection *self, char *pBuffer, int iOut);
|
||||
int SCPrintf(SConnection *self, int iOut, char *fmt, ...);
|
||||
int SCRead(SConnection *self, char *pBuffer, int iBufLen);
|
||||
int SCPrompt(SConnection *pCon, char *pPrompt, char *pResult, int iLen);
|
||||
int SCSendOK(SConnection *self);
|
||||
@@ -96,11 +112,25 @@ typedef int (*writeFunc)(struct __SConnection *pCon,
|
||||
writeFunc SCGetWriteFunc(SConnection *pCon);
|
||||
void SCSetWriteFunc(SConnection *pCon, writeFunc x);
|
||||
int SCOnlySockWrite(SConnection *self, char *buffer, int iOut);
|
||||
int SCFileWrite(SConnection *self, char *buffer, int iOut);
|
||||
int SCNotWrite(SConnection *self, char *buffer, int iOut);
|
||||
int SCNormalWrite(SConnection *self, char *buffer, int iOut);
|
||||
int SCWriteWithOutcode(SConnection *self, char *buffer, int iOut);
|
||||
/************************* CallBack *********************************** */
|
||||
int SCRegister(SConnection *pCon, SicsInterp *pSics,
|
||||
void *pInter, long lID);
|
||||
int SCUnregister(SConnection *pCon, void *pInter);
|
||||
/**
|
||||
* delete a callback with the given ID
|
||||
*/
|
||||
int SCUnregisterID(SConnection *pCon, long ID);
|
||||
/**
|
||||
* retrieve the ID of a callback on the callback interface
|
||||
* given in pData. This, together with SCUnregisterID allows to
|
||||
* ceanly remove all callbacks on a connection
|
||||
* returns -1 if no ID can be found.
|
||||
*/
|
||||
long SCgetCallbackID(SConnection *pCon, void *pData);
|
||||
/******************************* Error **************************************/
|
||||
void SCSetInterrupt(SConnection *self, int eCode);
|
||||
int SCGetInterrupt(SConnection *self);
|
||||
@@ -115,6 +145,7 @@ typedef int (*writeFunc)(struct __SConnection *pCon,
|
||||
int SCMatchRights(SConnection *pCon, int iCode);
|
||||
int SCGetOutClass(SConnection *self);
|
||||
int SCGetGrab(SConnection *pCon);
|
||||
int SCActive(SConnection *pCon);
|
||||
/********************* simulation mode ************************************/
|
||||
void SCSetSimMode(SConnection *pCon, int value);
|
||||
int SCinSimMode(SConnection *pCon);
|
||||
@@ -126,7 +157,31 @@ typedef int (*writeFunc)(struct __SConnection *pCon,
|
||||
int argc, char *argv[]);
|
||||
int ConSicsAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]);
|
||||
|
||||
/******************************** Store ************************************/
|
||||
typedef struct {
|
||||
SConnection *pCon;
|
||||
long ident;
|
||||
} SCStore;
|
||||
|
||||
void SCSave(SCStore *con, SConnection *pCon);
|
||||
/* save a connection for later use. */
|
||||
|
||||
SConnection *SCLoad(SCStore *con);
|
||||
/* check con and return SConnection if still valid or NULL otherwise. */
|
||||
|
||||
void KillFreeConnections(void);
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
int SCVerifyConnection(SConnection *self);
|
||||
void SCWriteToLogFiles(SConnection *self, char *buffer);
|
||||
int SCDoSockWrite(SConnection *self, char *buffer);
|
||||
int SCWriteInContext(SConnection *pCon, char *buffer, int code, commandContext cc);
|
||||
|
||||
long SCTagContext(SConnection *self, char *tagName);
|
||||
long SCAdvanceContext(SConnection *self, char *tagName);
|
||||
int SCPushContext(SConnection *pCon, int ID, char *deviceID);
|
||||
int SCPushContext2(SConnection *pCon, commandContext cc);
|
||||
int SCPopContext(SConnection *pCon);
|
||||
commandContext SCGetContext(SConnection *pCon);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user