REST: nothing triggers rest
[oweals/gnunet.git] / src / ats / gnunet-ats-solver-eval.c
index 5af2fbce3ab44347fe1a9e073c8588bd1b0c5662..833cb9ded0ffaf65349f19b4e691a8272a740f61 100644 (file)
@@ -2,20 +2,20 @@
  This file is part of GNUnet.
  Copyright (C) 2010-2013 GNUnet e.V.
 
- GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
 
  GNUnet is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- General Public License for more details.
Affero General Public License for more details.
 
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING.  If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ You should have received a copy of the GNU Affero General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
  */
 /**
  * @file ats-tests/ats-testing-experiment.c
@@ -122,7 +122,7 @@ find_peer_by_pid (const struct GNUNET_PeerIdentity *pid)
 {
   struct TestPeer *cur;
   for (cur = peer_head; NULL != cur; cur = cur->next)
-    if (0 == memcmp (&cur->peer_id, pid, sizeof (struct GNUNET_PeerIdentity)))
+    if (0 == GNUNET_memcmp (&cur->peer_id, pid))
       return cur;
   return NULL;
 }
@@ -1317,27 +1317,27 @@ load_op_add_address (struct GNUNET_ATS_TEST_Operation *o,
     GNUNET_STRINGS_utf8_toupper (op_network,op_network);
     if (0 == strcmp(op_network, "UNSPECIFIED"))
     {
-      o->address_network = GNUNET_ATS_NET_UNSPECIFIED;
+      o->address_network = GNUNET_NT_UNSPECIFIED;
     }
     else if (0 == strcmp(op_network, "LOOPBACK"))
     {
-      o->address_network = GNUNET_ATS_NET_LOOPBACK;
+      o->address_network = GNUNET_NT_LOOPBACK;
     }
     else if (0 == strcmp(op_network, "LAN"))
     {
-      o->address_network = GNUNET_ATS_NET_LAN;
+      o->address_network = GNUNET_NT_LAN;
     }
     else if (0 == strcmp(op_network, "WAN"))
     {
-      o->address_network = GNUNET_ATS_NET_WAN;
+      o->address_network = GNUNET_NT_WAN;
     }
     else if (0 == strcmp(op_network, "WLAN"))
     {
-      o->address_network = GNUNET_ATS_NET_WLAN;
+      o->address_network = GNUNET_NT_WLAN;
     }
     else if (0 == strcmp(op_network, "BT"))
     {
-      o->address_network = GNUNET_ATS_NET_BT;
+      o->address_network = GNUNET_NT_BT;
     }
     else
     {
@@ -2216,7 +2216,7 @@ enforce_add_address (struct GNUNET_ATS_TEST_Operation *op)
     GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Adding address %u for peer %u in network `%s'\n",
-    op->address_id, op->peer_id, GNUNET_ATS_print_network_type(a->network));
+    op->address_id, op->peer_id, GNUNET_NT_to_string(a->network));
 
   sh->sf->s_add (sh->sf->cls, a->ats_addr, op->address_network);
 
@@ -2750,16 +2750,16 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
   int c;
   int res;
 
-  for (c = 0; (c < GNUNET_ATS_NetworkTypeCount) && (c < dest_length); c++)
+  for (c = 0; (c < GNUNET_NT_COUNT) && (c < dest_length); c++)
   {
     in_dest[c] = 0;
     out_dest[c] = 0;
     GNUNET_asprintf (&entry_out,
                      "%s_QUOTA_OUT",
-                     GNUNET_ATS_print_network_type (c));
+                     GNUNET_NT_to_string (c));
     GNUNET_asprintf (&entry_in,
                      "%s_QUOTA_IN",
-                     GNUNET_ATS_print_network_type (c));
+                     GNUNET_NT_to_string (c));
 
     /* quota out */
     if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(cfg, "ats", entry_out, &quota_out_str))
