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_MESH_Hash 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;
86 * ID of the connection.
88 struct GNUNET_MESH_Hash cid;
94 * Message for encapsulation of a Key eXchange message in a connection.
99 * Type: GNUNET_MESSAGE_TYPE_MESH_KX.
101 struct GNUNET_MessageHeader header;
104 * ID of the connection.
106 struct GNUNET_MESH_Hash cid;
108 /* Specific KX message follows. */
113 * Message transmitted with the signed ephemeral key of a peer. The
114 * session key is then derived from the two ephemeral keys (ECDHE).
116 * As far as possible, same as CORE's EphemeralKeyMessage.
118 struct GNUNET_MESH_KX_Ephemeral
122 * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL.
124 struct GNUNET_MessageHeader header;
127 * Status of the sender (should be in "enum PeerStateMachine"), nbo.
129 int32_t sender_status GNUNET_PACKED;
132 * An ECC signature of the 'origin' asserting the validity of
133 * the given ephemeral key.
135 struct GNUNET_CRYPTO_EddsaSignature signature;
138 * Information about what is being signed.
140 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
143 * At what time was this key created (beginning of validity).
145 struct GNUNET_TIME_AbsoluteNBO creation_time;
148 * When does the given ephemeral key expire (end of validity).
150 struct GNUNET_TIME_AbsoluteNBO expiration_time;
153 * Ephemeral public ECC key (always for NIST P-521) encoded in a format suitable
154 * for network transmission as created using 'gcry_sexp_sprint'.
156 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
159 * Public key of the signing peer (persistent version, not the ephemeral public key).
161 struct GNUNET_PeerIdentity origin_identity;
166 * We're sending an (encrypted) PING to the other peer to check if he
167 * can decrypt. The other peer should respond with a PONG with the
168 * same content, except this time encrypted with the receiver's key.
170 struct GNUNET_MESH_KX_Ping
173 * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_PING.
175 struct GNUNET_MessageHeader header;
180 uint32_t iv GNUNET_PACKED;
183 * Intended target of the PING, used primarily to check
184 * that decryption actually worked.
186 struct GNUNET_PeerIdentity target;
189 * Random number chosen to make reply harder.
191 uint32_t nonce GNUNET_PACKED;
196 * Response to a PING. Includes data from the original PING.
198 struct GNUNET_MESH_KX_Pong
201 * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_PONG.
203 struct GNUNET_MessageHeader header;
208 uint32_t iv GNUNET_PACKED;
211 * Same nonce as in the reve.
213 uint32_t nonce GNUNET_PACKED;
218 * Tunnel(ed) message.
220 struct GNUNET_MESH_Encrypted
223 * Type: GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED
225 struct GNUNET_MessageHeader header;
228 * ID of the connection.
230 struct GNUNET_MESH_Hash cid;
233 * ID of the packet (hop by hop).
235 uint32_t pid GNUNET_PACKED;
238 * Number of hops to live.
240 uint32_t ttl GNUNET_PACKED;
243 * Initialization Vector for payload encryption.
245 uint32_t iv GNUNET_PACKED;
248 * MAC of the encrypted message, used to verify message integrity.
249 * Everything after this value will be encrypted and authenticated.
251 struct GNUNET_MESH_Hash hmac;
254 * Encrypted content follows.
260 * Message to create a Channel.
262 struct GNUNET_MESH_ChannelCreate
265 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE
267 struct GNUNET_MessageHeader header;
272 MESH_ChannelNumber chid GNUNET_PACKED;
277 uint32_t port GNUNET_PACKED;
282 uint32_t opt GNUNET_PACKED;
287 * Message to manage a Channel (ACK, NACK, Destroy).
289 struct GNUNET_MESH_ChannelManage
292 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_{ACK|NACK|DESTROY}
294 struct GNUNET_MessageHeader header;
299 MESH_ChannelNumber chid GNUNET_PACKED;
304 * Message for mesh data traffic.
306 struct GNUNET_MESH_Data
309 * Type: GNUNET_MESSAGE_TYPE_MESH_UNICAST,
310 * GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN
312 struct GNUNET_MessageHeader header;
315 * Unique ID of the payload message
317 uint32_t mid GNUNET_PACKED;
322 MESH_ChannelNumber chid GNUNET_PACKED;
331 * Message to acknowledge end-to-end data.
333 struct GNUNET_MESH_DataACK
336 * Type: GNUNET_MESSAGE_TYPE_MESH_DATA_ACK
338 struct GNUNET_MessageHeader header;
343 MESH_ChannelNumber chid GNUNET_PACKED;
346 * Bitfield of already-received newer messages
350 uint64_t futures GNUNET_PACKED;
353 * Last message ID received.
355 uint32_t mid GNUNET_PACKED;
360 * Message to acknowledge mesh encrypted traffic.
362 struct GNUNET_MESH_ACK
365 * Type: GNUNET_MESSAGE_TYPE_MESH_ACK
367 struct GNUNET_MessageHeader header;
370 * Maximum packet ID authorized.
372 uint32_t ack GNUNET_PACKED;
375 * ID of the connection.
377 struct GNUNET_MESH_Hash cid;
382 * Message to query a peer about its Flow Control status regarding a tunnel.
384 struct GNUNET_MESH_Poll
387 * Type: GNUNET_MESSAGE_TYPE_MESH_POLL
389 struct GNUNET_MessageHeader header;
394 uint32_t pid GNUNET_PACKED;
397 * ID of the connection.
399 struct GNUNET_MESH_Hash cid;
405 * Message for notifying a disconnection in a path
407 struct GNUNET_MESH_ConnectionBroken
410 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN
412 struct GNUNET_MessageHeader header;
415 * ID of the connection.
417 struct GNUNET_MESH_Hash cid;
422 struct GNUNET_PeerIdentity peer1;
427 struct GNUNET_PeerIdentity peer2;
432 * Message to destroy a connection.
434 struct GNUNET_MESH_ConnectionDestroy
437 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY
439 struct GNUNET_MessageHeader header;
442 * ID of the connection.
444 struct GNUNET_MESH_Hash cid;
448 GNUNET_NETWORK_STRUCT_END
450 #if 0 /* keep Emacsens' auto-indent happy */
457 /* ifndef MESH_PROTOCOL_H */
459 /* end of mesh_protocol.h */