diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-06-05 11:20:32 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-06-05 11:20:32 +0000 |
commit | fc576a73606c803af92a1c3e1885ed3628051bf7 (patch) | |
tree | 1b38b7c7e64ff91a41b262f655ffe01926d2c9d1 /src | |
parent | 47236bb24d1412aaf3d0ed7da3ff324f8c16d16e (diff) | |
download | gnunet-fc576a73606c803af92a1c3e1885ed3628051bf7.tar.gz gnunet-fc576a73606c803af92a1c3e1885ed3628051bf7.zip |
turn 'force_reply' into a bitfield for future extensions
Diffstat (limited to 'src')
-rw-r--r-- | src/cadet/cadet_protocol.h | 29 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnel.c | 9 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnel.h | 2 |
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 | |||
53 | struct GNUNET_CADET_ConnectionCreate | 53 | struct GNUNET_CADET_ConnectionCreate |
54 | { | 54 | { |
55 | /** | 55 | /** |
56 | * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE | 56 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE |
57 | * | 57 | * |
58 | * Size: sizeof (struct GNUNET_CADET_ConnectionCreate) + | 58 | * Size: sizeof (struct GNUNET_CADET_ConnectionCreate) + |
59 | * path_length * sizeof (struct GNUNET_PeerIdentity) | 59 | * path_length * sizeof (struct GNUNET_PeerIdentity) |
@@ -79,7 +79,7 @@ struct GNUNET_CADET_ConnectionCreate | |||
79 | struct GNUNET_CADET_ConnectionACK | 79 | struct GNUNET_CADET_ConnectionACK |
80 | { | 80 | { |
81 | /** | 81 | /** |
82 | * Type: GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK | 82 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_ACK |
83 | */ | 83 | */ |
84 | struct GNUNET_MessageHeader header; | 84 | struct GNUNET_MessageHeader header; |
85 | 85 | ||
@@ -97,7 +97,7 @@ struct GNUNET_CADET_ConnectionACK | |||
97 | struct GNUNET_CADET_KX | 97 | struct GNUNET_CADET_KX |
98 | { | 98 | { |
99 | /** | 99 | /** |
100 | * Type: GNUNET_MESSAGE_TYPE_CADET_KX. | 100 | * Type: #GNUNET_MESSAGE_TYPE_CADET_KX. |
101 | */ | 101 | */ |
102 | struct GNUNET_MessageHeader header; | 102 | struct GNUNET_MessageHeader header; |
103 | 103 | ||
@@ -110,6 +110,22 @@ struct GNUNET_CADET_KX | |||
110 | }; | 110 | }; |
111 | 111 | ||
112 | 112 | ||
113 | /** | ||
114 | * Flags to be used in GNUNET_CADET_AX_KX. | ||
115 | */ | ||
116 | enum GNUNET_CADET_AX_KX_Flags { | ||
117 | |||
118 | /** | ||
119 | * Should the peer reply with its KX details? | ||
120 | */ | ||
121 | GNUNET_CADET_AX_KX_FLAG_NONE = 0, | ||
122 | |||
123 | /** | ||
124 | * The peer should reply with its KX details? | ||
125 | */ | ||
126 | GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY = 1 | ||
127 | }; | ||
128 | |||
113 | 129 | ||
114 | /** | 130 | /** |
115 | * Message for encapsulation of a Key eXchange message in a connection. | 131 | * Message for encapsulation of a Key eXchange message in a connection. |
@@ -117,14 +133,15 @@ struct GNUNET_CADET_KX | |||
117 | struct GNUNET_CADET_AX_KX | 133 | struct GNUNET_CADET_AX_KX |
118 | { | 134 | { |
119 | /** | 135 | /** |
120 | * Type: GNUNET_MESSAGE_TYPE_CADET_AX_KX. | 136 | * Type: #GNUNET_MESSAGE_TYPE_CADET_AX_KX. |
121 | */ | 137 | */ |
122 | struct GNUNET_MessageHeader header; | 138 | struct GNUNET_MessageHeader header; |
123 | 139 | ||
124 | /** | 140 | /** |
125 | * Should the peer reply with its KX details? | 141 | * Flags for the key exchange in NBO, based on |
142 | * `enum GNUNET_CADET_AX_KX_Flags`. | ||
126 | */ | 143 | */ |
127 | uint32_t force_reply; | 144 | uint32_t flags GNUNET_PACKED; |
128 | 145 | ||
129 | /** | 146 | /** |
130 | * Sender's ephemeral public ECC key encoded in a | 147 | * 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) | |||
2865 | return; | 2865 | return; |
2866 | } | 2866 | } |
2867 | 2867 | ||
2868 | if (GNUNET_YES == ntohl (msg->force_reply)) | 2868 | if (GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY == |
2869 | (GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY & ntohl (msg->flags))) | ||
2869 | GCT_send_ax_kx (t, GNUNET_NO); | 2870 | GCT_send_ax_kx (t, GNUNET_NO); |
2870 | 2871 | ||
2871 | if (CADET_TUNNEL_KEY_OK == t->estate) | 2872 | if (CADET_TUNNEL_KEY_OK == t->estate) |
@@ -4164,6 +4165,7 @@ void | |||
4164 | GCT_send_ax_kx (struct CadetTunnel *t, int force_reply) | 4165 | GCT_send_ax_kx (struct CadetTunnel *t, int force_reply) |
4165 | { | 4166 | { |
4166 | struct GNUNET_CADET_AX_KX msg; | 4167 | struct GNUNET_CADET_AX_KX msg; |
4168 | enum GNUNET_CADET_AX_KX_Flags flags; | ||
4167 | 4169 | ||
4168 | LOG (GNUNET_ERROR_TYPE_INFO, "===> AX_KX for %s\n", GCT_2s (t)); | 4170 | LOG (GNUNET_ERROR_TYPE_INFO, "===> AX_KX for %s\n", GCT_2s (t)); |
4169 | if (NULL != t->ephm_h) | 4171 | if (NULL != t->ephm_h) |
@@ -4174,7 +4176,10 @@ GCT_send_ax_kx (struct CadetTunnel *t, int force_reply) | |||
4174 | 4176 | ||
4175 | msg.header.size = htons (sizeof (msg)); | 4177 | msg.header.size = htons (sizeof (msg)); |
4176 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_AX_KX); | 4178 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_AX_KX); |
4177 | msg.force_reply = htonl (force_reply); | 4179 | flags = GNUNET_CADET_AX_KX_FLAG_NONE; |
4180 | if (force_reply) | ||
4181 | flags |= GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY; | ||
4182 | msg.flags = htonl (flags); | ||
4178 | GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->kx_0, &msg.ephemeral_key); | 4183 | GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->kx_0, &msg.ephemeral_key); |
4179 | GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->DHRs, &msg.ratchet_key); | 4184 | GNUNET_CRYPTO_ecdhe_key_get_public (t->ax->DHRs, &msg.ratchet_key); |
4180 | 4185 | ||
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 | |||
107 | * we still have a valid session key and therefore we *can* still send | 107 | * we still have a valid session key and therefore we *can* still send |
108 | * traffic on the tunnel. | 108 | * traffic on the tunnel. |
109 | */ | 109 | */ |
110 | CADET_TUNNEL_KEY_REKEY, | 110 | CADET_TUNNEL_KEY_REKEY |
111 | }; | 111 | }; |
112 | 112 | ||
113 | /** | 113 | /** |