GNUnet  0.10.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 {
73 
79 
86  uint32_t utilization_out;
87 
94  uint32_t utilization_in;
95 
100  unsigned int distance;
101 
107 
108 };
109 
110 
116 {
117 
125 
133 
139 
145 
151 
152 };
153 
154 
155 
156 /* ********************* LAN Characterization library ************************ */
157 /* Note: these functions do not really communicate with the ATS service */
158 
159 
166 void
168  const struct GNUNET_ATS_Properties *hbo);
169 
170 
177 void
179  const struct GNUNET_ATS_PropertiesNBO *nbo);
180 
181 
182 
183 /* ********************Connection Suggestion API ***************************** */
184 
190 
195 
196 
205 
206 
212 void
214 
215 
227  const struct GNUNET_PeerIdentity *peer,
228  uint32_t strength);
229 
230 
236 void
238 
239 
240 /* ******************************** Scheduling API ***************************** */
241 
246 
250 struct GNUNET_ATS_Session;
251 
252 
269 typedef void
271  const struct GNUNET_PeerIdentity *peer,
272  const struct GNUNET_HELLO_Address *address,
273  struct GNUNET_ATS_Session *session,
274  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
275  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in);
276 
277 
289  void *suggest_cb_cls);
290 
291 
297 void
299 
300 
305 
306 
321  const struct GNUNET_HELLO_Address *address,
322  struct GNUNET_ATS_Session *session,
323  const struct GNUNET_ATS_Properties *prop);
324 
325 
332 void
334  struct GNUNET_ATS_Session *session);
335 
336 
349 int
351  struct GNUNET_ATS_Session *session);
352 
353 
367 void
369  const struct GNUNET_ATS_Properties *prop);
370 
371 
378 void
380 
381 
382 
383 /* ******************************** Performance API ***************************** */
384 
389 
405 typedef void
407  const struct GNUNET_HELLO_Address *address,
408  int address_active,
409  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
410  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
411  const struct GNUNET_ATS_Properties *prop);
412 
413 
418 
419 
432  void *addr_info_cb_cls);
433 
434 
449  const struct GNUNET_PeerIdentity *peer,
450  int all,
452  void *infocb_cls);
453 
454 
460 void
462 
463 
469 void
471 
472 
483 typedef void
485  const struct GNUNET_PeerIdentity *peer,
486  int32_t amount,
487  struct GNUNET_TIME_Relative res_delay);
488 
489 
494 
495 
512  const struct GNUNET_PeerIdentity *peer,
513  int32_t amount,
515  void *rcb_cls);
516 
517 
523 void
525 
526 
530 #define GNUNET_ATS_PreferenceType {GNUNET_ATS_PREFERENCE_BANDWIDTH, GNUNET_ATS_PREFERENCE_LATENCY, GNUNET_ATS_PREFERENCE_END}
531 
535 #define GNUNET_ATS_PreferenceTypeString {"BANDWIDTH", "LATENCY", "END" }
536 
541 {
542 
550 
559 
564 
565 };
566 
567 
574 const char *
576 
577 
586 void
588  const struct GNUNET_PeerIdentity *peer,
589  ...);
590 
591 
609 void
611  const struct GNUNET_PeerIdentity *peer,
612  const struct GNUNET_TIME_Relative scope,
613  ...);
614 
615 #endif
616  /* end of group */
618 
619 /* end of file gnunet-service-transport_ats.h */
static struct GNUNET_CADET_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
Handle to the ATS subsystem for bandwidth/transport scheduling information.
uint32_t utilization_in
Actual traffic on this connection from the other peer to this peer.
static struct GNUNET_ATS_PerformanceHandle * ph
ATS performance handle used.
Definition: gnunet-ats.c:116
GNUNET_ATS_ReservationCallback rcb
Function to call on result.
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.
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.
void * rcb_cls
Closure for rcb.
void GNUNET_ATS_scheduling_done(struct GNUNET_ATS_SchedulingHandle *sh)
Client is done with ATS scheduling, release resources.
void GNUNET_ATS_performance_done(struct GNUNET_ATS_PerformanceHandle *ph)
Client is done using the ATS performance subsystem, release resources.
void GNUNET_ATS_connectivity_suggest_cancel(struct GNUNET_ATS_ConnectivitySuggestHandle *sh)
We no longer care about being connected to a peer.
Time for relative time used by GNUnet, in microseconds and in network 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_ReservationCallback)(void *cls, const struct GNUNET_PeerIdentity *peer, int32_t amount, struct GNUNET_TIME_Relative res_delay)
Function called with reservation result.
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.
ATS performance characteristics for an address.
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
Definition: gnunet_nt_lib.h:35
Linked list of pending reservations.
End of preference list.
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...
uint32_t strength
How urgent is the request.
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.
static struct GNUNET_ATS_AddressListHandle * alh
ATS address list handle used.
Definition: gnunet-ats.c:131
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 * suggest_cb_cls
Closure for suggest_cb.
Information about ongoing sessions of the transport client.
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.
static struct SolverHandle * sh
Handle for ATS address suggestion requests.
struct GNUNET_TIME_Relative delay
Delay.
Information we track per address, incoming or outgoing.
const char * GNUNET_ATS_print_preference_type(enum GNUNET_ATS_PreferenceKind type)
Convert a GNUNET_ATS_PreferenceType to a string.
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.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
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_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.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
Change the peer&#39;s latency value to the given amount.
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
ATS Handle to obtain and/or modify performance information.
static void suggest_cb(void *cls, const struct GNUNET_PeerIdentity *pid, const char *address)
Function called by the solver to prompt the transport to try out a new address.
enum GNUNET_NetworkType scope
Which network scope does the respective address belong to? This property does not change...
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.
The identity of the host (wraps the signing key of the peer).
void GNUNET_ATS_reserve_bandwidth_cancel(struct GNUNET_ATS_ReservationContext *rc)
Cancel request for reserving bandwidth.
#define GNUNET_PACKED
gcc-ism to get packed structs.
configuration data
Definition: configuration.c:85
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_change_preference(struct GNUNET_ATS_PerformanceHandle *ph, const struct GNUNET_PeerIdentity *peer,...)
Change preferences for the given peer.
An address for communicating with a peer.
void GNUNET_ATS_performance_list_addresses_cancel(struct GNUNET_ATS_AddressListHandle *alh)
Cancel a pending address listing operation.
void GNUNET_ATS_address_destroy(struct GNUNET_ATS_AddressRecord *ar)
An address got destroyed, stop using it as a valid address.
Change the peer&#39;s bandwidth value (value per byte of bandwidth in the goal function) to the given amo...
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.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
void GNUNET_ATS_address_add_session(struct GNUNET_ATS_AddressRecord *ar, struct GNUNET_ATS_Session *session)
An address was used to initiate a session.
GNUNET_ATS_PreferenceKind
Enum defining all known preference categories.
ATS performance characteristics for an address in network byte order (for IPC).
Handle to the ATS subsystem for connectivity management.
void GNUNET_ATS_connectivity_done(struct GNUNET_ATS_ConnectivityHandle *ch)
Shutdown ATS connectivity suggestion client.
unsigned int distance
Distance on network layer (required for distance-vector routing) in hops.
static char * address
GNS address for this phone.
void * addr_info_cb_cls
Closure for addr_info_cb.
Time for relative time used by GNUnet, in microseconds.
uint32_t utilization_out
Actual traffic on this connection from this peer to the other peer.
Linked list of pending reservations.