ats service More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet-service-ats.h"
#include "gnunet-service-ats_addresses.h"
#include "gnunet-service-ats_connectivity.h"
#include "gnunet-service-ats_normalization.h"
#include "gnunet-service-ats_performance.h"
#include "gnunet-service-ats_preferences.h"
#include "gnunet-service-ats_scheduling.h"
#include "gnunet-service-ats_reservations.h"
#include "gnunet-service-ats_plugins.h"
#include "ats.h"
Go to the source code of this file.
Functions | |
static void | handle_ats_start (void *cls, const struct ClientStartMessage *msg) |
We have received a struct ClientStartMessage from a client. More... | |
static void | handle_reservation_request (void *cls, const struct ReservationRequestMessage *message) |
Handle 'reservation request' messages from clients. More... | |
static int | check_feedback (void *cls, const struct FeedbackPreferenceMessage *message) |
Check 'preference feedback' message is well-formed. More... | |
static void | handle_feedback (void *cls, const struct FeedbackPreferenceMessage *msg) |
Handle 'preference feedback' messages from clients. More... | |
static void | handle_request_address_list (void *cls, const struct AddressListRequestMessage *message) |
Handle 'request address list' messages from clients. More... | |
static void | handle_request_address (void *cls, const struct RequestAddressMessage *message) |
Handle 'request address' messages from clients. More... | |
static void | handle_request_address_cancel (void *cls, const struct RequestAddressMessage *message) |
Cancel 'request address' messages from clients. More... | |
static int | check_address_add (void *cls, const struct AddressAddMessage *m) |
Handle 'address add' messages from clients. More... | |
static void | handle_address_add (void *cls, const struct AddressAddMessage *message) |
Handle 'address add' messages from clients. More... | |
static void | handle_address_update (void *cls, const struct AddressUpdateMessage *message) |
Handle 'address update' messages from clients. More... | |
static void | handle_address_destroyed (void *cls, const struct AddressDestroyedMessage *message) |
Handle 'address destroyed' messages from clients. More... | |
static int | check_preference_change (void *cls, const struct ChangePreferenceMessage *message) |
Check that 'change preference' message is well-formed. More... | |
static void | handle_preference_change (void *cls, const struct ChangePreferenceMessage *message) |
Handle 'change preference' messages from clients. More... | |
static void * | client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq) |
A client connected to us. More... | |
static void | client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *client, void *app_ctx) |
A client disconnected from us. More... | |
static void | cleanup_task (void *cls) |
Task run during shutdown. More... | |
static void | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SERVICE_Handle *service) |
Process template requests. More... | |
GNUNET_SERVICE_MAIN ("ats", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_fixed_size(ats_start, GNUNET_MESSAGE_TYPE_ATS_START, struct ClientStartMessage, NULL), GNUNET_MQ_hd_fixed_size(request_address, GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS, struct RequestAddressMessage, NULL), GNUNET_MQ_hd_fixed_size(request_address_cancel, GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL, struct RequestAddressMessage, NULL), GNUNET_MQ_hd_fixed_size(request_address_list, GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST, struct AddressListRequestMessage, NULL), GNUNET_MQ_hd_var_size(address_add, GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD, struct AddressAddMessage, NULL), GNUNET_MQ_hd_fixed_size(address_update, GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE, struct AddressUpdateMessage, NULL), GNUNET_MQ_hd_fixed_size(address_destroyed, GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED, struct AddressDestroyedMessage, NULL), GNUNET_MQ_hd_fixed_size(reservation_request, GNUNET_MESSAGE_TYPE_ATS_RESERVATION_REQUEST, struct ReservationRequestMessage, NULL), GNUNET_MQ_hd_var_size(preference_change, GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE, struct ChangePreferenceMessage, NULL), GNUNET_MQ_hd_var_size(feedback, GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK, struct FeedbackPreferenceMessage, NULL), GNUNET_MQ_handler_end()) | |
Define "main" method using service macro. More... | |
Variables | |
struct GNUNET_STATISTICS_Handle * | GSA_stats |
Handle for statistics. More... | |
ats service
Definition in file gnunet-service-ats.c.
|
static |
We have received a struct ClientStartMessage
from a client.
Find out which type of client it is and notify the respective subsystem.
cls | handle to the client |
msg | the start message |
Definition at line 53 of file gnunet-service-ats.c.
References GAS_performance_add_client(), GAS_scheduling_add_client(), GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_OK, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), msg, START_FLAG_CONNECTION_SUGGESTION, START_FLAG_PERFORMANCE_NO_PIC, START_FLAG_PERFORMANCE_WITH_PIC, and START_FLAG_SCHEDULING.
|
static |
Handle 'reservation request' messages from clients.
cls | client that sent the request |
message | the request message |
Definition at line 104 of file gnunet-service-ats.c.
References GAS_handle_reservation_request(), and GNUNET_SERVICE_client_continue().
|
static |
Check 'preference feedback' message is well-formed.
cls | client that sent the request |
message | the request message |
Definition at line 123 of file gnunet-service-ats.c.
References GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, FeedbackPreferenceMessage::header, FeedbackPreferenceMessage::num_feedback, and GNUNET_MessageHeader::size.
|
static |
Handle 'preference feedback' messages from clients.
cls | client that sent the request |
msg | the request message |
Definition at line 151 of file gnunet-service-ats.c.
References GAS_plugin_notify_feedback(), GNUNET_CONTAINER_multipeermap_contains(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_SERVICE_client_continue(), GNUNET_STATISTICS_update(), GNUNET_TIME_relative_ntoh(), GSA_addresses, GSA_stats, msg, pi, PreferenceInformation::preference_kind, and PreferenceInformation::preference_value.
|
static |
Handle 'request address list' messages from clients.
cls | client that sent the request |
message | the request message |
Definition at line 198 of file gnunet-service-ats.c.
References GAS_handle_request_address_list(), and GNUNET_SERVICE_client_continue().
|
static |
Handle 'request address' messages from clients.
cls | client that sent the request |
message | the request message |
Definition at line 216 of file gnunet-service-ats.c.
References GAS_handle_request_address(), and GNUNET_SERVICE_client_continue().
|
static |
Cancel 'request address' messages from clients.
cls | client that sent the request |
message | the request message |
Definition at line 234 of file gnunet-service-ats.c.
References GAS_handle_request_address_cancel(), and GNUNET_SERVICE_client_continue().
|
static |
Handle 'address add' messages from clients.
cls | client that sent the request |
m | the request message |
Definition at line 252 of file gnunet-service-ats.c.
References address, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, m, plugin_name, and size.
|
static |
Handle 'address add' messages from clients.
cls | client that sent the request |
message | the request message |
Definition at line 289 of file gnunet-service-ats.c.
References GAS_handle_address_add(), and GNUNET_SERVICE_client_continue().
|
static |
Handle 'address update' messages from clients.
cls | client that sent the request |
message | the request message |
Definition at line 306 of file gnunet-service-ats.c.
References GAS_handle_address_update(), and GNUNET_SERVICE_client_continue().
|
static |
Handle 'address destroyed' messages from clients.
cls | client that sent the request |
message | the request message |
Definition at line 323 of file gnunet-service-ats.c.
References GAS_handle_address_destroyed(), and GNUNET_SERVICE_client_continue().
|
static |
Check that 'change preference' message is well-formed.
cls | client that sent the request |
message | the request message |
Definition at line 341 of file gnunet-service-ats.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, ChangePreferenceMessage::header, ChangePreferenceMessage::num_preferences, and GNUNET_MessageHeader::size.
|
static |
Handle 'change preference' messages from clients.
cls | client that sent the request |
message | the request message |
Definition at line 368 of file gnunet-service-ats.c.
References GAS_handle_preference_change(), and GNUNET_SERVICE_client_continue().
|
static |
A client connected to us.
Setup the local client record.
cls | unused |
client | handle of the client |
mq | message queue to talk to client |
Definition at line 389 of file gnunet-service-ats.c.
|
static |
A client disconnected from us.
Tear down the local client record.
cls | unused |
client | handle of the client |
app_ctx |
Definition at line 406 of file gnunet-service-ats.c.
References GAS_connectivity_remove_client(), GAS_preference_client_disconnect(), and GAS_scheduling_remove_client().
|
static |
Task run during shutdown.
cls | unused |
Definition at line 424 of file gnunet-service-ats.c.
References GAS_addresses_done(), GAS_connectivity_done(), GAS_normalization_stop(), GAS_performance_done(), GAS_plugin_done(), GAS_preference_done(), GAS_reservations_done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_destroy(), and GSA_stats.
Referenced by run().
|
static |
Process template requests.
cls | closure |
cfg | configuration to use |
service | the initialized service |
Definition at line 451 of file gnunet-service-ats.c.
References cfg, cleanup_task(), GAS_addresses_done(), GAS_addresses_init(), GAS_connectivity_done(), GAS_connectivity_init(), GAS_normalization_start(), GAS_normalization_stop(), GAS_performance_init(), GAS_plugin_init(), GAS_preference_done(), GAS_preference_init(), GAS_reservations_done(), GAS_reservations_init(), GNUNET_break, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_shutdown(), GNUNET_STATISTICS_create(), GNUNET_STATISTICS_destroy(), and GSA_stats.
Define "main" method using service macro.
struct GNUNET_STATISTICS_Handle* GSA_stats |
Handle for statistics.
Definition at line 42 of file gnunet-service-ats.c.
Referenced by cleanup_task(), handle_feedback(), and run().