GNUnet  0.10.x
gnunet-service-rps_custommap.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 
26 #include "gnunet_util_lib.h"
27 #include <inttypes.h>
28 
29 
53 struct CustomPeerMap;
54 
55 
63 struct CustomPeerMap *
64 CustomPeerMap_create (unsigned int len);
65 
73 unsigned int
74 CustomPeerMap_size (const struct CustomPeerMap *c_peer_map);
75 
85 int
86 CustomPeerMap_put (const struct CustomPeerMap *c_peer_map,
87  const struct GNUNET_PeerIdentity *peer);
88 
98 int
99 CustomPeerMap_contains_peer (const struct CustomPeerMap *c_peer_map,
100  const struct GNUNET_PeerIdentity *peer);
101 
111 int
112 CustomPeerMap_remove_peer (const struct CustomPeerMap *c_peer_map,
113  const struct GNUNET_PeerIdentity *peer);
114 
124 struct GNUNET_PeerIdentity *
125 CustomPeerMap_get_peer_by_index (const struct CustomPeerMap *c_peer_map,
126  uint32_t index);
127 
137 int
138 CustomPeerMap_remove_peer_by_index (const struct CustomPeerMap *c_peer_map,
139  uint32_t index);
140 
148 void
149 CustomPeerMap_clear (const struct CustomPeerMap *c_peer_map);
150 
156 void
157 CustomPeerMap_destroy (struct CustomPeerMap *c_peer_map);
158 
159 /* end of gnunet-service-rps_custommap.h */
void CustomPeerMap_destroy(struct CustomPeerMap *c_peer_map)
Destroy peermap.
Peer map to store peers with specialised use-cases (push_list, pull_list, view, ...)
int CustomPeerMap_put(const struct CustomPeerMap *c_peer_map, const struct GNUNET_PeerIdentity *peer)
Insert peer into the custom peer map.
void CustomPeerMap_clear(const struct CustomPeerMap *c_peer_map)
Clear the custom peer map.
unsigned int CustomPeerMap_size(const struct CustomPeerMap *c_peer_map)
Get the size of the custom peer map.
int CustomPeerMap_remove_peer_by_index(const struct CustomPeerMap *c_peer_map, uint32_t index)
Remove peer from custom peer map by index.
struct GNUNET_PeerIdentity * CustomPeerMap_get_peer_by_index(const struct CustomPeerMap *c_peer_map, uint32_t index)
Get a peer by index.
struct CustomPeerMap * CustomPeerMap_create(unsigned int len)
Create an empty peermap.
int CustomPeerMap_contains_peer(const struct CustomPeerMap *c_peer_map, const struct GNUNET_PeerIdentity *peer)
Check whether custom peer map contains a peer.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
The identity of the host (wraps the signing key of the peer).
int CustomPeerMap_remove_peer(const struct CustomPeerMap *c_peer_map, const struct GNUNET_PeerIdentity *peer)
Remove peer from custom peer map.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...