Initial revision
This commit is contained in:
115
conman.h
Normal file
115
conman.h
Normal file
@ -0,0 +1,115 @@
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
C O N N E C T I O N O B J E C T
|
||||
|
||||
This file defines the connection object data structure and the interface to
|
||||
this data structure. This is one of the most important SICS components.
|
||||
|
||||
|
||||
Substantially revised from a prior version.
|
||||
|
||||
Mark Koennecke, September 1997
|
||||
|
||||
copyright: see copyright.h
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef SICSCONNECT
|
||||
#define SICSCONNECT
|
||||
#include <stdio.h>
|
||||
#include "costa.h"
|
||||
#include "SCinter.h"
|
||||
#include "network.h"
|
||||
#include "obdes.h"
|
||||
|
||||
#define MAXLOGFILES 10
|
||||
|
||||
typedef struct __SConnection {
|
||||
/* object basics */
|
||||
pObjectDescriptor pDes;
|
||||
char *pName;
|
||||
long lMagic;
|
||||
|
||||
/* I/O control */
|
||||
mkChannel *pSock;
|
||||
FILE *pFiles[MAXLOGFILES];
|
||||
int iMacro;
|
||||
int iTelnet;
|
||||
int iOutput;
|
||||
int iFiles;
|
||||
int (*write)(struct __SConnection *pCon,
|
||||
char *pMessage, int iCode);
|
||||
mkChannel *pDataSock;
|
||||
char *pDataComp;
|
||||
int iDataPort;
|
||||
|
||||
/* execution context */
|
||||
int eInterrupt;
|
||||
int iUserRights;
|
||||
int inUse;
|
||||
int iDummy;
|
||||
int iGrab;
|
||||
int iErrCode;
|
||||
SicsInterp *pSics;
|
||||
|
||||
/* a FIFO */
|
||||
pCosta pStack;
|
||||
|
||||
/* callback registry */
|
||||
int iList;
|
||||
|
||||
/* Tasking Stuff */
|
||||
int iEnd;
|
||||
}SConnection;
|
||||
|
||||
#include "nserver.h"
|
||||
|
||||
/*------------------------------ live & death ----------------------------*/
|
||||
SConnection *SCreateConnection(SicsInterp *pSics, mkChannel *pSock,
|
||||
int iUserRights);
|
||||
SConnection *SCCreateDummyConnection(SicsInterp *pSics);
|
||||
void SCDeleteConnection(void *pVictim);
|
||||
|
||||
/*------------------------------- tasking --------------------------------*/
|
||||
int SCTaskFunction(void *pCon);
|
||||
void SCSignalFunction(void *pCon, int iSignal, void *pSigData);
|
||||
/* ***************************** I/O ************************************** */
|
||||
int SCAddLogFile(SConnection *self, char *name);
|
||||
int SCDelLogFile(SConnection *pCon, int iFile);
|
||||
void SCSetOutputClass(SConnection *self, int iClass);
|
||||
int SCWrite(SConnection *self, char *pBuffer, int iOut);
|
||||
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);
|
||||
/************************* CallBack *********************************** */
|
||||
int SCRegister(SConnection *pCon, SicsInterp *pSics,
|
||||
void *pInter, long lID);
|
||||
int SCUnregister(SConnection *pCon, void *pInter);
|
||||
/******************************* 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);
|
||||
|
||||
/* *************************** 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);
|
||||
|
||||
/* **************************** Invocation ******************************** */
|
||||
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[]);
|
||||
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user