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 
77 
84  uint32_t utilization_out;
85 
92  uint32_t utilization_in;
93 
98  unsigned int distance;
99 
105 };
106 
107 
120 
128 
134 
140 
146 };
147 
148 
149 
150 /* ********************* LAN Characterization library ************************ */
151 /* Note: these functions do not really communicate with the ATS service */
152 
153 
160 void
162  const struct GNUNET_ATS_Properties *hbo);
163 
164 
171 void
173  const struct GNUNET_ATS_PropertiesNBO *nbo);
174 
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
232 
233 
234 /* ******************************** Scheduling API ***************************** */
235 
240 
244 struct GNUNET_ATS_Session;
245 
246 
263 typedef void
265  const struct GNUNET_PeerIdentity *peer,
266  const struct GNUNET_HELLO_Address *address,
267  struct GNUNET_ATS_Session *session,
268  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
269  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in);
270 
271 
283  void *suggest_cb_cls);
284 
285 
291 void
293 
294 
299 
300 
315  const struct GNUNET_HELLO_Address *address,
316  struct GNUNET_ATS_Session *session,
317  const struct GNUNET_ATS_Properties *prop);
318 
319 
326 void
328  struct GNUNET_ATS_Session *session);
329 
330 
343 int
345  struct GNUNET_ATS_Session *session);
346 
347 
361 void
363  const struct GNUNET_ATS_Properties *prop);
364 
365 
372 void
374 
375 
376 
377 /* ******************************** Performance API ***************************** */
378 
383 
399 typedef void
401  const struct GNUNET_HELLO_Address *address,
402  int address_active,
403  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
404  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
405  const struct GNUNET_ATS_Properties *prop);
406 
407 
412 
413 
426  void *addr_info_cb_cls);
427 
428 
443  const struct GNUNET_PeerIdentity *peer,
444  int all,
446  void *infocb_cls);
447 
448 
454 void
456 
457 
463 void
465 
466 
477 typedef void
479  const struct GNUNET_PeerIdentity *peer,
480  int32_t amount,
481  struct GNUNET_TIME_Relative res_delay);
482 
483 
488 
489 
506  const struct GNUNET_PeerIdentity *peer,
507  int32_t amount,
509  void *rcb_cls);
510 
511 
517 void
519 
520 
524 #define GNUNET_ATS_PreferenceType { GNUNET_ATS_PREFERENCE_BANDWIDTH, GNUNET_ATS_PREFERENCE_LATENCY, GNUNET_ATS_PREFERENCE_END }
525 
529 #define GNUNET_ATS_PreferenceTypeString { "BANDWIDTH", "LATENCY", "END" }
530 
542 
551 
556 };
557 
558 
565 const char *
567 
568 
577 void
579  const struct GNUNET_PeerIdentity *peer,
580  ...);
581 
582 
600 void
602  const struct GNUNET_PeerIdentity *peer,
603  const struct GNUNET_TIME_Relative scope,
604  ...);
605 
606 #endif
607  /* end of group */
609 
610 /* 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:83
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.