GNUnet  0.19.4
gnunet_ats_plugin.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2009-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  */
20 
40 #ifndef PLUGIN_ATS_H
41 #define PLUGIN_ATS_H
42 
43 
44 #include "gnunet_ats_service.h"
46 
50 struct ATS_Address;
51 
62 typedef void
64  const struct GNUNET_PeerIdentity *peer,
65  enum GNUNET_ATS_PreferenceKind kind,
66  double pref_rel);
67 
68 
79 typedef void
81  struct GNUNET_SERVICE_Client *
82  application,
83  const struct
85  const struct GNUNET_TIME_Relative
86  scope,
87  enum GNUNET_ATS_PreferenceKind kind,
88  double score);
89 
96 typedef void
97 (*GAS_solver_bulk_start) (void *solver);
98 
99 
106 typedef void
107 (*GAS_solver_bulk_stop) (void *solver);
108 
109 
117 typedef void
118 (*GAS_solver_address_add) (void *solver,
119  struct ATS_Address *address,
120  uint32_t network);
121 
122 
129 typedef void
130 (*GAS_solver_address_delete) (void *solver,
131  struct ATS_Address *address);
132 
133 
140 typedef void
141 (*GAS_solver_address_property_changed) (void *solver,
142  struct ATS_Address *address);
143 
144 
151 typedef void
152 (*GAS_solver_get_preferred_address) (void *solver,
153  const struct GNUNET_PeerIdentity *peer);
154 
155 
162 typedef void
164  const struct
166 
167 
175 {
179  void *cls;
180 
187 
192 
201 
209 
216 
221 
226 
237 
245 };
246 
247 
259 {
264 
269 
274 
279 
285 
291 
297 
303 
309 
315 };
316 
317 
322 {
327 
332 };
333 
334 
339 {
344 
350 
356 
361 
366 };
367 
368 
376 typedef void
377 (*GAS_solver_information_callback) (void *cls,
379  enum GAS_Solver_Status stat,
381 
382 
388 typedef void
389 (*GAS_bandwidth_changed_cb) (void *cls,
390  struct ATS_Address *address);
391 
392 
402 typedef const double *
403 (*GAS_get_preferences) (void *cls,
404  const struct GNUNET_PeerIdentity *id);
405 
406 
416 typedef unsigned int
417 (*GAS_get_connectivity) (void *cls,
418  const struct GNUNET_PeerIdentity *id);
419 
420 
427 {
432 
437 
441  void *cls;
442 
447 
452 
457 
462 
468 
473  unsigned int network_count;
474 
479  unsigned long long out_quota[GNUNET_NT_COUNT];
480 
485  unsigned long long in_quota[GNUNET_NT_COUNT];
486 };
487 
488 #endif
489  /* end of group */
491  /* end of group addition */
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
static char * address
GNS address for this phone.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
Automatic transport selection and outbound bandwidth determination.
#define GNUNET_NT_COUNT
API to create, modify and access statistics.
void(* GAS_solver_address_change_preference)(void *solver, const struct GNUNET_PeerIdentity *peer, enum GNUNET_ATS_PreferenceKind kind, double pref_rel)
Change the preference for a peer.
void(* GAS_solver_address_feedback_preference)(void *solver, struct GNUNET_SERVICE_Client *application, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_TIME_Relative scope, enum GNUNET_ATS_PreferenceKind kind, double score)
Give feedback about the current assignment.
void(* GAS_solver_address_delete)(void *solver, struct ATS_Address *address)
Delete an address or just the session from the solver.
void(* GAS_solver_bulk_start)(void *solver)
Notify the solver about a bulk operation changing possibly a lot of values Solver will not resolve un...
void(* GAS_solver_address_property_changed)(void *solver, struct ATS_Address *address)
Transport properties for this address have changed.
void(* GAS_solver_information_callback)(void *cls, enum GAS_Solver_Operation op, enum GAS_Solver_Status stat, enum GAS_Solver_Additional_Information)
Callback to call with additional information Used for measurement.
void(* GAS_solver_address_add)(void *solver, struct ATS_Address *address, uint32_t network)
Add a single address within a network to the solver.
void(* GAS_bandwidth_changed_cb)(void *cls, struct ATS_Address *address)
Callback to call from solver when bandwidth for address has changed.
GAS_Solver_Status
Status of a GAS_Solver_Operation operation.
const double *(* GAS_get_preferences)(void *cls, const struct GNUNET_PeerIdentity *id)
Callback to call from solver to obtain application preference values for a peer.
unsigned int(* GAS_get_connectivity)(void *cls, const struct GNUNET_PeerIdentity *id)
Callback to call from solver to obtain application connectivity preferences for a peer.
GAS_Solver_Operation
Operation codes for solver information callback.
void(* GAS_solver_get_preferred_address)(void *solver, const struct GNUNET_PeerIdentity *peer)
Get the preferred address for a peer from solver.
void(* GAS_solver_bulk_stop)(void *solver)
Mark a bulk operation as done Solver will resolve if values have changed.
void(* GAS_solver_stop_get_preferred_address)(void *solver, const struct GNUNET_PeerIdentity *peer)
Stop getting the preferred address for a peer from solver.
GAS_Solver_Additional_Information
Status of the operation.
@ GAS_STAT_SUCCESS
Success.
@ GAS_STAT_FAIL
Failure.
@ GAS_OP_SOLVE_UPDATE_NOTIFICATION_START
After the problem was finished, start notifications about changes to addresses.
@ GAS_OP_SOLVE_MLP_LP_STOP
Solving of the LP problem is done MLP solver only.
@ GAS_OP_SOLVE_START
A solution iteration has been started.
@ GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP
After the problem was finished, notifications about changes to addresses are done.
@ GAS_OP_SOLVE_MLP_LP_START
Solving of the LP problem was started MLP solver only.
@ GAS_OP_SOLVE_SETUP_STOP
The setup of the problem as a preparation to solve is finished.
@ GAS_OP_SOLVE_MLP_MLP_STOP
Solving of the MLP problem is done MLP solver only.
@ GAS_OP_SOLVE_SETUP_START
The setup of the problem as a preparation to solve it was started.
@ GAS_OP_SOLVE_MLP_MLP_START
Solving of the MLP problem was started MLP solver only.
@ GAS_OP_SOLVE_STOP
A solution iteration has been finished.
@ GAS_INFO_PROP_ALL
The proportional solver had to recalculate for all networks.
@ GAS_INFO_PROP_SINGLE
The proportional solver had to recalculate for a single network.
@ GAS_INFO_UPDATED
An existing solution was reused Quite specific to the MLP solver.
@ GAS_INFO_NONE
No more specific information.
@ GAS_INFO_FULL
A full solution process is performed Quite specific to the MLP solver.
GNUNET_ATS_PreferenceKind
Enum defining all known preference categories.
static enum GNUNET_NetworkType scope
Which network scope do we belong to?
Address with additional information.
The ATS plugin will pass a pointer to a struct of this type as to the initialization function of the ...
void * cls
Closure to pass to all callbacks in this struct.
GAS_solver_information_callback info_cb
Callback for solver to call with status information, can be NULL.
GAS_get_preferences get_preferences
ATS addresses function to obtain preference values.
unsigned long long in_quota[6]
Array of configured inbound quotas Order according to networks in network array.
struct GNUNET_CONTAINER_MultiPeerMap * addresses
Hashmap containing all addresses available.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration handle to be used by the solver.
GAS_get_connectivity get_connectivity
ATS addresses function to obtain preference values.
unsigned int network_count
Number of networks available, size of the out_quota and in_quota arrays.
GAS_bandwidth_changed_cb bandwidth_changed_cb
ATS addresses callback to be notified about bandwidth assignment changes.
struct GNUNET_STATISTICS_Handle * stats
Statistics handle to be used by the solver.
unsigned long long out_quota[6]
Array of configured outbound quotas Order according to networks in network array.
GAS_solver_address_feedback_preference s_feedback
Give feedback about the current assignment.
GAS_solver_address_property_changed s_address_update_property
Update the properties of an address in the solver.
GAS_solver_address_add s_add
Add a new address for a peer to the solver.
void * cls
Closure to pass to all solver functions in this struct.
GAS_solver_bulk_start s_bulk_start
Start a bulk operation.
GAS_solver_get_preferred_address s_get
Tell solver to notify ATS if the address to use changes for a specific peer using the bandwidth chang...
GAS_solver_bulk_stop s_bulk_stop
Bulk operation done.
GAS_solver_address_change_preference s_pref
Change relative preference for quality in solver.
GAS_solver_stop_get_preferred_address s_get_stop
Tell solver stop notifying ATS about changes for this peers.
GAS_solver_address_delete s_del
Delete an address in the solver.
Internal representation of the hash map.
The identity of the host (wraps the signing key of the peer).
Handle to a client that is connected to a service.
Definition: service.c:252
Handle for the service.
Time for relative time used by GNUnet, in microseconds.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.