rescheduling sessions for udp
[oweals/gnunet.git] / src / datacache / plugin_datacache_template.c
index 501284c30b0612807a81a4e960a7896bde771591..306615571fd491b981864a59583fc39cda6d73c9 100644 (file)
@@ -4,7 +4,7 @@
 
      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 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
-#include "plugin_datacache.h"
+#include "gnunet_datacache_plugin.h"
 
 
 /**
  * Context for all functions in this plugin.
  */
-struct Plugin 
+struct Plugin
 {
   /**
    * Our execution environment.
@@ -43,23 +43,25 @@ struct Plugin
 /**
  * Store an item in the datastore.
  *
+ * @param cls closure (our "struct Plugin")
  * @param key key to store data under
  * @param size number of bytes in data
  * @param data data to store
  * @param type type of the value
  * @param discard_time when to discard the value in any case
- * @return 0 on error, number of bytes used otherwise
+ * @param path_info_len number of entries in 'path_info'
+ * @param path_info a path through the network
+ * @return 0 if duplicate, -1 on error, number of bytes used otherwise
  */
-static uint32_t 
-template_plugin_put (void *cls,
-                    const GNUNET_HashCode * key,
-                    uint32_t size,
-                    const char *data,
-                    uint32_t type,
-                    struct GNUNET_TIME_Absolute discard_time)
+static ssize_t
+template_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size,
+                     const char *data, enum GNUNET_BLOCK_Type type,
+                     struct GNUNET_TIME_Absolute discard_time,
+                    unsigned int path_info_len,
+                    const struct GNUNET_PeerIdentity *path_info)
 {
   GNUNET_break (0);
-  return 0;
+  return -1;
 }
 
 
@@ -67,17 +69,17 @@ template_plugin_put (void *cls,
  * Iterate over the results for a particular key
  * in the datastore.
  *
+ * @param cls closure (our "struct Plugin")
  * @param key
  * @param type entries of which type are relevant?
  * @param iter maybe NULL (to just count)
+ * @param iter_cls closure for iter
  * @return the number of results found
  */
-static unsigned int 
-template_plugin_get (void *cls,
-                    const GNUNET_HashCode * key,
-                    uint32_t type,
-                    GNUNET_DATACACHE_Iterator iter,
-                    void *iter_cls)
+static unsigned int
+template_plugin_get (void *cls, const struct GNUNET_HashCode * key,
+                     enum GNUNET_BLOCK_Type type,
+                     GNUNET_DATACACHE_Iterator iter, void *iter_cls)
 {
   GNUNET_break (0);
   return 0;
@@ -87,10 +89,11 @@ template_plugin_get (void *cls,
 /**
  * Delete the entry with the lowest expiration value
  * from the datacache right now.
- * 
+ *
+ * @param cls closure (our "struct Plugin")
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
- */ 
-static int 
+ */
+static int
 template_plugin_del (void *cls)
 {
   GNUNET_break (0);
@@ -100,6 +103,9 @@ template_plugin_del (void *cls)
 
 /**
  * Entry point for the plugin.
+ *
+ * @param cls closure (the "struct GNUNET_DATACACHE_PluginEnvironmnet")
+ * @return the plugin's closure (our "struct Plugin")
  */
 void *
 libgnunet_plugin_datacache_template_init (void *cls)
@@ -115,14 +121,17 @@ libgnunet_plugin_datacache_template_init (void *cls)
   api->get = &template_plugin_get;
   api->put = &template_plugin_put;
   api->del = &template_plugin_del;
-  GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
-                   "template", _("Template datacache running\n"));
+  GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "template",
+                   _("Template datacache running\n"));
   return api;
 }
 
 
 /**
  * Exit point from the plugin.
+ *
+ * @param cls closure (our "struct Plugin")
+ * @return NULL
  */
 void *
 libgnunet_plugin_datacache_template_done (void *cls)
@@ -138,4 +147,3 @@ libgnunet_plugin_datacache_template_done (void *cls)
 
 
 /* end of plugin_datacache_template.c */
-