GNUnet  0.19.3
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  */
37 #ifndef GNUNET_ATS_SERVICE_H
38 #define GNUNET_ATS_SERVICE_H
39 
40 
41 #include "gnunet_constants.h"
42 #include "gnunet_util_lib.h"
43 #include "gnunet_hello_lib.h"
44 
45 
49 #define GNUNET_ATS_DefaultBandwidth 65536
50 
54 #define GNUNET_ATS_VALUE_UNDEFINED UINT32_MAX
55 
59 #define GNUNET_ATS_VALUE_UNDEFINED_STR "undefined"
60 
64 #define GNUNET_ATS_MaxBandwidth UINT32_MAX
65 
69 #define GNUNET_ATS_MaxBandwidthString "unlimited"
70 
71 
76 {
82 
89  uint32_t utilization_out;
90 
97  uint32_t utilization_in;
98 
103  unsigned int distance;
104 
110 };
111 
112 
118 {
126 
134 
140 
146 
152 };
153 
154 
155 /* ********************* LAN Characterization library ************************ */
156 /* Note: these functions do not really communicate with the ATS service */
157 
158 
165 void
167  const struct GNUNET_ATS_Properties *hbo);
168 
169 
176 void
178  const struct GNUNET_ATS_PropertiesNBO *nbo);
179 
180 
181 /* ********************Connection Suggestion API ***************************** */
182 
188 
193 
194 
203 
204 
210 void
212 
213 
225  const struct GNUNET_PeerIdentity *peer,
226  uint32_t strength);
227 
228 
234 void
237 
238 
239 /* ******************************** Scheduling API ***************************** */
240 
245 
249 struct GNUNET_ATS_Session;
250 
251 
268 typedef void
270  const struct GNUNET_PeerIdentity *peer,
271  const struct
273  struct GNUNET_ATS_Session *session,
275  bandwidth_out,
277  bandwidth_in);
278 
279 
291  void *suggest_cb_cls);
292 
293 
299 void
301 
302 
307 
308 
323  const struct GNUNET_HELLO_Address *address,
324  struct GNUNET_ATS_Session *session,
325  const struct GNUNET_ATS_Properties *prop);
326 
327 
334 void
336  struct GNUNET_ATS_Session *session);
337 
338 
351 int
353  struct GNUNET_ATS_Session *session);
354 
355 
369 void
371  const struct GNUNET_ATS_Properties *prop);
372 
373 
380 void
382 
383 
384 /* ******************************** Performance API ***************************** */
385 
390 
406 typedef void
408  const struct
410  int address_active,
412  bandwidth_out,
414  bandwidth_in,
415  const struct
416  GNUNET_ATS_Properties *prop);
417 
418 
423 
424 
437  void *addr_info_cb_cls);
438 
439 
454  const struct GNUNET_PeerIdentity *peer,
455  int all,
457  infocb,
458  void *infocb_cls);
459 
460 
466 void
469 
470 
476 void
478 
479 
490 typedef void
491 (*GNUNET_ATS_ReservationCallback) (void *cls,
492  const struct GNUNET_PeerIdentity *peer,
493  int32_t amount,
494  struct GNUNET_TIME_Relative res_delay);
495 
496 
501 
502 
519  const struct GNUNET_PeerIdentity *peer,
520  int32_t amount,
522  void *rcb_cls);
523 
524 
530 void
532 
533 
537 #define GNUNET_ATS_PreferenceType { GNUNET_ATS_PREFERENCE_BANDWIDTH, \
538  GNUNET_ATS_PREFERENCE_LATENCY, \
539  GNUNET_ATS_PREFERENCE_END }
540 
544 #define GNUNET_ATS_PreferenceTypeString { "BANDWIDTH", "LATENCY", "END" }
545 
550 {
558 
567 
572 };
573 
574 
581 const char *
583 
584 
594 void
597  const struct
599  ...);
600 
601 
619 void
621  const struct GNUNET_PeerIdentity *peer,
622  const struct GNUNET_TIME_Relative scope,
623  ...);
624 
625 #endif
626  /* end of group */
628  /* end of Backbone addition */
630 
631 /* 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.
Helper library for handling HELLOs.
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 an enum 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.
#define GNUNET_PACKED
gcc-ism to get packed structs.
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
Definition: gnunet_nt_lib.h:39
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.