Annotation of OpenXM/src/kan96xx/plugin/oxKan0.h, Revision 1.11
1.11 ! takayama 1: /* $OpenXM: OpenXM/src/kan96xx/plugin/oxKan0.h,v 1.10 2004/09/17 07:27:28 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);
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. */
1.11 ! takayama 90: oxclientp oxCreateClient(char *ipname,int portStream,int portControl,
! 91: char *passControl,char *passData);
1.1 maekawa 92: oxclientp oxCreateClientFile(char *fileName,char *mode,char *controlFileName,char *cmode);
93: oxclientp oxCreateClient2(int fdstream,int portStream,
1.10 takayama 94: int fdcontrol,int portControl,int ipmask,char *cpass,char *dpass);
1.1 maekawa 95: int oxSetByteOrder(int fd);
1.6 takayama 96: int oxTellMyByteOrder(int fdOut,int fdIn);
1.1 maekawa 97:
98: char *oxGenPass(void);
99:
100:
101: /* -------------------------------------- */
102: int readOneByte(int fd); /* blocking */
103: int oxfdGetInt32(int fd);
104: int oxGetInt32(ox_stream ostream);
105: int oxfdGetOXheader(int fd,int *serial);
106: int oxGetOXheader(ox_stream ostream, int *serial);
107: int oxGetCMOInt32(ox_stream ostream);
108: char *oxGetCMOString(ox_stream ostream);
109:
110: void oxfdSendInt32(int fd,int k);
111: void oxfdSendOXheader(int fd,int k,int serial);
112: void oxfdSendCmoNull(int fd);
113: void oxfdSendCmoInt32(int fd,int k);
114: void oxfdSendCmoString(int fd,char *s);
115: void oxfdSendSyncBall(int fd);
116:
117: void oxSendInt32(ox_stream ostream,int k);
118: void oxSendOXheader(ox_stream ostream,int k,int serial);
119: void oxSendCmoNull(ox_stream ostream);
120: void oxSendCmoError(ox_stream ostream);
121: void oxSendCmoError2(ox_stream ostream,char *s);
122: void oxSendCmoInt32(ox_stream ostream,int k);
123: void oxSendCmoString(ox_stream ostream,char *s);
124: void oxSendMathCap(ox_stream ostream,struct mathCap *mathcap);
125: void oxPushMathCap(struct mathCap *mathcap);
126:
127:
128: void oxSendSyncBall(ox_stream ostream);
129: int oxWaitSyncBall(ox_stream ostream);
130:
131: void oxSendResultOfControl(int fd);
132: void oxSendResultOfControlInt32(int fd, int k);
133:
134:
135: void oxReqMathCap(ox_stream os);
136: void oxReqSetMathCap(ox_stream os,struct mathCap *mathcap);
137: void oxReqPops(ox_stream os,int n);
138: void oxReqSetName(ox_stream os,char *name);
139: void oxReqEvalName(ox_stream os,char *name);
140: void oxReqExecuteStringByLocalParser(ox_stream os,char *s);
141: void oxReqExecuteFunction(ox_stream os,char *s);
1.9 takayama 142: void oxReqExecuteFunctionWithOptionalArgument(ox_stream os,char *s);
1.1 maekawa 143: void oxReqPopString(ox_stream os);
144: void oxReqPushString(ox_stream os,char *s);
145: void oxReqPopCMO(ox_stream os);
146: void oxReqSingleOperand(ox_stream os,int sm_operator_tag);
147:
148: void oxReqControlResetConnection(int fd);
149: void oxReqControlKill(int fd);
150:
151: int oxReadPortFile(int func,char *fname); /* 0 : .control, 1 : .data */
152: int oxWritePortFile(int func,int port,char *fname);
153: char *oxGenPortFile(void);
154: int oxRemovePortFile(void);
155:
1.4 takayama 156: #define MAX_N_OF_CLIENT 1024
157: int oxGetClientID();
1.7 takayama 158:
159: char *oxFIDtoStr(int id);
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>