GNUnet 0.22.2
gnunet_op_lib.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2016 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__)
22#error "Only <gnunet_util_lib.h> can be included directly."
23#endif
24
36#ifndef GNUNET_OP_H
37#define GNUNET_OP_H
38
39
40#include "gnunet_util_lib.h"
41
45struct GNUNET_OP_Handle;
46
47
51struct GNUNET_OP_Handle *
53
54
58void
59GNUNET_OP_destroy (struct GNUNET_OP_Handle *h);
60
61
70uint64_t
71GNUNET_OP_get_next_id (struct GNUNET_OP_Handle *h);
72
73
91int
92GNUNET_OP_get (struct GNUNET_OP_Handle *h,
93 uint64_t op_id,
94 GNUNET_ResultCallback *result_cb,
95 void **cls,
96 void **ctx);
97
98
113uint64_t
114GNUNET_OP_add (struct GNUNET_OP_Handle *h,
115 GNUNET_ResultCallback result_cb,
116 void *cls,
117 void *ctx);
118
119
139int
140GNUNET_OP_result (struct GNUNET_OP_Handle *h,
141 uint64_t op_id,
142 int64_t result_code,
143 const void *data,
144 uint16_t data_size,
145 void **ctx);
146
147
159int
160GNUNET_OP_remove (struct GNUNET_OP_Handle *h,
161 uint64_t op_id);
162
163
164#endif // GNUNET_OP_H
165 /* end of group addition */
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:98
static char * data
The data to insert into the dht.
static struct GNUNET_FS_Handle * ctx
static size_t data_size
Number of bytes in data.
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.
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.
struct GNUNET_OP_Handle * GNUNET_OP_create()
Create new operations handle.