2 This file is part of GNUnet.
3 (C) 2001 - 2011 Christian Grothoff (and other contributing authors)
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.
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.
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.
22 * @author Bartlomiej Polot
23 * @file mesh/mesh_protocol_enc.h
26 #ifndef MESH_PROTOCOL_ENC_H_
27 #define MESH_PROTOCOL_ENC_H_
30 #include "gnunet_util_lib.h"
34 struct GNUNET_MESH_TunnelMessage;
38 /* keep Emacsens' auto-indent happy */
43 /******************************************************************************/
44 /******************** MESH NETWORK MESSAGES **************************/
45 /******************************************************************************/
47 GNUNET_NETWORK_STRUCT_BEGIN
50 * Message for mesh connection creation.
51 * TODO onionify path, add random tunnel ID
53 struct GNUNET_MESH_ConnectionCreate
56 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE
58 * Size: sizeof(struct GNUNET_MESH_ManipulatePath) +
59 * path_length * sizeof (struct GNUNET_PeerIdentity)
61 struct GNUNET_MessageHeader header;
64 * ID of the connection for that tunnel.
66 uint32_t cid GNUNET_PACKED;
71 struct GNUNET_HashCode tid;
74 * path_length structs defining the *whole* path from the origin [0] to the
75 * final destination [path_length-1].
77 /* struct GNUNET_PeerIdentity peers[path_length]; */
81 * Message for ack'ing a connection
83 struct GNUNET_MESH_ConnectionACK
86 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK
88 struct GNUNET_MessageHeader header;
91 * ID of the connection
93 uint32_t cid GNUNET_PACKED;
98 struct GNUNET_HashCode tid;
100 /* TODO: signature */
104 * Tunnel(ed) message.
106 struct GNUNET_MESH_Encrypted
109 * Type: GNUNET_MESSAGE_TYPE_MESH_{FWD,BCK}
111 struct GNUNET_MessageHeader header;
114 * ID of the connection.
116 uint32_t cid GNUNET_PACKED;
121 struct GNUNET_HashCode tid;
124 * ID of the packet (hop by hop).
126 uint32_t pid GNUNET_PACKED;
129 * Number of hops to live.
131 uint32_t ttl GNUNET_PACKED;
134 * Initialization Vector for payload encryption.
139 * Encrypted content follows.
143 struct GNUNET_MESH_ChannelCreate
146 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE
148 struct GNUNET_MessageHeader header;
153 uint32_t chid GNUNET_PACKED;
158 uint32_t opt GNUNET_PACKED;
161 struct GNUNET_MESH_ChannelDestroy
164 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY
166 struct GNUNET_MessageHeader header;
171 uint32_t chid GNUNET_PACKED;
175 * Message for mesh data traffic.
177 struct GNUNET_MESH_Data
180 * Type: GNUNET_MESSAGE_TYPE_MESH_UNICAST,
181 * GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN
183 struct GNUNET_MessageHeader header;
186 * Unique ID of the payload message
188 uint32_t mid GNUNET_PACKED;
193 uint32_t chid GNUNET_PACKED;
202 * Message to acknowledge end-to-end data.
204 struct GNUNET_MESH_DataACK
207 * Type: GNUNET_MESSAGE_TYPE_MESH_DATA_ACK
209 struct GNUNET_MessageHeader header;
214 uint32_t chid GNUNET_PACKED;
217 * Bitfield of already-received newer messages
221 uint64_t futures GNUNET_PACKED;
224 * Last message ID received.
226 uint32_t mid GNUNET_PACKED;
231 * Message to acknowledge mesh data traffic.
233 struct GNUNET_MESH_ACK
236 * Type: GNUNET_MESSAGE_TYPE_MESH_ACK
238 struct GNUNET_MessageHeader header;
241 * Maximum packet ID authorized.
243 uint32_t ack GNUNET_PACKED;
248 * Message to query a peer about its Flow Control status regarding a tunnel.
250 struct GNUNET_MESH_Poll
253 * Type: GNUNET_MESSAGE_TYPE_MESH_POLL
255 struct GNUNET_MessageHeader header;
260 uint32_t pid GNUNET_PACKED;
265 * Message for notifying a disconnection in a path
267 struct GNUNET_MESH_ConnectionBroken
270 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN
272 struct GNUNET_MessageHeader header;
275 * ID of the connection.
277 uint32_t cid GNUNET_PACKED;
282 struct GNUNET_HashCode tid;
287 struct GNUNET_PeerIdentity peer1;
292 struct GNUNET_PeerIdentity peer2;
294 /* TODO: signature */
299 * Message to destroy a connection.
301 struct GNUNET_MESH_ConnectionDestroy
304 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY
306 struct GNUNET_MessageHeader header;
309 * ID of the connection.
311 uint32_t cid GNUNET_PACKED;
316 struct GNUNET_HashCode tid;
318 /* TODO: signature */
323 * Message to keep a connection alive.
325 struct GNUNET_MESH_ConnectionKeepAlive
328 * Type: GNUNET_MESSAGE_TYPE_MESH_(FWD|BCK)_KEEPALIVE
330 struct GNUNET_MessageHeader header;
333 * ID of the connection
335 uint32_t cid GNUNET_PACKED;
340 struct GNUNET_HashCode tid;
345 GNUNET_NETWORK_STRUCT_END
347 #if 0 /* keep Emacsens' auto-indent happy */
354 /* ifndef MESH_PROTOCOL_H */
356 /* end of mesh_protocol.h */