REST/NAMESTORE: rework API
[oweals/gnunet.git] / src / transport / transport_api_address_to_string.c
index 53e4c832c67fd7bc5530247ddf8f977621b1c77e..006e81f29edb23a70db4f31a419475dbb6d644b8 100644 (file)
@@ -2,20 +2,20 @@
      This file is part of GNUnet.
      Copyright (C) 2009-2014, 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 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 transport/transport_api_address_to_string.c
@@ -182,13 +182,13 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
                                     GNUNET_TRANSPORT_AddressToStringCallback aluc,
                                     void *aluc_cls)
 {
-  GNUNET_MQ_hd_var_size (reply,
-                         GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY,
-                         struct AddressToStringResultMessage);
   struct GNUNET_TRANSPORT_AddressToStringContext *alc
     = GNUNET_new (struct GNUNET_TRANSPORT_AddressToStringContext);
   struct GNUNET_MQ_MessageHandler handlers[] = {
-    make_reply_handler (alc),
+    GNUNET_MQ_hd_var_size (reply,
+                           GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY,
+                           struct AddressToStringResultMessage,
+                           alc),
     GNUNET_MQ_handler_end ()
   };
   size_t alen;
@@ -199,10 +199,10 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
 
   alen = address->address_length;
   slen = strlen (address->transport_name) + 1;
-  if ( (alen + slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE
+  if ( (alen + slen >= GNUNET_MAX_MESSAGE_SIZE
         - sizeof (struct AddressLookupMessage)) ||
-       (alen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
-       (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) )
+       (alen >= GNUNET_MAX_MESSAGE_SIZE) ||
+       (slen >= GNUNET_MAX_MESSAGE_SIZE) )
   {
     GNUNET_break (0);
     GNUNET_free (alc);
@@ -210,7 +210,7 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
   }
   alc->cb = aluc;
   alc->cb_cls = aluc_cls;
-  alc->mq = GNUNET_CLIENT_connecT (cfg,
+  alc->mq = GNUNET_CLIENT_connect (cfg,
                                    "transport",
                                    handlers,
                                    &mq_error_handler,
@@ -233,10 +233,10 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf
   msg->addrlen = htons ((uint16_t) alen);
   msg->timeout = GNUNET_TIME_relative_hton (timeout);
   addrbuf = (char *) &msg[1];
-  memcpy (addrbuf,
+  GNUNET_memcpy (addrbuf,
           address->address,
           alen);
-  memcpy (&addrbuf[alen],
+  GNUNET_memcpy (&addrbuf[alen],
           address->transport_name,
           slen);
   GNUNET_MQ_send (alc->mq,