29 #define LOG(kind, ...) GNUNET_log_from (kind, "util-peer", __VA_ARGS__) 127 for (
unsigned int i = ret; i <
size; i++)
130 table[i]->
pid = i + 1;
169 for (i = count - 1; i >= 0; i--)
177 if (0 == table[
id]->
rc)
204 (table[
id]->
rc >= (
unsigned int) (-delta)));
206 if (0 == table[
id]->
rc)
234 *pid = table[
id]->
id;
249 return &table[
id]->
id;
const struct GNUNET_PeerIdentity * GNUNET_PEER_resolve2(GNUNET_PEER_Id id)
Convert an interned PID to a normal peer identity.
static struct GNUNET_TIME_Relative delta
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static int ret
Return value of the commandline.
static struct Experiment * e
GNUNET_PEER_Id GNUNET_PEER_search(const struct GNUNET_PeerIdentity *pid)
Search for a peer identity.
int GNUNET_CONTAINER_multipeermap_remove(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
Remove the given key-value pair from the map.
unsigned int rc
Reference counter, 0 if this slot is not used.
#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).
void GNUNET_PEER_resolve(GNUNET_PEER_Id id, struct GNUNET_PeerIdentity *pid)
Convert an interned PID to a normal peer identity.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
unsigned int GNUNET_PEER_Id
A GNUNET_PEER_Id is simply a shorter version of a "struct GNUNET_PeerIdentifier" that can be used ins...
static struct GNUNET_CONTAINER_MultiPeerMap * ids
GNUNET_PeerIdentity -> CadetPeer.
static struct PeerEntry ** table
Table with our interned peer IDs.
Internal representation of the hash map.
void GNUNET_PEER_decrement_rcs(const GNUNET_PEER_Id *ids, unsigned int count)
Decrement multiple RCs of peer identities by one.
static struct GNUNET_CONTAINER_MultiPeerMap * map
Peermap of PeerIdentities to "struct PeerEntry" (for fast lookup).
There must only be one value per key; storing a value should fail if a value under the same key alrea...
static unsigned int size
Size of the "table".
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).
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.
void GNUNET_PEER_change_rc(GNUNET_PEER_Id id, int delta)
Change the reference counter of an interned PID.
GNUNET_PEER_Id pid
Short version of the identifier; if the RC==0, then index of next free slot in table, otherwise equal to this slot in the table.
struct GNUNET_PeerIdentity id
What is the identity of the peer?
static unsigned int free_list_start
Index of the beginning of the free list in the table; set to "size" if no slots are free in the table...
GNUNET_PEER_Id GNUNET_PEER_intern(const struct GNUNET_PeerIdentity *pid)
Intern an peer identity.