GNUnet  0.20.0
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 
45 struct GNUNET_OP_Handle;
46 
47 
51 struct GNUNET_OP_Handle *
53 
54 
58 void
60 
61 
70 uint64_t
72 
73 
91 int
93  uint64_t op_id,
94  GNUNET_ResultCallback *result_cb,
95  void **cls,
96  void **ctx);
97 
98 
113 uint64_t
115  GNUNET_ResultCallback result_cb,
116  void *cls,
117  void *ctx);
118 
119 
139 int
141  uint64_t op_id,
142  int64_t result_code,
143  const void *data,
144  uint16_t data_size,
145  void **ctx);
146 
147 
159 int
161  uint64_t op_id);
162 
163 
164 #endif // GNUNET_OP_H
165  /* end of group addition */
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
uint32_t data
The data value.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
uint64_t GNUNET_OP_get_next_id(struct GNUNET_OP_Handle *h)
Get a unique operation ID to distinguish between asynchronous requests.
Definition: op.c:115
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.
Definition: op.c:302
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.
Definition: op.c:162
int GNUNET_OP_remove(struct GNUNET_OP_Handle *h, uint64_t op_id)
Remove / cancel an operation.
Definition: op.c:328
struct GNUNET_OP_Handle * GNUNET_OP_create()
Create new operations handle.
Definition: op.c:90
void GNUNET_OP_destroy(struct GNUNET_OP_Handle *h)
Destroy operations handle.
Definition: op.c:100
uint64_t GNUNET_OP_add(struct GNUNET_OP_Handle *h, GNUNET_ResultCallback result_cb, void *cls, void *ctx)
Add a new operation.
Definition: op.c:199
Operations handle.
Definition: op.c:68