GNUnet  0.19.4
gnunet_seti_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_SETI_SERVICE_H
37 #define GNUNET_SETI_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_SETI_CONTEXT_MESSAGE_MAX_SIZE ((1 << 16) - 1024)
57 
61 struct GNUNET_SETI_Handle;
62 
66 struct GNUNET_SETI_Request;
67 
72 
77 
78 
83 {
84 
90 
96 
102 
107 };
108 
109 
114 {
118  uint16_t size;
119 
123  uint16_t element_type;
124 
128  const void *data;
129 };
130 
131 
138 {
143 
150 };
151 
152 
157 {
162 
166  union
167  {
168  uint64_t num;
169  } v;
170 };
171 
172 
182 typedef void
183 (*GNUNET_SETI_ResultIterator) (void *cls,
184  const struct GNUNET_SETI_Element *element,
185  uint64_t current_size,
187 
188 
204 typedef void
205 (*GNUNET_SETI_ListenCallback) (void *cls,
206  const struct GNUNET_PeerIdentity *other_peer,
207  const struct GNUNET_MessageHeader *context_msg,
208  struct GNUNET_SETI_Request *request);
209 
210 
218 struct GNUNET_SETI_Handle *
220 
221 
232 int
234  const struct GNUNET_SETI_Element *element,
236  void *cb_cls);
237 
238 
245 void
247 
248 
263 GNUNET_SETI_prepare (const struct GNUNET_PeerIdentity *other_peer,
264  const struct GNUNET_HashCode *app_id,
265  const struct GNUNET_MessageHeader *context_msg,
266  const struct GNUNET_SETI_Option options[],
268  void *result_cls);
269 
270 
286  const struct GNUNET_HashCode *app_id,
288  void *listen_cls);
289 
290 
299 void
301 
302 
318  const struct GNUNET_SETI_Option options[],
320  void *result_cls);
321 
322 
336 int
338  struct GNUNET_SETI_Handle *set);
339 
340 
348 void
350 
351 
359 void
360 GNUNET_SETI_element_hash (const struct GNUNET_SETI_Element *element,
361  struct GNUNET_HashCode *ret_hash);
362 
363 
364 #if 0 /* keep Emacsens' auto-indent happy */
365 {
366 #endif
367 #ifdef __cplusplus
368 }
369 #endif
370 
371 #endif
372  /* end of group */
374  /* 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_SETI_Status
Status for the result callback.
struct GNUNET_SETI_OperationHandle * GNUNET_SETI_accept(struct GNUNET_SETI_Request *request, const struct GNUNET_SETI_Option options[], GNUNET_SETI_ResultIterator result_cb, void *result_cls)
Accept a request we got via GNUNET_SETI_listen().
Definition: seti_api.c:754
void GNUNET_SETI_destroy(struct GNUNET_SETI_Handle *set)
Destroy the set handle, and free all associated resources.
Definition: seti_api.c:488
struct GNUNET_SETI_Handle * GNUNET_SETI_create(const struct GNUNET_CONFIGURATION_Handle *cfg)
Create an empty set, supporting the specified operation.
Definition: seti_api.c:399
int GNUNET_SETI_add_element(struct GNUNET_SETI_Handle *set, const struct GNUNET_SETI_Element *element, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls)
Add an element to the given set.
Definition: seti_api.c:447
GNUNET_SETI_OptionType
Possible options to pass to a set operation.
int GNUNET_SETI_commit(struct GNUNET_SETI_OperationHandle *oh, struct GNUNET_SETI_Handle *set)
Commit a set to be used with a set operation.
Definition: seti_api.c:810
void GNUNET_SETI_element_hash(const struct GNUNET_SETI_Element *element, struct GNUNET_HashCode *ret_hash)
Hash a set element.
Definition: seti_api.c:849
void(* GNUNET_SETI_ListenCallback)(void *cls, const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_MessageHeader *context_msg, struct GNUNET_SETI_Request *request)
Called when another peer wants to do a set operation with the local peer.
void GNUNET_SETI_operation_cancel(struct GNUNET_SETI_OperationHandle *oh)
Cancel the given set operation.
Definition: seti_api.c:335
void(* GNUNET_SETI_ResultIterator)(void *cls, const struct GNUNET_SETI_Element *element, uint64_t current_size, enum GNUNET_SETI_Status status)
Callback for set union operation results.
struct GNUNET_SETI_ListenHandle * GNUNET_SETI_listen(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_HashCode *app_id, GNUNET_SETI_ListenCallback listen_cb, void *listen_cls)
Wait for set operation requests for the given application ID.
Definition: seti_api.c:702
void GNUNET_SETI_listen_cancel(struct GNUNET_SETI_ListenHandle *lh)
Cancel the given listen operation.
Definition: seti_api.c:734
struct GNUNET_SETI_OperationHandle * GNUNET_SETI_prepare(const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_HashCode *app_id, const struct GNUNET_MessageHeader *context_msg, const struct GNUNET_SETI_Option options[], GNUNET_SETI_ResultIterator result_cb, void *result_cls)
Prepare a set operation to be evaluated with another peer.
Definition: seti_api.c:513
@ GNUNET_SETI_STATUS_DONE
Success, all elements have been sent (and received).
@ GNUNET_SETI_STATUS_ADD_LOCAL
Element should be added to the result set of the local peer, i.e.
@ GNUNET_SETI_STATUS_FAILURE
The other peer refused to do the operation with us, or something went wrong.
@ GNUNET_SETI_STATUS_DEL_LOCAL
Element should be delete from the result set of the local peer, i.e.
@ GNUNET_SETI_OPTION_RETURN_INTERSECTION
Return the elements remaining in the intersection (GNUNET_SETI_STATUS_ADD_LOCAL).
@ GNUNET_SETI_OPTION_END
List terminator.
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.
const void * data
Actual data of the element.
uint16_t element_type
Application-specific element type.
uint16_t size
Number of bytes in the buffer pointed to by data.
Opaque handle to a set.
Definition: seti_api.c:40
Opaque handle to a listen operation.
Definition: seti_api.c:163
void * listen_cls
Closure for listen_cb.
Definition: seti_api.c:185
Handle to an operation.
Definition: seti_api.c:106
void * result_cls
Closure for result_cb.
Definition: seti_api.c:116
struct GNUNET_SETI_Handle * set
Local set used for the operation, NULL if no set has been provided by conclude yet.
Definition: seti_api.c:122
GNUNET_SETI_ResultIterator result_cb
Function to be called when we have a result, or an error.
Definition: seti_api.c:111
Option for set operations.
union GNUNET_SETI_Option::@41 v
Value for the option, only used with some options.
enum GNUNET_SETI_OptionType type
Type of the option.
Handle for a set operation request from another peer.
Definition: seti_api.c:86