diff options
Diffstat (limited to 'src/cadet/cadet_protocol.h')
-rw-r--r-- | src/cadet/cadet_protocol.h | 224 |
1 files changed, 111 insertions, 113 deletions
diff --git a/src/cadet/cadet_protocol.h b/src/cadet/cadet_protocol.h index 2df652e34..d034c63b0 100644 --- a/src/cadet/cadet_protocol.h +++ b/src/cadet/cadet_protocol.h | |||
@@ -47,6 +47,12 @@ extern "C" | |||
47 | 47 | ||
48 | GNUNET_NETWORK_STRUCT_BEGIN | 48 | GNUNET_NETWORK_STRUCT_BEGIN |
49 | 49 | ||
50 | |||
51 | /******************************************************************************/ | ||
52 | /***************************** CONNECTION **********************************/ | ||
53 | /******************************************************************************/ | ||
54 | |||
55 | |||
50 | /** | 56 | /** |
51 | * Message for cadet connection creation. | 57 | * Message for cadet connection creation. |
52 | */ | 58 | */ |
@@ -102,15 +108,15 @@ struct GNUNET_CADET_ConnectionACK | |||
102 | 108 | ||
103 | 109 | ||
104 | /** | 110 | /** |
105 | * Message for encapsulation of a Key eXchange message in a connection. | 111 | * Message for notifying a disconnection in a path |
106 | */ | 112 | */ |
107 | struct GNUNET_CADET_KX | 113 | struct GNUNET_CADET_ConnectionBroken |
108 | { | 114 | { |
109 | /** | 115 | /** |
110 | * Type: #GNUNET_MESSAGE_TYPE_CADET_KX. | 116 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN |
111 | */ | 117 | */ |
112 | struct GNUNET_MessageHeader header; | 118 | struct GNUNET_MessageHeader header; |
113 | 119 | ||
114 | /** | 120 | /** |
115 | * For alignment. | 121 | * For alignment. |
116 | */ | 122 | */ |
@@ -121,44 +127,129 @@ struct GNUNET_CADET_KX | |||
121 | */ | 127 | */ |
122 | struct GNUNET_CADET_Hash cid; | 128 | struct GNUNET_CADET_Hash cid; |
123 | 129 | ||
124 | /* Specific KX message follows. */ | 130 | /** |
131 | * ID of the endpoint | ||
132 | */ | ||
133 | struct GNUNET_PeerIdentity peer1; | ||
134 | |||
135 | /** | ||
136 | * ID of the endpoint | ||
137 | */ | ||
138 | struct GNUNET_PeerIdentity peer2; | ||
125 | }; | 139 | }; |
126 | 140 | ||
127 | 141 | ||
128 | /** | 142 | /** |
129 | * Flags to be used in GNUNET_CADET_AX_KX. | 143 | * Message to destroy a connection. |
130 | */ | 144 | */ |
131 | enum GNUNET_CADET_AX_KX_Flags { | 145 | struct GNUNET_CADET_ConnectionDestroy |
146 | { | ||
147 | /** | ||
148 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY | ||
149 | */ | ||
150 | struct GNUNET_MessageHeader header; | ||
151 | |||
152 | /** | ||
153 | * For alignment. | ||
154 | */ | ||
155 | uint32_t reserved GNUNET_PACKED; | ||
156 | |||
157 | /** | ||
158 | * ID of the connection. | ||
159 | */ | ||
160 | struct GNUNET_CADET_Hash cid; | ||
161 | }; | ||
162 | |||
163 | |||
164 | /** | ||
165 | * Message to acknowledge cadet encrypted traffic. | ||
166 | */ | ||
167 | struct GNUNET_CADET_ACK | ||
168 | { | ||
169 | /** | ||
170 | * Type: #GNUNET_MESSAGE_TYPE_CADET_ACK | ||
171 | */ | ||
172 | struct GNUNET_MessageHeader header; | ||
173 | |||
174 | /** | ||
175 | * Maximum packet ID authorized. | ||
176 | */ | ||
177 | uint32_t ack GNUNET_PACKED; | ||
178 | |||
179 | /** | ||
180 | * ID of the connection. | ||
181 | */ | ||
182 | struct GNUNET_CADET_Hash cid; | ||
183 | }; | ||
184 | |||
185 | |||
186 | /** | ||
187 | * Message to query a peer about its Flow Control status regarding a tunnel. | ||
188 | */ | ||
189 | struct GNUNET_CADET_Poll | ||
190 | { | ||
191 | /** | ||
192 | * Type: #GNUNET_MESSAGE_TYPE_CADET_POLL | ||
193 | */ | ||
194 | struct GNUNET_MessageHeader header; | ||
195 | |||
196 | /** | ||
197 | * Last packet sent. | ||
198 | */ | ||
199 | uint32_t pid GNUNET_PACKED; | ||
200 | |||
201 | /** | ||
202 | * ID of the connection. | ||
203 | */ | ||
204 | struct GNUNET_CADET_Hash cid; | ||
205 | |||
206 | }; | ||
207 | |||
208 | |||
209 | |||
210 | /******************************************************************************/ | ||
211 | /******************************* TUNNEL ***********************************/ | ||
212 | /******************************************************************************/ | ||
213 | |||
214 | /** | ||
215 | * Flags to be used in GNUNET_CADET_KX. | ||
216 | */ | ||
217 | enum GNUNET_CADET_KX_Flags { | ||
132 | 218 | ||
133 | /** | 219 | /** |
134 | * Should the peer reply with its KX details? | 220 | * Should the peer reply with its KX details? |
135 | */ | 221 | */ |
136 | GNUNET_CADET_AX_KX_FLAG_NONE = 0, | 222 | GNUNET_CADET_KX_FLAG_NONE = 0, |
137 | 223 | ||
138 | /** | 224 | /** |
139 | * The peer should reply with its KX details? | 225 | * The peer should reply with its KX details? |
140 | */ | 226 | */ |
141 | GNUNET_CADET_AX_KX_FLAG_FORCE_REPLY = 1 | 227 | GNUNET_CADET_KX_FLAG_FORCE_REPLY = 1 |
142 | }; | 228 | }; |
143 | 229 | ||
144 | 230 | ||
145 | /** | 231 | /** |
146 | * Message for encapsulation of a Key eXchange message in a connection. | 232 | * Message for a Key eXchange for a tunnel. |
147 | */ | 233 | */ |
148 | struct GNUNET_CADET_AX_KX | 234 | struct GNUNET_CADET_KX |
149 | { | 235 | { |
150 | /** | 236 | /** |
151 | * Type: #GNUNET_MESSAGE_TYPE_CADET_AX_KX. | 237 | * Type: #GNUNET_MESSAGE_TYPE_CADET_KX. |
152 | */ | 238 | */ |
153 | struct GNUNET_MessageHeader header; | 239 | struct GNUNET_MessageHeader header; |
154 | 240 | ||
155 | /** | 241 | /** |
156 | * Flags for the key exchange in NBO, based on | 242 | * Flags for the key exchange in NBO, based on |
157 | * `enum GNUNET_CADET_AX_KX_Flags`. | 243 | * `enum GNUNET_CADET_KX_Flags`. |
158 | */ | 244 | */ |
159 | uint32_t flags GNUNET_PACKED; | 245 | uint32_t flags GNUNET_PACKED; |
160 | 246 | ||
161 | /** | 247 | /** |
248 | * ID of the connection. | ||
249 | */ | ||
250 | struct GNUNET_CADET_Hash cid; | ||
251 | |||
252 | /** | ||
162 | * Sender's ephemeral public ECC key encoded in a | 253 | * Sender's ephemeral public ECC key encoded in a |
163 | * format suitable for network transmission, as created | 254 | * format suitable for network transmission, as created |
164 | * using 'gcry_sexp_sprint'. | 255 | * using 'gcry_sexp_sprint'. |
@@ -177,10 +268,10 @@ struct GNUNET_CADET_AX_KX | |||
177 | /** | 268 | /** |
178 | * Axolotl tunnel message. | 269 | * Axolotl tunnel message. |
179 | */ | 270 | */ |
180 | struct GNUNET_CADET_AX | 271 | struct GNUNET_CADET_Encrypted |
181 | { | 272 | { |
182 | /** | 273 | /** |
183 | * Type: #GNUNET_MESSAGE_TYPE_CADET_AXOLOTL_DATA | 274 | * Type: #GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED |
184 | */ | 275 | */ |
185 | struct GNUNET_MessageHeader header; | 276 | struct GNUNET_MessageHeader header; |
186 | 277 | ||
@@ -226,6 +317,11 @@ struct GNUNET_CADET_AX | |||
226 | }; | 317 | }; |
227 | 318 | ||
228 | 319 | ||
320 | |||
321 | /******************************************************************************/ | ||
322 | /******************************* CHANNEL ***********************************/ | ||
323 | /******************************************************************************/ | ||
324 | |||
229 | /** | 325 | /** |
230 | * Message to create a Channel. | 326 | * Message to create a Channel. |
231 | */ | 327 | */ |
@@ -326,104 +422,6 @@ struct GNUNET_CADET_DataACK | |||
326 | }; | 422 | }; |
327 | 423 | ||
328 | 424 | ||
329 | /** | ||
330 | * Message to acknowledge cadet encrypted traffic. | ||
331 | */ | ||
332 | struct GNUNET_CADET_ACK | ||
333 | { | ||
334 | /** | ||
335 | * Type: #GNUNET_MESSAGE_TYPE_CADET_ACK | ||
336 | */ | ||
337 | struct GNUNET_MessageHeader header; | ||
338 | |||
339 | /** | ||
340 | * Maximum packet ID authorized. | ||
341 | */ | ||
342 | uint32_t ack GNUNET_PACKED; | ||
343 | |||
344 | /** | ||
345 | * ID of the connection. | ||
346 | */ | ||
347 | struct GNUNET_CADET_Hash cid; | ||
348 | }; | ||
349 | |||
350 | |||
351 | /** | ||
352 | * Message to query a peer about its Flow Control status regarding a tunnel. | ||
353 | */ | ||
354 | struct GNUNET_CADET_Poll | ||
355 | { | ||
356 | /** | ||
357 | * Type: #GNUNET_MESSAGE_TYPE_CADET_POLL | ||
358 | */ | ||
359 | struct GNUNET_MessageHeader header; | ||
360 | |||
361 | /** | ||
362 | * Last packet sent. | ||
363 | */ | ||
364 | uint32_t pid GNUNET_PACKED; | ||
365 | |||
366 | /** | ||
367 | * ID of the connection. | ||
368 | */ | ||
369 | struct GNUNET_CADET_Hash cid; | ||
370 | |||
371 | }; | ||
372 | |||
373 | |||
374 | /** | ||
375 | * Message for notifying a disconnection in a path | ||
376 | */ | ||
377 | struct GNUNET_CADET_ConnectionBroken | ||
378 | { | ||
379 | /** | ||
380 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN | ||
381 | */ | ||
382 | struct GNUNET_MessageHeader header; | ||
383 | |||
384 | /** | ||
385 | * For alignment. | ||
386 | */ | ||
387 | uint32_t reserved GNUNET_PACKED; | ||
388 | |||
389 | /** | ||
390 | * ID of the connection. | ||
391 | */ | ||
392 | struct GNUNET_CADET_Hash cid; | ||
393 | |||
394 | /** | ||
395 | * ID of the endpoint | ||
396 | */ | ||
397 | struct GNUNET_PeerIdentity peer1; | ||
398 | |||
399 | /** | ||
400 | * ID of the endpoint | ||
401 | */ | ||
402 | struct GNUNET_PeerIdentity peer2; | ||
403 | }; | ||
404 | |||
405 | |||
406 | /** | ||
407 | * Message to destroy a connection. | ||
408 | */ | ||
409 | struct GNUNET_CADET_ConnectionDestroy | ||
410 | { | ||
411 | /** | ||
412 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY | ||
413 | */ | ||
414 | struct GNUNET_MessageHeader header; | ||
415 | |||
416 | /** | ||
417 | * For alignment. | ||
418 | */ | ||
419 | uint32_t reserved GNUNET_PACKED; | ||
420 | |||
421 | /** | ||
422 | * ID of the connection. | ||
423 | */ | ||
424 | struct GNUNET_CADET_Hash cid; | ||
425 | }; | ||
426 | |||
427 | 425 | ||
428 | GNUNET_NETWORK_STRUCT_END | 426 | GNUNET_NETWORK_STRUCT_END |
429 | 427 | ||