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