diff options
Diffstat (limited to 'src/mesh/gnunet-service-mesh_tunnel.h')
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.h | 73 |
1 files changed, 48 insertions, 25 deletions
diff --git a/src/mesh/gnunet-service-mesh_tunnel.h b/src/mesh/gnunet-service-mesh_tunnel.h index d4be562a2..8fabe0155 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.h +++ b/src/mesh/gnunet-service-mesh_tunnel.h | |||
@@ -41,9 +41,9 @@ extern "C" | |||
41 | #include "gnunet_util_lib.h" | 41 | #include "gnunet_util_lib.h" |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * All the states a tunnel can be in. | 44 | * All the connectivity states a tunnel can be in. |
45 | */ | 45 | */ |
46 | enum MeshTunnel3State | 46 | enum MeshTunnel3CState |
47 | { | 47 | { |
48 | /** | 48 | /** |
49 | * Uninitialized status, should never appear in operation. | 49 | * Uninitialized status, should never appear in operation. |
@@ -61,26 +61,38 @@ enum MeshTunnel3State | |||
61 | MESH_TUNNEL3_WAITING, | 61 | MESH_TUNNEL3_WAITING, |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Ephemeral key sent, waiting for peer's key. | ||
65 | */ | ||
66 | MESH_TUNNEL3_KEY_SENT, | ||
67 | |||
68 | /** | ||
69 | * Peer connected and ready to accept data. | 64 | * Peer connected and ready to accept data. |
70 | */ | 65 | */ |
71 | MESH_TUNNEL3_READY, | 66 | MESH_TUNNEL3_READY, |
67 | }; | ||
72 | 68 | ||
73 | /** | ||
74 | * Peer connected previosly but not responding. | ||
75 | */ | ||
76 | MESH_TUNNEL3_RECONNECTING, | ||
77 | 69 | ||
78 | /** | 70 | /** |
79 | * New ephemeral key and ping sent, waiting for pong. | 71 | * All the encryption states a tunnel can be in. |
80 | * This means that we DO have the peer's ephemeral key, otherwise the | 72 | */ |
81 | * state would be KEY_SENT. | 73 | enum MeshTunnel3EState |
82 | */ | 74 | { |
83 | MESH_TUNNEL3_REKEY, | 75 | /** |
76 | * Uninitialized status, should never appear in operation. | ||
77 | */ | ||
78 | MESH_TUNNEL3_KEY_UNINITIALIZED, | ||
79 | |||
80 | /** | ||
81 | * Ephemeral key sent, waiting for peer's key. | ||
82 | */ | ||
83 | MESH_TUNNEL3_KEY_SENT, | ||
84 | |||
85 | /** | ||
86 | * New ephemeral key and ping sent, waiting for pong. | ||
87 | * This means that we DO have the peer's ephemeral key, otherwise the | ||
88 | * state would be KEY_SENT. | ||
89 | */ | ||
90 | MESH_TUNNEL3_KEY_PING, | ||
91 | |||
92 | /** | ||
93 | * Handshake completed: session key available. | ||
94 | */ | ||
95 | MESH_TUNNEL3_KEY_OK, | ||
84 | }; | 96 | }; |
85 | 97 | ||
86 | /** | 98 | /** |
@@ -172,14 +184,25 @@ GMT_destroy_if_empty (struct MeshTunnel3 *t); | |||
172 | void | 184 | void |
173 | GMT_destroy (struct MeshTunnel3 *t); | 185 | GMT_destroy (struct MeshTunnel3 *t); |
174 | 186 | ||
187 | |||
188 | /** | ||
189 | * Change the tunnel's connection state. | ||
190 | * | ||
191 | * @param t Tunnel whose connection state to change. | ||
192 | * @param cstate New connection state. | ||
193 | */ | ||
194 | void | ||
195 | GMT_change_cstate (struct MeshTunnel3* t, enum MeshTunnel3CState state); | ||
196 | |||
197 | |||
175 | /** | 198 | /** |
176 | * Change the tunnel state. | 199 | * Change the tunnel encryption state. |
177 | * | 200 | * |
178 | * @param t Tunnel whose state to change. | 201 | * @param t Tunnel whose encryption state to change. |
179 | * @param state New state. | 202 | * @param state New encryption state. |
180 | */ | 203 | */ |
181 | void | 204 | void |
182 | GMT_change_state (struct MeshTunnel3* t, enum MeshTunnel3State state); | 205 | GMT_change_estate (struct MeshTunnel3* t, enum MeshTunnel3EState state); |
183 | 206 | ||
184 | /** | 207 | /** |
185 | * Add a connection to a tunnel. | 208 | * Add a connection to a tunnel. |
@@ -284,14 +307,14 @@ unsigned int | |||
284 | GMT_count_channels (struct MeshTunnel3 *t); | 307 | GMT_count_channels (struct MeshTunnel3 *t); |
285 | 308 | ||
286 | /** | 309 | /** |
287 | * Get the state of a tunnel. | 310 | * Get the connectivity state of a tunnel. |
288 | * | 311 | * |
289 | * @param t Tunnel. | 312 | * @param t Tunnel. |
290 | * | 313 | * |
291 | * @return Tunnel's state. | 314 | * @return Tunnel's connectivity state. |
292 | */ | 315 | */ |
293 | enum MeshTunnel3State | 316 | enum MeshTunnel3CState |
294 | GMT_get_state (struct MeshTunnel3 *t); | 317 | GMT_get_cstate (struct MeshTunnel3 *t); |
295 | 318 | ||
296 | /** | 319 | /** |
297 | * Get the maximum buffer space for a tunnel towards a local client. | 320 | * Get the maximum buffer space for a tunnel towards a local client. |