aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-07-26 21:47:30 +0000
committerChristian Grothoff <christian@grothoff.org>2009-07-26 21:47:30 +0000
commit138b0402c39ff1c8e725bc1fe3f96e0d7e82dd70 (patch)
tree74d69e9699cdfd40c1c07d43247401a693583fd6 /src/include
parent004df66e9aafab7fa042661cf1bb7879de5064be (diff)
downloadgnunet-138b0402c39ff1c8e725bc1fe3f96e0d7e82dd70.tar.gz
gnunet-138b0402c39ff1c8e725bc1fe3f96e0d7e82dd70.zip
DHT and datacache API refinements
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_datacache_lib.h2
-rw-r--r--src/include/gnunet_dht_service.h74
2 files changed, 71 insertions, 5 deletions
diff --git a/src/include/gnunet_datacache_lib.h b/src/include/gnunet_datacache_lib.h
index 8eb724bfa..3bd76df32 100644
--- a/src/include/gnunet_datacache_lib.h
+++ b/src/include/gnunet_datacache_lib.h
@@ -74,6 +74,7 @@ void GNUNET_DATACACHE_destroy (struct GNUNET_DATACACHE_Handle *h);
74 * An iterator over a set of items stored in the datacache. 74 * An iterator over a set of items stored in the datacache.
75 * 75 *
76 * @param cls closure 76 * @param cls closure
77 * @param exp when will the content expire?
77 * @param key key for the content 78 * @param key key for the content
78 * @param size number of bytes in data 79 * @param size number of bytes in data
79 * @param data content stored 80 * @param data content stored
@@ -81,6 +82,7 @@ void GNUNET_DATACACHE_destroy (struct GNUNET_DATACACHE_Handle *h);
81 * @return GNUNET_OK to continue iterating, GNUNET_SYSERR to abort 82 * @return GNUNET_OK to continue iterating, GNUNET_SYSERR to abort
82 */ 83 */
83typedef int (*GNUNET_DATACACHE_Iterator) (void *cls, 84typedef int (*GNUNET_DATACACHE_Iterator) (void *cls,
85 struct GNUNET_TIME_Absolute exp,
84 const GNUNET_HashCode * key, 86 const GNUNET_HashCode * key,
85 uint32_t size, 87 uint32_t size,
86 const char *data, 88 const char *data,
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h
index 8dcbc19c5..0dab0bcbc 100644
--- a/src/include/gnunet_dht_service.h
+++ b/src/include/gnunet_dht_service.h
@@ -37,11 +37,60 @@ extern "C"
37#endif 37#endif
38#endif 38#endif
39 39
40// FIXME: document 40
41/**
42 * Connection to the DHT service.
43 */
44struct GNUNET_DHT_Handle;
45
46
47/**
48 * Initialize the connection with the DHT service.
49 *
50 * @param cfg configuration to use
51 * @param sched scheduler to use
52 * @return NULL on error
53 */
54struct GNUNET_DHT_Handle *
55GNUNET_DHT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
56 struct GNUNET_SCHEDULER_Handle *sched);
57
58
59/**
60 * Shutdown connection with the DHT service.
61 *
62 * @param h connection to shut down
63 */
64void
65GNUNET_DHT_connect (struct GNUNET_DHT_Handle *h);
66
67
68/**
69 * Handle to control a GET operation.
70 */
41struct GNUNET_DHT_GetHandle; 71struct GNUNET_DHT_GetHandle;
42 72
43 73
44/** 74/**
75 * Iterator called on each result obtained for a GET
76 * operation.
77 *
78 * @param cls closure
79 * @param exp when will this value expire
80 * @param key key of the result
81 * @param type type of the result
82 * @param size number of bytes in data
83 * @param data pointer to the result data
84 */
85typedef void (*GNUNET_DHT_Iterator)(void *cls,
86 struct GNUNET_TIME_Absolute exp,
87 const GNUNET_HashCode * key,
88 uint32_t type,
89 uint32_t size,
90 const void *data);
91
92
93/**
45 * Perform an asynchronous GET operation on the DHT identified. 94 * Perform an asynchronous GET operation on the DHT identified.
46 * 95 *
47 * @param type expected type of the response object 96 * @param type expected type of the response object
@@ -60,23 +109,38 @@ GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *h,
60 109
61/** 110/**
62 * Stop async DHT-get. Frees associated resources. 111 * Stop async DHT-get. Frees associated resources.
112 *
113 * @param record GET operation to stop.
63 */ 114 */
64int GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *record); 115void
116GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *record);
65 117
66 118
67// FIXME: add continuation? expiration?
68/** 119/**
69 * Perform a PUT operation on the DHT identified by 'table' storing 120 * Perform a PUT operation on the DHT identified by 'table' storing
70 * a binding of 'key' to 'value'. The peer does not have to be part 121 * a binding of 'key' to 'value'. The peer does not have to be part
71 * of the table (if so, we will attempt to locate a peer that is!) 122 * of the table (if so, we will attempt to locate a peer that is!)
72 * 123 *
124 * @param h handle to DHT service
73 * @param key the key to store under 125 * @param key the key to store under
126 * @param type type of the value
127 * @param size number of bytes in data; must be less than 64k
128 * @param data the data to store
129 * @param exp desired expiration time for the value
130 * @param cont continuation to call when done;
131 * reason will be TIMEOUT on error,
132 * reason will be PREREQ_DONE on success
133 * @param cont_cls closure for cont
134 *
74 */ 135 */
75int GNUNET_DHT_put (struct GNUNET_DHT_Handle *h, 136int GNUNET_DHT_put (struct GNUNET_DHT_Handle *h,
76 const GNUNET_HashCode * key, 137 const GNUNET_HashCode * key,
77 uint32_t type, 138 uint32_t type,
78 uint32_t size, 139 uint32_t size,
79 const char *data); 140 const char *data,
141 struct GNUNET_TIME_Relative exp,
142 GNUNET_SCHEDULER_Task cont,
143 void *cont_cls);
80 144
81 145
82#if 0 /* keep Emacsens' auto-indent happy */ 146#if 0 /* keep Emacsens' auto-indent happy */