Asynchronous operations; register callbacks for operations and call them when a response arrives. More...
Go to the source code of this file.
Data Structures | |
struct | OperationListItem |
struct | GNUNET_OP_Handle |
Operations handle. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "util-op", __VA_ARGS__) |
Functions | |
struct GNUNET_OP_Handle * | GNUNET_OP_create () |
Create new operations handle. More... | |
void | GNUNET_OP_destroy (struct GNUNET_OP_Handle *h) |
Destroy operations handle. More... | |
uint64_t | GNUNET_OP_get_next_id (struct GNUNET_OP_Handle *h) |
Get a unique operation ID to distinguish between asynchronous requests. More... | |
static struct OperationListItem * | op_find (struct GNUNET_OP_Handle *h, uint64_t op_id) |
Find operation by ID. More... | |
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. More... | |
uint64_t | GNUNET_OP_add (struct GNUNET_OP_Handle *h, GNUNET_ResultCallback result_cb, void *cls, void *ctx) |
Add a new operation. More... | |
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). More... | |
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. More... | |
int | GNUNET_OP_remove (struct GNUNET_OP_Handle *h, uint64_t op_id) |
Remove / cancel an operation. More... | |
Asynchronous operations; register callbacks for operations and call them when a response arrives.
Definition in file op.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "util-op", __VA_ARGS__) |
|
static |
Find operation by ID.
h | Operations handle. |
op_id | Operation ID to look up. |
Definition at line 132 of file op.c.
References h, GNUNET_ARM_Operation::next, op, and OperationListItem::op_id.
Referenced by GNUNET_OP_get(), and op_result().
|
static |
Remove an operation, and call its result callback (unless it was cancelled).
h | Operations handle. | |
op_id | Operation ID. | |
result_code | Result of the operation. | |
data | Data result of the operation. | |
data_size | Size of data. | |
[out] | ctx | User context. |
cancel | Is the operation cancelled? GNUNET_NO Not cancelled, result callback is called. GNUNET_YES Cancelled, result callback is not called. |
Definition at line 246 of file op.c.
References ctx, data, data_size, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_NO, GNUNET_YES, h, LOG, op, op_find(), and OperationListItem::op_id.
Referenced by cadet_disconnect_adapter(), dht_da(), dht_disconnect(), dht_disconnect_adapter(), fs_disconnect_adapter(), GNUNET_OP_remove(), GNUNET_OP_result(), nse_disconnect_adapter(), rps_disconnect_adapter(), stat_disconnect_adapter(), statistics_da(), and stats_da().