GNUnet  0.10.x
gnunet-service-ats_addresses.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2011-2014 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
27 #ifndef GNUNET_SERVICE_ATS_ADDRESSES_H
28 #define GNUNET_SERVICE_ATS_ADDRESSES_H
29 
30 #include "gnunet_util_lib.h"
31 #include "gnunet_ats_service.h"
32 #include "gnunet-service-ats.h"
33 #include "ats.h"
34 
221 /*
222  * How long will address suggestions blocked after a suggestion
223  */
224 #define ATS_BLOCKING_DELTA GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100)
225 
233  unsigned int avg_queue_index;
234 
239 
243  uint64_t avg;
244 
248  double norm;
249 };
250 
251 
255 struct ATS_Address {
260 
264  const void *addr;
265 
269  char *plugin;
270 
275 
279  struct GNUNET_ATS_Properties properties;
280 
284  struct GNUNET_TIME_Absolute t_last_activity;
285 
289  struct GNUNET_TIME_Absolute t_added;
290 
294  size_t addr_len;
295 
299  uint32_t session_id;
300 
304  enum GNUNET_HELLO_AddressInfo local_address_info;
305 
309  uint32_t atsi_count;
310 
314  uint32_t assigned_bw_in;
315 
319  uint32_t assigned_bw_out;
320 
325 
330 
334  int active;
335 
339  struct GAS_NormalizationInfo norm_delay;
340 
344  struct GAS_NormalizationInfo norm_distance;
345 
349  struct GAS_NormalizationInfo norm_utilization_in;
350 
354  struct GAS_NormalizationInfo norm_utilization_out;
355 };
356 
357 
362 
363 
368 void
369 GAS_addresses_init(void);
370 
371 
375 void
376 GAS_addresses_done(void);
377 
378 
390 void
392  const char *plugin_name,
393  const void *plugin_addr,
394  size_t plugin_addr_len,
395  uint32_t local_address_info,
396  uint32_t session_id,
397  const struct GNUNET_ATS_Properties *prop);
398 
399 
407 void
409  uint32_t session_id,
410  const struct GNUNET_ATS_Properties *prop);
411 
412 
419 void
421  uint32_t session_id);
422 
423 
427 void
429 
430 
445 typedef void
447  const struct GNUNET_PeerIdentity *id,
448  const char *plugin_name,
449  const void *plugin_addr,
450  size_t plugin_addr_len,
451  const int address_active,
452  const struct GNUNET_ATS_Properties *prop,
453  enum GNUNET_HELLO_AddressInfo local_address_info,
454  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
455  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in);
456 
457 
465 void
468  void *pi_it_cls);
469 
470 
477 void
479  const struct AddressListRequestMessage *alrm);
480 
481 
482 #endif
483 
484 /* end of gnunet-service-ats_addresses.h */
unsigned int avg_queue_index
Next index to use in averaging queue.
void GAS_addresses_destroy(const struct GNUNET_PeerIdentity *peer, uint32_t session_id)
Remove an address for a peer.
uint32_t session_id
Session ID, can never be 0.
#define GAS_normalization_queue_length
int active
Is this the active address for this peer?
uint64_t atsi_abs[3]
Averaging queue.
const void * addr
Address (in plugin-specific binary format).
uint32_t last_notified_bw_out
Outbound bandwidth assigned by solver in NBO.
void GAS_addresses_init(void)
Initialize address subsystem.
struct GNUNET_CONTAINER_MultiPeerMap * GSA_addresses
A multipeermap mapping peer identities to struct ATS_Address.
static struct GNUNET_HashCode session_id
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
size_t addr_len
Address length, number of bytes in addr.
char * plugin
Plugin name.
ATS performance characteristics for an address.
Handle to a client that is connected to a service.
Definition: service.c:246
uint32_t assigned_bw_in
Inbound bandwidth assigned by solver.
void GAS_handle_request_address_list(struct GNUNET_SERVICE_Client *client, const struct AddressListRequestMessage *alrm)
Handle &#39;address list request&#39; messages from clients.
void GAS_addresses_add(const struct GNUNET_PeerIdentity *peer, const char *plugin_name, const void *plugin_addr, size_t plugin_addr_len, uint32_t local_address_info, uint32_t session_id, const struct GNUNET_ATS_Properties *prop)
Add a new address for a peer.
static char * plugin_name
Solver plugin name as string.
Internal representation of the hash map.
Information provided by ATS normalization.
void(* GNUNET_ATS_PeerInfo_Iterator)(void *cls, const struct GNUNET_PeerIdentity *id, const char *plugin_name, const void *plugin_addr, size_t plugin_addr_len, const int address_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 GAS_addresses_get_peer_info()
uint64_t avg
Averaged ATSI values from queue.
Address with additional information.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
void * solver_information
Solver-specific information for this address.
Client to service: please give us an overview of the addresses.
Definition: ats.h:333
void GAS_addresses_done(void)
Shutdown address subsystem.
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
void GAS_addresses_update(const struct GNUNET_PeerIdentity *peer, uint32_t session_id, const struct GNUNET_ATS_Properties *prop)
Update an address with new performance information for a peer.
The identity of the host (wraps the signing key of the peer).
uint32_t assigned_bw_out
Outbound bandwidth assigned by solver.
Automatic transport selection and outbound bandwidth determination.
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.
void GAS_addresses_destroy_all(void)
Remove all addresses.
Time for absolute times used by GNUnet, in microseconds.
GNUNET_HELLO_AddressInfo
Additional local information about an address.
uint32_t atsi_count
ATS performance information for this address, size of the atsi array.
double norm
Normalized values from queue to a range of values [1.0...2.0].
uint32_t last_notified_bw_in
Inbound bandwidth assigned by solver in NBO.
automatic transport selection messages