GNUnet  0.11.x
gnunet_setu_service.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2013, 2014, 2020 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  */
33 #ifndef GNUNET_SETU_SERVICE_H
34 #define GNUNET_SETU_SERVICE_H
35 
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #if 0 /* keep Emacsens' auto-indent happy */
40 }
41 #endif
42 #endif
43 
44 #include "gnunet_common.h"
45 #include "gnunet_time_lib.h"
47 
48 
52 #define GNUNET_SETU_CONTEXT_MESSAGE_MAX_SIZE ((1 << 16) - 1024)
53 
57 struct GNUNET_SETU_Handle;
58 
62 struct GNUNET_SETU_Request;
63 
68 
73 
74 
79 {
80 
86 
93 
99 
104 };
105 
106 
111 {
115  uint16_t size;
116 
120  uint16_t element_type;
121 
125  const void *data;
126 };
127 
128 
135 {
140 
149 
155 
162 
167 };
168 
169 
174 {
179 
183  union
184  {
185  uint64_t num;
186  } v;
187 };
188 
189 
199 typedef void
201  const struct GNUNET_SETU_Element *element,
202  uint64_t current_size,
204 
205 
221 typedef void
223  const struct GNUNET_PeerIdentity *other_peer,
224  const struct GNUNET_MessageHeader *context_msg,
225  struct GNUNET_SETU_Request *request);
226 
227 
235 struct GNUNET_SETU_Handle *
237 
238 
249 int
251  const struct GNUNET_SETU_Element *element,
253  void *cb_cls);
254 
255 
262 void
264 
265 
280 GNUNET_SETU_prepare (const struct GNUNET_PeerIdentity *other_peer,
281  const struct GNUNET_HashCode *app_id,
282  const struct GNUNET_MessageHeader *context_msg,
283  const struct GNUNET_SETU_Option options[],
285  void *result_cls);
286 
287 
303  const struct GNUNET_HashCode *app_id,
305  void *listen_cls);
306 
307 
316 void
318 
319 
335  const struct GNUNET_SETU_Option options[],
337  void *result_cls);
338 
339 
353 int
355  struct GNUNET_SETU_Handle *set);
356 
357 
365 void
367 
368 
376 void
377 GNUNET_SETU_element_hash (const struct GNUNET_SETU_Element *element,
378  struct GNUNET_HashCode *ret_hash);
379 
380 
381 #if 0 /* keep Emacsens' auto-indent happy */
382 {
383 #endif
384 #ifdef __cplusplus
385 }
386 #endif
387 
388 #endif
389  /* end of group */
void * listen_cls
Closure for listen_cb.
Definition: setu_api.c:167
Fail set operations when the other peer shows weird behavior that might by a Byzantine fault...
static void listen_cb(void *cls)
We have been notified that our listen socket has something to read.
Handle for a set operation request from another peer.
Definition: setu_api.c:73
struct GNUNET_SETU_OperationHandle * GNUNET_SETU_prepare(const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_HashCode *app_id, const struct GNUNET_MessageHeader *context_msg, const struct GNUNET_SETU_Option options[], GNUNET_SETU_ResultIterator result_cb, void *result_cls)
Prepare a set operation to be evaluated with another peer.
Definition: setu_api.c:508
static struct GNUNET_VPN_RedirectionRequest * request
Opaque redirection request handle.
Definition: gnunet-vpn.c:41
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
int GNUNET_SETU_commit(struct GNUNET_SETU_OperationHandle *oh, struct GNUNET_SETU_Handle *set)
Commit a set to be used with a set operation.
Definition: setu_api.c:837
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
const void * data
Actual data of the element.
Option for set operations.
void(* GNUNET_SETU_ResultIterator)(void *cls, const struct GNUNET_SETU_Element *element, uint64_t current_size, enum GNUNET_SETU_Status status)
Callback for set union operation results.
void * result_cls
Closure for result_cb.
Definition: setu_api.c:104
static struct GNUNET_HashCode app_id
void(* GNUNET_SETU_ListenCallback)(void *cls, const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_MessageHeader *context_msg, struct GNUNET_SETU_Request *request)
Called when another peer wants to do a set operation with the local peer.
struct GNUNET_SETU_Handle * GNUNET_SETU_create(const struct GNUNET_CONFIGURATION_Handle *cfg)
Create an empty set, supporting the specified operation.
Definition: setu_api.c:383
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
Opaque handle to a listen operation.
Definition: setu_api.c:144
The other peer refused to do the operation with us, or something went wrong.
GNUNET_SETU_Status
Status for the result callback.
Opaque handle to a set.
Definition: setu_api.c:38
static struct GNUNET_TRANSPORT_OfferHelloHandle * oh
Active HELLO offering to transport service.
Success, all elements have been sent (and received).
uint16_t element_type
Application-specific element type.
struct GNUNET_SETU_OperationHandle * GNUNET_SETU_accept(struct GNUNET_SETU_Request *request, const struct GNUNET_SETU_Option options[], GNUNET_SETU_ResultIterator result_cb, void *result_cls)
Accept a request we got via GNUNET_SETU_listen().
Definition: setu_api.c:774
Element should be added to the result set of the local peer, i.e.
uint16_t status
See PRISM_STATUS_*-constants.
A 512-bit hashcode.
void GNUNET_SETU_element_hash(const struct GNUNET_SETU_Element *element, struct GNUNET_HashCode *ret_hash)
Hash a set element.
Definition: setu_api.c:876
Handle to an operation.
Definition: setu_api.c:93
GNUNET_SETU_ResultIterator result_cb
Function to be called when we have a result, or an error.
Definition: setu_api.c:99
GNUNET_SETU_OptionType
Possible options to pass to a set operation.
struct GNUNET_SETU_ListenHandle * GNUNET_SETU_listen(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_HashCode *app_id, GNUNET_SETU_ListenCallback listen_cb, void *listen_cls)
Wait for set operation requests for the given application ID.
Definition: setu_api.c:708
Notify client also if we are sending a value to the other peer.
void GNUNET_SETU_destroy(struct GNUNET_SETU_Handle *set)
Destroy the set handle, and free all associated resources.
Definition: setu_api.c:470
The identity of the host (wraps the signing key of the peer).
Do not use the optimized set operation, but send full sets.
Only use optimized set operations, even though for this particular set operation they might be much s...
configuration data
Definition: configuration.c:84
void GNUNET_SETU_operation_cancel(struct GNUNET_SETU_OperationHandle *oh)
Cancel the given set operation.
Definition: setu_api.c:319
Element should be added to the result set of the remote peer, i.e.
int GNUNET_SETU_add_element(struct GNUNET_SETU_Handle *set, const struct GNUNET_SETU_Element *element, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls)
Add an element to the given set.
Definition: setu_api.c:428
void GNUNET_SETU_listen_cancel(struct GNUNET_SETU_ListenHandle *lh)
Cancel the given listen operation.
Definition: setu_api.c:740
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
Header for all communications.
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
uint16_t size
Number of bytes in the buffer pointed to by data.
Element stored in a set.