diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-04-26 16:56:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-04-26 16:56:00 +0000 |
commit | 4757258de33285fed2aa318c374dcdbf586c29f0 (patch) | |
tree | 283fa337cdaa54fbb3bbf08c937fdb6467c2b5d1 /src/include/gnunet_dht_service.h | |
parent | 506d42b2ba6eb104e64fd0c8889ea7233a9b96b3 (diff) | |
download | gnunet-4757258de33285fed2aa318c374dcdbf586c29f0.tar.gz gnunet-4757258de33285fed2aa318c374dcdbf586c29f0.zip |
-fixing #2277
Diffstat (limited to 'src/include/gnunet_dht_service.h')
-rw-r--r-- | src/include/gnunet_dht_service.h | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h index df9233f4d..eecbf66af 100644 --- a/src/include/gnunet_dht_service.h +++ b/src/include/gnunet_dht_service.h | |||
@@ -121,6 +121,28 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle); | |||
121 | 121 | ||
122 | /* *************** Standard API: get and put ******************* */ | 122 | /* *************** Standard API: get and put ******************* */ |
123 | 123 | ||
124 | |||
125 | /** | ||
126 | * Opaque handle to cancel a PUT operation. | ||
127 | */ | ||
128 | struct GNUNET_DHT_PutHandle; | ||
129 | |||
130 | |||
131 | /** | ||
132 | * Type of a PUT continuation. You must not call | ||
133 | * "GNUNET_DHT_disconnect" in this continuation. | ||
134 | * | ||
135 | * @param cls closure | ||
136 | * @param success GNUNET_OK if the PUT was transmitted, | ||
137 | * GNUNET_NO on timeout, | ||
138 | * GNUNET_SYSERR on disconnect from service | ||
139 | * after the PUT message was transmitted | ||
140 | * (so we don't know if it was received or not) | ||
141 | */ | ||
142 | typedef void (*GNUNET_DHT_PutContinuation)(void *cls, | ||
143 | int success); | ||
144 | |||
145 | |||
124 | /** | 146 | /** |
125 | * Perform a PUT operation storing data in the DHT. | 147 | * Perform a PUT operation storing data in the DHT. |
126 | * | 148 | * |
@@ -135,20 +157,38 @@ GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle); | |||
135 | * @param exp desired expiration time for the value | 157 | * @param exp desired expiration time for the value |
136 | * @param timeout how long to wait for transmission of this request | 158 | * @param timeout how long to wait for transmission of this request |
137 | * @param cont continuation to call when done (transmitting request to service) | 159 | * @param cont continuation to call when done (transmitting request to service) |
138 | * You must not call GNUNET_DHT_DISCONNECT in this continuation | 160 | * You must not call "GNUNET_DHT_disconnect" in this continuation |
139 | * @param cont_cls closure for cont | 161 | * @param cont_cls closure for cont |
162 | * @return handle to cancel the "PUT" operation, NULL on error | ||
163 | * (size too big) | ||
140 | */ | 164 | */ |
141 | void | 165 | struct GNUNET_DHT_PutHandle * |
142 | GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const GNUNET_HashCode * key, | 166 | GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const GNUNET_HashCode * key, |
143 | uint32_t desired_replication_level, | 167 | uint32_t desired_replication_level, |
144 | enum GNUNET_DHT_RouteOption options, | 168 | enum GNUNET_DHT_RouteOption options, |
145 | enum GNUNET_BLOCK_Type type, size_t size, const char *data, | 169 | enum GNUNET_BLOCK_Type type, size_t size, const char *data, |
146 | struct GNUNET_TIME_Absolute exp, | 170 | struct GNUNET_TIME_Absolute exp, |
147 | struct GNUNET_TIME_Relative timeout, GNUNET_SCHEDULER_Task cont, | 171 | struct GNUNET_TIME_Relative timeout, |
172 | GNUNET_DHT_PutContinuation cont, | ||
148 | void *cont_cls); | 173 | void *cont_cls); |
149 | 174 | ||
150 | 175 | ||
151 | /** | 176 | /** |
177 | * Cancels a DHT PUT operation. Note that the PUT request may still | ||
178 | * go out over the network (we can't stop that); However, if the PUT | ||
179 | * has not yet been sent to the service, cancelling the PUT will stop | ||
180 | * this from happening (but there is no way for the user of this API | ||
181 | * to tell if that is the case). The only use for this API is to | ||
182 | * prevent a later call to 'cont' from "GNUNET_DHT_put" (i.e. because | ||
183 | * the system is shutting down). | ||
184 | * | ||
185 | * @param ph put operation to cancel ('cont' will no longer be called) | ||
186 | */ | ||
187 | void | ||
188 | GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph); | ||
189 | |||
190 | |||
191 | /** | ||
152 | * Iterator called on each result obtained for a DHT | 192 | * Iterator called on each result obtained for a DHT |
153 | * operation that expects a reply | 193 | * operation that expects a reply |
154 | * | 194 | * |