GNUnet  0.10.x
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 
28 #ifndef GNUNET_OP_H
29 #define GNUNET_OP_H
30 
31 #include "gnunet_util_lib.h"
32 
36 struct GNUNET_OP_Handle;
37 
38 
42 struct GNUNET_OP_Handle *
44 
45 
49 void
51 
52 
61 uint64_t
63 
64 
82 int
84  uint64_t op_id,
85  GNUNET_ResultCallback *result_cb,
86  void **cls,
87  void **ctx);
88 
89 
104 uint64_t
106  GNUNET_ResultCallback result_cb,
107  void *cls,
108  void *ctx);
109 
110 
130 int
132  uint64_t op_id,
133  int64_t result_code,
134  const void *data,
135  uint16_t data_size,
136  void **ctx);
137 
138 
150 int
152  uint64_t op_id);
153 
154 
155 #endif // GNUNET_OP_H
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.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:94
void GNUNET_OP_destroy(struct GNUNET_OP_Handle *h)
Destroy operations handle.
Definition: op.c:97
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:299
struct GNUNET_OP_Handle * GNUNET_OP_create()
Create new operations handle.
Definition: op.c:87
int GNUNET_OP_remove(struct GNUNET_OP_Handle *h, uint64_t op_id)
Remove / cancel an operation.
Definition: op.c:325
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:112
Operations handle.
Definition: op.c:65
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:159
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:196
uint32_t data
The data value.
static size_t data_size
Number of bytes in data.