GNUnet  0.10.x
Functions
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.

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

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

154 {
155  GNUNET_break ( (NULL == prop) ||
156  (GNUNET_NT_UNSPECIFIED != prop->scope) );
157  notify_client (NULL,
158  peer,
159  plugin_name,
160  plugin_addr,
161  plugin_addr_len,
162  active,
163  prop,
164  local_address_info,
165  bandwidth_out,
166  bandwidth_in);
168  "# performance updates given to clients",
169  1,
170  GNUNET_NO);
171 }
#define GNUNET_NO
Definition: gnunet_common.h:81
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.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
struct GNUNET_STATISTICS_Handle * GSA_stats
Handle for statistics.
#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.
enum GNUNET_NetworkType scope
Which network scope does the respective address belong to? This property does not change...
Category of last resort.
Definition: gnunet_nt_lib.h:40
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 231 of file gnunet-service-ats_performance.c.

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

Referenced by handle_ats_start().

233 {
234  struct GNUNET_MQ_Handle *mq;
235 
236  mq = GNUNET_SERVICE_client_get_mq (client);
238  {
240  mq);
242  &peerinfo_it,
243  client);
244  }
245  else
246  {
248  mq);
249  }
250 }
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
Definition: service.c:2734
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:164
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()
Handle to a message queue.
Definition: mq.c:85
struct GNUNET_MQ_Handle * mq
Definition: 003.c:5
static struct GNUNET_NotificationContext * nc_pic
Context for sending messages to performance clients with PIC.
Performance monitoring client that wants to learn about changes in performance characteristics.
Definition: ats.h:49
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 259 of file gnunet-service-ats_performance.c.

References GNUNET_notification_context_create().

Referenced by run().

260 {
263 }
static struct GNUNET_NotificationContext * nc_no_pic
Context for sending messages to performance clients without PIC.
struct GNUNET_NotificationContext * GNUNET_notification_context_create(unsigned int queue_length)
Create a new notification context.
Definition: nc.c:125
static struct GNUNET_NotificationContext * nc_pic
Context for sending messages to performance clients with PIC.
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 270 of file gnunet-service-ats_performance.c.

References GNUNET_notification_context_destroy().

Referenced by cleanup_task().

271 {
273  nc_no_pic = NULL;
275  nc_pic = NULL;
276 }
static struct GNUNET_NotificationContext * nc_no_pic
Context for sending messages to performance clients without PIC.
void GNUNET_notification_context_destroy(struct GNUNET_NotificationContext *nc)
Destroy the context, force disconnect for all subscribers.
Definition: nc.c:141
static struct GNUNET_NotificationContext * nc_pic
Context for sending messages to performance clients with PIC.
Here is the call graph for this function:
Here is the caller graph for this function: