GNUnet  0.11.x
gnunet_ats_service.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2010-2015 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  */
34 #ifndef GNUNET_ATS_SERVICE_H
35 #define GNUNET_ATS_SERVICE_H
36 
37 #include "gnunet_constants.h"
38 #include "gnunet_util_lib.h"
39 #include "gnunet_hello_lib.h"
40 
41 
45 #define GNUNET_ATS_DefaultBandwidth 65536
46 
50 #define GNUNET_ATS_VALUE_UNDEFINED UINT32_MAX
51 
55 #define GNUNET_ATS_VALUE_UNDEFINED_STR "undefined"
56 
60 #define GNUNET_ATS_MaxBandwidth UINT32_MAX
61 
65 #define GNUNET_ATS_MaxBandwidthString "unlimited"
66 
67 
72 {
78 
85  uint32_t utilization_out;
86 
93  uint32_t utilization_in;
94 
99  unsigned int distance;
100 
106 };
107 
108 
114 {
122 
130 
136 
142 
148 };
149 
150 
151 /* ********************* LAN Characterization library ************************ */
152 /* Note: these functions do not really communicate with the ATS service */
153 
154 
161 void
163  const struct GNUNET_ATS_Properties *hbo);
164 
165 
172 void
174  const struct GNUNET_ATS_PropertiesNBO *nbo);
175 
176 
177 /* ********************Connection Suggestion API ***************************** */
178 
184 
189 
190 
199 
200 
206 void
208 
209 
221  const struct GNUNET_PeerIdentity *peer,
222  uint32_t strength);
223 
224 
230 void
233 
234 
235 /* ******************************** Scheduling API ***************************** */
236 
241 
245 struct GNUNET_ATS_Session;
246 
247 
264 typedef void
266  const struct GNUNET_PeerIdentity *peer,
267  const struct
269  struct GNUNET_ATS_Session *session,
271  bandwidth_out,
273  bandwidth_in);
274 
275 
287  void *suggest_cb_cls);
288 
289 
295 void
297 
298 
303 
304 
319  const struct GNUNET_HELLO_Address *address,
320  struct GNUNET_ATS_Session *session,
321  const struct GNUNET_ATS_Properties *prop);
322 
323 
330 void
332  struct GNUNET_ATS_Session *session);
333 
334 
347 int
349  struct GNUNET_ATS_Session *session);
350 
351 
365 void
367  const struct GNUNET_ATS_Properties *prop);
368 
369 
376 void
378 
379 
380 /* ******************************** Performance API ***************************** */
381 
386 
402 typedef void
404  const struct
406  int address_active,
408  bandwidth_out,
410  bandwidth_in,
411  const struct
412  GNUNET_ATS_Properties *prop);
413 
414 
419 
420 
433  void *addr_info_cb_cls);
434 
435 
450  const struct GNUNET_PeerIdentity *peer,
451  int all,
453  infocb,
454  void *infocb_cls);
455 
456 
462 void
465 
466 
472 void
474 
475 
486 typedef void
487 (*GNUNET_ATS_ReservationCallback) (void *cls,
488  const struct GNUNET_PeerIdentity *peer,
489  int32_t amount,
490  struct GNUNET_TIME_Relative res_delay);
491 
492 
497 
498 
515  const struct GNUNET_PeerIdentity *peer,
516  int32_t amount,
518  void *rcb_cls);
519 
520 
526 void
528 
529 
533 #define GNUNET_ATS_PreferenceType { GNUNET_ATS_PREFERENCE_BANDWIDTH, \
534  GNUNET_ATS_PREFERENCE_LATENCY, \
535  GNUNET_ATS_PREFERENCE_END }
536 
540 #define GNUNET_ATS_PreferenceTypeString { "BANDWIDTH", "LATENCY", "END" }
541 
546 {
554 
563 
568 };
569 
570 
577 const char *
579 
580 
589 void
592  const struct
594  ...);
595 
596 
614 void
616  const struct GNUNET_PeerIdentity *peer,
617  const struct GNUNET_TIME_Relative scope,
618  ...);
619 
620 #endif
621  /* end of group */
623 
624 /* end of file gnunet-service-transport_ats.h */
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct SolverHandle * sh
static struct GNUNET_ATS_PerformanceHandle * ph
ATS performance handle used.
Definition: gnunet-ats.c:116
static struct GNUNET_ATS_AddressListHandle * alh
ATS address list handle used.
Definition: gnunet-ats.c:131
static struct GNUNET_CADET_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
static char * address
GNS address for this phone.
static void addr_info_cb(void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop)
Signature of a function that is called with QoS information about an address.
#define GNUNET_PACKED
gcc-ism to get packed structs.
void GNUNET_ATS_address_add_session(struct GNUNET_ATS_AddressRecord *ar, struct GNUNET_ATS_Session *session)
An address was used to initiate a session.
struct GNUNET_ATS_SchedulingHandle * GNUNET_ATS_scheduling_init(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ATS_AddressSuggestionCallback suggest_cb, void *suggest_cb_cls)
Initialize the ATS scheduling subsystem.
struct GNUNET_ATS_PerformanceHandle * GNUNET_ATS_performance_init(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ATS_AddressInformationCallback addr_info_cb, void *addr_info_cb_cls)
Get handle to access performance API of the ATS subsystem.
struct GNUNET_ATS_ConnectivityHandle * GNUNET_ATS_connectivity_init(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the ATS connectivity suggestion client handle.
void GNUNET_ATS_performance_list_addresses_cancel(struct GNUNET_ATS_AddressListHandle *alh)
Cancel a pending address listing operation.
void GNUNET_ATS_performance_done(struct GNUNET_ATS_PerformanceHandle *ph)
Client is done using the ATS performance subsystem, release resources.
struct GNUNET_ATS_ConnectivitySuggestHandle * GNUNET_ATS_connectivity_suggest(struct GNUNET_ATS_ConnectivityHandle *ch, const struct GNUNET_PeerIdentity *peer, uint32_t strength)
We would like to establish a new connection with a peer.
void GNUNET_ATS_address_update(struct GNUNET_ATS_AddressRecord *ar, const struct GNUNET_ATS_Properties *prop)
We have updated performance statistics for a given address.
void GNUNET_ATS_properties_ntoh(struct GNUNET_ATS_Properties *hbo, const struct GNUNET_ATS_PropertiesNBO *nbo)
Convert ATS properties from network to host byte order.
void GNUNET_ATS_performance_give_feedback(struct GNUNET_ATS_PerformanceHandle *ph, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_TIME_Relative scope,...)
Application feedback on how good preference requirements are fulfilled for the preferences included i...
void GNUNET_ATS_properties_hton(struct GNUNET_ATS_PropertiesNBO *nbo, const struct GNUNET_ATS_Properties *hbo)
Convert ATS properties from host to network byte order.
int GNUNET_ATS_address_del_session(struct GNUNET_ATS_AddressRecord *ar, struct GNUNET_ATS_Session *session)
A session was destroyed, disassociate it from the given address record.
void GNUNET_ATS_reserve_bandwidth_cancel(struct GNUNET_ATS_ReservationContext *rc)
Cancel request for reserving bandwidth.
void GNUNET_ATS_connectivity_done(struct GNUNET_ATS_ConnectivityHandle *ch)
Shutdown ATS connectivity suggestion client.
void GNUNET_ATS_performance_change_preference(struct GNUNET_ATS_PerformanceHandle *ph, const struct GNUNET_PeerIdentity *peer,...)
Change preferences for the given peer.
const char * GNUNET_ATS_print_preference_type(enum GNUNET_ATS_PreferenceKind type)
Convert a GNUNET_ATS_PreferenceType to a string.
struct GNUNET_ATS_ReservationContext * GNUNET_ATS_reserve_bandwidth(struct GNUNET_ATS_PerformanceHandle *ph, const struct GNUNET_PeerIdentity *peer, int32_t amount, GNUNET_ATS_ReservationCallback rcb, void *rcb_cls)
Reserve inbound bandwidth from the given peer.
void(* GNUNET_ATS_AddressSuggestionCallback)(void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
Signature of a function called by ATS with the current bandwidth and address preferences as determine...
struct GNUNET_ATS_AddressListHandle * GNUNET_ATS_performance_list_addresses(struct GNUNET_ATS_PerformanceHandle *ph, const struct GNUNET_PeerIdentity *peer, int all, GNUNET_ATS_AddressInformationCallback infocb, void *infocb_cls)
Get information about addresses known to the ATS subsystem.
void(* GNUNET_ATS_AddressInformationCallback)(void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop)
Signature of a function that is called with QoS information about an address.
void GNUNET_ATS_address_destroy(struct GNUNET_ATS_AddressRecord *ar)
An address got destroyed, stop using it as a valid address.
void(* GNUNET_ATS_ReservationCallback)(void *cls, const struct GNUNET_PeerIdentity *peer, int32_t amount, struct GNUNET_TIME_Relative res_delay)
Function called with reservation result.
GNUNET_ATS_PreferenceKind
Enum defining all known preference categories.
void GNUNET_ATS_scheduling_done(struct GNUNET_ATS_SchedulingHandle *sh)
Client is done with ATS scheduling, release resources.
struct GNUNET_ATS_AddressRecord * GNUNET_ATS_address_add(struct GNUNET_ATS_SchedulingHandle *sh, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, const struct GNUNET_ATS_Properties *prop)
We have a new address ATS should know.
void GNUNET_ATS_connectivity_suggest_cancel(struct GNUNET_ATS_ConnectivitySuggestHandle *sh)
We no longer care about being connected to a peer.
@ GNUNET_ATS_PREFERENCE_BANDWIDTH
Change the peer's bandwidth value (value per byte of bandwidth in the goal function) to the given amo...
@ GNUNET_ATS_PREFERENCE_LATENCY
Change the peer's latency value to the given amount.
@ GNUNET_ATS_PREFERENCE_END
End of preference list.
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
Definition: gnunet_nt_lib.h:36
static enum GNUNET_NetworkType scope
Which network scope do we belong to?
Linked list of pending reservations.
Information we track per address, incoming or outgoing.
struct GNUNET_ATS_Session * session
Session handle.
Handle to the ATS subsystem for connectivity management.
Handle for ATS address suggestion requests.
uint32_t strength
How urgent is the request.
ATS Handle to obtain and/or modify performance information.
void * addr_info_cb_cls
Closure for addr_info_cb.
ATS performance characteristics for an address in network byte order (for IPC).
uint32_t utilization_out
Actual traffic on this connection from this peer to the other peer.
uint32_t utilization_in
Actual traffic on this connection from the other peer to this peer.
struct GNUNET_TIME_RelativeNBO delay
Delay.
uint32_t distance
Distance on network layer (required for distance-vector routing) in hops.
uint32_t scope
Which network scope does the respective address belong to? This property does not change.
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.
enum GNUNET_NetworkType scope
Which network scope does the respective address belong to? This property does not change.
uint32_t utilization_out
Actual traffic on this connection from this peer to the other peer.
Linked list of pending reservations.
GNUNET_ATS_ReservationCallback rcb
Function to call on result.
void * rcb_cls
Closure for rcb.
Handle to the ATS subsystem for bandwidth/transport scheduling information.
void * suggest_cb_cls
Closure for suggest_cb.
GNUNET_ATS_AddressSuggestionCallback suggest_cb
Callback to invoke on suggestions.
Session handle for connections.
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
An address for communicating with a peer.
The identity of the host (wraps the signing key of the peer).
Time for relative time used by GNUnet, in microseconds and in network byte order.
Time for relative time used by GNUnet, in microseconds.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.