![]() |
GNUnet
0.11.x
|
Print information about cadet tunnels and peers. More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_cadet_service.h"
#include "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... | |
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 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.
Referenced by read_stdio().
|
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, 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.
Referenced by tunnels_callback().
|
static |
Convert connection status to human readable string.
status | Connection status. |
Definition at line 187 of file gnunet-cadet.c.
Referenced by tunnels_callback().
|
static |
Task to shut down this application.
cls | Closure (unused). |
Definition at line 218 of file gnunet-cadet.c.
References 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, and GNUNET_SCHEDULER_cancel().
Referenced by run().
void mq_cb | ( | void * | cls | ) |
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 buf, 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, 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 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 echo, GNUNET_assert, GNUNET_CADET_close_port(), GNUNET_ERROR_TYPE_MESSAGE, GNUNET_i2s_full(), GNUNET_log, GNUNET_NO, and listen_stdio().
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 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 buf, done(), echo, 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, len, 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, and GNUNET_CADET_PeerListEntry::peer.
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(), 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(), and GNUNET_CADET_TunnelDetails::peer.
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(), and peers_callback().
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(), path_callback(), peer_id, 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(), 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.
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.
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 _, cfg, channel_ended(), channel_id, channel_incoming(), conn_id, data, echo, 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, listen_port, listen_stdio(), peer_id, 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, peer_id, request_peers, request_tunnels, res, and run().
|
static |
|
static |
Option –peer.
Definition at line 42 of file gnunet-cadet.c.
Referenced by ats_performance_info_cb(), check_remote_overlay_connect(), compute_diversity(), count_peer_in_views(), count_peer_in_views_2(), database_setup(), evaluate(), GCP_get(), gen_topo_from_file(), get_idx_of_pid(), GNUNET_TRANSPORT_TESTING_start_peer(), GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue(), GNUNET_TRANSPORT_TESTING_transport_communicator_service_start(), handle_manage_peer_service(), handle_peer_create(), handle_peer_destroy(), handle_peer_get_config(), handle_peer_reconfigure(), handle_peer_start(), handle_peer_stop(), handle_remote_overlay_connect(), is_in_view(), main(), manage_service_wrapper(), peerstore_flat_store_record(), print_view_sizes(), run(), show_peer(), uri_loc_to_string(), and write_final_stats().
|
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(), GNUNET_TESTBED_barrier_init_(), 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.
|
static |
|
static |
|
static |
Cadet handle.
Definition at line 92 of file gnunet-cadet.c.
Referenced by database_setup(), GNUNET_CORE_monitor_start(), GNUNET_DHT_monitor_start(), GNUNET_SERVER_inject(), GNUNET_TRANSPORT_TESTING_transport_communicator_send(), handle_dv_box(), handle_monitor_get(), handle_monitor_get_resp(), handle_monitor_put(), handle_mq_error(), handle_receive_info(), handle_send_msg(), load_etc_hosts(), lookup_dns_servers(), mqm_execute(), send_offers_iterator(), and try_reconnect().
|
static |
Our configuration.
Definition at line 97 of file gnunet-cadet.c.
|
static |
Active get path operation.
Definition at line 102 of file gnunet-cadet.c.
|
static |
Active peer listing operation.
Definition at line 107 of file gnunet-cadet.c.
|
static |
Active tunnel listing operation.
Definition at line 112 of file gnunet-cadet.c.
Referenced by handle_issue_ticket_message(), and issue_ticket_result_cb().
|
static |
Channel handle.
Definition at line 117 of file gnunet-cadet.c.
Referenced by adjust_running_peers(), cadet_mq_cancel_impl(), cadet_mq_destroy_impl(), cadet_mq_error_handler(), cadet_mq_send_impl(), cadet_mq_send_now(), channel_audio_sent_notify(), client_connect_cb(), client_disconnect_cb(), client_schedule(), conclude_autoconfig_request(), create_channel(), debug_channel(), destroy_channel_cb(), destroy_remaining_channels(), disconnect_cadet_peers(), dyndns_lookup(), error_handler(), find_channel_by_line(), GCT_add_channel(), GCT_send(), GNUNET_CADET_channel_create(), GNUNET_TRANSPORT_communicator_address_add(), GNUNET_TRANSPORT_communicator_address_remove(), GNUNET_TRANSPORT_communicator_connect(), GNUNET_TRANSPORT_communicator_mq_add(), GNUNET_TRANSPORT_communicator_mq_del(), GNUNET_TRANSPORT_core_disconnect(), GNUNET_TRANSPORT_core_get_mq(), 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_drop_message(), handle_incoming_ack(), handle_local_ack(), handle_local_data(), 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_stun(), inbound_channel(), inbound_end(), iterate_channels_cb(), mq_done_finish_caller_shutdown(), notify_client_external_ipv4_change(), notify_clients(), notify_clients_stun_change(), notify_tunnel_up_cb(), process_external_ip(), reversal_callback(), send_ack_cb(), start_test(), 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.
|
static |
Task for reading from stdin.
Definition at line 132 of file gnunet-cadet.c.
|
static |
Task for main job.
Definition at line 137 of file gnunet-cadet.c.
Referenced by GNUNET_CURL_job_add2(), GNUNET_CURL_job_add_raw(), GNUNET_CURL_job_add_with_ct_json(), GNUNET_CURL_perform2(), and setup_job().
|
static |
Definition at line 139 of file gnunet-cadet.c.
Referenced by read_stdio().