/*
This file is part of GNUnet.
- Copyright (C) 2001 - 2011 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2001 - 2011 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
*/
struct GNUNET_CADET_ConnectionCreate
{
- /**
- * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE
- *
- * Size: sizeof (struct GNUNET_CADET_ConnectionCreate) +
- * path_length * sizeof (struct GNUNET_PeerIdentity)
- */
+ /**
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE
+ *
+ * Size: sizeof (struct GNUNET_CADET_ConnectionCreate) +
+ * path_length * sizeof (struct GNUNET_PeerIdentity)
+ */
struct GNUNET_MessageHeader header;
- /**
- * ID of the connection
- */
+ /**
+ * For alignment.
+ */
+ uint32_t reserved GNUNET_PACKED;
+
+ /**
+ * ID of the connection
+ */
struct GNUNET_CADET_Hash cid;
- /**
- * path_length structs defining the *whole* path from the origin [0] to the
- * final destination [path_length-1].
- */
+ /**
+ * path_length structs defining the *whole* path from the origin [0] to the
+ * final destination [path_length-1].
+ */
/* struct GNUNET_PeerIdentity peers[path_length]; */
};
* Message for ack'ing a connection
*/
struct GNUNET_CADET_ConnectionACK
-{
- /**
- * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK
- */
- struct GNUNET_MessageHeader header;
-
- /**
- * ID of the connection.
- */
- struct GNUNET_CADET_Hash cid;
-
-};
-
-
-/**
- * Message for encapsulation of a Key eXchange message in a connection.
- */
-struct GNUNET_CADET_KX
-{
- /**
- * Type: GNUNET_MESSAGE_TYPE_CADET_KX.
- */
- struct GNUNET_MessageHeader header;
-
- /**
- * ID of the connection.
- */
- struct GNUNET_CADET_Hash cid;
-
- /* Specific KX message follows. */
-};
-
-
-
-/**
- * Message for encapsulation of a Key eXchange message in a connection.
- */
-struct GNUNET_CADET_AX_KX
{
/**
- * Type: GNUNET_MESSAGE_TYPE_CADET_AX_KX.
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK
*/
struct GNUNET_MessageHeader header;
/**
- * Should the peer reply with its KX details?
- */
- uint32_t force_reply;
-
- /**
- * An EdDSA signature of the permanent ECDH key with the Peer's ID key.
- */
- struct GNUNET_CRYPTO_EddsaSignature signature;
-
- /**
- * Information about what is being signed (@a permanent_key).
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
- /**
- * Sender's permanent_key public ECC key encoded in a
- * format suitable for network transmission, as created
- * using 'gcry_sexp_sprint'.
+ * For alignment.
*/
- struct GNUNET_CRYPTO_EcdhePublicKey permanent_key;
+ uint32_t reserved GNUNET_PACKED;
/**
- * Sender's ephemeral public ECC key encoded in a
- * format suitable for network transmission, as created
- * using 'gcry_sexp_sprint'.
+ * ID of the connection.
*/
- struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
+ struct GNUNET_CADET_Hash cid;
- /**
- * Sender's next ephemeral public ECC key encoded in a
- * format suitable for network transmission, as created
- * using 'gcry_sexp_sprint'.
- */
- struct GNUNET_CRYPTO_EcdhePublicKey ratchet_key;
};
/**
- * Message transmitted with the signed ephemeral key of a peer. The
- * session key is then derived from the two ephemeral keys (ECDHE).
- *
- * As far as possible, same as CORE's EphemeralKeyMessage.
+ * Message for encapsulation of a Key eXchange message in a connection.
*/
-struct GNUNET_CADET_KX_Ephemeral
+struct GNUNET_CADET_KX
{
-
/**
- * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_EPHEMERAL.
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_KX.
*/
struct GNUNET_MessageHeader header;
-
- /**
- * Status of the sender (should be in "enum PeerStateMachine"), nbo.
- */
- int32_t sender_status GNUNET_PACKED;
-
- /**
- * An ECC signature of the 'origin' asserting the validity of
- * the given ephemeral key.
- */
- struct GNUNET_CRYPTO_EddsaSignature signature;
-
- /**
- * Information about what is being signed.
- */
- struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
- /**
- * At what time was this key created (beginning of validity).
- */
- struct GNUNET_TIME_AbsoluteNBO creation_time;
-
- /**
- * When does the given ephemeral key expire (end of validity).
- */
- struct GNUNET_TIME_AbsoluteNBO expiration_time;
-
+
/**
- * Ephemeral public ECC key (always for NIST P-521) encoded in a format
- * suitable for network transmission as created using 'gcry_sexp_sprint'.
+ * For alignment.
*/
- struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
-
- /**
- * Public key of the signing peer
- * (persistent version, not the ephemeral public key).
- */
- struct GNUNET_PeerIdentity origin_identity;
+ uint32_t reserved GNUNET_PACKED;
/**
- * Seed for the IV of nonce.
+ * ID of the connection.
*/
- uint32_t iv GNUNET_PACKED;
+ struct GNUNET_CADET_Hash cid;
- /**
- * Nonce to check liveness of peer.
- */
- uint32_t nonce GNUNET_PACKED;
+ /* Specific KX message follows. */
};
/**
- * Response to a PING. Includes data from the original PING.
+ * Flags to be used in GNUNET_CADET_AX_KX.
*/
-struct GNUNET_CADET_KX_Pong
-{
- /**
- * Message type is GNUNET_MESSAGE_TYPE_CADET_KX_PONG.
- */
- struct GNUNET_MessageHeader header;
+enum GNUNET_CADET_AX_KX_Flags {
/**
- * Seed for the IV
+ * Should the peer reply with its KX details?
*/
- uint32_t iv GNUNET_PACKED;
+ GNUNET_CADET_AX_KX_FLAG_NONE = 0,
/**
- * Same nonce as in the reve.
+ * The peer should reply with its KX details?
*/
- uint32_t nonce GNUNET_PACKED;
+ GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY = 1
};
/**
- * Tunnel(ed) message.
+ * Message for encapsulation of a Key eXchange message in a connection.
*/
-struct GNUNET_CADET_Encrypted
+struct GNUNET_CADET_AX_KX
{
/**
- * Type: GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_AX_KX.
*/
struct GNUNET_MessageHeader header;
/**
- * ID of the connection.
- */
- struct GNUNET_CADET_Hash cid;
-
- /**
- * ID of the packet (hop by hop).
+ * Flags for the key exchange in NBO, based on
+ * `enum GNUNET_CADET_AX_KX_Flags`.
*/
- uint32_t pid GNUNET_PACKED;
+ uint32_t flags GNUNET_PACKED;
/**
- * Number of hops to live.
- */
- uint32_t ttl GNUNET_PACKED;
-
- /**
- * Initialization Vector for payload encryption.
- */
- uint32_t iv GNUNET_PACKED;
-
- /**
- * MAC of the encrypted message, used to verify message integrity.
- * Everything after this value will be encrypted and authenticated.
+ * Sender's ephemeral public ECC key encoded in a
+ * format suitable for network transmission, as created
+ * using 'gcry_sexp_sprint'.
*/
- struct GNUNET_CADET_Hash hmac;
+ struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key;
/**
- * Encrypted content follows.
+ * Sender's next ephemeral public ECC key encoded in a
+ * format suitable for network transmission, as created
+ * using 'gcry_sexp_sprint'.
*/
+ struct GNUNET_CRYPTO_EcdhePublicKey ratchet_key;
};
struct GNUNET_CADET_AX
{
/**
- * Type: GNUNET_MESSAGE_TYPE_CADET_AXOLOTL_DATA
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_AXOLOTL_DATA
*/
struct GNUNET_MessageHeader header;
- /**
- * ID of the connection.
- */
- struct GNUNET_CADET_Hash cid;
-
/**
* ID of the packet (hop by hop).
*/
uint32_t pid GNUNET_PACKED;
/**
- * Reserved field for 64b alignment.
+ * ID of the connection.
*/
- uint32_t reserved GNUNET_PACKED;
+ struct GNUNET_CADET_Hash cid;
/**
* MAC of the encrypted message, used to verify message integrity.
*/
struct GNUNET_CADET_Hash hmac;
+ /**************** AX_HEADER start ****************/
+
/**
* Number of messages sent with the current ratchet key.
*/
- uint32_t Ns;
+ uint32_t Ns GNUNET_PACKED;
/**
* Number of messages sent with the previous ratchet key.
*/
- uint32_t PNs;
+ uint32_t PNs GNUNET_PACKED;
/**
* Current ratchet key.
*/
struct GNUNET_CRYPTO_EcdhePublicKey DHRs;
+ /**************** AX_HEADER end ****************/
+
/**
* Encrypted content follows.
*/
struct GNUNET_CADET_ChannelCreate
{
/**
- * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE
*/
struct GNUNET_MessageHeader header;
/**
- * ID of the channel
+ * Channel options.
*/
- CADET_ChannelNumber chid GNUNET_PACKED;
+ uint32_t opt GNUNET_PACKED;
/**
* Destination port.
*/
- uint32_t port GNUNET_PACKED;
+ struct GNUNET_HashCode port;
/**
- * Channel options.
+ * ID of the channel
*/
- uint32_t opt GNUNET_PACKED;
+ CADET_ChannelNumber chid GNUNET_PACKED;
};
struct GNUNET_CADET_ChannelManage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY}
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_{ACK|NACK|DESTROY}
*/
struct GNUNET_MessageHeader header;
*/
struct GNUNET_CADET_Data
{
- /**
- * Type: GNUNET_MESSAGE_TYPE_CADET_UNICAST,
- * GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
- */
+ /**
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST,
+ * #GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
+ */
struct GNUNET_MessageHeader header;
- /**
- * Unique ID of the payload message
- */
+ /**
+ * Unique ID of the payload message
+ */
uint32_t mid GNUNET_PACKED;
- /**
- * ID of the channel
- */
+ /**
+ * ID of the channel
+ */
CADET_ChannelNumber chid GNUNET_PACKED;
- /**
- * Payload follows
- */
+ /**
+ * Payload follows
+ */
};
*/
struct GNUNET_CADET_ACK
{
- /**
- * Type: GNUNET_MESSAGE_TYPE_CADET_ACK
- */
+ /**
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_ACK
+ */
struct GNUNET_MessageHeader header;
- /**
- * Maximum packet ID authorized.
- */
+ /**
+ * Maximum packet ID authorized.
+ */
uint32_t ack GNUNET_PACKED;
- /**
- * ID of the connection.
- */
+ /**
+ * ID of the connection.
+ */
struct GNUNET_CADET_Hash cid;
};
*/
struct GNUNET_CADET_Poll
{
- /**
- * Type: GNUNET_MESSAGE_TYPE_CADET_POLL
- */
+ /**
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_POLL
+ */
struct GNUNET_MessageHeader header;
- /**
- * Last packet sent.
- */
+ /**
+ * Last packet sent.
+ */
uint32_t pid GNUNET_PACKED;
- /**
- * ID of the connection.
- */
+ /**
+ * ID of the connection.
+ */
struct GNUNET_CADET_Hash cid;
};
*/
struct GNUNET_CADET_ConnectionBroken
{
- /**
- * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
- */
+ /**
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
+ */
struct GNUNET_MessageHeader header;
- /**
- * ID of the connection.
- */
+ /**
+ * For alignment.
+ */
+ uint32_t reserved GNUNET_PACKED;
+
+ /**
+ * ID of the connection.
+ */
struct GNUNET_CADET_Hash cid;
- /**
- * ID of the endpoint
- */
+ /**
+ * ID of the endpoint
+ */
struct GNUNET_PeerIdentity peer1;
- /**
- * ID of the endpoint
- */
+ /**
+ * ID of the endpoint
+ */
struct GNUNET_PeerIdentity peer2;
};
*/
struct GNUNET_CADET_ConnectionDestroy
{
- /**
- * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
- */
+ /**
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
+ */
struct GNUNET_MessageHeader header;
- /**
- * ID of the connection.
- */
+ /**
+ * For alignment.
+ */
+ uint32_t reserved GNUNET_PACKED;
+
+ /**
+ * ID of the connection.
+ */
struct GNUNET_CADET_Hash cid;
};