REST: nothing triggers rest
[oweals/gnunet.git] / src / ats / ats_api_performance.c
index 7edc39e38992864d2ef0499fac4d9ebecd0f75ac..0954c02d5ec39d7b1f28b46cad6b850484415a06 100644 (file)
@@ -2,20 +2,20 @@
   This file is part of GNUnet.
   Copyright (C) 2010, 2011, 2016 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/ats_api_performance.c
@@ -383,9 +383,8 @@ handle_reservation_result (void *cls,
 
   amount = ntohl (rr->amount);
   rc = ph->reservation_head;
-  if (0 != memcmp (&rr->peer,
-                   &rc->peer,
-                   sizeof(struct GNUNET_PeerIdentity)))
+  if (0 != GNUNET_memcmp (&rr->peer,
+                   &rc->peer))
   {
     GNUNET_break(0);
     reconnect (ph);
@@ -498,7 +497,7 @@ handle_address_list (void *cls,
     return; /* was canceled */
 
   memset (&allzeros, '\0', sizeof (allzeros));
-  if ( (0 == memcmp (&allzeros, &pi->peer, sizeof(allzeros))) &&
+  if ( (0 == GNUNET_is_zero (&pi->peer)) &&
        (0 == plugin_name_length) &&
        (0 == plugin_address_length) )
   {
@@ -566,26 +565,26 @@ mq_error_handler (void *cls,
 static void
 reconnect (struct GNUNET_ATS_PerformanceHandle *ph)
 {
-  GNUNET_MQ_hd_var_size (peer_information,
-                         GNUNET_MESSAGE_TYPE_ATS_PEER_INFORMATION,
-                         struct PeerInformationMessage);
-  GNUNET_MQ_hd_fixed_size (reservation_result,
-                           GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT,
-                           struct ReservationResultMessage);
-  GNUNET_MQ_hd_var_size (address_list,
-                         GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_RESPONSE,
-                         struct PeerInformationMessage);
   struct GNUNET_MQ_MessageHandler handlers[] = {
-    make_peer_information_handler (ph),
-    make_reservation_result_handler (ph),
-    make_address_list_handler (ph),
+    GNUNET_MQ_hd_var_size (peer_information,
+                           GNUNET_MESSAGE_TYPE_ATS_PEER_INFORMATION,
+                           struct PeerInformationMessage,
+                           ph),
+    GNUNET_MQ_hd_fixed_size (reservation_result,
+                             GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT,
+                             struct ReservationResultMessage,
+                             ph),
+    GNUNET_MQ_hd_var_size (address_list,
+                           GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_RESPONSE,
+                           struct PeerInformationMessage,
+                           ph),
     GNUNET_MQ_handler_end ()
   };
   struct GNUNET_MQ_Envelope *env;
   struct ClientStartMessage *init;
 
   GNUNET_assert (NULL == ph->mq);
-  ph->mq = GNUNET_CLIENT_connecT (ph->cfg,
+  ph->mq = GNUNET_CLIENT_connect (ph->cfg,
                                   "ats",
                                   handlers,
                                   &mq_error_handler,
@@ -816,7 +815,7 @@ GNUNET_ATS_performance_list_addresses_cancel (struct GNUNET_ATS_AddressListHandl
  * @return a string or NULL if invalid
  */
 const char *
-GNUNET_ATS_print_preference_type (uint32_t type)
+GNUNET_ATS_print_preference_type (enum GNUNET_ATS_PreferenceKind type)
 {
   const char *prefs[] = GNUNET_ATS_PreferenceTypeString;
 
@@ -851,7 +850,7 @@ GNUNET_ATS_performance_change_preference (struct GNUNET_ATS_PerformanceHandle *p
   count = 0;
   va_start(ap, peer);
   while (GNUNET_ATS_PREFERENCE_END !=
-         (kind = va_arg (ap, enum GNUNET_ATS_PreferenceKind) ))
+         (kind = GNUNET_VA_ARG_ENUM (ap, GNUNET_ATS_PreferenceKind) ))
   {
     switch (kind)
     {
@@ -877,7 +876,7 @@ GNUNET_ATS_performance_change_preference (struct GNUNET_ATS_PerformanceHandle *p
   count = 0;
   va_start(ap, peer);
   while (GNUNET_ATS_PREFERENCE_END != (kind =
-      va_arg (ap, enum GNUNET_ATS_PreferenceKind) ))
+      GNUNET_VA_ARG_ENUM (ap, GNUNET_ATS_PreferenceKind) ))
   {
     pi[count].preference_kind = htonl (kind);
     switch (kind)
@@ -929,7 +928,7 @@ GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph,
   count = 0;
   va_start(ap, scope);
   while (GNUNET_ATS_PREFERENCE_END !=
-         (kind = va_arg (ap, enum GNUNET_ATS_PreferenceKind) ))
+         (kind = GNUNET_VA_ARG_ENUM (ap, GNUNET_ATS_PreferenceKind) ))
   {
     switch (kind)
     {
@@ -956,7 +955,7 @@ GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph,
   count = 0;
   va_start(ap, scope);
   while (GNUNET_ATS_PREFERENCE_END != (kind =
-      va_arg (ap, enum GNUNET_ATS_PreferenceKind) ))
+      GNUNET_VA_ARG_ENUM (ap, GNUNET_ATS_PreferenceKind) ))
   {
     pi[count].preference_kind = htonl (kind);
     switch (kind)