aboutsummaryrefslogtreecommitdiff
path: root/src/ats/gnunet-service-ats_plugins.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-05 12:52:20 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-05 12:52:20 +0000
commitc55971f17dc99f9833af48e078c8f681be771cb7 (patch)
tree544fd671b67903506419c98d463d086a696e25a1 /src/ats/gnunet-service-ats_plugins.h
parent15dd8e6cc1199d611d804853e134882bf13b234a (diff)
downloadgnunet-c55971f17dc99f9833af48e078c8f681be771cb7.tar.gz
gnunet-c55971f17dc99f9833af48e078c8f681be771cb7.zip
big ATS refactoring, no serious semantic changes should stem from this
Diffstat (limited to 'src/ats/gnunet-service-ats_plugins.h')
-rw-r--r--src/ats/gnunet-service-ats_plugins.h163
1 files changed, 163 insertions, 0 deletions
diff --git a/src/ats/gnunet-service-ats_plugins.h b/src/ats/gnunet-service-ats_plugins.h
new file mode 100644
index 000000000..a31024b1b
--- /dev/null
+++ b/src/ats/gnunet-service-ats_plugins.h
@@ -0,0 +1,163 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011-2014 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 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 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21/**
22 * @file ats/gnunet-service-ats_plugins.h
23 * @brief ats service plugin management
24 * @author Matthias Wachs
25 * @author Christian Grothoff
26 */
27#ifndef GNUNET_SERVICE_ATS_PLUGINS_H
28#define GNUNET_SERVICE_ATS_PLUGINS_H
29
30#include "gnunet_util_lib.h"
31#include "gnunet_ats_service.h"
32#include "gnunet-service-ats.h"
33#include "gnunet_statistics_service.h"
34#include "ats.h"
35
36
37/**
38 * Available ressource assignment modes
39 */
40enum ATS_Mode
41{
42 /**
43 * proportional mode:
44 *
45 * Assign each peer an equal amount of bandwidth (bw)
46 *
47 * bw_per_peer = bw_total / #active addresses
48 */
49 MODE_PROPORTIONAL,
50
51 /**
52 * MLP mode:
53 *
54 * Solve ressource assignment as an optimization problem
55 * Uses an mixed integer programming solver
56 */
57 MODE_MLP,
58
59 /**
60 * Reinforcement Learning mode:
61 *
62 * Solve resource assignment using a learning agent
63 */
64 MODE_RIL
65};
66
67
68/**
69 * Initialize address subsystem. The addresses subsystem manages the addresses
70 * known and current performance information. It has a solver component
71 * responsible for the resource allocation. It tells the solver about changes
72 * and receives updates when the solver changes the ressource allocation.
73 *
74 * @param cfg configuration to use
75 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error (failed to load
76 * solver plugin)
77 */
78int
79GAS_plugins_init (const struct GNUNET_CONFIGURATION_Handle *cfg);
80
81
82/**
83 * Shutdown address subsystem.
84 */
85void
86GAS_plugins_done (void);
87
88
89/**
90 * The preference changed for a peer, update solver.
91 *
92 * @param peer the peer
93 * @param kind the ATS kind
94 * @param pref_rel the new relative preference value
95 */
96void
97GAS_normalized_preference_changed (const struct GNUNET_PeerIdentity *peer,
98 enum GNUNET_ATS_PreferenceKind kind,
99 double pref_rel);
100
101
102/**
103 * The relative value for a property changed
104 *
105 * @param address the peer
106 * @param type the ATS type
107 * @param prop_rel the new relative preference value
108 */
109void
110GAS_normalized_property_changed (struct ATS_Address *address,
111 uint32_t type,
112 double prop_rel);
113
114
115void
116GAS_plugin_new_address (struct ATS_Address *new_address,
117 enum GNUNET_ATS_Network_Type addr_net,
118 const struct GNUNET_ATS_Information *atsi,
119 uint32_t atsi_count);
120
121
122void
123GAS_plugin_update_address (struct ATS_Address *address,
124 const struct GNUNET_ATS_Information *atsi,
125 uint32_t atsi_count);
126
127
128void
129GAS_plugin_update_preferences (void *client,
130 const struct GNUNET_PeerIdentity *peer,
131 enum GNUNET_ATS_PreferenceKind kind,
132 float score_abs);
133
134
135void
136GAS_plugin_preference_feedback (void *application,
137 const struct GNUNET_PeerIdentity *peer,
138 const struct GNUNET_TIME_Relative scope,
139 enum GNUNET_ATS_PreferenceKind kind,
140 float score_abs);
141
142
143void
144GAS_plugin_delete_address (struct ATS_Address *address);
145
146
147void
148GAS_plugin_request_connect_start (const struct GNUNET_PeerIdentity *pid);
149
150
151void
152GAS_plugin_request_connect_stop (const struct GNUNET_PeerIdentity *pid);
153
154
155void
156GAS_plugin_solver_lock (void);
157
158
159void
160GAS_plugin_solver_unlock (void);
161
162
163#endif