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