[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35866 - gnunet/src/cadet
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35866 - gnunet/src/cadet |
Date: |
Fri, 5 Jun 2015 13:20:32 +0200 |
Author: grothoff
Date: 2015-06-05 13:20:32 +0200 (Fri, 05 Jun 2015)
New Revision: 35866
Modified:
gnunet/src/cadet/cadet_protocol.h
gnunet/src/cadet/gnunet-service-cadet_tunnel.c
gnunet/src/cadet/gnunet-service-cadet_tunnel.h
Log:
turn 'force_reply' into a bitfield for future extensions
Modified: gnunet/src/cadet/cadet_protocol.h
===================================================================
--- gnunet/src/cadet/cadet_protocol.h 2015-06-04 13:50:02 UTC (rev 35865)
+++ gnunet/src/cadet/cadet_protocol.h 2015-06-05 11:20:32 UTC (rev 35866)
@@ -53,7 +53,7 @@
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_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_KX
{
/**
- * Type: GNUNET_MESSAGE_TYPE_CADET_KX.
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_KX.
*/
struct GNUNET_MessageHeader header;
@@ -110,7 +110,23 @@
};
+/**
+ * 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_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
Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c 2015-06-04 13:50:02 UTC
(rev 35865)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c 2015-06-05 11:20:32 UTC
(rev 35866)
@@ -2865,7 +2865,8 @@
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 @@
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 @@
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);
Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.h
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.h 2015-06-04 13:50:02 UTC
(rev 35865)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.h 2015-06-05 11:20:32 UTC
(rev 35866)
@@ -107,7 +107,7 @@
* 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
};
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35866 - gnunet/src/cadet,
gnunet <=