GNUnet  0.20.0
gnunet-service-ats_normalization.h File Reference

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

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.

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.

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 }
static char * address
GNS address for this phone.
struct GNUNET_CONTAINER_MultiPeerMap * GSA_addresses
A multihashmap to store all addresses.
static struct PropertyRange property_range
Range information for all quality properties we see.
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...
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...
static void init_range(struct PropertyRange *pr)
Initialize property range to the values corresponding to an empty set.
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.
#define LOG(kind,...)
static int notify_change(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Notify about change in normalized property.
void GAS_plugin_solver_unlock()
Resume instant solving, we are done with the bulk state updates.
void GAS_plugin_solver_lock()
Stop instant solving, there are many state updates happening in bulk right now.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_DEBUG
ATS performance characteristics for an address.
uint32_t utilization_in
Actual traffic on this connection from the other peer to this peer.
unsigned int distance
Distance on network layer (required for distance-vector routing) in hops.
struct GNUNET_TIME_Relative delay
Delay.
uint64_t rel_value_us
The actual value.
Range information for normalization of quality properties.

References address, 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, normalize_address(), notify_change(), 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().

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.

284 {
286 }

References init_range(), and property_range.

Referenced by GNUNET_ATS_solvers_solver_start(), and run().

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.

294 {
295  /* nothing to do */
296 }

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

Here is the caller graph for this function: