main for gnunet-service-transport More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_hello_lib.h"
#include "gnunet_statistics_service.h"
#include "gnunet_transport_service.h"
#include "gnunet_peerinfo_service.h"
#include "gnunet_ats_service.h"
#include "gnunet-service-transport.h"
#include "gnunet-service-transport_ats.h"
#include "gnunet-service-transport_hello.h"
#include "gnunet-service-transport_neighbours.h"
#include "gnunet-service-transport_plugins.h"
#include "gnunet-service-transport_validation.h"
#include "gnunet-service-transport_manipulation.h"
#include "transport.h"
Go to the source code of this file.
Data Structures | |
struct | GNUNET_ATS_SessionKiller |
Information we need for an asynchronous session kill. More... | |
struct | TransportClient |
Client connected to the transport service. More... | |
struct | GST_BlacklistCheck |
Context we use when performing a blacklist check. More... | |
struct | AddressToStringContext |
Context for address to string operations. More... | |
struct | SendTransmitContinuationContext |
Closure for handle_send_transmit_continuation() More... | |
struct | IterationContext |
Closure for call_iterator(). More... | |
struct | TestConnectionContext |
Closure for test_connection_ok(). More... | |
Macros | |
#define | TRANSPORT_BLACKLIST_HT_SIZE 64 |
Size of the blacklist hash map. More... | |
#define | MAX_PENDING (128 * 1024) |
How many messages can we have pending for a given client process before we start to drop incoming messages? We typically should have only one client and so this would be the primary buffer for messages, so the number should be chosen rather generously. More... | |
Enumerations | |
enum | ClientType { CT_NONE = 0 , CT_CORE = 1 , CT_MONITOR = 2 , CT_COMMUNICATOR = 3 , CT_APPLICATION = 4 , CT_NONE = 0 , CT_CORE = 1 , CT_MONITOR = 2 , CT_BLACKLIST = 3 , CT_CORE_NO_HANDLERS = 4 } |
What type of client is the struct TransportClient about? More... | |
Functions | |
static void | unicast (struct TransportClient *tc, const struct GNUNET_MessageHeader *msg, int may_drop) |
Queue the given message for transmission to the given client. More... | |
static void * | client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq) |
Called whenever a client connects. More... | |
static void | do_blacklist_check (void *cls) |
Perform next action in the blacklist check. More... | |
static int | mark_match_down (void *cls, const struct GNUNET_PeerIdentity *peer, void *value) |
Mark the peer as down so we don't call the continuation context in the future. More... | |
static void | client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *client, void *app_ctx) |
Called whenever a client is disconnected. More... | |
static void | notify_client_about_neighbour (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, enum GNUNET_TRANSPORT_PeerState state, struct GNUNET_TIME_Absolute state_timeout, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) |
Function called for each of our connected neighbours. More... | |
static void | handle_client_start (void *cls, const struct StartMessage *start) |
Initialize a normal client. More... | |
static int | check_client_hello (void *cls, const struct GNUNET_MessageHeader *message) |
Client sent us a HELLO. More... | |
static void | handle_client_hello (void *cls, const struct GNUNET_MessageHeader *message) |
Client sent us a HELLO. More... | |
static void | handle_send_transmit_continuation (void *cls, int success, size_t bytes_payload, size_t bytes_on_wire) |
Function called after the transmission is done. More... | |
static int | check_client_send (void *cls, const struct OutboundMessage *obm) |
Client asked for transmission to a peer. More... | |
static void | handle_client_send (void *cls, const struct OutboundMessage *obm) |
Client asked for transmission to a peer. More... | |
static void | transmit_address_to_client (void *cls, const char *buf, int res) |
Take the given address and append it to the set of results sent back to the client. More... | |
static int | check_client_address_to_string (void *cls, const struct AddressLookupMessage *alum) |
Client asked to resolve an address. More... | |
static void | handle_client_address_to_string (void *cls, const struct AddressLookupMessage *alum) |
Client asked to resolve an address. More... | |
static struct PeerIterateResponseMessage * | compose_address_iterate_response_message (const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address) |
Compose PeerIterateResponseMessage using the given peer and address. More... | |
static void | send_peer_information (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, enum GNUNET_TRANSPORT_PeerState state, struct GNUNET_TIME_Absolute state_timeout, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) |
Output information of neighbours to the given client. More... | |
static void | handle_client_monitor_peers (void *cls, const struct PeerMonitorMessage *msg) |
Client asked to obtain information about a specific or all peers Process the request. More... | |
static void | plugin_session_info_cb (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 monitoring). More... | |
static void | handle_client_monitor_plugins (void *cls, const struct GNUNET_MessageHeader *message) |
Client asked to obtain information about all plugin connections. More... | |
void | GST_clients_broadcast (const struct GNUNET_MessageHeader *msg, int may_drop) |
Broadcast the given message to all of our clients. More... | |
void | GST_clients_broadcast_peer_notification (const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, enum GNUNET_TRANSPORT_PeerState state, struct GNUNET_TIME_Absolute state_timeout) |
Broadcast the new active address to all clients monitoring the peer. More... | |
static int | mark_peer_down (void *cls, const struct GNUNET_PeerIdentity *peer, void *value) |
Mark the peer as down so we don't call the continuation context in the future. More... | |
void | GST_clients_broadcast_disconnect (const struct GNUNET_PeerIdentity *peer) |
Notify all clients about a disconnect, and cancel pending SEND_OK messages for this peer. More... | |
static void | transmit_our_hello (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, enum GNUNET_TRANSPORT_PeerState state, struct GNUNET_TIME_Absolute state_timeout, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) |
Transmit our HELLO message to the given (connected) neighbour. More... | |
static void | process_hello_update (void *cls, const struct GNUNET_MessageHeader *hello) |
My HELLO has changed. More... | |
static struct GNUNET_TIME_Relative | process_payload (const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, const struct GNUNET_MessageHeader *message) |
We received some payload. More... | |
static void | kill_session_task (void *cls) |
Task to asynchronously terminate a session. More... | |
static void | kill_session (const char *plugin_name, struct GNUNET_ATS_Session *session) |
Force plugin to terminate session due to communication issue. More... | |
static void | connect_bl_check_cont (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, int result) |
Black list check result for try_connect call If connection to the peer is allowed request address and ??? More... | |
struct GNUNET_TIME_Relative | GST_receive_callback (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. More... | |
static void | plugin_env_address_change_notification (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. More... | |
static void | plugin_env_session_end (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 service needs to discard all of those sessions as well. More... | |
static void | plugin_env_session_start_bl_check_cont (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, int result) |
Black list check result from blacklist check triggered when a plugin gave us a new session in plugin_env_session_start(). More... | |
static void | plugin_env_session_start (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, enum GNUNET_NetworkType scope) |
Plugin tells transport service about a new inbound session. More... | |
static void | ats_request_address_change (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) |
Function called by ATS to notify the callee that the assigned bandwidth or address for a given peer was changed. More... | |
static void | confirm_or_drop_neighbour (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, int allowed) |
Got the result about an existing connection from a new blacklister. More... | |
static void | test_connection_ok (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, enum GNUNET_TRANSPORT_PeerState state, struct GNUNET_TIME_Absolute state_timeout, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) |
Test if an existing connection is still acceptable given a new blacklisting client. More... | |
static void | handle_client_blacklist_init (void *cls, const struct GNUNET_MessageHeader *message) |
Initialize a blacklisting client. More... | |
static int | free_blacklist_entry (void *cls, const struct GNUNET_PeerIdentity *key, void *value) |
Free the given entry in the blacklist. More... | |
static void | handle_client_set_metric (void *cls, const struct TrafficMetricMessage *tm) |
Set traffic metric to manipulate. More... | |
static void | shutdown_task (void *cls) |
Function called when the service shuts down. More... | |
static void | handle_client_blacklist_reply (void *cls, const struct BlacklistMessage *msg) |
A blacklisting client has sent us reply. More... | |
void | GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer, const char *transport_name) |
Add the given peer to the blacklist (for the given transport). More... | |
void | GST_blacklist_abort_matching (const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session) |
Abort blacklist if address and session match. More... | |
static int | test_blacklisted (void *cls, const struct GNUNET_PeerIdentity *key, void *value) |
Test if the given blacklist entry matches. More... | |
struct GST_BlacklistCheck * | GST_blacklist_test_allowed (const struct GNUNET_PeerIdentity *peer, const char *transport_name, GST_BlacklistTestContinuation cont, void *cont_cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session) |
Test if a peer/transport combination is blacklisted. More... | |
void | GST_blacklist_test_cancel (struct GST_BlacklistCheck *bc) |
Cancel a blacklist check. More... | |
static void | blacklist_cfg_iter (void *cls, const char *section, const char *option, const char *value) |
Function to iterate over options in the blacklisting section for a peer. More... | |
static void | read_blacklist_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_PeerIdentity *my_id) |
Read blacklist configuration. More... | |
static void | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_SERVICE_Handle *service) |
Initiate transport service. More... | |
GNUNET_SERVICE_MAIN ("transport", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_fixed_size(client_start, GNUNET_MESSAGE_TYPE_TRANSPORT_START, struct StartMessage, NULL), GNUNET_MQ_hd_var_size(client_hello, GNUNET_MESSAGE_TYPE_HELLO, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_var_size(client_send, GNUNET_MESSAGE_TYPE_TRANSPORT_SEND, struct OutboundMessage, NULL), GNUNET_MQ_hd_var_size(client_address_to_string, GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING, struct AddressLookupMessage, NULL), GNUNET_MQ_hd_fixed_size(client_monitor_peers, GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_REQUEST, struct PeerMonitorMessage, NULL), GNUNET_MQ_hd_fixed_size(client_blacklist_init, GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_INIT, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_fixed_size(client_blacklist_reply, GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_REPLY, struct BlacklistMessage, NULL), GNUNET_MQ_hd_fixed_size(client_set_metric, GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC, struct TrafficMetricMessage, NULL), GNUNET_MQ_hd_fixed_size(client_monitor_plugins, GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_START, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_handler_end()) | |
Define "main" method using service macro. More... | |
Variables | |
static struct TransportClient * | clients_head |
Head of linked list of all clients to this service. More... | |
static struct TransportClient * | clients_tail |
Tail of linked list of all clients to this service. More... | |
static struct GNUNET_CONTAINER_MultiPeerMap * | active_stccs |
Map of peer identities to active send transmit continuation contexts. More... | |
static struct AddressToStringContext * | a2s_head |
Head of linked list of all pending address iterations. More... | |
static struct AddressToStringContext * | a2s_tail |
Tail of linked list of all pending address iterations. More... | |
static struct GST_BlacklistCheck * | bc_head |
Head of DLL of active blacklisting queries. More... | |
static struct GST_BlacklistCheck * | bc_tail |
Tail of DLL of active blacklisting queries. More... | |
static struct GNUNET_CONTAINER_MultiPeerMap * | blacklist |
Hashmap of blacklisted peers. More... | |
static struct GNUNET_NotificationContext * | plugin_nc |
Notification context, to send updates on changes to active plugin connections. More... | |
static struct TransportClient * | sync_client |
Plugin monitoring client we are currently syncing, NULL if all monitoring clients are in sync. More... | |
static struct GNUNET_PeerIdentity | all_zeros |
Peer identity that is all zeros, used as a way to indicate "all peers". More... | |
struct GNUNET_STATISTICS_Handle * | GST_stats |
Statistics handle. More... | |
const struct GNUNET_CONFIGURATION_Handle * | GST_cfg |
Configuration handle. More... | |
struct GNUNET_PeerIdentity | GST_my_identity |
Configuration handle. More... | |
struct GNUNET_PEERINFO_Handle * | GST_peerinfo |
Handle to peerinfo service. More... | |
struct GNUNET_CRYPTO_EddsaPrivateKey | GST_my_private_key |
Our private key. More... | |
struct GNUNET_ATS_SchedulingHandle * | GST_ats |
ATS scheduling handle. More... | |
struct GNUNET_ATS_ConnectivityHandle * | GST_ats_connect |
ATS connectivity handle. More... | |
struct GNUNET_TIME_Relative | hello_expiration |
Hello address expiration. More... | |
static struct GNUNET_ATS_SessionKiller * | sk_head |
Head of DLL of asynchronous tasks to kill sessions. More... | |
static struct GNUNET_ATS_SessionKiller * | sk_tail |
Tail of DLL of asynchronous tasks to kill sessions. More... | |
struct GNUNET_NT_InterfaceScanner * | GST_is |
Interface scanner determines our LAN address range(s). More... | |
main for gnunet-service-transport
Definition in file gnunet-service-transport.c.
#define TRANSPORT_BLACKLIST_HT_SIZE 64 |
Size of the blacklist hash map.
Definition at line 44 of file gnunet-service-transport.c.
#define MAX_PENDING (128 * 1024) |
How many messages can we have pending for a given client process before we start to drop incoming messages? We typically should have only one client and so this would be the primary buffer for messages, so the number should be chosen rather generously.
The expectation here is that most of the time the queue is large enough so that a drop is virtually never required. Note that this value must be about as large as 'TOTAL_MSGS' in the 'test_transport_api_reliability.c', otherwise that testcase may fail.
Definition at line 58 of file gnunet-service-transport.c.
enum ClientType |
What type of client is the struct TransportClient
about?
Definition at line 96 of file gnunet-service-transport.c.
|
static |
Queue the given message for transmission to the given client.
tc | target of the message |
msg | message to transmit |
may_drop | GNUNET_YES if the message can be dropped |
Definition at line 427 of file gnunet-service-transport.c.
References env, gettext_noop, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MQ_get_length(), GNUNET_MQ_msg_copy(), GNUNET_MQ_send(), GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_YES, GST_stats, MAX_PENDING, msg, GNUNET_MessageHeader::size, tc, and GNUNET_MessageHeader::type.
Referenced by broadcast_status(), GST_clients_broadcast(), handle_client_start(), handle_send_transmit_continuation(), and notify_client_about_neighbour().
|
static |
Called whenever a client connects.
Allocates our data structures associated with that client.
cls | closure, NULL |
client | identification of the client |
mq | message queue for the client |
struct TransportClient
Definition at line 465 of file gnunet-service-transport.c.
References TransportClient::client, clients_head, clients_tail, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, mq, and tc.
|
static |
Perform next action in the blacklist check.
cls | the struct GST_BlacklistCheck * |
Definition at line 2193 of file gnunet-service-transport.c.
References GST_BlacklistCheck::address, GST_BlacklistCheck::bl_pos, GST_BlacklistCheck::cont, GST_BlacklistCheck::cont_cls, CT_BLACKLIST, env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NO, GNUNET_OK, GNUNET_SERVICE_client_continue(), GNUNET_YES, GST_blacklist_test_cancel(), BlacklistMessage::is_allowed, GST_BlacklistCheck::peer, BlacklistMessage::peer, GST_BlacklistCheck::session, GST_BlacklistCheck::task, and tc.
Referenced by client_disconnect_cb(), GST_blacklist_test_allowed(), handle_client_blacklist_reply(), and test_connection_ok().
|
static |
Mark the peer as down so we don't call the continuation context in the future.
cls | a struct TransportClient |
peer | a peer we are sending to |
value | a struct SendTransmitContinuationContext to mark |
Definition at line 499 of file gnunet-service-transport.c.
References SendTransmitContinuationContext::down, GNUNET_OK, GNUNET_YES, SendTransmitContinuationContext::tc, tc, and value.
Referenced by client_disconnect_cb().
|
static |
Called whenever a client is disconnected.
Frees our resources associated with that client.
cls | closure, NULL |
client | identification of the client |
app_ctx | our struct TransportClient |
Definition at line 522 of file gnunet-service-transport.c.
References a2s_head, active_stccs, bc_head, GST_BlacklistCheck::bl_pos, clients_head, clients_tail, CT_BLACKLIST, CT_CORE, CT_CORE_NO_HANDLERS, CT_MONITOR, CT_NONE, do_blacklist_check(), GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multipeermap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_SCHEDULER_add_now(), mark_match_down(), GST_BlacklistCheck::next, AddressToStringContext::next, GST_BlacklistCheck::task, and tc.
|
static |
Function called for each of our connected neighbours.
Notify the client about the existing neighbour.
cls | the struct TransportClient * to notify |
peer | identity of the neighbour |
address | the address |
state | the current state of the peer |
state_timeout | the time out for the state |
bandwidth_in | inbound bandwidth in NBO |
bandwidth_out | outbound bandwidth in NBO |
Definition at line 585 of file gnunet-service-transport.c.
References GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT, GNUNET_NO, GST_neighbours_test_connected(), ConnectInfoMessage::header, ConnectInfoMessage::id, peer, ConnectInfoMessage::quota_out, GNUNET_MessageHeader::size, tc, GNUNET_MessageHeader::type, and unicast().
Referenced by handle_client_start().
|
static |
Initialize a normal client.
We got a start message from this client, add it to the list of clients for broadcasting of inbound messages.
cls | the client |
start | the start message that was sent |
Definition at line 615 of file gnunet-service-transport.c.
References CT_CORE, CT_CORE_NO_HANDLERS, CT_NONE, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GST_hello_get(), GST_my_identity, GST_neighbours_iterate(), notify_client_about_neighbour(), options, start, tc, and unicast().
|
static |
Client sent us a HELLO.
Check the request.
cls | the client |
message | the HELLO message |
Definition at line 658 of file gnunet-service-transport.c.
References GNUNET_OK.
|
static |
Client sent us a HELLO.
Process the request.
cls | the client |
message | the HELLO message |
Definition at line 671 of file gnunet-service-transport.c.
References GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_SERVICE_client_continue(), GST_validation_handle_hello(), and tc.
|
static |
Function called after the transmission is done.
Notify the client that it is OK to send the next message.
cls | closure |
success | GNUNET_OK on success, GNUNET_NO on failure, GNUNET_SYSERR if we're not connected |
bytes_payload | bytes payload sent |
bytes_on_wire | bytes sent on wire |
Definition at line 691 of file gnunet-service-transport.c.
References active_stccs, SendOkMessage::bytes_msg, SendOkMessage::bytes_physical, delay, SendTransmitContinuationContext::down, GNUNET_assert, GNUNET_CONSTANTS_LATENCY_WARN, GNUNET_CONTAINER_multipeermap_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK, GNUNET_NO, GNUNET_OK, GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get_duration(), GNUNET_YES, GST_neighbour_get_current_address(), SendOkMessage::header, SendOkMessage::peer, GNUNET_TIME_Relative::rel_value_us, SendTransmitContinuationContext::send_time, GNUNET_MessageHeader::size, SendOkMessage::success, SendTransmitContinuationContext::target, SendTransmitContinuationContext::tc, GNUNET_HELLO_Address::transport_name, GNUNET_MessageHeader::type, unicast(), and SendTransmitContinuationContext::uuid.
Referenced by handle_client_send().
|
static |
Client asked for transmission to a peer.
Process the request.
cls | the client |
obm | the send message that was sent |
Definition at line 753 of file gnunet-service-transport.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, OutboundMessage::header, GNUNET_MessageHeader::size, and size.
|
static |
Client asked for transmission to a peer.
Process the request.
cls | the client |
obm | the send message that was sent |
Definition at line 781 of file gnunet-service-transport.c.
References active_stccs, gettext_noop, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multipeermap_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_SERVICE_client_continue(), GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_get(), GNUNET_TIME_relative_ntoh(), GST_manipulation_send(), GST_neighbours_test_connected(), GST_stats, handle_send_transmit_continuation(), OutboundMessage::peer, SendTransmitContinuationContext::send_time, GNUNET_MessageHeader::size, SendTransmitContinuationContext::target, SendTransmitContinuationContext::tc, tc, OutboundMessage::timeout, GNUNET_MessageHeader::type, and SendTransmitContinuationContext::uuid.
|
static |
Take the given address and append it to the set of results sent back to the client.
This function may be called several times for a single conversion. The last invocation will be with a address of NULL and a res of GNUNET_OK. Thus, to indicate conversion errors, the callback might be called first with address NULL and res being GNUNET_SYSERR. In that case, there will still be a subsequent call later with address NULL and res GNUNET_OK.
cls | the struct AddressToStringContext |
buf | text to transmit (contains the human-readable address, or NULL) |
res | GNUNET_OK if conversion was successful, GNUNET_SYSERR on error, never GNUNET_NO |
Definition at line 846 of file gnunet-service-transport.c.
References a2s_head, a2s_tail, AddressToStringResultMessage::addr_len, buf, env, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY, GNUNET_MQ_msg, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, TransportClient::mq, res, AddressToStringResultMessage::res, and AddressToStringContext::tc.
Referenced by handle_client_address_to_string().
|
static |
Client asked to resolve an address.
Check the request.
cls | the client |
alum | the resolution request |
Definition at line 901 of file gnunet-service-transport.c.
References address, AddressLookupMessage::addrlen, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, AddressLookupMessage::header, plugin_name, GNUNET_MessageHeader::size, and size.
|
static |
Client asked to resolve an address.
Process the request.
cls | the client |
alum | the resolution request |
Definition at line 935 of file gnunet-service-transport.c.
References a2s_head, a2s_tail, AddressToStringResultMessage::addr_len, address, GNUNET_TRANSPORT_PluginFunctions::address_pretty_printer, AddressLookupMessage::addrlen, GNUNET_TRANSPORT_PluginFunctions::cls, env, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, GNUNET_OK, GNUNET_SERVICE_client_disable_continue_warning(), GNUNET_SYSERR, GNUNET_TIME_relative_ntoh(), GST_plugins_printer_find(), numeric, AddressLookupMessage::numeric_only, plugin_name, AddressToStringResultMessage::res, AddressToStringContext::tc, tc, AddressLookupMessage::timeout, and transmit_address_to_client().
|
static |
Compose PeerIterateResponseMessage using the given peer and address.
peer | identity of the peer |
address | the address, NULL on disconnect |
Definition at line 999 of file gnunet-service-transport.c.
References address, GNUNET_assert, GNUNET_malloc, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE, msg, peer, GNUNET_MessageHeader::size, size, and GNUNET_MessageHeader::type.
Referenced by GST_clients_broadcast_peer_notification(), and send_peer_information().
|
static |
Output information of neighbours to the given client.
cls | the struct PeerIterationContext * |
peer | identity of the neighbour |
address | the address |
state | current state this peer is in |
state_timeout | timeout for the current state of the peer |
bandwidth_in | inbound quota in NBO |
bandwidth_out | outbound quota in NBO |
Definition at line 1076 of file gnunet-service-transport.c.
References address, compose_address_iterate_response_message(), env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_MQ_msg_copy(), GNUNET_MQ_send(), GNUNET_TIME_absolute_hton(), GNUNET_TRANSPORT_ps2s(), GNUNET_YES, GST_plugins_a2s(), GNUNET_FS_PublishContext::mq, msg, pc, peer, state, and PeerIterateResponseMessage::state_timeout.
Referenced by handle_client_monitor_peers().
|
static |
Client asked to obtain information about a specific or all peers Process the request.
cls | the client |
msg | the peer address information request |
Definition at line 1112 of file gnunet-service-transport.c.
References all_zeros, CT_MONITOR, CT_NONE, env, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE_END, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NO, GNUNET_SERVICE_client_disable_continue_warning(), GNUNET_SERVICE_client_drop(), GNUNET_SERVICE_client_mark_monitor(), GNUNET_YES, GST_neighbours_iterate(), msg, pc, send_peer_information(), and tc.
|
static |
Function called by the plugin with information about the current sessions managed by the plugin (for monitoring).
cls | closure |
session | session handle this information is about, NULL to indicate that we are "in sync" (initial iteration complete) |
info | information about the state of the session, NULL if session is also NULL and we are merely signalling that the initial iteration is over |
Definition at line 1183 of file gnunet-service-transport.c.
References env, GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_EVENT, GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_SYNC, GNUNET_MQ_msg, GNUNET_MQ_msg_copy(), GNUNET_MQ_send(), GNUNET_NO, GNUNET_notification_context_broadcast(), GNUNET_notification_context_get_size(), GNUNET_TIME_absolute_hton(), GST_plugins_monitor_subscribe(), info, TransportClient::mq, msg, name, plugin_nc, GNUNET_MessageHeader::size, size, sync_client, and GNUNET_MessageHeader::type.
Referenced by handle_client_monitor_plugins().
|
static |
Client asked to obtain information about all plugin connections.
cls | the client |
message | the peer address information request |
Definition at line 1265 of file gnunet-service-transport.c.
References GNUNET_assert, GNUNET_notification_context_add(), GNUNET_SERVICE_client_disable_continue_warning(), GNUNET_SERVICE_client_mark_monitor(), GST_plugins_monitor_subscribe(), plugin_nc, plugin_session_info_cb(), sync_client, and tc.
void GST_clients_broadcast | ( | const struct GNUNET_MessageHeader * | msg, |
int | may_drop | ||
) |
Broadcast the given message to all of our clients.
msg | message to broadcast |
may_drop | GNUNET_YES if the message can be dropped / is payload |
Definition at line 1286 of file gnunet-service-transport.c.
References clients_head, CT_CORE, CT_NONE, done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GNUNET_YES, msg, GNUNET_MessageHeader::size, tc, GNUNET_MessageHeader::type, and unicast().
Referenced by GST_clients_broadcast_disconnect(), neighbours_connect_notification(), process_hello_update(), and send_outbound_quota_to_clients().
void GST_clients_broadcast_peer_notification | ( | const struct GNUNET_PeerIdentity * | peer, |
const struct GNUNET_HELLO_Address * | address, | ||
enum GNUNET_TRANSPORT_PeerState | state, | ||
struct GNUNET_TIME_Absolute | state_timeout | ||
) |
Broadcast the new active address to all clients monitoring the peer.
peer | peer this update is about (never NULL) |
address | address, NULL on disconnect |
state | the current state of the peer |
state_timeout | the time out for the state |
Definition at line 1320 of file gnunet-service-transport.c.
References address, all_zeros, clients_head, compose_address_iterate_response_message(), CT_MONITOR, env, GNUNET_free, GNUNET_MQ_msg_copy(), GNUNET_MQ_send(), GNUNET_TIME_absolute_hton(), msg, peer, state, PeerIterateResponseMessage::state_timeout, and tc.
Referenced by neighbours_changed_notification().
|
static |
Mark the peer as down so we don't call the continuation context in the future.
cls | NULL |
peer | peer that got disconnected |
value | a struct SendTransmitContinuationContext to mark |
Definition at line 1361 of file gnunet-service-transport.c.
References SendTransmitContinuationContext::down, GNUNET_OK, GNUNET_YES, and value.
Referenced by GST_clients_broadcast_disconnect().
void GST_clients_broadcast_disconnect | ( | const struct GNUNET_PeerIdentity * | peer | ) |
Notify all clients about a disconnect, and cancel pending SEND_OK messages for this peer.
peer | peer that disconnected |
Definition at line 1377 of file gnunet-service-transport.c.
References active_stccs, GNUNET_CONTAINER_multipeermap_get_multiple(), GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT, GNUNET_NO, GST_clients_broadcast(), DisconnectInfoMessage::header, mark_peer_down(), peer, DisconnectInfoMessage::peer, DisconnectInfoMessage::reserved, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.
Referenced by neighbours_disconnect_notification().
|
static |
Transmit our HELLO message to the given (connected) neighbour.
cls | the 'HELLO' message |
peer | identity of the peer |
address | the address |
state | current state this peer is in |
state_timeout | timeout for the current state of the peer |
bandwidth_in | inbound quota in NBO |
bandwidth_out | outbound quota in NBO |
Definition at line 1405 of file gnunet-service-transport.c.
References GNUNET_NO, GST_my_identity, GST_neighbours_send(), GST_neighbours_test_connected(), hello_expiration, peer, and GNUNET_MessageHeader::size.
Referenced by process_hello_update().
|
static |
My HELLO has changed.
Tell everyone who should know.
cls | unused |
hello | new HELLO |
Definition at line 1436 of file gnunet-service-transport.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GST_clients_broadcast(), GST_neighbours_iterate(), and transmit_our_hello().
Referenced by run().
|
static |
We received some payload.
Prepare to pass it on to our clients.
address | address and (claimed) identity of the other peer |
session | identifier used for this session (NULL for plugins that do not offer bi-directional communication to the sender using the same "connection") |
message | the message to process |
Definition at line 1436 of file gnunet-service-transport.c.
|
static |
Task to asynchronously terminate a session.
cls | the struct GNUNET_ATS_SessionKiller with the information for the kill |
Definition at line 1504 of file gnunet-service-transport.c.
References GNUNET_TRANSPORT_PluginFunctions::cls, GNUNET_TRANSPORT_PluginFunctions::disconnect_session, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_ATS_SessionKiller::plugin, GNUNET_ATS_SessionKiller::session, sk_head, sk_tail, and GNUNET_ATS_SessionKiller::task.
Referenced by kill_session().
|
static |
Force plugin to terminate session due to communication issue.
plugin_name | name of the plugin |
session | session to termiante |
Definition at line 1523 of file gnunet-service-transport.c.
References GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_SCHEDULER_add_now(), GST_plugins_find(), kill_session_task(), GNUNET_ATS_SessionKiller::next, plugin, GNUNET_ATS_SessionKiller::plugin, plugin_name, GNUNET_ATS_SessionKiller::session, sk_head, sk_tail, and GNUNET_ATS_SessionKiller::task.
Referenced by connect_bl_check_cont(), and plugin_env_session_start_bl_check_cont().
|
static |
Black list check result for try_connect call If connection to the peer is allowed request address and ???
cls | the message |
peer | the peer |
address | the address |
session | the session |
result | the result |
Definition at line 1557 of file gnunet-service-transport.c.
References address, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_OK, GNUNET_SYSERR, GST_blacklist_abort_matching(), GST_neighbours_handle_session_syn(), GST_plugins_a2s(), kill_session(), msg, peer, and result.
struct GNUNET_TIME_Relative GST_receive_callback | ( | 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.
cls | closure, const char* with the name of the plugin we received the message from |
address | address and (claimed) identity of the other peer |
message | the message, NULL if we only care about learning about the delay until we should receive again |
session | identifier used for this session (NULL for plugins that do not offer bi-directional communication to the sender using the same "connection") |
Definition at line 1557 of file gnunet-service-transport.c.
|
static |
Function that will be called for each address the transport is aware that it might be reachable under.
Update our HELLO.
cls | name of the plugin (const char*) |
add_remove | should the address added (YES) or removed (NO) from the set of valid addresses? |
address | the address to add or remove |
Definition at line 1740 of file gnunet-service-transport.c.
References address, addresses, GNUNET_break, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_YES, GST_hello_modify_addresses(), and GST_stats.
Referenced by run().
|
static |
Function that will be called whenever the plugin internally cleans up a session pointer and hence the service needs to discard all of those sessions as well.
Plugins that do not use sessions can simply omit calling this function and always use NULL wherever a session pointer is needed. This function should be called BEFORE a potential "TransmitContinuation" from the "TransmitFunction".
cls | closure |
address | which address was the session for |
session | which session is being destroyed |
Definition at line 1788 of file gnunet-service-transport.c.
References address, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_SCHEDULER_cancel(), GST_ats_del_session(), GST_blacklist_abort_matching(), GST_neighbours_session_terminated(), GST_plugins_a2s(), GNUNET_ATS_SessionKiller::next, GNUNET_ATS_SessionKiller::session, sk_head, sk_tail, and GNUNET_ATS_SessionKiller::task.
Referenced by run().
|
static |
Black list check result from blacklist check triggered when a plugin gave us a new session in plugin_env_session_start().
If connection to the peer is disallowed, kill the session.
cls | NULL |
peer | the peer |
address | address associated with the request |
session | session associated with the request |
result | the result |
Definition at line 1842 of file gnunet-service-transport.c.
References address, GNUNET_ERROR_TYPE_DEBUG, GNUNET_HELLO_address_check_option(), GNUNET_HELLO_ADDRESS_INFO_INBOUND, GNUNET_log, GNUNET_OK, GNUNET_YES, GST_plugins_a2s(), GST_validation_handle_address(), kill_session(), result, and GNUNET_ATS_SessionKiller::session.
Referenced by plugin_env_session_start().
|
static |
Plugin tells transport service about a new inbound session.
cls | unused |
address | the address |
session | the new session |
scope | network scope information |
Definition at line 1875 of file gnunet-service-transport.c.
References address, GNUNET_break, GNUNET_ERROR_TYPE_INFO, GNUNET_HELLO_address_check_option(), GNUNET_HELLO_ADDRESS_INFO_INBOUND, GNUNET_i2s(), GNUNET_log, GNUNET_NT_UNSPECIFIED, GNUNET_YES, GST_ats_add_inbound_address(), GST_blacklist_test_allowed(), GST_plugins_a2s(), plugin_env_session_start_bl_check_cont(), GNUNET_ATS_Properties::scope, and scope.
Referenced by run().
|
static |
Function called by ATS to notify the callee that the assigned bandwidth or address for a given peer was changed.
If the callback is called with address/bandwidth assignments of zero, the ATS disconnect function will still be called once the disconnect actually happened.
cls | closure |
peer | the peer this address is intended for |
address | address to use (for peer given in address) |
session | session to use (if available) |
bandwidth_out | assigned outbound bandwidth for the connection in NBO, 0 to disconnect from peer |
bandwidth_in | assigned inbound bandwidth for the connection in NBO, 0 to disconnect from peer |
ats | ATS information |
ats_count | number of ats elements |
Definition at line 1940 of file gnunet-service-transport.c.
References address, GNUNET_assert, GNUNET_ERROR_TYPE_INFO, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_update(), GST_neighbours_force_disconnect(), GST_neighbours_switch_to_address(), GST_stats, peer, and GNUNET_BANDWIDTH_Value32NBO::value__.
Referenced by run().
|
static |
Got the result about an existing connection from a new blacklister.
Shutdown the neighbour if necessary.
cls | unused |
peer | the neighbour that was investigated |
address | address associated with the request |
session | session associated with the request |
allowed | GNUNET_OK if we can keep it, GNUNET_NO if we must shutdown the connection |
Definition at line 2010 of file gnunet-service-transport.c.
References gettext_noop, GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_update(), GST_neighbours_force_disconnect(), GST_stats, and peer.
Referenced by test_connection_ok().
|
static |
Test if an existing connection is still acceptable given a new blacklisting client.
cls | the struct TestConnectionContext * |
peer | identity of the peer |
address | the address |
state | current state this peer is in |
state_timeout | timeout for the current state of the peer |
bandwidth_in | bandwidth assigned inbound |
bandwidth_out | bandwidth assigned outbound |
Definition at line 2039 of file gnunet-service-transport.c.
References address, GST_BlacklistCheck::address, bc_head, bc_tail, GST_BlacklistCheck::bl_pos, confirm_or_drop_neighbour(), GST_BlacklistCheck::cont, GST_BlacklistCheck::cont_cls, do_blacklist_check(), TestConnectionContext::first, GNUNET_CONTAINER_DLL_insert, GNUNET_HELLO_address_copy(), GNUNET_new, GNUNET_NO, GNUNET_SCHEDULER_add_now(), GNUNET_YES, peer, GST_BlacklistCheck::peer, GST_BlacklistCheck::task, and TestConnectionContext::tc.
Referenced by handle_client_blacklist_init().
|
static |
Initialize a blacklisting client.
We got a blacklist-init message from this client, add it to the list of clients to query for blacklisting.
cls | the client |
message | the blacklist-init message that was sent |
Definition at line 2076 of file gnunet-service-transport.c.
References CT_BLACKLIST, CT_NONE, TestConnectionContext::first, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_SERVICE_client_drop(), GNUNET_SERVICE_client_mark_monitor(), GNUNET_YES, GST_neighbours_iterate(), TestConnectionContext::tc, tc, and test_connection_ok().
|
static |
Free the given entry in the blacklist.
cls | unused |
key | host identity (unused) |
value | the blacklist entry |
Definition at line 2108 of file gnunet-service-transport.c.
References GNUNET_free, GNUNET_OK, and value.
Referenced by shutdown_task().
|
static |
Set traffic metric to manipulate.
cls | closure |
tm | message containing information |
Definition at line 2126 of file gnunet-service-transport.c.
References GNUNET_SERVICE_client_continue(), GST_manipulation_set_metric(), and tc.
|
static |
Function called when the service shuts down.
Unloads our plugins and cancels pending validations.
cls | closure, unused |
Definition at line 2142 of file gnunet-service-transport.c.
References a2s_head, a2s_tail, active_stccs, blacklist, free_blacklist_entry(), GNUNET_ATS_connectivity_done(), GNUNET_ATS_scheduling_done(), GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_CONTAINER_multipeermap_iterate(), GNUNET_free, GNUNET_NO, GNUNET_notification_context_destroy(), GNUNET_NT_scanner_done(), GNUNET_PEERINFO_disconnect(), GNUNET_STATISTICS_destroy(), GST_ats, GST_ats_connect, GST_ats_done(), GST_hello_stop(), GST_is, GST_manipulation_stop(), GST_neighbours_stop(), GST_peerinfo, GST_plugins_unload(), GST_stats, GST_validation_stop(), and plugin_nc.
Referenced by run().
|
static |
A blacklisting client has sent us reply.
Process it.
cls | the client |
msg | the blacklist-reply message that was sent |
Definition at line 2241 of file gnunet-service-transport.c.
References GST_BlacklistCheck::address, bc_head, bc_tail, GST_BlacklistCheck::bl_pos, GST_BlacklistCheck::cont, GST_BlacklistCheck::cont_cls, CT_BLACKLIST, do_blacklist_check(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_add_now(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_SYSERR, GNUNET_YES, GST_blacklist_test_cancel(), msg, GST_BlacklistCheck::next, GST_BlacklistCheck::peer, GST_BlacklistCheck::session, GST_BlacklistCheck::task, and tc.
void GST_blacklist_add_peer | ( | const struct GNUNET_PeerIdentity * | peer, |
const char * | transport_name | ||
) |
Add the given peer to the blacklist (for the given transport).
peer | peer to blacklist |
transport_name | transport to blacklist for this peer, NULL for all |
Definition at line 2307 of file gnunet-service-transport.c.
References blacklist, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multipeermap_create(), GNUNET_CONTAINER_multipeermap_put(), GNUNET_ERROR_TYPE_INFO, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_strdup, peer, transport, and TRANSPORT_BLACKLIST_HT_SIZE.
Referenced by blacklist_cfg_iter(), and run().
void GST_blacklist_abort_matching | ( | const struct GNUNET_HELLO_Address * | address, |
struct GNUNET_ATS_Session * | session | ||
) |
Abort blacklist if address and session match.
address | address used to abort matching checks |
session | session used to abort matching checks |
Definition at line 2343 of file gnunet-service-transport.c.
References address, GST_BlacklistCheck::address, bc_head, GST_BlacklistCheck::cont, GST_BlacklistCheck::cont_cls, GNUNET_HELLO_address_cmp(), GNUNET_SYSERR, GST_blacklist_test_cancel(), GST_BlacklistCheck::next, GST_BlacklistCheck::peer, and GST_BlacklistCheck::session.
Referenced by connect_bl_check_cont(), and plugin_env_session_end().
|
static |
Test if the given blacklist entry matches.
If so, abort the iteration.
cls | the transport name to match (const char*) |
key | the key (unused) |
value | the 'char *' (name of a blacklisted transport) |
Definition at line 2377 of file gnunet-service-transport.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_log, GNUNET_NO, GNUNET_OK, key, and value.
Referenced by GST_blacklist_test_allowed().
struct GST_BlacklistCheck* GST_blacklist_test_allowed | ( | const struct GNUNET_PeerIdentity * | peer, |
const char * | transport_name, | ||
GST_BlacklistTestContinuation | cont, | ||
void * | cont_cls, | ||
const struct GNUNET_HELLO_Address * | address, | ||
struct GNUNET_ATS_Session * | session | ||
) |
Test if a peer/transport combination is blacklisted.
peer | the identity of the peer to test |
transport_name | name of the transport to test, never NULL |
cont | function to call with result |
cont_cls | closure for cont |
address | address to pass back to cont, can be NULL |
session | session to pass back to cont, can be NULL |
Definition at line 2421 of file gnunet-service-transport.c.
References _, address, GST_BlacklistCheck::address, TransportClient::bc, bc_head, bc_tail, GST_BlacklistCheck::bl_pos, blacklist, clients_head, GST_BlacklistCheck::cont, GST_BlacklistCheck::cont_cls, CT_BLACKLIST, do_blacklist_check(), gettext_noop, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_multipeermap_get_multiple(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_HELLO_address_copy(), GNUNET_i2s(), GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_STATISTICS_update(), GNUNET_SYSERR, GST_stats, peer, GST_BlacklistCheck::peer, GST_BlacklistCheck::session, GST_BlacklistCheck::task, tc, and test_blacklisted().
Referenced by GST_neighbours_switch_to_address(), plugin_env_session_start(), and revalidate_address().
void GST_blacklist_test_cancel | ( | struct GST_BlacklistCheck * | bc | ) |
Cancel a blacklist check.
bc | check to cancel |
Definition at line 2490 of file gnunet-service-transport.c.
References GST_BlacklistCheck::address, TransportClient::bc, bc_head, bc_tail, GST_BlacklistCheck::bl_pos, TransportClient::blacklist, CT_BLACKLIST, TransportClient::details, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_SCHEDULER_cancel(), GST_BlacklistCheck::task, and TransportClient::type.
Referenced by cleanup_validation_entry(), do_blacklist_check(), GST_blacklist_abort_matching(), handle_client_blacklist_reply(), and revalidate_address().
|
static |
Function to iterate over options in the blacklisting section for a peer.
cls | closure |
section | name of the section |
option | name of the option |
value | value of the option |
Definition at line 2521 of file gnunet-service-transport.c.
References _, GNUNET_CRYPTO_eddsa_public_key_from_string(), GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_OK, GNUNET_strdup, GST_blacklist_add_peer(), peer, res, and value.
Referenced by read_blacklist_configuration().
|
static |
Read blacklist configuration.
cfg | the configuration handle |
my_id | my peer identity |
Definition at line 2569 of file gnunet-service-transport.c.
References blacklist_cfg_iter(), cfg, GNUNET_CONFIGURATION_iterate_section_values(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s_full(), GNUNET_log, GNUNET_snprintf(), and res.
Referenced by run().
|
static |
Initiate transport service.
cls | closure |
c | configuration to use |
service | the initialized service |
Definition at line 2597 of file gnunet-service-transport.c.
References _, active_stccs, ats_request_address_change(), DEFAULT_MAX_FDS, ds, GNUNET_assert, GNUNET_ATS_connectivity_init(), GNUNET_ATS_scheduling_init(), GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_time(), GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION, GNUNET_CONTAINER_multipeermap_create(), GNUNET_CRYPTO_eddsa_key_from_file(), GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_CRYPTO_eddsa_public_key_from_string(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_i2s_full(), GNUNET_log, GNUNET_NO, GNUNET_notification_context_create(), GNUNET_NT_scanner_init(), GNUNET_OK, GNUNET_PEERINFO_connect(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_STATISTICS_create(), GNUNET_SYSERR, GNUNET_YES, GST_ats, GST_ats_connect, GST_ats_init(), GST_blacklist_add_peer(), GST_cfg, GST_hello_start(), GST_is, GST_manipulation_init(), GST_manipulation_recv(), GST_my_identity, GST_my_private_key, GST_neighbours_start(), GST_peerinfo, GST_plugins_load(), GST_stats, GST_validation_start(), hello_expiration, plugin_env_address_change_notification(), plugin_env_session_end(), plugin_env_session_start(), plugin_nc, process_hello_update(), GNUNET_PeerIdentity::public_key, read_blacklist_configuration(), and shutdown_task().
Define "main" method using service macro.
|
static |
Head of linked list of all clients to this service.
Definition at line 305 of file gnunet-service-transport.c.
Referenced by client_connect_cb(), client_disconnect_cb(), GST_blacklist_test_allowed(), GST_clients_broadcast(), and GST_clients_broadcast_peer_notification().
|
static |
Tail of linked list of all clients to this service.
Definition at line 310 of file gnunet-service-transport.c.
Referenced by client_connect_cb(), and client_disconnect_cb().
|
static |
Map of peer identities to active send transmit continuation contexts.
Used to flag contexts as 'dead' when a connection goes down. Values are of type struct SendTransmitContinuationContext *
.
Definition at line 318 of file gnunet-service-transport.c.
Referenced by client_disconnect_cb(), GST_clients_broadcast_disconnect(), handle_client_send(), handle_send_transmit_continuation(), run(), and shutdown_task().
|
static |
Head of linked list of all pending address iterations.
Definition at line 323 of file gnunet-service-transport.c.
Referenced by client_disconnect_cb(), handle_client_address_to_string(), shutdown_task(), and transmit_address_to_client().
|
static |
Tail of linked list of all pending address iterations.
Definition at line 328 of file gnunet-service-transport.c.
Referenced by handle_client_address_to_string(), shutdown_task(), and transmit_address_to_client().
|
static |
Head of DLL of active blacklisting queries.
Definition at line 333 of file gnunet-service-transport.c.
Referenced by client_disconnect_cb(), GST_blacklist_abort_matching(), GST_blacklist_test_allowed(), GST_blacklist_test_cancel(), handle_client_blacklist_reply(), and test_connection_ok().
|
static |
Tail of DLL of active blacklisting queries.
Definition at line 338 of file gnunet-service-transport.c.
Referenced by GST_blacklist_test_allowed(), GST_blacklist_test_cancel(), handle_client_blacklist_reply(), and test_connection_ok().
|
static |
Hashmap of blacklisted peers.
Values are of type 'char *' (transport names), can be NULL if we have no static blacklist.
Definition at line 344 of file gnunet-service-transport.c.
Referenced by GST_blacklist_add_peer(), GST_blacklist_test_allowed(), and shutdown_task().
|
static |
Notification context, to send updates on changes to active plugin connections.
Definition at line 350 of file gnunet-service-transport.c.
Referenced by handle_client_monitor_plugins(), plugin_session_info_cb(), run(), and shutdown_task().
|
static |
Plugin monitoring client we are currently syncing, NULL if all monitoring clients are in sync.
Definition at line 356 of file gnunet-service-transport.c.
Referenced by handle_client_monitor_plugins(), and plugin_session_info_cb().
|
static |
Peer identity that is all zeros, used as a way to indicate "all peers".
Used for comparisons.
Definition at line 356 of file gnunet-service-transport.c.
Referenced by GST_clients_broadcast_peer_notification(), handle_client_monitor_peers(), handle_client_start_search(), and mac_test().
struct GNUNET_STATISTICS_Handle* GST_stats |
Statistics handle.
Definition at line 367 of file gnunet-service-transport.c.
Referenced by ats_request_address_change(), confirm_or_drop_neighbour(), GST_blacklist_test_allowed(), handle_client_send(), plugin_env_address_change_notification(), run(), shutdown_task(), and unicast().
const struct GNUNET_CONFIGURATION_Handle* GST_cfg |
Configuration handle.
Definition at line 372 of file gnunet-service-transport.c.
Referenced by run().
struct GNUNET_PeerIdentity GST_my_identity |
Configuration handle.
Definition at line 372 of file gnunet-service-transport.c.
Referenced by handle_client_start(), run(), and transmit_our_hello().
struct GNUNET_PEERINFO_Handle* GST_peerinfo |
Handle to peerinfo service.
Definition at line 382 of file gnunet-service-transport.c.
Referenced by GST_validation_handle_pong(), refresh_hello_task(), run(), and shutdown_task().
struct GNUNET_CRYPTO_EddsaPrivateKey GST_my_private_key |
struct GNUNET_ATS_SchedulingHandle* GST_ats |
ATS scheduling handle.
ATS handle.
Definition at line 392 of file gnunet-service-transport.c.
Referenced by GST_ats_add_address(), GST_ats_add_inbound_address(), run(), shutdown_task(), and unblock_address().
struct GNUNET_ATS_ConnectivityHandle* GST_ats_connect |
ATS connectivity handle.
Definition at line 397 of file gnunet-service-transport.c.
Referenced by run(), setup_neighbour(), and shutdown_task().
struct GNUNET_TIME_Relative hello_expiration |
Hello address expiration.
Definition at line 397 of file gnunet-service-transport.c.
Referenced by refresh_hello_task(), run(), and transmit_our_hello().
|
static |
Head of DLL of asynchronous tasks to kill sessions.
Definition at line 407 of file gnunet-service-transport.c.
Referenced by kill_session(), kill_session_task(), and plugin_env_session_end().
|
static |
Tail of DLL of asynchronous tasks to kill sessions.
Definition at line 412 of file gnunet-service-transport.c.
Referenced by kill_session(), kill_session_task(), and plugin_env_session_end().
struct GNUNET_NT_InterfaceScanner* GST_is |
Interface scanner determines our LAN address range(s).
Definition at line 417 of file gnunet-service-transport.c.
Referenced by run(), and shutdown_task().