GNUnet  0.11.x
Macros | Functions
gnunet-service-ats_normalization.h File Reference

ats service address: management of ATS properties and preferences normalization More...

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

Go to the source code of this file.

Macros

#define DEFAULT_REL_QUALITY   1.0
 Value we return for a normalized quality score if we have no data. More...
 

Functions

void GAS_normalization_update_property (struct ATS_Address *address)
 Update and normalize a prop performance information. More...
 
void GAS_normalization_start (void)
 Start the normalization component. More...
 
void GAS_normalization_stop (void)
 Stop the normalization component and free all items. More...
 

Detailed Description

ats service address: management of ATS properties and preferences normalization

Author
Matthias Wachs
Christian Grothoff

Definition in file gnunet-service-ats_normalization.h.

Macro Definition Documentation

◆ DEFAULT_REL_QUALITY

#define DEFAULT_REL_QUALITY   1.0

Value we return for a normalized quality score if we have no data.

Definition at line 34 of file gnunet-service-ats_normalization.h.

Referenced by enforce_add_address(), run(), and update_norm().

Function Documentation

◆ GAS_normalization_update_property()

void GAS_normalization_update_property ( struct ATS_Address address)

Update and normalize a prop performance information.

Parameters
addressthe address to update

Update and normalize a prop performance information.

Parameters
addressthe address to update

Definition at line 231 of file gnunet-service-ats_normalization.c.

References GNUNET_ATS_Properties::delay, GNUNET_ATS_Properties::distance, find_min_max_it(), GAS_plugin_solver_lock(), GAS_plugin_solver_unlock(), GNUNET_CONTAINER_multipeermap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_memcmp, GSA_addresses, init_range(), LOG, ATS_Address::norm_delay, ATS_Address::norm_distance, ATS_Address::norm_utilization_in, ATS_Address::norm_utilization_out, normalize_address(), notify_change(), ATS_Address::peer, ATS_Address::properties, property_range, GNUNET_TIME_Relative::rel_value_us, update_avg(), and GNUNET_ATS_Properties::utilization_in.

Referenced by GAS_addresses_add(), GAS_addresses_update(), and set_prop_task().

232 {
233  const struct GNUNET_ATS_Properties *prop = &address->properties;
234  struct PropertyRange range;
235 
237  "Updating properties for peer `%s'\n",
238  GNUNET_i2s (&address->peer));
241  &address->norm_delay);
242  update_avg (prop->distance,
243  &address->norm_distance);
244  update_avg (prop->utilization_in,
245  &address->norm_utilization_in);
246  update_avg (prop->utilization_in,
247  &address->norm_utilization_out);
248 
249  init_range (&range);
252  &range);
253  if (0 != GNUNET_memcmp (&range,
254  &property_range))
255  {
256  /* limits changed, (re)normalize all addresses */
257  property_range = range;
260  NULL);
262  &notify_change,
263  NULL);
264  }
265  else
266  {
267  /* renormalize just this one address */
268  normalize_address (NULL,
269  &address->peer,
270  address);
271  notify_change (NULL,
272  &address->peer,
273  address);
274  }
276 }
uint64_t rel_value_us
The actual value.
struct GNUNET_ATS_Properties properties
ATS performance information for this address.
uint32_t utilization_in
Actual traffic on this connection from the other peer to this peer.
struct GNUNET_PeerIdentity peer
Peer ID this address is for.
void GAS_plugin_solver_lock()
Stop instant solving, there are many state updates happening in bulk right now.
static int find_min_max_it(void *cls, const struct GNUNET_PeerIdentity *h, void *k)
Function called for all addresses and peers to find the minimum and maximum (averaged) values for a g...
Range information for normalization of quality properties.
static struct PropertyRange property_range
Range information for all quality properties we see.
static void update_avg(uint64_t current_val, struct GAS_NormalizationInfo *ni)
Add the value from atsi to the running average of the given ni quality property.
ATS performance characteristics for an address.
void GAS_plugin_solver_unlock()
Resume instant solving, we are done with the bulk state updates.
static int notify_change(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Notify about change in normalized property.
struct GNUNET_TIME_Relative delay
Delay.
struct GAS_NormalizationInfo norm_utilization_out
Normalized utilization outbound for this address.
struct GNUNET_CONTAINER_MultiPeerMap * GSA_addresses
A multihashmap to store all addresses.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
struct GAS_NormalizationInfo norm_utilization_in
Normalized utilization inbound for this address.
static void init_range(struct PropertyRange *pr)
Initialize property range to the values corresponding to an empty set.
static int normalize_address(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Normalize the property value for a given address based on the range we know that property values have...
#define LOG(kind,...)
struct GAS_NormalizationInfo norm_delay
Normalized delay information for this address.
unsigned int distance
Distance on network layer (required for distance-vector routing) in hops.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
struct GAS_NormalizationInfo norm_distance
Normalized distance information for this address.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GAS_normalization_start()

void GAS_normalization_start ( void  )

Start the normalization component.

Definition at line 283 of file gnunet-service-ats_normalization.c.

References init_range(), and property_range.

Referenced by GNUNET_ATS_solvers_solver_start(), and run().

284 {
286 }
static struct PropertyRange property_range
Range information for all quality properties we see.
static void init_range(struct PropertyRange *pr)
Initialize property range to the values corresponding to an empty set.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GAS_normalization_stop()

void GAS_normalization_stop ( void  )

Stop the normalization component and free all items.

Definition at line 293 of file gnunet-service-ats_normalization.c.

Referenced by cleanup_task(), GNUNET_ATS_solvers_solver_stop(), and run().

294 {
295  /* nothing to do */
296 }
Here is the caller graph for this function: