aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/cadet_protocol.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cadet/cadet_protocol.h')
-rw-r--r--src/cadet/cadet_protocol.h150
1 files changed, 4 insertions, 146 deletions
diff --git a/src/cadet/cadet_protocol.h b/src/cadet/cadet_protocol.h
index d2426addb..560c186cd 100644
--- a/src/cadet/cadet_protocol.h
+++ b/src/cadet/cadet_protocol.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2001 - 2011 GNUnet e.V. 3 Copyright (C) 2007 - 2017 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -19,8 +19,10 @@
19*/ 19*/
20 20
21/** 21/**
22 * @author Bartlomiej Polot
23 * @file cadet/cadet_protocol.h 22 * @file cadet/cadet_protocol.h
23 * @brief P2P messages used by CADET
24 * @author Bartlomiej Polot
25 * @author Christian Grothoff
24 */ 26 */
25 27
26#ifndef CADET_PROTOCOL_H_ 28#ifndef CADET_PROTOCOL_H_
@@ -298,17 +300,10 @@ struct GNUNET_CADET_TunnelEncryptedMessage
298 */ 300 */
299 struct GNUNET_MessageHeader header; 301 struct GNUNET_MessageHeader header;
300 302
301#if NEW_CADET
302 /** 303 /**
303 * Reserved, for alignment. 304 * Reserved, for alignment.
304 */ 305 */
305 uint32_t reserved GNUNET_PACKED; 306 uint32_t reserved GNUNET_PACKED;
306#else
307 /**
308 * Maximum packet ID authorized.
309 */
310 struct CadetEncryptedMessageIdentifier cemi;
311#endif
312 307
313 /** 308 /**
314 * ID of the connection. 309 * ID of the connection.
@@ -322,89 +317,18 @@ struct GNUNET_CADET_TunnelEncryptedMessage
322 */ 317 */
323 struct GNUNET_ShortHashCode hmac; 318 struct GNUNET_ShortHashCode hmac;
324 319
325 #if NEW_CADET
326 /** 320 /**
327 * Axolotl-header that specifies which keys to use in which ratchet 321 * Axolotl-header that specifies which keys to use in which ratchet
328 * to decrypt the body that follows. 322 * to decrypt the body that follows.
329 */ 323 */
330 struct GNUNET_CADET_AxHeader ax_header; 324 struct GNUNET_CADET_AxHeader ax_header;
331#else
332 /**
333 * Number of messages sent with the current ratchet key.
334 */
335 uint32_t Ns GNUNET_PACKED;
336
337 /**
338 * Number of messages sent with the previous ratchet key.
339 */
340 uint32_t PNs GNUNET_PACKED;
341 325
342 /** 326 /**
343 * Current ratchet key.
344 */
345 struct GNUNET_CRYPTO_EcdhePublicKey DHRs;
346#endif
347 /**
348 * Encrypted content follows. 327 * Encrypted content follows.
349 */ 328 */
350}; 329};
351 330
352 331
353#ifndef NEW_CADET
354
355/**
356 * Message to query a peer about its Flow Control status regarding a tunnel.
357 *
358 * It is NOT yet clear if we need this.
359 */
360struct GNUNET_CADET_ConnectionHopByHopPollMessage
361{
362 /**
363 * Type: #GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED_POLL
364 */
365 struct GNUNET_MessageHeader header;
366
367 /**
368 * Last packet sent.
369 */
370 struct CadetEncryptedMessageIdentifier cemi;
371
372 /**
373 * ID of the connection.
374 */
375 struct GNUNET_CADET_ConnectionTunnelIdentifier cid;
376
377};
378
379
380/**
381 * Message to acknowledge cadet encrypted traffic, used for
382 * flow-control on a hop-by-hop basis on the connection-level. Note
383 * that we do use the @e cemi from the tunnel layer as the connection
384 * layer's header is included/shared with the tunnel layer messages,
385 * and we only do flow control for the payload.
386 */
387struct GNUNET_CADET_ConnectionEncryptedAckMessage
388{
389 /**
390 * Type: #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_HOP_BY_HOP_ENCRYPTED_ACK
391 */
392 struct GNUNET_MessageHeader header;
393
394 /**
395 * Maximum packet ID authorized.
396 */
397 struct CadetEncryptedMessageIdentifier cemi_max;
398
399 /**
400 * ID of the connection.
401 */
402 struct GNUNET_CADET_ConnectionTunnelIdentifier cid;
403};
404
405#endif
406
407
408/******************************************************************************/ 332/******************************************************************************/
409/******************************* CHANNEL ***********************************/ 333/******************************* CHANNEL ***********************************/
410/******************************************************************************/ 334/******************************************************************************/
@@ -450,83 +374,19 @@ struct GNUNET_CADET_ChannelManageMessage
450 */ 374 */
451 struct GNUNET_MessageHeader header; 375 struct GNUNET_MessageHeader header;
452 376
453#ifdef NEW_CADET
454 /** 377 /**
455 * For alignment. 378 * For alignment.
456 */ 379 */
457 uint32_t reserved GNUNET_PACKED; 380 uint32_t reserved GNUNET_PACKED;
458#endif
459
460 /**
461 * ID of the channel
462 */
463 struct GNUNET_CADET_ChannelTunnelNumber ctn;
464};
465
466
467#ifndef NEW_CADET
468
469/**
470 * Message for cadet data traffic.
471 */
472struct GNUNET_CADET_ChannelAppDataMessage
473{
474 /**
475 * Type: #GNUNET_MESSAGE_TYPE_CADET_UNICAST,
476 * #GNUNET_MESSAGE_TYPE_CADET_TO_ORIGIN
477 */
478 struct GNUNET_MessageHeader header;
479
480 /**
481 * Unique ID of the payload message
482 */
483 /* NEW: struct ChannelMessageIdentifier */
484 uint32_t mid GNUNET_PACKED;
485 381
486 /** 382 /**
487 * ID of the channel 383 * ID of the channel
488 */ 384 */
489 struct GNUNET_CADET_ChannelTunnelNumber ctn; 385 struct GNUNET_CADET_ChannelTunnelNumber ctn;
490
491 /**
492 * Payload follows
493 */
494}; 386};
495 387
496 388
497/** 389/**
498 * Message to acknowledge end-to-end data.
499 */
500struct GNUNET_CADET_ChannelDataAckMessage
501{
502 /**
503 * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK
504 */
505 struct GNUNET_MessageHeader header;
506
507 /**
508 * ID of the channel
509 */
510 struct GNUNET_CADET_ChannelTunnelNumber ctn;
511
512 /**
513 * Bitfield of already-received messages past @e mid.
514 * pid + 1 @ LSB
515 * pid + 64 @ MSB
516 */
517 uint64_t futures GNUNET_PACKED;
518
519 /**
520 * Last message ID received.
521 */
522 /* NEW: struct ChannelMessageIdentifier */
523 uint32_t mid GNUNET_PACKED;
524};
525
526#else
527
528
529/**
530 * Number used to uniquely identify messages in a CADET Channel. 390 * Number used to uniquely identify messages in a CADET Channel.
531 */ 391 */
532struct ChannelMessageIdentifier 392struct ChannelMessageIdentifier
@@ -595,8 +455,6 @@ struct GNUNET_CADET_ChannelDataAckMessage
595}; 455};
596 456
597 457
598#endif
599
600GNUNET_NETWORK_STRUCT_END 458GNUNET_NETWORK_STRUCT_END
601 459
602#if 0 /* keep Emacsens' auto-indent happy */ 460#if 0 /* keep Emacsens' auto-indent happy */