code for handling overlay connect operations More...
#include "platform.h"
#include "gnunet-service-testbed.h"
#include "gnunet-service-testbed_connectionpool.h"
#include "gnunet_transport_hello_service.h"
Go to the source code of this file.
Data Structures | |
struct | ConnectivitySuggestContext |
Context information for requesting ATS to connect to a peer. More... | |
struct | LocalPeer2Context |
Context data for operations on second peer in local overlay connection contexts. More... | |
struct | RemotePeer2Context |
Context data for operations on second peer in remote overlay connection contexts. More... | |
struct | OverlayConnectContext |
Context information for connecting 2 peers in overlay. More... | |
struct | RemoteOverlayConnectCtx |
Context information for remote overlay connect operations. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "testbed-OC", __VA_ARGS__) |
Redefine LOG with a changed log component string. More... | |
#define | PEER_EXPIRED(peer) ((GNUNET_YES == peer->destroy_flag) && (0 == peer->reference_cnt)) |
Condition for checking if given peer is ready to be destroyed. More... | |
Enumerations | |
enum | OverlayConnectContextType { OCC_TYPE_LOCAL , OCC_TYPE_REMOTE_SLAVE , OCC_TYPE_REMOTE_LATERAL } |
Types for context information we create for overlay connect requests. More... | |
Functions | |
void | GST_cleanup_focc (struct ForwardedOverlayConnectContext *focc) |
Cleans up ForwardedOverlayConnectContext. More... | |
static void | forwarded_overlay_connect_timeout (void *cls) |
Timeout task for cancelling a forwarded overlay connect connect. More... | |
static void | forwarded_overlay_connect_listener (void *cls, const struct GNUNET_MessageHeader *msg) |
Callback to be called when forwarded overlay connection operation has a reply from the sub-controller successful. More... | |
void | GST_process_next_focc (struct RegisteredHostContext *rhc) |
Processes a forwarded overlay connect context in the queue of the given RegisteredHostContext. More... | |
static void | cleanup_occ_lp2c (struct LocalPeer2Context *lp2c) |
Cleans up any used handles in local peer2 context. More... | |
static void | cleanup_occ_rp2c (struct RemotePeer2Context *rp2c) |
Cleans up any used handles in remote peer2 context. More... | |
static void | cleanup_occ (struct OverlayConnectContext *occ) |
Cleanup overlay connect context structure. More... | |
static void | do_cleanup_occ (void *cls) |
Task for cleaning up overlay connect context structure. More... | |
static void | timeout_overlay_connect (void *cls) |
Task which will be run when overlay connect request has been timed out. More... | |
void | GST_notify_client_disconnect_oc (struct GNUNET_SERVICE_Client *client) |
Notify OC subsystem that client disconnected. More... | |
static void | send_overlay_connect_success_msg (struct OverlayConnectContext *occ) |
FIXME. More... | |
static void | overlay_connect_notify (void *cls, const struct GNUNET_PeerIdentity *new_peer) |
Function called to notify transport users that another peer connected to us. More... | |
static void | occ_cache_get_handle_ats_occ_cb (void *cls, struct GNUNET_CORE_Handle *ch, struct GNUNET_TRANSPORT_CoreHandle *th, struct GNUNET_ATS_ConnectivityHandle *ac, const struct GNUNET_PeerIdentity *my_identity, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Callback from cache with needed ATS handle set. More... | |
static void | occ_cache_get_handle_ats_rocc_cb (void *cls, struct GNUNET_CORE_Handle *ch, struct GNUNET_TRANSPORT_CoreHandle *th, struct GNUNET_ATS_ConnectivityHandle *ac, const struct GNUNET_PeerIdentity *my_identity, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Callback from cache with needed ATS handle set. More... | |
static void | send_hello (void *cls) |
Task to offer HELLO of peer 1 to peer 2 and try to make peer 2 to connect to peer 1. More... | |
static void | occ_hello_sent_cb (void *cls) |
Task that is run when hello has been sent If tc->reason = GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if GNUNET_SCHEDULER_REASON_READ_READY is succeeded. More... | |
static void | send_hello_thru_rocc (struct OverlayConnectContext *occ) |
Sends the HELLO of peer1 to peer2's controller through remote overlay connect request. More... | |
static void | p2_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch, struct GNUNET_TRANSPORT_CoreHandle *th, struct GNUNET_ATS_ConnectivityHandle *ac, const struct GNUNET_PeerIdentity *ignore_, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Callback from cache with needed handles set. More... | |
static void | p2_transport_connect (struct OverlayConnectContext *occ) |
Connects to the transport of the other peer if it is a local peer and schedules the send hello task. More... | |
static int | test_address (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Absolute expiration) |
Test for checking whether HELLO message is empty. More... | |
static void | hello_update_cb (void *cls, const struct GNUNET_MessageHeader *hello) |
Function called whenever there is an update to the HELLO of peers in the OverlayConnectClosure. More... | |
static void | p1_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch, struct GNUNET_TRANSPORT_CoreHandle *th, struct GNUNET_ATS_ConnectivityHandle *ac, const struct GNUNET_PeerIdentity *ignore_, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Callback from cache with needed handles set. More... | |
static void | occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch, struct GNUNET_TRANSPORT_CoreHandle *th, struct GNUNET_ATS_ConnectivityHandle *ac, const struct GNUNET_PeerIdentity *my_identity, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Callback from cache with needed CORE handle set. More... | |
static void | overlay_connect_get_config (void *cls, const struct GNUNET_MessageHeader *msg) |
Callback to be called when forwarded get peer config operation as part of overlay connect is successful. More... | |
static void | host_registration_comp (void *cls, const char *emsg) |
Callback which will be called after a host registration succeeded or failed. More... | |
static int | reghost_match_iterator (void *cls, const struct GNUNET_HashCode *key, void *value) |
Iterator to match a registered host context. More... | |
static struct GNUNET_HashCode | hash_hosts (struct GNUNET_TESTBED_Host *reg_host, struct GNUNET_TESTBED_Host *host) |
Function to generate the hashcode corresponding to a RegisteredHostContext. More... | |
static struct RegisteredHostContext * | register_host (struct Slave *slave, struct GNUNET_TESTBED_Host *host) |
Checks if the given host is registered at the given slave. More... | |
static void | forward_overlay_connect (const struct GNUNET_TESTBED_OverlayConnectMessage *msg, struct GNUNET_SERVICE_Client *client) |
Forwards the overlay connect request to a slave controller. More... | |
static void | p2_controller_connect_cb (void *cls, struct GNUNET_TESTBED_Controller *c) |
Callback called when a connection to the controller of peer2 has been established. More... | |
void | handle_overlay_connect (void *cls, const struct GNUNET_TESTBED_OverlayConnectMessage *msg) |
Handler for GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT messages. More... | |
static void | cleanup_rocc (struct RemoteOverlayConnectCtx *rocc) |
Function to cleanup RemoteOverlayConnectCtx and any associated tasks with it. More... | |
static void | timeout_rocc_task (void *cls) |
Task to timeout rocc and cleanit up. More... | |
static void | cache_transport_peer_connect_notify (void *cls, const struct GNUNET_PeerIdentity *new_peer) |
Function called to notify transport users that another peer connected to us. More... | |
static void | attempt_connect_task (void *cls) |
Task to offer the HELLO message to the peer and ask it to connect to the peer whose identity is in RemoteOverlayConnectCtx. More... | |
static void | rocc_hello_sent_cb (void *cls) |
Task that is run when hello has been sent If tc->reason = GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if GNUNET_SCHEDULER_REASON_READ_READY is succeeded. More... | |
static void | rocc_cache_get_handle_transport_cb (void *cls, struct GNUNET_CORE_Handle *ch, struct GNUNET_TRANSPORT_CoreHandle *th, struct GNUNET_ATS_ConnectivityHandle *ac, const struct GNUNET_PeerIdentity *ignore_, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Callback from cache with needed handles set. More... | |
int | check_remote_overlay_connect (void *cls, const struct GNUNET_TESTBED_RemoteOverlayConnectMessage *msg) |
Check GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT messages. More... | |
void | handle_remote_overlay_connect (void *cls, const struct GNUNET_TESTBED_RemoteOverlayConnectMessage *msg) |
Handler for GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT messages. More... | |
void | GST_free_occq () |
Clears all pending overlay connect contexts in queue. More... | |
void | GST_free_roccq () |
Clears all pending remote overlay connect contexts in queue. More... | |
Variables | |
static struct OverlayConnectContext * | occq_head |
DLL head for OverlayConnectContext DLL - to be used to clean up during shutdown. More... | |
static struct OverlayConnectContext * | occq_tail |
DLL tail for OverlayConnectContext DLL. More... | |
static struct RemoteOverlayConnectCtx * | roccq_head |
DLL head for RequectOverlayConnectContext DLL - to be used to clean up during shutdown. More... | |
static struct RemoteOverlayConnectCtx * | roccq_tail |
DLL tail for RequectOverlayConnectContext DLL. More... | |
code for handling overlay connect operations
Definition in file gnunet-service-testbed_oc.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "testbed-OC", __VA_ARGS__) |
Redefine LOG with a changed log component string.
Definition at line 38 of file gnunet-service-testbed_oc.c.
#define PEER_EXPIRED | ( | peer | ) | ((GNUNET_YES == peer->destroy_flag) && (0 == peer->reference_cnt)) |
Condition for checking if given peer is ready to be destroyed.
peer | the peer to check |
Definition at line 525 of file gnunet-service-testbed_oc.c.
Types for context information we create for overlay connect requests.
Definition at line 78 of file gnunet-service-testbed_oc.c.
void GST_cleanup_focc | ( | struct ForwardedOverlayConnectContext * | focc | ) |
Cleans up ForwardedOverlayConnectContext.
focc | the ForwardedOverlayConnectContext to cleanup |
Definition at line 357 of file gnunet-service-testbed_oc.c.
References RegisteredHostContext::focc_dll_head, RegisteredHostContext::focc_dll_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_free, ForwardedOverlayConnectContext::orig_msg, and ForwardedOverlayConnectContext::rhc.
Referenced by drop_client_entries(), forwarded_overlay_connect_listener(), forwarded_overlay_connect_timeout(), and reghost_free_iterator().
|
static |
Timeout task for cancelling a forwarded overlay connect connect.
cls | the struct ForwardedOperationContext |
Definition at line 375 of file gnunet-service-testbed_oc.c.
References ForwardedOperationContext::cls, RegisteredHostContext::focc_dll_head, GST_cleanup_focc(), GST_forwarded_operation_timeout(), GST_process_next_focc(), LOG_DEBUG, ForwardedOverlayConnectContext::peer1, ForwardedOverlayConnectContext::peer2, ForwardedOverlayConnectContext::rhc, and ForwardedOperationContext::timeout_task.
Referenced by GST_process_next_focc().
|
static |
Callback to be called when forwarded overlay connection operation has a reply from the sub-controller successful.
We have to relay the reply msg back to the client
cls | ForwardedOperationContext |
msg | the peer create success message |
Definition at line 403 of file gnunet-service-testbed_oc.c.
References ForwardedOperationContext::cls, RegisteredHostContext::focc_dll_head, GST_cleanup_focc(), GST_forwarded_operation_reply_relay(), GST_process_next_focc(), msg, and ForwardedOverlayConnectContext::rhc.
Referenced by GST_process_next_focc().
void GST_process_next_focc | ( | struct RegisteredHostContext * | rhc | ) |
Processes a forwarded overlay connect context in the queue of the given RegisteredHostContext.
rhc | the RegisteredHostContext |
Definition at line 425 of file gnunet-service-testbed_oc.c.
References ForwardedOperationContext::client, ForwardedOverlayConnectContext::client, ForwardedOperationContext::cls, Slave::controller, RegisteredHostContext::focc_dll_head, fopcq_head, fopcq_tail, forwarded_overlay_connect_listener(), forwarded_overlay_connect_timeout(), GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_free, GNUNET_new, GNUNET_SCHEDULER_add_delayed(), GNUNET_TESTBED_forward_operation_msg_(), GNUNET_YES, GST_peer_list, GST_timeout, OP_OVERLAY_CONNECT, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, ForwardedOverlayConnectContext::operation_id, ForwardedOverlayConnectContext::orig_msg, peer, ForwardedOverlayConnectContext::peer1, RegisteredHostContext::state, ForwardedOperationContext::timeout_task, ForwardedOperationContext::type, and VALID_PEER_ID.
Referenced by forwarded_overlay_connect_listener(), forwarded_overlay_connect_timeout(), and host_registration_comp().
|
static |
Cleans up any used handles in local peer2 context.
lp2c | the local peer2 context information |
Definition at line 468 of file gnunet-service-testbed_oc.c.
References ConnectivitySuggestContext::cgh_p2_ats, ConnectivitySuggestContext::cgh_p2_th, ConnectivitySuggestContext::csh, GNUNET_ATS_connectivity_suggest_cancel(), GNUNET_TRANSPORT_offer_hello_cancel(), GST_connection_pool_get_handle_done(), LocalPeer2Context::ohh, and LocalPeer2Context::tcc.
Referenced by cleanup_occ(), and overlay_connect_notify().
|
static |
Cleans up any used handles in remote peer2 context.
Relinquishes the remote controller connection if it has been established on-demand.
rp2c | the remote peer2 context information |
Definition at line 500 of file gnunet-service-testbed_oc.c.
References GNUNET_TESTBED_forward_operation_msg_cancel_(), GST_neighbour_get_connection_cancel(), GST_neighbour_release_connection(), RemotePeer2Context::ncn, RemotePeer2Context::opc, RemotePeer2Context::p2c, and RemotePeer2Context::p2n.
Referenced by cleanup_occ(), and overlay_connect_notify().
|
static |
Cleanup overlay connect context structure.
occ | the overlay connect context |
Definition at line 534 of file gnunet-service-testbed_oc.c.
References OverlayConnectContext::cgh_ch, OverlayConnectContext::cgh_p1th, cleanup_occ_lp2c(), cleanup_occ_rp2c(), OverlayConnectContext::cleanup_task, OverlayConnectContext::emsg, OverlayConnectContext::ghh, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_TRANSPORT_hello_get_cancel(), GST_connection_pool_get_handle_done(), GST_destroy_peer(), GST_peer_list, OverlayConnectContext::hello, OverlayConnectContext::local, LOG_DEBUG, OCC_TYPE_LOCAL, OCC_TYPE_REMOTE_LATERAL, OCC_TYPE_REMOTE_SLAVE, occq_head, occq_tail, OverlayConnectContext::op_id, OverlayConnectContext::other_peer_id, OverlayConnectContext::p2ctx, OverlayConnectContext::peer, PEER_EXPIRED, Peer::reference_cnt, OverlayConnectContext::remote, OverlayConnectContext::send_hello_task, OverlayConnectContext::timeout_task, and OverlayConnectContext::type.
Referenced by do_cleanup_occ(), GST_free_occq(), GST_notify_client_disconnect_oc(), and timeout_overlay_connect().
|
static |
Task for cleaning up overlay connect context structure.
cls | the overlay connect context |
Definition at line 587 of file gnunet-service-testbed_oc.c.
References cleanup_occ(), and OverlayConnectContext::cleanup_task.
Referenced by occ_cache_get_handle_core_cb(), and overlay_connect_notify().
|
static |
Task which will be run when overlay connect request has been timed out.
cls | the OverlayConnectContext |
Definition at line 602 of file gnunet-service-testbed_oc.c.
References cleanup_occ(), OverlayConnectContext::client, OverlayConnectContext::emsg, GNUNET_assert, GST_send_operation_fail_msg(), OverlayConnectContext::op_id, and OverlayConnectContext::timeout_task.
Referenced by handle_overlay_connect(), occ_cache_get_handle_ats_occ_cb(), occ_cache_get_handle_core_cb(), overlay_connect_get_config(), p1_transport_connect_cache_callback(), and p2_transport_connect_cache_callback().
void GST_notify_client_disconnect_oc | ( | struct GNUNET_SERVICE_Client * | client | ) |
Notify OC subsystem that client disconnected.
client | the client that disconnected |
Definition at line 624 of file gnunet-service-testbed_oc.c.
References cleanup_occ(), ForwardedOperationContext::client, OverlayConnectContext::client, fopcq_head, GNUNET_SCHEDULER_cancel(), GST_forwarded_operation_timeout(), ForwardedOperationContext::next, OverlayConnectContext::next, occq_head, and ForwardedOperationContext::timeout_task.
Referenced by client_disconnect_cb().
|
static |
FIXME.
Definition at line 654 of file gnunet-service-testbed_oc.c.
References OverlayConnectContext::client, env, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SERVICE_client_get_mq(), GNUNET_TESTBED_ET_CONNECT, Peer::id, LOG_DEBUG, msg, OverlayConnectContext::op_id, OverlayConnectContext::other_peer_id, and OverlayConnectContext::peer.
Referenced by occ_cache_get_handle_core_cb(), and overlay_connect_notify().
|
static |
Function called to notify transport users that another peer connected to us.
cls | closure |
new_peer | the peer that connected |
Definition at line 680 of file gnunet-service-testbed_oc.c.
References cleanup_occ_lp2c(), cleanup_occ_rp2c(), OverlayConnectContext::cleanup_task, do_cleanup_occ(), OverlayConnectContext::emsg, GNUNET_assert, GNUNET_free, GNUNET_i2s(), GNUNET_memcmp, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), GNUNET_strdup, OverlayConnectContext::local, LOG_DEBUG, OCC_TYPE_LOCAL, OCC_TYPE_REMOTE_LATERAL, OCC_TYPE_REMOTE_SLAVE, OverlayConnectContext::op_id, OverlayConnectContext::other_peer_identity, OverlayConnectContext::p2ctx, OverlayConnectContext::peer_identity, OverlayConnectContext::remote, OverlayConnectContext::send_hello_task, send_overlay_connect_success_msg(), OverlayConnectContext::timeout_task, and OverlayConnectContext::type.
Referenced by handle_overlay_connect(), and overlay_connect_get_config().
|
static |
Callback from cache with needed ATS handle set.
cls | a struct OverlayConnectCtx * |
ch | the handle to CORE. Can be NULL if it is not requested |
th | the handle to TRANSPORT. Can be NULL if it is not requested |
ac | the handle to ATS. Can be NULL if it is not requested |
my_identity | the identity of our peer |
cfg | configuration of the peer |
Definition at line 749 of file gnunet-service-testbed_oc.c.
References ac, ConnectivitySuggestContext::csh, OverlayConnectContext::emsg, GNUNET_asprintf(), GNUNET_assert, GNUNET_ATS_connectivity_suggest(), GNUNET_free, GNUNET_i2s(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), Peer::id, OverlayConnectContext::local, OCC_TYPE_LOCAL, OverlayConnectContext::op_id, OverlayConnectContext::other_peer_identity, OverlayConnectContext::p2ctx, OverlayConnectContext::peer, OverlayConnectContext::peer_identity, LocalPeer2Context::tcc, timeout_overlay_connect(), OverlayConnectContext::timeout_task, and OverlayConnectContext::type.
Referenced by occ_hello_sent_cb().
|
static |
Callback from cache with needed ATS handle set.
cls | a struct RemoteOverlayConnectCtx * |
ch | the handle to CORE. Can be NULL if it is not requested |
th | the handle to TRANSPORT. Can be NULL if it is not requested |
ac | the handle to ATS. Can be NULL if it is not requested |
my_identity | the identity of our peer |
Definition at line 799 of file gnunet-service-testbed_oc.c.
References RemoteOverlayConnectCtx::a_id, ac, ConnectivitySuggestContext::csh, GNUNET_ATS_connectivity_suggest(), and RemoteOverlayConnectCtx::tcc.
Referenced by rocc_hello_sent_cb().
|
static |
Task to offer HELLO of peer 1 to peer 2 and try to make peer 2 to connect to peer 1.
Task to offer HELLO of peer 1 to peer 2.
cls | the OverlayConnectContext |
If peer2 is local it is offered using its TRANSPORT connection; if remote the HELLO is sent remotely by using send_hello_thru_rocc()
cls | the OverlayConnectContext |
Definition at line 912 of file gnunet-service-testbed_oc.c.
References ConnectivitySuggestContext::cfg, GNUNET_assert, GNUNET_break, GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_free, GNUNET_i2s(), GNUNET_SCHEDULER_add_delayed(), GNUNET_strdup, GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_MILLISECONDS, GNUNET_TRANSPORT_offer_hello(), OverlayConnectContext::hello, OverlayConnectContext::local, LOG_DEBUG, occ_hello_sent_cb(), OCC_TYPE_LOCAL, LocalPeer2Context::ohh, OverlayConnectContext::op_id, OverlayConnectContext::other_peer_identity, OverlayConnectContext::p2ctx, OverlayConnectContext::peer_identity, OverlayConnectContext::send_hello_task, send_hello_thru_rocc(), LocalPeer2Context::tcc, OverlayConnectContext::timeout_task, and OverlayConnectContext::type.
Referenced by p2_transport_connect(), and p2_transport_connect_cache_callback().
|
static |
Task that is run when hello has been sent If tc->reason = GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if GNUNET_SCHEDULER_REASON_READ_READY is succeeded.
cls | the overlay connect context |
Definition at line 833 of file gnunet-service-testbed_oc.c.
References ConnectivitySuggestContext::cgh_p2_ats, Peer::details, OverlayConnectContext::emsg, GNUNET_asprintf(), GNUNET_assert, GNUNET_free, GNUNET_i2s(), GST_connection_pool_get_handle(), GST_CONNECTIONPOOL_SERVICE_ATS_CONNECTIVITY, GST_peer_list, Peer::local, OverlayConnectContext::local, occ_cache_get_handle_ats_occ_cb(), OCC_TYPE_LOCAL, LocalPeer2Context::ohh, OverlayConnectContext::op_id, OverlayConnectContext::other_peer_id, OverlayConnectContext::other_peer_identity, OverlayConnectContext::p2ctx, OverlayConnectContext::send_hello_task, LocalPeer2Context::tcc, OverlayConnectContext::timeout_task, and OverlayConnectContext::type.
Referenced by send_hello().
|
static |
Sends the HELLO of peer1 to peer2's controller through remote overlay connect request.
occ | the overlay connect context. Its type must be either OCC_TYPE_REMOTE_SLAVE or OCC_TYPE_REMOTE_LATERAL |
Definition at line 869 of file gnunet-service-testbed_oc.c.
References GNUNET_assert, GNUNET_free, GNUNET_htonll(), GNUNET_i2s(), GNUNET_malloc, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT, GNUNET_strdup, GNUNET_TESTBED_queue_message_(), OverlayConnectContext::hello, LOG_DEBUG, msg, OCC_TYPE_LOCAL, OverlayConnectContext::op_id, OverlayConnectContext::other_peer_id, OverlayConnectContext::other_peer_identity, RemotePeer2Context::p2c, OverlayConnectContext::p2ctx, OverlayConnectContext::peer_identity, OverlayConnectContext::remote, GNUNET_MessageHeader::size, GNUNET_MessageHeader::type, and OverlayConnectContext::type.
Referenced by send_hello().
|
static |
Callback from cache with needed handles set.
cls | the closure passed to GST_cache_get_handle_transport() |
ch | the handle to CORE. Can be NULL if it is not requested |
th | the handle to TRANSPORT. Can be NULL if it is not requested |
ac | the handle to ATS. Can be NULL if it is not requested |
ignore_ | peer identity which is ignored in this callback |
cfg | configuration of the peer |
Definition at line 963 of file gnunet-service-testbed_oc.c.
References cfg, ConnectivitySuggestContext::cfg, OverlayConnectContext::emsg, GNUNET_asprintf(), GNUNET_assert, GNUNET_i2s(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), OverlayConnectContext::local, OCC_TYPE_LOCAL, OverlayConnectContext::op_id, OverlayConnectContext::other_peer_identity, OverlayConnectContext::p2ctx, send_hello(), OverlayConnectContext::send_hello_task, LocalPeer2Context::tcc, ConnectivitySuggestContext::th_, timeout_overlay_connect(), OverlayConnectContext::timeout_task, and OverlayConnectContext::type.
Referenced by p2_transport_connect().
|
static |
Connects to the transport of the other peer if it is a local peer and schedules the send hello task.
occ | the overlay connect context |
Definition at line 1002 of file gnunet-service-testbed_oc.c.
References OverlayConnectContext::cgh_p1th, ConnectivitySuggestContext::cgh_p2_th, Peer::details, OverlayConnectContext::emsg, OverlayConnectContext::ghh, GNUNET_asprintf(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_SCHEDULER_add_now(), GST_connection_pool_get_handle(), GST_CONNECTIONPOOL_SERVICE_TRANSPORT, GST_peer_list, OverlayConnectContext::hello, Peer::local, OverlayConnectContext::local, OCC_TYPE_LOCAL, OverlayConnectContext::op_id, OverlayConnectContext::other_peer_id, OverlayConnectContext::other_peer_identity, OverlayConnectContext::p1th_, p2_transport_connect_cache_callback(), OverlayConnectContext::p2ctx, send_hello(), OverlayConnectContext::send_hello_task, LocalPeer2Context::tcc, and OverlayConnectContext::type.
Referenced by hello_update_cb(), and occ_cache_get_handle_core_cb().
|
static |
Test for checking whether HELLO message is empty.
cls | empty flag to set |
address | the HELLO |
expiration | expiration of the HELLO |
Definition at line 1044 of file gnunet-service-testbed_oc.c.
References GNUNET_NO, and GNUNET_OK.
Referenced by GNUNET_ATS_solver_generate_property_start(), hello_update_cb(), and set_prop_task().
|
static |
Function called whenever there is an update to the HELLO of peers in the OverlayConnectClosure.
If we have a valid HELLO, we connect to the peer 2's transport and offer peer 1's HELLO and ask peer 2 to connect to peer 1
cls | closure |
hello | our updated HELLO |
Definition at line 1064 of file gnunet-service-testbed_oc.c.
References OverlayConnectContext::cgh_p1th, OverlayConnectContext::emsg, OverlayConnectContext::ghh, GNUNET_free, GNUNET_HELLO_iterate_addresses(), GNUNET_i2s(), GNUNET_malloc, GNUNET_memcpy, GNUNET_NO, GNUNET_TRANSPORT_hello_get_cancel(), GNUNET_YES, GST_cache_add_hello(), GST_connection_pool_get_handle_done(), OverlayConnectContext::hello, Peer::id, LOG_DEBUG, OverlayConnectContext::op_id, OverlayConnectContext::p1th_, p2_transport_connect(), OverlayConnectContext::peer, OverlayConnectContext::peer_identity, GNUNET_MessageHeader::size, and test_address().
Referenced by p1_transport_connect_cache_callback().
|
static |
Callback from cache with needed handles set.
cls | the closure passed to GST_cache_get_handle_transport() |
ch | the handle to CORE. Can be NULL if it is not requested |
th | the handle to TRANSPORT. Can be NULL if it is not requested |
ac | the handle to ATS. Can be NULL if it is not requested |
ignore_ | peer identity which is ignored in this callback |
Definition at line 1111 of file gnunet-service-testbed_oc.c.
References cfg, OverlayConnectContext::cgh_p1th, OverlayConnectContext::emsg, OverlayConnectContext::ghh, GNUNET_asprintf(), GNUNET_assert, GNUNET_free, GNUNET_i2s(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), GNUNET_TRANSPORT_AC_ANY, GNUNET_TRANSPORT_hello_get(), hello_update_cb(), OverlayConnectContext::op_id, OverlayConnectContext::p1th_, OverlayConnectContext::peer_identity, timeout_overlay_connect(), and OverlayConnectContext::timeout_task.
Referenced by occ_cache_get_handle_core_cb().
|
static |
Callback from cache with needed CORE handle set.
cls | the closure passed to GST_cache_get_handle_transport() |
ch | the handle to CORE. Can be NULL if it is not requested |
th | the handle to TRANSPORT. Can be NULL if it is not requested |
ac | the handle to ATS. Can be NULL if it is not requested |
my_identity | the identity of our peer |
Definition at line 1158 of file gnunet-service-testbed_oc.c.
References OverlayConnectContext::cgh_p1th, ch, OverlayConnectContext::cleanup_task, Peer::details, do_cleanup_occ(), OverlayConnectContext::emsg, GNUNET_asprintf(), GNUNET_assert, GNUNET_copy_message(), GNUNET_CORE_get_mq(), GNUNET_free, GNUNET_i2s(), GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), GST_cache_lookup_hello(), GST_connection_pool_get_handle(), GST_CONNECTIONPOOL_SERVICE_TRANSPORT, OverlayConnectContext::hello, Peer::id, Peer::local, LOG_DEBUG, my_identity, OverlayConnectContext::op_id, OverlayConnectContext::other_peer_identity, p1_transport_connect_cache_callback(), p2_transport_connect(), OverlayConnectContext::peer, OverlayConnectContext::peer_identity, send_overlay_connect_success_msg(), timeout_overlay_connect(), and OverlayConnectContext::timeout_task.
Referenced by handle_overlay_connect(), and overlay_connect_get_config().
|
static |
Callback to be called when forwarded get peer config operation as part of overlay connect is successful.
Connection to Peer 1's core is made and is checked for new connection from peer 2
cls | ForwardedOperationContext |
msg | the peer create success message |
Definition at line 1236 of file gnunet-service-testbed_oc.c.
References OverlayConnectContext::cgh_ch, Peer::details, OverlayConnectContext::emsg, GNUNET_asprintf(), GNUNET_assert, GNUNET_free, GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), GST_connection_pool_get_handle(), GST_CONNECTIONPOOL_SERVICE_CORE, Peer::id, Peer::local, msg, occ_cache_get_handle_core_cb(), OCC_TYPE_LOCAL, OverlayConnectContext::op_id, RemotePeer2Context::opc, OverlayConnectContext::other_peer_identity, overlay_connect_notify(), OverlayConnectContext::p2ctx, OverlayConnectContext::peer, GNUNET_TESTBED_PeerConfigurationInformationMessage::peer_identity, OverlayConnectContext::remote, timeout_overlay_connect(), OverlayConnectContext::timeout_task, GNUNET_MessageHeader::type, and OverlayConnectContext::type.
Referenced by p2_controller_connect_cb().
|
static |
Callback which will be called after a host registration succeeded or failed.
cls | the RegisteredHostContext |
emsg | the error message; NULL if host registration is successful |
Definition at line 1281 of file gnunet-service-testbed_oc.c.
References GST_process_next_focc(), RegisteredHostContext::RHC_DONE, and RegisteredHostContext::state.
Referenced by register_host().
|
static |
Iterator to match a registered host context.
cls | pointer 2 pointer of RegisteredHostContext |
key | current key code |
value | value in the hash map |
Definition at line 1301 of file gnunet-service-testbed_oc.c.
Referenced by register_host().
|
static |
Function to generate the hashcode corresponding to a RegisteredHostContext.
reg_host | the host which is being registered in RegisteredHostContext |
host | the host of the controller which has to connect to the above rhost |
Definition at line 1301 of file gnunet-service-testbed_oc.c.
References GNUNET_free, GNUNET_NO, GNUNET_YES, RegisteredHostContext::host, RegisteredHostContext::reg_host, and value.
Referenced by register_host().
|
static |
Checks if the given host is registered at the given slave.
slave | the slave where registration has to be checked. The check is actually done through a locally maintained hashmap. No communication with the slave is involved. |
host | the host to register |
Definition at line 1353 of file gnunet-service-testbed_oc.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_new, GNUNET_NO, GNUNET_SYSERR, GST_host_list, GST_queue_host_registration(), hash_hosts(), RegisteredHostContext::host, Slave::host_id, host_registration_comp(), RegisteredHostContext::reg_host, Slave::reghost_map, reghost_match_iterator(), RegisteredHostContext::RHC_DONE, RegisteredHostContext::RHC_INIT, and RegisteredHostContext::state.
Referenced by forward_overlay_connect().
|
static |
Forwards the overlay connect request to a slave controller.
Before forwarding, any hosts which are needed to be known by the slave controller to execute the overlay connect request are registered at slave.
msg | the overlay connect request message to be forwarded |
client | the client to which the status of the forwarded request has to be notified |
Definition at line 1409 of file gnunet-service-testbed_oc.c.
References ForwardedOperationContext::client, ForwardedOverlayConnectContext::client, GNUNET_TESTBED_Peer::controller, Route::dest, RegisteredHostContext::focc_dll_head, RegisteredHostContext::focc_dll_tail, fopcq_head, fopcq_tail, forward, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_copy_message(), GNUNET_new, GNUNET_ntohll(), GNUNET_SCHEDULER_add_delayed(), GNUNET_TESTBED_forward_operation_msg_(), GNUNET_YES, GST_find_dest_route(), GST_forwarded_operation_reply_relay(), GST_forwarded_operation_timeout(), GST_host_list, GST_peer_list, GST_timeout, LOG_DEBUG, msg, OP_OVERLAY_CONNECT, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, ForwardedOverlayConnectContext::operation_id, ForwardedOverlayConnectContext::orig_msg, peer, ForwardedOverlayConnectContext::peer1, ForwardedOverlayConnectContext::peer2, ForwardedOverlayConnectContext::peer2_host_id, register_host(), ForwardedOverlayConnectContext::rhc, ForwardedOperationContext::timeout_task, ForwardedOperationContext::type, VALID_HOST_ID, and VALID_PEER_ID.
Referenced by handle_overlay_connect().
|
static |
Callback called when a connection to the controller of peer2 has been established.
cls | the overlay connect contexts |
c | handle to the controller connection |
Definition at line 1492 of file gnunet-service-testbed_oc.c.
References OverlayConnectContext::emsg, GNUNET_asprintf(), GNUNET_assert, GNUNET_free, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION, GNUNET_TESTBED_forward_operation_msg_(), GNUNET_TESTBED_PeerGetConfigurationMessage::header, RemotePeer2Context::ncn, OCC_TYPE_LOCAL, OverlayConnectContext::op_id, RemotePeer2Context::opc, GNUNET_TESTBED_PeerGetConfigurationMessage::operation_id, OverlayConnectContext::other_peer_id, overlay_connect_get_config(), RemotePeer2Context::p2c, OverlayConnectContext::p2ctx, GNUNET_TESTBED_PeerGetConfigurationMessage::peer_id, OverlayConnectContext::remote, GNUNET_MessageHeader::size, GNUNET_MessageHeader::type, and OverlayConnectContext::type.
Referenced by handle_overlay_connect().
void handle_overlay_connect | ( | void * | cls, |
const struct GNUNET_TESTBED_OverlayConnectMessage * | msg | ||
) |
Handler for GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT messages.
cls | identification of the client |
msg | the actual message |
Definition at line 1531 of file gnunet-service-testbed_oc.c.
References OverlayConnectContext::cgh_ch, OverlayConnectContext::client, Peer::details, OverlayConnectContext::emsg, forward_overlay_connect(), GNUNET_asprintf(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_i2s(), GNUNET_new, GNUNET_ntohll(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_TESTING_peer_get_identity(), GNUNET_YES, GST_connection_pool_get_handle(), GST_CONNECTIONPOOL_SERVICE_CORE, GST_create_neighbour(), GST_get_neighbour(), GST_host_list, GST_neighbour_get_connection(), GST_peer_list, GST_timeout, Peer::id, Peer::local, LOG, LOG_DEBUG, msg, RemotePeer2Context::ncn, occ_cache_get_handle_core_cb(), OCC_TYPE_LOCAL, OCC_TYPE_REMOTE_LATERAL, OCC_TYPE_REMOTE_SLAVE, occq_head, occq_tail, OverlayConnectContext::op_id, OverlayConnectContext::other_peer_id, OverlayConnectContext::other_peer_identity, overlay_connect_notify(), p2_controller_connect_cb(), RemotePeer2Context::p2c, OverlayConnectContext::p2ctx, RemotePeer2Context::p2n, OverlayConnectContext::peer, peer, Peer::reference_cnt, Peer::remote, OverlayConnectContext::remote, timeout_overlay_connect(), OverlayConnectContext::timeout_task, OverlayConnectContext::type, VALID_HOST_ID, and VALID_PEER_ID.
|
static |
Function to cleanup RemoteOverlayConnectCtx and any associated tasks with it.
rocc | the RemoteOverlayConnectCtx |
Definition at line 1678 of file gnunet-service-testbed_oc.c.
References RemoteOverlayConnectCtx::attempt_connect_task_id, ConnectivitySuggestContext::cgh_p2_ats, ConnectivitySuggestContext::cgh_p2_th, ConnectivitySuggestContext::csh, Peer::destroy_flag, GNUNET_assert, GNUNET_ATS_connectivity_suggest_cancel(), GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_TRANSPORT_offer_hello_cancel(), GNUNET_YES, GST_connection_pool_get_handle_done(), GST_destroy_peer(), RemoteOverlayConnectCtx::hello, LOG_DEBUG, RemoteOverlayConnectCtx::ohh, RemoteOverlayConnectCtx::op_id, RemoteOverlayConnectCtx::peer, Peer::reference_cnt, roccq_head, roccq_tail, RemoteOverlayConnectCtx::tcc, and RemoteOverlayConnectCtx::timeout_rocc_task_id.
Referenced by cache_transport_peer_connect_notify(), GST_free_roccq(), rocc_cache_get_handle_transport_cb(), and timeout_rocc_task().
|
static |
Task to timeout rocc and cleanit up.
cls | the RemoteOverlayConnectCtx |
Definition at line 1711 of file gnunet-service-testbed_oc.c.
References cleanup_rocc(), GNUNET_assert, LOG_DEBUG, RemoteOverlayConnectCtx::op_id, and RemoteOverlayConnectCtx::timeout_rocc_task_id.
Referenced by handle_remote_overlay_connect(), and rocc_cache_get_handle_transport_cb().
|
static |
Function called to notify transport users that another peer connected to us.
cls | the RemoteOverlayConnectContext |
new_peer | the peer that connected |
Definition at line 1731 of file gnunet-service-testbed_oc.c.
References RemoteOverlayConnectCtx::a_id, cleanup_rocc(), GNUNET_assert, GNUNET_i2s(), LOG_DEBUG, and RemoteOverlayConnectCtx::op_id.
Referenced by handle_remote_overlay_connect().
|
static |
Task to offer the HELLO message to the peer and ask it to connect to the peer whose identity is in RemoteOverlayConnectCtx.
cls | the RemoteOverlayConnectCtx |
Definition at line 1792 of file gnunet-service-testbed_oc.c.
References RemoteOverlayConnectCtx::a_id, RemoteOverlayConnectCtx::attempt_connect_task_id, ConnectivitySuggestContext::cfg, GNUNET_assert, GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_i2s(), GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_MILLISECONDS, GNUNET_TRANSPORT_offer_hello(), RemoteOverlayConnectCtx::hello, Peer::id, LOG_DEBUG, RemoteOverlayConnectCtx::ohh, RemoteOverlayConnectCtx::op_id, RemoteOverlayConnectCtx::peer, rocc_hello_sent_cb(), and RemoteOverlayConnectCtx::tcc.
Referenced by rocc_cache_get_handle_transport_cb().
|
static |
Task that is run when hello has been sent If tc->reason = GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if GNUNET_SCHEDULER_REASON_READ_READY is succeeded.
cls | the overlay connect context |
Definition at line 1766 of file gnunet-service-testbed_oc.c.
References RemoteOverlayConnectCtx::a_id, RemoteOverlayConnectCtx::attempt_connect_task_id, ConnectivitySuggestContext::cgh_p2_ats, Peer::details, GNUNET_assert, GNUNET_i2s(), GST_connection_pool_get_handle(), GST_CONNECTIONPOOL_SERVICE_ATS_CONNECTIVITY, Peer::id, Peer::local, LOG_DEBUG, occ_cache_get_handle_ats_rocc_cb(), RemoteOverlayConnectCtx::ohh, RemoteOverlayConnectCtx::op_id, RemoteOverlayConnectCtx::peer, and RemoteOverlayConnectCtx::tcc.
Referenced by attempt_connect_task().
|
static |
Callback from cache with needed handles set.
cls | the closure passed to GST_cache_get_handle_transport() |
ch | the handle to CORE. Can be NULL if it is not requested |
th | the handle to TRANSPORT. Can be NULL if it is not requested |
ac | the handle to ATS. Can be NULL if it is not requested |
ignore_ | peer identity which is ignored in this callback |
Definition at line 1828 of file gnunet-service-testbed_oc.c.
References RemoteOverlayConnectCtx::a_id, attempt_connect_task(), RemoteOverlayConnectCtx::attempt_connect_task_id, cfg, ConnectivitySuggestContext::cfg, cleanup_rocc(), GNUNET_i2s(), GNUNET_SCHEDULER_add_now(), GNUNET_TRANSPORT_core_get_mq(), Peer::id, LOG_DEBUG, RemoteOverlayConnectCtx::op_id, RemoteOverlayConnectCtx::peer, RemoteOverlayConnectCtx::tcc, ConnectivitySuggestContext::th_, timeout_rocc_task(), and RemoteOverlayConnectCtx::timeout_rocc_task_id.
Referenced by handle_remote_overlay_connect().
int check_remote_overlay_connect | ( | void * | cls, |
const struct GNUNET_TESTBED_RemoteOverlayConnectMessage * | msg | ||
) |
Check GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT messages.
cls | identification of the client |
msg | the actual message |
Definition at line 1870 of file gnunet-service-testbed_oc.c.
References GNUNET_break, GNUNET_break_op, GNUNET_MESSAGE_TYPE_HELLO, GNUNET_OK, GNUNET_SYSERR, GST_peer_list, GST_peer_list_size, msg, peer_id, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.
void handle_remote_overlay_connect | ( | void * | cls, |
const struct GNUNET_TESTBED_RemoteOverlayConnectMessage * | msg | ||
) |
Handler for GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT messages.
cls | identification of the client |
msg | the actual message |
Definition at line 1909 of file gnunet-service-testbed_oc.c.
References RemoteOverlayConnectCtx::a_id, cache_transport_peer_connect_notify(), ConnectivitySuggestContext::cgh_p2_th, GNUNET_TESTBED_Peer::controller, Peer::details, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_copy_message(), GNUNET_i2s(), GNUNET_malloc, GNUNET_memcpy, GNUNET_new, GNUNET_ntohll(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SERVICE_client_continue(), GNUNET_strlcpy(), GNUNET_TESTBED_queue_message_(), GNUNET_TESTING_peer_get_identity(), GNUNET_YES, GST_connection_pool_get_handle(), GST_CONNECTIONPOOL_SERVICE_TRANSPORT, GST_peer_list, GST_timeout, RemoteOverlayConnectCtx::hello, Peer::local, LOG_DEBUG, msg, RemoteOverlayConnectCtx::op_id, RemoteOverlayConnectCtx::peer, peer, peer_id, pid, Peer::reference_cnt, rocc_cache_get_handle_transport_cb(), roccq_head, roccq_tail, GNUNET_MessageHeader::size, RemoteOverlayConnectCtx::tcc, timeout_rocc_task(), and RemoteOverlayConnectCtx::timeout_rocc_task_id.
void GST_free_occq | ( | void | ) |
Clears all pending overlay connect contexts in queue.
Definition at line 1978 of file gnunet-service-testbed_oc.c.
References cleanup_occ(), and occq_head.
Referenced by handle_shutdown_peers(), and shutdown_task().
void GST_free_roccq | ( | void | ) |
Clears all pending remote overlay connect contexts in queue.
Definition at line 1991 of file gnunet-service-testbed_oc.c.
References cleanup_rocc(), and roccq_head.
Referenced by handle_shutdown_peers(), and shutdown_task().
|
static |
DLL head for OverlayConnectContext DLL - to be used to clean up during shutdown.
Definition at line 332 of file gnunet-service-testbed_oc.c.
Referenced by cleanup_occ(), GST_free_occq(), GST_notify_client_disconnect_oc(), and handle_overlay_connect().
|
static |
DLL tail for OverlayConnectContext DLL.
Definition at line 337 of file gnunet-service-testbed_oc.c.
Referenced by cleanup_occ(), and handle_overlay_connect().
|
static |
DLL head for RequectOverlayConnectContext DLL - to be used to clean up during shutdown.
Definition at line 343 of file gnunet-service-testbed_oc.c.
Referenced by cleanup_rocc(), GST_free_roccq(), and handle_remote_overlay_connect().
|
static |
DLL tail for RequectOverlayConnectContext DLL.
Definition at line 348 of file gnunet-service-testbed_oc.c.
Referenced by cleanup_rocc(), and handle_remote_overlay_connect().