GNUnet  0.19.3
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  */
36 #ifndef GNUNET_SETU_SERVICE_H
37 #define GNUNET_SETU_SERVICE_H
38 
39 #ifdef __cplusplus
40 extern "C"
41 {
42 #if 0 /* keep Emacsens' auto-indent happy */
43 }
44 #endif
45 #endif
46 
47 
48 #include "gnunet_common.h"
49 #include "gnunet_time_lib.h"
51 
52 
56 #define GNUNET_SETU_CONTEXT_MESSAGE_MAX_SIZE ((1 << 16) - 1024)
57 
61 struct GNUNET_SETU_Handle;
62 
66 struct GNUNET_SETU_Request;
67 
72 
77 
78 
83 {
84 
90 
97 
103 
108 };
109 
110 
115 {
119  uint16_t size;
120 
124  uint16_t element_type;
125 
129  const void *data;
130 };
131 
132 
139 {
144 
153 
159 
166 
171 
177 
183 
189 
195 };
196 
197 
202 {
207 
211  union
212  {
213  uint64_t num;
214  } v;
215 };
216 
217 
227 typedef void
228 (*GNUNET_SETU_ResultIterator) (void *cls,
229  const struct GNUNET_SETU_Element *element,
230  uint64_t current_size,
232 
233 
249 typedef void
250 (*GNUNET_SETU_ListenCallback) (void *cls,
251  const struct GNUNET_PeerIdentity *other_peer,
252  const struct GNUNET_MessageHeader *context_msg,
253  struct GNUNET_SETU_Request *request);
254 
255 
263 struct GNUNET_SETU_Handle *
265 
266 
277 int
279  const struct GNUNET_SETU_Element *element,
281  void *cb_cls);
282 
283 
290 void
292 
293 
308 GNUNET_SETU_prepare (const struct GNUNET_PeerIdentity *other_peer,
309  const struct GNUNET_HashCode *app_id,
310  const struct GNUNET_MessageHeader *context_msg,
311  const struct GNUNET_SETU_Option options[],
313  void *result_cls);
314 
315 
331  const struct GNUNET_HashCode *app_id,
333  void *listen_cls);
334 
335 
344 void
346 
347 
363  const struct GNUNET_SETU_Option options[],
365  void *result_cls);
366 
367 
381 int
383  struct GNUNET_SETU_Handle *set);
384 
385 
393 void
395 
396 
404 void
405 GNUNET_SETU_element_hash (const struct GNUNET_SETU_Element *element,
406  struct GNUNET_HashCode *ret_hash);
407 
408 
409 #if 0 /* keep Emacsens' auto-indent happy */
410 {
411 #endif
412 #ifdef __cplusplus
413 }
414 #endif
415 
416 #endif
417  /* end of group */
419  /* end of group addition */
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static void listen_cb(void *cls)
We have been notified that our listen socket has something to read.
static struct GNUNET_TRANSPORT_OfferHelloHandle * oh
Active HELLO offering to transport service.
uint16_t status
See PRISM_STATUS_*-constants.
static struct GNUNET_HashCode app_id
static struct GNUNET_VPN_RedirectionRequest * request
Opaque redirection request handle.
Definition: gnunet-vpn.c:40
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
Configuration API.
Functions related to time.
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
GNUNET_SETU_OptionType
Possible options to pass to a set operation.
void GNUNET_SETU_element_hash(const struct GNUNET_SETU_Element *element, struct GNUNET_HashCode *ret_hash)
Hash a set element.
Definition: setu_api.c:890
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:384
void GNUNET_SETU_operation_cancel(struct GNUNET_SETU_OperationHandle *oh)
Cancel the given set operation.
Definition: setu_api.c:320
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:717
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:497
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.
void GNUNET_SETU_destroy(struct GNUNET_SETU_Handle *set)
Destroy the set handle, and free all associated resources.
Definition: setu_api.c:471
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:769
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:851
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.
GNUNET_SETU_Status
Status for the result callback.
void GNUNET_SETU_listen_cancel(struct GNUNET_SETU_ListenHandle *lh)
Cancel the given listen operation.
Definition: setu_api.c:749
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:429
@ GNUNET_SETU_OPTION_FORCE_DELTA
Only use optimized set operations, even though for this particular set operation they might be much s...
@ GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKETS_PER_ELEMENT
This setting determines to how many IBF buckets an single elements is mapped to.
@ GNUNET_SETU_OPTION_CUSTOM_BANDWIDTH_LATENCY_TRADEOFF
Bandwidth latency tradeoff determines how much bytes a single RTT is worth, which is a performance se...
@ GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKET_NUMBER_FACTOR
The factor determines the number of buckets an IBF has which is multiplied by the estimated setsize d...
@ GNUNET_SETU_OPTION_CUSTOM_BYZANTINE_UPPER_BOUND
Byzantine upper bound.
@ GNUNET_SETU_OPTION_SYMMETRIC
Notify client also if we are sending a value to the other peer.
@ GNUNET_SETU_OPTION_END
List terminator.
@ GNUNET_SETU_OPTION_BYZANTINE
Fail set operations when the other peer shows weird behavior that might by a Byzantine fault.
@ GNUNET_SETU_OPTION_FORCE_FULL
Do not use the optimized set operation, but send full sets.
@ GNUNET_SETU_STATUS_DONE
Success, all elements have been sent (and received).
@ GNUNET_SETU_STATUS_ADD_REMOTE
Element should be added to the result set of the remote peer, i.e.
@ GNUNET_SETU_STATUS_FAILURE
The other peer refused to do the operation with us, or something went wrong.
@ GNUNET_SETU_STATUS_ADD_LOCAL
Element should be added to the result set of the local peer, i.e.
A 512-bit hashcode.
Header for all communications.
The identity of the host (wraps the signing key of the peer).
Element stored in a set.
uint16_t element_type
Application-specific element type.
uint16_t size
Number of bytes in the buffer pointed to by data.
const void * data
Actual data of the element.
Opaque handle to a set.
Definition: setu_api.c:40
Opaque handle to a listen operation.
Definition: setu_api.c:146
void * listen_cls
Closure for listen_cb.
Definition: setu_api.c:168
Handle to an operation.
Definition: setu_api.c:95
void * result_cls
Closure for result_cb.
Definition: setu_api.c:105
GNUNET_SETU_ResultIterator result_cb
Function to be called when we have a result, or an error.
Definition: setu_api.c:100
struct GNUNET_SETU_Handle * set
Local set used for the operation, NULL if no set has been provided by conclude yet.
Definition: setu_api.c:111
Option for set operations.
union GNUNET_SETU_Option::@42 v
Value for the option, only used with some options.
enum GNUNET_SETU_OptionType type
Type of the option.
Handle for a set operation request from another peer.
Definition: setu_api.c:75