gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r8325 - GNUnet/src/include


From: gnunet
Subject: [GNUnet-SVN] r8325 - GNUnet/src/include
Date: Wed, 11 Mar 2009 14:50:10 -0600

Author: nevans
Date: 2009-03-11 14:50:10 -0600 (Wed, 11 Mar 2009)
New Revision: 8325

Added:
   GNUnet/src/include/gnunet_dv_dht_lib.h
   GNUnet/src/include/gnunet_dv_dht_service.h
   GNUnet/src/include/gnunet_dv_service.h
Log:


Added: GNUnet/src/include/gnunet_dv_dht_lib.h
===================================================================
--- GNUnet/src/include/gnunet_dv_dht_lib.h                              (rev 0)
+++ GNUnet/src/include/gnunet_dv_dht_lib.h      2009-03-11 20:50:10 UTC (rev 
8325)
@@ -0,0 +1,135 @@
+/*
+      This file is part of GNUnet
+      (C) 2004, 2005, 2006, 2008 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
+      by the Free Software Foundation; either version 2, or (at your
+      option) any later version.
+
+      GNUnet is distributed in the hope that it will be useful, but
+      WITHOUT ANY WARRANTY; without even the implied warranty of
+      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+      General Public License for more details.
+
+      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.
+ */
+
+/**
+ * @file include/gnunet_dv_dht_lib.h
+ * @brief convenience API to the DV_DHT infrastructure for use by clients
+ * @author Christian Grothoff, Nathan Evans
+ */
+
+#ifndef GNUNET_DV_DHT_LIB_H
+#define GNUNET_DV_DHT_LIB_H
+
+#include "gnunet_dv_dht_service.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0                           /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+/**
+ * Opaque handle for asynchronous DHT get operation group.
+ */
+struct GNUNET_DV_DHT_Context;
+
+/**
+ * Opaque handle for a DHT get request.
+ */
+struct GNUNET_DV_DHT_GetRequest;
+
+/**
+ * Set up a context for performing asynchronous DHT operations.
+ *
+ * @param resultCallback function to call for results,
+ *        the operation also aborts if the callback returns
+ *        GNUNET_SYSERR
+ * @return NULL on error
+ */
+struct GNUNET_DV_DHT_Context *GNUNET_DV_DHT_context_create (struct
+                                                            
GNUNET_GC_Configuration
+                                                            *cfg,
+                                                            struct
+                                                            GNUNET_GE_Context
+                                                            *ectx,
+                                                            
GNUNET_ResultProcessor
+                                                            resultCallback,
+                                                            void
+                                                            
*resCallbackClosure);
+
+/**
+ * Start an asynchronous GET operation on the DHT looking for
+ * key.
+ *
+ * @param type the type of key to look up
+ * @param key the key to look up
+ * @return NULL on error
+ */
+struct GNUNET_DV_DHT_GetRequest *GNUNET_DV_DHT_get_start (struct
+                                                          GNUNET_DV_DHT_Context
+                                                          *ctx,
+                                                          unsigned int type,
+                                                          const
+                                                          GNUNET_HashCode *
+                                                          key);
+
+/**
+ * Stop an asynchronous GET operation on the DHT looking for
+ * key.
+ *
+ * @param handle request to stop
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ */
+int GNUNET_DV_DHT_get_stop (struct GNUNET_DV_DHT_Context *ctx,
+                            struct GNUNET_DV_DHT_GetRequest *handle);
+
+/**
+ * Destroy a previously created context for DHT operations.
+ *
+ * @param ctx context to destroy
+ * @return GNUNET_SYSERR on error
+ */
+int GNUNET_DV_DHT_context_destroy (struct GNUNET_DV_DHT_Context *ctx);
+
+/**
+ * Perform a synchronous put operation.
+ *
+ * @param key the key to store
+ * @param value what to store
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ */
+int GNUNET_DV_DHT_put (struct GNUNET_GC_Configuration *cfg,
+                       struct GNUNET_GE_Context *ectx,
+                       const GNUNET_HashCode * key,
+                       unsigned int type, unsigned int size,
+                       const char *value);
+
+
+
+/**
+ * Check if this peer has DHT connections to
+ * any other peer.
+ *
+ * @param sock connection to gnunetd
+ * @return number of connections
+ */
+unsigned long long
+GNUNET_DV_DHT_test_connected (struct GNUNET_ClientServerConnection *sock);
+
+#if 0                           /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GNUNET_DHT_LIB_H */

