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, const struct GNUNET_HashCode *hash) |
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... | |
struct GNUNET_MESSENGER_ListTunnel * | find_list_tunnels_alternate (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer) |
Searches linearly through the list of tunnels peer identities for matching against a specific peer identity and returns an element of the list which does not match it. More... | |
enum GNUNET_GenericReturnValue | verify_list_tunnels_flag_token (const struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, enum GNUNET_MESSENGER_ConnectionFlags flag) |
Verifies that a specific tunnel selected by its peer identity in a list of tunnels is the first in order with a given connection flag. More... | |
void | update_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HashCode *hash) |
Updates a specific peer from a tunnel in the list. More... | |
enum GNUNET_GenericReturnValue | 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... | |
void init_list_tunnels | ( | struct GNUNET_MESSENGER_ListTunnels * | tunnels | ) |
Initializes list of tunnels peer identities as empty list.
[out] | tunnels | List of tunnels |
Definition at line 29 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 tunnels |
Definition at line 39 of file messenger_api_list_tunnels.c.
References GNUNET_assert, GNUNET_MESSENGER_ListTunnels::head, remove_from_list_tunnels(), and GNUNET_MESSENGER_ListTunnels::tail.
Referenced by callback_leave_message_sent(), destroy_room(), and destroy_srv_room().
void add_to_list_tunnels | ( | struct GNUNET_MESSENGER_ListTunnels * | tunnels, |
const struct GNUNET_PeerIdentity * | peer, | ||
const struct GNUNET_HashCode * | hash | ||
) |
Adds a specific peer from a tunnel to the end of the list.
Optionally adds the hash of the peer message from the specific peer.
[in,out] | tunnels | List of tunnels |
[in] | peer | Peer identity of tunnel |
[in] | hash | Hash of peer message or NULL |
Definition at line 71 of file messenger_api_list_tunnels.c.
References compare_list_tunnels(), GNUNET_MESSENGER_ListTunnel::connection, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_sorted, GNUNET_memdup, GNUNET_new, GNUNET_PEER_intern(), GNUNET_MESSENGER_ListTunnel::hash, GNUNET_MESSENGER_ListTunnels::head, GNUNET_MESSENGER_ListTunnel::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 tunnels |
[in] | peer | Peer identity of tunnel |
[out] | index | Index of found element (optional) |
Definition at line 94 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, and pid.
Referenced by contains_list_tunnels(), handle_message_connection(), handle_message_miss(), handle_miss_message(), rebuild_srv_room_basement_structure(), and update_to_list_tunnels().
struct GNUNET_MESSENGER_ListTunnel * find_list_tunnels_alternate | ( | struct GNUNET_MESSENGER_ListTunnels * | tunnels, |
const struct GNUNET_PeerIdentity * | peer | ||
) |
Searches linearly through the list of tunnels peer identities for matching against a specific peer identity and returns an element of the list which does not match it.
[in,out] | tunnels | List of tunnels |
[in] | peer | Peer identity of tunnel |
Definition at line 122 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, and pid.
Referenced by callback_tunnel_disconnect().
enum GNUNET_GenericReturnValue verify_list_tunnels_flag_token | ( | const struct GNUNET_MESSENGER_ListTunnels * | tunnels, |
const struct GNUNET_PeerIdentity * | peer, | ||
enum GNUNET_MESSENGER_ConnectionFlags | flag | ||
) |
Verifies that a specific tunnel selected by its peer identity in a list of tunnels is the first in order with a given connection flag.
[in] | tunnels | List of tunnels |
[in] | peer | Peer identity of tunnel |
[in] | flag | Connection flag mask |
Definition at line 143 of file messenger_api_list_tunnels.c.
References GNUNET_MESSENGER_ListTunnel::connection, GNUNET_MESSENGER_MessageConnection::flags, GNUNET_assert, GNUNET_memcmp, GNUNET_OK, GNUNET_PEER_resolve(), GNUNET_SYSERR, GNUNET_MESSENGER_ListTunnels::head, GNUNET_MESSENGER_ListTunnel::next, GNUNET_MESSENGER_ListTunnel::peer, and pid.
Referenced by rebuild_srv_room_basement_structure().
void update_to_list_tunnels | ( | struct GNUNET_MESSENGER_ListTunnels * | tunnels, |
const struct GNUNET_PeerIdentity * | peer, | ||
const struct GNUNET_HashCode * | hash | ||
) |
Updates a specific peer from a tunnel in the list.
This function exists to add the hash of a newer peer message from the specific peer to the list element. It can also remove the hash when NULL is provided as new hash value.
[in,out] | tunnels | List of tunnels |
[in] | peer | Peer identity of tunnel |
[in] | hash | Hash of peer message or NULL |
Definition at line 169 of file messenger_api_list_tunnels.c.
References find_list_tunnels(), GNUNET_assert, GNUNET_free, GNUNET_memcpy, GNUNET_memdup, GNUNET_MESSENGER_ListTunnel::hash, and GNUNET_MESSENGER_ListTunnel::peer.
Referenced by recv_message_peer().
enum GNUNET_GenericReturnValue 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 tunnels |
[in] | peer | Peer identity of tunnel |
Definition at line 197 of file messenger_api_list_tunnels.c.
References find_list_tunnels(), GNUNET_assert, GNUNET_NO, GNUNET_YES, and GNUNET_MESSENGER_ListTunnel::peer.
Referenced by callback_tunnel_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 tunnels |
[in,out] | element | Element of the list |
Definition at line 208 of file messenger_api_list_tunnels.c.
References GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_PEER_change_rc(), GNUNET_MESSENGER_ListTunnel::hash, GNUNET_MESSENGER_ListTunnels::head, GNUNET_MESSENGER_ListTunnel::next, GNUNET_MESSENGER_ListTunnel::peer, and GNUNET_MESSENGER_ListTunnels::tail.
Referenced by clear_list_tunnels(), 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 tunnels |
[in] | path | Path of file |
Definition at line 230 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_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_YES, and handle.
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 tunnels |
[in] | path | Path of file |
Definition at line 274 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_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_PEER_resolve(), handle, GNUNET_MESSENGER_ListTunnels::head, GNUNET_MESSENGER_ListTunnel::next, GNUNET_MESSENGER_ListTunnel::peer, and pid.
Referenced by save_srv_room().