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