- Adapted indenation to new agreed upon system
- Added support for second generation scriptcontext based counter
This commit is contained in:
214
conman.h
214
conman.h
@ -32,157 +32,159 @@
|
||||
|
||||
#define MAXLOGFILES 10
|
||||
|
||||
typedef int (*writeFunc)(struct __SConnection *pCon,
|
||||
char *pMessage, int iCode);
|
||||
typedef int (*writeFunc) (struct __SConnection * pCon,
|
||||
char *pMessage, int iCode);
|
||||
|
||||
typedef struct __SConnection {
|
||||
/* Copy Object Fields*/
|
||||
pObjectDescriptor pDes; /* must be here */
|
||||
long lMagic; /* connection object ID */
|
||||
long ident; /* connection idetification */
|
||||
struct __SConnection *next; /* pointer for freeConnection managenment */
|
||||
int sockHandle; /* socket handle */
|
||||
int iTelnet; /* telnet flag */
|
||||
int iMacro; /* suppress I/O in macro */
|
||||
writeFunc write; /* function doing writing */
|
||||
int sicsError; /* Tcl interpreter requirement */
|
||||
pDynString data; /* for I/O buffering */
|
||||
writeFunc oldWriteFunc; /* saved write function used in I/O buffering */
|
||||
long iCmdCtr; /* sycamore protocol used */
|
||||
int conEventType; /* sycamore protocol support */
|
||||
int conStatus; /* should use status enum ffr */
|
||||
int transID; /* transaction ID */
|
||||
char deviceID[256]; /* transaction device ID */
|
||||
int iUserRights; /* user rights of the connection */
|
||||
|
||||
/* master connection object fields */
|
||||
int iList; /* callback registry, may go? */
|
||||
int iEnd; /* flag to end connection task */
|
||||
int iLogin; /* flag for successful login process */
|
||||
time_t conStart; /* time when connection was built: used during login */
|
||||
int iOutput; /* output filter flag */
|
||||
int listening; /* for listening to commandlog or other data */
|
||||
int eInterrupt; /* interrupts */
|
||||
int inUse; /* usage counter for the connection */
|
||||
int iGrab; /* grab flag for token*/
|
||||
int iProtocolID; /* ID of the protocol on this connection */
|
||||
pCosta pStack; /* stack of pending commands */
|
||||
int contextStack; /* context stack: may go? */
|
||||
mkChannel *pSock; /* for temporary backwards compatability */
|
||||
} SConnection;
|
||||
typedef struct __SConnection {
|
||||
/* Copy Object Fields */
|
||||
pObjectDescriptor pDes; /* must be here */
|
||||
long lMagic; /* connection object ID */
|
||||
long ident; /* connection idetification */
|
||||
struct __SConnection *next; /* pointer for freeConnection managenment */
|
||||
int sockHandle; /* socket handle */
|
||||
int iTelnet; /* telnet flag */
|
||||
int iMacro; /* suppress I/O in macro */
|
||||
writeFunc write; /* function doing writing */
|
||||
int sicsError; /* Tcl interpreter requirement */
|
||||
pDynString data; /* for I/O buffering */
|
||||
writeFunc oldWriteFunc; /* saved write function used in I/O buffering */
|
||||
long iCmdCtr; /* sycamore protocol used */
|
||||
int conEventType; /* sycamore protocol support */
|
||||
int conStatus; /* should use status enum ffr */
|
||||
int transID; /* transaction ID */
|
||||
char deviceID[256]; /* transaction device ID */
|
||||
int iUserRights; /* user rights of the connection */
|
||||
|
||||
/* master connection object fields */
|
||||
int iList; /* callback registry, may go? */
|
||||
int iEnd; /* flag to end connection task */
|
||||
int iLogin; /* flag for successful login process */
|
||||
time_t conStart; /* time when connection was built: used during login */
|
||||
int iOutput; /* output filter flag */
|
||||
int listening; /* for listening to commandlog or other data */
|
||||
int eInterrupt; /* interrupts */
|
||||
int inUse; /* usage counter for the connection */
|
||||
int iGrab; /* grab flag for token */
|
||||
int iProtocolID; /* ID of the protocol on this connection */
|
||||
pCosta pStack; /* stack of pending commands */
|
||||
int contextStack; /* context stack: may go? */
|
||||
mkChannel *pSock; /* for temporary backwards compatability */
|
||||
} SConnection;
|
||||
|
||||
#include "nserver.h"
|
||||
|
||||
/*------------------------------ live & death ----------------------------*/
|
||||
SConnection *SCreateConnection(SicsInterp *pSics, int sockHandle,
|
||||
int iUserRights);
|
||||
SConnection *SCCreateDummyConnection(SicsInterp *pSics);
|
||||
void SCDeleteConnection(void *pVictim);
|
||||
SConnection *SCCopyConnection(SConnection *pCon);
|
||||
SConnection *SCfindMaster(SConnection *pCon);
|
||||
int SCisConnected(SConnection *pCon);
|
||||
int VerifyConnection(SConnection *pCon);
|
||||
int SCVerifyConnection(SConnection *self);
|
||||
SConnection *SCreateConnection(SicsInterp * pSics, int sockHandle,
|
||||
int iUserRights);
|
||||
SConnection *SCCreateDummyConnection(SicsInterp * pSics);
|
||||
void SCDeleteConnection(void *pVictim);
|
||||
SConnection *SCCopyConnection(SConnection * pCon);
|
||||
SConnection *SCfindMaster(SConnection * pCon);
|
||||
int SCisConnected(SConnection * pCon);
|
||||
int VerifyConnection(SConnection * pCon);
|
||||
int SCVerifyConnection(SConnection * self);
|
||||
/*------------------------------- tasking --------------------------------*/
|
||||
int SCTaskFunction(void *pCon);
|
||||
void SCSignalFunction(void *pCon, int iSignal, void *pSigData);
|
||||
int SCTaskFunction(void *pCon);
|
||||
void SCSignalFunction(void *pCon, int iSignal, void *pSigData);
|
||||
/* ***************************** I/O ************************************** */
|
||||
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);
|
||||
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 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);
|
||||
int SCACTWrite(SConnection *self, char *buffer, int iOut);
|
||||
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);
|
||||
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 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);
|
||||
int SCACTWrite(SConnection * self, char *buffer, int iOut);
|
||||
/*********************** I/O Buffering ***********************************/
|
||||
int SCStartBuffering(SConnection *pCon);
|
||||
pDynString SCEndBuffering(SConnection *pCon);
|
||||
int SCStartBuffering(SConnection * pCon);
|
||||
pDynString SCEndBuffering(SConnection * pCon);
|
||||
/******************************* Error **************************************/
|
||||
void SCSetInterrupt(SConnection *self, int eCode);
|
||||
int SCGetInterrupt(SConnection *self);
|
||||
void SCSetInterrupt(SConnection * self, int eCode);
|
||||
int SCGetInterrupt(SConnection * self);
|
||||
/****************************** Macro ***************************************/
|
||||
int SCinMacro(SConnection *pCon);
|
||||
int SCsetMacro(SConnection *pCon, int iMode);
|
||||
int SCinMacro(SConnection * pCon);
|
||||
int SCsetMacro(SConnection * pCon, int iMode);
|
||||
/************************** parameters changed ? **************************/
|
||||
void SCparChange(SConnection *pCon);
|
||||
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);
|
||||
int SCActive(SConnection *pCon);
|
||||
int SCGetRights(SConnection * self);
|
||||
int SCSetRights(SConnection * pCon, int iNew);
|
||||
int SCMatchRights(SConnection * pCon, int iCode);
|
||||
int SCGetOutClass(SConnection * self);
|
||||
int SCGetGrab(SConnection * pCon);
|
||||
int SCActive(SConnection * pCon);
|
||||
/* **************************** Invocation ******************************** */
|
||||
int SCInvoke(SConnection *self,SicsInterp *pInter,char *pCommand);
|
||||
|
||||
int SCInvoke(SConnection * self, SicsInterp * pInter, char *pCommand);
|
||||
|
||||
/*************************** User Command **********************************/
|
||||
int ConfigCon(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]);
|
||||
int ConSicsAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]);
|
||||
int ConfigCon(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
int argc, char *argv[]);
|
||||
int ConSicsAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
int argc, char *argv[]);
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
int SCDoSockWrite(SConnection *self, char *buffer);
|
||||
int SCWriteInContext(SConnection *pCon, char *buffer, int code, commandContext cc);
|
||||
int SCDoSockWrite(SConnection * self, char *buffer);
|
||||
int SCWriteInContext(SConnection * pCon, char *buffer, int code,
|
||||
commandContext cc);
|
||||
|
||||
|
||||
/* ================== =====================================================
|
||||
* These routines are obsolete and may not even work anymore.
|
||||
* Mark Koennecke, January 2009
|
||||
* ==========================================================================*/
|
||||
void SCWriteToLogFiles(SConnection *self, char *buffer);
|
||||
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);
|
||||
void SCWriteToLogFiles(SConnection * self, char *buffer);
|
||||
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);
|
||||
/******************************** Store ************************************/
|
||||
typedef struct SCStore SCStore;
|
||||
|
||||
SCStore *SCSave(SConnection *pCon, SCStore *oldStore);
|
||||
SCStore *SCSave(SConnection * pCon, SCStore * oldStore);
|
||||
/* save a connection and its context for later use. */
|
||||
|
||||
SConnection *SCLoad(SCStore *conStore);
|
||||
SConnection *SCLoad(SCStore * conStore);
|
||||
/* check con and return SConnection if still valid or a dummy connection otherwise. */
|
||||
|
||||
SConnection *SCStorePush(SCStore *conStore);
|
||||
SConnection *SCStorePush(SCStore * conStore);
|
||||
/* load connection and push stored context. Must be paired with an SCStorePop command */
|
||||
|
||||
void SCStorePop(SCStore *conStore);
|
||||
void SCStorePop(SCStore * conStore);
|
||||
/* pop context */
|
||||
|
||||
int SCStoreConnected(SCStore *conStore);
|
||||
int SCStoreConnected(SCStore * conStore);
|
||||
/* check if a stored connection is not closed */
|
||||
|
||||
void SCStoreFree(SCStore *conStore);
|
||||
void SCStoreFree(SCStore * conStore);
|
||||
/* free an SCStore */
|
||||
|
||||
void KillFreeConnections(void);
|
||||
/************************* CallBack *********************************** */
|
||||
int SCRegister(SConnection *pCon, SicsInterp *pSics,
|
||||
void *pInter, long lID);
|
||||
int SCUnregister(SConnection *pCon, void *pInter);
|
||||
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);
|
||||
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);
|
||||
#endif
|
||||
|
||||
long SCgetCallbackID(SConnection * pCon, void *pData);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user