Helper library for interning of peer identifiers. More...
Typedefs | |
typedef unsigned int | GNUNET_PEER_Id |
A GNUNET_PEER_Id is simply a shorter version of a "struct
GNUNET_PeerIdentifier" that can be used inside of a GNUnet peer to save memory when the same identifier needs to be used over and over again. More... | |
Functions | |
GNUNET_PEER_Id | GNUNET_PEER_search (const struct GNUNET_PeerIdentity *pid) |
Search for a peer identity. More... | |
GNUNET_PEER_Id | GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid) |
Intern an peer identity. More... | |
void | GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta) |
Change the reference counter of an interned PID. More... | |
void | GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id *ids, unsigned int count) |
Decrement multiple RCs of peer identities by one. More... | |
void | GNUNET_PEER_resolve (GNUNET_PEER_Id id, struct GNUNET_PeerIdentity *pid) |
Convert an interned PID to a normal peer identity. More... | |
const struct GNUNET_PeerIdentity * | GNUNET_PEER_resolve2 (GNUNET_PEER_Id id) |
Convert an interned PID to a normal peer identity. More... | |
Helper library for interning of peer identifiers.
typedef unsigned int GNUNET_PEER_Id |
A GNUNET_PEER_Id is simply a shorter version of a "struct GNUNET_PeerIdentifier" that can be used inside of a GNUnet peer to save memory when the same identifier needs to be used over and over again.
Definition at line 60 of file gnunet_peer_lib.h.
GNUNET_PEER_Id GNUNET_PEER_search | ( | const struct GNUNET_PeerIdentity * | pid | ) |
Search for a peer identity.
The reference counter is not changed.
pid | identity to find |
Definition at line 84 of file peer.c.
References GNUNET_assert, GNUNET_CONTAINER_multipeermap_get(), map, PeerEntry::pid, pid, and PeerEntry::rc.
GNUNET_PEER_Id GNUNET_PEER_intern | ( | const struct GNUNET_PeerIdentity * | pid | ) |
Intern an peer identity.
If the identity is already known, its reference counter will be increased by one.
pid | identity to intern |
Definition at line 108 of file peer.c.
References free_list_start, GNUNET_array_grow, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CONTAINER_multipeermap_create(), GNUNET_CONTAINER_multipeermap_get(), GNUNET_CONTAINER_multipeermap_put(), GNUNET_new, GNUNET_OK, GNUNET_YES, PeerEntry::id, map, PeerEntry::pid, pid, PeerEntry::rc, ret, size, and table.
Referenced by add_to_list_tunnels(), create_tunnel(), GSF_peer_connect_handler(), and handle_p2p_get().
void GNUNET_PEER_change_rc | ( | GNUNET_PEER_Id | id, |
int | delta | ||
) |
Change the reference counter of an interned PID.
id | identity to change the RC of |
delta | how much to change the RC |
Definition at line 192 of file peer.c.
References delta, free_list_start, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multipeermap_remove(), GNUNET_OK, id, map, PeerEntry::pid, PeerEntry::rc, size, and table.
Referenced by clean_request(), destroy_tunnel(), GSF_peer_disconnect_handler(), GSF_peer_update_responder_peer_(), remove_from_list_tunnels(), and transmit_content().
void GNUNET_PEER_decrement_rcs | ( | const GNUNET_PEER_Id * | ids, |
unsigned int | count | ||
) |
Decrement multiple RCs of peer identities by one.
ids | array of PIDs to decrement the RCs of |
count | size of the ids array |
Definition at line 157 of file peer.c.
References free_list_start, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multipeermap_remove(), GNUNET_OK, id, map, PeerEntry::pid, PeerEntry::rc, size, and table.
Referenced by delete_migration_block(), and GSF_peer_disconnect_handler().
void GNUNET_PEER_resolve | ( | GNUNET_PEER_Id | id, |
struct GNUNET_PeerIdentity * | pid | ||
) |
Convert an interned PID to a normal peer identity.
id | interned PID to convert |
pid | where to write the normal peer identity |
Definition at line 220 of file peer.c.
References GNUNET_assert, id, PeerEntry::id, pid, PeerEntry::rc, size, and table.
Referenced by callback_tunnel_disconnect(), compare_list_tunnels(), find_list_tunnels(), find_list_tunnels_alternate(), flush_respect(), get_tunnel_peer_identity(), GSF_connected_peer_get_identity_(), GSF_dht_lookup_(), GSF_pending_request_get_message_(), GSF_pending_request_test_target_(), handle_p2p_put(), iterate_reset_room(), rebuild_srv_room_basement_structure(), recv_message_peer(), save_list_tunnels(), schedule_transmission(), score_content(), and verify_list_tunnels_flag_token().
const struct GNUNET_PeerIdentity * GNUNET_PEER_resolve2 | ( | GNUNET_PEER_Id | id | ) |
Convert an interned PID to a normal peer identity.
id | interned PID to convert |
Definition at line 234 of file peer.c.
References GNUNET_assert, id, PeerEntry::id, size, and table.
Referenced by connect_tunnel(), and GSF_connected_peer_get_identity2_().