GNUnet  0.10.x
Functions | Variables
gnunet-service-ats.c File Reference

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"
Include dependency graph for gnunet-service-ats.c:

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_HandleGSA_stats
 Handle for statistics. More...
 

Detailed Description

ats service

Author
Matthias Wachs
Christian Grothoff

Definition in file gnunet-service-ats.c.

Function Documentation

◆ handle_ats_start()

static void handle_ats_start ( void *  cls,
const struct ClientStartMessage msg 
)
static

We have received a struct ClientStartMessage from a client.

Find out which type of client it is and notify the respective subsystem.

Parameters
clshandle to the client
msgthe 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(), ClientStartMessage::start_flag, START_FLAG_CONNECTION_SUGGESTION, START_FLAG_PERFORMANCE_NO_PIC, START_FLAG_PERFORMANCE_WITH_PIC, and START_FLAG_SCHEDULING.

55 {
56  struct GNUNET_SERVICE_Client *client = cls;
57  enum StartFlag flag;
58 
59  flag = ntohl(msg->start_flag);
61  "Received ATS_START (%d) message\n",
62  (int)flag);
63  switch (flag)
64  {
66  if (GNUNET_OK !=
68  {
70  return;
71  }
72  break;
73 
76  flag);
77  break;
78 
81  flag);
82  break;
83 
85  /* This client won't receive messages from us, no need to 'add' */
86  break;
87 
88  default:
89  GNUNET_break(0);
91  return;
92  }
94 }
uint32_t start_flag
NBO value of an enum StartFlag.
Definition: ats.h:77
StartFlag
Flag used to indicate which type of client is connecting to the ATS service.
Definition: ats.h:37
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
Performance monitoring client that does NOT want to learn about changes in performance characteristic...
Definition: ats.h:53
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
Handle to a client that is connected to a service.
Definition: service.c:246
This is a scheduling client (aka transport service)
Definition: ats.h:41
int GAS_scheduling_add_client(struct GNUNET_SERVICE_Client *client)
Register a new scheduling client.
void GAS_performance_add_client(struct GNUNET_SERVICE_Client *client, enum StartFlag flag)
Register a new performance client.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Definition: service.c:2315
Connection suggestion handle.
Definition: ats.h:58
#define GNUNET_log(kind,...)
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2234
Performance monitoring client that wants to learn about changes in performance characteristics.
Definition: ats.h:47
Here is the call graph for this function:

◆ handle_reservation_request()

static void handle_reservation_request ( void *  cls,
const struct ReservationRequestMessage message 
)
static

Handle 'reservation request' messages from clients.

Parameters
clsclient that sent the request
messagethe request message

Definition at line 105 of file gnunet-service-ats.c.

References GAS_handle_reservation_request(), and GNUNET_SERVICE_client_continue().

107 {
108  struct GNUNET_SERVICE_Client *client = cls;
109 
111  message);
113 }
void GAS_handle_reservation_request(struct GNUNET_SERVICE_Client *client, const struct ReservationRequestMessage *msg)
Handle 'reservation request' messages from clients.
Handle to a client that is connected to a service.
Definition: service.c:246
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2234
Here is the call graph for this function:

◆ check_feedback()

static int check_feedback ( void *  cls,
const struct FeedbackPreferenceMessage message 
)
static

Check 'preference feedback' message is well-formed.

Parameters
clsclient that sent the request
messagethe request message
Returns
GNUNET_OK if message is well-formed

Definition at line 124 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.

126 {
127  uint16_t msize;
128  uint32_t nump;
129 
131  "Received PREFERENCE_FEEDBACK message\n");
132  msize = ntohs(message->header.size);
133  nump = ntohl(message->num_feedback);
134  if (msize !=
135  sizeof(struct FeedbackPreferenceMessage) +
136  nump * sizeof(struct PreferenceInformation))
137  {
138  GNUNET_break(0);
139  return GNUNET_SYSERR;
140  }
141  return GNUNET_OK;
142 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
uint32_t num_feedback
Number of feedback values included.
Definition: ats.h:459
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
Message containing application feedback for a peer.
Definition: ats.h:450
#define GNUNET_log(kind,...)
Variable-size entry in a struct ChangePreferenceMessage or struct FeedbackPreferenceMessage.
Definition: ats.h:408
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK.
Definition: ats.h:454

◆ handle_feedback()

static void handle_feedback ( void *  cls,
const struct FeedbackPreferenceMessage msg 
)
static

Handle 'preference feedback' messages from clients.

Parameters
clsclient that sent the request
msgthe request message

Definition at line 152 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, FeedbackPreferenceMessage::num_feedback, FeedbackPreferenceMessage::peer, pi, PreferenceInformation::preference_kind, PreferenceInformation::preference_value, and FeedbackPreferenceMessage::scope.

154 {
155  struct GNUNET_SERVICE_Client *client = cls;
156  const struct PreferenceInformation *pi;
157  uint32_t nump;
158 
159  nump = ntohl(msg->num_feedback);
160  if (GNUNET_NO ==
162  &msg->peer))
163  {
165  "Received PREFERENCE FEEDBACK for unknown peer `%s'\n",
166  GNUNET_i2s(&msg->peer));
168  return;
169  }
170 
172  "# preference feedbacks requests processed",
173  1,
174  GNUNET_NO);
175  pi = (const struct PreferenceInformation *)&msg[1];
176  for (uint32_t i = 0; i < nump; i++)
177  {
179  "Received PREFERENCE FEEDBACK for peer `%s'\n",
180  GNUNET_i2s(&msg->peer));
182  &msg->peer,
184  (enum GNUNET_ATS_PreferenceKind)ntohl(pi[i].preference_kind),
185  pi[i].preference_value);
186  }
188 }
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...
uint32_t preference_kind
An enum GNUNET_ATS_PreferenceKind in NBO.
Definition: ats.h:412
#define GNUNET_NO
Definition: gnunet_common.h:78
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
static struct GNUNET_PEERINFO_Handle * pi
Handle to peerinfo service.
uint32_t num_feedback
Number of feedback values included.
Definition: ats.h:459
Handle to a client that is connected to a service.
Definition: service.c:246
struct GNUNET_TIME_Relative GNUNET_TIME_relative_ntoh(struct GNUNET_TIME_RelativeNBO a)
Convert relative time from network byte order.
Definition: time.c:639
struct GNUNET_PeerIdentity peer
Peer this feedback is for.
Definition: ats.h:469
struct GNUNET_CONTAINER_MultiPeerMap * GSA_addresses
A multihashmap to store all addresses.
struct GNUNET_TIME_RelativeNBO scope
Relative time describing for which time interval this feedback is.
Definition: ats.h:464
struct GNUNET_STATISTICS_Handle * GSA_stats
Handle for statistics.
#define GNUNET_log(kind,...)
Variable-size entry in a struct ChangePreferenceMessage or struct FeedbackPreferenceMessage.
Definition: ats.h:408
GNUNET_ATS_PreferenceKind
Enum defining all known preference categories.
float preference_value
Degree of preference (or appreciation) for this preference_kind being expressed.
Definition: ats.h:418
int 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)...
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2234
Here is the call graph for this function:

◆ handle_request_address_list()

static void handle_request_address_list ( void *  cls,
const struct AddressListRequestMessage message 
)
static

Handle 'request address list' messages from clients.

Parameters
clsclient that sent the request
messagethe request message

Definition at line 198 of file gnunet-service-ats.c.

References GAS_handle_request_address_list(), and GNUNET_SERVICE_client_continue().

200 {
201  struct GNUNET_SERVICE_Client *client = cls;
202 
204  message);
206 }
Handle to a client that is connected to a service.
Definition: service.c:246
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2234
void GAS_handle_request_address_list(struct GNUNET_SERVICE_Client *client, const struct AddressListRequestMessage *alrm)
Handle &#39;address list request&#39; messages from clients.
Here is the call graph for this function:

◆ handle_request_address()

static void handle_request_address ( void *  cls,
const struct RequestAddressMessage message 
)
static

Handle 'request address' messages from clients.

Parameters
clsclient that sent the request
messagethe request message

Definition at line 216 of file gnunet-service-ats.c.

References GAS_handle_request_address(), and GNUNET_SERVICE_client_continue().

218 {
219  struct GNUNET_SERVICE_Client *client = cls;
220 
222  message);
224 }
Handle to a client that is connected to a service.
Definition: service.c:246
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 GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2234
Here is the call graph for this function:

◆ handle_request_address_cancel()

static void handle_request_address_cancel ( void *  cls,
const struct RequestAddressMessage message 
)
static

Cancel 'request address' messages from clients.

Parameters
clsclient that sent the request
messagethe request message

Definition at line 234 of file gnunet-service-ats.c.

References GAS_handle_request_address_cancel(), and GNUNET_SERVICE_client_continue().

236 {
237  struct GNUNET_SERVICE_Client *client = cls;
238 
240  message);
242 }
Handle to a client that is connected to a service.
Definition: service.c:246
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 GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2234
Here is the call graph for this function:

◆ check_address_add()

static int check_address_add ( void *  cls,
const struct AddressAddMessage m 
)
static

Handle 'address add' messages from clients.

Parameters
clsclient that sent the request
mthe request message

Definition at line 252 of file gnunet-service-ats.c.

References address, AddressAddMessage::address_length, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, AddressAddMessage::header, plugin_name, AddressAddMessage::plugin_name_length, size, and GNUNET_MessageHeader::size.

254 {
255  const char *address;
256  const char *plugin_name;
257  uint16_t address_length;
258  uint16_t plugin_name_length;
259  uint16_t size;
260 
261  size = ntohs(m->header.size);
262  address_length = ntohs(m->address_length);
263  plugin_name_length = ntohs(m->plugin_name_length);
264  address = (const char *)&m[1];
265  if (plugin_name_length != 0)
266  plugin_name = &address[address_length];
267  else
268  plugin_name = "";
269 
270  if ((address_length + plugin_name_length +
271  sizeof(struct AddressAddMessage) != size) ||
272  ((plugin_name_length > 0) &&
273  (plugin_name[plugin_name_length - 1] != '\0')))
274  {
275  GNUNET_break(0);
276  return GNUNET_SYSERR;
277  }
278  return GNUNET_OK;
279 }
uint16_t address_length
Number of bytes in the address that follows this struct.
Definition: ats.h:117
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static char * plugin_name
Solver plugin name as string.
uint16_t plugin_name_length
Number of bytes in the plugin name that follows this struct.
Definition: ats.h:122
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
static unsigned int size
Size of the "table".
Definition: peer.c:66
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD.
Definition: ats.h:112
static char * address
GNS address for this phone.
Scheduling client to ATS service: here is another address you can use.
Definition: ats.h:108

◆ handle_address_add()

static void handle_address_add ( void *  cls,
const struct AddressAddMessage message 
)
static

Handle 'address add' messages from clients.

Parameters
clsclient that sent the request
messagethe request message

Definition at line 289 of file gnunet-service-ats.c.

References GAS_handle_address_add(), and GNUNET_SERVICE_client_continue().

291 {
292  struct GNUNET_SERVICE_Client *client = cls;
293 
294  GAS_handle_address_add(message);
296 }
Handle to a client that is connected to a service.
Definition: service.c:246
void GAS_handle_address_add(const struct AddressAddMessage *m)
Handle &#39;address add&#39; messages from clients.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2234
Here is the call graph for this function:

◆ handle_address_update()

static void handle_address_update ( void *  cls,
const struct AddressUpdateMessage message 
)
static

Handle 'address update' messages from clients.

Parameters
clsclient that sent the request
messagethe request message

Definition at line 306 of file gnunet-service-ats.c.

References GAS_handle_address_update(), and GNUNET_SERVICE_client_continue().

308 {
309  struct GNUNET_SERVICE_Client *client = cls;
310 
311  GAS_handle_address_update(message);
313 }
void GAS_handle_address_update(const struct AddressUpdateMessage *m)
Handle &#39;address update&#39; messages from clients.
Handle to a client that is connected to a service.
Definition: service.c:246
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2234
Here is the call graph for this function:

◆ handle_address_destroyed()

static void handle_address_destroyed ( void *  cls,
const struct AddressDestroyedMessage message 
)
static

Handle 'address destroyed' messages from clients.

Parameters
clsclient that sent the request
messagethe request message

Definition at line 323 of file gnunet-service-ats.c.

References GAS_handle_address_destroyed(), and GNUNET_SERVICE_client_continue().

325 {
326  struct GNUNET_SERVICE_Client *client = cls;
327 
330 }
void GAS_handle_address_destroyed(const struct AddressDestroyedMessage *m)
Handle &#39;address destroyed&#39; messages from clients.
Handle to a client that is connected to a service.
Definition: service.c:246
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2234
Here is the call graph for this function:

◆ check_preference_change()

static int check_preference_change ( void *  cls,
const struct ChangePreferenceMessage message 
)
static

Check that 'change preference' message is well-formed.

Parameters
clsclient that sent the request
messagethe request message
Returns
GNUNET_OK if message is well-formed

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.

343 {
344  uint16_t msize;
345  uint32_t nump;
346 
347  msize = ntohs(message->header.size);
348  nump = ntohl(message->num_preferences);
349  if ((msize !=
350  sizeof(struct ChangePreferenceMessage) +
351  nump * sizeof(struct PreferenceInformation)) ||
352  (UINT16_MAX / sizeof(struct PreferenceInformation) < nump))
353  {
354  GNUNET_break(0);
355  return GNUNET_SYSERR;
356  }
357  return GNUNET_OK;
358 }
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE.
Definition: ats.h:429
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
uint32_t num_preferences
How many struct PreferenceInformation entries follow this struct?
Definition: ats.h:435
Variable-size entry in a struct ChangePreferenceMessage or struct FeedbackPreferenceMessage.
Definition: ats.h:408
Client to ATS: I have a performance preference for a peer.
Definition: ats.h:425

◆ handle_preference_change()

static void handle_preference_change ( void *  cls,
const struct ChangePreferenceMessage message 
)
static

Handle 'change preference' messages from clients.

Parameters
clsclient that sent the request
messagethe request message

Definition at line 368 of file gnunet-service-ats.c.

References GAS_handle_preference_change(), and GNUNET_SERVICE_client_continue().

370 {
371  struct GNUNET_SERVICE_Client *client = cls;
372 
374  message);
376 }
Handle to a client that is connected to a service.
Definition: service.c:246
void GAS_handle_preference_change(struct GNUNET_SERVICE_Client *client, const struct ChangePreferenceMessage *msg)
Handle &#39;preference change&#39; messages from clients.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
Definition: service.c:2234
Here is the call graph for this function:

◆ client_connect_cb()

static void* client_connect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
struct GNUNET_MQ_Handle mq 
)
static

A client connected to us.

Setup the local client record.

Parameters
clsunused
clienthandle of the client
mqmessage queue to talk to client
Returns
client

Definition at line 389 of file gnunet-service-ats.c.

Referenced by run().

392 {
393  return client;
394 }
Here is the caller graph for this function:

◆ client_disconnect_cb()

static void client_disconnect_cb ( void *  cls,
struct GNUNET_SERVICE_Client client,
void *  app_ctx 
)
static

