GNUnet  0.11.x
Data Structures | Macros | Functions
gnunet-service-rps_custommap.c File Reference

utilities for managing (information about) peers More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet-service-rps_custommap.h"
#include <inttypes.h>
Include dependency graph for gnunet-service-rps_custommap.c:

Go to the source code of this file.

Data Structures

struct  CustomPeerMap
 Peer map to store peers with specialised use-cases (push_list, pull_list, view, ...) More...
 

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "rps-peers", __VA_ARGS__)
 

Functions

struct CustomPeerMapCustomPeerMap_create (unsigned int len)
 Create an empty peermap. More...
 
unsigned int CustomPeerMap_size (const struct CustomPeerMap *c_peer_map)
 Get the size of the custom peer map. More...
 
int CustomPeerMap_put (const struct CustomPeerMap *c_peer_map, const struct GNUNET_PeerIdentity *peer)
 Insert peer into the custom peer map. More...
 
int CustomPeerMap_contains_peer (const struct CustomPeerMap *c_peer_map, const struct GNUNET_PeerIdentity *peer)
 Check whether custom peer map contains a peer. More...
 
static uint32_t * CustomPeerMap_get_index_pointer (const struct CustomPeerMap *c_peer_map, const struct GNUNET_PeerIdentity *peer)
 Get index of peer in custom peer map. More...
 
int CustomPeerMap_remove_peer (const struct CustomPeerMap *c_peer_map, const struct GNUNET_PeerIdentity *peer)
 Remove peer from custom peer map. More...
 
struct GNUNET_PeerIdentityCustomPeerMap_get_peer_by_index (const struct CustomPeerMap *c_peer_map, uint32_t index)
 Get a peer by index. More...
 
int CustomPeerMap_remove_peer_by_index (const struct CustomPeerMap *c_peer_map, uint32_t index)
 Remove peer from custom peer map by index. More...
 
void CustomPeerMap_clear (const struct CustomPeerMap *c_peer_map)
 Clear the custom peer map. More...
 
void CustomPeerMap_destroy (struct CustomPeerMap *c_peer_map)
 Destroy peermap. More...
 

Detailed Description

utilities for managing (information about) peers

Author
Julius B√ľnger

Definition in file gnunet-service-rps_custommap.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "rps-peers", __VA_ARGS__)

Definition at line 31 of file gnunet-service-rps_custommap.c.

Function Documentation

◆ CustomPeerMap_create()

struct CustomPeerMap* CustomPeerMap_create ( unsigned int  len)

Create an empty peermap.

Parameters
lenthe initial length for the internal maps
Returns
the newly created custom peer map

Definition at line 79 of file gnunet-service-rps_custommap.c.

References GNUNET_CONTAINER_multihashmap32_create(), GNUNET_CONTAINER_multipeermap_create(), GNUNET_new, GNUNET_NO, CustomPeerMap::hash_map, and CustomPeerMap::peer_map.

Referenced by new_sub().

80 {
81  struct CustomPeerMap *c_peer_map;
82 
83  c_peer_map = GNUNET_new (struct CustomPeerMap);
86  GNUNET_NO);
87  return c_peer_map;
88 }
Peer map to store peers with specialised use-cases (push_list, pull_list, view, ...)
struct GNUNET_CONTAINER_MultiPeerMap * peer_map
Peermap to quickly check whether a peer is contained.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
struct GNUNET_CONTAINER_MultiHashMap32 * GNUNET_CONTAINER_multihashmap32_create(unsigned int len)
Create a 32-bit key multi hash map.
struct GNUNET_CONTAINER_MultiHashMap32 * hash_map
Multihashmap to be able to access a random index.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CustomPeerMap_size()

unsigned int CustomPeerMap_size ( const struct CustomPeerMap c_peer_map)

Get the size of the custom peer map.

Parameters
c_peer_mapthe custom peer map to look in
Returns
size of the map

Definition at line 99 of file gnunet-service-rps_custommap.c.

References GNUNET_assert, GNUNET_CONTAINER_multihashmap32_size(), GNUNET_CONTAINER_multipeermap_size(), CustomPeerMap::hash_map, and CustomPeerMap::peer_map.

