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