diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-06-07 11:59:48 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-06-07 11:59:48 +0000 |
commit | a819c7cd70f869e374dd2c515c19ff8cd4204359 (patch) | |
tree | e3c088f373e07a7f3a80f5151585ec2112c111a6 /src/ats/gnunet-service-ats-solver_proportional.h | |
parent | 72b84d59d89b0075537b1e749655278fe1ea5deb (diff) | |
download | gnunet-a819c7cd70f869e374dd2c515c19ff8cd4204359.tar.gz gnunet-a819c7cd70f869e374dd2c515c19ff8cd4204359.zip |
rename and cleanup due to writing docu
Diffstat (limited to 'src/ats/gnunet-service-ats-solver_proportional.h')
-rw-r--r-- | src/ats/gnunet-service-ats-solver_proportional.h | 174 |
1 files changed, 174 insertions, 0 deletions
diff --git a/src/ats/gnunet-service-ats-solver_proportional.h b/src/ats/gnunet-service-ats-solver_proportional.h new file mode 100644 index 000000000..b450c3a86 --- /dev/null +++ b/src/ats/gnunet-service-ats-solver_proportional.h | |||
@@ -0,0 +1,174 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2011 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-solver_proportional.h | ||
23 | * @brief ATS proportional solver | ||
24 | * @author Matthias Wachs | ||
25 | * @author Christian Grothoff | ||
26 | */ | ||
27 | #include "platform.h" | ||
28 | #include "gnunet_statistics_service.h" | ||
29 | #include "gnunet-service-ats_addresses.h" | ||
30 | |||
31 | /** | ||
32 | * ATS simplistic solver | ||
33 | * | ||
34 | * General description | ||
35 | */ | ||
36 | |||
37 | |||
38 | |||
39 | |||
40 | /** | ||
41 | * Init the simplistic problem solving component | ||
42 | * | ||
43 | * Quotas: | ||
44 | * network[i] contains the network type as type GNUNET_ATS_NetworkType[i] | ||
45 | * out_quota[i] contains outbound quota for network type i | ||
46 | * in_quota[i] contains inbound quota for network type i | ||
47 | * | ||
48 | * Example | ||
49 | * network = {GNUNET_ATS_NET_UNSPECIFIED, GNUNET_ATS_NET_LOOPBACK, GNUNET_ATS_NET_LAN, GNUNET_ATS_NET_WAN, GNUNET_ATS_NET_WLAN} | ||
50 | * network[2] == GNUNET_ATS_NET_LAN | ||
51 | * out_quota[2] == 65353 | ||
52 | * in_quota[2] == 65353 | ||
53 | * | ||
54 | * @param cfg configuration handle | ||
55 | * @param stats the GNUNET_STATISTICS handle | ||
56 | * @param network array of GNUNET_ATS_NetworkType with length dest_length | ||
57 | * @param out_quota array of outbound quotas | ||
58 | * @param in_quota array of outbound quota | ||
59 | * @param dest_length array length for quota arrays | ||
60 | * @param bw_changed_cb callback for changed bandwidth amounts | ||
61 | * @param bw_changed_cb_cls cls for callback | ||
62 | * @return handle for the solver on success, NULL on fail | ||
63 | */ | ||
64 | void * | ||
65 | GAS_proportional_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
66 | const struct GNUNET_STATISTICS_Handle *stats, | ||
67 | int *network, | ||
68 | unsigned long long *out_quota, | ||
69 | unsigned long long *in_quota, | ||
70 | int dest_length, | ||
71 | GAS_bandwidth_changed_cb bw_changed_cb, | ||
72 | void *bw_changed_cb_cls); | ||
73 | |||
74 | /** | ||
75 | * Shutdown the simplistic problem solving component | ||
76 | * | ||
77 | * @param solver the respective handle to shutdown | ||
78 | */ | ||
79 | void | ||
80 | GAS_proportional_done (void * solver); | ||
81 | |||
82 | /** | ||
83 | * Add a single address within a network to the solver | ||
84 | * | ||
85 | * @param solver the solver Handle | ||
86 | * @param addresses the address hashmap containing all addresses | ||
87 | * @param address the address to add | ||
88 | * @param network network type of this address | ||
89 | */ | ||
90 | void | ||
91 | GAS_simplistic_address_add (void *solver, | ||
92 | struct GNUNET_CONTAINER_MultiHashMap *addresses, | ||
93 | struct ATS_Address *address, | ||
94 | uint32_t network); | ||
95 | |||
96 | |||
97 | /** | ||
98 | * Updates a single address in the solve | ||
99 | * | ||
100 | * @param solver the solver Handle | ||
101 | * @param addresses the address hashmap containing all addresses | ||
102 | * @param address the update address | ||
103 | * @param session the new session (if changed otherwise current) | ||
104 | * @param in_use the new address in use state (if changed otherwise current) | ||
105 | * @param prev_ats the latest ATS information | ||
106 | * @param prev_atsi_count the atsi count | ||
107 | */ | ||
108 | void | ||
109 | GAS_simplistic_address_update (void *solver, | ||
110 | struct GNUNET_CONTAINER_MultiHashMap *addresses, | ||
111 | struct ATS_Address *address, | ||
112 | uint32_t session, | ||
113 | int in_use, | ||
114 | const struct GNUNET_ATS_Information *atsi, | ||
115 | uint32_t atsi_count); | ||
116 | |||
117 | |||
118 | /** | ||
119 | * Remove an address from the solver | ||
120 | * | ||
121 | * @param solver the solver handle | ||
122 | * @param addresses the address hashmap containing all addresses | ||
123 | * @param address the address to remove | ||
124 | * @param session_only delete only session not whole address | ||
125 | */ | ||
126 | void | ||
127 | GAS_simplistic_address_delete (void *solver, | ||
128 | struct GNUNET_CONTAINER_MultiHashMap * addresses, | ||
129 | struct ATS_Address *address, int session_only); | ||
130 | |||
131 | |||
132 | /** | ||
133 | * Stop notifying about address and bandwidth changes for this peer | ||
134 | * | ||
135 | * @param solver the MLP handle | ||
136 | * @param addresses address hashmap | ||
137 | * @param peer the peer | ||
138 | */ | ||
139 | void | ||
140 | GAS_simplistic_stop_get_preferred_address (void *solver, | ||
141 | struct GNUNET_CONTAINER_MultiHashMap *addresses, | ||
142 | const struct GNUNET_PeerIdentity *peer); | ||
143 | |||
144 | /** | ||
145 | * Get the prefered address for a specific peer | ||
146 | * | ||
147 | * @param solver the solver handle | ||
148 | * @param addresses the address hashmap containing all addresses | ||
149 | * @param peer the identity of the peer | ||
150 | */ | ||
151 | const struct ATS_Address * | ||
152 | GAS_simplistic_get_preferred_address (void *solver, | ||
153 | struct GNUNET_CONTAINER_MultiHashMap * addresses, | ||
154 | const struct GNUNET_PeerIdentity *peer); | ||
155 | |||
156 | |||
157 | /** | ||
158 | * Changes the preferences for a peer in the problem | ||
159 | * | ||
160 | * @param solver the solver handle | ||
161 | * @param client the client with this preference | ||
162 | * @param peer the peer to change the preference for | ||
163 | * @param kind the kind to change the preference | ||
164 | * @param score the score | ||
165 | */ | ||
166 | void | ||
167 | GAS_simplistic_address_change_preference (void *solver, | ||
168 | void *client, | ||
169 | const struct GNUNET_PeerIdentity *peer, | ||
170 | enum GNUNET_ATS_PreferenceKind kind, | ||
171 | float score); | ||
172 | |||
173 | |||
174 | /* end of gnunet-service-ats-solver_proportional.c */ | ||