GNUnet  0.10.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 230 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().

231 {
232  const struct GNUNET_ATS_Properties *prop = &address->properties;
233  struct PropertyRange range;
234 
236  "Updating properties for peer `%s'\n",
237  GNUNET_i2s(&address->peer));
240  &address->norm_delay);
241  update_avg(prop->distance,
242  &address->norm_distance);
244  &address->norm_utilization_in);
246  &address->norm_utilization_out);
247 
248  init_range(&range);
251  &range);
252  if (0 != GNUNET_memcmp(&range,
253  &property_range))
254  {
255  /* limits changed, (re)normalize all addresses */
256  property_range = range;
259  NULL);
261  &notify_change,
262  NULL);
263  }
264  else
265  {
266  /* renormalize just this one address */
267  normalize_address(NULL,
268  &address->peer,
269  address);
270  notify_change(NULL,
271  &address->peer,
272  address);
273  }
275 }
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 282 of file gnunet-service-ats_normalization.c.

References init_range(), and property_range.

Referenced by GNUNET_ATS_solvers_solver_start(), and run().

283 {
285 }
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 292 of file gnunet-service-ats_normalization.c.

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

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