A client disconnected from us.

Tear down the local client record.

Parameters
clsunused
clienthandle 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().

Referenced by run().

409 {
410  if (NULL == client)
411  return;
415 }
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_preference_client_disconnect(struct GNUNET_SERVICE_Client *client)
A performance client disconnected.
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).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanup_task()

static void cleanup_task ( void *  cls)
static

Task run during shutdown.

Parameters
clsunused

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, and GNUNET_STATISTICS_destroy().

Referenced by run().

425 {
427  "ATS shutdown initiated\n");
430  GAS_plugin_done();
435  if (NULL != GSA_stats)
436  {
438  GSA_stats = NULL;
439  }
440 }
void GAS_normalization_stop()
Stop the normalization component and free all items.
void GAS_reservations_done()
Shutdown reservations subsystem.
#define GNUNET_NO
Definition: gnunet_common.h:78
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
void GAS_preference_done()
Shutdown preferences subsystem.
void GAS_plugin_done()
Shutdown address subsystem.
void GAS_connectivity_done()
Shutdown connectivity subsystem.
struct GNUNET_STATISTICS_Handle * GSA_stats
Handle for statistics.
#define GNUNET_log(kind,...)
void GAS_performance_done()
Shutdown performance subsystem.
void GAS_addresses_done()
Shutdown address subsystem.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
const struct GNUNET_CONFIGURATION_Handle cfg,
struct GNUNET_SERVICE_Handle service 
)
static

Process template requests.

Parameters
clsclosure
cfgconfiguration to use
servicethe initialized service

Definition at line 451 of file gnunet-service-ats.c.

References cleanup_task(), client_connect_cb(), client_disconnect_cb(), 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_MESSAGE_TYPE_ATS_ADDRESS_ADD, GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED, GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE, GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST, GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE, GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK, GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS, GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL, GNUNET_MESSAGE_TYPE_ATS_RESERVATION_REQUEST, GNUNET_MESSAGE_TYPE_ATS_START, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_shutdown(), GNUNET_SERVICE_MAIN(), GNUNET_SERVICE_OPTION_NONE, GNUNET_STATISTICS_create(), and GNUNET_STATISTICS_destroy().

454 {
456  cfg);
462  if (GNUNET_OK !=
463  GAS_plugin_init(cfg))
464  {
465  GNUNET_break(0);
471  if (NULL != GSA_stats)
472  {
474  GNUNET_NO);
475  GSA_stats = NULL;
476  }
477  return;
478  }
481  NULL);
482 }
void GAS_normalization_stop()
Stop the normalization component and free all items.
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, or when GNUNET_SCHEDULER_shutdown() is being invoked.
Definition: scheduler.c:1284
void GAS_reservations_done()
Shutdown reservations subsystem.
void GAS_preference_init()
Initialize preferences subsystem.
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
void GAS_connectivity_init()
Shutdown connectivity subsystem.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
void GAS_reservations_init()
Initialize reservations subsystem.
int GAS_plugin_init(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize plugins subsystem.
void GAS_preference_done()
Shutdown preferences subsystem.
void GAS_performance_init()
Initialize performance subsystem.
static void cleanup_task(void *cls)
Task run during shutdown.
void GAS_connectivity_done()
Shutdown connectivity subsystem.
struct GNUNET_STATISTICS_Handle * GSA_stats
Handle for statistics.
void GAS_normalization_start()
Start the normalization component.
void GAS_addresses_init()
Initialize address subsystem.
void GAS_addresses_done()
Shutdown address subsystem.
Here is the call graph for this function:

◆ GNUNET_SERVICE_MAIN()

Define "main" method using service macro.

Referenced by run().

Here is the caller graph for this function:

Variable Documentation

◆ GSA_stats

struct GNUNET_STATISTICS_Handle* GSA_stats

Handle for statistics.

Definition at line 42 of file gnunet-service-ats.c.