ats service plugin management More...
#include "platform.h"
#include "gnunet_ats_plugin.h"
#include "gnunet-service-ats_connectivity.h"
#include "gnunet-service-ats_performance.h"
#include "gnunet-service-ats_preferences.h"
#include "gnunet-service-ats_plugins.h"
#include "gnunet-service-ats_reservations.h"
#include "gnunet-service-ats_scheduling.h"
#include "gnunet-service-ats_normalization.h"
Go to the source code of this file.
Functions | |
void | GAS_plugin_notify_preference_changed (const struct GNUNET_PeerIdentity *peer, enum GNUNET_ATS_PreferenceKind kind, double pref_rel) |
The preference changed for a peer, update solver. More... | |
void | GAS_plugin_notify_property_changed (struct ATS_Address *address) |
The relative value for a property changed. More... | |
static void | solver_info_cb (void *cls, enum GAS_Solver_Operation op, enum GAS_Solver_Status status, enum GAS_Solver_Additional_Information add) |
Solver information callback. More... | |
static void | bandwidth_changed_cb (void *cls, struct ATS_Address *address) |
Callback for solver to notify about assignment changes. More... | |
static unsigned long long | parse_quota (const char *quota_str, const char *direction, enum GNUNET_NetworkType network) |
Convert quota from text to numeric value. More... | |
static unsigned long long | load_quota (const struct GNUNET_CONFIGURATION_Handle *cfg, enum GNUNET_NetworkType type, const char *direction) |
Load quota value from the configuration cfg for the given network type and direction. More... | |
static unsigned int | load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned long long *out_dest, unsigned long long *in_dest, int dest_length) |
Load quotas for networks from configuration. More... | |
int | GAS_plugin_init (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Initialize address subsystem. More... | |
void | GAS_plugin_done () |
Shutdown address subsystem. More... | |
void | GAS_plugin_new_address (struct ATS_Address *new_address) |
Tell the solver that the given address can now be used for talking to the respective peer. More... | |
void | GAS_plugin_delete_address (struct ATS_Address *address) |
Tell the solver that the given address is no longer valid can cannot be used any longer. More... | |
void | GAS_plugin_notify_feedback (struct GNUNET_SERVICE_Client *application, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_TIME_Relative scope, enum GNUNET_ATS_PreferenceKind kind, float score_abs) |
Tell the solver that the given client has expressed its appreciation for the past performance of a given connection. More... | |
void | GAS_plugin_solver_lock () |
Stop instant solving, there are many state updates happening in bulk right now. More... | |
void | GAS_plugin_solver_unlock () |
Resume instant solving, we are done with the bulk state updates. More... | |
void | GAS_plugin_request_connect_start (const struct GNUNET_PeerIdentity *pid) |
Notify the plugin that a request to connect to a particular peer was given to us. More... | |
void | GAS_plugin_request_connect_stop (const struct GNUNET_PeerIdentity *pid) |
Notify the plugin that a request to connect to a particular peer was dropped. More... | |
Variables | |
static struct GNUNET_ATS_SolverFunctions * | sf |
Solver handle. More... | |
static struct GNUNET_ATS_PluginEnvironment | env |
Solver environment. More... | |
static char * | plugin |
Solver plugin name as string. More... | |
ats service plugin management
Definition in file gnunet-service-ats_plugins.c.
void GAS_plugin_notify_preference_changed | ( | const struct GNUNET_PeerIdentity * | peer, |
enum GNUNET_ATS_PreferenceKind | kind, | ||
double | pref_rel | ||
) |
The preference changed for a peer, update solver.
peer | the peer |
kind | the ATS kind |
pref_rel | the new relative preference value |
Definition at line 62 of file gnunet-service-ats_plugins.c.
References GNUNET_ATS_SolverFunctions::cls, peer, GNUNET_ATS_SolverFunctions::s_pref, and sf.
Referenced by update_relative_values_for_peer().
void GAS_plugin_notify_property_changed | ( | struct ATS_Address * | address | ) |
The relative value for a property changed.
address | The peer for which a property changed. |
Definition at line 74 of file gnunet-service-ats_plugins.c.
References address, GNUNET_ATS_SolverFunctions::cls, GNUNET_ATS_SolverFunctions::s_address_update_property, and sf.
Referenced by notify_change().
|
static |
Solver information callback.
cls | the closure |
op | the operation |
status | operation status |
add | additional information |
Definition at line 90 of file gnunet-service-ats_plugins.c.
References add, GAS_INFO_FULL, GAS_INFO_NONE, GAS_INFO_PROP_ALL, GAS_INFO_PROP_SINGLE, GAS_INFO_UPDATED, GAS_OP_SOLVE_MLP_LP_START, GAS_OP_SOLVE_MLP_LP_STOP, GAS_OP_SOLVE_MLP_MLP_START, GAS_OP_SOLVE_MLP_MLP_STOP, GAS_OP_SOLVE_SETUP_START, GAS_OP_SOLVE_SETUP_STOP, GAS_OP_SOLVE_START, GAS_OP_SOLVE_STOP, GAS_OP_SOLVE_UPDATE_NOTIFICATION_START, GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP, GAS_STAT_SUCCESS, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, op, and status.
Referenced by GAS_plugin_init().
|
static |
Callback for solver to notify about assignment changes.
cls | NULL |
address | the address with changes |
Definition at line 210 of file gnunet-service-ats_plugins.c.
References address, GAS_performance_notify_all_clients(), GAS_reservations_set_bandwidth(), GAS_scheduling_transmit_address_suggestion(), GNUNET_BANDWIDTH_value_init(), GNUNET_BANDWIDTH_ZERO, GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), and GNUNET_log.
Referenced by GAS_plugin_init().
|
static |
Convert quota from text to numeric value.
quota_str | the value found in the configuration |
direction | direction of the quota |
network | network the quota applies to |
Definition at line 293 of file gnunet-service-ats_plugins.c.
References _, direction, GNUNET_ATS_DefaultBandwidth, GNUNET_ATS_MaxBandwidth, GNUNET_ATS_MaxBandwidthString, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_NO, GNUNET_NT_to_string(), GNUNET_OK, GNUNET_STRINGS_fancy_size_to_bytes(), GNUNET_YES, res, and ret.
Referenced by load_quota().
|
static |
Load quota value from the configuration cfg for the given network type and direction.
cfg | configuration to parse |
type | network type to parse for |
direction | traffic direction to parse for |
Definition at line 350 of file gnunet-service-ats_plugins.c.
References _, cfg, direction, GNUNET_asprintf(), GNUNET_ATS_DefaultBandwidth, GNUNET_CONFIGURATION_get_value_string(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_NT_to_string(), GNUNET_OK, parse_quota(), ret, and type.
Referenced by load_quotas().
|
static |
Load quotas for networks from configuration.
cfg | configuration handle |
out_dest | where to write outbound quotas |
in_dest | where to write inbound quotas |
dest_length | length of inbound and outbound arrays |
Definition at line 398 of file gnunet-service-ats_plugins.c.
References cfg, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NT_COUNT, GNUNET_NT_to_string(), and load_quota().
Referenced by GAS_plugin_init().
int GAS_plugin_init | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Initialize address subsystem.
The addresses subsystem manages the addresses known and current performance information. It has a solver component responsible for the resource allocation. It tells the solver about changes and receives updates when the solver changes the resource allocation.
cfg | configuration to use |
Definition at line 424 of file gnunet-service-ats_plugins.c.
References _, GNUNET_ATS_PluginEnvironment::addresses, bandwidth_changed_cb(), GNUNET_ATS_PluginEnvironment::bandwidth_changed_cb, cfg, GNUNET_ATS_PluginEnvironment::cfg, GNUNET_ATS_PluginEnvironment::cls, env, GAS_connectivity_has_peer(), GAS_preference_get_by_peer(), GNUNET_ATS_PluginEnvironment::get_connectivity, GNUNET_ATS_PluginEnvironment::get_preferences, GNUNET_asprintf(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_NT_COUNT, GNUNET_OK, GNUNET_PLUGIN_load(), GNUNET_strdup, GNUNET_SYSERR, GSA_addresses, GSA_stats, GNUNET_ATS_PluginEnvironment::in_quota, GNUNET_ATS_PluginEnvironment::info_cb, load_quotas(), GNUNET_ATS_PluginEnvironment::network_count, GNUNET_ATS_PluginEnvironment::out_quota, plugin, sf, solver_info_cb(), and GNUNET_ATS_PluginEnvironment::stats.
Referenced by run().
void GAS_plugin_done | ( | void | ) |
Shutdown address subsystem.
Definition at line 474 of file gnunet-service-ats_plugins.c.
References GNUNET_free, GNUNET_PLUGIN_unload(), plugin, and sf.
Referenced by cleanup_task().
void GAS_plugin_new_address | ( | struct ATS_Address * | new_address | ) |
Tell the solver that the given address can now be used for talking to the respective peer.
new_address | the new address |
Definition at line 485 of file gnunet-service-ats_plugins.c.
References GNUNET_ATS_SolverFunctions::cls, ATS_Address::properties, GNUNET_ATS_SolverFunctions::s_add, GNUNET_ATS_Properties::scope, and sf.
Referenced by GAS_addresses_add().
void GAS_plugin_delete_address | ( | struct ATS_Address * | address | ) |
Tell the solver that the given address is no longer valid can cannot be used any longer.
address | address that was deleted |
Definition at line 500 of file gnunet-service-ats_plugins.c.
References address, GNUNET_ATS_SolverFunctions::cls, GNUNET_ATS_SolverFunctions::s_del, and sf.
Referenced by free_address().
void GAS_plugin_notify_feedback | ( | struct GNUNET_SERVICE_Client * | application, |
const struct GNUNET_PeerIdentity * | peer, | ||
const struct GNUNET_TIME_Relative | scope, | ||
enum GNUNET_ATS_PreferenceKind | kind, | ||
float | score_abs | ||
) |
Tell the solver that the given client has expressed its appreciation for the past performance of a given connection.
application | client providing the feedback |
peer | peer the feedback is about |
scope | timeframe the feedback applies to |
kind | performance property the feedback relates to |
score_abs | degree of the appreciation |
Definition at line 518 of file gnunet-service-ats_plugins.c.
References GNUNET_ATS_SolverFunctions::cls, peer, GNUNET_ATS_SolverFunctions::s_feedback, scope, and sf.
Referenced by handle_feedback().
void GAS_plugin_solver_lock | ( | void | ) |
Stop instant solving, there are many state updates happening in bulk right now.
Definition at line 538 of file gnunet-service-ats_plugins.c.
References GNUNET_ATS_SolverFunctions::cls, GNUNET_ATS_SolverFunctions::s_bulk_start, and sf.
Referenced by GAS_addresses_add(), GAS_addresses_destroy_all(), GAS_addresses_done(), GAS_connectivity_done(), GAS_handle_preference_change(), GAS_normalization_update_property(), and preference_aging().
void GAS_plugin_solver_unlock | ( | void | ) |
Resume instant solving, we are done with the bulk state updates.
Definition at line 548 of file gnunet-service-ats_plugins.c.
References GNUNET_ATS_SolverFunctions::cls, GNUNET_ATS_SolverFunctions::s_bulk_stop, and sf.
Referenced by GAS_addresses_add(), GAS_addresses_destroy_all(), GAS_addresses_done(), GAS_connectivity_done(), GAS_handle_preference_change(), GAS_normalization_update_property(), and preference_aging().
void GAS_plugin_request_connect_start | ( | const struct GNUNET_PeerIdentity * | pid | ) |
Notify the plugin that a request to connect to a particular peer was given to us.
pid | identity of peer we now care about |
Definition at line 561 of file gnunet-service-ats_plugins.c.
References GNUNET_ATS_SolverFunctions::cls, pid, GNUNET_ATS_SolverFunctions::s_get, and sf.
Referenced by GAS_handle_request_address().
void GAS_plugin_request_connect_stop | ( | const struct GNUNET_PeerIdentity * | pid | ) |
Notify the plugin that a request to connect to a particular peer was dropped.
pid | identity of peer we care now less about |
Definition at line 575 of file gnunet-service-ats_plugins.c.
References GNUNET_ATS_SolverFunctions::cls, pid, GNUNET_ATS_SolverFunctions::s_get_stop, and sf.
Referenced by free_matching_requests().
|
static |
Solver handle.
Definition at line 41 of file gnunet-service-ats_plugins.c.
Referenced by GAS_plugin_delete_address(), GAS_plugin_done(), GAS_plugin_init(), GAS_plugin_new_address(), GAS_plugin_notify_feedback(), GAS_plugin_notify_preference_changed(), GAS_plugin_notify_property_changed(), GAS_plugin_request_connect_start(), GAS_plugin_request_connect_stop(), GAS_plugin_solver_lock(), GAS_plugin_solver_unlock(), libgnunet_plugin_ats_proportional_done(), and libgnunet_plugin_ats_proportional_init().
|
static |
Solver environment.
Definition at line 41 of file gnunet-service-ats_plugins.c.
Referenced by GAS_plugin_init().
|
static |
Solver plugin name as string.
Definition at line 51 of file gnunet-service-ats_plugins.c.
Referenced by GAS_plugin_done(), and GAS_plugin_init().