consensus.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. This file is part of GNUnet.
  3. (C) 2012 Christian Grothoff (and other contributing authors)
  4. GNUnet is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published
  6. by the Free Software Foundation; either version 3, or (at your
  7. option) any later version.
  8. GNUnet is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNUnet; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.
  16. */
  17. /**
  18. * @author Florian Dold
  19. * @file consensus/consensus.h
  20. * @brief
  21. */
  22. #ifndef CONSENSUS_H
  23. #define CONSENSUS_H
  24. #include "gnunet_common.h"
  25. GNUNET_NETWORK_STRUCT_BEGIN
  26. /**
  27. * Sent by the client to the service,
  28. * when the client wants the service to join a consensus session.
  29. */
  30. struct GNUNET_CONSENSUS_JoinMessage
  31. {
  32. /**
  33. * Type: GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_JOIN
  34. */
  35. struct GNUNET_MessageHeader header;
  36. /**
  37. * Number of peers (at the end of this message) that want to
  38. * participate in the consensus.
  39. */
  40. uint32_t num_peers GNUNET_PACKED;
  41. /**
  42. * Session id of the consensus.
  43. */
  44. struct GNUNET_HashCode session_id;
  45. /**
  46. * Start time for the consensus.
  47. */
  48. struct GNUNET_TIME_AbsoluteNBO start;
  49. /**
  50. * Deadline for conclude.
  51. */
  52. struct GNUNET_TIME_AbsoluteNBO deadline;
  53. /* GNUNET_PeerIdentity[num_peers] */
  54. };
  55. /**
  56. * Message with an element
  57. */
  58. struct GNUNET_CONSENSUS_ElementMessage
  59. {
  60. /**
  61. * Type:
  62. * Either GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_RECEIVED_ELEMENT
  63. * or GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_INSERT_ELEMENT
  64. */
  65. struct GNUNET_MessageHeader header;
  66. /**
  67. * Type: GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_NEW_ELEMENT
  68. */
  69. uint16_t element_type GNUNET_PACKED; /* FIXME: alignment? => uint32_t */
  70. /* rest: element data */
  71. };
  72. GNUNET_NETWORK_STRUCT_END
  73. #endif