fix
[oweals/gnunet.git] / src / datacache / plugin_datacache_template.c
index d1f162c170b0404f049375cd60668a89760d06f1..60862dac2a846b2eb0c0907787161fccf31a168f 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
  * @brief template for an implementation of a database backend for the datacache
  * @author Christian Grothoff
  */
-#ifndef PLUGIN_DATACACHE_H
-#define PLUGIN_DATACACHE_H
-
-#include "plugin_datacache.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#if 0                           /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_datacache_plugin.h"
 
 
 /**
@@ -46,13 +36,14 @@ struct Plugin
   /**
    * Our execution environment.
    */
-  struct GNUNET_DATASTORE_PluginEnvironment *env;
+  struct GNUNET_DATACACHE_PluginEnvironment *env;
 };
 
 
 /**
  * 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
@@ -60,12 +51,12 @@ struct Plugin
  * @param discard_time when to discard the value in any case
  * @return 0 on error, number of bytes used otherwise
  */
-static uint32_t 
+static size_t 
 template_plugin_put (void *cls,
                     const GNUNET_HashCode * key,
-                    uint32_t size,
+                    size_t size,
                     const char *data,
-                    uint32_t type,
+                    enum GNUNET_BLOCK_Type type,
                     struct GNUNET_TIME_Absolute discard_time)
 {
   GNUNET_break (0);
@@ -77,15 +68,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,
+                    enum GNUNET_BLOCK_Type type,
                     GNUNET_DATACACHE_Iterator iter,
                     void *iter_cls)
 {
@@ -98,6 +91,7 @@ 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 
@@ -110,6 +104,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)
@@ -133,6 +130,9 @@ libgnunet_plugin_datacache_template_init (void *cls)
 
 /**
  * Exit point from the plugin.
+ *
+ * @param cls closure (our "struct Plugin")
+ * @return NULL
  */
 void *
 libgnunet_plugin_datacache_template_done (void *cls)