@@ -2779,7 +2779,7 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
       {
           GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                       _("Could not load quota for network `%s':  `%s', assigning default bandwidth %llu\n"),
-                      GNUNET_ATS_print_network_type (c),
+                      GNUNET_NT_to_string (c),
                       quota_out_str,
                       GNUNET_ATS_DefaultBandwidth);
           out_dest[c] = GNUNET_ATS_DefaultBandwidth;
@@ -2788,7 +2788,7 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
       {
           GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                       "Outbound quota configure for network `%s' is %llu\n",
-                      GNUNET_ATS_print_network_type (c),
+                      GNUNET_NT_to_string (c),
                       out_dest[c]);
       }
       GNUNET_free (quota_out_str);
@@ -2797,7 +2797,7 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
     {
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _("No outbound quota configured for network `%s', assigning default bandwidth %llu\n"),
-                  GNUNET_ATS_print_network_type (c),
+                  GNUNET_NT_to_string (c),
                   GNUNET_ATS_DefaultBandwidth);
       out_dest[c] = GNUNET_ATS_DefaultBandwidth;
     }
@@ -2820,7 +2820,7 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
       {
           GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                       _("Could not load quota for network `%s':  `%s', assigning default bandwidth %llu\n"),
-                      GNUNET_ATS_print_network_type (c),
+                      GNUNET_NT_to_string (c),
                       quota_in_str,
                       GNUNET_ATS_DefaultBandwidth);
           in_dest[c] = GNUNET_ATS_DefaultBandwidth;
@@ -2829,7 +2829,7 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
       {
           GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                       "Inbound quota configured for network `%s' is %llu\n",
-                      GNUNET_ATS_print_network_type (c),
+                      GNUNET_NT_to_string (c),
                       in_dest[c]);
       }
       GNUNET_free (quota_in_str);
@@ -2838,19 +2838,19 @@ GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
     {
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   _("No outbound quota configure for network `%s', assigning default bandwidth %llu\n"),
-                  GNUNET_ATS_print_network_type (c),
+                  GNUNET_NT_to_string (c),
                   GNUNET_ATS_DefaultBandwidth);
       out_dest[c] = GNUNET_ATS_DefaultBandwidth;
     }
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                 "Loaded quota for network `%s' (in/out): %llu %llu\n",
-                GNUNET_ATS_print_network_type (c),
+                GNUNET_NT_to_string (c),
                 in_dest[c],
                 out_dest[c]);
     GNUNET_free (entry_out);
     GNUNET_free (entry_in);
   }
-  return GNUNET_ATS_NetworkTypeCount;
+  return GNUNET_NT_COUNT;
 }
 
 
@@ -3050,16 +3050,16 @@ GNUNET_ATS_solvers_solver_start (enum GNUNET_ATS_Solvers type)
   sh->env.addresses = sh->addresses;
   sh->env.bandwidth_changed_cb = &solver_bandwidth_changed_cb;
   sh->env.get_preferences = &get_preferences_cb;
-  sh->env.network_count = GNUNET_ATS_NetworkTypeCount;
+  sh->env.network_count = GNUNET_NT_COUNT;
   sh->env.info_cb = &solver_info_cb;
-  sh->env.network_count = GNUNET_ATS_NetworkTypeCount;
+  sh->env.network_count = GNUNET_NT_COUNT;
 
   /* start normalization */
   GAS_normalization_start ();
 
   /* load quotas */
-  if (GNUNET_ATS_NetworkTypeCount != GNUNET_ATS_solvers_load_quotas (e->cfg,
-      sh->env.out_quota, sh->env.in_quota, GNUNET_ATS_NetworkTypeCount))
+  if (GNUNET_NT_COUNT != GNUNET_ATS_solvers_load_quotas (e->cfg,
+      sh->env.out_quota, sh->env.in_quota, GNUNET_NT_COUNT))
   {
     GNUNET_break(0);
     GNUNET_free (sh->plugin);