GNUnet  0.20.0
gnunet_transport_plugin.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2009-2014 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 
39 #ifndef PLUGIN_TRANSPORT_H
40 #define PLUGIN_TRANSPORT_H
41 
42 
44 #include "gnunet_scheduler_lib.h"
47 #include "gnunet_ats_service.h"
48 
49 #define TRANSPORT_SESSION_INBOUND_STRING "<inbound>"
50 
64 struct GNUNET_ATS_Session;
65 
66 
80 typedef void
81 (*GNUNET_TRANSPORT_SessionEnd) (void *cls,
82  const struct GNUNET_HELLO_Address *address,
83  struct GNUNET_ATS_Session *session);
84 
85 
94 typedef void
95 (*GNUNET_TRANSPORT_SessionStart) (void *cls,
96  const struct GNUNET_HELLO_Address *address,
97  struct GNUNET_ATS_Session *session,
98  enum GNUNET_NetworkType net);
99 
100 
123 typedef struct GNUNET_TIME_Relative
125  const struct
127  struct GNUNET_ATS_Session *session,
128  const struct
129  GNUNET_MessageHeader *message);
130 
131 
142 typedef enum GNUNET_NetworkType
143 (*GNUNET_TRANSPORT_AddressToType)(void *cls,
144  const struct sockaddr *addr,
145  size_t addrlen);
146 
147 
155 typedef void
157  const struct
159  uint32_t distance);
160 
161 
171 typedef void
173  int add_remove,
174  const struct
176 
177 
194 typedef struct GNUNET_TIME_Relative
195 (*GNUNET_TRANSPORT_TrafficReport) (void *cls,
196  const struct GNUNET_PeerIdentity *peer,
197  size_t amount_recved);
198 
199 
205 typedef const struct GNUNET_MessageHeader *
206 (*GNUNET_TRANSPORT_GetHelloCallback) (void);
207 
208 
215 {
220 
225 
229  void *cls;
230 
235 
245 
250 
257 
263 
269 
275 
281 
287  uint32_t max_connections;
288 };
289 
290 
310 typedef void
312  const struct
313  GNUNET_PeerIdentity *target,
314  int result,
315  size_t size_payload,
316  size_t size_on_wire);
317 
318 
348 typedef ssize_t
350  struct GNUNET_ATS_Session *session,
351  const char *msgbuf,
352  size_t msgbuf_size,
353  unsigned int priority,
354  struct GNUNET_TIME_Relative to,
356  void *cont_cls);
357 
358 
371 typedef int
373  struct GNUNET_ATS_Session *
374  session);
375 
376 
385 typedef unsigned int
387 
388 
401 typedef void
403  const struct
405 
406 
421 typedef void
423  const char *address,
424  int res);
425 
426 
441 typedef void
443  const char *type,
444  const void *addr,
445  size_t addrlen,
446  int numeric,
449  asc,
450  void *asc_cls);
451 
452 
467 typedef int
468 (*GNUNET_TRANSPORT_CheckAddress) (void *cls,
469  const void *addr,
470  size_t addrlen);
471 
472 
482 typedef struct GNUNET_ATS_Session *
483 (*GNUNET_TRANSPORT_CreateSession) (void *cls,
484  const struct GNUNET_HELLO_Address *address);
485 
486 
496 typedef void
498  const struct
500  struct GNUNET_ATS_Session *session);
501 
502 
513 typedef void
515  const struct GNUNET_PeerIdentity *peer,
516  struct GNUNET_ATS_Session *session,
517  struct GNUNET_TIME_Relative delay);
518 
519 
531 typedef const char *
532 (*GNUNET_TRANSPORT_AddressToString) (void *cls,
533  const void *addr,
534  size_t addrlen);
535 
536 
549 typedef int
551  const char *addr,
552  uint16_t addrlen,
553  void **buf,
554  size_t *added);
555 
556 
564 typedef enum GNUNET_NetworkType
566  struct GNUNET_ATS_Session *session);
567 
568 
576 typedef enum GNUNET_NetworkType
578  const struct
580 
581 
594 typedef void
596  struct GNUNET_ATS_Session *session,
597  const struct
599 
600 
613 typedef void
616  sic,
617  void *sic_cls);
618 
619 
625 {
629  void *cls;
630 
639 
646 
653 
660 
667 
674 
679 
690 
696 
702 
708 
713 
718 
723 };
724 
725 
726 /*#ifndef PLUGIN_TRANSPORT_H*/
727 #endif
728  /* end of group */
730  /* end of group addition */
732 
733 /* end of gnunet_transport_plugin.h */
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
Definition: gnunet-abd.c:61
static int res
static char * address
GNS address for this phone.
static int result
Global testing status.
#define info
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
static char buf[2048]
static int numeric
Option -n.
Automatic transport selection and outbound bandwidth determination.
Configuration API.
API to schedule computations using continuation passing style.
API to create, modify and access statistics.
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
Definition: gnunet_nt_lib.h:39
void(* GNUNET_TRANSPORT_SessionInfoCallback)(void *cls, struct GNUNET_ATS_Session *session, const struct GNUNET_TRANSPORT_SessionInfo *info)
Function called by the plugin with information about the current sessions managed by the plugin (for ...
struct GNUNET_TIME_Relative(* GNUNET_TRANSPORT_TrafficReport)(void *cls, const struct GNUNET_PeerIdentity *peer, size_t amount_recved)
Function that will be called whenever the plugin receives data over the network and wants to determin...
int(* GNUNET_TRANSPORT_DisconnectSessionFunction)(void *cls, struct GNUNET_ATS_Session *session)
Function that can be called to force a disconnect from the specified neighbour for the given session ...
enum GNUNET_NetworkType(* GNUNET_TRANSPORT_GetNetworkTypeForAddress)(void *cls, const struct GNUNET_HELLO_Address *address)
Function to obtain the network type for an address.
enum GNUNET_NetworkType(* GNUNET_TRANSPORT_GetNetworkType)(void *cls, struct GNUNET_ATS_Session *session)
Function to obtain the network type for a session.
struct GNUNET_ATS_Session *(* GNUNET_TRANSPORT_CreateSession)(void *cls, const struct GNUNET_HELLO_Address *address)
Create a new session to transmit data to the target This session will used to send data to this peer ...
void(* GNUNET_TRANSPORT_AddressNotification)(void *cls, int add_remove, const struct GNUNET_HELLO_Address *address)
Function that will be called for each address the transport is aware that it might be reachable under...
const struct GNUNET_MessageHeader *(* GNUNET_TRANSPORT_GetHelloCallback)(void)
Function that returns a HELLO message.
void(* GNUNET_TRANSPORT_TransmitContinuation)(void *cls, const struct GNUNET_PeerIdentity *target, int result, size_t size_payload, size_t size_on_wire)
Function called by the GNUNET_TRANSPORT_TransmitFunction upon "completion".
void(* GNUNET_TRANSPORT_DisconnectPeerFunction)(void *cls, const struct GNUNET_PeerIdentity *target)
Function that can be called to force a disconnect from the specified neighbour.
void(* GNUNET_TRANSPORT_SessionStart)(void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, enum GNUNET_NetworkType net)
Plugin tells transport service about a new inbound session.
void(* GNUNET_TRANSPORT_UpdateInboundDelay)(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_ATS_Session *session, struct GNUNET_TIME_Relative delay)
Function that will be called whenever the transport service wants to notify the plugin that the inbou...
void(* GNUNET_TRANSPORT_AddressPrettyPrinter)(void *cls, const char *type, const void *addr, size_t addrlen, int numeric, struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_AddressStringCallback asc, void *asc_cls)
Convert the transports address to a nice, human-readable format.
enum GNUNET_NetworkType(* GNUNET_TRANSPORT_AddressToType)(void *cls, const struct sockaddr *addr, size_t addrlen)
Function that can be called by plugins to figure if an address is an loopback, LAN or WAN address.
unsigned int(* GNUNET_TRANSPORT_QueryKeepaliveFactorFunction)(void *cls)
Function that is called to get the keepalive factor.
int(* GNUNET_TRANSPORT_StringToAddress)(void *cls, const char *addr, uint16_t addrlen, void **buf, size_t *added)
Function called to convert a string address to a binary address.
void(* GNUNET_TRANSPORT_SessionEnd)(void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session)
Function that will be called whenever the plugin internally cleans up a session pointer and hence the...
struct GNUNET_TIME_Relative(* GNUNET_TRANSPORT_PluginReceiveCallback)(void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, const struct GNUNET_MessageHeader *message)
Function called by the transport for each received message.
int(* GNUNET_TRANSPORT_CheckAddress)(void *cls, const void *addr, size_t addrlen)
Another peer has suggested an address for this peer and transport plugin.
void(* GNUNET_TRANSPORT_UpdateSessionTimeout)(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_ATS_Session *session)
Function that will be called whenever the transport service wants to notify the plugin that a session...
void(* GNUNET_TRANSPORT_UpdateAddressDistance)(void *cls, const struct GNUNET_HELLO_Address *address, uint32_t distance)
Function called when distance of an address changes.
const char *(* GNUNET_TRANSPORT_AddressToString)(void *cls, const void *addr, size_t addrlen)
Function called for a quick conversion of the binary address to a numeric address.
void(* GNUNET_TRANSPORT_SessionMonitorSetup)(void *cls, GNUNET_TRANSPORT_SessionInfoCallback sic, void *sic_cls)
Begin monitoring sessions of a plugin.
void(* GNUNET_TRANSPORT_AddressStringCallback)(void *cls, const char *address, int res)
Function called by the pretty printer for the resolved address for each human-readable address obtain...
ssize_t(* GNUNET_TRANSPORT_TransmitFunction)(void *cls, struct GNUNET_ATS_Session *session, const char *msgbuf, size_t msgbuf_size, unsigned int priority, struct GNUNET_TIME_Relative to, GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
The new send function with just the session and no address.
Session handle for connections.
struct GNUNET_PeerIdentity target
To whom are we talking to.
size_t addrlen
Address length.
An address for communicating with a peer.
Header for all communications.
The identity of the host (wraps the signing key of the peer).
Handle for the service.
Time for relative time used by GNUnet, in microseconds.
The transport service will pass a pointer to a struct of this type as the first and only argument to ...
struct GNUNET_STATISTICS_Handle * stats
Handle for reporting statistics.
GNUNET_TRANSPORT_AddressToType get_address_type
Function that will be called to figure if an address is an loopback, LAN, WAN etc.
GNUNET_TRANSPORT_SessionEnd session_end
Function that must be called by the plugin when a non-NULL session handle stops being valid (is destr...
GNUNET_TRANSPORT_GetHelloCallback get_our_hello
Function that returns our HELLO.
GNUNET_TRANSPORT_AddressNotification notify_address
Function that must be called by each plugin to notify the transport service about the addresses under...
void * cls
Closure for the various callbacks.
GNUNET_TRANSPORT_UpdateAddressDistance update_address_distance
Function that will be called by DV to update distance for an address.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
GNUNET_TRANSPORT_SessionStart session_start
Function called by the plugin when a new (incoming) session was created not explicitly created using ...
GNUNET_TRANSPORT_PluginReceiveCallback receive
Function that should be called by the transport plugin whenever a message is received.
const struct GNUNET_PeerIdentity * my_identity
Identity of this peer.
uint32_t max_connections
What is the maximum number of connections that this transport should allow? Transports that do not ha...
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
void * cls
Closure for all of the callbacks.
GNUNET_TRANSPORT_TransmitFunction send
Function that the transport service will use to transmit data to another peer.
GNUNET_TRANSPORT_UpdateInboundDelay update_inbound_delay
Function that will be called whenever the transport service wants to notify the plugin that the inbou...
GNUNET_TRANSPORT_SessionMonitorSetup setup_monitor
Function to monitor the sessions managed by the plugin.
GNUNET_TRANSPORT_DisconnectPeerFunction disconnect_peer
Function that can be used to force the plugin to disconnect from the given peer and cancel all previo...
GNUNET_TRANSPORT_GetNetworkTypeForAddress get_network_for_address
Function to obtain the network type for an address.
GNUNET_TRANSPORT_DisconnectSessionFunction disconnect_session
Function that can be used to force the plugin to disconnect from the given peer and cancel all previo...
GNUNET_TRANSPORT_QueryKeepaliveFactorFunction query_keepalive_factor
Function that is used to query keepalive factor.
GNUNET_TRANSPORT_AddressPrettyPrinter address_pretty_printer
Function to pretty-print addresses.
GNUNET_TRANSPORT_AddressToString address_to_string
Function that will be called to convert a binary address to a string (numeric conversion only).
GNUNET_TRANSPORT_GetNetworkType get_network
Function to obtain the network type for a session.
GNUNET_TRANSPORT_CreateSession get_session
Function that will be called tell the plugin to create a session object.
GNUNET_TRANSPORT_CheckAddress check_address
Function that will be called to check if a binary address for this plugin is well-formed and correspo...
GNUNET_TRANSPORT_StringToAddress string_to_address
Function that will be called to convert a string address to binary (numeric conversion only).
GNUNET_TRANSPORT_UpdateSessionTimeout update_session_timeout
Function that will be called whenever the transport service wants to notify the plugin that a session...
Information about a plugin's session.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.