aboutsummaryrefslogtreecommitdiff
path: root/src/ats
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-07-04 15:27:59 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-07-04 15:27:59 +0000
commit9bde041f15f890cb36d67cc0d085e6bc143112cb (patch)
treeb34c08077c07e1fe6a338263e29084d2b42a871f /src/ats
parent0151f4b4c92002f7f3e712d1d0bce3d7b2077312 (diff)
downloadgnunet-9bde041f15f890cb36d67cc0d085e6bc143112cb.tar.gz
gnunet-9bde041f15f890cb36d67cc0d085e6bc143112cb.zip
major change to solver api: split _update function since it combined 3 different functionalities
proportional almost done, mlp to do
Diffstat (limited to 'src/ats')
-rw-r--r--src/ats/gnunet-service-ats-solver_mlp.c67
-rw-r--r--src/ats/gnunet-service-ats-solver_mlp.h49
-rw-r--r--src/ats/gnunet-service-ats-solver_proportional.c286
-rw-r--r--src/ats/gnunet-service-ats-solver_proportional.h41
-rw-r--r--src/ats/gnunet-service-ats_addresses.c242
-rw-r--r--src/ats/gnunet-service-ats_addresses.h42
-rw-r--r--src/ats/gnunet-service-ats_normalization.c2
-rw-r--r--src/ats/gnunet-service-ats_normalization.h2
-rw-r--r--src/ats/test_ats_api.conf1
9 files changed, 396 insertions, 336 deletions
diff --git a/src/ats/gnunet-service-ats-solver_mlp.c b/src/ats/gnunet-service-ats-solver_mlp.c
index 1e2237eee..5a7fbfc78 100644
--- a/src/ats/gnunet-service-ats-solver_mlp.c
+++ b/src/ats/gnunet-service-ats-solver_mlp.c
@@ -1401,6 +1401,45 @@ mlp_update_quality (struct GAS_MLP_Handle *mlp,
1401 mlp->mlp_prob_updated = GNUNET_YES; 1401 mlp->mlp_prob_updated = GNUNET_YES;
1402} 1402}
1403 1403
1404void
1405GAS_mlp_address_property_changed (void *solver,
1406 struct ATS_Address *address,
1407 uint32_t type,
1408 uint32_t abs_value,
1409 double rel_value)
1410{
1411 GNUNET_break (0);
1412}
1413
1414
1415void
1416GAS_mlp_address_session_changed (void *solver,
1417 struct ATS_Address *address,
1418 uint32_t cur_session,
1419 uint32_t new_session)
1420{
1421 GNUNET_break (0);
1422}
1423
1424void
1425GAS_mlp_address_inuse_changed (void *solver,
1426 struct ATS_Address *address,
1427 uint32_t session,
1428 int in_use)
1429{
1430 GNUNET_break (0);
1431}
1432
1433
1434void
1435GAS_mlp_address_change_network (void *solver,
1436 struct ATS_Address *address,
1437 uint32_t current_network,
1438 uint32_t new_network)
1439{
1440 GNUNET_break (0);
1441}
1442
1404/** 1443/**
1405 * Updates a single address in the MLP problem 1444 * Updates a single address in the MLP problem
1406 * 1445 *
@@ -1432,6 +1471,7 @@ GAS_mlp_address_update (void *solver,
1432 struct ATS_Peer *p; 1471 struct ATS_Peer *p;
1433 struct GAS_MLP_Handle *mlp = solver; 1472 struct GAS_MLP_Handle *mlp = solver;
1434 struct MLP_information *mlpi = address->solver_information; 1473 struct MLP_information *mlpi = address->solver_information;
1474 int c1;
1435 1475
1436 GNUNET_assert (NULL != solver); 1476 GNUNET_assert (NULL != solver);
1437 GNUNET_assert (NULL != address); 1477 GNUNET_assert (NULL != address);
@@ -1442,22 +1482,37 @@ GAS_mlp_address_update (void *solver,
1442 LOG (GNUNET_ERROR_TYPE_ERROR, _("Updating address for peer `%s' not added before\n"), GNUNET_i2s(&address->peer)); 1482 LOG (GNUNET_ERROR_TYPE_ERROR, _("Updating address for peer `%s' not added before\n"), GNUNET_i2s(&address->peer));
1443 return; 1483 return;
1444 } 1484 }
1445 mlp_update_quality (mlp, mlp->addresses, address, prev_atsi, prev_atsi_count); 1485
1486 if (address->session_id != prev_session)
1487 {
1488 /* Session changed */
1489
1490 }
1491 if ((NULL != prev_atsi) && (0 != prev_atsi_count))
1492 {
1493 /* Properties changed */
1494 for (c1 = 0; c1 < prev_atsi_count; c1++ )
1495 {
1496 LOG (GNUNET_ERROR_TYPE_DEBUG, "Updating `%s'\n",
1497 GNUNET_ATS_print_property_type (ntohl(prev_atsi[c1].type)));
1498 //mlp->get_properties (mlp->get_properties_cls );
1499 }
1500 //mlp_update_quality (mlp, mlp->addresses, address, prev_atsi, prev_atsi_count);
1501 }
1446 1502
1447 /* Is this peer included in the problem? */ 1503 /* Is this peer included in the problem? */
1448 if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &address->peer.hashPubKey))) 1504 if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &address->peer.hashPubKey)))
1449 { 1505 {
1450 LOG (GNUNET_ERROR_TYPE_DEBUG, "Updating address for peer `%s' without address request \n", GNUNET_i2s(&address->peer)); 1506 LOG (GNUNET_ERROR_TYPE_DEBUG, "Updating address for peer `%s' without address request \n",
1507 GNUNET_i2s(&address->peer));
1451 return; 1508 return;
1452 } 1509 }
1453 LOG (GNUNET_ERROR_TYPE_DEBUG, "Updating address for peer `%s' with address request \n", GNUNET_i2s(&address->peer)); 1510 LOG (GNUNET_ERROR_TYPE_DEBUG, "Updating address for peer `%s' with address request \n",
1454 1511 GNUNET_i2s(&address->peer));
1455 /* Problem size changed: new address for peer with pending request */
1456 mlp->mlp_prob_updated = GNUNET_YES; 1512 mlp->mlp_prob_updated = GNUNET_YES;
1457 1513
1458 if (GNUNET_YES == mlp->mlp_auto_solve) 1514 if (GNUNET_YES == mlp->mlp_auto_solve)
1459 GAS_mlp_solve_problem (solver); 1515 GAS_mlp_solve_problem (solver);
1460 return;
1461} 1516}
1462 1517
1463/** 1518/**
diff --git a/src/ats/gnunet-service-ats-solver_mlp.h b/src/ats/gnunet-service-ats-solver_mlp.h
index 3771bd2ce..9a8b8efdf 100644
--- a/src/ats/gnunet-service-ats-solver_mlp.h
+++ b/src/ats/gnunet-service-ats-solver_mlp.h
@@ -415,34 +415,31 @@ GAS_mlp_address_add (void *solver,
415 struct ATS_Address *address, 415 struct ATS_Address *address,
416 uint32_t network); 416 uint32_t network);
417 417
418/**
419 * Updates a single address in the MLP problem
420 *
421 * If the address did not exist before in the problem:
422 * The MLP problem has to be recreated and the problem has to be resolved
423 *
424 * ATS performance information in address are already updated, delta + previous
425 * values are included in atsi_prev (value GNUNET_ATS_VALUE_UNDEFINED if not existing before)
426 *
427 * Otherwise the addresses' values can be updated and the existing base can
428 * be reused
429 *
430 * @param solver the solver Handle
431 * @param addresses the address hashmap containing all addresses
432 * @param address the update address
433 * @param prev_session the new session (if changed otherwise current)
434 * @param prev_in_use the new address in use state (if changed otherwise current)
435 * @param prev_atsi ATS information updated + previous values, GNUNET_ATS_VALUE_UNDEFINED if not existing before
436 * @param prev_atsi_count number of atsi values updated
437 */
438void 418void
439GAS_mlp_address_update (void *solver, 419GAS_mlp_address_property_changed (void *solver,
440 struct ATS_Address *address, 420 struct ATS_Address *address,
441 uint32_t prev_session, 421 uint32_t type,
442 int prev_in_use, 422 uint32_t abs_value,
443 const struct GNUNET_ATS_Information *prev_atsi, 423 double rel_value);
444 uint32_t prev_atsi_count); 424
425
426void
427GAS_mlp_address_session_changed (void *solver,
428 struct ATS_Address *address,
429 uint32_t cur_session,
430 uint32_t new_session);
431
432void
433GAS_mlp_address_inuse_changed (void *solver,
434 struct ATS_Address *address,
435 uint32_t session,
436 int in_use);
445 437
438void
439GAS_proportional_address_change_network (void *solver,
440 struct ATS_Address *address,
441 uint32_t current_network,
442 uint32_t new_network);
446 443
447/** 444/**
448 * Deletes a single address in the MLP problem 445 * Deletes a single address in the MLP problem
diff --git a/src/ats/gnunet-service-ats-solver_proportional.c b/src/ats/gnunet-service-ats-solver_proportional.c
index 3aca61156..03cba6eb1 100644
--- a/src/ats/gnunet-service-ats-solver_proportional.c
+++ b/src/ats/gnunet-service-ats-solver_proportional.c
@@ -431,7 +431,6 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s,
431 unsigned long long assigned_quota_out = 0; 431 unsigned long long assigned_quota_out = 0;
432 struct AddressWrapper *cur; 432 struct AddressWrapper *cur;
433 433
434
435 if (GNUNET_YES == s->bulk_lock) 434 if (GNUNET_YES == s->bulk_lock)
436 { 435 {
437 s->bulk_requests++; 436 s->bulk_requests++;
@@ -556,18 +555,6 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s,
556} 555}
557 556
558 557
559/**
560 * Extract an ATS performance info from an address
561 *
562 * @param address the address
563 * @param type the type to extract in HBO
564 * @return the value in HBO or GNUNET_ATS_VALUE_UNDEFINED in HBO if value does not exist
565 */
566static int
567get_performance_info (struct ATS_Address *address, uint32_t type);
568
569
570
571struct FindBestAddressCtx 558struct FindBestAddressCtx
572{ 559{
573 struct GAS_PROPORTIONAL_Handle *s; 560 struct GAS_PROPORTIONAL_Handle *s;
@@ -871,31 +858,6 @@ addresse_decrement (struct GAS_PROPORTIONAL_Handle *s,
871 858
872 859
873/** 860/**
874 * Extract an ATS performance info from an address
875 *
876 * @param address the address
877 * @param type the type to extract in HBO
878 * @return the value in HBO or GNUNET_ATS_VALUE_UNDEFINED in HBO if value does not exist
879 */
880static int
881get_performance_info (struct ATS_Address *address, uint32_t type)
882{
883 int c1;
884 GNUNET_assert (NULL != address);
885
886 if ((NULL == address->atsi) || (0 == address->atsi_count))
887 return GNUNET_ATS_VALUE_UNDEFINED;
888
889 for (c1 = 0; c1 < address->atsi_count; c1++)
890 {
891 if (ntohl(address->atsi[c1].type) == type)
892 return ntohl(address->atsi[c1].value);
893 }
894 return GNUNET_ATS_VALUE_UNDEFINED;
895}
896
897
898/**
899 * Solver API functions 861 * Solver API functions
900 * --------------------------- 862 * ---------------------------
901 */ 863 */
@@ -1146,140 +1108,146 @@ GAS_proportional_address_add (void *solver,
1146 struct ATS_Address *address, 1108 struct ATS_Address *address,
1147 uint32_t network); 1109 uint32_t network);
1148 1110
1149/** 1111
1150 * Updates a single address in the solver and checks previous values
1151 *
1152 * @param solver the solver Handle
1153 * @param addresses the address hashmap containing all addresses
1154 * @param address the update address
1155 * @param session the previous session
1156 * @param in_use the previous address in use state
1157 * @param prev_ats previous ATS information
1158 * @param prev_atsi_count the previous atsi count
1159 */
1160void 1112void
1161GAS_proportional_address_update (void *solver, 1113GAS_proportional_address_property_changed (void *solver,
1162 struct ATS_Address *address, 1114 struct ATS_Address *address,
1163 uint32_t session, 1115 uint32_t type,
1164 int in_use, 1116 uint32_t abs_value,
1165 const struct GNUNET_ATS_Information *prev_ats, 1117 double rel_value)
1166 uint32_t prev_atsi_count)
1167{ 1118{
1168 struct ATS_Address *new; 1119 struct GAS_PROPORTIONAL_Handle *s;
1169 struct GAS_PROPORTIONAL_Handle *s = (struct GAS_PROPORTIONAL_Handle *) solver; 1120 struct Network *n;
1170 int i;
1171 uint32_t prev_value;
1172 uint32_t prev_type;
1173 uint32_t addr_net;
1174 int save_active = GNUNET_NO;
1175 struct Network *new_net = NULL;
1176 1121
1177 /* Check updates to performance information */ 1122 GNUNET_assert (NULL != solver);
1178 for (i = 0; i < prev_atsi_count; i++) 1123 GNUNET_assert (NULL != address);
1179 {
1180 prev_type = ntohl (prev_ats[i].type);
1181 prev_value = ntohl (prev_ats[i].value);
1182 switch (prev_type)
1183 {
1184 case GNUNET_ATS_UTILIZATION_UP:
1185 case GNUNET_ATS_UTILIZATION_DOWN:
1186 case GNUNET_ATS_QUALITY_NET_DELAY:
1187 case GNUNET_ATS_QUALITY_NET_DISTANCE:
1188 case GNUNET_ATS_COST_WAN:
1189 case GNUNET_ATS_COST_LAN:
1190 case GNUNET_ATS_COST_WLAN:
1191 /* No actions required here*/
1192 break;
1193 case GNUNET_ATS_NETWORK_TYPE:
1194
1195 addr_net = get_performance_info (address, GNUNET_ATS_NETWORK_TYPE);
1196 if (GNUNET_ATS_VALUE_UNDEFINED == addr_net)
1197 {
1198 GNUNET_break (0);
1199 addr_net = GNUNET_ATS_NET_UNSPECIFIED;
1200 }
1201 if (addr_net != prev_value)
1202 {
1203 /* Network changed */
1204 LOG (GNUNET_ERROR_TYPE_DEBUG, "Network type changed, moving %s address from `%s' to `%s'\n",
1205 (GNUNET_YES == address->active) ? "active" : "inactive",
1206 GNUNET_ATS_print_network_type(prev_value),
1207 GNUNET_ATS_print_network_type(addr_net));
1208
1209 save_active = address->active;
1210 /* remove from old network */
1211 GAS_proportional_address_delete (solver, address, GNUNET_NO);
1212
1213 /* set new network type */
1214 new_net = get_network (solver, addr_net);
1215 if (NULL == new_net)
1216 {
1217 /* Address changed to invalid network... */
1218 LOG (GNUNET_ERROR_TYPE_ERROR, _("Cannot find network of type `%u' %s\n"),
1219 addr_net, GNUNET_ATS_print_network_type (addr_net));
1220 address->assigned_bw_in = GNUNET_BANDWIDTH_value_init (0);
1221 address->assigned_bw_out = GNUNET_BANDWIDTH_value_init (0);
1222 s->bw_changed (s->bw_changed_cls, address);
1223 return;
1224 }
1225 address->solver_information = new_net;
1226
1227 /* Add to new network and update*/
1228 GAS_proportional_address_add (solver, address, addr_net);
1229 if (GNUNET_YES == save_active)
1230 {
1231 /* check if bandwidth available in new network */
1232 if (GNUNET_YES == (is_bandwidth_available_in_network (new_net)))
1233 {
1234 /* Suggest updated address */
1235 address->active = GNUNET_YES;
1236 addresse_increment (s, new_net, GNUNET_NO, GNUNET_YES);
1237 distribute_bandwidth_in_network (solver, new_net, NULL);
1238 }
1239 else
1240 {
1241 LOG (GNUNET_ERROR_TYPE_DEBUG, "Not enough bandwidth in new network, suggesting alternative address ..\n");
1242
1243 /* Set old address to zero bw */
1244 address->assigned_bw_in = GNUNET_BANDWIDTH_value_init (0);
1245 address->assigned_bw_out = GNUNET_BANDWIDTH_value_init (0);
1246 s->bw_changed (s->bw_changed_cls, address);
1247
1248 /* Find new address to suggest since no bandwidth in network*/
1249 new = (struct ATS_Address *) GAS_proportional_get_preferred_address (s, &address->peer);
1250 if (NULL != new)
1251 {
1252 /* Have an alternative address to suggest */
1253 s->bw_changed (s->bw_changed_cls, new);
1254 }
1255 }
1256 }
1257 }
1258 break;
1259 case GNUNET_ATS_ARRAY_TERMINATOR:
1260 break;
1261 default:
1262 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1263 "Received unsupported ATS type %u\n", prev_type);
1264 GNUNET_break (0);
1265 break;
1266 1124
1267 } 1125 s = (struct GAS_PROPORTIONAL_Handle *) solver;
1126 n = (struct Network *) address->solver_information;
1268 1127
1269 } 1128 if (NULL == n)
1270 if (address->session_id != session) 1129 {
1130 GNUNET_break (0);
1131 return;
1132 }
1133
1134 LOG (GNUNET_ERROR_TYPE_DEBUG,
1135 "Property `%s' for peer `%s' address %p changed to %.2f %p %p %p\n",
1136 GNUNET_ATS_print_property_type (type),
1137 GNUNET_i2s (&address->peer),
1138 address,
1139 rel_value, s, n, &distribute_bandwidth_in_network);
1140 switch (type)
1271 { 1141 {
1272 LOG (GNUNET_ERROR_TYPE_DEBUG, 1142 case GNUNET_ATS_UTILIZATION_UP:
1273 "Session changed from %u to %u\n", session, address->session_id); 1143 case GNUNET_ATS_UTILIZATION_DOWN:
1144 case GNUNET_ATS_QUALITY_NET_DELAY:
1145 case GNUNET_ATS_QUALITY_NET_DISTANCE:
1146 case GNUNET_ATS_COST_WAN:
1147 case GNUNET_ATS_COST_LAN:
1148 case GNUNET_ATS_COST_WLAN:
1149
1150 //FIXME distribute_bandwidth_in_network (s, n, GNUNET_NO);
1151 break;
1274 } 1152 }
1275 if (address->used != in_use) 1153}
1154
1155
1156void
1157GAS_proportional_address_session_changed (void *solver,
1158 struct ATS_Address *address,
1159 uint32_t cur_session,
1160 uint32_t new_session)
1161{
1162 if (cur_session!= new_session)
1276 { 1163 {
1277 LOG (GNUNET_ERROR_TYPE_DEBUG, 1164 LOG (GNUNET_ERROR_TYPE_DEBUG,
1278 "Usage changed from %u to %u\n", in_use, address->used); 1165 "Session changed from %u to %u\n", cur_session, new_session);
1279 } 1166 }
1167}
1280 1168
1169void
1170GAS_proportional_address_inuse_changed (void *solver,
1171 struct ATS_Address *address,
1172 int in_use)
1173{
1174 LOG (GNUNET_ERROR_TYPE_DEBUG,
1175 "Usage changed to %s\n",
1176 (GNUNET_YES == in_use) ? "USED" : "UNUSED");
1281} 1177}
1282 1178
1179void
1180GAS_proportional_address_change_network (void *solver,
1181 struct ATS_Address *address,
1182 uint32_t current_network,
1183 uint32_t new_network)
1184{
1185 struct ATS_Address *new;
1186 struct GAS_PROPORTIONAL_Handle *s = (struct GAS_PROPORTIONAL_Handle *) solver;
1187 int save_active = GNUNET_NO;
1188 struct Network *new_net = NULL;
1189
1190 if (current_network == new_network)
1191 {
1192 GNUNET_break (0);
1193 return;
1194 }
1195
1196 /* Network changed */
1197 LOG (GNUNET_ERROR_TYPE_DEBUG, "Network type changed, moving %s address from `%s' to `%s'\n",
1198 (GNUNET_YES == address->active) ? "active" : "inactive",
1199 GNUNET_ATS_print_network_type (current_network),
1200 GNUNET_ATS_print_network_type (new_network));
1201
1202 save_active = address->active;
1203 /* remove from old network */
1204 GAS_proportional_address_delete (solver, address, GNUNET_NO);
1205
1206 /* set new network type */
1207 new_net = get_network (solver, new_network);
1208 if (NULL == new_net)
1209 {
1210 /* Address changed to invalid network... */
1211 LOG (GNUNET_ERROR_TYPE_ERROR, _("Cannot find network of type `%u' %s\n"),
1212 new_network, GNUNET_ATS_print_network_type (new_network));
1213 address->assigned_bw_in = GNUNET_BANDWIDTH_value_init (0);
1214 address->assigned_bw_out = GNUNET_BANDWIDTH_value_init (0);
1215 s->bw_changed (s->bw_changed_cls, address);
1216 return;
1217 }
1218 address->solver_information = new_net;
1219
1220 /* Add to new network and update*/
1221 GAS_proportional_address_add (solver, address, new_network);
1222 if (GNUNET_YES == save_active)
1223 {
1224 /* check if bandwidth available in new network */
1225 if (GNUNET_YES == (is_bandwidth_available_in_network (new_net)))
1226 {
1227 /* Suggest updated address */
1228 address->active = GNUNET_YES;
1229 addresse_increment (s, new_net, GNUNET_NO, GNUNET_YES);
1230 distribute_bandwidth_in_network (solver, new_net, NULL);
1231 }
1232 else
1233 {
1234 LOG (GNUNET_ERROR_TYPE_DEBUG, "Not enough bandwidth in new network, suggesting alternative address ..\n");
1235
1236 /* Set old address to zero bw */
1237 address->assigned_bw_in = GNUNET_BANDWIDTH_value_init (0);
1238 address->assigned_bw_out = GNUNET_BANDWIDTH_value_init (0);
1239 s->bw_changed (s->bw_changed_cls, address);
1240
1241 /* Find new address to suggest since no bandwidth in network*/
1242 new = (struct ATS_Address *) GAS_proportional_get_preferred_address (s, &address->peer);
1243 if (NULL != new)
1244 {
1245 /* Have an alternative address to suggest */
1246 s->bw_changed (s->bw_changed_cls, new);
1247 }
1248 }
1249 }
1250}
1283 1251
1284/** 1252/**
1285 * Add a new single address to a network 1253 * Add a new single address to a network
diff --git a/src/ats/gnunet-service-ats-solver_proportional.h b/src/ats/gnunet-service-ats-solver_proportional.h
index 9a185b21a..8ce341847 100644
--- a/src/ats/gnunet-service-ats-solver_proportional.h
+++ b/src/ats/gnunet-service-ats-solver_proportional.h
@@ -114,26 +114,31 @@ GAS_proportional_address_add (void *solver,
114 struct ATS_Address *address, 114 struct ATS_Address *address,
115 uint32_t network); 115 uint32_t network);
116 116
117void
118GAS_proportional_address_property_changed (void *solver,
119 struct ATS_Address *address,
120 uint32_t type,
121 uint32_t abs_value,
122 double rel_value);
123
117 124
118/**
119 * Updates a single address in the solve
120 *
121 * @param solver the solver Handle
122 * @param addresses the address hashmap containing all addresses
123 * @param address the update address
124 * @param session the new session (if changed otherwise current)
125 * @param in_use the new address in use state (if changed otherwise current)
126 * @param prev_ats the latest ATS information
127 * @param prev_atsi_count the atsi count
128 */
129void 125void
130GAS_proportional_address_update (void *solver, 126GAS_proportional_address_session_changed (void *solver,
131 struct ATS_Address *address, 127 struct ATS_Address *address,
132 uint32_t session, 128 uint32_t cur_session,
133 int in_use, 129 uint32_t new_session);
134 const struct GNUNET_ATS_Information *atsi,
135 uint32_t atsi_count);
136 130
131void
132GAS_proportional_address_inuse_changed (void *solver,
133 struct ATS_Address *address,
134 uint32_t session,
135 int in_use);
136
137void
138GAS_proportional_address_change_network (void *solver,
139 struct ATS_Address *address,
140 uint32_t current_network,
141 uint32_t new_network);
137 142
138/** 143/**
139 * Remove an address from the solver 144 * Remove an address from the solver
@@ -166,7 +171,7 @@ GAS_proportional_bulk_stop (void *solver);
166/** 171/**
167 * Stop notifying about address and bandwidth changes for this peer 172 * Stop notifying about address and bandwidth changes for this peer
168 * 173 *
169 * @param solver the MLP handle 174 * @param solver the proportional handle
170 * @param addresses address hashmap 175 * @param addresses address hashmap
171 * @param peer the peer 176 * @param peer the peer
172 */ 177 */
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index 6adb44798..dd12613fd 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -338,10 +338,14 @@ struct GAS_Addresses_Handle
338 */ 338 */
339 GAS_solver_address_add s_add; 339 GAS_solver_address_add s_add;
340 340
341 /** 341
342 * Update address in solver 342 GAS_solver_address_property_changed s_address_update_property;
343 */ 343
344 GAS_solver_address_update s_update; 344 GAS_solver_address_session_changed s_address_update_session;
345
346 GAS_solver_address_inuse_changed s_address_update_inuse;
347
348 GAS_solver_address_network_changed s_address_update_network;
345 349
346 /** 350 /**
347 * Get address from solver 351 * Get address from solver
@@ -666,8 +670,7 @@ find_equivalent_address (struct GAS_Addresses_Handle *handle,
666 670
667 671
668/** 672/**
669 * Lookup an ATS address by the address properties and session or return an 673 * Find the exact address
670 * equivalent address with a session == 0
671 * 674 *
672 * @param handle the address handle to use 675 * @param handle the address handle to use
673 * @param peer peer 676 * @param peer peer
@@ -681,14 +684,12 @@ find_equivalent_address (struct GAS_Addresses_Handle *handle,
681 */ 684 */
682 685
683static struct ATS_Address * 686static struct ATS_Address *
684lookup_address (struct GAS_Addresses_Handle *handle, 687find_exact_address (struct GAS_Addresses_Handle *handle,
685 const struct GNUNET_PeerIdentity *peer, 688 const struct GNUNET_PeerIdentity *peer,
686 const char *plugin_name, 689 const char *plugin_name,
687 const void *plugin_addr, 690 const void *plugin_addr,
688 size_t plugin_addr_len, 691 size_t plugin_addr_len,
689 uint32_t session_id, 692 uint32_t session_id)
690 const struct GNUNET_ATS_Information *atsi,
691 uint32_t atsi_count)
692{ 693{
693 struct ATS_Address *aa; 694 struct ATS_Address *aa;
694 struct ATS_Address *ea; 695 struct ATS_Address *ea;
@@ -702,13 +703,9 @@ lookup_address (struct GAS_Addresses_Handle *handle,
702 ea = find_equivalent_address (handle, peer, aa); 703 ea = find_equivalent_address (handle, peer, aa);
703 free_address (aa); 704 free_address (aa);
704 if (ea == NULL) 705 if (ea == NULL)
705 {
706 return NULL; 706 return NULL;
707 }
708 else if (ea->session_id != session_id) 707 else if (ea->session_id != session_id)
709 {
710 return NULL; 708 return NULL;
711 }
712 return ea; 709 return ea;
713} 710}
714 711
@@ -754,16 +751,19 @@ get_performance_info (struct ATS_Address *address, uint32_t type)
754void 751void
755GAS_addresses_add (struct GAS_Addresses_Handle *handle, 752GAS_addresses_add (struct GAS_Addresses_Handle *handle,
756 const struct GNUNET_PeerIdentity *peer, 753 const struct GNUNET_PeerIdentity *peer,
757 const char *plugin_name, const void *plugin_addr, 754 const char *plugin_name,
758 size_t plugin_addr_len, uint32_t session_id, 755 const void *plugin_addr,
756 size_t plugin_addr_len,
757 uint32_t session_id,
759 const struct GNUNET_ATS_Information *atsi, 758 const struct GNUNET_ATS_Information *atsi,
760 uint32_t atsi_count) 759 uint32_t atsi_count)
761{ 760{
762 struct ATS_Address *aa; 761 struct ATS_Address *new_address;
763 struct ATS_Address *ea; 762 struct ATS_Address *existing_address;
764 struct GNUNET_ATS_Information *atsi_delta; 763 struct GNUNET_ATS_Information *atsi_delta;
765 uint32_t atsi_delta_count; 764 uint32_t atsi_delta_count;
766 uint32_t addr_net; 765 uint32_t addr_net;
766 uint32_t previous_session;
767 767
768 768
769 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 769 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -776,54 +776,55 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle,
776 776
777 GNUNET_assert (NULL != handle->addresses); 777 GNUNET_assert (NULL != handle->addresses);
778 778
779 aa = create_address (peer, plugin_name, plugin_addr, plugin_addr_len, 779 new_address = create_address (peer, plugin_name, plugin_addr, plugin_addr_len,
780 session_id); 780 session_id);
781 atsi_delta = NULL; 781 atsi_delta = NULL;
782 disassemble_ats_information (aa, atsi, atsi_count, &atsi_delta, &atsi_delta_count); 782 disassemble_ats_information (new_address, atsi, atsi_count, &atsi_delta, &atsi_delta_count);
783 GNUNET_free_non_null (atsi_delta); 783 GNUNET_free_non_null (atsi_delta);
784 addr_net = get_performance_info (aa, GNUNET_ATS_NETWORK_TYPE); 784 addr_net = get_performance_info (new_address, GNUNET_ATS_NETWORK_TYPE);
785 if (GNUNET_ATS_VALUE_UNDEFINED == addr_net) 785 if (GNUNET_ATS_VALUE_UNDEFINED == addr_net)
786 addr_net = GNUNET_ATS_NET_UNSPECIFIED; 786 addr_net = GNUNET_ATS_NET_UNSPECIFIED;
787 787
788 /* Get existing address or address with session == 0 */ 788 /* Get existing address or address with session == 0 */
789 ea = find_equivalent_address (handle, peer, aa); 789 existing_address = find_equivalent_address (handle, peer, new_address);
790 if (ea == NULL) 790 if (existing_address == NULL)
791 { 791 {
792 /* We have a new address */ 792 /* Add a new address */
793 GNUNET_assert (GNUNET_OK == 793 GNUNET_assert (GNUNET_OK ==
794 GNUNET_CONTAINER_multihashmap_put (handle->addresses, 794 GNUNET_CONTAINER_multihashmap_put (handle->addresses,
795 &peer->hashPubKey, aa, 795 &peer->hashPubKey, new_address,
796 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); 796 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
797 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Added new address for peer `%s' session id %u, %p\n", 797
798 GNUNET_i2s (peer), session_id, aa); 798 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding new address for peer `%s' session id %u, %p\n",
799 GNUNET_i2s (peer), session_id, new_address);
800
799 /* Tell solver about new address */ 801 /* Tell solver about new address */
802 handle->s_add (handle->solver, new_address, addr_net);
803
800 handle->s_bulk_start (handle->solver); 804 handle->s_bulk_start (handle->solver);
801 GAS_normalization_normalize_property (handle->addresses, aa, atsi, atsi_count); 805 GAS_normalization_normalize_property (handle->addresses, new_address, atsi, atsi_count);
802 handle->s_bulk_stop (handle->solver); 806 handle->s_bulk_stop (handle->solver);
803 handle->s_add (handle->solver, aa, addr_net); 807
804 /* Notify performance clients about new address */ 808 /* Notify performance clients about new address */
805 GAS_performance_notify_all_clients (&aa->peer, 809 GAS_performance_notify_all_clients (&new_address->peer,
806 aa->plugin, 810 new_address->plugin,
807 aa->addr, aa->addr_len, 811 new_address->addr, new_address->addr_len,
808 aa->session_id, 812 new_address->session_id,
809 aa->atsi, aa->atsi_count, 813 new_address->atsi, new_address->atsi_count,
810 aa->assigned_bw_out, 814 new_address->assigned_bw_out,
811 aa->assigned_bw_in); 815 new_address->assigned_bw_in);
812 return; 816 return;
813 } 817 }
814 818
815 GNUNET_free (aa->plugin); 819 /* We have an existing address we can use, clean up new */
816 GNUNET_free_non_null (aa->atsi); 820 GNUNET_free (new_address->plugin);
817 GNUNET_free (aa); 821 GNUNET_free_non_null (new_address->atsi);
818 aa = NULL; 822 GNUNET_free (new_address);
823 new_address = NULL;
819 824
820 if (ea->session_id != 0) 825 if (0 != existing_address->session_id)
821 { 826 {
822 /* This address with the same session is already existing 827 /* Should not happen */
823 * Should not happen */
824 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
825 "Added already existing address for peer `%s' `%s' %p with new session %u\n",
826 GNUNET_i2s (peer), plugin_name, session_id);
827 GNUNET_break (0); 828 GNUNET_break (0);
828 return; 829 return;
829 } 830 }
@@ -831,29 +832,33 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle,
831 /* We have an address without an session, update this address */ 832 /* We have an address without an session, update this address */
832 atsi_delta = NULL; 833 atsi_delta = NULL;
833 atsi_delta_count = 0; 834 atsi_delta_count = 0;
834 if (GNUNET_YES == disassemble_ats_information (ea, atsi, atsi_count, &atsi_delta, &atsi_delta_count)) 835 if (GNUNET_YES == disassemble_ats_information (existing_address, atsi, atsi_count, &atsi_delta, &atsi_delta_count))
835 { 836 {
836 GAS_performance_notify_all_clients (&ea->peer, 837 /* Notify performance clients about properties */
837 ea->plugin, 838 GAS_performance_notify_all_clients (&existing_address->peer,
838 ea->addr, ea->addr_len, 839 existing_address->plugin,
839 ea->session_id, 840 existing_address->addr, existing_address->addr_len,
840 ea->atsi, ea->atsi_count, 841 existing_address->session_id,
841 ea->assigned_bw_out, 842 existing_address->atsi, existing_address->atsi_count,
842 ea->assigned_bw_in); 843 existing_address->assigned_bw_out,
844 existing_address->assigned_bw_in);
845
846 /* Notify solver about update with atsi information and session */
847 handle->s_bulk_start (handle->solver);
848 GAS_normalization_normalize_property (handle->addresses, existing_address, atsi, atsi_count);
849 handle->s_bulk_stop (handle->solver);
843 } 850 }
844
845 /* Notify solver about update with atsi information and session */
846 handle->s_bulk_start (handle->solver);
847 GAS_normalization_normalize_property (handle->addresses, ea, atsi, atsi_count);
848 handle->s_bulk_stop (handle->solver);
849 handle->s_update (handle->solver, ea, session_id, ea->used, atsi_delta, atsi_delta_count);
850 GNUNET_free_non_null (atsi_delta); 851 GNUNET_free_non_null (atsi_delta);
851 852
852 /* Do the update */ 853 /* Notify solver about new session */
853 ea->session_id = session_id; 854 previous_session = existing_address->session_id;
855 existing_address->session_id = session_id;
856 handle->s_address_update_session (handle->solver, existing_address,
857 previous_session, session_id);
858
854 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 859 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
855 "Updated existing address for peer `%s' %p with new session %u\n", 860 "Updated existing address for peer `%s' %p with new session %u\n",
856 GNUNET_i2s (peer), ea, session_id); 861 GNUNET_i2s (peer), existing_address, session_id);
857} 862}
858 863
859 864
@@ -884,6 +889,7 @@ GAS_addresses_update (struct GAS_Addresses_Handle *handle,
884 struct GNUNET_ATS_Information *atsi_delta; 889 struct GNUNET_ATS_Information *atsi_delta;
885 uint32_t atsi_delta_count; 890 uint32_t atsi_delta_count;
886 uint32_t prev_session; 891 uint32_t prev_session;
892 int c1;
887 893
888 if (GNUNET_NO == handle->running) 894 if (GNUNET_NO == handle->running)
889 return; 895 return;
@@ -891,8 +897,8 @@ GAS_addresses_update (struct GAS_Addresses_Handle *handle,
891 GNUNET_assert (NULL != handle->addresses); 897 GNUNET_assert (NULL != handle->addresses);
892 898
893 /* Get existing address */ 899 /* Get existing address */
894 aa = lookup_address (handle, peer, plugin_name, plugin_addr, plugin_addr_len, 900 aa = find_exact_address (handle, peer, plugin_name,
895 session_id, atsi, atsi_count); 901 plugin_addr, plugin_addr_len, session_id);
896 if (aa == NULL) 902 if (aa == NULL)
897 { 903 {
898 /* GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Tried to update unknown address for peer `%s' `%s' session id %u\n", */ 904 /* GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Tried to update unknown address for peer `%s' `%s' session id %u\n", */
@@ -914,28 +920,44 @@ GAS_addresses_update (struct GAS_Addresses_Handle *handle,
914 GNUNET_i2s (peer), aa); 920 GNUNET_i2s (peer), aa);
915 921
916 /* Update address */ 922 /* Update address */
923 if (session_id != aa->session_id)
924 {
925 /* Session changed */
926 prev_session = aa->session_id;
927 aa->session_id = session_id;
928 handle->s_address_update_session (handle->solver, aa, prev_session, aa->session_id);
929 }
930
917 atsi_delta = NULL; 931 atsi_delta = NULL;
918 atsi_delta_count = 0; 932 atsi_delta_count = 0;
919 if (GNUNET_YES == disassemble_ats_information (aa, atsi, atsi_count, &atsi_delta, &atsi_delta_count)) 933 if (GNUNET_YES == disassemble_ats_information (aa, atsi, atsi_count, &atsi_delta, &atsi_delta_count))
920 { 934 {
921 /* Notify performance clients about updated address */ 935 /* ATS properties changed */
922 GAS_performance_notify_all_clients (&aa->peer,
923 aa->plugin,
924 aa->addr, aa->addr_len,
925 aa->session_id,
926 aa->atsi, aa->atsi_count,
927 aa->assigned_bw_out,
928 aa->assigned_bw_in);
929 }
930 prev_session = aa->session_id;
931 aa->session_id = session_id;
932 936
933 handle->s_bulk_start (handle->solver); 937 for (c1 = 0; c1 < atsi_delta_count; c1++)
934 GAS_normalization_normalize_property (handle->addresses, aa, atsi, atsi_count); 938 {
935 handle->s_bulk_stop (handle->solver); 939 if (GNUNET_ATS_NETWORK_TYPE == ntohl (atsi_delta[c1].type))
940 {
941 /* Network type changed */
942 handle->s_address_update_network (handle->solver, aa,
943 ntohl (atsi_delta[c1].value),
944 get_performance_info (aa, GNUNET_ATS_NETWORK_TYPE));
945 }
946 }
936 947
937 /* Tell solver about update */ 948 /* Notify performance clients about updated address */
938 handle->s_update (handle->solver, aa, prev_session, aa->used, atsi_delta, atsi_delta_count); 949 GAS_performance_notify_all_clients (&aa->peer,
950 aa->plugin,
951 aa->addr, aa->addr_len,
952 aa->session_id,
953 aa->atsi, aa->atsi_count,
954 aa->assigned_bw_out,
955 aa->assigned_bw_in);
956
957 handle->s_bulk_start (handle->solver);
958 GAS_normalization_normalize_property (handle->addresses, aa, atsi, atsi_count);
959 handle->s_bulk_stop (handle->solver);
960 }
939 GNUNET_free_non_null (atsi_delta); 961 GNUNET_free_non_null (atsi_delta);
940} 962}
941 963
@@ -986,7 +1008,7 @@ destroy_by_session_id (void *cls, const struct GNUNET_HashCode * key, void *valu
986 (0 == memcmp (des->addr, aa->addr, aa->addr_len))) 1008 (0 == memcmp (des->addr, aa->addr, aa->addr_len)))
987 { 1009 {
988 1010
989 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1011 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
990 "Deleting full address for peer `%s' session %u %p\n", 1012 "Deleting full address for peer `%s' session %u %p\n",
991 GNUNET_i2s (&aa->peer), aa->session_id, aa); 1013 GNUNET_i2s (&aa->peer), aa->session_id, aa);
992 1014
@@ -1072,8 +1094,8 @@ GAS_addresses_destroy (struct GAS_Addresses_Handle *handle,
1072 return; 1094 return;
1073 1095
1074 /* Get existing address */ 1096 /* Get existing address */
1075 ea = lookup_address (handle, peer, plugin_name, plugin_addr, plugin_addr_len, 1097 ea = find_exact_address (handle, peer, plugin_name, plugin_addr,
1076 session_id, NULL, 0); 1098 plugin_addr_len, session_id);
1077 if (ea == NULL) 1099 if (ea == NULL)
1078 { 1100 {
1079 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Tried to destroy unknown address for peer `%s' `%s' session id %u\n", 1101 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Tried to destroy unknown address for peer `%s' `%s' session id %u\n",
@@ -1081,7 +1103,7 @@ GAS_addresses_destroy (struct GAS_Addresses_Handle *handle,
1081 return; 1103 return;
1082 } 1104 }
1083 1105
1084 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1106 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1085 "Received `%s' for peer `%s' address %p session %u\n", 1107 "Received `%s' for peer `%s' address %p session %u\n",
1086 "ADDRESS DESTROY", 1108 "ADDRESS DESTROY",
1087 GNUNET_i2s (peer), ea, session_id); 1109 GNUNET_i2s (peer), ea, session_id);
@@ -1125,8 +1147,6 @@ GAS_addresses_in_use (struct GAS_Addresses_Handle *handle,
1125 int in_use) 1147 int in_use)
1126{ 1148{
1127 struct ATS_Address *ea; 1149 struct ATS_Address *ea;
1128 int prev_inuse;
1129
1130 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1150 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1131 "Received `%s' for peer `%s'\n", 1151 "Received `%s' for peer `%s'\n",
1132 "ADDRESS IN USE", 1152 "ADDRESS IN USE",
@@ -1135,9 +1155,8 @@ GAS_addresses_in_use (struct GAS_Addresses_Handle *handle,
1135 if (GNUNET_NO == handle->running) 1155 if (GNUNET_NO == handle->running)
1136 return GNUNET_SYSERR; 1156 return GNUNET_SYSERR;
1137 1157
1138 ea = lookup_address (handle, peer, plugin_name, 1158 ea = find_exact_address (handle, peer, plugin_name,
1139 plugin_addr, plugin_addr_len, 1159 plugin_addr, plugin_addr_len, session_id);
1140 session_id, NULL, 0);
1141 if (NULL == ea) 1160 if (NULL == ea)
1142 { 1161 {
1143 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1162 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1160,11 +1179,8 @@ GAS_addresses_in_use (struct GAS_Addresses_Handle *handle,
1160 } 1179 }
1161 1180
1162 /* Tell solver about update */ 1181 /* Tell solver about update */
1163 prev_inuse = ea->used;
1164 ea->used = in_use; 1182 ea->used = in_use;
1165 handle->s_update (handle->solver, ea, session_id, prev_inuse, NULL, 0); 1183 handle->s_address_update_inuse (handle->solver, ea, ea->session_id, ea->used);
1166
1167
1168 return GNUNET_OK; 1184 return GNUNET_OK;
1169} 1185}
1170 1186
@@ -1340,25 +1356,30 @@ normalized_preference_changed_cb (void *cls,
1340/** 1356/**
1341 * The relative value for a property changed 1357 * The relative value for a property changed
1342 * 1358 *
1343 * @param cls the address handle 1359 * @param solver the address handle
1344 * @param peer the peer 1360 * @param peer the peer
1345 * @param type the ATS type 1361 * @param type the ATS type
1346 * @param prop_rel the new relative preference value 1362 * @param prop_rel the new relative preference value
1347 */ 1363 */
1348static void 1364static void
1349normalized_property_changed_cb (void *cls, 1365normalized_property_changed_cb (void *solver,
1350 const struct ATS_Address *peer, 1366 struct ATS_Address *address,
1351 uint32_t type, 1367 uint32_t type,
1352 double prop_rel) 1368 double prop_rel)
1353{ 1369{
1354 GNUNET_assert (NULL != cls); 1370 GNUNET_assert (NULL != solver);
1355 //struct GAS_Addresses_Handle *handle = cls; 1371
1356 /* Tell solver about update */
1357 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1372 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1358 "Normalized property %s for peer `%s' changed to %.3f \n", 1373 "Normalized property %s for peer `%s' changed to %.3f \n",
1359 GNUNET_ATS_print_property_type (type), 1374 GNUNET_ATS_print_property_type (type),
1360 GNUNET_i2s (&peer->peer), 1375 GNUNET_i2s (&address->peer),
1361 prop_rel); 1376 prop_rel);
1377
1378 GAS_proportional_address_property_changed (solver,
1379 address,
1380 type,
1381 0,
1382 prop_rel);
1362} 1383}
1363 1384
1364 1385
@@ -1654,7 +1675,9 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
1654 ah->ats_mode = MODE_MLP; 1675 ah->ats_mode = MODE_MLP;
1655 ah->s_init = &GAS_mlp_init; 1676 ah->s_init = &GAS_mlp_init;
1656 ah->s_add = &GAS_mlp_address_add; 1677 ah->s_add = &GAS_mlp_address_add;
1657 ah->s_update = &GAS_mlp_address_update; 1678 ah->s_address_update_property = &GAS_mlp_address_property_changed;
1679 ah->s_address_update_session = &GAS_mlp_address_session_changed;
1680 ah->s_address_update_inuse = &GAS_mlp_address_inuse_changed;
1658 ah->s_get = &GAS_mlp_get_preferred_address; 1681 ah->s_get = &GAS_mlp_get_preferred_address;
1659 ah->s_get_stop = &GAS_mlp_stop_get_preferred_address; 1682 ah->s_get_stop = &GAS_mlp_stop_get_preferred_address;
1660 ah->s_pref = &GAS_mlp_address_change_preference; 1683 ah->s_pref = &GAS_mlp_address_change_preference;
@@ -1663,7 +1686,6 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
1663 ah->s_bulk_stop = &GAS_mlp_bulk_stop; 1686 ah->s_bulk_stop = &GAS_mlp_bulk_stop;
1664 ah->s_done = &GAS_mlp_done; 1687 ah->s_done = &GAS_mlp_done;
1665#else 1688#else
1666
1667 GNUNET_free (ah); 1689 GNUNET_free (ah);
1668 return NULL; 1690 return NULL;
1669#endif 1691#endif
@@ -1673,7 +1695,10 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
1673 ah->ats_mode = MODE_SIMPLISTIC; 1695 ah->ats_mode = MODE_SIMPLISTIC;
1674 ah->s_init = &GAS_proportional_init; 1696 ah->s_init = &GAS_proportional_init;
1675 ah->s_add = &GAS_proportional_address_add; 1697 ah->s_add = &GAS_proportional_address_add;
1676 ah->s_update = &GAS_proportional_address_update; 1698 ah->s_address_update_property = &GAS_proportional_address_property_changed;
1699 ah->s_address_update_session = &GAS_proportional_address_session_changed;
1700 ah->s_address_update_inuse = &GAS_proportional_address_inuse_changed;
1701 ah->s_address_update_network = &GAS_proportional_address_change_network;
1677 ah->s_get = &GAS_proportional_get_preferred_address; 1702 ah->s_get = &GAS_proportional_get_preferred_address;
1678 ah->s_get_stop = &GAS_proportional_stop_get_preferred_address; 1703 ah->s_get_stop = &GAS_proportional_stop_get_preferred_address;
1679 ah->s_pref = &GAS_proportional_address_change_preference; 1704 ah->s_pref = &GAS_proportional_address_change_preference;
@@ -1690,7 +1715,10 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
1690 1715
1691 GNUNET_assert (NULL != ah->s_init); 1716 GNUNET_assert (NULL != ah->s_init);
1692 GNUNET_assert (NULL != ah->s_add); 1717 GNUNET_assert (NULL != ah->s_add);
1693 GNUNET_assert (NULL != ah->s_update); 1718 GNUNET_assert (NULL != ah->s_address_update_inuse);
1719 GNUNET_assert (NULL != ah->s_address_update_property);
1720 GNUNET_assert (NULL != ah->s_address_update_session);
1721 GNUNET_assert (NULL != ah->s_address_update_network);
1694 GNUNET_assert (NULL != ah->s_get); 1722 GNUNET_assert (NULL != ah->s_get);
1695 GNUNET_assert (NULL != ah->s_get_stop); 1723 GNUNET_assert (NULL != ah->s_get_stop);
1696 GNUNET_assert (NULL != ah->s_pref); 1724 GNUNET_assert (NULL != ah->s_pref);
@@ -1710,7 +1738,7 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
1710 &get_property_cb, NULL); 1738 &get_property_cb, NULL);
1711 if (NULL == ah->solver) 1739 if (NULL == ah->solver)
1712 { 1740 {
1713 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to initialize solver!\n"); 1741 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to initialize solver!\n"));
1714 GNUNET_free (ah); 1742 GNUNET_free (ah);
1715 return NULL; 1743 return NULL;
1716 } 1744 }
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h
index a01f67d13..f5e42193b 100644
--- a/src/ats/gnunet-service-ats_addresses.h
+++ b/src/ats/gnunet-service-ats_addresses.h
@@ -464,25 +464,31 @@ typedef void
464 struct ATS_Address *address, 464 struct ATS_Address *address,
465 int session_only); 465 int session_only);
466 466
467/** 467
468 * Notify the solver about an update for an address 468typedef void
469 * 469(*GAS_solver_address_property_changed) (void *solver,
470 * @param solver the solver to use 470 struct ATS_Address *address,
471 * @param addresses the address hashmap containing all addresses 471 uint32_t type,
472 * @param address the address 472 uint32_t abs_value,
473 * @param session the previous session 473 double rel_value);
474 * @param in_use previous address used state: yes or no 474
475 * @param atsi ats previous performance information 475typedef void
476 * @param atsi_count previous number of ats performance information 476(*GAS_solver_address_session_changed) (void *solver,
477 * 477 struct ATS_Address *address,
478 */ 478 uint32_t cur_session,
479 uint32_t new_session);
480
481typedef void
482(*GAS_solver_address_inuse_changed) (void *solver,
483 struct ATS_Address *address,
484 uint32_t session,
485 int in_use);
486
479typedef void 487typedef void
480(*GAS_solver_address_update) (void *solver, 488(*GAS_solver_address_network_changed) (void *solver,
481 struct ATS_Address *address, 489 struct ATS_Address *address,
482 uint32_t prev_session, 490 uint32_t current_network,
483 int in_use, 491 uint32_t new_network);
484 const struct GNUNET_ATS_Information *prev_atsi,
485 uint32_t prev_atsi_count);
486 492
487 493
488/** 494/**
diff --git a/src/ats/gnunet-service-ats_normalization.c b/src/ats/gnunet-service-ats_normalization.c
index 6ced1b49e..7a2876810 100644
--- a/src/ats/gnunet-service-ats_normalization.c
+++ b/src/ats/gnunet-service-ats_normalization.c
@@ -745,7 +745,7 @@ property_normalize (struct GNUNET_CONTAINER_MultiHashMap *addresses,
745 745
746 746
747/** 747/**
748 * Update and normalize a atsi performance information 748 * Update and normalize atsi performance information
749 * 749 *
750 * @param addresses hashmap containing all addresses 750 * @param addresses hashmap containing all addresses
751 * @param address the address to update 751 * @param address the address to update
diff --git a/src/ats/gnunet-service-ats_normalization.h b/src/ats/gnunet-service-ats_normalization.h
index 551c47cd3..ed94530f9 100644
--- a/src/ats/gnunet-service-ats_normalization.h
+++ b/src/ats/gnunet-service-ats_normalization.h
@@ -43,7 +43,7 @@ typedef void
43 43
44typedef void 44typedef void
45(*GAS_Normalization_property_changed_cb) (void *cls, 45(*GAS_Normalization_property_changed_cb) (void *cls,
46 const struct ATS_Address *peer, 46 struct ATS_Address *peer,
47 uint32_t type, 47 uint32_t type,
48 double prop_rel); 48 double prop_rel);
49 49
diff --git a/src/ats/test_ats_api.conf b/src/ats/test_ats_api.conf
index 9e00a15d7..c71ec9c1c 100644
--- a/src/ats/test_ats_api.conf
+++ b/src/ats/test_ats_api.conf
@@ -21,6 +21,7 @@ UNIX_MATCH_GID = YES
21 21
22# Enable MLP mode (default: NO) 22# Enable MLP mode (default: NO)
23MODE = SIMPLISTIC 23MODE = SIMPLISTIC
24#MODE = MLP
24# Network specific inbound/outbound quotas 25# Network specific inbound/outbound quotas
25# UNSPECIFIED 26# UNSPECIFIED
26UNSPECIFIED_QUOTA_IN = 64 KiB 27UNSPECIFIED_QUOTA_IN = 64 KiB