aboutsummaryrefslogtreecommitdiff
path: root/src/consensus/consensus_protocol.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/consensus/consensus_protocol.h')
-rw-r--r--src/consensus/consensus_protocol.h57
1 files changed, 50 insertions, 7 deletions
diff --git a/src/consensus/consensus_protocol.h b/src/consensus/consensus_protocol.h
index fb3bde628..f2933ed6f 100644
--- a/src/consensus/consensus_protocol.h
+++ b/src/consensus/consensus_protocol.h
@@ -29,6 +29,7 @@
29#define GNUNET_CONSENSUS_PROTOCOL_H 29#define GNUNET_CONSENSUS_PROTOCOL_H
30 30
31#include "platform.h" 31#include "platform.h"
32#include "gnunet_util_lib.h"
32#include "gnunet_common.h" 33#include "gnunet_common.h"
33#include "gnunet_protocols.h" 34#include "gnunet_protocols.h"
34 35
@@ -44,37 +45,37 @@ GNUNET_NETWORK_STRUCT_BEGIN
44struct GNUNET_CONSENSUS_RoundContextMessage 45struct GNUNET_CONSENSUS_RoundContextMessage
45{ 46{
46 /** 47 /**
47 * Type: GNUNET_MESSAGE_TYPE_CONSENSUS_P2P_ROUND_CONTEXT 48 * Type: #GNUNET_MESSAGE_TYPE_CONSENSUS_P2P_ROUND_CONTEXT
48 */ 49 */
49 struct GNUNET_MessageHeader header; 50 struct GNUNET_MessageHeader header;
50 51
51 /** 52 /**
52 * A value from 'enum PhaseKind'. 53 * A value from 'enum PhaseKind'.
53 */ 54 */
54 uint16_t kind; 55 uint16_t kind GNUNET_PACKED;
55 56
56 /** 57 /**
57 * Number of the first peer 58 * Number of the first peer
58 * in canonical order. 59 * in canonical order.
59 */ 60 */
60 int16_t peer1; 61 int16_t peer1 GNUNET_PACKED;
61 62
62 /** 63 /**
63 * Number of the second peer in canonical order. 64 * Number of the second peer in canonical order.
64 */ 65 */
65 int16_t peer2; 66 int16_t peer2 GNUNET_PACKED;
66 67
67 /** 68 /**
68 * Repetition of the gradecast phase. 69 * Repetition of the gradecast phase.
69 */ 70 */
70 int16_t repetition; 71 int16_t repetition GNUNET_PACKED;
71 72
72 /** 73 /**
73 * Leader in the gradecast phase. 74 * Leader in the gradecast phase.
74 * 75 *
75 * Can be different from both peer1 and peer2. 76 * Can be different from both peer1 and peer2.
76 */ 77 */
77 int16_t leader; 78 int16_t leader GNUNET_PACKED;
78 79
79 /** 80 /**
80 * Non-zero if this set reconciliation 81 * Non-zero if this set reconciliation
@@ -84,9 +85,51 @@ struct GNUNET_CONSENSUS_RoundContextMessage
84 * 85 *
85 * Ignored for set operations that are not within gradecasts. 86 * Ignored for set operations that are not within gradecasts.
86 */ 87 */
87 uint16_t is_contested; 88 uint16_t is_contested GNUNET_PACKED;
88}; 89};
89 90
91
92enum {
93 CONSENSUS_MARKER_CONTESTED = 1,
94 CONSENSUS_MARKER_SIZE = 2,
95};
96
97
98/**
99 * Consensus element, either marker or payload.
100 */
101struct ConsensusElement
102{
103 /**
104 * Payload element_type, only valid
105 * if this is not a marker element.
106 */
107 uint16_t payload_type GNUNET_PACKED;
108
109 /**
110 * Is this a marker element?
111 */
112 uint8_t marker;
113
114 /* rest: element data */
115};
116
117
118struct ConsensusSizeElement
119{
120 struct ConsensusElement ce;
121
122 uint64_t size GNUNET_PACKED;
123 uint8_t sender_index;
124};
125
126struct ConsensusStuffedElement
127{
128 struct ConsensusElement ce;
129 struct GNUNET_HashCode rand GNUNET_PACKED;
130};
131
132
90GNUNET_NETWORK_STRUCT_END 133GNUNET_NETWORK_STRUCT_END
91 134
92#endif 135#endif