Annotation of OpenXM/src/kan96xx/plugin/oxKan0.h, Revision 1.3
1.3 ! takayama 1: /* $OpenXM: OpenXM/src/kan96xx/plugin/oxKan0.h,v 1.2 2000/01/16 07:55:47 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;
69: } oxclient;
70: #define N_OF_CLIENT_FIELDS 13 /* If you add new field to struct oxclient
71: do not forget to increase the number.*/
1.3 ! takayama 72: /* Change also, oxInitClient, oxCreateClient(2), oxCreateClientFile oxmisc.c
1.1 maekawa 73: oxClientToObject, oxObjectToClient oxmisc2.c
74: */
75: typedef oxclient * oxclientp;
1.3 ! takayama 76:
! 77: #define AbortIfRFC_101(oxclient) if (oxclient->controlport < 0) {\
! 78: errorOxmisc2("The OpenXM RFC 101 client is used for RFC 100\n"); }
1.1 maekawa 79:
80: #define CLIENT_SOCKET 0
81: #define CLIENT_FILE 1
82:
83: int oxGetResultOfControlInt32(int fd);
84: int oxclientMultiSelect(oxclientp clients[],int dataready[],int controlready[],
85: int size, int t);
86: int oxInitClient(oxclientp c);
87: int oxGetControl(oxclientp client);
88: int oxIsThereErrorClient(oxclientp client); /* 1 : error, 0 : OK. */
89: oxclientp oxCreateClient(char *ipname,int portStream,int portControl);
90: oxclientp oxCreateClientFile(char *fileName,char *mode,char *controlFileName,char *cmode);
91: oxclientp oxCreateClient2(int fdstream,int portStream,
92: int fdcontrol,int portControl,int ipmask,char *pass);
93: int oxSetByteOrder(int fd);
94: int oxTellMyByteOrder(int fd);
95:
96: char *oxGenPass(void);
97:
98:
99: /* -------------------------------------- */
100: int readOneByte(int fd); /* blocking */
101: int oxfdGetInt32(int fd);
102: int oxGetInt32(ox_stream ostream);
103: int oxfdGetOXheader(int fd,int *serial);
104: int oxGetOXheader(ox_stream ostream, int *serial);
105: int oxGetCMOInt32(ox_stream ostream);
106: char *oxGetCMOString(ox_stream ostream);
107:
108: void oxfdSendInt32(int fd,int k);
109: void oxfdSendOXheader(int fd,int k,int serial);
110: void oxfdSendCmoNull(int fd);
111: void oxfdSendCmoInt32(int fd,int k);
112: void oxfdSendCmoString(int fd,char *s);
113: void oxfdSendSyncBall(int fd);
114:
115: void oxSendInt32(ox_stream ostream,int k);
116: void oxSendOXheader(ox_stream ostream,int k,int serial);
117: void oxSendCmoNull(ox_stream ostream);
118: void oxSendCmoError(ox_stream ostream);
119: void oxSendCmoError2(ox_stream ostream,char *s);
120: void oxSendCmoInt32(ox_stream ostream,int k);
121: void oxSendCmoString(ox_stream ostream,char *s);
122: void oxSendMathCap(ox_stream ostream,struct mathCap *mathcap);
123: void oxPushMathCap(struct mathCap *mathcap);
124:
125:
126: void oxSendSyncBall(ox_stream ostream);
127: int oxWaitSyncBall(ox_stream ostream);
128:
129: void oxSendResultOfControl(int fd);
130: void oxSendResultOfControlInt32(int fd, int k);
131:
132:
133: void oxReqMathCap(ox_stream os);
134: void oxReqSetMathCap(ox_stream os,struct mathCap *mathcap);
135: void oxReqPops(ox_stream os,int n);
136: void oxReqSetName(ox_stream os,char *name);
137: void oxReqEvalName(ox_stream os,char *name);
138: void oxReqExecuteStringByLocalParser(ox_stream os,char *s);
139: void oxReqExecuteFunction(ox_stream os,char *s);
140: void oxReqPopString(ox_stream os);
141: void oxReqPushString(ox_stream os,char *s);
142: void oxReqPopCMO(ox_stream os);
143: void oxReqSingleOperand(ox_stream os,int sm_operator_tag);
144:
145: void oxReqControlResetConnection(int fd);
146: void oxReqControlKill(int fd);
147:
148: int oxReadPortFile(int func,char *fname); /* 0 : .control, 1 : .data */
149: int oxWritePortFile(int func,int port,char *fname);
150: char *oxGenPortFile(void);
151: int oxRemovePortFile(void);
152:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>