Hash map with multiple values per key. More...
Typedefs | |
typedef enum GNUNET_GenericReturnValue(* | GNUNET_CONTAINER_MultiHashMapIteratorCallback) (void *cls, const struct GNUNET_HashCode *key, void *value) |
Iterator over hash map entries. More... | |
typedef enum GNUNET_GenericReturnValue(* | GNUNET_CONTAINER_PeerMapIterator) (void *cls, const struct GNUNET_PeerIdentity *key, void *value) |
Iterator over hash map entries. More... | |
typedef enum GNUNET_GenericReturnValue(* | GNUNET_CONTAINER_ShortmapIterator) (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
Iterator over hash map entries. More... | |
typedef enum GNUNET_GenericReturnValue(* | GNUNET_CONTAINER_MultiUuidmapIteratorCallback) (void *cls, const struct GNUNET_Uuid *key, void *value) |
Iterator over uuid map entries. More... | |
typedef enum GNUNET_GenericReturnValue(* | GNUNET_CONTAINER_MultiHashMapIterator32Callback) (void *cls, uint32_t key, void *value) |
Iterator over hash map entries. More... | |
Enumerations | |
enum | GNUNET_CONTAINER_MultiHashMapOption { GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE , GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE , GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY , GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST } |
Options for storing values in the HashMap. More... | |
Hash map with multiple values per key.
typedef enum GNUNET_GenericReturnValue(* GNUNET_CONTAINER_MultiHashMapIteratorCallback) (void *cls, const struct GNUNET_HashCode *key, void *value) |
Iterator over hash map entries.
cls | closure |
key | current key code |
value | value in the hash map |
Definition at line 330 of file gnunet_container_lib.h.
typedef enum GNUNET_GenericReturnValue(* GNUNET_CONTAINER_PeerMapIterator) (void *cls, const struct GNUNET_PeerIdentity *key, void *value) |
Iterator over hash map entries.
cls | closure |
key | current public key |
value | value in the hash map |
Definition at line 670 of file gnunet_container_lib.h.
typedef enum GNUNET_GenericReturnValue(* GNUNET_CONTAINER_ShortmapIterator) (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
Iterator over hash map entries.
cls | closure |
key | current public key |
value | value in the hash map |
Definition at line 953 of file gnunet_container_lib.h.
typedef enum GNUNET_GenericReturnValue(* GNUNET_CONTAINER_MultiUuidmapIteratorCallback) (void *cls, const struct GNUNET_Uuid *key, void *value) |
Iterator over uuid map entries.
cls | closure |
key | current public key |
value | value in the hash map |
Definition at line 1236 of file gnunet_container_lib.h.
typedef enum GNUNET_GenericReturnValue(* GNUNET_CONTAINER_MultiHashMapIterator32Callback) (void *cls, uint32_t key, void *value) |
Iterator over hash map entries.
cls | closure |
key | current key code |
value | value in the hash map |
Definition at line 1519 of file gnunet_container_lib.h.
Options for storing values in the HashMap.
Enumerator | |
---|---|
GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE | If a value with the given key exists, replace it. Note that the old value would NOT be freed by replace (the application has to make sure that this happens if required). |
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE | Allow multiple values with the same key. |
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY | There must only be one value per key; storing a value should fail if a value under the same key already exists. |
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST | , ' bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY; implemented just like GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE but this option documents better what is intended if GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY is what is desired). |
Definition at line 357 of file gnunet_container_lib.h.
struct GNUNET_CONTAINER_MultiHashMap* GNUNET_CONTAINER_multihashmap_create | ( | unsigned int | len, |
int | do_not_copy_keys | ||
) |
Create a multi hash map.
len | initial size (map will grow as needed) |
do_not_copy_keys | GNUNET_NO is always safe and should be used by default; GNUNET_YES means that on 'put', the 'key' does not have to be copied as the destination of the pointer is guaranteed to be life as long as the value is stored in the hashmap. This can significantly reduce memory consumption, but of course is also a recipe for heap corruption if the assumption is not true. Only use this if (1) memory use is important in this case and (2) you have triple-checked that the invariant holds |
Definition at line 181 of file container_multihashmap.c.
References GNUNET_assert, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_malloc_large, GNUNET_MAX_MALLOC_CHECKED, GNUNET_new, GNUNET_new_array, len, GNUNET_CONTAINER_MultiHashMap::map, GNUNET_CONTAINER_MultiHashMap::map_length, and GNUNET_CONTAINER_MultiHashMap::use_small_entries.
Referenced by check_unique(), create_download_context(), create_handle(), create_member(), create_member_session(), create_response(), create_room(), create_service(), create_srv_handle(), database_setup(), deserialize_download(), deserialize_search(), diff_create(), GDS_CLIENTS_init(), GDS_ROUTING_init(), get_cadet(), get_file_handle(), GNUNET_CADET_connect(), GNUNET_DHT_connect(), GNUNET_FS_indexing_init(), GNUNET_FS_namespace_list_updateable(), GNUNET_FS_search_start_searching_(), GNUNET_FS_share_tree_trim(), GNUNET_IDENTITY_connect(), GNUNET_PEERSTORE_watch(), GNUNET_TESTBED_barrier_init_(), GSF_peer_connect_handler(), GSF_pending_request_init_(), GSF_plan_add_(), GST_barriers_init(), handle_alice_client_message(), handle_bob_client_message(), handle_client_accept(), handle_client_create_set(), handle_client_evaluate(), handle_client_join(), handle_link_controllers(), handle_port_open(), init_contact_store(), init_ego_store(), init_message_store(), init_operation_store(), init_socket(), intersection_accept(), intersection_evaluate(), iterate_forward_members(), iterate_notify_about_members(), libgnunet_plugin_datacache_heap_init(), libgnunet_plugin_datastore_heap_init(), libgnunet_plugin_dhtu_ip_init(), REGEX_INTERNAL_iterate_reachable_edges(), REGEX_INTERNAL_search(), rfn_create(), run(), search_start(), send_full_set(), switch_member_session(), union_accept(), and union_evaluate().
void GNUNET_CONTAINER_multihashmap_destroy | ( | struct GNUNET_CONTAINER_MultiHashMap * | map | ) |
Destroy a hash map.
Will not free any values stored in the hash map!
map | the map |
Definition at line 216 of file container_multihashmap.c.
References GNUNET_assert, GNUNET_free, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by _GSS_operation_destroy(), check_key_type(), check_unique(), cleanup(), cleanup_handle(), clear_contact_store(), clear_ego_store(), clear_message_store(), clear_operation_store(), client_disconnect_cb(), close_all_files(), database_shutdown(), destroy_handle(), destroy_member(), destroy_member_session(), destroy_room(), destroy_service(), destroy_service_session(), destroy_srv_handle(), disconnect_cb(), do_shutdown(), fail_intersection_operation(), free_download_context(), free_search_context(), free_update_information_graph(), GNUNET_CADET_disconnect(), GNUNET_DHT_disconnect(), GNUNET_FS_download_signal_suspend_(), GNUNET_FS_indexing_done(), GNUNET_FS_search_signal_suspend_(), GNUNET_FS_search_stop(), GNUNET_FS_share_tree_trim(), GNUNET_PEERSTORE_disconnect(), GNUNET_TESTBED_barrier_remove_(), GSF_peer_disconnect_handler(), GSF_plan_notify_peer_disconnect_(), GST_barriers_destroy(), intersection_op_cancel(), iterate_forward_members(), iterate_notify_about_members(), iterate_zones(), kill_slave(), libgnunet_plugin_datacache_heap_done(), libgnunet_plugin_dhtu_ip_done(), libgnunet_plugin_rest_openid_connect_done(), main(), print_finish(), REGEX_INTERNAL_iterate_reachable_edges(), REGEX_INTERNAL_search_cancel(), search_start(), shutdown_rest(), shutdown_task(), and union_op_cancel().
void* GNUNET_CONTAINER_multihashmap_get | ( | const struct GNUNET_CONTAINER_MultiHashMap * | map, |
const struct GNUNET_HashCode * | key | ||
) |
Given a key find a value in the map matching the key.
map | the map |
key | what to look for |
Definition at line 282 of file container_multihashmap.c.
References GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
Referenced by add_file(), add_to_keyword_counter(), add_to_meta_counter(), callback_ego_lookup(), callback_ego_rename(), cancel_store_operation(), cb_intersection_element_removed(), change_srv_handle_member_id(), check_and_remove_pending_reversal(), check_member_session_history(), close_handle_room(), code_redirect(), collector(), consume_fail(), consume_ticket(), cookie_identity_interpretation(), create_response(), delete_store_ego(), diff_insert(), ego_sign_data(), entry_handle_room_at(), execute_add(), execute_remove(), find_port(), find_target(), GCCH_channel_incoming_new(), GCCH_channel_local_new(), get_file_handle(), get_gns_cont(), get_handle_contact(), get_member_session(), get_redirect_state(), get_room_message(), get_room_sender(), get_service_room(), get_srv_handle_member_id(), get_store_contact(), get_store_contact_raw(), get_store_message(), get_store_message_link(), get_url_parameter_copy(), GNUNET_FS_add_to_index(), GNUNET_FS_handle_on_demand_block(), GNUNET_MESSENGER_enter_room(), GNUNET_MESSENGER_open_room(), handle_barrier_cancel(), handle_barrier_status(), handle_barrier_wait(), handle_client_set_add(), handle_delete_message(), handle_identity_update(), handle_member_id(), handle_port_close(), handle_recv_message(), handle_union_p2p_demand(), handle_union_p2p_offer(), handle_watch_record(), is_message_in_message_control_flow(), login_cont(), lookup_diff(), lookup_rfn(), lookup_set(), lookup_task(), mark_as_reachable(), message_token(), mq_init(), namecache_lookup_block(), namestore_flat_lookup_records(), namestore_get(), ns_lookup_result_cb(), open_handle_room(), parse_credentials_basic_auth(), parse_credentials_post_body(), peerinfo_get(), pending_reversal_timeout(), post_data_iter(), queue_destroy(), remove_high_frequency_keywords(), rfn_vote(), route_packet(), sock_read(), token_endpoint(), update_message_control_flow(), update_store_ego(), use_store_operation(), and userinfo_endpoint().
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_remove | ( | struct GNUNET_CONTAINER_MultiHashMap * | map, |
const struct GNUNET_HashCode * | key, | ||
const void * | value | ||
) |
Remove the given key-value pair from the map.
Note that if the key-value pair is in the map multiple times, only one of the pairs will be removed.
map | the map |
key | key of the key-value pair |
value | value of the key-value pair |
Definition at line 397 of file container_multihashmap.c.
References map, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, and MapEntry::sme.
Referenced by add_file(), bind_loose_channel(), callback_ego_rename(), cancel_store_operation(), cb_intersection_element_removed(), clean_channel(), clean_request(), client_disconnect_it(), client_release_ports(), close_handle_room(), close_service_room(), consume_fail(), consume_ticket(), create_target(), delete_entries(), delete_store_ego(), delete_value(), expire_entries(), expire_oldest_entry(), filter_all(), free_channel_state(), free_destination_entry(), free_ego(), free_pending_request(), free_service_record(), get_store_message(), GNUNET_CADET_close_port(), GNUNET_DHT_get_stop(), GNUNET_FS_indexing_do_unindex(), GNUNET_FS_indexing_done(), GNUNET_PEERSTORE_watch_cancel(), GNUNET_TESTBED_barrier_remove_(), GSC_drop_loose_channel(), GSF_cadet_query_cancel(), GSF_plan_notify_peer_disconnect_(), GSF_plan_notify_request_done_(), handle_delete_message(), handle_identity_update(), handle_port_close(), handle_union_p2p_elements(), handle_watch_cancel(), iterator_bf_reduce(), libgnunet_plugin_datacache_heap_done(), migrate_and_drop_keywords(), migrate_and_drop_metadata(), move_to_pending(), ns_lookup_result_cb(), peer_destroy(), pending_reversal_timeout(), pending_reversals_delete_it(), process_result_with_request(), reconstruct_cb(), reghost_free_iterator(), remove_all(), remove_barrier(), remove_client_query_record(), remove_iterator(), remove_member_session(), remove_store_contact(), setup_state_record(), unbind_store_ego(), and update_store_contact().
int GNUNET_CONTAINER_multihashmap_remove_all | ( | struct GNUNET_CONTAINER_MultiHashMap * | map, |
const struct GNUNET_HashCode * | key | ||
) |
Remove all entries for the given key from the map.
Note that the values would not be "freed".
map | the map |
key | identifies values to be removed |
Definition at line 465 of file container_multihashmap.c.
References MapEntry::bme, GNUNET_free, GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, GNUNET_CONTAINER_MultiPeerMap::modification_counter, BigMapEntry::next, SmallMapEntry::next, p, ret, GNUNET_CONTAINER_MultiPeerMap::size, MapEntry::sme, update_next_cache_bme(), update_next_cache_sme(), and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by clear_member_chain_history(), expire_blocks(), map_remove_iterator(), namecache_cache_block(), and namestore_flat_store_records().
unsigned int GNUNET_CONTAINER_multihashmap_clear | ( | struct GNUNET_CONTAINER_MultiHashMap * | map | ) |
Remove all entries from the map.
Note that the values would not be "freed".
map | the map |
Definition at line 572 of file container_multihashmap.c.
References GNUNET_CONTAINER_multihashmap_iterate(), map, remove_all(), ret, and GNUNET_CONTAINER_MultiPeerMap::size.
Referenced by check_member_session_completion().
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_contains | ( | const struct GNUNET_CONTAINER_MultiHashMap * | map, |
const struct GNUNET_HashCode * | key | ||
) |
Check if the map contains any value under the given key (including values that are NULL).
map | the map |
key | the key to test if a value exists for it |
Definition at line 572 of file container_multihashmap.c.
Referenced by allocate_v4_address(), allocate_v6_address(), build_authz_response(), check_member_session_history(), code_redirect(), collector(), contains_store_message(), cookie_identity_interpretation(), do_flood(), ego_get_all(), ego_get_response(), ego_sign_data(), forward_about_members(), get_gns_cont(), get_url_parameter_copy(), GNUNET_TESTBED_barrier_init_(), handle_barrier_cancel(), handle_barrier_init(), handle_room_message(), handle_union_p2p_offer(), iterate_save_messages(), load_message_store_entries(), load_message_store_links(), mq_init(), namestore_get(), notify_about_members(), parse_credentials_basic_auth(), parse_credentials_post_body(), peerinfo_get(), regex_next_edge(), register_host(), run(), and userinfo_endpoint().
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_contains_value | ( | const struct GNUNET_CONTAINER_MultiHashMap * | map, |
const struct GNUNET_HashCode * | key, | ||
const void * | value | ||
) |
Check if the map contains the given value under the given key.
map | the map |
key | the key to test if a value exists for it |
value | value to test for |
Definition at line 572 of file container_multihashmap.c.
Referenced by bind_store_ego(), plan(), schedule_block_download(), and unbind_store_ego().
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put | ( | struct GNUNET_CONTAINER_MultiHashMap * | map, |
const struct GNUNET_HashCode * | key, | ||
void * | value, | ||
enum GNUNET_CONTAINER_MultiHashMapOption | opt | ||
) |
Store a key-value pair in the map.
map | the map |
key | key to use |
value | value to use |
opt | options for put |
map | the map |
key | key to use |
value | value to use |
opt | options for put |
Definition at line 645 of file container_multihashmap.c.
Referenced by add_link(), add_member_session(), add_to_keyword_counter(), add_to_meta_counter(), bind_store_ego(), callback_ego_rename(), callback_scan_for_operations(), change_srv_handle_member_id(), check_dht_local_get_result_seen(), check_unique(), collector(), create_handle_member_id(), create_randomized_element_iterator(), database_setup(), decode_and_send(), deserialize_search_result(), dht_get_string_handler(), diff_insert(), entry_service_room(), execute_add(), filtered_map_initialization(), find_target(), forward_about_members(), GCCH_channel_incoming_new(), GCCH_channel_local_new(), GDS_ROUTING_add(), get_cb(), get_file_handle(), get_store_contact(), get_store_message(), GNUNET_CADET_open_port(), GNUNET_DHT_get_start(), GNUNET_FS_add_to_index(), GNUNET_FS_namespace_list_updateable(), GNUNET_MESSENGER_enter_room(), GNUNET_MESSENGER_open_room(), GNUNET_PEERSTORE_watch(), GNUNET_TESTBED_barrier_init_(), GSF_pending_request_create_(), GSF_plan_add_(), handle_alice_client_message(), handle_alice_client_message_multipart(), handle_barrier_init(), handle_bob_client_message(), handle_bob_client_message_multipart(), handle_client_redirect_to_ip(), handle_client_redirect_to_service(), handle_client_set_add(), handle_identity_update(), handle_p2p_get(), handle_port_open(), handle_room_message(), handle_union_p2p_inquiry(), handle_union_p2p_offer(), handle_watch(), header_iterator(), heap_plugin_put(), init_socket(), initialize_map_unfiltered(), iterate_copy_history(), load_member_session_history(), load_message_store_entries(), load_message_store_links(), load_state(), login_cont(), maint_child_death(), mq_init(), namecache_cache_block(), namestore_flat_store_records(), notify_about_members(), open_service_room(), peerstore_flat_store_record(), post_data_iter(), process_ksk_result(), process_sks_result(), put_diff(), put_rfn(), put_set(), put_store_message(), put_task(), queue(), read_index_list(), regex_find_path(), REGEX_INTERNAL_search(), regex_next_edge(), register_hashcode(), register_host(), rfn_vote(), route_packet(), run(), schedule_block_download(), set_result_cb(), setup_state_record(), sock_read(), store_all_states(), store_service(), token_endpoint(), transmit_pending(), update_member_chain_history(), update_message_control_flow(), update_sre_result_maps(), update_store_contact(), update_store_ego(), url_iterator(), and use_store_operation().
unsigned int GNUNET_CONTAINER_multihashmap_size | ( | const struct GNUNET_CONTAINER_MultiHashMap * | map | ) |
Get the number of key-value pairs in the map.
map | the map |
Definition at line 274 of file container_multihashmap.c.
References map, and GNUNET_CONTAINER_MultiPeerMap::size.
Referenced by cb_intersection_element_removed(), check_alices_cryptodata_message(), check_all_done(), check_union_p2p_elements(), create_target(), disconnect_cb(), GNUNET_DHT_disconnect(), GNUNET_TESTBED_barrier_remove_(), GSF_cadet_query_cancel(), handle_alices_cryptodata_message(), handle_client_accept(), handle_client_iterate(), handle_client_redirect_to_ip(), handle_client_redirect_to_service(), handle_intersection_p2p_done(), handle_union_p2p_request_full(), handle_union_p2p_send_full(), handle_union_p2p_strata_estimator(), initialize_key_to_element(), iterate_zones(), maybe_finish(), mq_init(), peer_destroy(), process_bf(), process_ksk_result(), route_packet(), run(), save_state(), schedule_transmit_search_request(), send_alices_cryptodata_message(), solve_srv_room_member_collisions(), switch_member_session(), transmit_cryptographic_reply(), and union_accept().
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_iterate | ( | struct GNUNET_CONTAINER_MultiHashMap * | map, |
GNUNET_CONTAINER_MultiHashMapIteratorCallback | it, | ||
void * | it_cls | ||
) |
Iterate over all entries in the map.
map | the map |
it | function to call on each entry |
it_cls | extra argument to it |
Definition at line 282 of file container_multihashmap.c.
Referenced by _GSS_operation_destroy(), begin_bf_exchange(), callback_mq_error(), callback_reconnect(), callback_set_handle_name(), check_all_done(), check_key_type(), cleanup(), cleanup_handle(), clear_contact_store(), clear_ego_store(), clear_message_store(), clear_operation_store(), client_disconnect_cb(), close_all_files(), collect_generation_garbage(), database_shutdown(), destroy_handle(), destroy_member(), destroy_room(), destroy_service(), destroy_service_session(), destroy_srv_handle(), disconnect_cb(), do_reconnect(), do_shutdown(), free_search_context(), get_member_session_of(), get_store_operation_type(), GNUNET_CADET_disconnect(), GNUNET_CONTAINER_multihashmap_clear(), GNUNET_FS_search_continue(), GNUNET_FS_search_pause(), GNUNET_FS_search_signal_suspend_(), GNUNET_FS_search_start_searching_(), GNUNET_FS_search_stop(), GNUNET_MESSENGER_find_rooms(), GNUNET_PEERSTORE_disconnect(), GSF_iterate_pending_requests_(), GSF_peer_disconnect_handler(), GST_barriers_destroy(), GST_link_notify_disconnect(), handle_alices_cryptodata_message(), handle_client_accept(), handle_intersection_p2p_done(), handle_union_p2p_request_full(), handle_union_p2p_send_full(), handle_union_p2p_strata_estimator(), heap_get_keys(), heap_plugin_get_closest(), heap_plugin_get_key(), initialize_key_to_element(), iterate_member_sessions(), iterate_zones(), kill_slave(), libgnunet_plugin_rest_openid_connect_done(), load_member_next_sessions(), main(), maybe_finish(), namecache_expire_blocks(), namestore_flat_iterate_records(), namestore_flat_zone_to_name(), peerstore_flat_delete_records(), peerstore_flat_expire_records(), peerstore_flat_iterate_records(), print_finish(), process_bf(), reconnect(), reconnect_cbk(), REGEX_INTERNAL_iterate_reachable_edges(), REGEX_INTERNAL_search_cancel(), reschedule_connect(), reset_cadet(), run(), save_member(), save_member_session_history(), save_message_store(), save_srv_handle_configuration(), save_state(), schedule_transmit_search_request(), send_alices_cryptodata_message(), send_bloomfilter(), send_full_set(), set_srv_handle_ego(), share_tree_trim(), shutdown_task(), signal_search_resume(), switch_member_session(), sync_member_contacts(), transmit_cryptographic_reply(), and try_reconnect().
struct GNUNET_CONTAINER_MultiHashMapIterator* GNUNET_CONTAINER_multihashmap_iterator_create | ( | const struct GNUNET_CONTAINER_MultiHashMap * | map | ) |
Create an iterator for a multihashmap.
The iterator can be used to retrieve all the elements in the multihashmap one by one, without having to handle all elements at once (in contrast to GNUNET_CONTAINER_multihashmap_iterate). Note that the iterator can not be used anymore if elements have been removed from 'map' after the creation of the iterator, or 'map' has been destroyed. Adding elements to 'map' may result in skipped or repeated elements.
map | the map to create an iterator for |
Definition at line 909 of file container_multihashmap.c.
References GNUNET_new, map, GNUNET_CONTAINER_MultiHashMapIterator::map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiHashMapIterator::me, GNUNET_CONTAINER_MultiHashMapIterator::modification_counter, and GNUNET_CONTAINER_MultiPeerMap::modification_counter.
Referenced by apply_diff_to_rfn(), handle_client_iterate(), handle_intersection_p2p_done(), process_bf(), task_start_apply_round(), task_start_eval_echo(), and task_start_grade().
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_iterator_next | ( | struct GNUNET_CONTAINER_MultiHashMapIterator * | iter, |
struct GNUNET_HashCode * | key, | ||
const void ** | value | ||
) |
Retrieve the next element from the hash map at the iterator's position.
If there are no elements left, GNUNET_NO is returned, and key and value are not modified. This operation is only allowed if no elements have been removed from the multihashmap since the creation of iter, and the map has not been destroyed. Adding elements may result in repeating or skipping elements.
iter | the iterator to get the next element from |
key | pointer to store the key in, can be NULL |
value | pointer to store the value in, can be NULL |
Definition at line 909 of file container_multihashmap.c.
Referenced by apply_diff_to_rfn(), send_client_element(), send_remaining_elements(), task_start_apply_round(), task_start_eval_echo(), and task_start_grade().
void GNUNET_CONTAINER_multihashmap_iterator_destroy | ( | struct GNUNET_CONTAINER_MultiHashMapIterator * | iter | ) |
Destroy a multihashmap iterator.
iter | the iterator to destroy |
Definition at line 968 of file container_multihashmap.c.
References GNUNET_free.
Referenced by _GSS_operation_destroy(), apply_diff_to_rfn(), client_disconnect_cb(), handle_client_iter_ack(), intersection_op_cancel(), send_client_element(), send_remaining_elements(), task_start_apply_round(), task_start_eval_echo(), and task_start_grade().
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_get_multiple | ( | struct GNUNET_CONTAINER_MultiHashMap * | map, |
const struct GNUNET_HashCode * | key, | ||
GNUNET_CONTAINER_MultiHashMapIteratorCallback | it, | ||
void * | it_cls | ||
) |
Iterate over all entries in the map that match a particular key.
map | the map |
key | key that the entries must correspond to |
it | function to call on each entry |
it_cls | extra argument to it |
Definition at line 645 of file container_multihashmap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_free, GNUNET_malloc_large, idx_of(), BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, GNUNET_CONTAINER_MultiPeerMap::modification_counter, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by callback_ego_create(), check_client_hello(), find_closest(), find_trees(), forward_reply(), GDS_CLIENTS_handle_reply(), GDS_ROUTING_add(), GDS_ROUTING_process(), get_cb(), GNUNET_FS_namespace_list_updateable(), GSF_plan_add_(), handle_dht_local_get_result_seen(), handle_p2p_get(), handle_p2p_put(), handle_port_open(), handle_put(), handle_reply(), heap_plugin_get_key(), heap_plugin_put(), heap_plugin_remove_key(), iter_hashcodes(), process_ksk_result(), process_sks_result(), regex_next_edge(), register_host(), and watch_notifier().
unsigned int GNUNET_CONTAINER_multihashmap_get_random | ( | const struct GNUNET_CONTAINER_MultiHashMap * | map, |
GNUNET_CONTAINER_MultiHashMapIteratorCallback | it, | ||
void * | it_cls | ||
) |
Call it on a random value from the map, or not at all if the map is empty.
Note that this function has linear complexity (in the size of the map).
map | the map |
it | function to call on a random entry |
it_cls | extra argument to it |
Definition at line 849 of file container_multihashmap.c.
References GNUNET_break, GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_u32(), GNUNET_OK, GNUNET_SYSERR, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::size, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
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).
len | initial size (map will grow as needed) |
do_not_copy_keys | GNUNET_NO is always safe and should be used by default; GNUNET_YES means that on 'put', the 'key' does not have to be copied as the destination of the pointer is guaranteed to be life as long as the value is stored in the hashmap. This can significantly reduce memory consumption, but of course is also a recipe for heap corruption if the assumption is not true. Only use this if (1) memory use is important in this case and (2) you have triple-checked that the invariant holds |
Definition at line 179 of file container_multipeermap.c.
References GNUNET_assert, GNUNET_free, GNUNET_malloc_large, GNUNET_new, len, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by client_connect_cb(), core_init(), create_srv_room(), CustomPeerMap_create(), GAS_addresses_init(), GAS_connectivity_init(), GAS_preference_init(), GAS_reservations_init(), GNUNET_ATS_connectivity_init(), GNUNET_ATS_solvers_solver_start(), GNUNET_CORE_connect(), GNUNET_CRYPTO_ecc_dlog_prepare(), GNUNET_PEER_intern(), GNUNET_TRANSPORT_application_init(), GNUNET_TRANSPORT_core_connect(), GSC_SESSIONS_init(), GSF_cadet_start_server(), GSF_connected_peer_init_(), GSF_plan_init(), GST_ats_init(), GST_blacklist_add_peer(), GST_manipulation_init(), GST_neighbours_start(), GST_validation_start(), handle_client_send_request(), handle_connection_create(), handle_peer_push(), handle_suggest(), init_socket(), libgnunet_plugin_transport_http_client_init(), libgnunet_plugin_transport_tcp_init(), libgnunet_plugin_transport_udp_init(), libgnunet_plugin_transport_unix_init(), new_sub(), run(), setup_ac(), update_preference(), View_change_len(), and View_create().
void GNUNET_CONTAINER_multipeermap_destroy | ( | struct GNUNET_CONTAINER_MultiPeerMap * | map | ) |
Destroy a hash map.
Will not free any values stored in the hash map!
map | the map |
Definition at line 199 of file container_multipeermap.c.
References GNUNET_assert, GNUNET_free, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by cleaning_task(), cleanup_map(), client_disconnect_cb(), CustomPeerMap_destroy(), destroy_srv_room(), destroy_sub(), do_shutdown(), end(), GAS_addresses_done(), GAS_connectivity_done(), GAS_preference_client_disconnect(), GAS_preference_done(), GAS_reservations_done(), GDS_NEIGHBOURS_done(), GNUNET_ATS_connectivity_done(), GNUNET_ATS_solvers_solver_stop(), GNUNET_CORE_disconnect(), GNUNET_CRYPTO_ecc_dlog_release(), GNUNET_TRANSPORT_application_done(), GNUNET_TRANSPORT_core_disconnect(), GSC_SESSIONS_done(), GSF_cadet_stop_server(), GSF_connected_peer_done_(), GSF_plan_done(), GST_ats_done(), GST_validation_stop(), handle_connection_create(), libgnunet_plugin_transport_http_client_done(), libgnunet_plugin_transport_tcp_done(), libgnunet_plugin_transport_tcp_init(), libgnunet_plugin_transport_udp_init(), libgnunet_plugin_transport_unix_done(), main(), peers_terminate(), shutdown_rest(), shutdown_task(), View_change_len(), and View_destroy().
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.
map | the map |
key | what to look for |
Definition at line 268 of file container_multipeermap.c.
References MapEntry::bme, GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
Referenced by add_host_to_known_hosts(), addr_info_cb(), blacklist_check(), connect_notify(), consider_for_advertising(), cummulative_ack(), CustomPeerMap_get_index_pointer(), CustomPeerMap_remove_peer(), enter_srv_room_at(), find_session(), free_preference(), GAS_preference_get_by_peer(), GAS_reservations_set_bandwidth(), GCP_get(), GDS_NEIGHBOURS_lookup_peer(), GDS_u_connect(), get_cadet(), get_peer_ctx(), get_srv_room_tunnel(), GNUNET_CORE_get_mq(), GNUNET_CRYPTO_ecc_dlog(), GNUNET_PEER_intern(), GNUNET_PEER_search(), GSF_peer_get_(), GSF_plan_add_(), GSF_plan_notify_peer_disconnect_(), GST_manipulation_manipulate_metrics(), GST_manipulation_peer_disconnect(), GST_manipulation_send(), GST_manipulation_set_metric(), handle_client_send(), handle_client_send_request(), handle_connect_notify(), handle_core_connect(), handle_disconnect_notify(), handle_dv_box(), handle_hello(), handle_notify_inbound(), handle_revocation_union_request(), handle_send_ready(), handle_suggest_cancel(), handle_tcp_nat_probe(), incoming_channel(), learn_dv_path(), lookup_neighbour(), lookup_virtual_link(), neighbour_find(), process_peer(), process_peer_monitoring_cb(), profiler_reply_handle(), profiler_reply_handle_info(), rebuild_srv_room_basement_structure(), reservations_reserve(), update_hello(), update_preference(), update_relative_values_for_peer(), View_change_len(), View_clear(), and View_remove_peer().
enum GNUNET_GenericReturnValue 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.
Note that if the key-value pair is in the map multiple times, only one of the pairs will be removed.
map | the map |
key | key of the key-value pair |
value | value of the key-value pair |
Definition at line 379 of file container_multipeermap.c.
References map, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, and MapEntry::sme.
Referenced by ats_perf_mon_cb(), callback_room_connect(), callback_room_disconnect(), cleanup_validation_entry(), client_delete_session(), destroy_ack_cummulator(), destroy_active_client_request(), destroy_ai(), destroy_it(), destroy_peer(), disconnect_and_free_peer_entry(), disconnect_cb(), enforce_del_address(), enter_srv_room_at(), free_addr_it(), free_address(), free_all_it(), free_backtalker(), free_dv_route(), free_iterator(), free_matching_requests(), free_neighbour(), free_peer(), free_preference(), free_tmps(), free_validation_state(), free_virtual_link(), GAS_reservations_set_bandwidth(), GDS_u_disconnect(), GNUNET_PEER_change_rc(), GNUNET_PEER_decrement_rcs(), GNUNET_TRANSPORT_application_suggest_cancel(), GSC_CLIENTS_notify_client_about_neighbour(), GSC_CLIENTS_reject_request(), GSC_SESSIONS_end(), GSF_peer_disconnect_handler(), GSF_plan_notify_peer_disconnect_(), handle_client_send(), handle_core_disconnect(), handle_send_transmit_continuation(), handle_tcp_nat_probe(), iterator(), neighbour_delete(), queue_destroy(), receiver_destroy(), sender_destroy(), server_delete_session(), stop_peer_request(), tcp_plugin_disconnect_session(), udp_disconnect_session(), and unix_plugin_session_disconnect().
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.
Note that the values would not be "freed".
map | the map |
key | identifies values to be removed |
Definition at line 444 of file container_multipeermap.c.
Referenced by add_valid_peer(), core_disconnects(), CustomPeerMap_remove_peer(), destroy_peer(), View_clear(), and View_remove_peer().
enum GNUNET_GenericReturnValue 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).
map | the map |
key | the key to test if a value exists for it |
Definition at line 444 of file container_multipeermap.c.
References MapEntry::bme, GNUNET_free, GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, GNUNET_CONTAINER_MultiPeerMap::modification_counter, BigMapEntry::next, SmallMapEntry::next, p, ret, GNUNET_CONTAINER_MultiPeerMap::size, MapEntry::sme, update_next_cache_bme(), update_next_cache_sme(), and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by addr_info_cb(), callback_room_disconnect(), check_access(), check_peer_known(), check_peer_valid(), check_removable(), clean_peer(), compute_rand_delay(), CustomPeerMap_contains_peer(), CustomPeerMap_put(), destroy_peer(), GAS_connectivity_has_peer(), get_peer_ctx(), GSC_CLIENTS_deliver_message(), GSC_CLIENTS_notify_client_about_neighbour(), GSC_CLIENTS_solicit_request(), handle_client_send_request(), handle_dv_learn(), handle_feedback(), handle_peer_pull_request(), handle_peer_push(), mq_notify_sent_cb(), send_pull_request(), send_push(), tcp_plugin_get_session(), View_clear(), and View_contains_peer().
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multipeermap_contains_value | ( | const struct GNUNET_CONTAINER_MultiPeerMap * | map, |
const struct GNUNET_PeerIdentity * | key, | ||
const void * | value | ||
) |
Check if the map contains the given value under the given key.
map | the map |
key | the key to test if a value exists for it |
value | value to test for |
Definition at line 444 of file container_multipeermap.c.
Referenced by handle_tcp_data(), set_prop_task(), tcp_plugin_send(), udp_plugin_send(), udp_plugin_update_session_timeout(), unix_plugin_send(), and unix_plugin_update_session_timeout().
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.
map | the map |
key | key to use |
value | value to use |
opt | options for put |
Definition at line 632 of file container_multipeermap.c.
References MapEntry::bme, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_memcmp, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, grow(), idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::size, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, value, BigMapEntry::value, and SmallMapEntry::value.
Referenced by activate_core_visible_dv_path(), add_host_to_known_hosts(), add_valid_peer(), addr_info_cb(), ats_perf_mon_cb(), boot_queue(), callback_room_connect(), connect_peer(), core_connects(), create_peer_ctx(), cummulative_ack(), CustomPeerMap_put(), enforce_add_address(), enter_srv_room_at(), find_validation_entry(), GAS_addresses_add(), GAS_handle_request_address(), GAS_reservations_set_bandwidth(), GCP_get(), GDS_u_connect(), get_cadet(), GNUNET_ATS_connectivity_suggest(), GNUNET_CRYPTO_ecc_dlog_prepare(), GNUNET_PEER_intern(), GNUNET_TRANSPORT_application_suggest(), GSC_CLIENTS_notify_client_about_neighbour(), GSC_SESSIONS_create(), GSF_peer_connect_handler(), GSF_plan_add_(), GST_ats_add_address(), GST_ats_add_inbound_address(), GST_blacklist_add_peer(), GST_manipulation_set_metric(), handle_add_queue_message(), handle_client_init(), handle_client_send(), handle_client_send_request(), handle_connect(), handle_connection_create(), handle_core_connect(), handle_dv_box(), handle_flow_control(), handle_suggest(), handle_tcp_nat_probe(), handle_tcp_welcome(), handle_validation_response(), http_client_plugin_get_session(), info_cb(), insert_in_sampler(), learn_dv_path(), make_peer(), mq_init(), new_peer_entry(), peer_id_cb(), process_peer_monitoring_cb(), run(), server_lookup_connection(), setup_ac(), setup_neighbour(), setup_queue(), setup_sender(), start_address_validation(), tcp_plugin_get_session(), udp_plugin_create_session(), unix_plugin_get_session(), update_preference(), View_change_len(), and View_put().
unsigned int GNUNET_CONTAINER_multipeermap_size | ( | const struct GNUNET_CONTAINER_MultiPeerMap * | map | ) |
Get the number of key-value pairs in the map.
map | the map |
Definition at line 260 of file container_multipeermap.c.
References map, and GNUNET_CONTAINER_MultiPeerMap::size.
Referenced by add_valid_peer(), boot_queue(), create_peer_ctx(), CustomPeerMap_put(), CustomPeerMap_remove_peer(), CustomPeerMap_remove_peer_by_index(), CustomPeerMap_size(), destroy_peer(), do_shutdown(), GAS_addresses_destroy_all(), GAS_addresses_get_peer_info(), GDS_NEIGHBOURS_done(), GDS_u_connect(), GDS_u_disconnect(), get_random_peer_from_peermap(), get_target_peers(), GSC_SESSIONS_create(), GSC_SESSIONS_end(), GSF_peer_connect_handler(), GSF_peer_disconnect_handler(), GSF_plan_done(), handle_dv_learn(), insert_in_sampler(), mq_init(), publish_p2a_stat_update(), publish_ve_stat_update(), queue_destroy(), receiver_destroy(), restore_valid_peers(), send_find_peer_message(), sender_destroy(), setup_estimate_message(), setup_queue(), setup_sender(), shutdown_task(), start_dv_learn(), store_valid_peers(), udp_disconnect_session(), udp_plugin_create_session(), unix_plugin_get_session(), unix_plugin_session_disconnect(), update_addresses_stat(), View_change_len(), View_get_peer_by_index(), and View_size().
int GNUNET_CONTAINER_multipeermap_iterate | ( | struct GNUNET_CONTAINER_MultiPeerMap * | map, |
GNUNET_CONTAINER_PeerMapIterator | it, | ||
void * | it_cls | ||
) |
Iterate over all entries in the map.
map | the map |
it | function to call on each entry |
it_cls | extra argument to it |
Definition at line 292 of file container_multipeermap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_OK, GNUNET_SYSERR, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, NEXT_CACHE_SIZE, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
Referenced by add_peer_task(), ats_perf_mon_cb(), check_proof_of_work(), cleaning_task(), cleanup_map(), client_disconnect_cb(), client_lookup_session(), consider_for_advertising(), cron_flush_respect(), destroy_srv_room(), disconnect(), disconnect_and_schedule_reconnect(), do_shutdown(), end(), forward_srv_room_message(), GAS_addresses_destroy_all(), GAS_addresses_get_peer_info(), GAS_connectivity_done(), GAS_connectivity_remove_client(), GAS_normalization_update_property(), GAS_preference_client_disconnect(), GAS_preference_done(), GAS_reservations_done(), GCP_destroy_all_peers(), GCP_iterate_all(), get_random_peer_from_peermap(), get_valid_peers(), GNUNET_ATS_connectivity_done(), GNUNET_ATS_solvers_solver_stop(), GNUNET_CORE_disconnect(), GNUNET_TRANSPORT_application_done(), GSC_SESSIONS_broadcast_typemap(), GSC_SESSIONS_done(), GSC_SESSIONS_notify_client_about_sessions(), GSF_cadet_stop_server(), GSF_connected_peer_done_(), GSF_handle_local_client_disconnect_(), GSF_iterate_connected_peers_(), GST_ats_done(), GST_neighbours_iterate(), GST_validation_stop(), handle_client_start(), handle_dv_learn(), handle_get_all(), handle_monitor_start(), handle_notify(), handle_p2p_estimate(), http_client_plugin_setup_monitor(), http_server_plugin_setup_monitor(), libgnunet_plugin_transport_http_client_done(), libgnunet_plugin_transport_tcp_done(), libgnunet_plugin_transport_unix_done(), peers_terminate(), preference_aging(), recalculate_relative_preferences(), reconnect(), reconnect_later(), schedule_next_hello(), send_find_peer_message(), send_srv_room_message(), shutdown_task(), start_dv_learn(), store_valid_peers(), tcp_plugin_setup_monitor(), template_plugin_setup_monitor(), udp_plugin_setup_monitor(), unix_plugin_setup_monitor(), update_preference(), and utilization_transmission().
struct GNUNET_CONTAINER_MultiPeerMapIterator* GNUNET_CONTAINER_multipeermap_iterator_create | ( | const struct GNUNET_CONTAINER_MultiPeerMap * | map | ) |
Create an iterator for a multihashmap.
The iterator can be used to retrieve all the elements in the multihashmap one by one, without having to handle all elements at once (in contrast to GNUNET_CONTAINER_multipeermap_iterate). Note that the iterator can not be used anymore if elements have been removed from map after the creation of the iterator, or 'map' has been destroyed. Adding elements to map may result in skipped or repeated elements.
map | the map to create an iterator for |
Definition at line 829 of file container_multipeermap.c.
References GNUNET_new, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMapIterator::map, GNUNET_CONTAINER_MultiPeerMapIterator::me, GNUNET_CONTAINER_MultiPeerMap::modification_counter, and GNUNET_CONTAINER_MultiPeerMapIterator::modification_counter.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multipeermap_iterator_next | ( | struct GNUNET_CONTAINER_MultiPeerMapIterator * | iter, |
struct GNUNET_PeerIdentity * | key, | ||
const void ** | value | ||
) |
Retrieve the next element from the hash map at the iterator's position.
If there are no elements left, GNUNET_NO is returned, and key and value are not modified.
This operation is only allowed if no elements have been removed from the multihashmap since the creation of iter, and the map has not been destroyed.
Adding elements may result in repeating or skipping elements.
iter | the iterator to get the next element from |
key | pointer to store the key in, can be NULL |
value | pointer to store the value in, can be NULL |
Definition at line 829 of file container_multipeermap.c.
void GNUNET_CONTAINER_multipeermap_iterator_destroy | ( | struct GNUNET_CONTAINER_MultiPeerMapIterator * | iter | ) |
Destroy a multipeermap iterator.
iter | the iterator to destroy |
Definition at line 888 of file container_multipeermap.c.
References GNUNET_free.
int GNUNET_CONTAINER_multipeermap_get_multiple | ( | struct GNUNET_CONTAINER_MultiPeerMap * | map, |
const struct GNUNET_PeerIdentity * | key, | ||
GNUNET_CONTAINER_PeerMapIterator | it, | ||
void * | it_cls | ||
) |
Iterate over all entries in the map that match a particular key.
map | the map |
key | public key that the entries must correspond to |
it | function to call on each entry |
it_cls | extra argument to it |
Definition at line 703 of file container_multipeermap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_memcmp, GNUNET_OK, GNUNET_SYSERR, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, NEXT_CACHE_SIZE, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
Referenced by ats_perf_mon_cb(), enc_notify_cb(), find_ai(), find_ai_no_session(), find_exact_address(), find_validation_entry(), GAS_addresses_get_peer_info(), GAS_handle_request_address_cancel(), get_active_address(), get_best_address(), GST_blacklist_test_allowed(), GST_clients_broadcast_disconnect(), GST_validation_get_addresses(), handle_add_queue_message(), handle_get(), handle_validation_response(), http_client_plugin_peer_disconnect(), http_server_plugin_disconnect_peer(), lookup_queue(), lookup_session(), server_lookup_connection(), setup_sender(), start_address_validation(), tcp_plugin_disconnect(), tcp_plugin_get_session(), try_handle_plaintext(), udp_disconnect(), udp_plugin_lookup_session(), unix_plugin_peer_disconnect(), and update_relative_values_for_peer().
unsigned int GNUNET_CONTAINER_multipeermap_get_random | ( | const struct GNUNET_CONTAINER_MultiPeerMap * | map, |
GNUNET_CONTAINER_PeerMapIterator | it, | ||
void * | it_cls | ||
) |
Call it on a random value from the map, or not at all if the map is empty.
Note that this function has linear complexity (in the size of the map).
map | the map |
it | function to call on a random entry |
it_cls | extra argument to it |
Definition at line 770 of file container_multipeermap.c.
References GNUNET_break, GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_u32(), GNUNET_OK, GNUNET_SYSERR, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::size, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
struct GNUNET_CONTAINER_MultiShortmap* GNUNET_CONTAINER_multishortmap_create | ( | unsigned int | len, |
int | do_not_copy_keys | ||
) |
Create a multi peer map (hash map for public keys of peers).
len | initial size (map will grow as needed) |
do_not_copy_keys | GNUNET_NO is always safe and should be used by default; GNUNET_YES means that on 'put', the 'key' does not have to be copied as the destination of the pointer is guaranteed to be life as long as the value is stored in the hashmap. This can significantly reduce memory consumption, but of course is also a recipe for heap corruption if the assumption is not true. Only use this if (1) memory use is important in this case and (2) you have triple-checked that the invariant holds |
Create a multi peer map (hash map for public keys of peers).
len | initial size (map will grow as needed) |
do_not_copy_keys | GNUNET_NO is always safe and should be used by default; GNUNET_YES means that on 'put', the 'key' does not have to be copied as the destination of the pointer is guaranteed to be life as long as the value is stored in the hashmap. This can significantly reduce memory consumption, but of course is also a recipe for heap corruption if the assumption is not true. Only use this if (1) memory use is important in this case and (2) you have triple-checked that the invariant holds |
Definition at line 196 of file container_multishortmap.c.
References GNUNET_assert, GNUNET_free, GNUNET_malloc_large, GNUNET_new, len, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by create_room(), GCO_init(), GCP_get(), GNUNET_PQ_connect2(), GNUNET_TESTING_cmd_end(), GNUNET_TESTING_get_topo_from_string(), init_member_store(), run(), and start_helper().
void GNUNET_CONTAINER_multishortmap_destroy | ( | struct GNUNET_CONTAINER_MultiShortmap * | map | ) |
Destroy a hash map.
Will not free any values stored in the hash map!
map | the map |
Definition at line 215 of file container_multishortmap.c.
References GNUNET_assert, GNUNET_free, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by clear_member_store(), destroy_peer(), destroy_room(), do_shutdown(), free_barriers_cb(), GCO_shutdown(), GNUNET_PQ_connect2(), GNUNET_PQ_disconnect(), GNUNET_TESTING_free_topology(), interpreter_delete_barriers(), shutdown_rest(), and TST_interpreter_finish_attached_cmds().
void* GNUNET_CONTAINER_multishortmap_get | ( | const struct GNUNET_CONTAINER_MultiShortmap * | map, |
const struct GNUNET_ShortHashCode * | key | ||
) |
Given a key find a value in the map matching the key.
map | the map |
key | what to look for |
Definition at line 284 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
Referenced by GCC_lookup(), get_node_info(), get_route(), get_store_member(), GNUNET_PQ_event_listen(), GNUNET_PQ_event_listen_cancel(), GNUNET_TESTING_barrier_get_node(), GNUNET_TESTING_get_topo_from_string(), sock_read(), start_helper(), and TST_interpreter_get_barrier().
int GNUNET_CONTAINER_multishortmap_remove | ( | struct GNUNET_CONTAINER_MultiShortmap * | map, |
const struct GNUNET_ShortHashCode * | key, | ||
const void * | value | ||
) |
Remove the given key-value pair from the map.
Note that if the key-value pair is in the map multiple times, only one of the pairs will be removed.
map | the map |
key | key of the key-value pair |
value | value of the key-value pair |
Definition at line 402 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_free, GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, GNUNET_CONTAINER_MultiPeerMap::modification_counter, BigMapEntry::next, SmallMapEntry::next, p, GNUNET_CONTAINER_MultiPeerMap::size, MapEntry::sme, update_next_cache_bme(), update_next_cache_sme(), GNUNET_CONTAINER_MultiPeerMap::use_small_entries, and value.
Referenced by destroy_route(), free_barrier_node_cb(), GCC_destroy(), GCP_remove_connection(), GNUNET_PQ_event_listen_cancel(), handle_id_message(), handle_leave_message(), kce_destroy(), and start_dv_learn().
int GNUNET_CONTAINER_multishortmap_remove_all | ( | struct GNUNET_CONTAINER_MultiShortmap * | map, |
const struct GNUNET_ShortHashCode * | key | ||
) |
Remove all entries for the given key from the map.
Note that the values would not be "freed".
map | the map |
key | identifies values to be removed |
Definition at line 458 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_free, GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, GNUNET_CONTAINER_MultiPeerMap::modification_counter, BigMapEntry::next, SmallMapEntry::next, p, ret, GNUNET_CONTAINER_MultiPeerMap::size, MapEntry::sme, update_next_cache_bme(), update_next_cache_sme(), and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
int GNUNET_CONTAINER_multishortmap_contains | ( | const struct GNUNET_CONTAINER_MultiShortmap * | map, |
const struct GNUNET_ShortHashCode * | key | ||
) |
Check if the map contains any value under the given key (including values that are NULL).
map | the map |
key | the key to test if a value exists for it |
Definition at line 538 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by generate_free_member_id(), GNUNET_TESTING_get_topo_from_string(), and start_helper().
int GNUNET_CONTAINER_multishortmap_contains_value | ( | const struct GNUNET_CONTAINER_MultiShortmap * | map, |
const struct GNUNET_ShortHashCode * | key, | ||
const void * | value | ||
) |
Check if the map contains the given value under the given key.
map | the map |
key | the key to test if a value exists for it |
value | value to test for |
Definition at line 562 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, value, BigMapEntry::value, and SmallMapEntry::value.
Referenced by handle_join_message().
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multishortmap_put | ( | struct GNUNET_CONTAINER_MultiShortmap * | map, |
const struct GNUNET_ShortHashCode * | key, | ||
void * | value, | ||
enum GNUNET_CONTAINER_MultiHashMapOption | opt | ||
) |
Store a key-value pair in the map.
map | the map |
key | key to use |
value | value to use |
opt | options for put |
Definition at line 592 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_free, GNUNET_malloc_large, idx_of(), BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, GNUNET_CONTAINER_MultiPeerMap::modification_counter, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by add_store_member(), barrier_attached(), connection_create(), GCP_add_connection(), GNUNET_PQ_event_listen(), GNUNET_TESTING_get_topo_from_string(), handle_connection_create(), handle_id_message(), handle_join_message(), kce_generate(), notify_connect(), start_dv_learn(), start_helper(), and TST_interpreter_add_barrier().
unsigned int GNUNET_CONTAINER_multishortmap_size | ( | const struct GNUNET_CONTAINER_MultiShortmap * | map | ) |
Get the number of key-value pairs in the map.
map | the map |
Definition at line 276 of file container_multishortmap.c.
References map, and GNUNET_CONTAINER_MultiPeerMap::size.
Referenced by consider_peer_activate(), consider_peer_destroy(), destroy_peer(), destroy_route(), GCO_shutdown(), generate_free_member_id(), GNUNET_PQ_disconnect(), GNUNET_PQ_event_listen_cancel(), handle_connection_create(), kce_generate(), scheduler_fd_cb(), secret_destroy(), and start_dv_learn().
int GNUNET_CONTAINER_multishortmap_iterate | ( | struct GNUNET_CONTAINER_MultiShortmap * | map, |
GNUNET_CONTAINER_ShortmapIterator | it, | ||
void * | it_cls | ||
) |
Iterate over all entries in the map.
map | the map |
it | function to call on each entry |
it_cls | extra argument to it |
Definition at line 308 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_OK, GNUNET_SYSERR, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, NEXT_CACHE_SIZE, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
Referenced by clear_member_store(), find_room_member(), free_barriers_cb(), free_namespaces_cb(), GNUNET_PQ_event_reconnect_(), GNUNET_TESTING_free_topology(), interpreter_delete_barriers(), iterate_room_members(), iterate_store_members(), load_member_store(), log_namespaces(), log_topo(), save_member_store(), send_simple_run(), and TST_interpreter_finish_attached_cmds().
struct GNUNET_CONTAINER_MultiShortmapIterator* GNUNET_CONTAINER_multishortmap_iterator_create | ( | const struct GNUNET_CONTAINER_MultiShortmap * | map | ) |
Create an iterator for a multihashmap.
The iterator can be used to retrieve all the elements in the multihashmap one by one, without having to handle all elements at once (in contrast to GNUNET_CONTAINER_multishortmap_iterate). Note that the iterator can not be used anymore if elements have been removed from map after the creation of the iterator, or 'map' has been destroyed. Adding elements to map may result in skipped or repeated elements.
map | the map to create an iterator for |
Definition at line 839 of file container_multishortmap.c.
References GNUNET_new, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiShortmapIterator::map, GNUNET_CONTAINER_MultiShortmapIterator::me, GNUNET_CONTAINER_MultiPeerMap::modification_counter, and GNUNET_CONTAINER_MultiShortmapIterator::modification_counter.
Referenced by backchannel_check_run().
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multishortmap_iterator_next | ( | struct GNUNET_CONTAINER_MultiShortmapIterator * | iter, |
struct GNUNET_ShortHashCode * | key, | ||
const void ** | value | ||
) |
Retrieve the next element from the hash map at the iterator's position.
If there are no elements left, GNUNET_NO is returned, and key and value are not modified. This operation is only allowed if no elements have been removed from the multihashmap since the creation of iter, and the map has not been destroyed. Adding elements may result in repeating or skipping elements.
iter | the iterator to get the next element from |
key | pointer to store the key in, can be NULL |
value | pointer to store the value in, can be NULL |
Definition at line 839 of file container_multishortmap.c.
Referenced by backchannel_check_run().
void GNUNET_CONTAINER_multishortmap_iterator_destroy | ( | struct GNUNET_CONTAINER_MultiShortmapIterator * | iter | ) |
Destroy a multishortmap iterator.
iter | the iterator to destroy |
Definition at line 898 of file container_multishortmap.c.
References GNUNET_free.
int GNUNET_CONTAINER_multishortmap_get_multiple | ( | struct GNUNET_CONTAINER_MultiShortmap * | map, |
const struct GNUNET_ShortHashCode * | key, | ||
GNUNET_CONTAINER_ShortmapIterator | it, | ||
void * | it_cls | ||
) |
Iterate over all entries in the map that match a particular key.
map | the map |
key | public key that the entries must correspond to |
it | function to call on each entry |
it_cls | extra argument to it |
map | the map |
key | key that the entries must correspond to |
it | function to call on each entry |
it_cls | extra argument to it |
Definition at line 723 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_memcmp, GNUNET_OK, GNUNET_SYSERR, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, NEXT_CACHE_SIZE, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
Referenced by GNUNET_PQ_event_do_poll().
unsigned int GNUNET_CONTAINER_multishortmap_get_random | ( | const struct GNUNET_CONTAINER_MultiShortmap * | map, |
GNUNET_CONTAINER_ShortmapIterator | it, | ||
void * | it_cls | ||
) |
Call it on a random value from the map, or not at all if the map is empty.
Note that this function has linear complexity (in the size of the map).
map | the map |
it | function to call on a random entry |
it_cls | extra argument to it |
Definition at line 790 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_break, GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_u32(), GNUNET_OK, GNUNET_SYSERR, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::size, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
struct GNUNET_CONTAINER_MultiUuidmap* GNUNET_CONTAINER_multiuuidmap_create | ( | unsigned int | len, |
int | do_not_copy_keys | ||
) |
Create a multi peer map (hash map for public keys of peers).
len | initial size (map will grow as needed) |
do_not_copy_keys | GNUNET_NO is always safe and should be used by default; GNUNET_YES means that on 'put', the 'key' does not have to be copied as the destination of the pointer is guaranteed to be life as long as the value is stored in the hashmap. This can significantly reduce memory consumption, but of course is also a recipe for heap corruption if the assumption is not true. Only use this if (1) memory use is important in this case and (2) you have triple-checked that the invariant holds |
Create a multi peer map (hash map for public keys of peers).
len | initial size (map will grow as needed) |
do_not_copy_keys | GNUNET_NO is always safe and should be used by default; GNUNET_YES means that on 'put', the 'key' does not have to be copied as the destination of the pointer is guaranteed to be life as long as the value is stored in the hashmap. This can significantly reduce memory consumption, but of course is also a recipe for heap corruption if the assumption is not true. Only use this if (1) memory use is important in this case and (2) you have triple-checked that the invariant holds |
Definition at line 196 of file container_multiuuidmap.c.
References GNUNET_assert, GNUNET_free, GNUNET_malloc_large, GNUNET_new, len, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by run().
void GNUNET_CONTAINER_multiuuidmap_destroy | ( | struct GNUNET_CONTAINER_MultiUuidmap * | map | ) |
Destroy a hash map.
Will not free any values stored in the hash map!
map | the map |
Definition at line 215 of file container_multiuuidmap.c.
References GNUNET_assert, GNUNET_free, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by do_shutdown().
void* GNUNET_CONTAINER_multiuuidmap_get | ( | const struct GNUNET_CONTAINER_MultiUuidmap * | map, |
const struct GNUNET_Uuid * | key | ||
) |
Given a key find a value in the map matching the key.
map | the map |
key | what to look for |
Definition at line 284 of file container_multiuuidmap.c.
References MapEntry::bme, GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
Referenced by handle_reliability_ack().
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multiuuidmap_remove | ( | struct GNUNET_CONTAINER_MultiUuidmap * | map, |
const struct GNUNET_Uuid * | key, | ||
const void * | value | ||
) |
Remove the given key-value pair from the map.
Note that if the key-value pair is in the map multiple times, only one of the pairs will be removed.
map | the map |
key | key of the key-value pair |
value | value of the key-value pair |
Definition at line 392 of file container_multiuuidmap.c.
References map, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, and MapEntry::sme.
Referenced by free_pending_acknowledgement().
int GNUNET_CONTAINER_multiuuidmap_remove_all | ( | struct GNUNET_CONTAINER_MultiUuidmap * | map, |
const struct GNUNET_Uuid * | key | ||
) |
Remove all entries for the given key from the map.
Note that the values would not be "freed".
map | the map |
key | identifies values to be removed |
Definition at line 457 of file container_multiuuidmap.c.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multiuuidmap_contains | ( | const struct GNUNET_CONTAINER_MultiUuidmap * | map, |
const struct GNUNET_Uuid * | key | ||
) |
Check if the map contains any value under the given key (including values that are NULL).
map | the map |
key | the key to test if a value exists for it |
Definition at line 457 of file container_multiuuidmap.c.
References MapEntry::bme, GNUNET_free, GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, GNUNET_CONTAINER_MultiPeerMap::modification_counter, BigMapEntry::next, SmallMapEntry::next, p, ret, GNUNET_CONTAINER_MultiPeerMap::size, MapEntry::sme, update_next_cache_bme(), update_next_cache_sme(), and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multiuuidmap_contains_value | ( | const struct GNUNET_CONTAINER_MultiUuidmap * | map, |
const struct GNUNET_Uuid * | key, | ||
const void * | value | ||
) |
Check if the map contains the given value under the given key.
map | the map |
key | the key to test if a value exists for it |
value | value to test for |
Definition at line 457 of file container_multiuuidmap.c.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multiuuidmap_put | ( | struct GNUNET_CONTAINER_MultiUuidmap * | map, |
const struct GNUNET_Uuid * | key, | ||
void * | value, | ||
enum GNUNET_CONTAINER_MultiHashMapOption | opt | ||
) |
Store a key-value pair in the map.
map | the map |
key | key to use |
value | value to use |
opt | options for put |
Definition at line 591 of file container_multiuuidmap.c.
References MapEntry::bme, GNUNET_free, GNUNET_malloc_large, idx_of(), BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, GNUNET_CONTAINER_MultiPeerMap::modification_counter, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by prepare_pending_acknowledgement().
unsigned int GNUNET_CONTAINER_multiuuidmap_size | ( | const struct GNUNET_CONTAINER_MultiUuidmap * | map | ) |
Get the number of key-value pairs in the map.
map | the map |
Definition at line 276 of file container_multiuuidmap.c.
References map, and GNUNET_CONTAINER_MultiPeerMap::size.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multiuuidmap_iterate | ( | struct GNUNET_CONTAINER_MultiUuidmap * | map, |
GNUNET_CONTAINER_MultiUuidmapIteratorCallback | it, | ||
void * | it_cls | ||
) |
Iterate over all entries in the map.
map | the map |
it | function to call on each entry |
it_cls | extra argument to it |
Definition at line 284 of file container_multiuuidmap.c.
Referenced by do_shutdown().
struct GNUNET_CONTAINER_MultiUuidmapIterator* GNUNET_CONTAINER_multiuuidmap_iterator_create | ( | const struct GNUNET_CONTAINER_MultiUuidmap * | map | ) |
Create an iterator for a multihashmap.
The iterator can be used to retrieve all the elements in the multihashmap one by one, without having to handle all elements at once (in contrast to GNUNET_CONTAINER_multiuuidmap_iterate). Note that the iterator can not be used anymore if elements have been removed from map after the creation of the iterator, or 'map' has been destroyed. Adding elements to map may result in skipped or repeated elements.
map | the map to create an iterator for |
Definition at line 837 of file container_multiuuidmap.c.
References GNUNET_new, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiUuidmapIterator::map, GNUNET_CONTAINER_MultiUuidmapIterator::me, GNUNET_CONTAINER_MultiPeerMap::modification_counter, and GNUNET_CONTAINER_MultiUuidmapIterator::modification_counter.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multiuuidmap_iterator_next | ( | struct GNUNET_CONTAINER_MultiUuidmapIterator * | iter, |
struct GNUNET_Uuid * | key, | ||
const void ** | value | ||
) |
Retrieve the next element from the hash map at the iterator's position.
If there are no elements left, GNUNET_NO is returned, and key and value are not modified. This operation is only allowed if no elements have been removed from the multihashmap since the creation of iter, and the map has not been destroyed. Adding elements may result in repeating or skipping elements.
iter | the iterator to get the next element from |
key | pointer to store the key in, can be NULL |
value | pointer to store the value in, can be NULL |
Definition at line 837 of file container_multiuuidmap.c.
void GNUNET_CONTAINER_multiuuidmap_iterator_destroy | ( | struct GNUNET_CONTAINER_MultiUuidmapIterator * | iter | ) |
Destroy a multiuuidmap iterator.
iter | the iterator to destroy |
Definition at line 896 of file container_multiuuidmap.c.
References GNUNET_free.
int GNUNET_CONTAINER_multiuuidmap_get_multiple | ( | struct GNUNET_CONTAINER_MultiUuidmap * | map, |
const struct GNUNET_Uuid * | key, | ||
GNUNET_CONTAINER_MultiUuidmapIteratorCallback | it, | ||
void * | it_cls | ||
) |
Iterate over all entries in the map that match a particular key.
map | the map |
key | public key that the entries must correspond to |
it | function to call on each entry |
it_cls | extra argument to it |
map | the map |
key | key that the entries must correspond to |
it | function to call on each entry |
it_cls | extra argument to it |
Definition at line 721 of file container_multiuuidmap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_memcmp, GNUNET_OK, GNUNET_SYSERR, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, NEXT_CACHE_SIZE, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
unsigned int GNUNET_CONTAINER_multiuuidmap_get_random | ( | const struct GNUNET_CONTAINER_MultiUuidmap * | map, |
GNUNET_CONTAINER_MultiUuidmapIteratorCallback | it, | ||
void * | it_cls | ||
) |
Call it on a random value from the map, or not at all if the map is empty.
Note that this function has linear complexity (in the size of the map).
map | the map |
it | function to call on a random entry |
it_cls | extra argument to it |
Definition at line 788 of file container_multiuuidmap.c.
References MapEntry::bme, GNUNET_break, GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_u32(), GNUNET_OK, GNUNET_SYSERR, BigMapEntry::key, SmallMapEntry::key, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::size, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
struct GNUNET_CONTAINER_MultiHashMap32* GNUNET_CONTAINER_multihashmap32_create | ( | unsigned int | len | ) |
Create a 32-bit key multi hash map.
len | initial size (map will grow as needed) |
Create a 32-bit key multi hash map.
len | initial size (map will grow as needed) |
Definition at line 143 of file container_multihashmap32.c.
References GNUNET_assert, GNUNET_free, GNUNET_malloc_large, GNUNET_new, len, and ret.
Referenced by client_connect_cb(), CustomPeerMap_create(), GCT_create_tunnel(), GNUNET_CADET_connect(), GNUNET_MQ_assoc_add(), GNUNET_TESTBED_insert_opc_(), GNUNET_TESTBED_run(), GNUNET_TRANSPORT_monitor_plugins(), GST_cache_init(), GST_connection_pool_init(), handle_fragment_box(), and initialize_key_to_element().
void GNUNET_CONTAINER_multihashmap32_destroy | ( | struct GNUNET_CONTAINER_MultiHashMap32 * | map | ) |
Destroy a 32-bit key hash map.
Will not free any values stored in the hash map!
map | the map |
Destroy a 32-bit key hash map.
Will not free any values stored in the hash map!
map | the map |
Definition at line 167 of file container_multihashmap32.c.
References e, GNUNET_free, map, GNUNET_CONTAINER_MultiPeerMap::map, and GNUNET_CONTAINER_MultiPeerMap::map_length.
Referenced by _GSS_operation_destroy(), cleanup(), client_disconnect_cb(), CustomPeerMap_destroy(), destroy_tunnel(), free_virtual_link(), GNUNET_CADET_disconnect(), GNUNET_MQ_destroy(), GNUNET_TESTBED_controller_disconnect(), GNUNET_TRANSPORT_monitor_plugins_cancel(), GST_cache_clear(), GST_connection_pool_destroy(), and union_op_cancel().
unsigned int GNUNET_CONTAINER_multihashmap32_size | ( | const struct GNUNET_CONTAINER_MultiHashMap32 * | map | ) |
Get the number of key-value pairs in the map.
map | the map |
Definition at line 201 of file container_multihashmap32.c.
References map, and GNUNET_CONTAINER_MultiPeerMap::size.
Referenced by add_entry(), cleanup(), client_disconnect_cb(), CustomPeerMap_put(), CustomPeerMap_remove_peer(), CustomPeerMap_remove_peer_by_index(), CustomPeerMap_size(), GCT_count_channels(), GNUNET_TESTBED_controller_disconnect(), GNUNET_TESTBED_remove_opc_(), GNUNET_TESTBED_shutdown_peers(), GST_cache_clear(), GST_connection_pool_get_handle(), GST_connection_pool_get_handle_done(), handle_client_accept(), handle_client_evaluate(), interrupt(), send_client_done(), send_client_element(), union_accept(), and union_evaluate().
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.
map | the map |
key | what to look for |
Definition at line 209 of file container_multihashmap32.c.
References e, idx_of(), key, map, and GNUNET_CONTAINER_MultiPeerMap::map.
Referenced by cache_lookup(), client_get_next_ccn(), CustomPeerMap_get_peer_by_index(), CustomPeerMap_remove_peer(), find_channel(), GNUNET_MQ_assoc_get(), GNUNET_MQ_assoc_remove(), GST_connection_pool_get_handle(), handle_plaintext_channel_open(), and lookup_channel().
int GNUNET_CONTAINER_multihashmap32_iterate | ( | struct GNUNET_CONTAINER_MultiHashMap32 * | map, |
GNUNET_CONTAINER_MultiHashMapIterator32Callback | it, | ||
void * | it_cls | ||
) |
Iterate over all entries in the map.
map | the map |
it | function to call on each entry |
it_cls | extra argument to it |
Definition at line 227 of file container_multihashmap32.c.
References e, GNUNET_assert, GNUNET_OK, GNUNET_SYSERR, map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, GNUNET_CONTAINER_MultiPeerMap::next_cache, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, and NEXT_CACHE_SIZE.
Referenced by _GSS_operation_destroy(), client_disconnect_cb(), free_virtual_link(), GCT_change_estate(), GCT_debug(), GCT_destroy_tunnel_now(), GCT_iterate_channels(), GNUNET_CADET_disconnect(), GNUNET_TESTBED_controller_disconnect(), GNUNET_TRANSPORT_monitor_plugins_cancel(), GST_cache_clear(), GST_connection_pool_destroy(), handle_mq_error(), handle_union_p2p_full_done(), prepare_ibf(), rc_cleanup_operations(), reconnect_plugin_ctx(), and union_op_cancel().
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap32_remove | ( | struct GNUNET_CONTAINER_MultiHashMap32 * | map, |
uint32_t | key, | ||
const void * | value | ||
) |
Remove the given key-value pair from the map.
Note that if the key-value pair is in the map multiple times, only one of the pairs will be removed.
map | the map |
key | key of the key-value pair |
value | value of the key-value pair |
Definition at line 271 of file container_multihashmap32.c.
References map, me, GNUNET_CONTAINER_MultiPeerMap::next_cache, and GNUNET_CONTAINER_MultiPeerMap::next_cache_off.
Referenced by add_entry(), cache_clear_iterator(), channel_destroy_iterator(), destroy_channel(), destroy_pooled_connection(), free_entry(), free_reassembly_context(), GCT_remove_channel(), GNUNET_TESTBED_remove_opc_(), GSC_handle_remote_channel_destroy(), handle_channel_destroy(), handle_event(), opc_free_iterator(), and remove_rcop().
int GNUNET_CONTAINER_multihashmap32_remove_all | ( | struct GNUNET_CONTAINER_MultiHashMap32 * | map, |
uint32_t | key | ||
) |
Remove all entries for the given key from the map.
Note that the values would not be "freed".
map | the map |
key | identifies values to be removed |
Definition at line 316 of file container_multihashmap32.c.