GNUnet 0.21.1
gnunet-service-rps_sampler_elem.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C)
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
27#ifndef RPS_SAMPLER_ELEM_H
28#define RPS_SAMPLER_ELEM_H
29#include <inttypes.h>
30
31
32/***********************************************************************
33* WARNING: This section needs to be reviewed regarding the use of
34* functions providing (pseudo)randomness!
35***********************************************************************/
36
41{
42 NOT_EMPTY = 0x0,
43 EMPTY = 0x1
44};
45
50{
57
62
67
68
73
78
83
87 uint32_t num_peers;
88
92 uint32_t num_change;
93
97 char *file_name;
98};
99
100
106void
107RPS_sampler_elem_reinit (struct RPS_SamplerElement *sampler_elem);
108
109
118struct RPS_SamplerElement *
120
121
127void
128RPS_sampler_elem_destroy (struct RPS_SamplerElement *sampler_elem);
129
130
137void
138RPS_sampler_elem_next (struct RPS_SamplerElement *sampler_elem,
139 const struct GNUNET_PeerIdentity *new_ID);
140
147void
148RPS_sampler_elem_set (struct RPS_SamplerElement *sampler_elem,
150
151
152#endif /* RPS_SAMPLER_ELEM_H */
153/* end of gnunet-service-rps.c */
void RPS_sampler_elem_set(struct RPS_SamplerElement *sampler_elem, struct GNUNET_CRYPTO_AuthKey auth_key)
Set the min-wise independent function of the given sampler element.
void RPS_sampler_elem_reinit(struct RPS_SamplerElement *sampler_elem)
Reinitialise a previously initialised sampler element.
void RPS_sampler_elem_destroy(struct RPS_SamplerElement *sampler_elem)
Destroy a sampler element.
struct RPS_SamplerElement * RPS_sampler_elem_create(void)
Create a sampler element and initialise it.
RPS_SamplerEmpty
Used to indicate whether a sampler element is empty.
void RPS_sampler_elem_next(struct RPS_SamplerElement *sampler_elem, const struct GNUNET_PeerIdentity *new_ID)
Update a sampler element with a PeerID.
type for (message) authentication keys
A 512-bit hashcode.
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.
A sampler element sampling one PeerID at a time.
char * file_name
The file name this sampler element should log to.
struct GNUNET_TIME_Absolute last_client_request
Time of last request.
struct GNUNET_TIME_Absolute birth
'Birth'
struct GNUNET_CRYPTO_AuthKey auth_key
Min-wise linear permutation used by this sampler.
uint32_t num_peers
How many times a PeerID was put in this sampler.
struct GNUNET_HashCode peer_id_hash
The according hash value of this PeerID.
uint32_t num_change
How many times this sampler changed the peer_id.
struct GNUNET_PeerIdentity peer_id
The PeerID this sampler currently samples.
enum RPS_SamplerEmpty is_empty
Flag that indicates that we are not holding a valid PeerID right now.