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.h
26 #ifndef MESH_PROTOCOL_H_
27 #define MESH_PROTOCOL_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.
53 struct GNUNET_MESH_ConnectionCreate
56 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE
58 * Size: sizeof (struct GNUNET_MESH_ConnectionCreate) +
59 * path_length * sizeof (struct GNUNET_PeerIdentity)
61 struct GNUNET_MessageHeader header;
64 * ID of the connection
66 struct GNUNET_HashCode cid;
69 * path_length structs defining the *whole* path from the origin [0] to the
70 * final destination [path_length-1].
72 /* struct GNUNET_PeerIdentity peers[path_length]; */
76 * Message for ack'ing a connection
78 struct GNUNET_MESH_ConnectionACK
81 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK
83 struct GNUNET_MessageHeader header;
88 uint32_t reserved GNUNET_PACKED;
91 * ID of the connection.
93 struct GNUNET_HashCode cid;
100 * Message for encapsulation of a Key eXchange message in a connection.
102 struct GNUNET_MESH_KX
105 * Type: GNUNET_MESSAGE_TYPE_MESH_KX.
107 struct GNUNET_MessageHeader header;
112 uint32_t reserved GNUNET_PACKED;
115 * ID of the connection.
117 struct GNUNET_HashCode cid;
119 /* Specific KX message follows. */
124 * Message transmitted with the signed ephemeral key of a peer. The
125 * session key is then derived from the two ephemeral keys (ECDHE).
127 * As far as possible, same as CORE's EphemeralKeyMessage.
129 struct GNUNET_MESH_KX_Ephemeral
133 * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL.
135 struct GNUNET_MessageHeader header;
138 * Status of the sender (should be in "enum PeerStateMachine"), nbo.
140 int32_t sender_status GNUNET_PACKED;
143 * An ECC signature of the 'origin' asserting the validity of
144 * the given ephemeral key.
146 struct GNUNET_CRYPTO_EddsaSignature signature;
149 * Information about what is being signed.
151 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
154 * At what time was this key created (beginning of validity).
156 struct GNUNET_TIME_AbsoluteNBO creation_time;
159 * When does the given ephemeral key expire (end of validity).
161 struct GNUNET_TIME_AbsoluteNBO expiration_time;
164 * Ephemeral public ECC key (always for NIST P-521) encoded in a format suitable
165 * for network transmission as created using 'gcry_sexp_sprint'.
167 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
170 * Public key of the signing peer (persistent version, not the ephemeral public key).
172 struct GNUNET_PeerIdentity origin_identity;
177 * We're sending an (encrypted) PING to the other peer to check if he
178 * can decrypt. The other peer should respond with a PONG with the
179 * same content, except this time encrypted with the receiver's key.
181 struct GNUNET_MESH_KX_Ping
184 * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_PING.
186 struct GNUNET_MessageHeader header;
191 uint32_t iv GNUNET_PACKED;
194 * Intended target of the PING, used primarily to check
195 * that decryption actually worked.
197 struct GNUNET_PeerIdentity target;
200 * Random number chosen to make reply harder.
202 uint32_t nonce GNUNET_PACKED;
207 * Response to a PING. Includes data from the original PING.
209 struct GNUNET_MESH_KX_Pong
212 * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_PONG.
214 struct GNUNET_MessageHeader header;
219 uint32_t iv GNUNET_PACKED;
222 * Same nonce as in the reve.
224 uint32_t nonce GNUNET_PACKED;
229 * Tunnel(ed) message.
231 struct GNUNET_MESH_Encrypted
234 * Type: GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED
236 struct GNUNET_MessageHeader header;
239 * Initialization Vector for payload encryption.
241 uint32_t iv GNUNET_PACKED;
244 * ID of the connection.
246 struct GNUNET_HashCode cid;
249 * ID of the packet (hop by hop).
251 uint32_t pid GNUNET_PACKED;
254 * Number of hops to live.
256 uint32_t ttl GNUNET_PACKED;
259 * Encrypted content follows.
263 struct GNUNET_MESH_ChannelCreate
266 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE
268 struct GNUNET_MessageHeader header;
273 MESH_ChannelNumber chid GNUNET_PACKED;
278 uint32_t port GNUNET_PACKED;
283 uint32_t opt GNUNET_PACKED;
286 struct GNUNET_MESH_ChannelManage
289 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_{ACK|NACK|DESTROY}
291 struct GNUNET_MessageHeader header;
296 MESH_ChannelNumber chid GNUNET_PACKED;
300 * Message for mesh data traffic.
302 struct GNUNET_MESH_Data
305 * Type: GNUNET_MESSAGE_TYPE_MESH_UNICAST,
306 * GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN
308 struct GNUNET_MessageHeader header;
311 * Unique ID of the payload message
313 uint32_t mid GNUNET_PACKED;
318 MESH_ChannelNumber chid GNUNET_PACKED;
327 * Message to acknowledge end-to-end data.
329 struct GNUNET_MESH_DataACK
332 * Type: GNUNET_MESSAGE_TYPE_MESH_DATA_ACK
334 struct GNUNET_MessageHeader header;
339 MESH_ChannelNumber chid GNUNET_PACKED;
342 * Bitfield of already-received newer messages
346 uint64_t futures GNUNET_PACKED;
349 * Last message ID received.
351 uint32_t mid GNUNET_PACKED;
356 * Message to acknowledge mesh encrypted traffic.
358 struct GNUNET_MESH_ACK
361 * Type: GNUNET_MESSAGE_TYPE_MESH_ACK
363 struct GNUNET_MessageHeader header;
366 * Maximum packet ID authorized.
368 uint32_t ack GNUNET_PACKED;
371 * ID of the connection.
373 struct GNUNET_HashCode cid;
378 * Message to query a peer about its Flow Control status regarding a tunnel.
380 struct GNUNET_MESH_Poll
383 * Type: GNUNET_MESSAGE_TYPE_MESH_POLL
385 struct GNUNET_MessageHeader header;
390 uint32_t pid GNUNET_PACKED;
393 * ID of the connection.
395 struct GNUNET_HashCode cid;
401 * Message for notifying a disconnection in a path
403 struct GNUNET_MESH_ConnectionBroken
406 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN
408 struct GNUNET_MessageHeader header;
413 uint32_t reserved GNUNET_PACKED;
416 * ID of the connection.
418 struct GNUNET_HashCode cid;
423 struct GNUNET_PeerIdentity peer1;
428 struct GNUNET_PeerIdentity peer2;
430 /* TODO: signature */
435 * Message to destroy a connection.
437 struct GNUNET_MESH_ConnectionDestroy
440 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY
442 struct GNUNET_MessageHeader header;
447 uint32_t reserved GNUNET_PACKED;
450 * ID of the connection.
452 struct GNUNET_HashCode cid;
454 /* TODO: signature */
459 * Message to keep a connection alive.
461 struct GNUNET_MESH_ConnectionKeepAlive
464 * Type: GNUNET_MESSAGE_TYPE_MESH_(FWD|BCK)_KEEPALIVE
466 struct GNUNET_MessageHeader header;
471 uint32_t reserved GNUNET_PACKED;
474 * ID of the connection.
476 struct GNUNET_HashCode cid;
481 GNUNET_NETWORK_STRUCT_END
483 #if 0 /* keep Emacsens' auto-indent happy */
490 /* ifndef MESH_PROTOCOL_H */
492 /* end of mesh_protocol.h */