#include "platform.h"
#include "gnunet-service-messenger_member_store.h"
#include "gnunet-service-messenger_member.h"
#include "gnunet-service-messenger_service.h"
#include "gnunet-service-messenger_room.h"
#include "messenger_api_message.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_MESSENGER_ClosureIterateMembers |
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... | |
static enum GNUNET_GenericReturnValue | iterate_destroy_members (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
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... | |
static enum GNUNET_GenericReturnValue | callback_scan_for_members (void *cls, const char *filename) |
static enum GNUNET_GenericReturnValue | iterate_load_next_member_sessions (void *cls, const struct GNUNET_ShortHashCode *id, void *value) |
static enum GNUNET_GenericReturnValue | iterate_sync_member_contacts (void *cls, const struct GNUNET_ShortHashCode *id, void *value) |
void | load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) |
Loads members from a directory into a member store. More... | |
static enum GNUNET_GenericReturnValue | iterate_save_members (void *cls, const struct GNUNET_ShortHashCode *id, void *value) |
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... | |
static int | iterate_store_members_it (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
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... | |
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().
|
static |
Definition at line 47 of file gnunet-service-messenger_member_store.c.
References destroy_member(), GNUNET_assert, GNUNET_YES, and value.
Referenced by clear_member_store().
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().
|
static |
Definition at line 100 of file gnunet-service-messenger_member_store.c.
References DIR_SEPARATOR, filename, GNUNET_asprintf(), GNUNET_assert, GNUNET_DISK_directory_test(), GNUNET_free, GNUNET_OK, GNUNET_YES, and load_member().
Referenced by load_member_store().
|
static |
Definition at line 125 of file gnunet-service-messenger_member_store.c.
References DIR_SEPARATOR, GNUNET_asprintf(), GNUNET_assert, GNUNET_DISK_directory_test(), GNUNET_free, GNUNET_sh2s(), GNUNET_YES, load_member_next_sessions(), and value.
Referenced by load_member_store().
|
static |
Definition at line 153 of file gnunet-service-messenger_member_store.c.
References GNUNET_assert, GNUNET_YES, sync_member_contacts(), and value.
Referenced by load_member_store().
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().
|
static |
Definition at line 198 of file gnunet-service-messenger_member_store.c.
References DIR_SEPARATOR, GNUNET_asprintf(), GNUNET_assert, GNUNET_DISK_directory_create(), GNUNET_DISK_directory_test(), GNUNET_free, GNUNET_NO, GNUNET_OK, GNUNET_sh2s(), GNUNET_YES, save_member(), and value.
Referenced by save_member_store().
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().
|
static |
Definition at line 315 of file gnunet-service-messenger_member_store.c.
References GNUNET_MESSENGER_ClosureIterateMembers::cls, GNUNET_assert, GNUNET_MESSENGER_ClosureIterateMembers::it, iterate_member_sessions(), and value.
Referenced by iterate_store_members().
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().