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"
35 struct GNUNET_MESH_TunnelMessage;
39 /* keep Emacsens' auto-indent happy */
44 /******************************************************************************/
45 /******************** MESH NETWORK MESSAGES **************************/
46 /******************************************************************************/
48 GNUNET_NETWORK_STRUCT_BEGIN
51 * Message for mesh connection creation.
52 * TODO onionify path, add random tunnel ID
54 struct GNUNET_MESH_ConnectionCreate
57 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE
59 * Size: sizeof(struct GNUNET_MESH_ManipulatePath) +
60 * path_length * sizeof (struct GNUNET_PeerIdentity)
62 struct GNUNET_MessageHeader header;
65 * ID of the connection for that tunnel.
67 uint32_t cid GNUNET_PACKED;
72 struct GNUNET_HashCode tid;
75 * path_length structs defining the *whole* path from the origin [0] to the
76 * final destination [path_length-1].
78 /* struct GNUNET_PeerIdentity peers[path_length]; */
82 * Message for ack'ing a connection
84 struct GNUNET_MESH_ConnectionACK
87 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK
89 struct GNUNET_MessageHeader header;
92 * ID of the connection
94 uint32_t cid GNUNET_PACKED;
99 struct GNUNET_HashCode tid;
101 /* TODO: signature */
105 * Tunnel(ed) message.
107 struct GNUNET_MESH_Encrypted
110 * Type: GNUNET_MESSAGE_TYPE_MESH_{FWD,BCK}
112 struct GNUNET_MessageHeader header;
115 * ID of the connection.
117 uint32_t cid GNUNET_PACKED;
122 struct GNUNET_HashCode tid;
125 * ID of the packet (hop by hop).
127 uint32_t pid GNUNET_PACKED;
130 * Number of hops to live.
132 uint32_t ttl GNUNET_PACKED;
135 * Initialization Vector for payload encryption.
140 * Encrypted content follows.
144 struct GNUNET_MESH_ChannelCreate
147 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE
149 struct GNUNET_MessageHeader header;
154 MESH_ChannelNumber chid GNUNET_PACKED;
159 uint32_t port GNUNET_PACKED;
164 uint32_t opt GNUNET_PACKED;
167 struct GNUNET_MESH_ChannelManage
170 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_{ACK|DESTROY}
172 struct GNUNET_MessageHeader header;
177 MESH_ChannelNumber chid GNUNET_PACKED;
181 * Message for mesh data traffic.
183 struct GNUNET_MESH_Data
186 * Type: GNUNET_MESSAGE_TYPE_MESH_UNICAST,
187 * GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN
189 struct GNUNET_MessageHeader header;
192 * Unique ID of the payload message
194 uint32_t mid GNUNET_PACKED;
199 MESH_ChannelNumber chid GNUNET_PACKED;
208 * Message to acknowledge end-to-end data.
210 struct GNUNET_MESH_DataACK
213 * Type: GNUNET_MESSAGE_TYPE_MESH_DATA_ACK
215 struct GNUNET_MessageHeader header;
220 MESH_ChannelNumber chid GNUNET_PACKED;
223 * Bitfield of already-received newer messages
227 uint64_t futures GNUNET_PACKED;
230 * Last message ID received.
232 uint32_t mid GNUNET_PACKED;
237 * Message to acknowledge mesh data traffic.
239 struct GNUNET_MESH_ACK
242 * Type: GNUNET_MESSAGE_TYPE_MESH_ACK
244 struct GNUNET_MessageHeader header;
247 * Maximum packet ID authorized.
249 uint32_t ack GNUNET_PACKED;
254 struct GNUNET_HashCode tid;
257 * ID of the connection
259 uint32_t cid GNUNET_PACKED;
264 * Message to query a peer about its Flow Control status regarding a tunnel.
266 struct GNUNET_MESH_Poll
269 * Type: GNUNET_MESSAGE_TYPE_MESH_POLL
271 struct GNUNET_MessageHeader header;
276 uint32_t pid GNUNET_PACKED;
281 struct GNUNET_HashCode tid;
284 * ID of the connection
286 uint32_t cid GNUNET_PACKED;
291 * Message for notifying a disconnection in a path
293 struct GNUNET_MESH_ConnectionBroken
296 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN
298 struct GNUNET_MessageHeader header;
301 * ID of the connection.
303 uint32_t cid GNUNET_PACKED;
308 struct GNUNET_HashCode tid;
313 struct GNUNET_PeerIdentity peer1;
318 struct GNUNET_PeerIdentity peer2;
320 /* TODO: signature */
325 * Message to destroy a connection.
327 struct GNUNET_MESH_ConnectionDestroy
330 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY
332 struct GNUNET_MessageHeader header;
335 * ID of the connection.
337 uint32_t cid GNUNET_PACKED;
342 struct GNUNET_HashCode tid;
344 /* TODO: signature */
349 * Message to keep a connection alive.
351 struct GNUNET_MESH_ConnectionKeepAlive
354 * Type: GNUNET_MESSAGE_TYPE_MESH_(FWD|BCK)_KEEPALIVE
356 struct GNUNET_MessageHeader header;
359 * ID of the connection
361 uint32_t cid GNUNET_PACKED;
366 struct GNUNET_HashCode tid;
371 GNUNET_NETWORK_STRUCT_END
373 #if 0 /* keep Emacsens' auto-indent happy */
380 /* ifndef MESH_PROTOCOL_H */
382 /* end of mesh_protocol.h */