*/
struct GNUNET_DHT_Handle;
+/**
+ * Iterator called on each result obtained from a generic route
+ * operation
+ */
+typedef void (*GNUNET_DHT_MessageCallback)(void *cls,
+ int code);
/**
* Initialize the connection with the DHT service.
* @param cont_cls closure for cont
*/
void
-GNUNET_DHT_put (struct GNUNET_DHT_Handle *h,
+GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
const GNUNET_HashCode * key,
uint32_t type,
uint32_t size,
const char *data,
struct GNUNET_TIME_Absolute exp,
struct GNUNET_TIME_Relative timeout,
- GNUNET_SCHEDULER_Task cont,
+ GNUNET_DHT_MessageCallback cont,
void *cont_cls);
/**
- * Iterator called on each result obtained for a GET
- * operation.
+ * Iterator called on each result obtained for a DHT
+ * operation that expects a reply
*
* @param cls closure
* @param exp when will this value expire
* @param size number of bytes in data
* @param data pointer to the result data
*/
-typedef void (*GNUNET_DHT_Iterator)(void *cls,
+typedef void (*GNUNET_DHT_GetIterator)(void *cls,
struct GNUNET_TIME_Absolute exp,
const GNUNET_HashCode * key,
uint32_t type,
* Perform an asynchronous GET operation on the DHT identified.
*
* @param h handle to the DHT service
+ * @param timeout timeout for this request to be sent to the
+ * service
* @param type expected type of the response object
* @param key the key to look up
* @param iter function to call on each result
* @param iter_cls closure for iter
* @return handle to stop the async get, NULL on error
*/
-struct GNUNET_DHT_GetHandle *
+struct GNUNET_DHT_RouteHandle *
GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *h,
+ struct GNUNET_TIME_Relative timeout,
uint32_t type,
const GNUNET_HashCode * key,
- GNUNET_DHT_Iterator iter,
+ GNUNET_DHT_GetIterator iter,
void *iter_cls);
/**
* @param get_handle GET operation to stop.
*/
void
-GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle);
+GNUNET_DHT_get_stop (struct GNUNET_DHT_RouteHandle *get_handle);
/**
- * Iterator called on each result obtained from a FIND_PEER
+ * Iterator called on each result obtained from a find peer
* operation
*
* @param cls closure
- * @param peer a peer that was located
- * @param reply response generated by the peer (for example, a HELLO); or NULL
+ * @param reply response
*/
-typedef void (*GNUNET_DHT_ReplyProcessor)(void *cls,
+typedef void (*GNUNET_DHT_FindPeerProcessor)(void *cls,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *reply);
+/**
+ * Iterator called on each result obtained from a generic route
+ * operation
+ */
+typedef void (*GNUNET_DHT_ReplyProcessor)(void *cls,
+ const struct GNUNET_MessageHeader *reply);
+
+
/**
* Options for routing.
*/
GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE = 1
};
+/**
+ * Handle to control a route operation.
+ */
+struct GNUNET_DHT_RouteHandle;
/**
* Perform an asynchronous FIND_PEER operation on the DHT.
* @param iter_cls closure for iter
* @param timeout when to abort with an error if we fail to get
* a confirmation for the PUT from the local DHT service
- * @param cont continuation to call when done;
- * reason will be TIMEOUT on error,
- * reason will be PREREQ_DONE on success
+ * @param cont continuation to call when done, GNUNET_SYSERR if failed
+ * GNUNET_OK otherwise
* @param cont_cls closure for cont
* @return handle to stop the request
*/
-struct GNUNET_DHT_FindPeerHandle *
+struct GNUNET_DHT_RouteHandle *
GNUNET_DHT_route_start (struct GNUNET_DHT_Handle *handle,
const GNUNET_HashCode *key,
unsigned int desired_replication_level,
struct GNUNET_TIME_Relative timeout,
GNUNET_DHT_ReplyProcessor iter,
void *iter_cls,
- GNUNET_SCHEDULER_Task cont,
+ GNUNET_DHT_MessageCallback cont,
void *cont_cls);
void
-GNUNET_DHT_route_stop (struct GNUNET_DHT_FindPeerHandle *fph);
+GNUNET_DHT_route_stop (struct GNUNET_DHT_RouteHandle *fph);
#if 0 /* keep Emacsens' auto-indent happy */
*/
/**
- * Local DHT Get message, from API to service
+ * Local and P2P generic DHT message start type
*/
-#define GNUNET_MESSAGE_TYPE_DHT_GET 143
+#define GNUNET_MESSAGE_TYPE_DHT 142
/**
- * Local DHT Get stop message, from API to service
+ * Local and P2P generic DHT message stop type
*/
-#define GNUNET_MESSAGE_TYPE_DHT_GET_STOP 144
+#define GNUNET_MESSAGE_TYPE_DHT_STOP 143
+
+/**
+ * Local and message acknowledgment
+ */
+#define GNUNET_MESSAGE_TYPE_DHT_ACK 145
/**
* Local DHT Get message, from API to service
*/
-#define GNUNET_MESSAGE_TYPE_DHT_FIND_PEER 145
+#define GNUNET_MESSAGE_TYPE_DHT_GET 146
/**
* Local DHT Get stop message, from API to service
*/
-#define GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_STOP 146
+#define GNUNET_MESSAGE_TYPE_DHT_GET_STOP 147
/**
- * Local DHT Put message, from API to service
+ * Local DHT Get message, from API to service
*/
-#define GNUNET_MESSAGE_TYPE_DHT_PUT 147
+#define GNUNET_MESSAGE_TYPE_DHT_FIND_PEER 148
/**
- * Local DHT Get result message, from service to API
+ * Local DHT Get stop message, from API to service
*/
-#define GNUNET_MESSAGE_TYPE_DHT_GET_RESULT 149
+#define GNUNET_MESSAGE_TYPE_DHT_FIND_PEER_STOP 149
/**
- * Local DHT Put result message, from service to API
+ * Local DHT Put message, from API to service
*/
-#define GNUNET_MESSAGE_TYPE_DHT_PUT_RESULT 151
+#define GNUNET_MESSAGE_TYPE_DHT_PUT 150
+/**
+ * Local DHT Get result message, from service to API
+ */
+#define GNUNET_MESSAGE_TYPE_DHT_GET_RESULT 151
/**