109 const struct sockaddr *addr,
131 unsigned long long tneigh;
144 _ (
"Transport service is lacking NEIGHBOUR_LIMIT option.\n"));
154 _ (
"Starting transport plugins `%s'\n"),
156 for (pos = strtok (plugs,
" "); pos != NULL; pos = strtok (NULL,
" "))
159 _ (
"Loading `%s' transport plugin\n"),
162 "libgnunet_plugin_transport_%s",
191 if (NULL == plug->
api)
194 _ (
"Failed to load transport plugin for `%s'\n"),
209 _ (
"Missing function `%s' in transport plugin for `%s'\n"),
210 "address_pretty_printer",
217 _ (
"Missing function `%s' in transport plugin for `%s'\n"),
225 _ (
"Missing function `%s' in transport plugin for `%s'\n"),
233 _ (
"Missing function `%s' in transport plugin for `%s'\n"),
241 _ (
"Missing function `%s' in transport plugin for `%s'\n"),
249 _ (
"Missing function `%s' in transport plugin for `%s'\n"),
257 _ (
"Missing function `%s' in transport plugin for `%s'\n"),
265 _ (
"Missing function `%s' in transport plugin for `%s'\n"),
273 _ (
"Missing function `%s' in transport plugin for `%s'\n"),
274 "disconnect_session",
281 _ (
"Missing function `%s' in transport plugin for `%s'\n"),
282 "query_keepalive_factor",
289 _ (
"Missing function `%s' in transport plugin for `%s'\n"),
290 "update_session_timeout",
296 _ (
"Did not load plugin `%s' due to missing functions\n"),
364 char *sep = strchr (stripped,
'_');
389 static char unable_to_show[1024];
390 static const char *s;
394 if (0 ==
address->address_length)
400 "Failed to find transport plugin `%s'\n",
402 return "<plugin unknown>";
404 if (0 ==
address->address_length)
407 sizeof(unable_to_show),
408 "<unable to stringify %u-byte long address of %s transport>",
409 (
unsigned int)
address->address_length,
411 return unable_to_show;
static char * address
GNS address for this phone.
static void address_cb(void *cls, void **app_ctx, int add_remove, enum GNUNET_NAT_AddressClass ac, const struct sockaddr *addr, socklen_t addrlen)
Signature of the callback passed to GNUNET_NAT_register() for a function to call whenever our set of ...
static struct GNUNET_PeerIdentity GST_my_identity
Our public key.
static const struct GNUNET_CONFIGURATION_Handle * GST_cfg
Configuration handle.
static struct GNUNET_STATISTICS_Handle * GST_stats
Statistics handle.
struct GNUNET_NT_InterfaceScanner * GST_is
Interface scanner determines our LAN address range(s).
void GST_ats_update_distance(const struct GNUNET_HELLO_Address *address, uint32_t distance)
Notify ATS about DV distance change to an address.
interfacing between transport and ATS service
const struct GNUNET_MessageHeader * GST_hello_get()
Obtain this peers HELLO message.
static void plugin_env_update_distance(void *cls, const struct GNUNET_HELLO_Address *address, uint32_t distance)
Function that will be called to update metrics for an address.
void GST_plugins_unload()
Unload all plugins.
struct GNUNET_TRANSPORT_PluginFunctions * GST_plugins_find(const char *name)
Obtain the plugin API based on a plugin name.
void GST_plugins_load(GNUNET_TRANSPORT_PluginReceiveCallback recv_cb, GNUNET_TRANSPORT_AddressNotification address_cb, GNUNET_TRANSPORT_SessionStart session_start_cb, GNUNET_TRANSPORT_SessionEnd session_end_cb)
Load and initialize all plugins.
static enum GNUNET_NetworkType plugin_env_address_to_type(void *cls, const struct sockaddr *addr, size_t addrlen)
Function that will be called to figure if an address is an loopback, LAN, WAN etc.
static struct TransportPlugin * plugins_head
Head of DLL of all loaded plugins.
struct GNUNET_TRANSPORT_PluginFunctions * GST_plugins_printer_find(const char *name)
Obtain the plugin API based on a the stripped plugin name after the underscore.
void GST_plugins_monitor_subscribe(GNUNET_TRANSPORT_SessionInfoCallback cb, void *cb_cls)
Register callback with all plugins to monitor their status.
const char * GST_plugins_a2s(const struct GNUNET_HELLO_Address *address)
Convert a given address to a human-readable format.
static struct TransportPlugin * plugins_tail
Head of DLL of all loaded plugins.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define GNUNET_log(kind,...)
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
int GNUNET_snprintf(char *buf, size_t size, const char *format,...) __attribute__((format(printf
Like snprintf, just aborts if the buffer is of insufficient size.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
enum GNUNET_NetworkType GNUNET_NT_scanner_get_type(struct GNUNET_NT_InterfaceScanner *is, const struct sockaddr *addr, socklen_t addrlen)
Returns where the address is located: loopback, LAN or WAN.
@ GNUNET_NT_UNSPECIFIED
Category of last resort.
void * GNUNET_PLUGIN_unload(const char *library_name, void *arg)
Unload plugin (runs the "done" callback and returns whatever "done" returned).
void * GNUNET_PLUGIN_load(const char *library_name, void *arg)
Setup plugin (runs the "init" callback and returns whatever "init" returned).
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 ...
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...
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.
#define TRANSPORT_SESSION_INBOUND_STRING
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.
An address for communicating with a peer.
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_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_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...
Entry in doubly-linked list of all of our plugins.
struct TransportPlugin * next
This is a doubly-linked list.
struct TransportPlugin * prev
This is a doubly-linked list.
struct GNUNET_TRANSPORT_PluginEnvironment env
Environment this transport service is using for this plugin.
char * short_name
Short name for the plugin (e.g.
char * lib_name
Name of the library (e.g.
struct GNUNET_TRANSPORT_PluginFunctions * api
API of the transport as returned by the plugin's initialization function.