Go to the source code of this file.
Data Structures | |
struct | GNUNET_MESSENGER_MemberStore |
Typedefs | |
typedef enum GNUNET_GenericReturnValue(* | GNUNET_MESSENGER_MemberIteratorCallback) (void *cls, const struct GNUNET_CRYPTO_PublicKey *public_key, struct GNUNET_MESSENGER_MemberSession *session) |
Functions | |
void | init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MESSENGER_SrvRoom *room) |
Initializes a member store as fully empty connected to a room. More... | |
void | clear_member_store (struct GNUNET_MESSENGER_MemberStore *store) |
Clears a member store, wipes its content and deallocates its memory. More... | |
struct GNUNET_MESSENGER_ContactStore * | get_member_contact_store (struct GNUNET_MESSENGER_MemberStore *store) |
Returns the used contact store of a given member store. More... | |
const struct GNUNET_HashCode * | get_member_store_key (const struct GNUNET_MESSENGER_MemberStore *store) |
Returns the shared secret you need to access a room of the store. More... | |
void | load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) |
Loads members from a directory into a member store. More... | |
void | save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) |
Saves members from a member store into a directory. More... | |
struct GNUNET_MESSENGER_Member * | get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) |
Returns the member in a store identified by a given id. More... | |
struct GNUNET_MESSENGER_Member * | get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_MESSENGER_Message *message) |
Returns the member of a store using a sender id of a given message. More... | |
struct GNUNET_MESSENGER_Member * | add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) |
Adds a member to a store under a specific id and returns it on success. More... | |
int | iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store, GNUNET_MESSENGER_MemberIteratorCallback it, void *cls) |
Iterate through all member sessions currently connected to the members of the given member store and call the provided iterator callback with a selected closure. More... | |
typedef enum GNUNET_GenericReturnValue(* GNUNET_MESSENGER_MemberIteratorCallback) (void *cls, const struct GNUNET_CRYPTO_PublicKey *public_key, struct GNUNET_MESSENGER_MemberSession *session) |
Definition at line 1 of file gnunet-service-messenger_member_store.h.
void init_member_store | ( | struct GNUNET_MESSENGER_MemberStore * | store, |
struct GNUNET_MESSENGER_SrvRoom * | room | ||
) |
Initializes a member store as fully empty connected to a room.
[out] | store | Member store |
room | Room |
Definition at line 36 of file gnunet-service-messenger_member_store.c.
References GNUNET_assert, GNUNET_CONTAINER_multishortmap_create(), GNUNET_NO, GNUNET_MESSENGER_MemberStore::members, and GNUNET_MESSENGER_MemberStore::room.
Referenced by create_srv_room().
void clear_member_store | ( | struct GNUNET_MESSENGER_MemberStore * | store | ) |
Clears a member store, wipes its content and deallocates its memory.
[in,out] | store | Member store |
Definition at line 63 of file gnunet-service-messenger_member_store.c.
References get_srv_room_key(), GNUNET_assert, GNUNET_CONTAINER_multishortmap_destroy(), GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, iterate_destroy_members(), GNUNET_MESSENGER_MemberStore::members, GNUNET_MESSENGER_MemberStore::room, and GNUNET_MESSENGER_Member::store.
Referenced by destroy_srv_room().
struct GNUNET_MESSENGER_ContactStore * get_member_contact_store | ( | struct GNUNET_MESSENGER_MemberStore * | store | ) |
Returns the used contact store of a given member store.
[in,out] | store | Member store |
Definition at line 77 of file gnunet-service-messenger_member_store.c.
References get_service_contact_store(), GNUNET_assert, GNUNET_MESSENGER_MemberStore::room, and GNUNET_MESSENGER_SrvRoom::service.
Referenced by check_member_session_completion(), create_member_session(), destroy_member_session(), reset_member_session(), and switch_member_session().
const struct GNUNET_HashCode * get_member_store_key | ( | const struct GNUNET_MESSENGER_MemberStore * | store | ) |
Returns the shared secret you need to access a room of the store.
[in] | store | Member store |
Definition at line 90 of file gnunet-service-messenger_member_store.c.
References get_srv_room_key(), GNUNET_assert, and GNUNET_MESSENGER_MemberStore::room.
Referenced by get_member_session_key().
void load_member_store | ( | struct GNUNET_MESSENGER_MemberStore * | store, |
const char * | directory | ||
) |
Loads members from a directory into a member store.
[out] | store | Member store |
[in] | directory | Path to a directory |
Definition at line 172 of file gnunet-service-messenger_member_store.c.
References callback_scan_for_members(), DIR_SEPARATOR, GNUNET_asprintf(), GNUNET_assert, GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_DISK_directory_scan(), GNUNET_DISK_directory_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_OK, GNUNET_YES, iterate_load_next_member_sessions(), iterate_sync_member_contacts(), GNUNET_MESSENGER_MemberStore::members, find_typedefs::scan_dir(), and GNUNET_MESSENGER_Member::store.
Referenced by load_srv_room().
void save_member_store | ( | struct GNUNET_MESSENGER_MemberStore * | store, |
const char * | directory | ||
) |
Saves members from a member store into a directory.
[in] | store | Member store |
[in] | directory | Path to a directory |
Definition at line 227 of file gnunet-service-messenger_member_store.c.
References DIR_SEPARATOR, GNUNET_asprintf(), GNUNET_assert, GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_DISK_directory_create(), GNUNET_DISK_directory_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_YES, iterate_save_members(), GNUNET_MESSENGER_MemberStore::members, and GNUNET_MESSENGER_Member::store.
Referenced by save_srv_room().
struct GNUNET_MESSENGER_Member * get_store_member | ( | const struct GNUNET_MESSENGER_MemberStore * | store, |
const struct GNUNET_ShortHashCode * | id | ||
) |
Returns the member in a store identified by a given id.
If the store does not contain a member with the given id, NULL gets returned.
[in] | store | Member store |
[in] | id | Member id |
Definition at line 249 of file gnunet-service-messenger_member_store.c.
References GNUNET_assert, GNUNET_CONTAINER_multishortmap_get(), GNUNET_MESSENGER_MemberStore::members, and GNUNET_MESSENGER_Member::store.
Referenced by add_store_member(), get_handle_member_session(), get_store_member_of(), handle_get_message(), load_member_session_next(), notify_srv_handle_message(), and solve_srv_room_member_collisions().
struct GNUNET_MESSENGER_Member * get_store_member_of | ( | struct GNUNET_MESSENGER_MemberStore * | store, |
const struct GNUNET_MESSENGER_Message * | message | ||
) |
Returns the member of a store using a sender id of a given message.
If the message is a peer message or the member does not provide a matching session, NULL gets returned.
[in,out] | store | Member store |
[in] | message | Message |
Definition at line 259 of file gnunet-service-messenger_member_store.c.
References add_store_member(), get_store_member(), GNUNET_assert, GNUNET_MESSENGER_KIND_JOIN, GNUNET_YES, GNUNET_MESSENGER_Message::header, is_peer_message(), GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_MessageHeader::sender_id, and GNUNET_MESSENGER_Member::store.
Referenced by callback_found_message(), callback_room_handle_message(), handle_room_messages(), and recv_message_request().
struct GNUNET_MESSENGER_Member * add_store_member | ( | struct GNUNET_MESSENGER_MemberStore * | store, |
const struct GNUNET_ShortHashCode * | id | ||
) |
Adds a member to a store under a specific id and returns it on success.
[in,out] | store | Member store |
[in] | id | Member id |
Definition at line 275 of file gnunet-service-messenger_member_store.c.
References create_member(), destroy_member(), get_member_id(), get_store_member(), GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CONTAINER_multishortmap_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_OK, GNUNET_sh2s(), GNUNET_MESSENGER_MemberStore::members, and GNUNET_MESSENGER_Member::store.
Referenced by get_store_member_of(), join_room_locally(), load_member(), open_srv_room(), send_message_join(), and switch_member_session().
int iterate_store_members | ( | struct GNUNET_MESSENGER_MemberStore * | store, |
GNUNET_MESSENGER_MemberIteratorCallback | it, | ||
void * | cls | ||
) |
Iterate through all member sessions currently connected to the members of the given member store and call the provided iterator callback with a selected closure.
The function will return the amount of members it iterated through.
[in,out] | store | Member store |
[in] | it | Iterator callback |
[in,out] | cls | Closure |
Definition at line 332 of file gnunet-service-messenger_member_store.c.
References GNUNET_MESSENGER_ClosureIterateMembers::cls, GNUNET_assert, GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_MESSENGER_ClosureIterateMembers::it, iterate_store_members_it(), and GNUNET_MESSENGER_MemberStore::members.
Referenced by callback_room_handle_message(), cleanup_srv_room_discourse_messages(), initialize_service_handle(), recv_message_info(), and send_message_join().