Annotation of OpenXM/src/kan96xx/plugin/oxKan0.h, Revision 1.1
1.1 ! maekawa 1: /* ox_kan0.h */
! 2:
! 3: #define mymalloc(n) malloc(n)
! 4: #define myfree(p) free(p)
! 5: typedef FILE2 * ox_stream;
! 6:
! 7: int socketOpen(char *serverName,int portNumber);
! 8: /* OpenedSocket is used to return the port number. */
! 9: int socketAccept(int snum);
! 10: int socketAcceptLocal(int snum);
! 11: int oxSocketSelect0(int fd,int t);
! 12: int oxSocketMultiSelect(int sid[],int size,int t,int result[]);
! 13: int socketConnect(char *serverName,int portNumber);
! 14: int socketConnectWithPass(char *serverName,int portNumber,char *pass);
! 15:
! 16:
! 17: /* ------------------------------------- */
! 18: extern FILE *MyErrorOut;
! 19:
! 20: typedef struct CMO_Object {
! 21: int tag;
! 22: char data[1];
! 23: } CMO_Object ;
! 24:
! 25: typedef struct CMO_string_object {
! 26: int tag;
! 27: int size;
! 28: char data[1];
! 29: } CMO_string_object;
! 30:
! 31: typedef struct CMO_int32_object {
! 32: int tag;
! 33: int n;
! 34: } CMO_int32_object ;
! 35:
! 36: void printCMO_object(FILE *fp,CMO_Object *op);
! 37:
! 38:
! 39: /* --------------------------------------- */
! 40: #define DSTATE_ERROR -1
! 41: #define DSTATE_ANY 0
! 42: #define DSTATE_FIRST_SYNC 1
! 43: #define DSTATE_SECOND_SYNC 2
! 44: #define DSTATE_WAIT_OX_DATA 256
! 45:
! 46: typedef struct oxclient {
! 47: ox_stream datafp2;
! 48: int dataport;
! 49: int controlfd;
! 50: int controlport;
! 51: int dstate; /* state of data channel */
! 52: /* 0 : any
! 53: 1 : waiting the first OX_SYNC_BALL
! 54: 2 : waiting the second OX_SYNC_BALL
! 55: 256: waiting the OX_DATA to stack.
! 56: */
! 57: int cstate; /* state of control channel */
! 58: /* 0 : any
! 59: 1 : waiting resultOfControlInt32
! 60: */
! 61: int humanio; /* 1: stdin, 0: not */
! 62: int type; /* 0: CLIENT_SOCKET socket, 1: CLIENT_FILE file */
! 63: int id; /* client identifier. */
! 64: void *mathcapObjp; /* NULL for the initial state.
! 65: NULL means no restriction.*/
! 66: int engineByteOrder;
! 67: int controlByteOrder;
! 68: } oxclient;
! 69: #define N_OF_CLIENT_FIELDS 13 /* If you add new field to struct oxclient
! 70: do not forget to increase the number.*/
! 71: /* Change also, oxInitClient, oxCreateClient, oxCreateClientFile oxmisc.c
! 72: oxClientToObject, oxObjectToClient oxmisc2.c
! 73: */
! 74: typedef oxclient * oxclientp;
! 75:
! 76: #define CLIENT_SOCKET 0
! 77: #define CLIENT_FILE 1
! 78:
! 79: int oxGetResultOfControlInt32(int fd);
! 80: int oxclientMultiSelect(oxclientp clients[],int dataready[],int controlready[],
! 81: int size, int t);
! 82: int oxInitClient(oxclientp c);
! 83: int oxGetControl(oxclientp client);
! 84: int oxIsThereErrorClient(oxclientp client); /* 1 : error, 0 : OK. */
! 85: oxclientp oxCreateClient(char *ipname,int portStream,int portControl);
! 86: oxclientp oxCreateClientFile(char *fileName,char *mode,char *controlFileName,char *cmode);
! 87: oxclientp oxCreateClient2(int fdstream,int portStream,
! 88: int fdcontrol,int portControl,int ipmask,char *pass);
! 89: int oxSetByteOrder(int fd);
! 90: int oxTellMyByteOrder(int fd);
! 91:
! 92: char *oxGenPass(void);
! 93:
! 94:
! 95: /* -------------------------------------- */
! 96: int readOneByte(int fd); /* blocking */
! 97: int oxfdGetInt32(int fd);
! 98: int oxGetInt32(ox_stream ostream);
! 99: int oxfdGetOXheader(int fd,int *serial);
! 100: int oxGetOXheader(ox_stream ostream, int *serial);
! 101: int oxGetCMOInt32(ox_stream ostream);
! 102: char *oxGetCMOString(ox_stream ostream);
! 103:
! 104: void oxfdSendInt32(int fd,int k);
! 105: void oxfdSendOXheader(int fd,int k,int serial);
! 106: void oxfdSendCmoNull(int fd);
! 107: void oxfdSendCmoInt32(int fd,int k);
! 108: void oxfdSendCmoString(int fd,char *s);
! 109: void oxfdSendSyncBall(int fd);
! 110:
! 111: void oxSendInt32(ox_stream ostream,int k);
! 112: void oxSendOXheader(ox_stream ostream,int k,int serial);
! 113: void oxSendCmoNull(ox_stream ostream);
! 114: void oxSendCmoError(ox_stream ostream);
! 115: void oxSendCmoError2(ox_stream ostream,char *s);
! 116: void oxSendCmoInt32(ox_stream ostream,int k);
! 117: void oxSendCmoString(ox_stream ostream,char *s);
! 118: void oxSendMathCap(ox_stream ostream,struct mathCap *mathcap);
! 119: void oxPushMathCap(struct mathCap *mathcap);
! 120:
! 121:
! 122: void oxSendSyncBall(ox_stream ostream);
! 123: int oxWaitSyncBall(ox_stream ostream);
! 124:
! 125: void oxSendResultOfControl(int fd);
! 126: void oxSendResultOfControlInt32(int fd, int k);
! 127:
! 128:
! 129: void oxReqMathCap(ox_stream os);
! 130: void oxReqSetMathCap(ox_stream os,struct mathCap *mathcap);
! 131: void oxReqPops(ox_stream os,int n);
! 132: void oxReqSetName(ox_stream os,char *name);
! 133: void oxReqEvalName(ox_stream os,char *name);
! 134: void oxReqExecuteStringByLocalParser(ox_stream os,char *s);
! 135: void oxReqExecuteFunction(ox_stream os,char *s);
! 136: void oxReqPopString(ox_stream os);
! 137: void oxReqPushString(ox_stream os,char *s);
! 138: void oxReqPopCMO(ox_stream os);
! 139: void oxReqSingleOperand(ox_stream os,int sm_operator_tag);
! 140:
! 141: void oxReqControlResetConnection(int fd);
! 142: void oxReqControlKill(int fd);
! 143:
! 144: int oxReadPortFile(int func,char *fname); /* 0 : .control, 1 : .data */
! 145: int oxWritePortFile(int func,int port,char *fname);
! 146: char *oxGenPortFile(void);
! 147: int oxRemovePortFile(void);
! 148:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>