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;
66 uint32_t reserved GNUNET_PACKED;
69 * ID of the connection
71 struct GNUNET_CADET_Hash cid;
74 * path_length structs defining the *whole* path from the origin [0] to the
75 * final destination [path_length-1].
77 /* struct GNUNET_PeerIdentity peers[path_length]; */
82 * Message for ack'ing a connection
84 struct GNUNET_CADET_ConnectionACK
87 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK
89 struct GNUNET_MessageHeader header;
94 uint32_t reserved GNUNET_PACKED;
97 * ID of the connection.
99 struct GNUNET_CADET_Hash cid;
105 * Message for encapsulation of a Key eXchange message in a connection.
107 struct GNUNET_CADET_KX
110 * Type: #GNUNET_MESSAGE_TYPE_CADET_KX.
112 struct GNUNET_MessageHeader header;
117 uint32_t reserved GNUNET_PACKED;
120 * ID of the connection.
122 struct GNUNET_CADET_Hash cid;
124 /* Specific KX message follows. */
129 * Flags to be used in GNUNET_CADET_AX_KX.
131 enum GNUNET_CADET_AX_KX_Flags {
134 * Should the peer reply with its KX details?
136 GNUNET_CADET_AX_KX_FLAG_NONE = 0,
139 * The peer should reply with its KX details?
141 GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY = 1
146 * Message for encapsulation of a Key eXchange message in a connection.
148 struct GNUNET_CADET_AX_KX
151 * Type: #GNUNET_MESSAGE_TYPE_CADET_AX_KX.
153 struct GNUNET_MessageHeader header;
156 * Flags for the key exchange in NBO, based on
157 * `enum GNUNET_CADET_AX_KX_Flags`.
159 uint32_t flags GNUNET_PACKED;
162 * Sender's ephemeral public ECC key encoded in a
163 * format suitable for network transmission, as created
164 * using 'gcry_sexp_sprint'.
166 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
169 * Sender's next ephemeral public ECC key encoded in a
170 * format suitable for network transmission, as created
171 * using 'gcry_sexp_sprint'.
173 struct GNUNET_CRYPTO_EcdhePublicKey ratchet_key;
178 * Axolotl tunnel message.
180 struct GNUNET_CADET_AX
183 * Type: #GNUNET_MESSAGE_TYPE_CADET_AXOLOTL_DATA
185 struct GNUNET_MessageHeader header;
188 * ID of the packet (hop by hop).
190 uint32_t pid GNUNET_PACKED;
193 * ID of the connection.
195 struct GNUNET_CADET_Hash cid;
198 * MAC of the encrypted message, used to verify message integrity.
199 * Everything after this value will be encrypted with the header key
202 struct GNUNET_CADET_Hash hmac;
204 /**************** AX_HEADER start ****************/
207 * Number of messages sent with the current ratchet key.
209 uint32_t Ns GNUNET_PACKED;
212 * Number of messages sent with the previous ratchet key.
214 uint32_t PNs GNUNET_PACKED;
217 * Current ratchet key.
219 struct GNUNET_CRYPTO_EcdhePublicKey DHRs;
221 /**************** AX_HEADER end ****************/
224 * Encrypted content follows.
230 * Message to create a Channel.
232 struct GNUNET_CADET_ChannelCreate
235 * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
237 struct GNUNET_MessageHeader header;
242 uint32_t opt GNUNET_PACKED;
247 struct GNUNET_HashCode port;
252 CADET_ChannelNumber chid GNUNET_PACKED;
257 * Message to manage a Channel (ACK, NACK, Destroy).
259 struct GNUNET_CADET_ChannelManage
262 * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY}
264 struct GNUNET_MessageHeader header;
269 CADET_ChannelNumber chid GNUNET_PACKED;
274 * Message for cadet data traffic.
276 struct GNUNET_CADET_Data
279 * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST,
280 * #GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
282 struct GNUNET_MessageHeader header;
285 * Unique ID of the payload message
287 uint32_t mid GNUNET_PACKED;
292 CADET_ChannelNumber chid GNUNET_PACKED;
301 * Message to acknowledge end-to-end data.
303 struct GNUNET_CADET_DataACK
306 * Type: GNUNET_MESSAGE_TYPE_CADET_DATA_ACK
308 struct GNUNET_MessageHeader header;
313 CADET_ChannelNumber chid GNUNET_PACKED;
316 * Bitfield of already-received newer messages
320 uint64_t futures GNUNET_PACKED;
323 * Last message ID received.
325 uint32_t mid GNUNET_PACKED;
330 * Message to acknowledge cadet encrypted traffic.
332 struct GNUNET_CADET_ACK
335 * Type: #GNUNET_MESSAGE_TYPE_CADET_ACK
337 struct GNUNET_MessageHeader header;
340 * Maximum packet ID authorized.
342 uint32_t ack GNUNET_PACKED;
345 * ID of the connection.
347 struct GNUNET_CADET_Hash cid;
352 * Message to query a peer about its Flow Control status regarding a tunnel.
354 struct GNUNET_CADET_Poll
357 * Type: #GNUNET_MESSAGE_TYPE_CADET_POLL
359 struct GNUNET_MessageHeader header;
364 uint32_t pid GNUNET_PACKED;
367 * ID of the connection.
369 struct GNUNET_CADET_Hash cid;
375 * Message for notifying a disconnection in a path
377 struct GNUNET_CADET_ConnectionBroken
380 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
382 struct GNUNET_MessageHeader header;
387 uint32_t reserved GNUNET_PACKED;
390 * ID of the connection.
392 struct GNUNET_CADET_Hash cid;
397 struct GNUNET_PeerIdentity peer1;
402 struct GNUNET_PeerIdentity peer2;
407 * Message to destroy a connection.
409 struct GNUNET_CADET_ConnectionDestroy
412 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
414 struct GNUNET_MessageHeader header;
419 uint32_t reserved GNUNET_PACKED;
422 * ID of the connection.
424 struct GNUNET_CADET_Hash cid;
428 GNUNET_NETWORK_STRUCT_END
430 #if 0 /* keep Emacsens' auto-indent happy */
437 /* ifndef CADET_PROTOCOL_H */
439 /* end of cadet_protocol.h */