Go to the source code of this file.
Functions | |
void | GCPP_try_path_from_dht (const struct GNUNET_DHT_PathElement *get_path, unsigned int get_path_length, const struct GNUNET_DHT_PathElement *put_path, unsigned int put_path_length) |
Create a peer path based on the result of a DHT lookup. More... | |
struct CadetPeerPath * | GCPP_get_path_from_route (unsigned int path_length, const struct GNUNET_PeerIdentity *pids) |
We got an incoming connection, obtain the corresponding path. More... | |
unsigned int | GCPP_get_length (struct CadetPeerPath *path) |
Return the length of the path. More... | |
struct CadetConnection * | GCPP_get_connection (struct CadetPeerPath *path, struct CadetPeer *destination, unsigned int off) |
Return connection to destination using path, or return NULL if no such connection exists. More... | |
void | GCPP_add_connection (struct CadetPeerPath *path, unsigned int off, struct CadetConnection *cc) |
Notify path that it is used for connection cc which ends at the path's offset off. More... | |
void | GCPP_del_connection (struct CadetPeerPath *path, unsigned int off, struct CadetConnection *cc) |
Notify path that it is no longer used for connection cc which ended at the path's offset off. More... | |
unsigned int | GCPP_find_peer (struct CadetPeerPath *path, struct CadetPeer *cp) |
Find peer's offset on path. More... | |
GNUNET_CONTAINER_HeapCostType | GCPP_get_desirability (const struct CadetPeerPath *path) |
Return how much we like keeping the path. More... | |
void | GCPP_release (struct CadetPeerPath *path) |
The given peer cp used to own this path. More... | |
struct CadetPeer * | GCPP_get_peer_at_offset (struct CadetPeerPath *path, unsigned int off) |
Obtain the peer at offset off in path. More... | |
const char * | GCPP_2s (struct CadetPeerPath *p) |
Convert a path to a human-readable string. More... | |
void GCPP_try_path_from_dht | ( | const struct GNUNET_DHT_PathElement * | get_path, |
unsigned int | get_path_length, | ||
const struct GNUNET_DHT_PathElement * | put_path, | ||
unsigned int | put_path_length | ||
) |
Create a peer path based on the result of a DHT lookup.
If we already know this path, or one that is longer, simply return NULL. Otherwise, we try to extend an existing path, or create a new one if applicable.
get_path | path of the get request |
get_path_length | length of get_path |
put_path | path of the put request |
put_path_length | length of the put_path |
If we already know this path, or one that is longer, simply return NULL. Otherwise, we try to extend an existing path, or create a new one if applicable.
get_path | path of the get request |
get_path_length | length of get_path |
put_path | path of the put request |
put_path_length | length of the put_path |
Definition at line 471 of file gnunet-service-cadet_paths.c.
References attach_path(), check_match(), CheckMatchContext::cpath, CheckMatchContext::cpath_length, CadetPeerPath::entries, CadetPeerPath::entries_length, extend_path(), GCP_get(), GCP_iterate_paths_at(), GCP_path_entry_add(), GCPP_2s(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_memcmp, GNUNET_new, GNUNET_new_array, GNUNET_NO, GNUNET_YES, CadetPeerPath::hn, LOG, CheckMatchContext::match, my_full_id, CadetPeerPathEntry::path, CadetPeerPathEntry::peer, and pid.
Referenced by dht_get_id_handler().
struct CadetPeerPath * GCPP_get_path_from_route | ( | unsigned int | path_length, |
const struct GNUNET_PeerIdentity * | pids | ||
) |
We got an incoming connection, obtain the corresponding path.
path_length | number of segments on the path |
pids | path through the network, in reverse order (we are at the end, at index path_length) |
Definition at line 598 of file gnunet-service-cadet_paths.c.
References check_match(), CheckMatchContext::cpath, CheckMatchContext::cpath_length, CadetPeerPath::entries, CadetPeerPath::entries_length, extend_path(), GCP_attach_path(), GCP_get(), GCP_iterate_paths_at(), GCP_path_entry_add(), GCPP_2s(), GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_new, GNUNET_new_array, GNUNET_YES, CadetPeerPath::hn, LOG, CheckMatchContext::match, CadetPeerPathEntry::path, CadetPeerPathEntry::peer, and recalculate_path_desirability().
Referenced by GCP_iterate_paths(), GCP_set_mq(), and handle_connection_create().
unsigned int GCPP_get_length | ( | struct CadetPeerPath * | path | ) |
Return the length of the path.
Excludes one end of the path, so the loopback path has length 0.
path | path to return the length for |
Definition at line 692 of file gnunet-service-cadet_paths.c.
References CadetPeerPath::entries_length, and CadetPeerPathEntry::path.
Referenced by consider_path_cb(), evaluate_connection(), GCP_attach_path(), path_heap_cleanup(), and path_info_iterator().
struct CadetConnection * GCPP_get_connection | ( | struct CadetPeerPath * | path, |
struct CadetPeer * | destination, | ||
unsigned int | off | ||
) |
Return connection to destination using path, or return NULL if no such connection exists.
path | path to traverse |
destination | destination node to get to, must be on path |
off | offset of destination on path |
Definition at line 118 of file gnunet-service-cadet_paths.c.
References CadetPeerPathEntry::cc, CadetPeerPath::entries, GNUNET_assert, CadetPeerPathEntry::path, and CadetPeerPathEntry::peer.
Referenced by GCC_create_inbound(), and path_heap_cleanup().
void GCPP_add_connection | ( | struct CadetPeerPath * | path, |
unsigned int | off, | ||
struct CadetConnection * | cc | ||
) |
Notify path that it is used for connection cc which ends at the path's offset off.
path | the path to remember the cc |
off | the offset where the cc ends |
cc | the connection to remember |
Definition at line 140 of file gnunet-service-cadet_paths.c.
References CadetPeerPathEntry::cc, CadetPeerPath::entries, GCC_2s(), GCPP_2s(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, LOG, and CadetPeerPathEntry::path.
Referenced by connection_create().
void GCPP_del_connection | ( | struct CadetPeerPath * | path, |
unsigned int | off, | ||
struct CadetConnection * | cc | ||
) |
Notify path that it is no longer used for connection cc which ended at the path's offset off.
path | the path to forget the cc |
off | the offset where the cc ended |
cc | the connection to forget |
Definition at line 168 of file gnunet-service-cadet_paths.c.
References CadetPeerPathEntry::cc, CadetPeerPath::entries, GCC_2s(), GCPP_2s(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, LOG, and CadetPeerPathEntry::path.
Referenced by GCC_destroy().
unsigned int GCPP_find_peer | ( | struct CadetPeerPath * | path, |
struct CadetPeer * | cp | ||
) |
Find peer's offset on path.
path | path to search |
cp | peer to look for |
Definition at line 706 of file gnunet-service-cadet_paths.c.
References CadetPeerPath::entries_length, GCPP_get_peer_at_offset(), and CadetPeerPathEntry::path.
Referenced by GCC_create_inbound().
GNUNET_CONTAINER_HeapCostType GCPP_get_desirability | ( | const struct CadetPeerPath * | path | ) |
Return how much we like keeping the path.
This is an aggregate score based on various factors, including the age of the path (older == better), and the value of this path to all of its adjacent peers. For example, long paths that end at a peer that we have no shorter way to reach are very desirable, while long paths that end at a peer for which we have a shorter way as well are much less desirable. Higher values indicate more valuable paths. The returned value should be used to decide which paths to remember.
path | path to return the length for |
Definition at line 101 of file gnunet-service-cadet_paths.c.
References CadetPeerPath::desirability.
Referenced by consider_path_cb(), evaluate_connection(), and GCP_attach_path().
void GCPP_release | ( | struct CadetPeerPath * | path | ) |
The given peer cp used to own this path.
However, it is no longer interested in maintaining it, so the path should be discarded or shortened (in case a previous peer on the path finds the path desirable).
path | the path that is being released |
The given peer cp used to own this path.
path | the path that is being released |
Definition at line 243 of file gnunet-service-cadet_paths.c.
References attach_path(), CadetPeerPathEntry::cc, CadetPeerPath::entries, CadetPeerPath::entries_length, GCP_path_entry_remove(), GCPP_2s(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, CadetPeerPath::hn, LOG, CadetPeerPathEntry::path, and CadetPeerPathEntry::peer.
Referenced by drop_paths(), GCP_drop_owned_paths(), and path_heap_cleanup().
struct CadetPeer * GCPP_get_peer_at_offset | ( | struct CadetPeerPath * | path, |
unsigned int | off | ||
) |
Obtain the peer at offset off in path.
path | peer path to inspect |
off | offset to return, must be smaller than path length |
Definition at line 720 of file gnunet-service-cadet_paths.c.
References CadetPeerPath::entries, GNUNET_assert, and CadetPeerPathEntry::peer.
Referenced by check_match(), connection_create(), consider_path_cb(), evaluate_connection(), GCC_destroy(), GCP_attach_path(), GCP_path_entry_add(), GCPP_2s(), GCPP_find_peer(), handle_connection_broken(), handle_connection_create_ack(), handle_connection_destroy(), handle_tunnel_encrypted(), handle_tunnel_kx(), handle_tunnel_kx_auth(), path_info_iterator(), and send_create().
const char * GCPP_2s | ( | struct CadetPeerPath * | path | ) |
Convert a path to a human-readable string.
path | path to convert |
path | path to convert |
Definition at line 735 of file gnunet-service-cadet_paths.c.
References CadetPeerPath::entries_length, GCP_get_id(), GCPP_get_peer_at_offset(), GNUNET_i2s(), and GNUNET_snprintf().
Referenced by check_match(), connection_create(), consider_path_cb(), evaluate_connection(), extend_path(), GCC_create_inbound(), GCC_debug(), GCP_attach_path(), GCP_detach_path(), GCP_path_entry_add(), GCP_path_entry_remove(), GCPP_add_connection(), GCPP_del_connection(), GCPP_get_path_from_route(), GCPP_release(), GCPP_try_path_from_dht(), GCT_consider_path(), and handle_connection_create().