GNUnet  0.20.0
gnunet-service-ats_performance.h File Reference

ats service, interaction with 'performance' API More...

#include "gnunet_util_lib.h"
#include "gnunet_ats_service.h"
#include "ats.h"
Include dependency graph for gnunet-service-ats_performance.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer, const char *plugin_name, const void *plugin_addr, size_t plugin_addr_len, int active, const struct GNUNET_ATS_Properties *prop, enum GNUNET_HELLO_AddressInfo local_address_info, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
 Transmit the given performance information to all performance clients. More...
 
void GAS_performance_add_client (struct GNUNET_SERVICE_Client *client, enum StartFlag flag)
 Register a new performance client. More...
 
void GAS_performance_init (void)
 Initialize performance subsystem. More...
 
void GAS_performance_done (void)
 Shutdown performance subsystem. More...
 

Detailed Description

ats service, interaction with 'performance' API

Author
Matthias Wachs
Christian Grothoff

Definition in file gnunet-service-ats_performance.h.

Function Documentation

◆ GAS_performance_notify_all_clients()

void GAS_performance_notify_all_clients ( const struct GNUNET_PeerIdentity peer,
const char *  plugin_name,
const void *  plugin_addr,
size_t  plugin_addr_len,
int  active,
const struct GNUNET_ATS_Properties prop,
enum GNUNET_HELLO_AddressInfo  local_address_info,
struct GNUNET_BANDWIDTH_Value32NBO  bandwidth_out,
struct GNUNET_BANDWIDTH_Value32NBO  bandwidth_in 
)

Transmit the given performance information to all performance clients.

Parameters
peerpeer for which this is an address suggestion
plugin_name0-termintated string specifying the transport plugin
plugin_addrbinary address for the plugin to use
plugin_addr_lennumber of bytes in plugin_addr
activeGNUNET_YES if this address is actively used to maintain a connection to a peer; GNUNET_NO if the address is not actively used; GNUNET_SYSERR if this address is no longer available for ATS
propperformance data for the address
local_address_infoinformation about the local flags for the address
bandwidth_outassigned outbound bandwidth
bandwidth_inassigned inbound bandwidth

Definition at line 145 of file gnunet-service-ats_performance.c.

157 {
158  GNUNET_break ((NULL == prop) ||
159  (GNUNET_NT_UNSPECIFIED != prop->scope));
160  notify_client (NULL,
161  peer,
162  plugin_name,
163  plugin_addr,
164  plugin_addr_len,
165  active,
166  prop,
167  local_address_info,
168  bandwidth_out,
169  bandwidth_in);
171  "# performance updates given to clients",
172  1,
173  GNUNET_NO);
174 }
struct GNUNET_STATISTICS_Handle * GSA_stats
Handle for statistics.
static void notify_client(struct GNUNET_SERVICE_Client *client, const struct GNUNET_PeerIdentity *peer, const char *plugin_name, const void *plugin_addr, size_t plugin_addr_len, int active, const struct GNUNET_ATS_Properties *prop, enum GNUNET_HELLO_AddressInfo local_address_info, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
Transmit the given performance information to all performance clients.
static char * plugin_name
Name of our plugin.
@ GNUNET_NO
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_NT_UNSPECIFIED
Category of last resort.
Definition: gnunet_nt_lib.h:43
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
enum GNUNET_NetworkType scope
Which network scope does the respective address belong to? This property does not change.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.

References GNUNET_break, GNUNET_NO, GNUNET_NT_UNSPECIFIED, GNUNET_STATISTICS_update(), GSA_stats, notify_client(), peer, plugin_name, and GNUNET_ATS_Properties::scope.

Referenced by bandwidth_changed_cb(), free_address(), GAS_addresses_add(), and GAS_addresses_update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GAS_performance_add_client()

void GAS_performance_add_client ( struct GNUNET_SERVICE_Client client,
enum StartFlag  flag 
)

Register a new performance client.

Parameters
clienthandle of the new client
flagflag specifying the type of the client

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

236 {
237  struct GNUNET_MQ_Handle *mq;
238 
239  mq = GNUNET_SERVICE_client_get_mq (client);
241  {
243  mq);
245  &peerinfo_it,
246  client);
247  }
248  else
249  {
251  mq);
252  }
253 }
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
@ START_FLAG_PERFORMANCE_WITH_PIC
Performance monitoring client that wants to learn about changes in performance characteristics.
Definition: ats.h:48
void GAS_addresses_get_peer_info(const struct GNUNET_PeerIdentity *peer, GNUNET_ATS_PeerInfo_Iterator pi_it, void *pi_it_cls)
Return information all peers currently known to ATS.
static void peerinfo_it(void *cls, const struct GNUNET_PeerIdentity *id, const char *plugin_name, const void *plugin_addr, size_t plugin_addr_len, int active, const struct GNUNET_ATS_Properties *prop, enum GNUNET_HELLO_AddressInfo local_address_info, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
Iterator for called from GAS_addresses_get_peer_info()
static struct GNUNET_NotificationContext * nc_pic
Context for sending messages to performance clients with PIC.
static struct GNUNET_NotificationContext * nc_no_pic
Context for sending messages to performance clients without PIC.
void GNUNET_notification_context_add(struct GNUNET_NotificationContext *nc, struct GNUNET_MQ_Handle *mq)
Add a subscriber to the notification context.
Definition: nc.c:161
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
Definition: service.c:2443
Handle to a message queue.
Definition: mq.c:87

References GAS_addresses_get_peer_info(), GNUNET_notification_context_add(), GNUNET_SERVICE_client_get_mq(), mq, nc_no_pic, nc_pic, peerinfo_it(), and START_FLAG_PERFORMANCE_WITH_PIC.

Referenced by handle_ats_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GAS_performance_init()

void GAS_performance_init ( void  )

Initialize performance subsystem.

Parameters
serverhandle to our server
addressesthe address handle to use
serverhandle to our server

Definition at line 262 of file gnunet-service-ats_performance.c.

263 {
266 }
struct GNUNET_NotificationContext * GNUNET_notification_context_create(unsigned int queue_length)
Create a new notification context.
Definition: nc.c:122

References GNUNET_notification_context_create(), nc_no_pic, and nc_pic.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GAS_performance_done()

void GAS_performance_done ( void  )

Shutdown performance subsystem.

Definition at line 273 of file gnunet-service-ats_performance.c.

274 {
276  nc_no_pic = NULL;
278  nc_pic = NULL;
279 }
void GNUNET_notification_context_destroy(struct GNUNET_NotificationContext *nc)
Destroy the context, force disconnect for all subscribers.
Definition: nc.c:138

References GNUNET_notification_context_destroy(), nc_no_pic, and nc_pic.

Referenced by cleanup_task().

Here is the call graph for this function:
Here is the caller graph for this function: