GNUnet  0.11.x
gnunet_dhtu_plugin.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2021 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  */
20 
27 #ifndef PLUGIN_DHTU_H
28 #define PLUGIN_DHTU_H
29 
30 #include "gnunet_util_lib.h"
31 
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #if 0 /* keep Emacsens' auto-indent happy */
37 }
38 #endif
39 #endif
40 
41 
46 struct GNUNET_DHTU_Source;
47 
52 struct GNUNET_DHTU_Target;
53 
59 
60 
65 {
66  struct GNUNET_HashCode sha512;
67 };
68 
69 
76 {
81 
85  void *cls;
86 
97  void
98  (*address_add_cb)(void *cls,
99  struct GNUNET_DHTU_HashKey *key,
100  const char *address,
101  struct GNUNET_DHTU_Source *source,
102  void **ctx);
103 
109  void
110  (*address_del_cb)(void *ctx);
111 
120  void
121  (*network_size_cb)(void *cls,
122  struct GNUNET_TIME_Absolute timestamp,
123  double logestimate,
124  double std_dev);
125 
139  void
140  (*connect_cb)(void *cls,
141  struct GNUNET_DHTU_Target *target,
142  struct GNUNET_DHTU_HashKey *key,
143  void **ctx);
144 
151  void
152  (*disconnect_cb)(void *ctx);
153 
164  void
165  (*receive_cb)(void *cls,
166  void **tctx,
167  void **sctx,
168  const void *message,
169  size_t message_size);
170 
171 };
172 
173 
178 {
182  void *cls;
183 
190  void
191  (*try_connect) (void *cls,
192  const char *address);
193 
194 
204  (*hold)(void *cls,
205  struct GNUNET_DHTU_Target *target);
206 
213  void
215 
231  void
232  (*send) (void *cls,
233  struct GNUNET_DHTU_Target *target,
234  const void *msg,
235  size_t msg_size,
236  GNUNET_SCHEDULER_TaskCallback finished_cb,
237  void *finished_cb_cls);
238 
239 };
240 
241 
242 #if 0 /* keep Emacsens' auto-indent happy */
243 {
244 #endif
245 #ifdef __cplusplus
246 }
247 #endif
248 
249 #endif
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static struct GNUNET_ATS_PerformanceHandle * ph
ATS performance handle used.
Definition: gnunet-ats.c:116
static char * address
GNS address for this phone.
struct GNUNET_HashCode key
The key used in the DHT.
static GstElement * source
Appsrc instance into which we write data for the pipeline.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
Key used to identify peer's position in the DHT.
struct GNUNET_HashCode sha512
The datastore service will pass a pointer to a struct of this type as the first and only argument to ...
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
void * cls
Closure to use for callbacks.
void(* address_add_cb)(void *cls, struct GNUNET_DHTU_HashKey *key, const char *address, struct GNUNET_DHTU_Source *source, void **ctx)
Function to call with new addresses of this peer.
void(* address_del_cb)(void *ctx)
Function to call with expired addresses of this peer.
void(* disconnect_cb)(void *ctx)
Function to call when we disconnected from a peer and can henceforth cannot transmit to that peer any...
void(* connect_cb)(void *cls, struct GNUNET_DHTU_Target *target, struct GNUNET_DHTU_HashKey *key, void **ctx)
Function to call when we connect to a peer and can henceforth transmit to that peer.
void(* network_size_cb)(void *cls, struct GNUNET_TIME_Absolute timestamp, double logestimate, double std_dev)
We have a new estimate on the size of the underlay.
void(* receive_cb)(void *cls, void **tctx, void **sctx, const void *message, size_t message_size)
Function to call when we receive a message.
struct returned by the initialization function of the plugin
void(* try_connect)(void *cls, const char *address)
Request creation of a session with a peer at the given address.
void * cls
Closure to pass to all plugin functions.
void(* drop)(struct GNUNET_DHTU_PreferenceHandle *ph)
Do no long request underlay to keep the connection alive.
void(* send)(void *cls, struct GNUNET_DHTU_Target *target, const void *msg, size_t msg_size, GNUNET_SCHEDULER_TaskCallback finished_cb, void *finished_cb_cls)
Send message to some other participant over the network.
Opaque handle expressing a preference of the DHT to keep a particular target connected.
Opaque handle that the underlay offers for our address to be used when sending messages to another pe...
Opaque handle that the underlay offers for the target peer when sending messages to another peer.
A 512-bit hashcode.
Time for absolute times used by GNUnet, in microseconds.