vlp-10 Using coding style in genint.h and comm.h
[vlp.git] / src / global / 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 typedef struct {
16         paddr sender;     /* address of the sender and */
17         paddr receiver;   /* receiver of the message */
18         int type;         /* message type */
19         int par;          /* prototype or error signal number */
20 } ctrl_msg;
21
22 typedef struct {
23         ctrl_msg control;
24         char params[256 - sizeof(ctrl_msg)];
25 } messg;
26
27 typedef struct {
28         int pword[15];
29         char pstr[255];
30         char pchar;
31 } param_struct;
32
33 typedef struct {
34         int node;
35         int program_id;
36 } ctx_struct;
37
38 /* Commm struct for GRAPH element */
39
40 #define GRAPH_ALLOCATE  1
41 #define GRAPH_EXIT      2 
42 #define GRAPH_FREE      3
43 #define GRAPH_SET_TITLE 4
44 #define GRAPH_WRITE     5
45 #define GRAPH_WRITEXY   6
46 #define GRAPH_READCHAR  7
47 #define GRAPH_READSTR   8
48 #define GRAPH_READLN    9
49 #define GRAPH_PUTCHAR   10
50 #define GRAPH_LINE      11
51 #define GRAPH_ELLIPSE   12
52 #define GRAPH_RECT      13
53 #define GRAPH_FOREGROUND        14
54 #define GRAPH_BACKGROUND        15
55 #define GRAPH_POINT     16
56 #define GRAPH_CLEAR     17
57 #define GRAPH_HASCII    18
58 #define GRAPH_INKEY     19
59 #define GRAPH_ALLOCATED 20
60 #define GRAPH_INKEY_RESPONSE    21
61 #define GRAPH_READCHAR_RESPONSE 22
62 #define GRAPH_READSTR_RESPONSE  23
63 #define GRAPH_READLN_RESPONSE   24
64 #define GRAPH_MOVE              25
65 #define GRAPH_CURPOS            26
66 #define GRAPH_CURPOS_RESPONSE   27
67 #define GRAPH_LINETO            28
68
69 #define GRAPH_OPERATION_OK      29
70 #define GRAPH_OUTSTRING         30
71 #define GRAPH_WRITEINTXY        31
72 #define GRAPH_PUTMAP            32
73 #define GRAPH_GETMAP            33
74 #define GRAPH_GETMAP_RESPONSE   34
75
76 #define GRAPH_MGETPRESS         35
77 #define GRAPH_MGETPRESS_RESPONSE        36
78
79 #define GRAPH_MAGIC     37
80 #define GRAPH_MAGIC_RESPONSE    38
81
82 /* INT element */
83
84 #define INT_CONNECTED   1
85 #define INT_EXITING     2
86 #define INT_CTX         3
87 #define INT_CTX_REQ     4
88 #define INT_REMOTE_INST 5
89 #define INT_INST_OK     6
90 #define INT_READY       7
91 #define INT_CLOSE_INSTANCE      8
92 #define INT_KILL        9
93 #define INT_START_OK    10
94
95
96
97 /* NET element */
98
99 #define NET_PROPAGATE   0
100 #define NET_PROPAGATE_OUT               1
101 /*
102    msg_type = MSG_NET, param.pword[0] = NET_PROPAGATE
103    param.pword[1] = MSG_INT or MSG_VLP
104    param.pword[2,3] = sender context or node,0
105    param.pword[4,5] = receiver context or node,0
106    param.pword[6] =            VLP command
107    
108  */
109  
110 #define NET_PROPAGATE_IN        2
111  
112 #define NET_UNREGISTER          3
113 #define NET_REGISTER_NODE       4
114 #define NET_REGISTER_OK         5
115  
116 #define NET_NODE                6
117  
118 #define NET_CCD_START   7
119 #define NET_PCD_START   8
120 #define NET_CODESTREAM_OK       9
121  
122 #define NET_TRANSMIT_CODE       10
123  
124  
125 #define NET_CONNECT             11
126 #define NET_ACCEPT              12
127  
128 #define NET_EXIT                13
129 #define NET_CCD_CODE            14
130 #define NET_PCD_CODE            15
131   
132
133 #define NET_CSWRITELN           16
134 #define NET_DISCONNECT          17
135 #define NET_NODE_EXIST          18 
136 #define NET_TRANSMITTED         19
137 #define NET_CONNECTIONS         20
138 #define NET_CONNINFO            21
139 #define NET_CONNECT_TO          22
140 #define NET_GET_INFO            23
141 #define NET_INFO                24
142 #define NET_INFO_END            25
143 #define NET_NODES_NUM           26
144 #define NET_NODES_NUM_RESPONSE  27
145
146 /* VLP message */
147
148 #define VLP_WRITE               0
149 #define VLP_REMOTE_INSTANCE     1
150 #define VLP_REMOTE_INSTANCE_OK  2
151 #define VLP_REGINT              3
152 #define VLP_REMOTE_INSTANCE_PLEASE 4
153 #define VLP_REMOTE_INSTANCE_HERE        5
154 #define VLP_CLOSE_INSTANCE              6
155 #define VLP_INTERPRETER_DOWN            7
156 /* ------------------------------------------------------------ */
157 /*                Message structure                            */
158 /*------------------------------------------------------------*/
159
160 #define MSG_VLP         0
161 #define MSG_NET         1
162 #define MSG_GRAPH       2
163 #define MSG_INT         3
164
165 typedef struct {
166         short msg_type;
167         param_struct param;
168         messg int_msg;
169 } MESSAGE;
170
171
172 typedef struct {
173         short msg_type;
174         param_struct param;
175 } G_MESSAGE;
176
177 #define TCP_BUFFER_SIZE 30*sizeof(MESSAGE);
178