59 flag = ntohl (
msg->start_flag);
61 "Received ATS_START (%d) message\n",
130 "Received PREFERENCE_FEEDBACK message\n");
158 nump = ntohl (
msg->num_feedback);
164 "Received PREFERENCE FEEDBACK for unknown peer `%s'\n",
171 "# preference feedbacks requests processed",
175 for (uint32_t i = 0; i < nump; i++)
178 "Received PREFERENCE FEEDBACK for peer `%s'\n",
257 uint16_t address_length;
258 uint16_t plugin_name_length;
261 size = ntohs (
m->header.size);
262 address_length = ntohs (
m->address_length);
263 plugin_name_length = ntohs (
m->plugin_name_length);
265 if (plugin_name_length != 0)
270 if ((address_length + plugin_name_length
272 ((plugin_name_length > 0) &&
427 "ATS shutdown initiated\n");
struct GNUNET_MQ_Handle * mq
struct GNUNET_MessageHeader * msg
automatic transport selection messages
StartFlag
Flag used to indicate which type of client is connecting to the ATS service.
@ START_FLAG_PERFORMANCE_NO_PIC
Performance monitoring client that does NOT want to learn about changes in performance characteristic...
@ START_FLAG_CONNECTION_SUGGESTION
Connection suggestion handle.
@ START_FLAG_SCHEDULING
This is a scheduling client (aka transport service)
@ START_FLAG_PERFORMANCE_WITH_PIC
Performance monitoring client that wants to learn about changes in performance characteristics.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
static char * address
GNS address for this phone.
static struct GNUNET_PEERINFO_Handle * pi
Handle to peerinfo service.
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
static void handle_request_address_cancel(void *cls, const struct RequestAddressMessage *message)
Cancel 'request address' messages from clients.
static void handle_reservation_request(void *cls, const struct ReservationRequestMessage *message)
Handle 'reservation request' messages from clients.
static void handle_address_update(void *cls, const struct AddressUpdateMessage *message)
Handle 'address update' messages from clients.
static void handle_request_address_list(void *cls, const struct AddressListRequestMessage *message)
Handle 'request address list' messages from clients.
static void cleanup_task(void *cls)
Task run during shutdown.
struct GNUNET_STATISTICS_Handle * GSA_stats
Handle for statistics.
static void handle_request_address(void *cls, const struct RequestAddressMessage *message)
Handle 'request address' messages from clients.
static void handle_ats_start(void *cls, const struct ClientStartMessage *msg)
We have received a struct ClientStartMessage from a client.
static int check_preference_change(void *cls, const struct ChangePreferenceMessage *message)
Check that 'change preference' message is well-formed.
static void handle_feedback(void *cls, const struct FeedbackPreferenceMessage *msg)
Handle 'preference feedback' messages from clients.
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.
static void handle_address_add(void *cls, const struct AddressAddMessage *message)
Handle 'address add' messages from clients.
static void * client_connect_cb(void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq)
A client connected to us.
static void handle_address_destroyed(void *cls, const struct AddressDestroyedMessage *message)
Handle 'address destroyed' messages from clients.
static int check_address_add(void *cls, const struct AddressAddMessage *m)
Handle 'address add' messages from clients.
static void handle_preference_change(void *cls, const struct ChangePreferenceMessage *message)
Handle 'change preference' messages from clients.
static void client_disconnect_cb(void *cls, struct GNUNET_SERVICE_Client *client, void *app_ctx)
A client disconnected from us.
static void run(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SERVICE_Handle *service)
Process template requests.
static int check_feedback(void *cls, const struct FeedbackPreferenceMessage *message)
Check 'preference feedback' message is well-formed.
void GAS_addresses_init()
Initialize address subsystem.
struct GNUNET_CONTAINER_MultiPeerMap * GSA_addresses
A multihashmap to store all addresses.
void GAS_handle_request_address_list(struct GNUNET_SERVICE_Client *client, const struct AddressListRequestMessage *alrm)
Handle 'address list request' messages from clients.
void GAS_addresses_done()
Shutdown address subsystem.
ats service address management
void GAS_connectivity_remove_client(struct GNUNET_SERVICE_Client *client)
Unregister a client (which may have been a connectivity client, but this is not assured).
void GAS_handle_request_address_cancel(struct GNUNET_SERVICE_Client *client, const struct RequestAddressMessage *msg)
Handle GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL messages from clients.
void GAS_connectivity_init()
Shutdown connectivity subsystem.
void GAS_handle_request_address(struct GNUNET_SERVICE_Client *client, const struct RequestAddressMessage *msg)
Handle GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS messages from clients.
void GAS_connectivity_done()
Shutdown connectivity subsystem.
ats service, interaction with 'connecivity' API
void GAS_normalization_stop()
Stop the normalization component and free all items.
void GAS_normalization_start()
Start the normalization component.
ats service address: management of ATS properties and preferences normalization
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 gi...
int GAS_plugin_init(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize address subsystem.
void GAS_plugin_done()
Shutdown address subsystem.
ats service plugin management
void GAS_preference_client_disconnect(struct GNUNET_SERVICE_Client *client)
A performance client disconnected.
void GAS_preference_init()
Initialize preferences subsystem.
void GAS_preference_done()
Shutdown preferences subsystem.
void GAS_handle_preference_change(struct GNUNET_SERVICE_Client *client, const struct ChangePreferenceMessage *msg)
Handle 'preference change' messages from clients.
manage preferences expressed by clients
void GAS_handle_reservation_request(struct GNUNET_SERVICE_Client *client, const struct ReservationRequestMessage *msg)
Handle 'reservation request' messages from clients.
void GAS_reservations_done()
Shutdown reservations subsystem.
void GAS_reservations_init()
Initialize reservations subsystem.
ats service, inbound bandwidth reservation management
void GAS_handle_address_add(const struct AddressAddMessage *m)
Handle 'address add' messages from clients.
void GAS_handle_address_update(const struct AddressUpdateMessage *m)
Handle 'address update' messages from clients.
void GAS_handle_address_destroyed(const struct AddressDestroyedMessage *m)
Handle 'address destroyed' messages from clients.
void GAS_scheduling_remove_client(struct GNUNET_SERVICE_Client *client)
Unregister a client (which may have been a scheduling client, but this is not assured).
int GAS_scheduling_add_client(struct GNUNET_SERVICE_Client *client)
Register a new scheduling client.
ats service, interaction with 'scheduling' API
static char * plugin_name
Name of our plugin.
GNUNET_ATS_PreferenceKind
Enum defining all known preference categories.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multipeermap_contains(const struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key)
Check if the map contains any value under the given key (including values that are NULL).
#define GNUNET_log(kind,...)
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK
Type of the 'struct ChangePreferenceMessage' sent by clients to ATS to ask for allocation preference ...
#define GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST
Type of the 'struct AddressListRequestMessage' sent by client to ATS to request information about add...
#define GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS
Type of the 'struct RequestAddressMessage' sent by clients to ATS to request an address to help conne...
#define GNUNET_MESSAGE_TYPE_ATS_START
Type of the 'struct ClientStartMessage' sent by clients to ATS to identify the type of the client.
#define GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE
Type of the 'struct AddressUpdateMessage' sent by clients to ATS to inform ATS about performance chan...
#define GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL
Type of the 'struct RequestAddressMessage' sent by clients to ATS to request an address to help conne...
#define GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD
Type of the 'struct AddressUpdateMessage' sent by client to ATS to add a new address.
#define GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED
Type of the 'struct AddressDestroyedMessage' sent by clients to ATS to inform ATS about an address be...
#define GNUNET_MESSAGE_TYPE_ATS_RESERVATION_REQUEST
Type of the 'struct ReservationRequestMessage' sent by clients to ATS to ask for inbound bandwidth re...
#define GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE
Type of the 'struct ChangePreferenceMessage' sent by clients to ATS to ask for allocation preference ...
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
@ GNUNET_SERVICE_OPTION_NONE
Use defaults.
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
struct GNUNET_TIME_Relative GNUNET_TIME_relative_ntoh(struct GNUNET_TIME_RelativeNBO a)
Convert relative time from network byte order.
static unsigned int size
Size of the "table".
Scheduling client to ATS service: here is another address you can use.
Message sent by ATS client to ATS service when an address was destroyed and must thus henceforth no l...
Client to service: please give us an overview of the addresses.
Message used to notify ATS that the performance characteristics for an address have changed.
Client to ATS: I have a performance preference for a peer.
uint32_t num_preferences
How many struct PreferenceInformation entries follow this struct?
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE.
First message any client sends to ATS, used to self-identify (what type of client this is).
Message containing application feedback for a peer.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK.
uint32_t num_feedback
Number of feedback values included.
Handle to a message queue.
Handle to a client that is connected to a service.
Connectivity client to ATS service: we would like to have address suggestions for this peer.