2 This file is part of GNUnet.
3 Copyright (C) 2001 - 2011 GNUnet e.V.
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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, 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 /******************************************************************************/
52 /***************************** CONNECTION **********************************/
53 /******************************************************************************/
57 * Message for cadet connection creation.
59 struct GNUNET_CADET_ConnectionCreate
62 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE
64 * Size: sizeof (struct GNUNET_CADET_ConnectionCreate) +
65 * path_length * sizeof (struct GNUNET_PeerIdentity)
67 struct GNUNET_MessageHeader header;
72 uint32_t reserved GNUNET_PACKED;
75 * ID of the connection
77 struct GNUNET_CADET_Hash cid;
80 * path_length structs defining the *whole* path from the origin [0] to the
81 * final destination [path_length-1].
83 /* struct GNUNET_PeerIdentity peers[path_length]; */
88 * Message for ack'ing a connection
90 struct GNUNET_CADET_ConnectionACK
93 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK
95 struct GNUNET_MessageHeader header;
100 uint32_t reserved GNUNET_PACKED;
103 * ID of the connection.
105 struct GNUNET_CADET_Hash cid;
111 * Message for notifying a disconnection in a path
113 struct GNUNET_CADET_ConnectionBroken
116 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
118 struct GNUNET_MessageHeader header;
123 uint32_t reserved GNUNET_PACKED;
126 * ID of the connection.
128 struct GNUNET_CADET_Hash cid;
133 struct GNUNET_PeerIdentity peer1;
138 struct GNUNET_PeerIdentity peer2;
143 * Message to destroy a connection.
145 struct GNUNET_CADET_ConnectionDestroy
148 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
150 struct GNUNET_MessageHeader header;
155 uint32_t reserved GNUNET_PACKED;
158 * ID of the connection.
160 struct GNUNET_CADET_Hash cid;
165 * Message to acknowledge cadet encrypted traffic.
167 struct GNUNET_CADET_ACK
170 * Type: #GNUNET_MESSAGE_TYPE_CADET_ACK
172 struct GNUNET_MessageHeader header;
175 * Maximum packet ID authorized.
177 uint32_t ack GNUNET_PACKED;
180 * ID of the connection.
182 struct GNUNET_CADET_Hash cid;
187 * Message to query a peer about its Flow Control status regarding a tunnel.
189 struct GNUNET_CADET_Poll
192 * Type: #GNUNET_MESSAGE_TYPE_CADET_POLL
194 struct GNUNET_MessageHeader header;
199 uint32_t pid GNUNET_PACKED;
202 * ID of the connection.
204 struct GNUNET_CADET_Hash cid;
210 /******************************************************************************/
211 /******************************* TUNNEL ***********************************/
212 /******************************************************************************/
215 * Flags to be used in GNUNET_CADET_KX.
217 enum GNUNET_CADET_KX_Flags {
220 * Should the peer reply with its KX details?
222 GNUNET_CADET_KX_FLAG_NONE = 0,
225 * The peer should reply with its KX details?
227 GNUNET_CADET_KX_FLAG_FORCE_REPLY = 1
232 * Message for a Key eXchange for a tunnel.
234 struct GNUNET_CADET_KX
237 * Type: #GNUNET_MESSAGE_TYPE_CADET_KX.
239 struct GNUNET_MessageHeader header;
242 * Flags for the key exchange in NBO, based on
243 * `enum GNUNET_CADET_KX_Flags`.
245 uint32_t flags GNUNET_PACKED;
248 * ID of the connection.
250 struct GNUNET_CADET_Hash cid;
253 * Sender's ephemeral public ECC key encoded in a
254 * format suitable for network transmission, as created
255 * using 'gcry_sexp_sprint'.
257 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
260 * Sender's next ephemeral public ECC key encoded in a
261 * format suitable for network transmission, as created
262 * using 'gcry_sexp_sprint'.
264 struct GNUNET_CRYPTO_EcdhePublicKey ratchet_key;
269 * Axolotl tunnel message.
271 struct GNUNET_CADET_Encrypted
274 * Type: #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED
276 struct GNUNET_MessageHeader header;
279 * ID of the packet (hop by hop).
281 uint32_t pid GNUNET_PACKED;
284 * ID of the connection.
286 struct GNUNET_CADET_Hash cid;
289 * MAC of the encrypted message, used to verify message integrity.
290 * Everything after this value will be encrypted with the header key
293 struct GNUNET_CADET_Hash hmac;
295 /**************** AX_HEADER start ****************/
298 * Number of messages sent with the current ratchet key.
300 uint32_t Ns GNUNET_PACKED;
303 * Number of messages sent with the previous ratchet key.
305 uint32_t PNs GNUNET_PACKED;
308 * Current ratchet key.
310 struct GNUNET_CRYPTO_EcdhePublicKey DHRs;
312 /**************** AX_HEADER end ****************/
315 * Encrypted content follows.
321 /******************************************************************************/
322 /******************************* CHANNEL ***********************************/
323 /******************************************************************************/
326 * Message to create a Channel.
328 struct GNUNET_CADET_ChannelCreate
331 * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
333 struct GNUNET_MessageHeader header;
338 uint32_t opt GNUNET_PACKED;
343 struct GNUNET_HashCode port;
348 CADET_ChannelNumber chid GNUNET_PACKED;
353 * Message to manage a Channel (ACK, NACK, Destroy).
355 struct GNUNET_CADET_ChannelManage
358 * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY}
360 struct GNUNET_MessageHeader header;
365 CADET_ChannelNumber chid GNUNET_PACKED;
370 * Message for cadet data traffic.
372 struct GNUNET_CADET_Data
375 * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST,
376 * #GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
378 struct GNUNET_MessageHeader header;
381 * Unique ID of the payload message
383 uint32_t mid GNUNET_PACKED;
388 CADET_ChannelNumber chid GNUNET_PACKED;
397 * Message to acknowledge end-to-end data.
399 struct GNUNET_CADET_DataACK
402 * Type: GNUNET_MESSAGE_TYPE_CADET_DATA_ACK
404 struct GNUNET_MessageHeader header;
409 CADET_ChannelNumber chid GNUNET_PACKED;
412 * Bitfield of already-received newer messages
416 uint64_t futures GNUNET_PACKED;
419 * Last message ID received.
421 uint32_t mid GNUNET_PACKED;
426 GNUNET_NETWORK_STRUCT_END
428 #if 0 /* keep Emacsens' auto-indent happy */
435 /* ifndef CADET_PROTOCOL_H */
437 /* end of cadet_protocol.h */