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
67 struct GNUNET_HashCode cid;
70 * path_length structs defining the *whole* path from the origin [0] to the
71 * final destination [path_length-1].
73 /* struct GNUNET_PeerIdentity peers[path_length]; */
77 * Message for ack'ing a connection
79 struct GNUNET_MESH_ConnectionACK
82 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK
84 struct GNUNET_MessageHeader header;
89 uint32_t reserved GNUNET_PACKED;
92 * ID of the connection.
94 struct GNUNET_HashCode cid;
100 * Tunnel(ed) message.
102 struct GNUNET_MESH_Encrypted
105 * Type: GNUNET_MESSAGE_TYPE_MESH_{FWD,BCK}
107 struct GNUNET_MessageHeader header;
110 * ID of the packet (hop by hop).
112 uint32_t pid GNUNET_PACKED;
115 * ID of the connection.
117 struct GNUNET_HashCode cid;
120 * Initialization Vector for payload encryption.
122 uint64_t iv GNUNET_PACKED;
125 * Number of hops to live.
127 uint32_t ttl GNUNET_PACKED;
132 uint32_t reserved GNUNET_PACKED;
135 * Encrypted content follows.
139 struct GNUNET_MESH_ChannelCreate
142 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE
144 struct GNUNET_MessageHeader header;
149 MESH_ChannelNumber chid GNUNET_PACKED;
154 uint32_t port GNUNET_PACKED;
159 uint32_t opt GNUNET_PACKED;
162 struct GNUNET_MESH_ChannelManage
165 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_{ACK|DESTROY}
167 struct GNUNET_MessageHeader header;
172 MESH_ChannelNumber chid GNUNET_PACKED;
176 * Message for mesh data traffic.
178 struct GNUNET_MESH_Data
181 * Type: GNUNET_MESSAGE_TYPE_MESH_UNICAST,
182 * GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN
184 struct GNUNET_MessageHeader header;
187 * Unique ID of the payload message
189 uint32_t mid GNUNET_PACKED;
194 MESH_ChannelNumber chid GNUNET_PACKED;
203 * Message to acknowledge end-to-end data.
205 struct GNUNET_MESH_DataACK
208 * Type: GNUNET_MESSAGE_TYPE_MESH_DATA_ACK
210 struct GNUNET_MessageHeader header;
215 MESH_ChannelNumber chid GNUNET_PACKED;
218 * Bitfield of already-received newer messages
222 uint64_t futures GNUNET_PACKED;
225 * Last message ID received.
227 uint32_t mid GNUNET_PACKED;
232 * Message to acknowledge mesh encrypted traffic.
234 struct GNUNET_MESH_ACK
237 * Type: GNUNET_MESSAGE_TYPE_MESH_ACK
239 struct GNUNET_MessageHeader header;
242 * Maximum packet ID authorized.
244 uint32_t ack GNUNET_PACKED;
247 * ID of the connection.
249 struct GNUNET_HashCode cid;
254 * Message to query a peer about its Flow Control status regarding a tunnel.
256 struct GNUNET_MESH_Poll
259 * Type: GNUNET_MESSAGE_TYPE_MESH_POLL
261 struct GNUNET_MessageHeader header;
266 uint32_t pid GNUNET_PACKED;
269 * ID of the connection.
271 struct GNUNET_HashCode cid;
277 * Message for notifying a disconnection in a path
279 struct GNUNET_MESH_ConnectionBroken
282 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN
284 struct GNUNET_MessageHeader header;
289 uint32_t reserved GNUNET_PACKED;
292 * ID of the connection.
294 struct GNUNET_HashCode cid;
299 struct GNUNET_PeerIdentity peer1;
304 struct GNUNET_PeerIdentity peer2;
306 /* TODO: signature */
311 * Message to destroy a connection.
313 struct GNUNET_MESH_ConnectionDestroy
316 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY
318 struct GNUNET_MessageHeader header;
323 uint32_t reserved GNUNET_PACKED;
326 * ID of the connection.
328 struct GNUNET_HashCode cid;
330 /* TODO: signature */
335 * Message to keep a connection alive.
337 struct GNUNET_MESH_ConnectionKeepAlive
340 * Type: GNUNET_MESSAGE_TYPE_MESH_(FWD|BCK)_KEEPALIVE
342 struct GNUNET_MessageHeader header;
347 uint32_t reserved GNUNET_PACKED;
350 * ID of the connection.
352 struct GNUNET_HashCode cid;
357 GNUNET_NETWORK_STRUCT_END
359 #if 0 /* keep Emacsens' auto-indent happy */
366 /* ifndef MESH_PROTOCOL_H */
368 /* end of mesh_protocol.h */