LRN's patch argument order
[oweals/gnunet.git] / src / util / pseudonym.c
index 85a485098661635ec55b2669c3783256ed572f25..356a83b6b60f18dd26f92c23470029cd07b0176d 100644 (file)
 #include "gnunet_pseudonym_lib.h"
 #include "gnunet_bio_lib.h"
 
-/** 
+#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
+
+#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename)
+
+/**
  * Name of the directory which stores meta data for pseudonym
  */
 #define PS_METADATA_DIR DIR_SEPARATOR_STR "data" DIR_SEPARATOR_STR "pseudonyms" DIR_SEPARATOR_STR "metadata" DIR_SEPARATOR_STR
 
-/** 
+/**
  * Name of the directory which stores names for pseudonyms
  */
 #define PS_NAMES_DIR    DIR_SEPARATOR_STR "data" DIR_SEPARATOR_STR "pseudonyms" DIR_SEPARATOR_STR "names"    DIR_SEPARATOR_STR
 
 
-/** 
+/**
+ * Configuration section we use.
+ */
+#define GNUNET_CLIENT_SERVICE_NAME "client"
+
+
+
+/**
  * Registered callbacks for discovery of pseudonyms.
  */
 struct DiscoveryCallback
 {
-  /** 
+  /**
    * This is a linked list.
    */
   struct DiscoveryCallback *next;
 
-  /** 
+  /**
    * Function to call each time a pseudonym is discovered.
    */
   GNUNET_PSEUDONYM_Iterator callback;
 
-  /** 
+  /**
    * Closure for callback.
    */
   void *closure;
 };
 
 
-/** 
- * Head of the linked list of functions to call when 
+/**
+ * Head of the linked list of functions to call when
  * new pseudonyms are added.
  */
 static struct DiscoveryCallback *head;
@@ -258,10 +269,9 @@ read_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
   }
   if (GNUNET_OK != GNUNET_BIO_read_close (fileR, &emsg))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                _
-                ("Failed to parse metadata about pseudonym from file `%s': %s\n"),
-                fn, emsg);
+    LOG (GNUNET_ERROR_TYPE_WARNING,
+         _("Failed to parse metadata about pseudonym from file `%s': %s\n"), fn,
+         emsg);
     GNUNET_break (GNUNET_OK == GNUNET_DISK_directory_remove (fn));
     GNUNET_CONTAINER_meta_data_destroy (*meta);
     *meta = NULL;
@@ -280,7 +290,7 @@ read_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
 /**
  * Return the unique, human readable name for the given namespace.
  *
- * @param cfg configuration 
+ * @param cfg configuration
  * @param nsid cryptographic ID of the namespace
  * @return NULL on failure (should never happen)
  */
@@ -356,7 +366,7 @@ GNUNET_PSEUDONYM_id_to_name (const struct GNUNET_CONFIGURATION_Handle *cfg,
     idx = i;
     if (sizeof (GNUNET_HashCode) !=
         GNUNET_DISK_file_write (fh, nsid, sizeof (GNUNET_HashCode)))
-      GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "write", fn);
+      LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "write", fn);
   }
   GNUNET_DISK_file_close (fh);
   ret = GNUNET_malloc (strlen (name) + 32);
@@ -489,7 +499,7 @@ list_pseudonym_helper (void *cls, const char *fullname)
 /**
  * List all available pseudonyms.
  *
- * @param cfg overall configuration 
+ * @param cfg overall configuration
  * @param iterator function to call for each pseudonym
  * @param closure closure for iterator
  * @return number of pseudonyms found