Added upstream version.
[vlp.git] / head / comm.h
1 /*    Communication structures */
2
3
4 // REDHAT DEPENDENT !!!
5 #include <netinet/tcp.h>
6
7 typedef char string20[20];
8
9 typedef struct {
10     int node;
11     int pix;
12     int mark;
13 } paddr;
14
15 struct ctrl_msg
16 {
17     paddr sender;       /* address of the sender and */
18     paddr receiver;   /* receiver of the message */
19     int type;      /* message type */
20     int par;         /* prototype or error signal number */
21 };
22
23
24
25 typedef struct
26 {
27     struct ctrl_msg control;
28     char params[ 256-sizeof(struct ctrl_msg) ];
29 } messg;
30
31
32 typedef struct
33 {
34  int pword[15];
35  char pstr[255];
36  char pchar;
37 } param_struct;
38
39
40
41 typedef struct
42 {
43  int node;
44  int program_id;
45 } ctx_struct;
46
47 /* Commm struct for GRAPH element */
48
49
50 #define GRAPH_ALLOCATE  1
51 #define GRAPH_EXIT      2 
52 #define GRAPH_FREE      3
53 #define GRAPH_SET_TITLE 4
54 #define GRAPH_WRITE     5
55 #define GRAPH_WRITEXY   6
56 #define GRAPH_READCHAR  7
57 #define GRAPH_READSTR   8
58 #define GRAPH_READLN    9
59 #define GRAPH_PUTCHAR   10
60 #define GRAPH_LINE      11
61 #define GRAPH_ELLIPSE   12
62 #define GRAPH_RECT      13
63 #define GRAPH_FOREGROUND        14
64 #define GRAPH_BACKGROUND        15
65 #define GRAPH_POINT     16
66 #define GRAPH_CLEAR     17
67 #define GRAPH_HASCII    18
68 #define GRAPH_INKEY     19
69 #define GRAPH_ALLOCATED 20
70 #define GRAPH_INKEY_RESPONSE    21
71 #define GRAPH_READCHAR_RESPONSE 22
72 #define GRAPH_READSTR_RESPONSE  23
73 #define GRAPH_READLN_RESPONSE   24
74 #define GRAPH_MOVE              25
75 #define GRAPH_CURPOS            26
76 #define GRAPH_CURPOS_RESPONSE   27
77 #define GRAPH_LINETO            28
78
79 #define GRAPH_OPERATION_OK      29
80 #define GRAPH_OUTSTRING         30
81 #define GRAPH_WRITEINTXY        31
82 #define GRAPH_PUTMAP            32
83 #define GRAPH_GETMAP            33
84 #define GRAPH_GETMAP_RESPONSE   34
85
86 #define GRAPH_MGETPRESS         35
87 #define GRAPH_MGETPRESS_RESPONSE        36
88
89 #define GRAPH_MAGIC     37
90 #define GRAPH_MAGIC_RESPONSE    38
91
92 /* INT element */
93
94
95
96 #define INT_CONNECTED   1
97 #define INT_EXITING     2
98 #define INT_CTX         3
99 #define INT_CTX_REQ     4
100 #define INT_REMOTE_INST 5
101 #define INT_INST_OK     6
102 #define INT_READY       7
103 #define INT_CLOSE_INSTANCE      8
104 #define INT_KILL        9
105 #define INT_START_OK    10
106
107
108
109 /* NET element */
110
111 #define NET_PROPAGATE   0
112 #define NET_PROPAGATE_OUT               1
113 /*  msg_type = MSG_NET, param.pword[0] = NET_PROPAGATE
114    param.pword[1] = MSG_INT or MSG_VLP
115    param.pword[2,3] = sender context or node,0
116    param.pword[4,5] = receiver context or node,0
117    param.pword[6] =            VLP command
118    
119  */
120  
121 #define NET_PROPAGATE_IN        2
122  
123 #define NET_UNREGISTER          3
124 #define NET_REGISTER_NODE       4
125 #define NET_REGISTER_OK         5
126  
127 #define NET_NODE                6
128  
129 #define NET_CCD_START   7
130 #define NET_PCD_START   8
131 #define NET_CODESTREAM_OK       9
132  
133 #define NET_TRANSMIT_CODE       10
134  
135  
136 #define NET_CONNECT             11
137 #define NET_ACCEPT              12
138  
139 #define NET_EXIT                13
140 #define NET_CCD_CODE            14
141 #define NET_PCD_CODE            15
142   
143
144 #define NET_CSWRITELN           16
145 #define NET_DISCONNECT          17
146 #define NET_NODE_EXIST          18 
147 #define NET_TRANSMITTED         19
148 #define NET_CONNECTIONS         20
149 #define NET_CONNINFO            21
150 #define NET_CONNECT_TO          22
151 #define NET_GET_INFO            23
152 #define NET_INFO                24
153 #define NET_INFO_END            25
154 #define NET_NODES_NUM           26
155 #define NET_NODES_NUM_RESPONSE  27
156
157
158 /* VLP message */
159
160 #define VLP_WRITE               0
161 #define VLP_REMOTE_INSTANCE     1
162 #define VLP_REMOTE_INSTANCE_OK  2
163 #define VLP_REGINT              3
164 #define VLP_REMOTE_INSTANCE_PLEASE 4
165 #define VLP_REMOTE_INSTANCE_HERE        5
166 #define VLP_CLOSE_INSTANCE              6
167 #define VLP_INTERPRETER_DOWN            7
168 /* ------------------------------------------------------------ */
169 /*                Message structure                            */
170 /*------------------------------------------------------------*/
171
172
173 #define MSG_VLP         0
174 #define MSG_NET         1
175 #define MSG_GRAPH       2
176 #define MSG_INT         3
177
178 typedef struct
179 {
180  short msg_type;
181  param_struct param;
182  messg int_msg;
183 } MESSAGE;
184
185
186 typedef struct
187 {
188  short msg_type;
189  param_struct param;
190  
191 } G_MESSAGE;
192
193
194
195
196 #define TCP_BUFFER_SIZE 30*sizeof(MESSAGE);
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248