Print information about cadet tunnels and peers. More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_cadet_service.h"
#include "../../service/cadet/cadet.h"
Go to the source code of this file.
Macros | |
#define | STREAM_BUFFER_SIZE 1024 |
Functions | |
static void | listen_stdio (void) |
Wait for input on STDIO and send it out over the ch. More... | |
static const char * | enc_2s (uint16_t status) |
Convert encryption status to human readable string. More... | |
static const char * | conn_2s (uint16_t status) |
Convert connection status to human readable string. More... | |
static void | shutdown_task (void *cls) |
Task to shut down this application. More... | |
static void | mq_cb (void *cls) |
static void | read_stdio (void *cls) |
Task run in stdio mode, after some data is available at stdin. More... | |
static void | channel_ended (void *cls, const struct GNUNET_CADET_Channel *channel) |
Function called whenever a channel is destroyed. More... | |
static void * | channel_incoming (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *initiator) |
Method called whenever another peer has added us to a channel the other peer initiated. More... | |
static void | send_echo (void *cls) |
Send an echo request to the remote peer. More... | |
static int | check_data (void *cls, const struct GNUNET_MessageHeader *message) |
Check data message sanity. More... | |
static void | handle_data (void *cls, const struct GNUNET_MessageHeader *message) |
Function called whenever a message is received. More... | |
static void | peers_callback (void *cls, const struct GNUNET_CADET_PeerListEntry *ple) |
Method called to retrieve information about all peers in CADET, called once per peer. More... | |
static void | path_callback (void *cls, const struct GNUNET_CADET_PeerPathDetail *ppd) |
Method called to retrieve information about paths to a specific peer known to the service. More... | |
static void | tunnels_callback (void *cls, const struct GNUNET_CADET_TunnelDetails *td) |
Method called to retrieve information about all tunnels in CADET. More... | |
static void | get_peers (void *cls) |
Call CADET's meta API, get all peers known to a peer. More... | |
static void | show_peer (void *cls) |
Call CADET's monitor API, get info of one peer. More... | |
static void | get_tunnels (void *cls) |
Call CADET's meta API, get all tunnels known to a peer. More... | |
static void | show_channel (void *cls) |
Call CADET's monitor API, get info of one channel. More... | |
static void | show_connection (void *cls) |
Call CADET's monitor API, get info of one connection. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Main function that will be run by the scheduler. More... | |
int | main (int argc, char *const *argv) |
The main function to obtain peer information. More... | |
Variables | |
static int | request_peers |
Option -P. More... | |
static char * | peer_id |
Option –peer. More... | |
static int | request_tunnels |
Option -T. More... | |
static char * | conn_id |
Option –connection. More... | |
static char * | channel_id |
Option –channel. More... | |
static char * | listen_port |
Port to listen on (-o). More... | |
static int | echo |
Request echo service. More... | |
static struct GNUNET_TIME_Absolute | echo_time |
Time of last echo request. More... | |
static struct GNUNET_SCHEDULER_Task * | echo_task |
Task for next echo request. More... | |
static char * | target_id |
Peer to connect to. More... | |
static const char * | target_port = "default" |
Port to connect to. More... | |
static struct GNUNET_CADET_Handle * | mh |
Cadet handle. More... | |
static const struct GNUNET_CONFIGURATION_Handle * | my_cfg |
Our configuration. More... | |
static struct GNUNET_CADET_GetPath * | gpo |
Active get path operation. More... | |
static struct GNUNET_CADET_PeersLister * | plo |
Active peer listing operation. More... | |
static struct GNUNET_CADET_ListTunnels * | tio |
Active tunnel listing operation. More... | |
static struct GNUNET_CADET_Channel * | ch |
Channel handle. More... | |
static struct GNUNET_HashCode | porthash |
HashCode of the given port string. More... | |
struct GNUNET_CADET_Port * | lp |
Data structure for ongoing reception of incoming virtual circuits. More... | |
static struct GNUNET_SCHEDULER_Task * | rd_task |
Task for reading from stdin. More... | |
static struct GNUNET_SCHEDULER_Task * | job |
Task for main job. More... | |
static unsigned int | sent_pkt |
Print information about cadet tunnels and peers.
Definition in file gnunet-cadet.c.
#define STREAM_BUFFER_SIZE 1024 |
Definition at line 32 of file gnunet-cadet.c.
|
static |
Wait for input on STDIO and send it out over the ch.
Definition at line 332 of file gnunet-cadet.c.
References GNUNET_NETWORK_fdset_create(), GNUNET_NETWORK_fdset_destroy(), GNUNET_NETWORK_fdset_set_native(), GNUNET_SCHEDULER_add_select(), GNUNET_SCHEDULER_PRIORITY_DEFAULT, GNUNET_TIME_UNIT_FOREVER_REL, rd_task, and read_stdio().
Referenced by channel_incoming(), mq_cb(), read_stdio(), and run().
|
static |
Convert encryption status to human readable string.
status | Encryption status. |
Definition at line 157 of file gnunet-cadet.c.
References status.
Referenced by tunnels_callback().
|
static |
Convert connection status to human readable string.
status | Connection status. |
Definition at line 187 of file gnunet-cadet.c.
References status.
Referenced by tunnels_callback().
|
static |
Task to shut down this application.
cls | Closure (unused). |
Definition at line 218 of file gnunet-cadet.c.
References ch, echo_task, GNUNET_CADET_channel_destroy(), GNUNET_CADET_close_port(), GNUNET_CADET_disconnect(), GNUNET_CADET_get_path_cancel(), GNUNET_CADET_list_peers_cancel(), GNUNET_CADET_list_tunnels_cancel(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_SCHEDULER_cancel(), gpo, job, lp, mh, plo, rd_task, and tio.
Referenced by run().
|
static |
Definition at line 270 of file gnunet-cadet.c.
References listen_stdio().
Referenced by read_stdio().
|
static |
Task run in stdio mode, after some data is available at stdin.
cls | Closure (unused). |
Definition at line 282 of file gnunet-cadet.c.
References ch, data_size, echo, echo_time, env, GNUNET_CADET_get_mq(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_CADET_CLI, GNUNET_MQ_msg_extra, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), GNUNET_NO, GNUNET_SCHEDULER_shutdown(), GNUNET_TIME_absolute_get(), listen_stdio(), mq_cb(), msg, rd_task, sent_pkt, and STREAM_BUFFER_SIZE.
Referenced by listen_stdio().
|
static |
Function called whenever a channel is destroyed.
Should clean up any associated state.
It must NOT call GNUNET_CADET_channel_destroy on the channel.
cls | closure |
channel | connection to the other end (henceforth invalid) |
Definition at line 359 of file gnunet-cadet.c.
References ch, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, and GNUNET_SCHEDULER_shutdown().
Referenced by run().
|
static |
Method called whenever another peer has added us to a channel the other peer initiated.
Only called (once) upon reception of data with a message type which was subscribed to in GNUNET_CADET_connect.
A call to GNUNET_CADET_channel_destroy causes the channel to be ignored. In this case the handler MUST return NULL.
cls | closure |
channel | new handle to the channel |
initiator | peer that started the channel |
Definition at line 383 of file gnunet-cadet.c.
References ch, echo, GNUNET_assert, GNUNET_CADET_close_port(), GNUNET_ERROR_TYPE_MESSAGE, GNUNET_i2s_full(), GNUNET_log, GNUNET_NO, listen_stdio(), and lp.
Referenced by run().
|
static |
Send an echo request to the remote peer.
cls | Closure (NULL). |
Definition at line 407 of file gnunet-cadet.c.
References ch, echo_task, env, GNUNET_CADET_get_mq(), GNUNET_MESSAGE_TYPE_CADET_CLI, GNUNET_MQ_msg, GNUNET_MQ_send(), and msg.
Referenced by handle_data(), and run().
|
static |
Check data message sanity.
Does nothing so far (all messages are OK).
cls | Closure (unused). |
message | The message to check. |
Definition at line 429 of file gnunet-cadet.c.
References GNUNET_OK.
|
static |
Function called whenever a message is received.
Each time the function must call GNUNET_CADET_receive_done on the channel in order to receive the next message. This doesn't need to be immediate: can be delayed if some processing is done on the message.
cls | NULL |
message | The actual message. |
Definition at line 446 of file gnunet-cadet.c.
References ch, echo, echo_task, echo_time, env, GNUNET_CADET_get_mq(), GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_MESSAGE, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_log_strerror, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_CADET_CLI, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_shutdown(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_SECONDS, GNUNET_YES, listen_port, msg, send_echo(), and GNUNET_MessageHeader::size.
|
static |
Method called to retrieve information about all peers in CADET, called once per peer.
After last peer has been reported, an additional call with NULL is done.
cls | Closure. |
ple | information about peer, or NULL on "EOF". |
Definition at line 512 of file gnunet-cadet.c.
References GNUNET_i2s_full(), GNUNET_SCHEDULER_shutdown(), GNUNET_CADET_PeerListEntry::have_tunnel, GNUNET_CADET_PeerListEntry::n_paths, GNUNET_CADET_PeerListEntry::peer, and plo.
Referenced by get_peers().
|
static |
Method called to retrieve information about paths to a specific peer known to the service.
cls | Closure. |
ppd | path detail |
Definition at line 536 of file gnunet-cadet.c.
References GNUNET_i2s(), GNUNET_SCHEDULER_shutdown(), gpo, GNUNET_CADET_PeerPathDetail::path, GNUNET_CADET_PeerPathDetail::path_length, and GNUNET_CADET_PeerPathDetail::target_offset.
Referenced by show_peer().
|
static |
Method called to retrieve information about all tunnels in CADET.
cls | Closure. |
td | tunnel details |
Definition at line 560 of file gnunet-cadet.c.
References GNUNET_CADET_TunnelDetails::channels, conn_2s(), GNUNET_CADET_TunnelDetails::connections, GNUNET_CADET_TunnelDetails::cstate, enc_2s(), GNUNET_CADET_TunnelDetails::estate, GNUNET_i2s_full(), GNUNET_SCHEDULER_shutdown(), GNUNET_CADET_TunnelDetails::peer, and tio.
Referenced by get_tunnels().
|
static |
Call CADET's meta API, get all peers known to a peer.
cls | Closure (unused). |
Definition at line 584 of file gnunet-cadet.c.
References GNUNET_CADET_list_peers(), job, my_cfg, peers_callback(), and plo.
Referenced by reconnect(), and run().
|
static |
Call CADET's monitor API, get info of one peer.
cls | Closure (unused). |
Definition at line 597 of file gnunet-cadet.c.
References _, GNUNET_CADET_get_path(), GNUNET_CRYPTO_eddsa_public_key_from_string(), GNUNET_OK, GNUNET_SCHEDULER_shutdown(), gpo, job, my_cfg, path_callback(), peer_id, pid, and GNUNET_PeerIdentity::public_key.
Referenced by run().
|
static |
Call CADET's meta API, get all tunnels known to a peer.
cls | Closure (unused). |
Definition at line 620 of file gnunet-cadet.c.
References GNUNET_CADET_list_tunnels(), job, my_cfg, tio, and tunnels_callback().
Referenced by reconnect(), and run().
|
static |
Call CADET's monitor API, get info of one channel.
cls | Closure (unused). |
Definition at line 633 of file gnunet-cadet.c.
References GNUNET_break, and job.
Referenced by run().
|
static |
Call CADET's monitor API, get info of one connection.
cls | Closure (unused). |
Definition at line 646 of file gnunet-cadet.c.
References GNUNET_break, and job.
Referenced by run().
|
static |
Main function that will be run by the scheduler.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 662 of file gnunet-cadet.c.
References _, consensus-simulation::args, cfg, ch, channel_ended(), channel_id, channel_incoming(), conn_id, data, echo, echo_task, get_peers(), get_tunnels(), GNUNET_CADET_channel_create(), GNUNET_CADET_connect(), GNUNET_CADET_open_port(), GNUNET_CRYPTO_eddsa_public_key_from_string(), GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_MESSAGE, GNUNET_log, GNUNET_MESSAGE_TYPE_CADET_CLI, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_YES, handlers, job, listen_port, listen_stdio(), lp, mh, my_cfg, peer_id, pid, porthash, GNUNET_PeerIdentity::public_key, request_peers, request_tunnels, send_echo(), show_channel(), show_connection(), show_peer(), shutdown_task(), target_id, and target_port.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function to obtain peer information.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 790 of file gnunet-cadet.c.
References conn_id, echo, gettext_noop, GNUNET_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_string(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), listen_port, options, peer_id, request_peers, request_tunnels, res, and run().
|
static |
|
static |
Option –peer.
Definition at line 42 of file gnunet-cadet.c.
Referenced by add_search_string(), GCD_search(), GCP_get(), get_store_peer_of(), GNUNET_TRANSPORT_TESTING_start_peer(), GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue(), GNUNET_TRANSPORT_TESTING_transport_communicator_service_start(), load_peer_store(), main(), mq_init(), run(), show_peer(), update_store_peer(), and uri_loc_to_string().
|
static |
|
static |
|
static |
|
static |
Port to listen on (-o).
Definition at line 62 of file gnunet-cadet.c.
Referenced by handle_data(), main(), and run().
|
static |
Request echo service.
Definition at line 67 of file gnunet-cadet.c.
Referenced by channel_incoming(), handle_data(), main(), read_stdio(), render_row(), and run().
|
static |
Time of last echo request.
Definition at line 72 of file gnunet-cadet.c.
Referenced by handle_data(), and read_stdio().
|
static |
Task for next echo request.
Definition at line 77 of file gnunet-cadet.c.
Referenced by handle_data(), run(), send_echo(), and shutdown_task().
|
static |
|
static |
|
static |
Cadet handle.
Definition at line 92 of file gnunet-cadet.c.
Referenced by cadet_timeout(), check_union_p2p_demand(), check_union_p2p_offer(), database_setup(), disconnect_cb(), finish_handling_raw_message(), GDS_u_receive(), get_cadet(), GNUNET_CORE_monitor_start(), GNUNET_CORE_monitor_stop(), GNUNET_DHT_monitor_start(), GNUNET_DHT_monitor_stop(), GNUNET_MQ_extract_nested_mh_(), GNUNET_MQ_handle_message(), GNUNET_MQ_inject_message(), GNUNET_TRANSPORT_TESTING_transport_communicator_send(), GSF_cadet_query(), GSF_cadet_query_cancel(), GSF_cadet_release_clients(), handle_dv_box(), handle_monitor_get(), handle_monitor_get_resp(), handle_monitor_put(), handle_mq_error(), handle_raw_message(), handle_receive_info(), handle_reply(), handle_send_msg(), handle_union_p2p_demand(), handle_union_p2p_offer(), load_etc_hosts(), lookup_dns_servers(), move_to_pending(), mqm_execute(), read_cb(), reconnect(), reset_cadet(), reset_cadet_async(), reset_cadet_task(), run(), send_monitor_start(), send_msg_from_cache(), send_offers_iterator(), shutdown_task(), transmit_pending(), transport_communicator_start(), try_reconnect(), and window_change_cb().
|
static |
Our configuration.
Definition at line 97 of file gnunet-cadet.c.
Referenced by get_peers(), get_tunnels(), run(), and show_peer().
|
static |
Active get path operation.
Definition at line 102 of file gnunet-cadet.c.
Referenced by path_callback(), show_peer(), and shutdown_task().
|
static |
Active peer listing operation.
Definition at line 107 of file gnunet-cadet.c.
Referenced by get_peers(), peers_callback(), and shutdown_task().
|
static |
Active tunnel listing operation.
Definition at line 112 of file gnunet-cadet.c.
Referenced by get_tunnels(), handle_issue_ticket_message(), issue_ticket_result_cb(), shutdown_task(), and tunnels_callback().
|
static |
Channel handle.
Definition at line 117 of file gnunet-cadet.c.
Referenced by bind_loose_channel(), cadet_mq_cancel_impl(), cadet_mq_destroy_impl(), cadet_mq_error_handler(), cadet_mq_send_impl(), cadet_mq_send_now(), channel_audio_sent_notify(), channel_destroy(), channel_destroy_iterator(), channel_ended(), channel_incoming(), channel_open_sent_cb(), check_notify_client(), clean_up_channel(), client_connect_cb(), client_disconnect_cb(), conclude_autoconfig_request(), create_channel(), data_sent_cb(), debug_channel(), destroy_channel(), destroy_channel_cb(), destroy_line_cadet_channels(), destroy_remaining_channels(), disconnect(), dyndns_lookup(), error_handler(), find_channel_by_line(), force_reconnect(), forward_reply(), GCCH_2s(), GCCH_assign_type_to_drop(), GCCH_bind(), GCCH_channel_incoming_new(), GCCH_channel_local_destroy(), GCCH_channel_local_new(), GCCH_debug(), GCCH_get_id(), GCCH_handle_channel_open_ack(), GCCH_handle_channel_plaintext_data(), GCCH_handle_channel_plaintext_data_ack(), GCCH_handle_duplicate_open(), GCCH_handle_local_ack(), GCCH_handle_local_data(), GCCH_handle_remote_destroy(), GCCH_is_type_to_drop(), GCCH_tunnel_up(), GCT_add_channel(), GCT_remove_channel(), GCT_send(), GNUNET_CADET_channel_create(), GNUNET_HOSTLIST_client_start(), GNUNET_TRANSPORT_application_done(), GNUNET_TRANSPORT_application_init(), GNUNET_TRANSPORT_application_suggest(), GNUNET_TRANSPORT_application_suggest_cancel(), GNUNET_TRANSPORT_application_validate(), GNUNET_TRANSPORT_communicator_address_add(), GNUNET_TRANSPORT_communicator_address_remove(), GNUNET_TRANSPORT_communicator_address_remove_all(), GNUNET_TRANSPORT_communicator_burst_finished(), GNUNET_TRANSPORT_communicator_connect(), GNUNET_TRANSPORT_communicator_disconnect(), GNUNET_TRANSPORT_communicator_mq_add(), GNUNET_TRANSPORT_communicator_mq_del(), GNUNET_TRANSPORT_communicator_mq_update(), GNUNET_TRANSPORT_communicator_notify(), GNUNET_TRANSPORT_communicator_receive(), GSC_bind(), GSC_drop_loose_channel(), GSC_handle_remote_channel_destroy(), handle_add_global_address(), handle_autoconfig_request(), handle_backchannel_incoming(), handle_cadet_audio_message(), handle_cadet_hangup_message(), handle_cadet_pickup_message(), handle_cadet_resume_message(), handle_cadet_ring_message(), handle_cadet_suspend_message(), handle_channel_create(), handle_channel_created(), handle_channel_destroy(), handle_client_audio_message(), handle_client_call_message(), handle_client_hangup_message(), handle_client_pickup_message(), handle_client_resume_message(), handle_client_suspend_message(), handle_create_queue(), handle_data(), handle_dht_local_get(), handle_dht_local_get_result_seen(), handle_dht_local_get_stop(), handle_dht_local_hello_get(), handle_dht_local_hello_offer(), handle_dht_local_monitor(), handle_dht_local_monitor_stop(), handle_dht_local_put(), handle_drop_message(), handle_incoming_ack(), handle_local_ack(), handle_local_data(), handle_matching_ack(), handle_plaintext_channel_destroy(), handle_plaintext_channel_open(), handle_plaintext_channel_open_ack(), handle_plaintext_data(), handle_plaintext_data_ack(), handle_register(), handle_request_connection_reversal(), handle_send_msg(), handle_start_burst(), handle_stun(), inbound_channel(), inbound_end(), iterate_channels_cb(), lookup_hole_external(), mq_done_finish_caller_shutdown(), notify_client(), notify_client_external_ipv4_change(), notify_clients(), notify_clients_stun_change(), notify_tunnel_up_cb(), notify_window_size(), process_external_ip(), read_stdio(), reconnect(), reconnect_task(), remove_client_query_record(), retry_transmission(), reversal_callback(), run(), send_ack(), send_ack_cb(), send_ack_to_client(), send_channel_data_ack(), send_channel_open(), send_echo(), send_open_ack(), shutdown_task(), signal_remote_destroy_cb(), timeout_closed_cb(), transmit_suggestion(), and upnp_addr_change_cb().
|
static |
HashCode of the given port string.
Definition at line 122 of file gnunet-cadet.c.
Referenced by run().
struct GNUNET_CADET_Port* lp |
Data structure for ongoing reception of incoming virtual circuits.
Definition at line 127 of file gnunet-cadet.c.
Referenced by channel_incoming(), run(), and shutdown_task().
|
static |
Task for reading from stdin.
Definition at line 132 of file gnunet-cadet.c.
Referenced by listen_stdio(), read_stdio(), and shutdown_task().
|
static |
Task for main job.
Definition at line 137 of file gnunet-cadet.c.
Referenced by dht_put_continuation(), dispatch_job(), dispatch_job_monitor(), free_job(), get_peers(), get_tunnels(), GNUNET_CURL_extend_headers(), GNUNET_CURL_job_add2(), GNUNET_CURL_job_add_raw(), GNUNET_CURL_job_add_with_ct_json(), GNUNET_CURL_job_cancel(), GNUNET_CURL_perform2(), initiate_put_from_pipe_trigger(), run(), setup_job(), show_channel(), show_connection(), show_peer(), shutdown_task(), and sign_worker().
|
static |
Definition at line 139 of file gnunet-cadet.c.
Referenced by read_stdio().