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]; */
76 * Message for ack'ing a connection
78 struct GNUNET_CADET_ConnectionACK
81 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK
83 struct GNUNET_MessageHeader header;
86 * ID of the connection.
88 struct GNUNET_CADET_Hash cid;
94 * Message for encapsulation of a Key eXchange message in a connection.
96 struct GNUNET_CADET_KX
99 * Type: GNUNET_MESSAGE_TYPE_CADET_KX.
101 struct GNUNET_MessageHeader header;
104 * ID of the connection.
106 struct GNUNET_CADET_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_CADET_KX_Ephemeral
122 * Message type is GNUNET_MESSAGE_TYPE_CADET_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
154 * suitable for network transmission as created using 'gcry_sexp_sprint'.
156 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
159 * Public key of the signing peer
160 * (persistent version, not the ephemeral public key).
162 struct GNUNET_PeerIdentity origin_identity;
165 * Seed for the IV of nonce.
167 uint32_t iv GNUNET_PACKED;
170 * Nonce to check liveness of peer.
172 uint32_t nonce GNUNET_PACKED;
177 * Response to a PING. Includes data from the original PING.
179 struct GNUNET_CADET_KX_Pong
182 * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_PONG.
184 struct GNUNET_MessageHeader header;
189 uint32_t iv GNUNET_PACKED;
192 * Same nonce as in the reve.
194 uint32_t nonce GNUNET_PACKED;
199 * Tunnel(ed) message.
201 struct GNUNET_CADET_Encrypted
204 * Type: GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED
206 struct GNUNET_MessageHeader header;
209 * ID of the connection.
211 struct GNUNET_CADET_Hash cid;
214 * ID of the packet (hop by hop).
216 uint32_t pid GNUNET_PACKED;
219 * Number of hops to live.
221 uint32_t ttl GNUNET_PACKED;
224 * Initialization Vector for payload encryption.
226 uint32_t iv GNUNET_PACKED;
229 * MAC of the encrypted message, used to verify message integrity.
230 * Everything after this value will be encrypted and authenticated.
232 struct GNUNET_CADET_Hash hmac;
235 * Encrypted content follows.
241 * Axolotl tunnel message.
243 struct GNUNET_CADET_AX
246 * Type: GNUNET_MESSAGE_TYPE_CADET_AXOLOTL_DATA
248 struct GNUNET_MessageHeader header;
251 * ID of the connection.
253 struct GNUNET_CADET_Hash 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 * Initialization Vector for payload encryption.
268 uint32_t iv GNUNET_PACKED;
271 * MAC of the encrypted message, used to verify message integrity.
272 * Everything after this value will be encrypted and authenticated.
274 struct GNUNET_CADET_Hash hmac;
277 * Encrypted content follows.
283 * Message to create a Channel.
285 struct GNUNET_CADET_ChannelCreate
288 * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
290 struct GNUNET_MessageHeader header;
295 CADET_ChannelNumber chid GNUNET_PACKED;
300 uint32_t port GNUNET_PACKED;
305 uint32_t opt GNUNET_PACKED;
310 * Message to manage a Channel (ACK, NACK, Destroy).
312 struct GNUNET_CADET_ChannelManage
315 * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY}
317 struct GNUNET_MessageHeader header;
322 CADET_ChannelNumber chid GNUNET_PACKED;
327 * Message for cadet data traffic.
329 struct GNUNET_CADET_Data
332 * Type: GNUNET_MESSAGE_TYPE_CADET_UNICAST,
333 * GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
335 struct GNUNET_MessageHeader header;
338 * Unique ID of the payload message
340 uint32_t mid GNUNET_PACKED;
345 CADET_ChannelNumber chid GNUNET_PACKED;
354 * Message to acknowledge end-to-end data.
356 struct GNUNET_CADET_DataACK
359 * Type: GNUNET_MESSAGE_TYPE_CADET_DATA_ACK
361 struct GNUNET_MessageHeader header;
366 CADET_ChannelNumber chid GNUNET_PACKED;
369 * Bitfield of already-received newer messages
373 uint64_t futures GNUNET_PACKED;
376 * Last message ID received.
378 uint32_t mid GNUNET_PACKED;
383 * Message to acknowledge cadet encrypted traffic.
385 struct GNUNET_CADET_ACK
388 * Type: GNUNET_MESSAGE_TYPE_CADET_ACK
390 struct GNUNET_MessageHeader header;
393 * Maximum packet ID authorized.
395 uint32_t ack GNUNET_PACKED;
398 * ID of the connection.
400 struct GNUNET_CADET_Hash cid;
405 * Message to query a peer about its Flow Control status regarding a tunnel.
407 struct GNUNET_CADET_Poll
410 * Type: GNUNET_MESSAGE_TYPE_CADET_POLL
412 struct GNUNET_MessageHeader header;
417 uint32_t pid GNUNET_PACKED;
420 * ID of the connection.
422 struct GNUNET_CADET_Hash cid;
428 * Message for notifying a disconnection in a path
430 struct GNUNET_CADET_ConnectionBroken
433 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
435 struct GNUNET_MessageHeader header;
438 * ID of the connection.
440 struct GNUNET_CADET_Hash cid;
445 struct GNUNET_PeerIdentity peer1;
450 struct GNUNET_PeerIdentity peer2;
455 * Message to destroy a connection.
457 struct GNUNET_CADET_ConnectionDestroy
460 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
462 struct GNUNET_MessageHeader header;
465 * ID of the connection.
467 struct GNUNET_CADET_Hash cid;
471 GNUNET_NETWORK_STRUCT_END
473 #if 0 /* keep Emacsens' auto-indent happy */
480 /* ifndef CADET_PROTOCOL_H */
482 /* end of cadet_protocol.h */