GNUnet  0.17.6
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 
67 {
72 
76  void *cls;
77 
87  void
88  (*address_add_cb)(void *cls,
89  const char *address,
90  struct GNUNET_DHTU_Source *source,
91  void **ctx);
92 
98  void
99  (*address_del_cb)(void *ctx);
100 
109  void
110  (*network_size_cb)(void *cls,
111  struct GNUNET_TIME_Absolute timestamp,
112  double logestimate,
113  double std_dev);
114 
126  void
127  (*connect_cb)(void *cls,
128  struct GNUNET_DHTU_Target *target,
129  const struct GNUNET_PeerIdentity *pid,
130  void **ctx);
131 
132 
139  void
140  (*disconnect_cb)(void *ctx);
141 
152  void
153  (*receive_cb)(void *cls,
154  void **tctx,
155  void **sctx,
156  const void *message,
157  size_t message_size);
158 
159 };
160 
161 
166 {
170  void *cls;
171 
179  void
180  (*try_connect) (void *cls,
181  const struct GNUNET_PeerIdentity *pid,
182  const char *address);
183 
184 
194  (*hold)(void *cls,
195  struct GNUNET_DHTU_Target *target);
196 
203  void
205 
221  void
222  (*send) (void *cls,
223  struct GNUNET_DHTU_Target *target,
224  const void *msg,
225  size_t msg_size,
226  GNUNET_SCHEDULER_TaskCallback finished_cb,
227  void *finished_cb_cls);
228 
229 };
230 
231 
232 #if 0 /* keep Emacsens' auto-indent happy */
233 {
234 #endif
235 #ifdef __cplusplus
236 }
237 #endif
238 
239 #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.
static GstElement * source
Appsrc instance into which we write data for the pipeline.
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
The datastore service will pass a pointer to a struct of this type as the first and only argument to ...
void(* address_add_cb)(void *cls, const char *address, struct GNUNET_DHTU_Source *source, void **ctx)
Function to call with new addresses of this peer.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
void(* connect_cb)(void *cls, struct GNUNET_DHTU_Target *target, const struct GNUNET_PeerIdentity *pid, void **ctx)
Function to call when we connect to a peer and can henceforth transmit to that peer.
void * cls
Closure to use for callbacks.
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(* 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 struct GNUNET_PeerIdentity *pid, 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 longer 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.
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.