plugin management More...
#include "platform.h"
#include "gnunet-service-transport.h"
#include "gnunet-service-transport_hello.h"
#include "gnunet-service-transport_ats.h"
#include "gnunet-service-transport_plugins.h"
Go to the source code of this file.
Data Structures | |
struct | TransportPlugin |
Entry in doubly-linked list of all of our plugins. More... | |
Functions | |
static void | plugin_env_update_distance (void *cls, const struct GNUNET_HELLO_Address *address, uint32_t distance) |
Function that will be called to update metrics for an address. More... | |
static enum GNUNET_NetworkType | plugin_env_address_to_type (void *cls, const struct sockaddr *addr, size_t addrlen) |
Function that will be called to figure if an address is an loopback, LAN, WAN etc. More... | |
void | GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb, GNUNET_TRANSPORT_AddressNotification address_cb, GNUNET_TRANSPORT_SessionStart session_start_cb, GNUNET_TRANSPORT_SessionEnd session_end_cb) |
Load and initialize all plugins. More... | |
void | GST_plugins_unload () |
Unload all plugins. More... | |
struct GNUNET_TRANSPORT_PluginFunctions * | GST_plugins_find (const char *name) |
Obtain the plugin API based on a plugin name. More... | |
struct GNUNET_TRANSPORT_PluginFunctions * | GST_plugins_printer_find (const char *name) |
Obtain the plugin API based on a the stripped plugin name after the underscore. More... | |
const char * | GST_plugins_a2s (const struct GNUNET_HELLO_Address *address) |
Convert a given address to a human-readable format. More... | |
void | GST_plugins_monitor_subscribe (GNUNET_TRANSPORT_SessionInfoCallback cb, void *cb_cls) |
Register callback with all plugins to monitor their status. More... | |
Variables | |
static struct TransportPlugin * | plugins_head |
Head of DLL of all loaded plugins. More... | |
static struct TransportPlugin * | plugins_tail |
Head of DLL of all loaded plugins. More... | |
plugin management
Definition in file gnunet-service-transport_plugins.c.
|
static |
Function that will be called to update metrics for an address.
cls | closure |
address | address to update metrics for |
distance | new distance |
Definition at line 89 of file gnunet-service-transport_plugins.c.
Referenced by GST_plugins_load().
|
static |
Function that will be called to figure if an address is an loopback, LAN, WAN etc.
address
cls | closure |
addr | binary address |
addrlen | length of the addr |
Definition at line 89 of file gnunet-service-transport_plugins.c.
References address, and GST_ats_update_distance().
Referenced by GST_plugins_load().
void GST_plugins_load | ( | GNUNET_TRANSPORT_PluginReceiveCallback | recv_cb, |
GNUNET_TRANSPORT_AddressNotification | address_cb, | ||
GNUNET_TRANSPORT_SessionStart | session_start_cb, | ||
GNUNET_TRANSPORT_SessionEnd | session_end_cb | ||
) |
Load and initialize all plugins.
The respective functions will be invoked by the plugins when the respective events happen. The closure will be set to a 'const char*' containing the name of the plugin that caused the call.
recv_cb | function to call when data is received |
address_cb | function to call when our public addresses changed |
session_start_cb | function to call when a session was created |
session_end_cb | function to call when a session was terminated |
Definition at line 124 of file gnunet-service-transport_plugins.c.
References _, address_cb(), GNUNET_TRANSPORT_PluginFunctions::address_pretty_printer, GNUNET_TRANSPORT_PluginFunctions::address_to_string, TransportPlugin::api, GNUNET_TRANSPORT_PluginEnvironment::cfg, GNUNET_TRANSPORT_PluginFunctions::check_address, GNUNET_TRANSPORT_PluginEnvironment::cls, GNUNET_TRANSPORT_PluginFunctions::disconnect_peer, GNUNET_TRANSPORT_PluginFunctions::disconnect_session, TransportPlugin::env, GNUNET_TRANSPORT_PluginEnvironment::get_address_type, GNUNET_TRANSPORT_PluginFunctions::get_network, GNUNET_TRANSPORT_PluginEnvironment::get_our_hello, GNUNET_TRANSPORT_PluginFunctions::get_session, GNUNET_asprintf(), GNUNET_break, GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_PLUGIN_load(), GNUNET_PLUGIN_unload(), GNUNET_strdup, GNUNET_YES, GST_cfg, GST_hello_get(), GST_my_identity, GST_stats, TransportPlugin::lib_name, GNUNET_TRANSPORT_PluginEnvironment::max_connections, GNUNET_TRANSPORT_PluginEnvironment::my_identity, TransportPlugin::next, GNUNET_TRANSPORT_PluginEnvironment::notify_address, plugin_env_address_to_type(), plugin_env_update_distance(), plugins_head, plugins_tail, GNUNET_TRANSPORT_PluginFunctions::query_keepalive_factor, GNUNET_TRANSPORT_PluginEnvironment::receive, GNUNET_TRANSPORT_PluginFunctions::send, GNUNET_TRANSPORT_PluginEnvironment::session_end, GNUNET_TRANSPORT_PluginEnvironment::session_start, TransportPlugin::short_name, GNUNET_TRANSPORT_PluginEnvironment::stats, GNUNET_TRANSPORT_PluginFunctions::string_to_address, GNUNET_TRANSPORT_PluginEnvironment::update_address_distance, and GNUNET_TRANSPORT_PluginFunctions::update_session_timeout.
Referenced by run().
void GST_plugins_unload | ( | void | ) |
Unload all plugins.
Definition at line 314 of file gnunet-service-transport_plugins.c.
References TransportPlugin::api, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_PLUGIN_unload(), TransportPlugin::lib_name, plugins_head, plugins_tail, and TransportPlugin::short_name.
Referenced by shutdown_task().
struct GNUNET_TRANSPORT_PluginFunctions* GST_plugins_find | ( | const char * | name | ) |
Obtain the plugin API based on a plugin name.
name | name of the plugin |
Definition at line 336 of file gnunet-service-transport_plugins.c.
References TransportPlugin::api, name, TransportPlugin::next, plugins_head, and TransportPlugin::short_name.
Referenced by add_valid_address(), GST_neighbours_calculate_receive_delay(), GST_neighbours_switch_to_address(), GST_validation_handle_address(), GST_validation_handle_ping(), GST_validation_handle_pong(), inbound_bw_tracker_update(), kill_session(), multicast_pong(), send_syn(), send_syn_ack_message(), send_with_session(), switch_address_bl_check_cont(), and transmit_ping_if_allowed().
struct GNUNET_TRANSPORT_PluginFunctions* GST_plugins_printer_find | ( | const char * | name | ) |
Obtain the plugin API based on a the stripped plugin name after the underscore.
Example: GST_plugins_printer_find (http_client) will return all plugins starting with the prefix "http": http_client or server if loaded
name | name of the plugin |
Definition at line 360 of file gnunet-service-transport_plugins.c.
References TransportPlugin::api, GNUNET_free, GNUNET_strdup, name, TransportPlugin::next, plugins_head, and TransportPlugin::short_name.
Referenced by GST_plugins_a2s(), and handle_client_address_to_string().
const char* GST_plugins_a2s | ( | const struct GNUNET_HELLO_Address * | address | ) |
Convert a given address to a human-readable format.
Note that the return value will be overwritten on the next call to this function.
address | the address to convert |
Definition at line 386 of file gnunet-service-transport_plugins.c.
References address, GNUNET_TRANSPORT_PluginFunctions::address_to_string, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_snprintf(), GST_plugins_printer_find(), and TRANSPORT_SESSION_INBOUND_STRING.
Referenced by add_valid_address(), connect_bl_check_cont(), GST_ats_add_address(), GST_ats_add_inbound_address(), GST_ats_block_address(), GST_ats_expire_address(), GST_ats_update_utilization(), GST_hello_modify_addresses(), GST_neighbours_session_terminated(), GST_neighbours_switch_to_address(), GST_validation_handle_address(), GST_validation_handle_ping(), GST_validation_handle_pong(), neighbours_changed_notification(), plugin_env_session_end(), plugin_env_session_start(), plugin_env_session_start_bl_check_cont(), revalidate_address(), send_peer_information(), send_session_syn_ack_cont(), send_syn(), send_syn_ack_message(), send_with_session(), set_primary_address(), switch_address_bl_check_cont(), transmit_ping_if_allowed(), and unblock_address().
void GST_plugins_monitor_subscribe | ( | GNUNET_TRANSPORT_SessionInfoCallback | cb, |
void * | cb_cls | ||
) |
Register callback with all plugins to monitor their status.
cb | callback to register, NULL to unsubscribe |
cb_cls | closure for cb |
Definition at line 422 of file gnunet-service-transport_plugins.c.
References TransportPlugin::api, GNUNET_TRANSPORT_PluginFunctions::cls, GNUNET_break, TransportPlugin::next, plugins_head, and GNUNET_TRANSPORT_PluginFunctions::setup_monitor.
Referenced by handle_client_monitor_plugins(), and plugin_session_info_cb().
|
static |
Head of DLL of all loaded plugins.
Definition at line 73 of file gnunet-service-transport_plugins.c.
Referenced by GST_plugins_find(), GST_plugins_load(), GST_plugins_monitor_subscribe(), GST_plugins_printer_find(), and GST_plugins_unload().
|
static |
Head of DLL of all loaded plugins.
Definition at line 78 of file gnunet-service-transport_plugins.c.
Referenced by GST_plugins_load(), and GST_plugins_unload().