GNUnet  0.10.x
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  NOT_EMPTY = 0x0,
42  EMPTY = 0x1
43 };
44 
55 
60 
65 
66 
71 
76 
81 
85  uint32_t num_peers;
86 
90  uint32_t num_change;
91 
95  char *file_name;
96 };
97 
98 
104 void
105 RPS_sampler_elem_reinit(struct RPS_SamplerElement *sampler_elem);
106 
107 
116 struct RPS_SamplerElement *
118 
119 
125 void
126 RPS_sampler_elem_destroy(struct RPS_SamplerElement *sampler_elem);
127 
128 
135 void
136 RPS_sampler_elem_next(struct RPS_SamplerElement *sampler_elem,
137  const struct GNUNET_PeerIdentity *new_ID);
138 
145 void
146 RPS_sampler_elem_set(struct RPS_SamplerElement *sampler_elem,
148 
149 
150 #endif /* RPS_SAMPLER_ELEM_H */
151 /* end of gnunet-service-rps.c */
uint32_t num_peers
How many times a PeerID was put in this sampler.
struct GNUNET_TIME_Absolute birth
&#39;Birth&#39;
A sampler element sampling one PeerID at a time.
void RPS_sampler_elem_destroy(struct RPS_SamplerElement *sampler_elem)
Destroy a sampler element.
struct GNUNET_TIME_Absolute last_client_request
Time of last request.
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.
struct RPS_SamplerElement * RPS_sampler_elem_create(void)
Create a sampler element and initialise it.
void RPS_sampler_elem_reinit(struct RPS_SamplerElement *sampler_elem)
Reinitialise a previously initialised sampler element.
enum RPS_SamplerEmpty is_empty
Flag that indicates that we are not holding a valid PeerID right now.
struct GNUNET_PeerIdentity peer_id
The PeerID this sampler currently samples.
A 512-bit hashcode.
struct GNUNET_HashCode peer_id_hash
The according hash value of this PeerID.
The identity of the host (wraps the signing key of the peer).
RPS_SamplerEmpty
Used to indicate whether a sampler element is empty.
char * file_name
The file name this sampler element should log to.
struct GNUNET_CRYPTO_AuthKey auth_key
Min-wise linear permutation used by this sampler.
Time for absolute times used by GNUnet, in microseconds.
uint32_t num_change
How many times this sampler changed the peer_id.
type for (message) authentication keys
void RPS_sampler_elem_next(struct RPS_SamplerElement *sampler_elem, const struct GNUNET_PeerIdentity *new_ID)
Update a sampler element with a PeerID.