messenger api: client and service implementation of GNUnet MESSENGER service More...
Go to the source code of this file.
Data Structures | |
struct | GNUNET_MESSENGER_ListTunnel |
struct | GNUNET_MESSENGER_ListTunnels |
Functions | |
void | init_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels) |
Initializes list of tunnels peer identities as empty list. More... | |
void | clear_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels) |
Clears the list of tunnels peer identities. More... | |
void | add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer) |
Adds a specific peer from a tunnel to the end of the list. More... | |
struct GNUNET_MESSENGER_ListTunnel * | find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, size_t *index) |
Searches linearly through the list of tunnels peer identities for matching a specific peer identity and returns the matching element of the list. More... | |
int | contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer) |
Tests linearly if the list of tunnels peer identities contains a specific peer identity and returns GNUNET_YES on success, otherwise GNUNET_NO. More... | |
struct GNUNET_MESSENGER_ListTunnel * | remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element) |
Removes a specific element from the list of tunnels peer identities and returns the next element in the list. More... | |
void | load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path) |
Loads the list of tunnels peer identities from a file under a given path. More... | |
void | save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path) |
Saves the list of tunnels peer identities to a file under a given path. More... | |
messenger api: client and service implementation of GNUnet MESSENGER service
Definition in file messenger_api_list_tunnels.h.
void init_list_tunnels | ( | struct GNUNET_MESSENGER_ListTunnels * | tunnels | ) |
Initializes list of tunnels peer identities as empty list.
[out] | tunnels | List of peer identities |
Definition at line 30 of file messenger_api_list_tunnels.c.
References GNUNET_assert, GNUNET_MESSENGER_ListTunnels::head, and GNUNET_MESSENGER_ListTunnels::tail.
Referenced by create_room(), and create_srv_room().
void clear_list_tunnels | ( | struct GNUNET_MESSENGER_ListTunnels * | tunnels | ) |
Clears the list of tunnels peer identities.
[in,out] | tunnels | List of peer identities |
Definition at line 39 of file messenger_api_list_tunnels.c.
References GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_PEER_change_rc(), GNUNET_MESSENGER_ListTunnels::head, GNUNET_MESSENGER_ListTunnel::peer, and GNUNET_MESSENGER_ListTunnels::tail.
Referenced by destroy_room(), and destroy_srv_room().
void add_to_list_tunnels | ( | struct GNUNET_MESSENGER_ListTunnels * | tunnels, |
const struct GNUNET_PeerIdentity * | peer | ||
) |
Adds a specific peer from a tunnel to the end of the list.
[in,out] | tunnels | List of peer identities |
[in] | peer | Peer identity of tunnel |
Definition at line 65 of file messenger_api_list_tunnels.c.
References compare_list_tunnels(), GNUNET_assert, GNUNET_CONTAINER_DLL_insert_sorted, GNUNET_new, GNUNET_PEER_intern(), GNUNET_MESSENGER_ListTunnels::head, GNUNET_MESSENGER_ListTunnel::peer, peer, and GNUNET_MESSENGER_ListTunnels::tail.
Referenced by entry_handle_room_at(), handle_message_peer(), and load_list_tunnels().
struct GNUNET_MESSENGER_ListTunnel* find_list_tunnels | ( | struct GNUNET_MESSENGER_ListTunnels * | tunnels, |
const struct GNUNET_PeerIdentity * | peer, | ||
size_t * | index | ||
) |
Searches linearly through the list of tunnels peer identities for matching a specific peer identity and returns the matching element of the list.
If no matching element is found, NULL gets returned.
If index is not NULL, index will be overridden with the numeric index of the found element in the list. If no matching element is found, index will contain the total amount of elements in the list.
[in,out] | tunnels | List of peer identities |
[in] | peer | Peer identity of tunnel |
[out] | index | Index of found element (optional) |
Definition at line 79 of file messenger_api_list_tunnels.c.
References GNUNET_assert, GNUNET_memcmp, GNUNET_PEER_resolve(), GNUNET_MESSENGER_ListTunnels::head, GNUNET_MESSENGER_ListTunnel::next, GNUNET_MESSENGER_ListTunnel::peer, peer, and pid.
Referenced by contains_list_tunnels(), handle_message_miss(), handle_miss_message(), and rebuild_srv_room_basement_structure().
int contains_list_tunnels | ( | struct GNUNET_MESSENGER_ListTunnels * | tunnels, |
const struct GNUNET_PeerIdentity * | peer | ||
) |
Tests linearly if the list of tunnels peer identities contains a specific peer identity and returns GNUNET_YES on success, otherwise GNUNET_NO.
[in,out] | tunnels | List of peer identities |
[in] | peer | Peer identity of tunnel |
Definition at line 106 of file messenger_api_list_tunnels.c.
References find_list_tunnels(), GNUNET_assert, GNUNET_NO, GNUNET_YES, and peer.
Referenced by callback_room_disconnect(), handle_message_peer(), and recv_message_info().
struct GNUNET_MESSENGER_ListTunnel* remove_from_list_tunnels | ( | struct GNUNET_MESSENGER_ListTunnels * | tunnels, |
struct GNUNET_MESSENGER_ListTunnel * | element | ||
) |
Removes a specific element from the list of tunnels peer identities and returns the next element in the list.
[in,out] | tunnels | List of peer identities |
[in,out] | element | Element of the list |
Definition at line 115 of file messenger_api_list_tunnels.c.
References GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_PEER_change_rc(), GNUNET_MESSENGER_ListTunnels::head, GNUNET_MESSENGER_ListTunnel::next, GNUNET_MESSENGER_ListTunnel::peer, and GNUNET_MESSENGER_ListTunnels::tail.
Referenced by handle_message_miss(), handle_miss_message(), and rebuild_srv_room_basement_structure().
void load_list_tunnels | ( | struct GNUNET_MESSENGER_ListTunnels * | tunnels, |
const char * | path | ||
) |
Loads the list of tunnels peer identities from a file under a given path.
[out] | tunnels | List of hashes |
[in] | path | Path of file |
Definition at line 130 of file messenger_api_list_tunnels.c.
References add_to_list_tunnels(), GNUNET_assert, GNUNET_DISK_file_close(), GNUNET_DISK_file_open(), GNUNET_DISK_file_read(), GNUNET_DISK_file_seek(), GNUNET_DISK_file_test(), GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_DISK_SEEK_SET, GNUNET_YES, handle, len, and peer.
Referenced by load_srv_room().
void save_list_tunnels | ( | struct GNUNET_MESSENGER_ListTunnels * | tunnels, |
const char * | path | ||
) |
Saves the list of tunnels peer identities to a file under a given path.
[in] | tunnels | List of hashes |
[in] | path | Path of file |
Definition at line 165 of file messenger_api_list_tunnels.c.
References GNUNET_assert, GNUNET_DISK_file_close(), GNUNET_DISK_file_open(), GNUNET_DISK_file_seek(), GNUNET_DISK_file_sync(), GNUNET_DISK_file_write(), GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_DISK_SEEK_SET, GNUNET_PEER_resolve(), handle, GNUNET_MESSENGER_ListTunnels::head, GNUNET_MESSENGER_ListTunnel::next, GNUNET_MESSENGER_ListTunnel::peer, and pid.
Referenced by save_srv_room().