aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_consensus_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_consensus_service.h')
-rw-r--r--src/include/gnunet_consensus_service.h45
1 files changed, 33 insertions, 12 deletions
diff --git a/src/include/gnunet_consensus_service.h b/src/include/gnunet_consensus_service.h
index a2bf69021..8e2d8f572 100644
--- a/src/include/gnunet_consensus_service.h
+++ b/src/include/gnunet_consensus_service.h
@@ -38,20 +38,42 @@ extern "C"
38#include "platform.h" 38#include "platform.h"
39#include "gnunet_common.h" 39#include "gnunet_common.h"
40#include "gnunet_time_lib.h" 40#include "gnunet_time_lib.h"
41#include "gnunet_configuration_lib.h"
41 42
42 43
43/** 44/**
44 * Called when a new element was received from another peer; elements 45 * An element of the consensus set.
45 * given to a consensus operation by the local peer are NOT given 46 */
47struct GNUNET_CONSENSUS_Element
48{
49 /**
50 * The actual data of the element.
51 */
52 const void *data;
53
54 /**
55 * Size of the element's data.
56 */
57 uint16_t size;
58
59 /**
60 * Application specific element type
61 */
62 uint16_t type;
63};
64
65
66/**
67 * Called when a new element was received from another peer, or an error occured.
68 *
69 * Elements given to a consensus operation by the local peer are NOT given
46 * to this callback. 70 * to this callback.
47 * 71 *
48 * @param cls closure 72 * @param cls closure
49 * @param element_size will match the size given to GNUNET_CONSENSUS_create 73 * @param element new element, NULL on error
50 * @param element
51 */ 74 */
52typedef void (*GNUNET_CONSENSUS_NewElementCallback) (void *cls, 75typedef void (*GNUNET_CONSENSUS_NewElementCallback) (void *cls,
53 size_t element_size, 76 struct GNUNET_CONSENSUS_Element *element);
54 const void *element);
55 77
56 78
57 79
@@ -67,9 +89,9 @@ struct GNUNET_CONSENSUS_Handle;
67 * @param cfg 89 * @param cfg
68 * @param num_peers 90 * @param num_peers
69 * @param peers array of peers participating in this consensus session 91 * @param peers array of peers participating in this consensus session
92 * Inclusion of the local peer is optional.
70 * @param session_id session identifier 93 * @param session_id session identifier
71 * Allows a group of peers to have more than consensus session. 94 * Allows a group of peers to have more than consensus session.
72 * @param element_size size of the elements in the reconciled set in bytes
73 * @param num_initial_elements number of entries in the 'initial_elements' array 95 * @param num_initial_elements number of entries in the 'initial_elements' array
74 * @param initial_elements our elements for the consensus (each of 'element_size' 96 * @param initial_elements our elements for the consensus (each of 'element_size'
75 * @param new_element callback, called when a new element is added to the set by 97 * @param new_element callback, called when a new element is added to the set by
@@ -82,9 +104,10 @@ GNUNET_CONSENSUS_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
82 unsigned int num_peers, 104 unsigned int num_peers,
83 const struct GNUNET_PeerIdentity *peers, 105 const struct GNUNET_PeerIdentity *peers,
84 const struct GNUNET_HashCode *session_id, 106 const struct GNUNET_HashCode *session_id,
85 size_t element_size, 107 /*
86 unsigned int num_initial_elements, 108 unsigned int num_initial_elements,
87 const void **initial_elements, 109 const struct GNUNET_CONSENSUS_Element **initial_elements,
110 */
88 GNUNET_CONSENSUS_NewElementCallback new_element, 111 GNUNET_CONSENSUS_NewElementCallback new_element,
89 void *new_element_cls); 112 void *new_element_cls);
90 113
@@ -107,7 +130,6 @@ typedef void (*GNUNET_CONSENSUS_InsertDoneCallback) (void *cls,
107 * "GNUNET_CONSENSUS_conclude". 130 * "GNUNET_CONSENSUS_conclude".
108 * 131 *
109 * @param consensus handle for the consensus session 132 * @param consensus handle for the consensus session
110 * @param element_size must match element size from GNUNET_CONSENSUS_create
111 * @param element the element to be inserted 133 * @param element the element to be inserted
112 * @param idc function called when we are done with this element and it 134 * @param idc function called when we are done with this element and it
113 * is thus allowed to call GNUNET_CONSENSUS_insert again 135 * is thus allowed to call GNUNET_CONSENSUS_insert again
@@ -115,8 +137,7 @@ typedef void (*GNUNET_CONSENSUS_InsertDoneCallback) (void *cls,
115 */ 137 */
116void 138void
117GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus, 139GNUNET_CONSENSUS_insert (struct GNUNET_CONSENSUS_Handle *consensus,
118 size_t element_size, 140 const struct GNUNET_CONSENSUS_Element *element,
119 const void *element,
120 GNUNET_CONSENSUS_InsertDoneCallback idc, 141 GNUNET_CONSENSUS_InsertDoneCallback idc,
121 void *idc_cls); 142 void *idc_cls);
122 143