Referenced by CustomPeerMap_clear(), CustomPeerMap_put(), CustomPeerMap_remove_peer(), CustomPeerMap_remove_peer_by_index(), and do_round().

100 {
103  return GNUNET_CONTAINER_multipeermap_size (c_peer_map->peer_map);
104 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_CONTAINER_MultiPeerMap * peer_map
Peermap to quickly check whether a peer is contained.
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the map.
struct GNUNET_CONTAINER_MultiHashMap32 * hash_map
Multihashmap to be able to access a random index.
unsigned int GNUNET_CONTAINER_multipeermap_size(const struct GNUNET_CONTAINER_MultiPeerMap *map)
Get the number of key-value pairs in the map.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CustomPeerMap_put()

int CustomPeerMap_put ( const struct CustomPeerMap c_peer_map,
const struct GNUNET_PeerIdentity peer 
)

Insert peer into the custom peer map.

Parameters
c_peer_mapthe custom peer map to insert peer
peerthe peer to insert
Returns
GNUNET_OK if map did not contain peer previously GNUNET_NO if map did contain peer previously

Definition at line 117 of file gnunet-service-rps_custommap.c.

References CustomPeerMap_size(), GNUNET_assert, GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_multihashmap32_size(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CONTAINER_multipeermap_contains(), GNUNET_CONTAINER_multipeermap_put(), GNUNET_CONTAINER_multipeermap_size(), GNUNET_new, GNUNET_NO, GNUNET_OK, CustomPeerMap::hash_map, p, peer, and CustomPeerMap::peer_map.

Referenced by handle_peer_pull_reply(), handle_peer_push(), and insert_in_pull_map().

119 {
120  uint32_t *index;
121  struct GNUNET_PeerIdentity *p;
122 
126  peer))
127  {
128  /* Need to store the index of the peer in the peermap to be able to remove
129  * it properly */
130  index = GNUNET_new (uint32_t);
131  *index = CustomPeerMap_size (c_peer_map);
132  p = GNUNET_new (struct GNUNET_PeerIdentity);
133  *p = *peer;
134  GNUNET_assert (p != peer);
135  GNUNET_assert (0 == memcmp (p,
136  peer,
137  sizeof(struct GNUNET_PeerIdentity)));
139  p,
140  index,
143  *index,
144  p,
147  c_peer_map->hash_map) ==
149  return GNUNET_OK;
150  }
151  return GNUNET_NO;
152 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_CONTAINER_MultiPeerMap * peer_map
Peermap to quickly check whether a peer is contained.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
#define GNUNET_new(type)
Allocate a struct or union of the given type.
int GNUNET_CONTAINER_multihashmap32_put(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
, &#39; bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_...
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the map.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
unsigned int CustomPeerMap_size(const struct CustomPeerMap *c_peer_map)
Get the size of the custom peer map.
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
The identity of the host (wraps the signing key of the peer).
struct GNUNET_CONTAINER_MultiHashMap32 * hash_map
Multihashmap to be able to access a random index.
unsigned int GNUNET_CONTAINER_multipeermap_size(const struct GNUNET_CONTAINER_MultiPeerMap *map)
Get the number of key-value pairs in the map.
int GNUNET_CONTAINER_multipeermap_contains(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Check if the map contains any value under the given key (including values that are NULL)...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CustomPeerMap_contains_peer()

int CustomPeerMap_contains_peer ( const struct CustomPeerMap c_peer_map,
const struct GNUNET_PeerIdentity peer 
)

Check whether custom peer map contains a peer.

Parameters
c_peer_mapthe custom peer map to look in
peerthe peer to check for
Returns
GNUNET_OK if map contains peer GNUNET_NO otherwise

Definition at line 165 of file gnunet-service-rps_custommap.c.

References GNUNET_CONTAINER_multipeermap_contains(), and CustomPeerMap::peer_map.

Referenced by check_sending_channel_needed(), clean_peer(), CustomPeerMap_get_index_pointer(), and CustomPeerMap_remove_peer().

167 {
168  return GNUNET_CONTAINER_multipeermap_contains (c_peer_map->peer_map, peer);
169 }
struct GNUNET_CONTAINER_MultiPeerMap * peer_map
Peermap to quickly check whether a peer is contained.
int GNUNET_CONTAINER_multipeermap_contains(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Check if the map contains any value under the given key (including values that are NULL)...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CustomPeerMap_get_index_pointer()

static uint32_t* CustomPeerMap_get_index_pointer ( const struct CustomPeerMap c_peer_map,
const struct GNUNET_PeerIdentity peer 
)
static

Get index of peer in custom peer map.

Parameters
c_peer_mapthe custom peer map to look in
peerthe peer to get the index from
Returns
the index

Definition at line 181 of file gnunet-service-rps_custommap.c.

References CustomPeerMap_contains_peer(), GNUNET_assert, GNUNET_CONTAINER_multipeermap_get(), GNUNET_YES, and CustomPeerMap::peer_map.

Referenced by CustomPeerMap_remove_peer(), and CustomPeerMap_remove_peer_by_index().

183 {
184  uint32_t *index;
185 
186  GNUNET_assert (GNUNET_YES == CustomPeerMap_contains_peer (c_peer_map, peer));
187  index = GNUNET_CONTAINER_multipeermap_get (c_peer_map->peer_map, peer);
188  return index;
189 }
int CustomPeerMap_contains_peer(const struct CustomPeerMap *c_peer_map, const struct GNUNET_PeerIdentity *peer)
Check whether custom peer map contains a peer.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_CONTAINER_MultiPeerMap * peer_map
Peermap to quickly check whether a peer is contained.
void * GNUNET_CONTAINER_multipeermap_get(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Given a key find a value in the map matching the key.
#define GNUNET_YES
Definition: gnunet_common.h:77
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CustomPeerMap_remove_peer()

int CustomPeerMap_remove_peer ( const struct CustomPeerMap c_peer_map,
const struct GNUNET_PeerIdentity peer 
)

Remove peer from custom peer map.

Parameters
c_peer_mapthe custom peer map to remove the peer from
peerthe peer to remove
Returns
GNUNET_OK if map contained peer and removed it successfully GNUNET_NO if map does not contain peer

Definition at line 202 of file gnunet-service-rps_custommap.c.

References CustomPeerMap_contains_peer(), CustomPeerMap_get_index_pointer(), CustomPeerMap_size(), GNUNET_assert, GNUNET_CONTAINER_multihashmap32_get(), GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_multihashmap32_remove_all(), GNUNET_CONTAINER_multihashmap32_size(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CONTAINER_multipeermap_get(), GNUNET_CONTAINER_multipeermap_remove_all(), GNUNET_CONTAINER_multipeermap_size(), GNUNET_free, GNUNET_NO, GNUNET_OK, CustomPeerMap::hash_map, p, and CustomPeerMap::peer_map.

Referenced by CustomPeerMap_remove_peer_by_index(), and remove_peer().

204 {
205  uint32_t *index;
206  struct GNUNET_PeerIdentity *p;
207  uint32_t *last_index;
208  struct GNUNET_PeerIdentity *last_p;
209 
210  if (GNUNET_NO == CustomPeerMap_contains_peer (c_peer_map,
211  peer))
212  {
213  return GNUNET_NO;
214  }
215  index = CustomPeerMap_get_index_pointer (c_peer_map,
216  peer);
217  GNUNET_assert (*index < CustomPeerMap_size (c_peer_map));
218  /* Need to get the pointer stored in the hashmap to free it */
220  *index);
221  GNUNET_assert (NULL != p);
223  *index);
224  // TODO wrong peerid?
226  peer);
227  if (*index != CustomPeerMap_size (c_peer_map))
228  { /* fill 'gap' with peer at last index */
229  last_p =
231  CustomPeerMap_size (c_peer_map));
232  GNUNET_assert (NULL != last_p);
233  last_index = GNUNET_CONTAINER_multipeermap_get (c_peer_map->peer_map,
234  last_p);
235  GNUNET_assert (NULL != last_index);
236  GNUNET_assert (CustomPeerMap_size (c_peer_map) == *last_index);
238  *index, last_p,
241  *last_index);
242  *last_index = *index;
243  }
244  GNUNET_free (index);
247  GNUNET_free (p);
248  return GNUNET_OK;
249 }
static uint32_t * CustomPeerMap_get_index_pointer(const struct CustomPeerMap *c_peer_map, const struct GNUNET_PeerIdentity *peer)
Get index of peer in custom peer map.
int GNUNET_CONTAINER_multipeermap_remove_all(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Remove all entries for the given key from the map.
int CustomPeerMap_contains_peer(const struct CustomPeerMap *c_peer_map, const struct GNUNET_PeerIdentity *peer)
Check whether custom peer map contains a peer.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_CONTAINER_MultiPeerMap * peer_map
Peermap to quickly check whether a peer is contained.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
int GNUNET_CONTAINER_multihashmap32_put(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
int GNUNET_CONTAINER_multihashmap32_remove_all(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key)
Remove all entries for the given key from the map.
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
void * GNUNET_CONTAINER_multihashmap32_get(const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key)
Given a key find a value in the map matching the key.
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the map.
There must only be one value per key; storing a value should fail if a value under the same key alrea...
unsigned int CustomPeerMap_size(const struct CustomPeerMap *c_peer_map)
Get the size of the custom peer map.
The identity of the host (wraps the signing key of the peer).
struct GNUNET_CONTAINER_MultiHashMap32 * hash_map
Multihashmap to be able to access a random index.
void * GNUNET_CONTAINER_multipeermap_get(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Given a key find a value in the map matching the key.
unsigned int GNUNET_CONTAINER_multipeermap_size(const struct GNUNET_CONTAINER_MultiPeerMap *map)
Get the number of key-value pairs in the map.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CustomPeerMap_get_peer_by_index()

struct GNUNET_PeerIdentity* CustomPeerMap_get_peer_by_index ( const struct CustomPeerMap c_peer_map,
uint32_t  index 
)

Get a peer by index.

Parameters
c_peer_mapthe custom peer map to look in
indexthe index of the peer to get
Returns
peer to the corresponding index. if this index is not known, return NULL

Definition at line 262 of file gnunet-service-rps_custommap.c.

References GNUNET_CONTAINER_multihashmap32_contains(), GNUNET_CONTAINER_multihashmap32_get(), GNUNET_YES, and CustomPeerMap::hash_map.

Referenced by CustomPeerMap_remove_peer_by_index(), and do_round().

264 {
265  if (GNUNET_YES ==
267  {
268  return GNUNET_CONTAINER_multihashmap32_get (c_peer_map->hash_map, index);
269  }
270  return NULL;
271 }
int GNUNET_CONTAINER_multihashmap32_contains(const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key)
Check if the map contains any value under the given key (including values that are NULL)...
void * GNUNET_CONTAINER_multihashmap32_get(const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key)
Given a key find a value in the map matching the key.
struct GNUNET_CONTAINER_MultiHashMap32 * hash_map
Multihashmap to be able to access a random index.
#define GNUNET_YES
Definition: gnunet_common.h:77
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CustomPeerMap_remove_peer_by_index()

int CustomPeerMap_remove_peer_by_index ( const struct CustomPeerMap c_peer_map,
uint32_t  index 
)

Remove peer from custom peer map by index.

Parameters
c_peer_mapthe custom peer map to remove the peer from
indexthe index of the peer to remove
Returns
GNUNET_OK if map contained peer and removed it successfully GNUNET_NO if map does not contain (index of) peer

Definition at line 284 of file gnunet-service-rps_custommap.c.

References CustomPeerMap_get_index_pointer(), CustomPeerMap_get_peer_by_index(), CustomPeerMap_remove_peer(), CustomPeerMap_size(), GNUNET_assert, GNUNET_CONTAINER_multihashmap32_contains(), GNUNET_CONTAINER_multihashmap32_size(), GNUNET_CONTAINER_multipeermap_size(), GNUNET_NO, GNUNET_OK, CustomPeerMap::hash_map, peer, and CustomPeerMap::peer_map.

Referenced by CustomPeerMap_clear().

286 {
287  uint32_t *index_p;
288  struct GNUNET_PeerIdentity *peer;
289 
290  if (index >= CustomPeerMap_size (c_peer_map))
291  {
292  return GNUNET_NO;
293  }
296  if (GNUNET_NO ==
298  {
299  return GNUNET_NO;
300  }
301  peer = CustomPeerMap_get_peer_by_index (c_peer_map, index);
302  GNUNET_assert (NULL != peer);
303  index_p = CustomPeerMap_get_index_pointer (c_peer_map, peer);
304  GNUNET_assert (index == *index_p);
305  CustomPeerMap_remove_peer (c_peer_map, peer);
308  return GNUNET_OK;
309 }
static uint32_t * CustomPeerMap_get_index_pointer(const struct CustomPeerMap *c_peer_map, const struct GNUNET_PeerIdentity *peer)
Get index of peer in custom peer map.
struct GNUNET_PeerIdentity * CustomPeerMap_get_peer_by_index(const struct CustomPeerMap *c_peer_map, uint32_t index)
Get a peer by index.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_CONTAINER_MultiPeerMap * peer_map
Peermap to quickly check whether a peer is contained.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
int CustomPeerMap_remove_peer(const struct CustomPeerMap *c_peer_map, const struct GNUNET_PeerIdentity *peer)
Remove peer from custom peer map.
int GNUNET_CONTAINER_multihashmap32_contains(const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key)
Check if the map contains any value under the given key (including values that are NULL)...
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the map.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
unsigned int CustomPeerMap_size(const struct CustomPeerMap *c_peer_map)
Get the size of the custom peer map.
The identity of the host (wraps the signing key of the peer).
struct GNUNET_CONTAINER_MultiHashMap32 * hash_map
Multihashmap to be able to access a random index.
unsigned int GNUNET_CONTAINER_multipeermap_size(const struct GNUNET_CONTAINER_MultiPeerMap *map)
Get the number of key-value pairs in the map.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CustomPeerMap_clear()

void CustomPeerMap_clear ( const struct CustomPeerMap c_peer_map)

Clear the custom peer map.

Parameters
c_peer_mapthe custom peer map to look in
Returns
size of the map

Definition at line 320 of file gnunet-service-rps_custommap.c.

References CustomPeerMap_remove_peer_by_index(), CustomPeerMap_size(), GNUNET_assert, GNUNET_CONTAINER_multihashmap32_contains(), GNUNET_OK, GNUNET_YES, and CustomPeerMap::hash_map.

Referenced by CustomPeerMap_destroy(), and do_round().

321 {
322  while (0 < CustomPeerMap_size (c_peer_map))
323  {
326  c_peer_map->hash_map,
328  c_peer_map) - 1));
332  c_peer_map) - 1));
333  }
334  GNUNET_assert (0 == CustomPeerMap_size (c_peer_map));
335 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
int CustomPeerMap_remove_peer_by_index(const struct CustomPeerMap *c_peer_map, uint32_t index)
Remove peer from custom peer map by index.
int GNUNET_CONTAINER_multihashmap32_contains(const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key)
Check if the map contains any value under the given key (including values that are NULL)...
unsigned int CustomPeerMap_size(const struct CustomPeerMap *c_peer_map)
Get the size of the custom peer map.
struct GNUNET_CONTAINER_MultiHashMap32 * hash_map
Multihashmap to be able to access a random index.
#define GNUNET_YES
Definition: gnunet_common.h:77
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CustomPeerMap_destroy()

void CustomPeerMap_destroy ( struct CustomPeerMap c_peer_map)

Destroy peermap.

Parameters
c_peer_mapthe map to destroy

Definition at line 344 of file gnunet-service-rps_custommap.c.

References CustomPeerMap_clear(), GNUNET_CONTAINER_multihashmap32_destroy(), GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_free, CustomPeerMap::hash_map, and CustomPeerMap::peer_map.

Referenced by destroy_sub().

345 {
346  CustomPeerMap_clear (c_peer_map);
349  GNUNET_free (c_peer_map);
350 }
struct GNUNET_CONTAINER_MultiPeerMap * peer_map
Peermap to quickly check whether a peer is contained.
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
void CustomPeerMap_clear(const struct CustomPeerMap *c_peer_map)
Clear the custom peer map.
void GNUNET_CONTAINER_multihashmap32_destroy(struct GNUNET_CONTAINER_MultiHashMap32 *map)
Destroy a 32-bit key hash map.
struct GNUNET_CONTAINER_MultiHashMap32 * hash_map
Multihashmap to be able to access a random index.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function: