GNUnet  0.20.0
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 
31 #include "gnunet_util_lib.h"
32 
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #if 0 /* keep Emacsens' auto-indent happy */
38 }
39 #endif
40 #endif
41 
42 
47 struct GNUNET_DHTU_Source;
48 
53 struct GNUNET_DHTU_Target;
54 
60 
61 
68 {
73 
77  void *cls;
78 
88  void
89  (*address_add_cb)(void *cls,
90  const char *address,
91  struct GNUNET_DHTU_Source *source,
92  void **ctx);
93 
99  void
100  (*address_del_cb)(void *ctx);
101 
110  void
111  (*network_size_cb)(void *cls,
112  struct GNUNET_TIME_Absolute timestamp,
113  double logestimate,
114  double std_dev);
115 
127  void
128  (*connect_cb)(void *cls,
129  struct GNUNET_DHTU_Target *target,
130  const struct GNUNET_PeerIdentity *pid,
131  void **ctx);
132 
133 
140  void
141  (*disconnect_cb)(void *ctx);
142 
153  void
154  (*receive_cb)(void *cls,
155  void **tctx,
156  void **sctx,
157  const void *message,
158  size_t message_size);
159 
160 };
161 
162 
167 {
171  void *cls;
172 
180  void
181  (*try_connect) (void *cls,
182  const struct GNUNET_PeerIdentity *pid,
183  const char *address);
184 
185 
195  (*hold)(void *cls,
196  struct GNUNET_DHTU_Target *target);
197 
204  void
206 
222  void
223  (*send) (void *cls,
224  struct GNUNET_DHTU_Target *target,
225  const void *msg,
226  size_t msg_size,
228  void *finished_cb_cls);
229 
230 };
231 
232 
233 #if 0 /* keep Emacsens' auto-indent happy */
234 {
235 #endif
236 #ifdef __cplusplus
237 }
238 #endif
239 
240 #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 void finished_cb(enum GNUNET_GenericReturnValue rv)
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.