2 This file is part of GNUnet
3 Copyright (C) 2012 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
18 * @file consensus/consensus_protocol.h
19 * @brief p2p message definitions for consensus
20 * @author Florian Dold
23 #ifndef GNUNET_CONSENSUS_PROTOCOL_H
24 #define GNUNET_CONSENSUS_PROTOCOL_H
27 #include "gnunet_util_lib.h"
28 #include "gnunet_common.h"
29 #include "gnunet_protocols.h"
32 GNUNET_NETWORK_STRUCT_BEGIN
35 * Sent as context message for set reconciliation.
37 * Essentially contains all the fields
38 * from 'struct TaskKey', but in NBO.
40 struct GNUNET_CONSENSUS_RoundContextMessage
43 * Type: #GNUNET_MESSAGE_TYPE_CONSENSUS_P2P_ROUND_CONTEXT
45 struct GNUNET_MessageHeader header;
48 * A value from 'enum PhaseKind'.
50 uint16_t kind GNUNET_PACKED;
53 * Number of the first peer
56 int16_t peer1 GNUNET_PACKED;
59 * Number of the second peer in canonical order.
61 int16_t peer2 GNUNET_PACKED;
64 * Repetition of the gradecast phase.
66 int16_t repetition GNUNET_PACKED;
69 * Leader in the gradecast phase.
71 * Can be different from both peer1 and peer2.
73 int16_t leader GNUNET_PACKED;
76 * Non-zero if this set reconciliation
77 * had elements removed because they were contested.
79 * Will be considered when grading broadcasts.
81 * Ignored for set operations that are not within gradecasts.
83 uint16_t is_contested GNUNET_PACKED;
88 CONSENSUS_MARKER_CONTESTED = 1,
89 CONSENSUS_MARKER_SIZE = 2,
94 * Consensus element, either marker or payload.
96 struct ConsensusElement
99 * Payload element_type, only valid
100 * if this is not a marker element.
102 uint16_t payload_type GNUNET_PACKED;
105 * Is this a marker element?
109 /* rest: element data */
113 struct ConsensusSizeElement
115 struct ConsensusElement ce;
117 uint64_t size GNUNET_PACKED;
118 uint8_t sender_index;
121 struct ConsensusStuffedElement
123 struct ConsensusElement ce;
124 struct GNUNET_HashCode rand GNUNET_PACKED;
128 GNUNET_NETWORK_STRUCT_END