REST: nothing triggers rest
[oweals/gnunet.git] / src / ats / ats_api_scheduling.c
index c4174f99e9af588e2adfcf1b32f8b0f3aa81c729..532426e91371423b668cd1c3777bb125285742d9 100644 (file)
@@ -2,20 +2,20 @@
      This file is part of GNUnet.
      Copyright (C) 2010-2015 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 Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-     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.
+     SPDX-License-Identifier: AGPL3.0-or-later
 */
 /**
  * @file ats/ats_api_scheduling.c
@@ -230,9 +230,8 @@ find_session (struct GNUNET_ATS_SchedulingHandle *sh,
        as we communicate asynchronously with the ATS service. */
     return NULL;
   }
-  if (0 != memcmp (peer,
-                   &ar->address->peer,
-                   sizeof (struct GNUNET_PeerIdentity)))
+  if (0 != GNUNET_memcmp (peer,
+                   &ar->address->peer))
   {
     GNUNET_break (0);
     return NULL;
@@ -298,9 +297,8 @@ find_session_id (struct GNUNET_ATS_SchedulingHandle *sh,
          (GNUNET_NO == sh->session_array[i]->in_destroy) &&
          ( (session == sh->session_array[i]->session) ||
            (NULL == sh->session_array[i]->session) ) &&
-         (0 == memcmp (&address->peer,
-                       &sh->session_array[i]->address->peer,
-                       sizeof (struct GNUNET_PeerIdentity))) &&
+         (0 == GNUNET_memcmp (&address->peer,
+                       &sh->session_array[i]->address->peer)) &&
          (0 == GNUNET_HELLO_address_cmp (address,
                                          sh->session_array[i]->address)) )
       return i;
@@ -478,7 +476,7 @@ send_add_address_message (struct GNUNET_ATS_SchedulingHandle *sh,
 
   if (NULL == sh->mq)
     return; /* disconnected, skip for now */
-  GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != ar->properties.scope);
+  GNUNET_break (GNUNET_NT_UNSPECIFIED != ar->properties.scope);
   namelen = strlen (ar->address->transport_name) + 1;
   msize = ar->address->address_length + namelen;
   ev = GNUNET_MQ_msg_extra (m, msize, GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD);
@@ -515,15 +513,15 @@ send_add_address_message (struct GNUNET_ATS_SchedulingHandle *sh,
 static void
 reconnect (struct GNUNET_ATS_SchedulingHandle *sh)
 {
-  GNUNET_MQ_hd_fixed_size (ats_session_release,
-                          GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE,
-                          struct GNUNET_ATS_SessionReleaseMessage);
-  GNUNET_MQ_hd_fixed_size (ats_address_suggestion,
-                          GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION,
-                          struct AddressSuggestionMessage);
   struct GNUNET_MQ_MessageHandler handlers[] = {
-    make_ats_session_release_handler (sh),
-    make_ats_address_suggestion_handler (sh),
+    GNUNET_MQ_hd_fixed_size (ats_session_release,
+                             GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE,
+                             struct GNUNET_ATS_SessionReleaseMessage,
+                             sh),
+    GNUNET_MQ_hd_fixed_size (ats_address_suggestion,
+                             GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION,
+                             struct AddressSuggestionMessage,
+                             sh),
     GNUNET_MQ_handler_end ()
   };
   struct GNUNET_MQ_Envelope *ev;
@@ -532,7 +530,7 @@ reconnect (struct GNUNET_ATS_SchedulingHandle *sh)
   struct GNUNET_ATS_AddressRecord *ar;
 
   GNUNET_assert (NULL == sh->mq);
-  sh->mq = GNUNET_CLIENT_connecT (sh->cfg,
+  sh->mq = GNUNET_CLIENT_connect (sh->cfg,
                                   "ats",
                                   handlers,
                                   &error_handler,
@@ -654,12 +652,12 @@ GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh,
     GNUNET_break (0);
     return NULL;
   }
-  GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != prop->scope);
+  GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope);
   namelen = strlen (address->transport_name) + 1;
   msize = address->address_length + namelen;
-  if ((msize + sizeof (struct AddressUpdateMessage) >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
-      (address->address_length >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
-      (namelen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) )
+  if ((msize + sizeof (struct AddressUpdateMessage) >= GNUNET_MAX_MESSAGE_SIZE) ||
+      (address->address_length >= GNUNET_MAX_MESSAGE_SIZE) ||
+      (namelen >= GNUNET_MAX_MESSAGE_SIZE) )
   {
     /* address too large for us, this should not happen */
     GNUNET_break (0);
@@ -757,7 +755,7 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_AddressRecord *ar,
        ar->address->transport_name,
        ar->session,
        ar->slot);
-  GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != prop->scope);
+  GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope);
   GNUNET_ATS_properties_hton (&ar->properties,
                               prop);
   if (NULL == sh->mq)