-more datacache integration work
[oweals/gnunet.git] / src / testbed / gnunet-daemon-testbed-blacklist.c
index 04e920924d1f17d8396deedb89f94fe87fbb6d58..a7322d7534ce22b5b070dff71457d29f438314c9 100644 (file)
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      (C) 2008--2013 Christian Grothoff (and other contributing authors)
+      Copyright (C) 2008--2013 Christian Grothoff (and other contributing authors)
 
       GNUnet is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
 
 
 /**
- * @file testbed/gnunet-daemon-testbed-blacklist
+ * @file testbed/gnunet-daemon-testbed-blacklist.c
  * @brief daemon to restrict incoming connections from other peers at the
- *          transport layer of a peer 
- * @author Sree Harsha Totakura <sreeharsha@totakura.in> 
+ *          transport layer of a peer
+ * @author Sree Harsha Totakura <sreeharsha@totakura.in>
  */
 
 #include "platform.h"
@@ -56,7 +56,7 @@
 /**
  * The map to store the peer identities to allow/deny
  */
-static struct GNUNET_CONTAINER_MultiHashMap *map;
+static struct GNUNET_CONTAINER_MultiPeerMap *map;
 
 /**
  * The array of peer identities we read from whitelist/blacklist
@@ -72,7 +72,7 @@ struct GNUNET_TRANSPORT_Blacklist *bh;
 /**
  * Task for shutdown
  */
-static GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
+static struct GNUNET_SCHEDULER_Task * shutdown_task;
 
 /**
  * Are we allowing or denying access from peers
@@ -92,9 +92,9 @@ static int mode;
  *         #GNUNET_NO if not.
  */
 static int
-iterator (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterator (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
 {
-  GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (map, key,
+  GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (map, key,
                                                                      value));
   return GNUNET_YES;
 }
@@ -108,10 +108,10 @@ cleanup_map ()
 {
   if (NULL != map)
   {
-    GNUNET_assert (GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap_iterate (map,
+    GNUNET_assert (GNUNET_SYSERR != GNUNET_CONTAINER_multipeermap_iterate (map,
                                                                            &iterator,
                                                                            NULL));
-    GNUNET_CONTAINER_multihashmap_destroy (map);
+    GNUNET_CONTAINER_multipeermap_destroy (map);
     map = NULL;
   }
 }
@@ -143,9 +143,9 @@ static int
 check_access (void *cls, const struct GNUNET_PeerIdentity * pid)
 {
   int contains;
+
   if (NULL != map)
-    contains = GNUNET_CONTAINER_multihashmap_contains (map, &(pid->hashPubKey));
+    contains = GNUNET_CONTAINER_multipeermap_contains (map, pid);
   else
     contains = GNUNET_NO;
   if (ACCESS_DENY == mode)
@@ -167,7 +167,7 @@ setup_ac (const char *fname, const struct GNUNET_CONFIGURATION_Handle *cfg)
   uint64_t fsize;
   unsigned int npeers;
   unsigned int cnt;
-  
+
   GNUNET_assert (GNUNET_OK != GNUNET_DISK_file_size (fname, &fsize, GNUNET_NO,
                                                      GNUNET_YES));
   if (0 != (fsize % sizeof (struct GNUNET_PeerIdentity)))
@@ -178,13 +178,13 @@ setup_ac (const char *fname, const struct GNUNET_CONFIGURATION_Handle *cfg)
   npeers = fsize / sizeof (struct GNUNET_PeerIdentity);
   if (0 != npeers)
   {
-    map = GNUNET_CONTAINER_multihashmap_create (npeers, GNUNET_YES);
+    map = GNUNET_CONTAINER_multipeermap_create (npeers, GNUNET_YES);
     ilist = GNUNET_malloc_large (fsize);
     GNUNET_assert (fsize == GNUNET_DISK_fn_read (fname, ilist, fsize));
   }
   for (cnt = 0; cnt < npeers; cnt++)
   {
-    if (GNUNET_SYSERR == GNUNET_CONTAINER_multihashmap_put (map, &(ilist[cnt].hashPubKey),
+    if (GNUNET_SYSERR == GNUNET_CONTAINER_multipeermap_put (map, &ilist[cnt],
                                                             &ilist[cnt],
                                                             GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
     {
@@ -214,9 +214,9 @@ run (void *cls, char *const *args, const char *cfgfile,
   char *shome;
   char fname[PATH_MAX];
 
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (c, "PATHS",
-                                                          "SERVICEHOME",
-                                                          &shome))
+  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (c, "PATHS",
+                                                            "GNUNET_HOME",
+                                                            &shome))
   {
     GNUNET_break (0);
     return;