GNUnet  0.11.x
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  */
33 #ifndef GNUNET_SETI_SERVICE_H
34 #define GNUNET_SETI_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_SETI_CONTEXT_MESSAGE_MAX_SIZE ((1 << 16) - 1024)
53 
57 struct GNUNET_SETI_Handle;
58 
62 struct GNUNET_SETI_Request;
63 
68 
73 
74 
79 {
80 
86 
92 
98 
103 };
104 
105 
110 {
114  uint16_t size;
115 
119  uint16_t element_type;
120 
124  const void *data;
125 };
126 
127 
134 {
139 
146 };
147 
148 
153 {
158 
162  union
163  {
164  uint64_t num;
165  } v;
166 };
167 
168 
178 typedef void
180  const struct GNUNET_SETI_Element *element,
181  uint64_t current_size,
183 
184 
200 typedef void
202  const struct GNUNET_PeerIdentity *other_peer,
203  const struct GNUNET_MessageHeader *context_msg,
204  struct GNUNET_SETI_Request *request);
205 
206 
214 struct GNUNET_SETI_Handle *
216 
217 
228 int
230  const struct GNUNET_SETI_Element *element,
232  void *cb_cls);
233 
234 
241 void
243 
244 
259 GNUNET_SETI_prepare (const struct GNUNET_PeerIdentity *other_peer,
260  const struct GNUNET_HashCode *app_id,
261  const struct GNUNET_MessageHeader *context_msg,
262  const struct GNUNET_SETI_Option options[],
264  void *result_cls);
265 
266 
282  const struct GNUNET_HashCode *app_id,
284  void *listen_cls);
285 
286 
295 void
297 
298 
314  const struct GNUNET_SETI_Option options[],
316  void *result_cls);
317 
318 
332 int
334  struct GNUNET_SETI_Handle *set);
335 
336 
344 void
346 
347 
355 void
356 GNUNET_SETI_element_hash (const struct GNUNET_SETI_Element *element,
357  struct GNUNET_HashCode *ret_hash);
358 
359 
360 #if 0 /* keep Emacsens' auto-indent happy */
361 {
362 #endif
363 #ifdef __cplusplus
364 }
365 #endif
366 
367 #endif
368  /* end of group */
static void listen_cb(void *cls)
We have been notified that our listen socket has something to read.
Success, all elements have been sent (and received).
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
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
The other peer refused to do the operation with us, or something went wrong.
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
uint16_t size
Number of bytes in the buffer pointed to by data.
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:836
Option for set operations.
static struct GNUNET_HashCode app_id
void * listen_cls
Closure for listen_cb.
Definition: seti_api.c:185
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:715
Opaque handle to a listen operation.
Definition: seti_api.c:162
void * result_cls
Closure for result_cb.
Definition: seti_api.c:116
Handle for a set operation request from another peer.
Definition: seti_api.c:85
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
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.
Element should be added to the result set of the local peer, i.e.
Opaque handle to a set.
Definition: seti_api.c:39
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:780
static struct GNUNET_TRANSPORT_OfferHelloHandle * oh
Active HELLO offering to transport service.
void GNUNET_SETI_operation_cancel(struct GNUNET_SETI_OperationHandle *oh)
Cancel the given set operation.
Definition: seti_api.c:335
Element stored in a set.
uint16_t status
See PRISM_STATUS_*-constants.
const void * data
Actual data of the element.
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
A 512-bit hashcode.
Handle to an operation.
Definition: seti_api.c:105
void GNUNET_SETI_element_hash(const struct GNUNET_SETI_Element *element, struct GNUNET_HashCode *ret_hash)
Hash a set element.
Definition: seti_api.c:875
Element should be delete from the result set of the local peer, i.e.
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.
The identity of the host (wraps the signing key of the peer).
configuration data
Definition: configuration.c:84
GNUNET_SETI_Status
Status for the result callback.
Return the elements remaining in the intersection (GNUNET_SETI_STATUS_ADD_LOCAL). ...
GNUNET_SETI_ResultIterator result_cb
Function to be called when we have a result, or an error.
Definition: seti_api.c:111
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...
void GNUNET_SETI_listen_cancel(struct GNUNET_SETI_ListenHandle *lh)
Cancel the given listen operation.
Definition: seti_api.c:747
GNUNET_SETI_OptionType
Possible options to pass to a set operation.
uint16_t element_type
Application-specific element type.
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:526
void GNUNET_SETI_destroy(struct GNUNET_SETI_Handle *set)
Destroy the set handle, and free all associated resources.
Definition: seti_api.c:488