use c99
[oweals/gnunet.git] / src / gns / gns_api.c
index f8ce026c745daa7b33333b78843b27eac6b7cd14..a1fe3680aba4ff888880c533d56f02c2dfcdc968 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2009-2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2009-2013 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
@@ -14,8 +14,8 @@
 
      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., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 /**
  * @file gns/gns_api.c
@@ -154,7 +154,7 @@ struct GNUNET_GNS_Handle
   /**
    * Reconnect task
    */
-  GNUNET_SCHEDULER_TaskIdentifier reconnect_task;
+  struct GNUNET_SCHEDULER_Task * reconnect_task;
 
   /**
    * How long do we wait until we try to reconnect?
@@ -203,14 +203,13 @@ reconnect (struct GNUNET_GNS_Handle *handle)
  * Reconnect to GNS
  *
  * @param cls the handle
- * @param tc task context
  */
 static void
-reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls)
 {
   struct GNUNET_GNS_Handle *handle = cls;
 
-  handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
+  handle->reconnect_task = NULL;
   reconnect (handle);
 }
 
@@ -240,9 +239,10 @@ force_reconnect (struct GNUNET_GNS_Handle *handle)
                                 p);
   }
   handle->reconnect_backoff = GNUNET_TIME_STD_BACKOFF (handle->reconnect_backoff);
-  handle->reconnect_task = GNUNET_SCHEDULER_add_delayed (handle->reconnect_backoff,
-                                                    &reconnect_task,
-                                                    handle);
+  handle->reconnect_task
+    = GNUNET_SCHEDULER_add_delayed (handle->reconnect_backoff,
+                                   &reconnect_task,
+                                   handle);
 }
 
 
@@ -390,7 +390,7 @@ process_lookup_reply (struct GNUNET_GNS_LookupRequest *qe,
                                                              rd))
   {
     LOG (GNUNET_ERROR_TYPE_ERROR,
-        _("Failed to serialize lookup reply from GNS service!\n"));
+        _("Failed to deserialize lookup reply from GNS service!\n"));
     proc (proc_cls, 0, NULL);
   }
   else
@@ -484,10 +484,10 @@ GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle)
     GNUNET_CLIENT_disconnect (handle->client);
     handle->client = NULL;
   }
-  if (GNUNET_SCHEDULER_NO_TASK != handle->reconnect_task)
+  if (NULL != handle->reconnect_task)
   {
     GNUNET_SCHEDULER_cancel (handle->reconnect_task);
-    handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
+    handle->reconnect_task = NULL;
   }
   GNUNET_assert (NULL == handle->lookup_head);
   GNUNET_free (handle);
@@ -523,10 +523,10 @@ GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr)
  * @param name the name to look up
  * @param zone the zone to start the resolution in
  * @param type the record type to look up
- * @param only_cached #GNUNET_YES to only check locally (not in the DHT)
+ * @param options local options for the lookup
  * @param shorten_zone_key the private key of the shorten zone (can be NULL)
  * @param proc processor to call on result
- * @param proc_cls closure for processor
+ * @param proc_cls closure for @a proc
  * @return handle to the get request
  */
 struct GNUNET_GNS_LookupRequest*
@@ -534,7 +534,7 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
                   const char *name,
                   const struct GNUNET_CRYPTO_EcdsaPublicKey *zone,
                   uint32_t type,
-                  int only_cached,
+                  enum GNUNET_GNS_LocalOptions options,
                   const struct GNUNET_CRYPTO_EcdsaPrivateKey *shorten_zone_key,
                   GNUNET_GNS_LookupResultProcessor proc,
                   void *proc_cls)
@@ -576,7 +576,7 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
   lookup_msg->header.type = htons (GNUNET_MESSAGE_TYPE_GNS_LOOKUP);
   lookup_msg->header.size = htons (msize);
   lookup_msg->id = htonl (lr->r_id);
-  lookup_msg->only_cached = htonl (only_cached);
+  lookup_msg->options = htons ((uint16_t) options);
   lookup_msg->zone = *zone;
   lookup_msg->type = htonl (type);
   if (NULL != shorten_zone_key)