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 180 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, GNUNET_CONTAINER_MultiHashMap::map, GNUNET_CONTAINER_MultiHashMap::map_length, and GNUNET_CONTAINER_MultiHashMap::use_small_entries.
Referenced by check_unique(), connection_init(), 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(), DHTU_ip_init(), 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(), GSF_peer_connect_handler(), GSF_pending_request_init_(), GSF_plan_add_(), handle_alice_client_message(), handle_bob_client_message(), handle_client_accept(), handle_client_create_set(), handle_client_evaluate(), handle_client_join(), handle_port_open(), init_contact_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(), mq_init(), REGEX_INTERNAL_iterate_reachable_edges(), REGEX_INTERNAL_search(), REST_openid_process_request(), rfn_create(), run(), search_start(), send_full_set(), setup_is(), start_service_run(), 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 215 of file container_multihashmap.c.
References GNUNET_assert, GNUNET_free, GNUNET_CONTAINER_MultiPeerMap::map, 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 __attribute__(), _GSS_operation_destroy(), check_unique(), cleanup(), cleanup_handle(), clear_contact_store(), clear_message_store(), clear_operation_store(), client_disconnect_cb(), close_all_files(), connection_destroy(), database_shutdown(), destroy_handle(), destroy_member(), destroy_member_session(), destroy_room(), destroy_service(), destroy_service_session(), destroy_srv_handle(), DHTU_ip_done(), disconnect(), disconnect_cb(), do_shutdown(), fail_intersection_operation(), finish_test(), free_download_context(), free_search_context(), free_update_information_graph(), GDS_ROUTING_done(), GNUNET_CADET_disconnect(), GNUNET_DHT_disconnect(), GNUNET_FS_download_signal_suspend_(), GNUNET_FS_download_stop(), GNUNET_FS_indexing_done(), GNUNET_FS_search_signal_suspend_(), GNUNET_FS_search_stop(), GNUNET_FS_share_tree_trim(), GNUNET_IDENTITY_disconnect(), GSF_peer_disconnect_handler(), GSF_pending_request_done_(), GSF_plan_notify_peer_disconnect_(), intersection_op_cancel(), iterate_forward_members(), iterate_notify_about_members(), iterate_zones(), libgnunet_plugin_datacache_heap_done(), libgnunet_plugin_datastore_heap_done(), main(), print_finish(), REGEX_INTERNAL_iterate_reachable_edges(), REGEX_INTERNAL_search_cancel(), REST_openid_done(), search_start(), shutdown_rest(), shutdown_task(), stop_service_run(), 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 281 of file container_multihashmap.c.
References GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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_room_message(), cancel_store_operation(), cb_intersection_element_removed(), change_srv_handle_member_id(), check_and_remove_pending_reversal(), check_member_session_history(), close_handle_room(), close_service_room(), code_redirect(), collector(), consume_fail(), consume_ticket(), cookie_identity_interpretation(), create_receiver(), create_response(), delete_store_message(), diff_insert(), ego_sign_data(), entry_handle_room_at(), execute_add(), execute_remove(), find_port(), find_stream(), find_target(), GCCH_channel_incoming_new(), GCCH_channel_local_new(), get_file_handle(), get_gns_cont(), get_handle_contact(), get_handle_room(), get_member_session(), get_redirect_state(), get_room_message(), get_room_recipient(), 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_store_operation_type(), get_url_parameter_copy(), GNUNET_FS_add_to_index(), GNUNET_FS_handle_on_demand_block(), GNUNET_MESSENGER_enter_room(), GNUNET_MESSENGER_open_room(), GNUNET_TESTING_interpreter_get_command(), handle_client_set_add(), handle_delete_message(), handle_identity_update(), handle_port_close(), handle_room_message(), handle_transcript_message(), handle_union_p2p_demand(), handle_union_p2p_offer(), is_message_in_message_control_flow(), join_room_run(), 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(), notify_srv_handle_member_id(), ns_lookup_result_cb(), on_message_cb(), open_handle_room(), parse_credentials_basic_auth(), parse_credentials_post_body(), pending_reversal_timeout(), post_data_iter(), queue_destroy(), remove_high_frequency_keywords(), remove_stream(), rfn_vote(), route_packet(), setup_sender(), sock_read(), token_endpoint(), update_message_control_flow(), 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 406 of file container_multihashmap.c.
References MapEntry::bme, GNUNET_free, GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, GNUNET_CONTAINER_MultiPeerMap::map, 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 add_file(), bind_loose_channel(), cancel_store_operation(), cb_intersection_element_removed(), clean_channel(), clean_request(), client_release_ports(), close_handle_room(), close_service_room(), connection_destroy(), consume_fail(), consume_ticket(), create_target(), delete_linked_hash(), delete_store_message(), delete_value(), expire_oldest_entry(), filter_all(), free_channel_state(), free_destination_entry(), free_ego(), free_pending_request(), free_service_record(), free_validation_state(), get_store_message(), GNUNET_CADET_close_port(), GNUNET_DHT_get_stop(), GNUNET_FS_indexing_do_unindex(), GNUNET_FS_indexing_done(), 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(), heap_plugin_del(), 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(), queue_destroy(), receiver_destroy(), reconstruct_cb(), remove_all(), remove_client_query_record(), remove_iterator(), remove_member_session(), remove_store_contact(), remove_stream(), sender_destroy(), setup_state_record(), update_store_contact(), and validation_transmit_on_queue().
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 464 of file container_multihashmap.c.
References MapEntry::bme, GNUNET_free, GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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 cleanup_store_discourse_messages_before(), clear_member_chain_history(), close_srv_handle_room(), delete_store_message(), expire_blocks(), link_room_deletion(), 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 571 of file container_multihashmap.c.
References GNUNET_CONTAINER_multihashmap_iterate(), map, remove_all(), ret, and GNUNET_CONTAINER_MultiPeerMap::size.
Referenced by task_notify_srv_handle_member_id().
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 582 of file container_multihashmap.c.
References GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, me, BigMapEntry::next, SmallMapEntry::next, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by allocate_v4_address(), allocate_v6_address(), build_authz_response(), check_member_session_history(), code_redirect(), collector(), contains_store_message(), cookie_identity_interpretation(), ego_get_all(), ego_get_response(), ego_sign_data(), forward_about_members(), free_validation_state(), get_gns_cont(), get_url_parameter_copy(), handle_query_message(), handle_union_p2p_offer(), handle_validation_response(), is_srv_handle_routing(), 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(), publicize_rm(), regex_next_edge(), run(), userinfo_endpoint(), and validation_transmit_on_queue().
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 610 of file container_multihashmap.c.
References GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, me, BigMapEntry::next, SmallMapEntry::next, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, value, BigMapEntry::value, and SmallMapEntry::value.
Referenced by plan(), and schedule_block_download().
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 710 of file container_multihashmap.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, GNUNET_CONTAINER_MultiPeerMap::map, 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 add_link(), add_member_session(), add_to_keyword_counter(), add_to_meta_counter(), boot_queue(), callback_scan_for_operations(), change_srv_handle_member_id(), check_unique(), collector(), create_handle_member_id(), create_randomized_element_iterator(), create_receiver(), create_stream(), 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_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_TESTING_interpreter_run_cmd_(), GSF_pending_request_create_(), GSF_plan_add_(), handle_alice_client_message(), handle_alice_client_message_multipart(), handle_bob_client_message(), handle_bob_client_message_multipart(), handle_client_redirect_to_ip(), handle_client_redirect_to_service(), handle_client_set_add(), handle_dht_local_get(), handle_identity_update(), handle_p2p_get(), handle_port_open(), handle_room_message(), handle_transcript_message(), handle_union_p2p_inquiry(), handle_union_p2p_offer(), handle_validation_response(), header_iterator(), heap_plugin_put(), init_socket(), initialize_map_unfiltered(), iterate_copy_history(), join_room_run(), link_room_message(), 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(), notify_srv_handle_member_id(), open_service_room(), open_srv_handle_room(), post_data_iter(), process_ksk_result(), process_sks_result(), publicize_rm(), 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(), rfn_vote(), route_packet(), run(), schedule_block_download(), server_read_pkt(), setup_sender(), 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(), 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 273 of file container_multihashmap.c.
References map, and GNUNET_CONTAINER_MultiPeerMap::size.
Referenced by __attribute__(), boot_queue(), cb_intersection_element_removed(), check_alices_cryptodata_message(), check_union_p2p_elements(), close_service_room(), close_srv_handle_room(), connection_destroy(), create_receiver(), create_target(), disconnect(), disconnect_cb(), entry_service_room(), free_validation_state(), GDS_ROUTING_done(), GNUNET_DHT_disconnect(), 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(), handle_validation_response(), initialize_key_to_element(), iterate_zones(), maybe_finish(), mq_init(), open_service_room(), peer_destroy(), process_bf(), process_ksk_result(), queue_destroy(), receiver_destroy(), route_packet(), run(), save_state(), schedule_transmit_search_request(), send_alices_cryptodata_message(), sender_destroy(), setup_sender(), solve_srv_room_member_collisions(), switch_member_session(), transmit_cryptographic_reply(), union_accept(), and validation_transmit_on_queue().
int 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 309 of file container_multihashmap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_OK, GNUNET_SYSERR, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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 _GSS_operation_destroy(), begin_bf_exchange(), callback_mq_error(), callback_reconnect(), cleanup(), cleanup_handle(), cleanup_store_discourse_messages_before(), clear_contact_store(), clear_message_store(), clear_operation_store(), client_disconnect_cb(), close_all_files(), collect_generation_garbage(), connection_destroy(), database_shutdown(), destroy_handle(), destroy_member(), destroy_room(), destroy_service(), destroy_service_session(), destroy_srv_handle(), disconnect_cb(), do_reconnect(), do_shutdown(), enc_notify_cb(), free_search_context(), get_member_session_of(), 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_IDENTITY_disconnect(), GNUNET_MESSENGER_find_rooms(), GSF_iterate_pending_requests_(), GSF_peer_disconnect_handler(), GSF_pending_request_done_(), 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(), handle_validation_response(), heap_get_keys(), heap_plugin_get_closest(), heap_plugin_get_key(), initialize_key_to_element(), iterate_member_sessions(), iterate_zones(), libgnunet_plugin_datastore_heap_done(), load_member_next_sessions(), main(), maybe_finish(), namecache_expire_blocks(), namestore_flat_iterate_records(), namestore_flat_zone_to_name(), print_finish(), process_bf(), reconnect_cbk(), REGEX_INTERNAL_iterate_reachable_edges(), REGEX_INTERNAL_search_cancel(), reschedule_connect(), reset_cadet(), REST_openid_done(), run(), save_member(), save_member_session_history(), save_message_store(), save_operation_store(), save_state(), schedule_transmit_search_request(), send_alices_cryptodata_message(), send_bloomfilter(), send_full_set(), share_tree_trim(), shutdown_task(), signal_search_resume(), stop_service_run(), switch_member_session(), sync_member_contacts(), task_notify_srv_handle_member_id(), 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 908 of file container_multihashmap.c.
References GNUNET_new, GNUNET_CONTAINER_MultiHashMapIterator::map, GNUNET_CONTAINER_MultiPeerMap::map, 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 922 of file container_multihashmap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_NO, GNUNET_YES, GNUNET_CONTAINER_MultiHashMapIterator::idx, key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiHashMap::map, GNUNET_CONTAINER_MultiHashMapIterator::map, GNUNET_CONTAINER_MultiHashMap::map_length, GNUNET_CONTAINER_MultiHashMapIterator::me, GNUNET_CONTAINER_MultiHashMap::modification_counter, GNUNET_CONTAINER_MultiHashMapIterator::modification_counter, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, GNUNET_CONTAINER_MultiHashMap::use_small_entries, value, BigMapEntry::value, and SmallMapEntry::value.
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 967 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 781 of file container_multihashmap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_memcmp, GNUNET_OK, GNUNET_SYSERR, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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 close_srv_handle_room(), delete_linked_hash(), find_trees(), GDS_CLIENTS_handle_reply(), GDS_ROUTING_add(), GDS_ROUTING_process(), GNUNET_FS_namespace_list_updateable(), GSF_plan_add_(), handle_client_result(), handle_dht_local_get_result_seen(), handle_dht_local_get_stop(), handle_p2p_get(), handle_p2p_put(), handle_port_open(), handle_put(), handle_reply(), heap_plugin_get(), heap_plugin_get_key(), heap_plugin_put(), heap_plugin_remove_key(), iter_hashcodes(), link_room_deletion(), link_room_message(), process_ksk_result(), process_sks_result(), regex_next_edge(), and try_handle_plaintext().
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 848 of file container_multihashmap.c.
References GNUNET_break, GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_u32(), GNUNET_OK, GNUNET_SYSERR, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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, GNUNET_CONTAINER_MultiPeerMap::map, 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(), GDS_NEIGHBOURS_init(), GNUNET_CORE_connect(), GNUNET_CRYPTO_ecc_dlog_prepare(), GNUNET_HOSTLIST_server_start(), GNUNET_MESSENGER_create_room_state(), GNUNET_PEER_intern(), GNUNET_TRANSPORT_application_init(), GSC_SESSIONS_init(), GSF_cadet_start_server(), GSF_connected_peer_init_(), GSF_plan_init(), handle_add_queue_message(), handle_client_send_request(), handle_connection_create(), handle_peer_push(), handle_suggest(), new_sub(), run(), 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, GNUNET_CONTAINER_MultiPeerMap::map, 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(), client_disconnect_cb(), CustomPeerMap_destroy(), destroy_srv_room(), destroy_sub(), do_shutdown(), free_neighbour(), GDS_NEIGHBOURS_done(), GNUNET_CORE_disconnect(), GNUNET_CRYPTO_ecc_dlog_release(), GNUNET_MESSENGER_destroy_room_state(), GNUNET_TRANSPORT_application_done(), GSC_SESSIONS_done(), GSF_cadet_stop_server(), GSF_connected_peer_done_(), GSF_plan_done(), handle_connection_create(), 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, GNUNET_CONTAINER_MultiPeerMap::map, map, me, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
Referenced by connect_notify(), consider_for_advertising(), cummulative_ack(), CustomPeerMap_get_index_pointer(), CustomPeerMap_remove_peer(), enter_srv_room_at(), find_session(), 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_(), handle_client_send(), handle_client_send_request(), handle_connect_notify(), handle_core_connect(), handle_disconnect_notify(), handle_dv_box(), handle_notify_inbound(), handle_revocation_union_request(), handle_send_ready(), handle_suggest_cancel(), learn_dv_path(), lookup_neighbour(), lookup_virtual_link(), neighbour_find(), process_peer(), process_peer_monitoring_cb(), rebuild_srv_room_basement_structure(), route_control_message_without_fc(), 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 389 of file container_multipeermap.c.
References MapEntry::bme, GNUNET_free, GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, GNUNET_CONTAINER_MultiPeerMap::map, 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 callback_room_connect(), callback_tunnel_disconnect(), check_for_global_natted(), destroy_ack_cummulator(), destroy_active_client_request(), destroy_it(), destroy_peer(), disconnect_and_free_peer_entry(), disconnect_cb(), enter_srv_room_at(), free_backtalker(), free_dv_route(), free_neighbour(), free_peer(), free_validation_state(), free_virtual_link(), 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(), neighbour_delete(), queue_destroy(), and stop_peer_request().
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.
References MapEntry::bme, GNUNET_free, GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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 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 524 of file container_multipeermap.c.
References MapEntry::bme, GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, me, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by callback_tunnel_disconnect(), check_peer_known(), check_peer_valid(), check_removable(), clean_peer(), CustomPeerMap_contains_peer(), CustomPeerMap_put(), destroy_peer(), get_peer_ctx(), GSC_CLIENTS_deliver_message(), GSC_CLIENTS_notify_client_about_neighbour(), GSC_CLIENTS_solicit_request(), handle_add_queue_message(), handle_client_send_request(), handle_dv_learn(), handle_peer_pull_reply(), handle_peer_pull_request(), handle_peer_push(), mq_notify_sent_cb(), send_pull_request(), send_push(), 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 548 of file container_multipeermap.c.
References MapEntry::bme, GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, me, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, value, BigMapEntry::value, and SmallMapEntry::value.
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, GNUNET_CONTAINER_MultiPeerMap::map, 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_valid_peer(), callback_room_connect(), check_for_global_natted(), connect_peer(), core_connects(), create_peer_ctx(), cummulative_ack(), CustomPeerMap_put(), enter_srv_room_at(), GCP_get(), GDS_u_connect(), get_cadet(), 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_(), handle_add_queue_message(), handle_client_init(), handle_client_send_request(), handle_connect(), handle_connection_create(), handle_core_connect(), handle_dv_box(), handle_flow_control(), handle_suggest(), handle_validation_response(), insert_in_sampler(), learn_dv_path(), make_peer(), new_peer_entry(), on_message_cb(), process_notify(), process_peer_monitoring_cb(), setup_queue(), start_address_validation(), 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(), callback_tunnel_disconnect(), create_peer_ctx(), CustomPeerMap_put(), CustomPeerMap_remove_peer(), CustomPeerMap_remove_peer_by_index(), CustomPeerMap_size(), destroy_peer(), do_shutdown(), GDS_NEIGHBOURS_done(), GDS_u_connect(), GDS_u_disconnect(), get_random_peer_from_peermap(), get_srv_room_amount_of_tunnels(), 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(), process_notify(), queue_destroy(), restore_valid_peers(), send_find_peer_message(), setup_estimate_message(), setup_queue(), shutdown_task(), start_dv_learn(), store_valid_peers(), 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, GNUNET_CONTAINER_MultiPeerMap::map, 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(), cleaning_task(), client_disconnect_cb(), consider_for_advertising(), consider_sending_fc(), cron_flush_respect(), destroy_srv_room(), disconnect(), do_shutdown(), forward_srv_room_message(), free_neighbour(), GCP_destroy_all_peers(), GCP_iterate_all(), get_random_peer_from_peermap(), get_valid_peers(), 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_(), handle_client_start(), handle_dv_learn(), handle_monitor_start(), handle_p2p_estimate(), peers_terminate(), process_notify(), publicize_rm(), reconnect(), reconnect_later(), schedule_next_hello(), send_find_peer_message(), send_srv_room_message(), shutdown_task(), start_dv_learn(), store_valid_peers(), and update_flood_message().
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, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMapIterator::map, 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 843 of file container_multipeermap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_NO, GNUNET_YES, GNUNET_CONTAINER_MultiPeerMapIterator::idx, key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMapIterator::map, GNUNET_CONTAINER_MultiPeerMap::map_length, GNUNET_CONTAINER_MultiPeerMapIterator::me, GNUNET_CONTAINER_MultiPeerMap::modification_counter, GNUNET_CONTAINER_MultiPeerMapIterator::modification_counter, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, value, BigMapEntry::value, and SmallMapEntry::value.
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, GNUNET_CONTAINER_MultiPeerMap::map, 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 check_for_global_natted(), handle_add_queue_message(), handle_validation_response(), lookup_queue(), and start_address_validation().
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, GNUNET_CONTAINER_MultiPeerMap::map, 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 195 of file container_multishortmap.c.
References GNUNET_assert, GNUNET_free, GNUNET_malloc_large, GNUNET_new, GNUNET_CONTAINER_MultiPeerMap::map, map, GNUNET_CONTAINER_MultiPeerMap::map_length, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by create_member(), create_message_control(), create_peers(), create_room(), create_subnet_peers(), create_subnets(), GCO_init(), GCP_get(), GNUNET_CORE_cmd_connect_peers(), GNUNET_PQ_connect2(), GNUNET_TESTING_add_barrier_(), GNUNET_TESTING_get_topo_from_string_(), GNUNET_TRANSPORT_cmd_start_peer(), init_member_store(), init_peer_store(), run(), and start_testcase().
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 214 of file container_multishortmap.c.
References GNUNET_assert, GNUNET_free, GNUNET_CONTAINER_MultiPeerMap::map, 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(), clear_peer_store(), destroy_member(), destroy_message_control(), destroy_peer(), destroy_room(), do_shutdown(), finish_test(), GCO_shutdown(), GNUNET_PQ_connect2(), GNUNET_PQ_disconnect(), and shutdown_rest().
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 283 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, me, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, BigMapEntry::value, and SmallMapEntry::value.
Referenced by GCC_lookup(), get_member_subscription(), get_node_info(), get_route(), get_store_member(), GNUNET_PQ_event_listen(), GNUNET_PQ_event_listen_cancel(), GNUNET_TESTING_get_barrier2_(), handle_discourse_subscription(), and sock_read().
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 401 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_free, GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, GNUNET_CONTAINER_MultiPeerMap::map, 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(), GCC_destroy(), GCP_remove_connection(), GNUNET_PQ_event_listen_cancel(), handle_discourse_subscription(), handle_id_message(), handle_leave_message(), kce_destroy(), keep_subscription_alive(), remove_member_subscription(), start_dv_learn(), and task_message_control().
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 457 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_free, GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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 537 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, me, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, and GNUNET_CONTAINER_MultiPeerMap::use_small_entries.
Referenced by generate_free_member_id().
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 561 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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 644 of file container_multishortmap.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, GNUNET_CONTAINER_MultiPeerMap::map, 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 add_member_subscription(), add_peer_store_entry(), add_store_member(), connection_create(), create_peers(), create_subnet_peers(), create_subnets(), enqueue_message_control(), GCP_add_connection(), GNUNET_PQ_event_listen(), GNUNET_TESTING_add_barrier_(), GNUNET_TESTING_get_topo_from_string_(), handle_connection_create(), handle_discourse_subscription(), handle_id_message(), handle_join_message(), kce_generate(), load_peer_store(), notify_connect(), start_dv_learn(), and start_testcase().
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 275 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(), GNUNET_TESTING_barrier_count_(), 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 307 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_OK, GNUNET_SYSERR, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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(), clear_peer_store(), destroy_member(), destroy_room(), find_room_member(), free_carriers_cb(), free_subnets_cb(), GNUNET_PQ_event_reconnect_(), GNUNET_TESTING_barrier_iterate_(), GNUNET_TESTING_free_topology(), iterate_member_subscriptions(), iterate_room_members(), iterate_store_members(), load_member_store(), log_namespaces(), log_topo(), netjail_exec_run(), save_member_store(), save_peer_store(), send_simple_run(), start_carriers(), and start_subnets().
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 838 of file container_multishortmap.c.
References GNUNET_new, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiShortmapIterator::map, 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 852 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_NO, GNUNET_YES, GNUNET_CONTAINER_MultiShortmapIterator::idx, key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiShortmap::map, GNUNET_CONTAINER_MultiShortmapIterator::map, GNUNET_CONTAINER_MultiShortmap::map_length, GNUNET_CONTAINER_MultiShortmapIterator::me, GNUNET_CONTAINER_MultiShortmap::modification_counter, GNUNET_CONTAINER_MultiShortmapIterator::modification_counter, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, GNUNET_CONTAINER_MultiShortmap::use_small_entries, value, BigMapEntry::value, and SmallMapEntry::value.
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 897 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 722 of file container_multishortmap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_memcmp, GNUNET_OK, GNUNET_SYSERR, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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 get_store_peer_of(), GNUNET_PQ_event_do_poll(), process_message_control(), and update_store_peer().
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 789 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, GNUNET_CONTAINER_MultiPeerMap::map, 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 195 of file container_multiuuidmap.c.
References GNUNET_assert, GNUNET_free, GNUNET_malloc_large, GNUNET_new, GNUNET_CONTAINER_MultiPeerMap::map, 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 214 of file container_multiuuidmap.c.
References GNUNET_assert, GNUNET_free, GNUNET_CONTAINER_MultiPeerMap::map, 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 283 of file container_multiuuidmap.c.
References MapEntry::bme, GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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 401 of file container_multiuuidmap.c.
References MapEntry::bme, GNUNET_free, GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, GNUNET_CONTAINER_MultiPeerMap::map, 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 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 456 of file container_multiuuidmap.c.
References MapEntry::bme, GNUNET_free, GNUNET_memcmp, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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 | ( | 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 536 of file container_multiuuidmap.c.
References MapEntry::bme, GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, me, BigMapEntry::next, SmallMapEntry::next, MapEntry::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 560 of file container_multiuuidmap.c.
References MapEntry::bme, GNUNET_memcmp, GNUNET_NO, GNUNET_YES, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, me, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, GNUNET_CONTAINER_MultiPeerMap::use_small_entries, value, BigMapEntry::value, and SmallMapEntry::value.
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 643 of file container_multiuuidmap.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, GNUNET_CONTAINER_MultiPeerMap::map, 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 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 275 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 307 of file container_multiuuidmap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_OK, GNUNET_SYSERR, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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 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 836 of file container_multiuuidmap.c.
References GNUNET_new, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiUuidmapIterator::map, 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 850 of file container_multiuuidmap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_NO, GNUNET_YES, GNUNET_CONTAINER_MultiUuidmapIterator::idx, key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiUuidmap::map, GNUNET_CONTAINER_MultiUuidmapIterator::map, GNUNET_CONTAINER_MultiUuidmap::map_length, GNUNET_CONTAINER_MultiUuidmapIterator::me, GNUNET_CONTAINER_MultiUuidmap::modification_counter, GNUNET_CONTAINER_MultiUuidmapIterator::modification_counter, BigMapEntry::next, SmallMapEntry::next, MapEntry::sme, GNUNET_CONTAINER_MultiUuidmap::use_small_entries, value, BigMapEntry::value, and SmallMapEntry::value.
void GNUNET_CONTAINER_multiuuidmap_iterator_destroy | ( | struct GNUNET_CONTAINER_MultiUuidmapIterator * | iter | ) |
Destroy a multiuuidmap iterator.
iter | the iterator to destroy |
Definition at line 895 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 720 of file container_multiuuidmap.c.
References MapEntry::bme, GNUNET_assert, GNUNET_memcmp, GNUNET_OK, GNUNET_SYSERR, idx_of(), key, BigMapEntry::key, SmallMapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, 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 787 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, GNUNET_CONTAINER_MultiPeerMap::map, 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 142 of file container_multihashmap32.c.
References GNUNET_assert, GNUNET_free, GNUNET_malloc_large, GNUNET_new, and ret.
Referenced by client_connect_cb(), CustomPeerMap_create(), GCT_create_tunnel(), GNUNET_CADET_connect(), GNUNET_MQ_assoc_add(), 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 166 of file container_multihashmap32.c.
References GNUNET_free, GNUNET_CONTAINER_MultiPeerMap::map, map, GNUNET_CONTAINER_MultiPeerMap::map_length, and MapEntry::next.
Referenced by _GSS_operation_destroy(), client_disconnect_cb(), CustomPeerMap_destroy(), destroy_tunnel(), free_virtual_link(), GNUNET_CADET_disconnect(), GNUNET_MQ_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 200 of file container_multihashmap32.c.
References map, and GNUNET_CONTAINER_MultiPeerMap::size.
Referenced by client_disconnect_cb(), CustomPeerMap_put(), CustomPeerMap_remove_peer(), CustomPeerMap_remove_peer_by_index(), CustomPeerMap_size(), GCT_count_channels(), handle_client_accept(), handle_client_evaluate(), 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 208 of file container_multihashmap32.c.
References idx_of(), key, MapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, MapEntry::next, and MapEntry::value.
Referenced by CustomPeerMap_get_peer_by_index(), CustomPeerMap_remove_peer(), find_channel(), get_next_free_ctn(), GNUNET_MQ_assoc_get(), GNUNET_MQ_assoc_remove(), 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 226 of file container_multihashmap32.c.
References GNUNET_assert, GNUNET_OK, GNUNET_SYSERR, MapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, GNUNET_CONTAINER_MultiPeerMap::map_length, MapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, NEXT_CACHE_SIZE, and MapEntry::value.
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(), handle_mq_error(), handle_union_p2p_full_done(), prepare_ibf(), 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 280 of file container_multihashmap32.c.
References GNUNET_free, GNUNET_NO, GNUNET_YES, idx_of(), key, MapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, GNUNET_CONTAINER_MultiPeerMap::modification_counter, MapEntry::next, p, GNUNET_CONTAINER_MultiPeerMap::size, update_next_cache(), value, and MapEntry::value.
Referenced by channel_destroy_iterator(), destroy_channel(), free_reassembly_context(), GCT_remove_channel(), GSC_handle_remote_channel_destroy(), and handle_channel_destroy().
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 315 of file container_multihashmap32.c.
References GNUNET_free, idx_of(), key, MapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, GNUNET_CONTAINER_MultiPeerMap::modification_counter, MapEntry::next, p, ret, GNUNET_CONTAINER_MultiPeerMap::size, and update_next_cache().
Referenced by CustomPeerMap_remove_peer(), and GNUNET_MQ_assoc_remove().
enum GNUNET_GenericReturnValue 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).
map | the map |
key | the key to test if a value exists for it |
Definition at line 358 of file container_multihashmap32.c.
References GNUNET_NO, GNUNET_YES, idx_of(), key, MapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, and MapEntry::next.
Referenced by CustomPeerMap_clear(), CustomPeerMap_get_peer_by_index(), and CustomPeerMap_remove_peer_by_index().
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap32_contains_value | ( | const struct GNUNET_CONTAINER_MultiHashMap32 * | map, |
uint32_t | 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 376 of file container_multihashmap32.c.
References GNUNET_NO, GNUNET_YES, idx_of(), key, MapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, MapEntry::next, value, and MapEntry::value.
enum GNUNET_GenericReturnValue 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.
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 449 of file container_multihashmap32.c.
References GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, grow(), idx_of(), key, MapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, GNUNET_CONTAINER_MultiPeerMap::map_length, MapEntry::next, GNUNET_CONTAINER_MultiPeerMap::size, value, and MapEntry::value.
Referenced by create_channel(), CustomPeerMap_put(), CustomPeerMap_remove_peer(), GCT_add_channel(), GNUNET_MQ_assoc_add(), GSC_bind(), handle_channel_create(), handle_fragment_box(), handle_plaintext_channel_open(), and op_register_element().
int GNUNET_CONTAINER_multihashmap32_get_multiple | ( | struct GNUNET_CONTAINER_MultiHashMap32 * | map, |
uint32_t | key, | ||
GNUNET_CONTAINER_MultiHashMapIterator32Callback | 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 491 of file container_multihashmap32.c.
References GNUNET_assert, GNUNET_OK, GNUNET_SYSERR, idx_of(), key, MapEntry::key, GNUNET_CONTAINER_MultiPeerMap::map, map, MapEntry::next, GNUNET_CONTAINER_MultiPeerMap::next_cache, GNUNET_CONTAINER_MultiPeerMap::next_cache_off, NEXT_CACHE_SIZE, and MapEntry::value.
Referenced by handle_fragment_box(), op_get_element(), and send_offers_for_key().