GNUnet 0.22.0
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
40extern "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
62
67
72
77
78
83{
84
90
96
102
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
182typedef void
183(*GNUNET_SETI_ResultIterator) (void *cls,
184 const struct GNUNET_SETI_Element *element,
185 uint64_t current_size,
187
188
204typedef void
205(*GNUNET_SETI_ListenCallback) (void *cls,
206 const struct GNUNET_PeerIdentity *other_peer,
207 const struct GNUNET_MessageHeader *context_msg,
209
210
218struct GNUNET_SETI_Handle *
220
221
232int
234 const struct GNUNET_SETI_Element *element,
236 void *cb_cls);
237
238
245void
247
248
263GNUNET_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
299void
301
302
318 const struct GNUNET_SETI_Option options[],
320 void *result_cls);
321
322
336int
338 struct GNUNET_SETI_Handle *set);
339
340
348void
350
351
359void
360GNUNET_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 struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:108
static void listen_cb(void *cls)
We have been notified that our listen socket has something to read.
static int status
The program status; 0 for success.
Definition: gnunet-nse.c:39
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
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
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_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.
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
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
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.
void GNUNET_SETI_listen_cancel(struct GNUNET_SETI_ListenHandle *lh)
Cancel the given listen operation.
Definition: seti_api.c:734
@ 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
struct GNUNET_HashCode app_id
Application ID we listen for.
Definition: seti_api.c:195
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::@31 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