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 * 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. */
114 * Flags to be used in GNUNET_CADET_AX_KX.
116 enum GNUNET_CADET_AX_KX_Flags {
119 * Should the peer reply with its KX details?
121 GNUNET_CADET_AX_KX_FLAG_NONE = 0,
124 * The peer should reply with its KX details?
126 GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY = 1
131 * Message for encapsulation of a Key eXchange message in a connection.
133 struct GNUNET_CADET_AX_KX
136 * Type: #GNUNET_MESSAGE_TYPE_CADET_AX_KX.
138 struct GNUNET_MessageHeader header;
141 * Flags for the key exchange in NBO, based on
142 * `enum GNUNET_CADET_AX_KX_Flags`.
144 uint32_t flags GNUNET_PACKED;
147 * Sender's ephemeral public ECC key encoded in a
148 * format suitable for network transmission, as created
149 * using 'gcry_sexp_sprint'.
151 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
154 * Sender's next ephemeral public ECC key encoded in a
155 * format suitable for network transmission, as created
156 * using 'gcry_sexp_sprint'.
158 struct GNUNET_CRYPTO_EcdhePublicKey ratchet_key;
163 * Axolotl tunnel message.
165 struct GNUNET_CADET_AX
168 * Type: #GNUNET_MESSAGE_TYPE_CADET_AXOLOTL_DATA
170 struct GNUNET_MessageHeader header;
173 * ID of the packet (hop by hop).
175 uint32_t pid GNUNET_PACKED;
178 * ID of the connection.
180 struct GNUNET_CADET_Hash cid;
183 * MAC of the encrypted message, used to verify message integrity.
184 * Everything after this value will be encrypted with the header key
187 struct GNUNET_CADET_Hash hmac;
189 /**************** AX_HEADER start ****************/
192 * Number of messages sent with the current ratchet key.
194 uint32_t Ns GNUNET_PACKED;
197 * Number of messages sent with the previous ratchet key.
199 uint32_t PNs GNUNET_PACKED;
202 * Current ratchet key.
204 struct GNUNET_CRYPTO_EcdhePublicKey DHRs;
206 /**************** AX_HEADER end ****************/
209 * Encrypted content follows.
215 * Message to create a Channel.
217 struct GNUNET_CADET_ChannelCreate
220 * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
222 struct GNUNET_MessageHeader header;
227 CADET_ChannelNumber chid GNUNET_PACKED;
232 struct GNUNET_HashCode port;
237 uint32_t opt GNUNET_PACKED;
242 * Message to manage a Channel (ACK, NACK, Destroy).
244 struct GNUNET_CADET_ChannelManage
247 * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY}
249 struct GNUNET_MessageHeader header;
254 CADET_ChannelNumber chid GNUNET_PACKED;
259 * Message for cadet data traffic.
261 struct GNUNET_CADET_Data
264 * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST,
265 * #GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
267 struct GNUNET_MessageHeader header;
270 * Unique ID of the payload message
272 uint32_t mid GNUNET_PACKED;
277 CADET_ChannelNumber chid GNUNET_PACKED;
286 * Message to acknowledge end-to-end data.
288 struct GNUNET_CADET_DataACK
291 * Type: GNUNET_MESSAGE_TYPE_CADET_DATA_ACK
293 struct GNUNET_MessageHeader header;
298 CADET_ChannelNumber chid GNUNET_PACKED;
301 * Bitfield of already-received newer messages
305 uint64_t futures GNUNET_PACKED;
308 * Last message ID received.
310 uint32_t mid GNUNET_PACKED;
315 * Message to acknowledge cadet encrypted traffic.
317 struct GNUNET_CADET_ACK
320 * Type: #GNUNET_MESSAGE_TYPE_CADET_ACK
322 struct GNUNET_MessageHeader header;
325 * Maximum packet ID authorized.
327 uint32_t ack GNUNET_PACKED;
330 * ID of the connection.
332 struct GNUNET_CADET_Hash cid;
337 * Message to query a peer about its Flow Control status regarding a tunnel.
339 struct GNUNET_CADET_Poll
342 * Type: #GNUNET_MESSAGE_TYPE_CADET_POLL
344 struct GNUNET_MessageHeader header;
349 uint32_t pid GNUNET_PACKED;
352 * ID of the connection.
354 struct GNUNET_CADET_Hash cid;
360 * Message for notifying a disconnection in a path
362 struct GNUNET_CADET_ConnectionBroken
365 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
367 struct GNUNET_MessageHeader header;
370 * ID of the connection.
372 struct GNUNET_CADET_Hash cid;
377 struct GNUNET_PeerIdentity peer1;
382 struct GNUNET_PeerIdentity peer2;
387 * Message to destroy a connection.
389 struct GNUNET_CADET_ConnectionDestroy
392 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
394 struct GNUNET_MessageHeader header;
397 * ID of the connection.
399 struct GNUNET_CADET_Hash cid;
403 GNUNET_NETWORK_STRUCT_END
405 #if 0 /* keep Emacsens' auto-indent happy */
412 /* ifndef CADET_PROTOCOL_H */
414 /* end of cadet_protocol.h */