2 This file is part of GNUnet.
3 (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 * Message to create a Channel.
243 struct GNUNET_CADET_ChannelCreate
246 * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
248 struct GNUNET_MessageHeader header;
253 CADET_ChannelNumber chid GNUNET_PACKED;
258 uint32_t port GNUNET_PACKED;
263 uint32_t opt GNUNET_PACKED;
268 * Message to manage a Channel (ACK, NACK, Destroy).
270 struct GNUNET_CADET_ChannelManage
273 * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY}
275 struct GNUNET_MessageHeader header;
280 CADET_ChannelNumber chid GNUNET_PACKED;
285 * Message for cadet data traffic.
287 struct GNUNET_CADET_Data
290 * Type: GNUNET_MESSAGE_TYPE_CADET_UNICAST,
291 * GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
293 struct GNUNET_MessageHeader header;
296 * Unique ID of the payload message
298 uint32_t mid GNUNET_PACKED;
303 CADET_ChannelNumber chid GNUNET_PACKED;
312 * Message to acknowledge end-to-end data.
314 struct GNUNET_CADET_DataACK
317 * Type: GNUNET_MESSAGE_TYPE_CADET_DATA_ACK
319 struct GNUNET_MessageHeader header;
324 CADET_ChannelNumber chid GNUNET_PACKED;
327 * Bitfield of already-received newer messages
331 uint64_t futures GNUNET_PACKED;
334 * Last message ID received.
336 uint32_t mid GNUNET_PACKED;
341 * Message to acknowledge cadet encrypted traffic.
343 struct GNUNET_CADET_ACK
346 * Type: GNUNET_MESSAGE_TYPE_CADET_ACK
348 struct GNUNET_MessageHeader header;
351 * Maximum packet ID authorized.
353 uint32_t ack GNUNET_PACKED;
356 * ID of the connection.
358 struct GNUNET_CADET_Hash cid;
363 * Message to query a peer about its Flow Control status regarding a tunnel.
365 struct GNUNET_CADET_Poll
368 * Type: GNUNET_MESSAGE_TYPE_CADET_POLL
370 struct GNUNET_MessageHeader header;
375 uint32_t pid GNUNET_PACKED;
378 * ID of the connection.
380 struct GNUNET_CADET_Hash cid;
386 * Message for notifying a disconnection in a path
388 struct GNUNET_CADET_ConnectionBroken
391 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
393 struct GNUNET_MessageHeader header;
396 * ID of the connection.
398 struct GNUNET_CADET_Hash cid;
403 struct GNUNET_PeerIdentity peer1;
408 struct GNUNET_PeerIdentity peer2;
413 * Message to destroy a connection.
415 struct GNUNET_CADET_ConnectionDestroy
418 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
420 struct GNUNET_MessageHeader header;
423 * ID of the connection.
425 struct GNUNET_CADET_Hash cid;
429 GNUNET_NETWORK_STRUCT_END
431 #if 0 /* keep Emacsens' auto-indent happy */
438 /* ifndef CADET_PROTOCOL_H */
440 /* end of cadet_protocol.h */