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;
101 * Message for encapsulation of a Key eXchange message in a connection.
103 struct GNUNET_MESH_KX
106 * Type: GNUNET_MESSAGE_TYPE_MESH_KX.
108 struct GNUNET_MessageHeader header;
113 uint32_t reserved GNUNET_PACKED;
116 * ID of the connection.
118 struct GNUNET_HashCode cid;
120 /* Specific KX message follows. */
125 * Message transmitted with the signed ephemeral key of a peer. The
126 * session key is then derived from the two ephemeral keys (ECDHE).
128 * As far as possible, same as CORE's EphemeralKeyMessage.
130 struct GNUNET_MESH_KX_Ephemeral
134 * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_EPHEMERAL.
136 struct GNUNET_MessageHeader header;
139 * Status of the sender (should be in "enum PeerStateMachine"), nbo.
141 int32_t sender_status GNUNET_PACKED;
144 * An ECC signature of the 'origin' asserting the validity of
145 * the given ephemeral key.
147 struct GNUNET_CRYPTO_EddsaSignature signature;
150 * Information about what is being signed.
152 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
155 * At what time was this key created (beginning of validity).
157 struct GNUNET_TIME_AbsoluteNBO creation_time;
160 * When does the given ephemeral key expire (end of validity).
162 struct GNUNET_TIME_AbsoluteNBO expiration_time;
165 * Ephemeral public ECC key (always for NIST P-521) encoded in a format suitable
166 * for network transmission as created using 'gcry_sexp_sprint'.
168 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
171 * Public key of the signing peer (persistent version, not the ephemeral public key).
173 struct GNUNET_PeerIdentity origin_identity;
178 * We're sending an (encrypted) PING to the other peer to check if he
179 * can decrypt. The other peer should respond with a PONG with the
180 * same content, except this time encrypted with the receiver's key.
182 struct GNUNET_MESH_KX_Ping
185 * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_PING.
187 struct GNUNET_MessageHeader header;
192 uint32_t iv GNUNET_PACKED;
195 * Intended target of the PING, used primarily to check
196 * that decryption actually worked.
198 struct GNUNET_PeerIdentity target;
201 * Random number chosen to make reply harder.
203 uint32_t nonce GNUNET_PACKED;
208 * Response to a PING. Includes data from the original PING.
210 struct GNUNET_MESH_KX_Pong
213 * Message type is GNUNET_MESSAGE_TYPE_MESH_KX_PONG.
215 struct GNUNET_MessageHeader header;
220 uint32_t iv GNUNET_PACKED;
223 * Intended target of the PING, used primarily to check
224 * that decryption actually worked.
226 struct GNUNET_PeerIdentity target;
229 * Same nonce as in the reve.
231 uint32_t nonce GNUNET_PACKED;
236 * Tunnel(ed) message.
238 struct GNUNET_MESH_Encrypted
241 * Type: GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED
243 struct GNUNET_MessageHeader header;
246 * Initialization Vector for payload encryption.
248 uint32_t iv GNUNET_PACKED;
251 * ID of the connection.
253 struct GNUNET_HashCode cid;
256 * ID of the packet (hop by hop).
258 uint32_t pid GNUNET_PACKED;
261 * Number of hops to live.
263 uint32_t ttl GNUNET_PACKED;
266 * Encrypted content follows.
270 struct GNUNET_MESH_ChannelCreate
273 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE
275 struct GNUNET_MessageHeader header;
280 MESH_ChannelNumber chid GNUNET_PACKED;
285 uint32_t port GNUNET_PACKED;
290 uint32_t opt GNUNET_PACKED;
293 struct GNUNET_MESH_ChannelManage
296 * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_{ACK|DESTROY}
298 struct GNUNET_MessageHeader header;
303 MESH_ChannelNumber chid GNUNET_PACKED;
307 * Message for mesh data traffic.
309 struct GNUNET_MESH_Data
312 * Type: GNUNET_MESSAGE_TYPE_MESH_UNICAST,
313 * GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN
315 struct GNUNET_MessageHeader header;
318 * Unique ID of the payload message
320 uint32_t mid GNUNET_PACKED;
325 MESH_ChannelNumber chid GNUNET_PACKED;
334 * Message to acknowledge end-to-end data.
336 struct GNUNET_MESH_DataACK
339 * Type: GNUNET_MESSAGE_TYPE_MESH_DATA_ACK
341 struct GNUNET_MessageHeader header;
346 MESH_ChannelNumber chid GNUNET_PACKED;
349 * Bitfield of already-received newer messages
353 uint64_t futures GNUNET_PACKED;
356 * Last message ID received.
358 uint32_t mid GNUNET_PACKED;
363 * Message to acknowledge mesh encrypted traffic.
365 struct GNUNET_MESH_ACK
368 * Type: GNUNET_MESSAGE_TYPE_MESH_ACK
370 struct GNUNET_MessageHeader header;
373 * Maximum packet ID authorized.
375 uint32_t ack GNUNET_PACKED;
378 * ID of the connection.
380 struct GNUNET_HashCode cid;
385 * Message to query a peer about its Flow Control status regarding a tunnel.
387 struct GNUNET_MESH_Poll
390 * Type: GNUNET_MESSAGE_TYPE_MESH_POLL
392 struct GNUNET_MessageHeader header;
397 uint32_t pid GNUNET_PACKED;
400 * ID of the connection.
402 struct GNUNET_HashCode cid;
408 * Message for notifying a disconnection in a path
410 struct GNUNET_MESH_ConnectionBroken
413 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN
415 struct GNUNET_MessageHeader header;
420 uint32_t reserved GNUNET_PACKED;
423 * ID of the connection.
425 struct GNUNET_HashCode cid;
430 struct GNUNET_PeerIdentity peer1;
435 struct GNUNET_PeerIdentity peer2;
437 /* TODO: signature */
442 * Message to destroy a connection.
444 struct GNUNET_MESH_ConnectionDestroy
447 * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY
449 struct GNUNET_MessageHeader header;
454 uint32_t reserved GNUNET_PACKED;
457 * ID of the connection.
459 struct GNUNET_HashCode cid;
461 /* TODO: signature */
466 * Message to keep a connection alive.
468 struct GNUNET_MESH_ConnectionKeepAlive
471 * Type: GNUNET_MESSAGE_TYPE_MESH_(FWD|BCK)_KEEPALIVE
473 struct GNUNET_MessageHeader header;
478 uint32_t reserved GNUNET_PACKED;
481 * ID of the connection.
483 struct GNUNET_HashCode cid;
488 GNUNET_NETWORK_STRUCT_END
490 #if 0 /* keep Emacsens' auto-indent happy */
497 /* ifndef MESH_PROTOCOL_H */
499 /* end of mesh_protocol.h */