2 This file is part of GNUnet.
3 Copyright (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 cadet/cadet_protocol.h
26 #ifndef CADET_PROTOCOL_H_
27 #define CADET_PROTOCOL_H_
30 #include "gnunet_util_lib.h"
35 struct GNUNET_CADET_TunnelMessage;
39 /* keep Emacsens' auto-indent happy */
44 /******************************************************************************/
45 /******************** CADET NETWORK MESSAGES **************************/
46 /******************************************************************************/
48 GNUNET_NETWORK_STRUCT_BEGIN
51 * Message for cadet connection creation.
53 struct GNUNET_CADET_ConnectionCreate
56 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE
58 * Size: sizeof (struct GNUNET_CADET_ConnectionCreate) +
59 * path_length * sizeof (struct GNUNET_PeerIdentity)
61 struct GNUNET_MessageHeader header;
64 * ID of the connection
66 struct GNUNET_CADET_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]; */
77 * Message for ack'ing a connection
79 struct GNUNET_CADET_ConnectionACK
82 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK
84 struct GNUNET_MessageHeader header;
87 * ID of the connection.
89 struct GNUNET_CADET_Hash cid;
95 * Message for encapsulation of a Key eXchange message in a connection.
97 struct GNUNET_CADET_KX
100 * Type: GNUNET_MESSAGE_TYPE_CADET_KX.
102 struct GNUNET_MessageHeader header;
105 * ID of the connection.
107 struct GNUNET_CADET_Hash cid;
109 /* Specific KX message follows. */
115 * Message for encapsulation of a Key eXchange message in a connection.
117 struct GNUNET_CADET_AX_KX
120 * Type: GNUNET_MESSAGE_TYPE_CADET_AX_KX.
122 struct GNUNET_MessageHeader header;
125 * Ephemeral public ECC key (always for NIST P-521) encoded in a format
126 * suitable for network transmission as created using 'gcry_sexp_sprint'.
128 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
134 * Message transmitted with the signed ephemeral key of a peer. The
135 * session key is then derived from the two ephemeral keys (ECDHE).
137 * As far as possible, same as CORE's EphemeralKeyMessage.
139 struct GNUNET_CADET_KX_Ephemeral
143 * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL.
145 struct GNUNET_MessageHeader header;
148 * Status of the sender (should be in "enum PeerStateMachine"), nbo.
150 int32_t sender_status GNUNET_PACKED;
153 * An ECC signature of the 'origin' asserting the validity of
154 * the given ephemeral key.
156 struct GNUNET_CRYPTO_EddsaSignature signature;
159 * Information about what is being signed.
161 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
164 * At what time was this key created (beginning of validity).
166 struct GNUNET_TIME_AbsoluteNBO creation_time;
169 * When does the given ephemeral key expire (end of validity).
171 struct GNUNET_TIME_AbsoluteNBO expiration_time;
174 * Ephemeral public ECC key (always for NIST P-521) encoded in a format
175 * suitable for network transmission as created using 'gcry_sexp_sprint'.
177 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
180 * Public key of the signing peer
181 * (persistent version, not the ephemeral public key).
183 struct GNUNET_PeerIdentity origin_identity;
186 * Seed for the IV of nonce.
188 uint32_t iv GNUNET_PACKED;
191 * Nonce to check liveness of peer.
193 uint32_t nonce GNUNET_PACKED;
198 * Response to a PING. Includes data from the original PING.
200 struct GNUNET_CADET_KX_Pong
203 * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_PONG.
205 struct GNUNET_MessageHeader header;
210 uint32_t iv GNUNET_PACKED;
213 * Same nonce as in the reve.
215 uint32_t nonce GNUNET_PACKED;
220 * Tunnel(ed) message.
222 struct GNUNET_CADET_Encrypted
225 * Type: GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED
227 struct GNUNET_MessageHeader header;
230 * ID of the connection.
232 struct GNUNET_CADET_Hash cid;
235 * ID of the packet (hop by hop).
237 uint32_t pid GNUNET_PACKED;
240 * Number of hops to live.
242 uint32_t ttl GNUNET_PACKED;
245 * Initialization Vector for payload encryption.
247 uint32_t iv GNUNET_PACKED;
250 * MAC of the encrypted message, used to verify message integrity.
251 * Everything after this value will be encrypted and authenticated.
253 struct GNUNET_CADET_Hash hmac;
256 * Encrypted content follows.
262 * Axolotl tunnel message.
264 struct GNUNET_CADET_AX
267 * Type: GNUNET_MESSAGE_TYPE_CADET_AXOLOTL_DATA
269 struct GNUNET_MessageHeader header;
272 * ID of the connection.
274 struct GNUNET_CADET_Hash cid;
277 * ID of the packet (hop by hop).
279 uint32_t pid GNUNET_PACKED;
282 * Number of hops to live.
284 uint32_t ttl GNUNET_PACKED;
287 * Initialization Vector for payload encryption.
289 uint32_t iv GNUNET_PACKED;
292 * MAC of the encrypted message, used to verify message integrity.
293 * Everything after this value will be encrypted and authenticated.
295 struct GNUNET_CADET_Hash hmac;
298 * Encrypted content follows.
304 * Message to create a Channel.
306 struct GNUNET_CADET_ChannelCreate
309 * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
311 struct GNUNET_MessageHeader header;
316 CADET_ChannelNumber chid GNUNET_PACKED;
321 uint32_t port GNUNET_PACKED;
326 uint32_t opt GNUNET_PACKED;
331 * Message to manage a Channel (ACK, NACK, Destroy).
333 struct GNUNET_CADET_ChannelManage
336 * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY}
338 struct GNUNET_MessageHeader header;
343 CADET_ChannelNumber chid GNUNET_PACKED;
348 * Message for cadet data traffic.
350 struct GNUNET_CADET_Data
353 * Type: GNUNET_MESSAGE_TYPE_CADET_UNICAST,
354 * GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
356 struct GNUNET_MessageHeader header;
359 * Unique ID of the payload message
361 uint32_t mid GNUNET_PACKED;
366 CADET_ChannelNumber chid GNUNET_PACKED;
375 * Message to acknowledge end-to-end data.
377 struct GNUNET_CADET_DataACK
380 * Type: GNUNET_MESSAGE_TYPE_CADET_DATA_ACK
382 struct GNUNET_MessageHeader header;
387 CADET_ChannelNumber chid GNUNET_PACKED;
390 * Bitfield of already-received newer messages
394 uint64_t futures GNUNET_PACKED;
397 * Last message ID received.
399 uint32_t mid GNUNET_PACKED;
404 * Message to acknowledge cadet encrypted traffic.
406 struct GNUNET_CADET_ACK
409 * Type: GNUNET_MESSAGE_TYPE_CADET_ACK
411 struct GNUNET_MessageHeader header;
414 * Maximum packet ID authorized.
416 uint32_t ack GNUNET_PACKED;
419 * ID of the connection.
421 struct GNUNET_CADET_Hash cid;
426 * Message to query a peer about its Flow Control status regarding a tunnel.
428 struct GNUNET_CADET_Poll
431 * Type: GNUNET_MESSAGE_TYPE_CADET_POLL
433 struct GNUNET_MessageHeader header;
438 uint32_t pid GNUNET_PACKED;
441 * ID of the connection.
443 struct GNUNET_CADET_Hash cid;
449 * Message for notifying a disconnection in a path
451 struct GNUNET_CADET_ConnectionBroken
454 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
456 struct GNUNET_MessageHeader header;
459 * ID of the connection.
461 struct GNUNET_CADET_Hash cid;
466 struct GNUNET_PeerIdentity peer1;
471 struct GNUNET_PeerIdentity peer2;
476 * Message to destroy a connection.
478 struct GNUNET_CADET_ConnectionDestroy
481 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
483 struct GNUNET_MessageHeader header;
486 * ID of the connection.
488 struct GNUNET_CADET_Hash cid;
492 GNUNET_NETWORK_STRUCT_END
494 #if 0 /* keep Emacsens' auto-indent happy */
501 /* ifndef CADET_PROTOCOL_H */
503 /* end of cadet_protocol.h */