Added: GNUnet/src/include/gnunet_dv_dht_service.h
===================================================================
--- GNUnet/src/include/gnunet_dv_dht_service.h                          (rev 0)
+++ GNUnet/src/include/gnunet_dv_dht_service.h  2009-03-11 20:50:10 UTC (rev 
8325)
@@ -0,0 +1,92 @@
+/*
+      This file is part of GNUnet
+      (C) 2004, 2005, 2006, 2008 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
+      by the Free Software Foundation; either version 2, or (at your
+      option) any later version.
+
+      GNUnet is distributed in the hope that it will be useful, but
+      WITHOUT ANY WARRANTY; without even the implied warranty of
+      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+      General Public License for more details.
+
+      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.
+ */
+
+/**
+ * @file include/gnunet_dv_dht_service.h
+ * @brief API to the DHT-module.  This API is what will be used by
+ *     DV_DHT clients that run as modules within gnunetd.  If you
+ *     are writing a client look at either dv_dht.h (if you
+ *     want to handle the communication with gnunetd yourself) or
+ *     at gnunet_dv_dht_lib to use the convenience library.
+ * @author Christian Grothoff
+ */
+
+#ifndef GNUNET_DV_DHT_SERVICE_H
+#define GNUNET_DV_DHT_SERVICE_H
+
+#include "gnunet_core.h"
+#include "gnunet_dstore_service.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0                           /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+struct GNUNET_DHT_GetHandle;
+
+/**
+ * Functions of the DHT Service API.
+ */
+typedef struct
+{
+
+  /**
+   * Perform an asynchronous GET operation on the DHT identified.
+   *
+   * @param type expected type of the response object
+   * @param key the key to look up
+   * @param callback function to call on each result
+   * @param closure extra argument to callback
+   * @return handle to stop the async get
+   */
+  struct GNUNET_DV_DHT_GetHandle *(*get_start) (unsigned int type,
+                                                const GNUNET_HashCode * key,
+                                                GNUNET_ResultProcessor
+                                                callback, void *cls);
+
+  /**
+   * Stop async DHT-get.  Frees associated resources.
+   */
+  int (*get_stop) (struct GNUNET_DV_DHT_GetHandle * record);
+
+  /**
+   * Perform a PUT operation on the DHT identified by 'table' storing
+   * a binding of 'key' to 'value'.  The peer does not have to be part
+   * of the table (if so, we will attempt to locate a peer that is!)
+   *
+   * @param key the key to store under
+   */
+  int (*put) (const GNUNET_HashCode * key,
+              unsigned int type, unsigned int size, const char *data);
+
+} GNUNET_DV_DHT_ServiceAPI;
+
+#if 0                           /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* DV_DHT_SERVICE_API_H */

Added: GNUnet/src/include/gnunet_dv_service.h
===================================================================
--- GNUnet/src/include/gnunet_dv_service.h                              (rev 0)
+++ GNUnet/src/include/gnunet_dv_service.h      2009-03-11 20:50:10 UTC (rev 
8325)
@@ -0,0 +1,53 @@
+/*
+ This file is part of GNUnet.
+ (C) 2008 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
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ 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.
+ */
+
+/**
+ * @author Nathan Evans
+ * @file include/gnunet_dv_service.h
+ * @brief dv is a distance vector type algorithm for providing distance vector
+ * routing. This is a simple service api for using it.
+ */
+
+#ifndef GNUNET_DV_SERVICE_H
+#define GNUNET_DV_SERVICE_H
+
+#include "gnunet_core.h"
+
+/**
+ * Functions of the DV Service API.
+ */
+typedef struct
+{
+  /**
+   * Send a message via DV
+   *
+   * @param recipient to which neighbor should this go
+   * @param message the message which should be sent
+   */
+  int (*dv_send) (const GNUNET_PeerIdentity * recipient,
+                  const GNUNET_MessageHeader * message,
+                  unsigned int importance, unsigned int maxdelay);
+
+  int (*dv_connections_iterate) (GNUNET_NodeIteratorCallback method,
+                                 void *arg);
+
+} GNUNET_DV_ServiceAPI;
+
+#endif /* end of gnunet_dv_service.h */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]