aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/mesh_protocol_enc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesh/mesh_protocol_enc.h')
-rw-r--r--src/mesh/mesh_protocol_enc.h337
1 files changed, 337 insertions, 0 deletions
diff --git a/src/mesh/mesh_protocol_enc.h b/src/mesh/mesh_protocol_enc.h
new file mode 100644
index 000000000..f739897ee
--- /dev/null
+++ b/src/mesh/mesh_protocol_enc.h
@@ -0,0 +1,337 @@
1/*
2 This file is part of GNUnet.
3 (C) 2001 - 2011 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @author Bartlomiej Polot
23 * @file mesh/mesh_protocol_enc.h
24 */
25
26#ifndef MESH_PROTOCOL_ENC_H_
27#define MESH_PROTOCOL_ENC_H_
28
29#ifdef __cplusplus
30extern "C"
31{
32#if 0
33 /* keep Emacsens' auto-indent happy */
34}
35#endif
36#endif
37
38/******************************************************************************/
39/******************** MESH NETWORK MESSAGES **************************/
40/******************************************************************************/
41
42GNUNET_NETWORK_STRUCT_BEGIN
43
44/**
45 * Message for mesh path creation.
46 */
47struct GNUNET_MESH_CreateTunnel
48{
49 /**
50 * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE
51 *
52 * Size: sizeof(struct GNUNET_MESH_ManipulatePath) +
53 * path_length * sizeof (struct GNUNET_PeerIdentity)
54 */
55 struct GNUNET_MessageHeader header;
56
57 /**
58 * Global id of the tunnel this path belongs to,
59 * unique in conjunction with the origin.
60 */
61 uint32_t tid GNUNET_PACKED;
62
63 /**
64 * Tunnel options (GNUNET_MESH_OPTION_*).
65 */
66 uint32_t opt GNUNET_PACKED;
67
68 /**
69 * Destination port.
70 */
71 uint32_t port GNUNET_PACKED;
72
73 /**
74 * TODO do not add the first hop
75 * path_length structs defining the *whole* path from the origin [0] to the
76 * final destination [path_length-1].
77 */
78 /* struct GNUNET_PeerIdentity peers[path_length]; */
79};
80
81
82/**
83 * Message for mesh data traffic.
84 */
85struct GNUNET_MESH_Data
86{
87 /**
88 * Type: GNUNET_MESSAGE_TYPE_MESH_UNICAST,
89 * GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN
90 */
91 struct GNUNET_MessageHeader header;
92
93 /**
94 * TID of the tunnel
95 */
96 uint32_t tid GNUNET_PACKED;
97
98 /**
99 * Number of hops to live
100 */
101 uint32_t ttl GNUNET_PACKED;
102
103 /**
104 * ID of the packet
105 */
106 uint32_t pid GNUNET_PACKED;
107
108 /**
109 * OID of the tunnel
110 */
111 struct GNUNET_PeerIdentity oid;
112
113 /**
114 * Unique ID of the payload message
115 */
116 uint32_t mid GNUNET_PACKED;
117
118 /**
119 * Payload follows
120 */
121};
122
123
124/**
125 * Message to acknowledge end-to-end data.
126 */
127struct GNUNET_MESH_DataACK
128{
129 /**
130 * Type: GNUNET_MESSAGE_TYPE_MESH_DATA_ACK
131 */
132 struct GNUNET_MessageHeader header;
133
134 /**
135 * TID of the tunnel
136 */
137 uint32_t tid GNUNET_PACKED;
138
139 /**
140 * OID of the tunnel
141 */
142 struct GNUNET_PeerIdentity oid;
143
144 /**
145 * Bitfield of already-received newer messages
146 * pid + 1 @ LSB
147 * pid + 64 @ MSB
148 */
149 uint64_t futures GNUNET_PACKED;
150
151 /**
152 * Last message ID received.
153 */
154 uint32_t mid GNUNET_PACKED;
155};
156
157
158/**
159 * Message to acknowledge mesh data traffic.
160 */
161struct GNUNET_MESH_ACK
162{
163 /**
164 * Type: GNUNET_MESSAGE_TYPE_MESH_ACK
165 */
166 struct GNUNET_MessageHeader header;
167
168 /**
169 * TID of the tunnel
170 */
171 uint32_t tid GNUNET_PACKED;
172
173 /**
174 * OID of the tunnel
175 */
176 struct GNUNET_PeerIdentity oid;
177
178 /**
179 * Maximum packet ID authorized.
180 */
181 uint32_t pid GNUNET_PACKED;
182};
183
184
185/**
186 * Message to query a peer about its Flow Control status regarding a tunnel.
187 */
188struct GNUNET_MESH_Poll
189{
190 /**
191 * Type: GNUNET_MESSAGE_TYPE_MESH_POLL
192 */
193 struct GNUNET_MessageHeader header;
194
195 /**
196 * TID of the tunnel
197 */
198 uint32_t tid GNUNET_PACKED;
199
200 /**
201 * OID of the tunnel
202 */
203 struct GNUNET_PeerIdentity oid;
204
205 /**
206 * Last packet sent.
207 */
208 uint32_t pid GNUNET_PACKED;
209};
210
211/**
212 * Message for ack'ing a path
213 */
214struct GNUNET_MESH_PathACK
215{
216 /**
217 * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_ACK
218 */
219 struct GNUNET_MessageHeader header;
220
221 /**
222 * TID of the tunnel
223 */
224 uint32_t tid GNUNET_PACKED;
225
226 /**
227 * OID of the tunnel
228 */
229 struct GNUNET_PeerIdentity oid;
230
231 /**
232 * ID of the endpoint
233 */
234 struct GNUNET_PeerIdentity peer_id;
235
236 /**
237 * Initial ACK value for payload.
238 */
239 uint32_t ack GNUNET_PACKED;
240
241 /* TODO: signature */
242};
243
244
245/**
246 * Message for notifying a disconnection in a path
247 */
248struct GNUNET_MESH_PathBroken
249{
250 /**
251 * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_BROKEN
252 */
253 struct GNUNET_MessageHeader header;
254
255 /**
256 * TID of the tunnel
257 */
258 uint32_t tid GNUNET_PACKED;
259
260 /**
261 * OID of the tunnel
262 */
263 struct GNUNET_PeerIdentity oid;
264
265 /**
266 * ID of the endpoint
267 */
268 struct GNUNET_PeerIdentity peer1;
269
270 /**
271 * ID of the endpoint
272 */
273 struct GNUNET_PeerIdentity peer2;
274
275 /* TODO: signature */
276};
277
278
279/**
280 * Message to destroy a tunnel
281 */
282struct GNUNET_MESH_TunnelDestroy
283{
284 /**
285 * Type: GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY
286 */
287 struct GNUNET_MessageHeader header;
288
289 /**
290 * TID of the tunnel
291 */
292 uint32_t tid GNUNET_PACKED;
293
294 /**
295 * OID of the tunnel
296 */
297 struct GNUNET_PeerIdentity oid;
298
299 /* TODO: signature */
300};
301
302
303/**
304 * Message to destroy a tunnel
305 */
306struct GNUNET_MESH_TunnelKeepAlive
307{
308 /**
309 * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_(FWD|BCK)_KEEPALIVE
310 */
311 struct GNUNET_MessageHeader header;
312
313 /**
314 * TID of the tunnel
315 */
316 uint32_t tid GNUNET_PACKED;
317
318 /**
319 * OID of the tunnel
320 */
321 struct GNUNET_PeerIdentity oid;
322};
323
324
325
326GNUNET_NETWORK_STRUCT_END
327
328#if 0 /* keep Emacsens' auto-indent happy */
329{
330#endif
331#ifdef __cplusplus
332}
333#endif
334
335/* ifndef MESH_PROTOCOL_H */
336#endif
337/* end of mesh_protocol.h */