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]; */
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. */
115 * Message for encapsulation of a Key eXchange message in a connection.
117 struct GNUNET_CADET_AX_KX
120 * Type: GNUNET_MESSAGE_TYPE_CADET_AX_KX.
122 struct GNUNET_MessageHeader header;
125 * An EdDSA signature of the permanent ECDH key with the Peer's ID key.
127 struct GNUNET_CRYPTO_EddsaSignature signature;
130 * Information about what is being signed (@a permanent_key).
132 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
135 * Sender's permanent_key public ECC key encoded in a
136 * format suitable for network transmission, as created
137 * using 'gcry_sexp_sprint'.
139 struct GNUNET_CRYPTO_EcdhePublicKey permanent_key;
142 * Sender's ephemeral public ECC key encoded in a
143 * format suitable for network transmission, as created
144 * using 'gcry_sexp_sprint'.
146 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
149 * Sender's next ephemeral public ECC key encoded in a
150 * format suitable for network transmission, as created
151 * using 'gcry_sexp_sprint'.
153 struct GNUNET_CRYPTO_EcdhePublicKey ratchet_key;
158 * Message transmitted with the signed ephemeral key of a peer. The
159 * session key is then derived from the two ephemeral keys (ECDHE).
161 * As far as possible, same as CORE's EphemeralKeyMessage.
163 struct GNUNET_CADET_KX_Ephemeral
167 * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL.
169 struct GNUNET_MessageHeader header;
172 * Status of the sender (should be in "enum PeerStateMachine"), nbo.
174 int32_t sender_status GNUNET_PACKED;
177 * An ECC signature of the 'origin' asserting the validity of
178 * the given ephemeral key.
180 struct GNUNET_CRYPTO_EddsaSignature signature;
183 * Information about what is being signed.
185 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
188 * At what time was this key created (beginning of validity).
190 struct GNUNET_TIME_AbsoluteNBO creation_time;
193 * When does the given ephemeral key expire (end of validity).
195 struct GNUNET_TIME_AbsoluteNBO expiration_time;
198 * Ephemeral public ECC key (always for NIST P-521) encoded in a format
199 * suitable for network transmission as created using 'gcry_sexp_sprint'.
201 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
204 * Public key of the signing peer
205 * (persistent version, not the ephemeral public key).
207 struct GNUNET_PeerIdentity origin_identity;
210 * Seed for the IV of nonce.
212 uint32_t iv GNUNET_PACKED;
215 * Nonce to check liveness of peer.
217 uint32_t nonce GNUNET_PACKED;
222 * Response to a PING. Includes data from the original PING.
224 struct GNUNET_CADET_KX_Pong
227 * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_PONG.
229 struct GNUNET_MessageHeader header;
234 uint32_t iv GNUNET_PACKED;
237 * Same nonce as in the reve.
239 uint32_t nonce GNUNET_PACKED;
244 * Tunnel(ed) message.
246 struct GNUNET_CADET_Encrypted
249 * Type: GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED
251 struct GNUNET_MessageHeader header;
254 * ID of the connection.
256 struct GNUNET_CADET_Hash cid;
259 * ID of the packet (hop by hop).
261 uint32_t pid GNUNET_PACKED;
264 * Number of hops to live.
266 uint32_t ttl GNUNET_PACKED;
269 * Initialization Vector for payload encryption.
271 uint32_t iv GNUNET_PACKED;
274 * MAC of the encrypted message, used to verify message integrity.
275 * Everything after this value will be encrypted and authenticated.
277 struct GNUNET_CADET_Hash hmac;
280 * Encrypted content follows.
286 * Axolotl tunnel message.
288 struct GNUNET_CADET_AX
291 * Type: GNUNET_MESSAGE_TYPE_CADET_AXOLOTL_DATA
293 struct GNUNET_MessageHeader header;
296 * ID of the connection.
298 struct GNUNET_CADET_Hash cid;
301 * ID of the packet (hop by hop).
303 uint32_t pid GNUNET_PACKED;
306 * Reserved field for 64b alignment.
308 uint32_t reserved GNUNET_PACKED;
311 * MAC of the encrypted message, used to verify message integrity.
312 * Everything after this value will be encrypted with the header key
315 struct GNUNET_CADET_Hash hmac;
318 * Number of messages sent with the current ratchet key.
323 * Number of messages sent with the previous ratchet key.
328 * Current ratchet key.
330 struct GNUNET_CRYPTO_EcdhePublicKey DHRs;
333 * Encrypted content follows.
339 * Message to create a Channel.
341 struct GNUNET_CADET_ChannelCreate
344 * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
346 struct GNUNET_MessageHeader header;
351 CADET_ChannelNumber chid GNUNET_PACKED;
356 uint32_t port GNUNET_PACKED;
361 uint32_t opt GNUNET_PACKED;
366 * Message to manage a Channel (ACK, NACK, Destroy).
368 struct GNUNET_CADET_ChannelManage
371 * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY}
373 struct GNUNET_MessageHeader header;
378 CADET_ChannelNumber chid GNUNET_PACKED;
383 * Message for cadet data traffic.
385 struct GNUNET_CADET_Data
388 * Type: GNUNET_MESSAGE_TYPE_CADET_UNICAST,
389 * GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
391 struct GNUNET_MessageHeader header;
394 * Unique ID of the payload message
396 uint32_t mid GNUNET_PACKED;
401 CADET_ChannelNumber chid GNUNET_PACKED;
410 * Message to acknowledge end-to-end data.
412 struct GNUNET_CADET_DataACK
415 * Type: GNUNET_MESSAGE_TYPE_CADET_DATA_ACK
417 struct GNUNET_MessageHeader header;
422 CADET_ChannelNumber chid GNUNET_PACKED;
425 * Bitfield of already-received newer messages
429 uint64_t futures GNUNET_PACKED;
432 * Last message ID received.
434 uint32_t mid GNUNET_PACKED;
439 * Message to acknowledge cadet encrypted traffic.
441 struct GNUNET_CADET_ACK
444 * Type: GNUNET_MESSAGE_TYPE_CADET_ACK
446 struct GNUNET_MessageHeader header;
449 * Maximum packet ID authorized.
451 uint32_t ack GNUNET_PACKED;
454 * ID of the connection.
456 struct GNUNET_CADET_Hash cid;
461 * Message to query a peer about its Flow Control status regarding a tunnel.
463 struct GNUNET_CADET_Poll
466 * Type: GNUNET_MESSAGE_TYPE_CADET_POLL
468 struct GNUNET_MessageHeader header;
473 uint32_t pid GNUNET_PACKED;
476 * ID of the connection.
478 struct GNUNET_CADET_Hash cid;
484 * Message for notifying a disconnection in a path
486 struct GNUNET_CADET_ConnectionBroken
489 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
491 struct GNUNET_MessageHeader header;
494 * ID of the connection.
496 struct GNUNET_CADET_Hash cid;
501 struct GNUNET_PeerIdentity peer1;
506 struct GNUNET_PeerIdentity peer2;
511 * Message to destroy a connection.
513 struct GNUNET_CADET_ConnectionDestroy
516 * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
518 struct GNUNET_MessageHeader header;
521 * ID of the connection.
523 struct GNUNET_CADET_Hash cid;
527 GNUNET_NETWORK_STRUCT_END
529 #if 0 /* keep Emacsens' auto-indent happy */
536 /* ifndef CADET_PROTOCOL_H */
538 /* end of cadet_protocol.h */