summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-06-05 11:20:32 +0000
committerChristian Grothoff <christian@grothoff.org>2015-06-05 11:20:32 +0000
commitfc576a73606c803af92a1c3e1885ed3628051bf7 (patch)
tree1b38b7c7e64ff91a41b262f655ffe01926d2c9d1 /src
parent47236bb24d1412aaf3d0ed7da3ff324f8c16d16e (diff)
turn 'force_reply' into a bitfield for future extensions
Diffstat (limited to 'src')
-rw-r--r--src/cadet/cadet_protocol.h29
-rw-r--r--src/cadet/gnunet-service-cadet_tunnel.c9
-rw-r--r--src/cadet/gnunet-service-cadet_tunnel.h2
3 files changed, 31 insertions, 9 deletions
diff --git a/src/cadet/cadet_protocol.h b/src/cadet/cadet_protocol.h
index 9b0abcc55..27247e942 100644
--- a/src/cadet/cadet_protocol.h
+++ b/src/cadet/cadet_protocol.h
@@ -53,7 +53,7 @@ GNUNET_NETWORK_STRUCT_BEGIN
struct GNUNET_CADET_ConnectionCreate
{
/**
- * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE
*
* Size: sizeof (struct GNUNET_CADET_ConnectionCreate) +
* path_length * sizeof (struct GNUNET_PeerIdentity)
@@ -79,7 +79,7 @@ struct GNUNET_CADET_ConnectionCreate
struct GNUNET_CADET_ConnectionACK
{
/**
- * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK
*/
struct GNUNET_MessageHeader header;
@@ -97,7 +97,7 @@ struct GNUNET_CADET_ConnectionACK
struct GNUNET_CADET_KX
{
/**
- * Type: GNUNET_MESSAGE_TYPE_CADET_KX.
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_KX.
*/
struct GNUNET_MessageHeader header;
@@ -110,6 +110,22 @@ struct GNUNET_CADET_KX
};
+/**
+ * Flags to be used in GNUNET_CADET_AX_KX.
+ */
+enum GNUNET_CADET_AX_KX_Flags {
+
+ /**
+ * Should the peer reply with its KX details?
+ */
+ GNUNET_CADET_AX_KX_FLAG_NONE = 0,
+
+ /**
+ * The peer should reply with its KX details?
+ */
+ GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY = 1
+};
+
/**
* Message for encapsulation of a Key eXchange message in a connection.
@@ -117,14 +133,15 @@ struct GNUNET_CADET_KX
struct GNUNET_CADET_AX_KX
{
/**
- * Type: GNUNET_MESSAGE_TYPE_CADET_AX_KX.
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_AX_KX.
*/
struct GNUNET_MessageHeader header;
/**
- * Should the peer reply with its KX details?
+ * Flags for the key exchange in NBO, based on
+ * `enum GNUNET_CADET_AX_KX_Flags`.
*/
- uint32_t force_reply;
+ uint32_t flags GNUNET_PACKED;
/**
* Sender's ephemeral public ECC key encoded in a
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c
index 3b0f335f2..00c9b4763 100644
--- a/src/cadet/gnunet-service-cadet_tunnel.c
+++ b/src/cadet/gnunet-service-cadet_tunnel.c
@@ -2865,7 +2865,8 @@ handle_kx_ax (struct CadetTunnel *t, const struct GNUNET_CADET_AX_KX *msg)
return;
}
- if (GNUNET_YES == ntohl (msg->force_reply))
+ if (GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY ==
+ (GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY & ntohl (msg->flags)))
GCT_send_ax_kx (t, GNUNET_NO);
if (CADET_TUNNEL_KEY_OK == t->estate)
@@ -4164,6 +4165,7 @@ void
GCT_send_ax_kx (struct CadetTunnel *t, int force_reply)
{
struct GNUNET_CADET_AX_KX msg;
+ enum GNUNET_CADET_AX_KX_Flags flags;
LOG (GNUNET_ERROR_TYPE_INFO, "===> AX_KX for %s\n", GCT_2s (t));
if (NULL != t->ephm_h)
@@ -4174,7 +4176,10 @@ GCT_send_ax_kx (struct CadetTunnel *t, int force_reply)
msg.header.size = htons (sizeof (msg));
msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_AX_KX);
- msg.force_reply = htonl (force_reply);
+ flags = GNUNET_CADET_AX_KX_FLAG_NONE;
+ if (force_reply)
+ flags |= GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY;
+ msg.flags = htonl (flags);
GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->kx_0, &msg.ephemeral_key);
GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->DHRs, &msg.ratchet_key);
diff --git a/src/cadet/gnunet-service-cadet_tunnel.h b/src/cadet/gnunet-service-cadet_tunnel.h
index 8b3f26ff0..128dad4b0 100644
--- a/src/cadet/gnunet-service-cadet_tunnel.h
+++ b/src/cadet/gnunet-service-cadet_tunnel.h
@@ -107,7 +107,7 @@ enum CadetTunnelEState
* we still have a valid session key and therefore we *can* still send
* traffic on the tunnel.
*/
- CADET_TUNNEL_KEY_REKEY,
+ CADET_TUNNEL_KEY_REKEY
};
/**