support compatibility mode for DNS names in gnunet-gns
[oweals/gnunet.git] / src / dht / gnunet-service-dht_hello.c
index d0f460a53a329901a46c772d9aeef9348b7d8d5a..a0141d1fb43db195c9ae72e08c73dacba5ec4c07 100644 (file)
@@ -1,22 +1,22 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2011 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2011 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 dht/gnunet-service-dht_hello.c
@@ -69,13 +69,15 @@ GDS_HELLO_get (const struct GNUNET_PeerIdentity *peer)
  * FIXME this is called once per address. Merge instead of replacing?
  */
 static void
-process_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
-               const struct GNUNET_HELLO_Message *hello, const char *err_msg)
+process_hello (void *cls,
+               const struct GNUNET_PeerIdentity *peer,
+               const struct GNUNET_HELLO_Message *hello,
+               const char *err_msg)
 {
   struct GNUNET_TIME_Absolute ex;
   struct GNUNET_HELLO_Message *hm;
 
-  if (hello == NULL)
+  if (NULL == hello)
     return;
   ex = GNUNET_HELLO_get_last_expiration (hello);
   if (0 == GNUNET_TIME_absolute_get_remaining (ex).rel_value_us)
@@ -86,7 +88,7 @@ process_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
   hm = GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer);
   GNUNET_free_non_null (hm);
   hm = GNUNET_malloc (GNUNET_HELLO_size (hello));
-  memcpy (hm, hello, GNUNET_HELLO_size (hello));
+  GNUNET_memcpy (hm, hello, GNUNET_HELLO_size (hello));
   GNUNET_assert (GNUNET_SYSERR !=
                  GNUNET_CONTAINER_multipeermap_put (peer_to_hello,
                                                     peer, hm,
@@ -100,8 +102,12 @@ process_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
 void
 GDS_HELLO_init ()
 {
-  pnc = GNUNET_PEERINFO_notify (GDS_cfg, GNUNET_NO, &process_hello, NULL);
-  peer_to_hello = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO);
+  pnc = GNUNET_PEERINFO_notify (GDS_cfg,
+                                GNUNET_NO,
+                                &process_hello,
+                                NULL);
+  peer_to_hello = GNUNET_CONTAINER_multipeermap_create (256,
+                                                        GNUNET_NO);
 }
 
 
@@ -110,8 +116,8 @@ GDS_HELLO_init ()
  */
 static int
 free_hello (void *cls,
-           const struct GNUNET_PeerIdentity *key,
-           void *hello)
+            const struct GNUNET_PeerIdentity *key,
+            void *hello)
 {
   GNUNET_free (hello);
   return GNUNET_OK;
@@ -131,9 +137,12 @@ GDS_HELLO_done ()
   }
   if (NULL != peer_to_hello)
   {
-    GNUNET_CONTAINER_multipeermap_iterate (peer_to_hello, &free_hello, NULL);
+    GNUNET_CONTAINER_multipeermap_iterate (peer_to_hello,
+                                           &free_hello,
+                                           NULL);
     GNUNET_CONTAINER_multipeermap_destroy (peer_to_hello);
   }
 }
 
+
 /* end of gnunet-service-dht_hello.c */