GNUnet 0.22.2
gnunet_consensus_service.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) 2012 GNUnet e.V.
4
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.
9
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.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
35#ifndef GNUNET_CONSENSUS_SERVICE_H
36#define GNUNET_CONSENSUS_SERVICE_H
37
38#ifdef __cplusplus
39extern "C"
40{
41#if 0 /* keep Emacsens' auto-indent happy */
42}
43#endif
44#endif
45
46
47#include "gnunet_common.h"
48#include "gnunet_time_lib.h"
50#include "gnunet_set_service.h"
51
52
58#define GNUNET_CONSENSUS_ELEMENT_TYPE_USER_MAX 0xFFF0
59
60
70typedef void (*GNUNET_CONSENSUS_ElementCallback) (void *cls,
71 const struct
72 GNUNET_SET_Element *element);
73
74
79
80
101 unsigned int num_peers,
102 const struct GNUNET_PeerIdentity *peers,
103 const struct GNUNET_HashCode *session_id,
105 struct GNUNET_TIME_Absolute deadline,
107 void *new_element_cls);
108
109
121typedef void (*GNUNET_CONSENSUS_InsertDoneCallback) (void *cls,
122 int success);
123
124
138void
140 const struct GNUNET_SET_Element *element,
142 void *idc_cls);
143
144
150typedef void (*GNUNET_CONSENSUS_ConcludeCallback) (void *cls);
151
152
161void
164 void *conclude_cls);
165
166
173void
175
176
177#if 0 /* keep Emacsens' auto-indent happy */
178{
179#endif
180#ifdef __cplusplus
181}
182#endif
183
184#endif
185 /* end of group */
187 /* end of group addition */
static int start
Set if we are to start default services (including ARM).
Definition: gnunet-arm.c:38
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:108
struct GNUNET_CONTAINER_MultiPeerMap * peers
Map from PIDs to struct CadetPeer entries.
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
Configuration API.
static unsigned int num_peers
Number of peers.
Two-peer set operations.
Functions related to time.
void GNUNET_CONSENSUS_destroy(struct GNUNET_CONSENSUS_Handle *consensus)
Destroy a consensus handle (free all state associated with it, no longer call any of the callbacks).
void(* GNUNET_CONSENSUS_ElementCallback)(void *cls, const struct GNUNET_SET_Element *element)
Called when a new element was received from another peer, or an error occurred.
void GNUNET_CONSENSUS_insert(struct GNUNET_CONSENSUS_Handle *consensus, const struct GNUNET_SET_Element *element, GNUNET_CONSENSUS_InsertDoneCallback idc, void *idc_cls)
Insert an element in the set being reconsiled.
void(* GNUNET_CONSENSUS_InsertDoneCallback)(void *cls, int success)
Called when an insertion (transmission to consensus service, which does not imply fully consensus on ...
void(* GNUNET_CONSENSUS_ConcludeCallback)(void *cls)
Called when a conclusion was successful.
struct GNUNET_CONSENSUS_Handle * GNUNET_CONSENSUS_create(const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int num_peers, const struct GNUNET_PeerIdentity *peers, const struct GNUNET_HashCode *session_id, struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute deadline, GNUNET_CONSENSUS_ElementCallback new_element_cb, void *new_element_cls)
Create a consensus session.
void GNUNET_CONSENSUS_conclude(struct GNUNET_CONSENSUS_Handle *consensus, GNUNET_CONSENSUS_ConcludeCallback conclude, void *conclude_cls)
We are finished inserting new elements into the consensus; try to conclude the consensus within a giv...
Handle for the service.
Definition: consensus_api.c:40
void * conclude_cls
Closure for the conclude_cb callback.
Definition: consensus_api.c:74
void * new_element_cls
Closure for new_element_cb.
Definition: consensus_api.c:54
GNUNET_CONSENSUS_ElementCallback new_element_cb
Callback for new elements.
Definition: consensus_api.c:49
struct GNUNET_HashCode session_id
The (local) session identifier for the consensus session.
Definition: consensus_api.c:59
A 512-bit hashcode.
The identity of the host (wraps the signing key of the peer).
Element stored in a set.
Time for absolute times used by GNUnet, in microseconds.