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