34 #define LOG(kind, ...) GNUNET_log_from (kind, "util-op", __VA_ARGS__)
117 return ++
h->last_op_id;
215 "%p Added operation #%" PRIu64
"\n",
261 "Could not find operation #%" PRIu64
"\n",
op_id);
273 (NULL !=
op->result_cb))
274 op->result_cb (
op->cls,
310 "%p Received result for operation #%" PRIu64
": %" PRId64
" (size: %u)\n",
332 "%p Cancelling operation #%" PRIu64
"\n",
static size_t data_size
Number of bytes in data.
static struct GNUNET_ARM_Operation * op
Current operation.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
uint32_t data
The data value.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
uint64_t GNUNET_OP_get_next_id(struct GNUNET_OP_Handle *h)
Get a unique operation ID to distinguish between asynchronous requests.
int GNUNET_OP_result(struct GNUNET_OP_Handle *h, uint64_t op_id, int64_t result_code, const void *data, uint16_t data_size, void **ctx)
Call the result callback of an operation and remove it.
void(* GNUNET_ResultCallback)(void *cls, int64_t result_code, const void *data, uint16_t data_size)
Function called with the result of an asynchronous operation.
int GNUNET_OP_get(struct GNUNET_OP_Handle *h, uint64_t op_id, GNUNET_ResultCallback *result_cb, void **cls, void **ctx)
Find operation by ID.
int GNUNET_OP_remove(struct GNUNET_OP_Handle *h, uint64_t op_id)
Remove / cancel an operation.
struct GNUNET_OP_Handle * GNUNET_OP_create()
Create new operations handle.
void GNUNET_OP_destroy(struct GNUNET_OP_Handle *h)
Destroy operations handle.
uint64_t GNUNET_OP_add(struct GNUNET_OP_Handle *h, GNUNET_ResultCallback result_cb, void *cls, void *ctx)
Add a new operation.
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
static int op_result(struct GNUNET_OP_Handle *h, uint64_t op_id, int64_t result_code, const void *data, uint16_t data_size, void **ctx, uint8_t cancel)
Remove an operation, and call its result callback (unless it was cancelled).
static struct OperationListItem * op_find(struct GNUNET_OP_Handle *h, uint64_t op_id)
Find operation by ID.
struct GNUNET_ARM_Operation * next
This is a doubly-linked list.
struct OperationListItem * op_tail
Last operation in the linked list.
struct OperationListItem * op_head
First operation in the linked list.
uint64_t last_op_id
Last operation ID used.
void * cls
Closure for result_cb.
struct OperationListItem * next
struct OperationListItem * prev
uint64_t op_id
Operation ID.
GNUNET_ResultCallback result_cb
Continuation to invoke with the result of an operation.