address information More...
Data Structures | |
struct | GNUNET_TRANSPORT_SessionInfo |
Information about a plugin's session. More... | |
Macros | |
#define | GNUNET_TRANSPORT_HELLO_VERSION 0x00000000 |
Version number of the transport API. More... | |
#define | GNUNET_TRANSPORT_MANIPULATION_VERSION 0x00000003 |
Version number of the transport API. More... | |
#define | GNUNET_TRANSPORT_VERSION 0x00000003 |
Version number of the transport API. More... | |
Typedefs | |
typedef void(* | GNUNET_TRANSPORT_HelloUpdateCallback) (void *cls, const struct GNUNET_MessageHeader *hello) |
Function called whenever there is an update to the HELLO of this peer. More... | |
typedef void(* | GNUNET_TRANSPORT_AddressCallback) (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address, enum GNUNET_NetworkType nt, struct GNUNET_TIME_Absolute expiration) |
Function with addresses found in a HELLO. More... | |
typedef void(* | GNUNET_TRANSPORT_AddressToStringCallback) (void *cls, const char *address, int res) |
Function to call with a textual representation of an address. More... | |
typedef void(* | GNUNET_TRANSPORT_PeerIterateCallback) (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, enum GNUNET_TRANSPORT_PeerState state, struct GNUNET_TIME_Absolute state_timeout) |
Function to call with information about a peer. More... | |
typedef int(* | GNUNET_TRANSPORT_BlacklistCallback) (void *cls, const struct GNUNET_PeerIdentity *pid) |
Function that decides if a connection is acceptable or not. More... | |
typedef void(* | GNUNET_TRANSPORT_SessionMonitorCallback) (void *cls, struct GNUNET_TRANSPORT_PluginSession *session, void **session_ctx, const struct GNUNET_TRANSPORT_SessionInfo *info) |
Function called by the plugin with information about the current sessions managed by the plugin (for monitoring). More... | |
typedef void *(* | GNUNET_TRANSPORT_NotifyConnect) (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq) |
Function called to notify transport users that another peer connected to us. More... | |
typedef void(* | GNUNET_TRANSPORT_NotifyDisconnect) (void *cls, const struct GNUNET_PeerIdentity *peer, void *handler_cls) |
Function called to notify transport users that another peer disconnected from us. More... | |
typedef void(* | GNUNET_TRANSPORT_NotifyExcessBandwidth) (void *cls, const struct GNUNET_PeerIdentity *neighbour, void *handlers_cls) |
Function called if we have "excess" bandwidth to a peer. More... | |
address information
Low-level P2P IO.
#define GNUNET_TRANSPORT_HELLO_VERSION 0x00000000 |
Version number of the transport API.
Definition at line 56 of file gnunet_transport_hello_service.h.
#define GNUNET_TRANSPORT_MANIPULATION_VERSION 0x00000003 |
Version number of the transport API.
Definition at line 57 of file gnunet_transport_manipulation_service.h.
#define GNUNET_TRANSPORT_VERSION 0x00000003 |
Version number of the transport API.
Definition at line 55 of file gnunet_transport_service.h.
typedef void(* GNUNET_TRANSPORT_HelloUpdateCallback) (void *cls, const struct GNUNET_MessageHeader *hello) |
Function called whenever there is an update to the HELLO of this peer.
cls | closure |
hello | our updated HELLO |
Definition at line 124 of file gnunet_transport_hello_service.h.
typedef void(* GNUNET_TRANSPORT_AddressCallback) (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address, enum GNUNET_NetworkType nt, struct GNUNET_TIME_Absolute expiration) |
Function with addresses found in a HELLO.
cls | closure |
peer | identity of the peer |
address | the address (UTF-8, 0-terminated) |
nt | network type of the address |
expiration | when does this address expire? |
Definition at line 170 of file gnunet_transport_hello_service.h.
Function to call with a textual representation of an address.
This function will be called several times with different possible textual representations, and a last time with address being NULL to signal the end of the iteration. Note that address NULL always is the last call, regardless of the value in res.
cls | closure |
address | NULL on end of iteration, otherwise 0-terminated printable UTF-8 string, in particular an empty string if res is GNUNET_NO |
res | result of the address to string conversion: if GNUNET_OK: conversion successful if GNUNET_NO: address was invalid (or not supported) if GNUNET_SYSERR: communication error (IPC error) |
Definition at line 122 of file gnunet_transport_service.h.
typedef void(* GNUNET_TRANSPORT_PeerIterateCallback) (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, enum GNUNET_TRANSPORT_PeerState state, struct GNUNET_TIME_Absolute state_timeout) |
Function to call with information about a peer.
If one_shot was set to GNUNET_YES to iterate over all peers once, a final call with NULL for peer and address will follow when done. In this case state and timeout do not contain valid values.
The GNUNET_TRANSPORT_monitor_peers_cancel() call MUST not be called from within this function!
cls | closure |
peer | peer this update is about, NULL if this is the final last callback for a iteration operation |
address | address, NULL if this is the final callback for iteration op |
state | current state this peer is in |
state_timeout | timeout for the current state of the peer |
Definition at line 334 of file gnunet_transport_service.h.
typedef int(* GNUNET_TRANSPORT_BlacklistCallback) (void *cls, const struct GNUNET_PeerIdentity *pid) |
Function that decides if a connection is acceptable or not.
cls | closure |
pid | peer to approve or disapproave |
Definition at line 404 of file gnunet_transport_service.h.
typedef void(* GNUNET_TRANSPORT_SessionMonitorCallback) (void *cls, struct GNUNET_TRANSPORT_PluginSession *session, void **session_ctx, const struct GNUNET_TRANSPORT_SessionInfo *info) |
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) |
session_ctx | storage location where the application can store data; will point to NULL on GNUNET_TRANSPORT_SS_INIT, and must be reset to NULL on GNUNET_TRANSPORT_SS_DONE |
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; NULL with session being non-NULL if the monitor was being cancelled while sessions were active |
Definition at line 552 of file gnunet_transport_service.h.
typedef void*(* GNUNET_TRANSPORT_NotifyConnect) (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq) |
Function called to notify transport users that another peer connected to us.
cls | closure |
peer | the identity of the peer that connected; this pointer will remain valid until the disconnect, hence applications do not necessarily have to make a copy of the value if they only need it until disconnect |
mq | message queue to use to transmit to peer |
Definition at line 605 of file gnunet_transport_service.h.
typedef void(* GNUNET_TRANSPORT_NotifyDisconnect) (void *cls, const struct GNUNET_PeerIdentity *peer, void *handler_cls) |
Function called to notify transport users that another peer disconnected from us.
The message queue that was given to the connect notification will be destroyed and must not be used henceforth.
cls | closure from GNUNET_TRANSPORT_core_connect |
peer | the peer that disconnected |
handlers_cls | closure of the handlers, was returned from the connect notification callback |
Definition at line 623 of file gnunet_transport_service.h.
typedef void(* GNUNET_TRANSPORT_NotifyExcessBandwidth) (void *cls, const struct GNUNET_PeerIdentity *neighbour, void *handlers_cls) |
Function called if we have "excess" bandwidth to a peer.
The notification will happen the first time we have excess bandwidth, and then only again after the client has performed some transmission to the peer.
Excess bandwidth is defined as being allowed (by ATS) to send more data, and us reaching the limit of the capacity build-up (which, if we go past it, means we don't use available bandwidth). See also the "max carry" in struct GNUNET_BANDWIDTH_Tracker
.
cls | the closure |
neighbour | peer that we have excess bandwidth to |
handlers_cls | closure of the handlers, was returned from the connect notification callback |
Definition at line 646 of file gnunet_transport_service.h.
Some addresses contain sensitive information or are not suitable for global distribution.
We use address classes to filter addresses by which domain they make sense to be used in. These are used in a bitmask.
Enumerator | |
---|---|
GNUNET_TRANSPORT_AC_NONE | No address. |
GNUNET_TRANSPORT_AC_OTHER | Addresses that fall into no other category (i.e. incoming which we cannot use elsewhere). |
GNUNET_TRANSPORT_AC_GLOBAL | Addresses that are global and are insensitive (i.e. IPv4). |
GNUNET_TRANSPORT_AC_GLOBAL_PRIVATE | Addresses that are global and are sensitive (i.e. IPv6 with our MAC). |
GNUNET_TRANSPORT_AC_LAN | Addresses useful in the local wired network, i.e. a MAC. Sensitive, but obvious to people nearby. Useful for broadcasts. |
GNUNET_TRANSPORT_AC_WLAN | Addresses useful in the local wireless network, i.e. a MAC. Sensitive, but obvious to people nearby. Useful for broadcasts. |
GNUNET_TRANSPORT_AC_BT | Addresses useful in the local bluetooth network. Sensitive, but obvious to people nearby. Useful for broadcasts. |
GNUNET_TRANSPORT_AC_ANY | Bitmask for "any" address. |
Definition at line 65 of file gnunet_transport_hello_service.h.
Possible state of a neighbour.
Initially, we are GNUNET_TRANSPORT_PS_NOT_CONNECTED.
Then, there are two main paths. If we receive a SYN message, we give the inbound address to ATS. After the check we ask ATS for a suggestion (#GNUNET_TRANSPORT_PS_CONNECT_RECV_ATS). If ATS makes a suggestion, we send our SYN_ACK and go to #GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK. If we receive a ACK, we go to GNUNET_TRANSPORT_PS_CONNECTED (and notify everyone about the new connection). If the operation times out, we go to GNUNET_TRANSPORT_PS_DISCONNECT.
The other case is where we transmit a SYN message first. We start with GNUNET_TRANSPORT_PS_INIT_ATS. If we get an address, we send the SYN message and go to state #GNUNET_TRANSPORT_PS_CONNECT_SENT. Once we receive a SYN_ACK, we go to GNUNET_TRANSPORT_PS_CONNECTED (and notify everyone about the new connection and send back a ACK). If the operation times out, we go to GNUNET_TRANSPORT_PS_DISCONNECT.
If the session is in trouble (i.e. transport-level disconnect or timeout), we go to GNUNET_TRANSPORT_PS_RECONNECT_ATS where we ask ATS for a new address (we don't notify anyone about the disconnect yet). Once we have a new address, we enter GNUNET_TRANSPORT_PS_RECONNECT_SENT and send a SYN message. If we receive a SYN_ACK, we go to GNUNET_TRANSPORT_PS_CONNECTED and nobody noticed that we had trouble; we also send a ACK at this time just in case. If the operation times out, we go to GNUNET_TRANSPORT_PS_DISCONNECT (and notify everyone about the lost connection).
If ATS decides to switch addresses while we have a normal connection, we go to #GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_SYN_SENT and send a SESSION_CONNECT. If we get a ACK back, we switch the primary connection to the suggested alternative from ATS, go back to GNUNET_TRANSPORT_PS_CONNECTED and send a ACK to the other peer just to be sure. If the operation times out we go to GNUNET_TRANSPORT_PS_CONNECTED (and notify ATS that the given alternative address is "invalid").
Once a session is in GNUNET_TRANSPORT_PS_DISCONNECT, it is cleaned up and then goes to (GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED). If we receive an explicit disconnect request, we can go from any state to GNUNET_TRANSPORT_PS_DISCONNECT, possibly after generating disconnect notifications.
Note that it is quite possible that while we are in any of these states, we could receive a 'SYN' request from the other peer. We then enter a 'weird' state where we pursue our own primary state machine (as described above), but with the 'send_connect_ack' flag set to 1. If our state machine allows us to send a 'SYN_ACK' (because we have an acceptable address), we send the 'SYN_ACK' and set the 'send_connect_ack' to 2. If we then receive a 'ACK', we go to GNUNET_TRANSPORT_PS_CONNECTED (and reset 'send_connect_ack' to 0).
Enumerator | |
---|---|
GNUNET_TRANSPORT_PS_NOT_CONNECTED | Fresh peer or completely disconnected. |
GNUNET_TRANSPORT_PS_INIT_ATS | Asked to initiate connection, trying to get address from ATS. |
GNUNET_TRANSPORT_PS_SYN_SENT | Sent SYN message to other peer, waiting for SYN_ACK. |
GNUNET_TRANSPORT_PS_SYN_RECV_ATS | Received a SYN, asking ATS about address suggestions. |
GNUNET_TRANSPORT_PS_SYN_RECV_ACK | SYN request from other peer was SYN_ACK'ed, waiting for ACK. |
GNUNET_TRANSPORT_PS_CONNECTED | Got our SYN_ACK/ACK, connection is up. |
GNUNET_TRANSPORT_PS_RECONNECT_ATS | Connection got into trouble, rest of the system still believes it to be up, but we're getting a new address from ATS. |
GNUNET_TRANSPORT_PS_RECONNECT_SENT | Sent SYN over new address (either by ATS telling us to switch addresses or from RECONNECT_ATS); if this fails, we need to tell the rest of the system about a disconnect. |
GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT | We have some primary connection, but ATS suggested we switch to some alternative; we now sent a SYN message for the alternative session to the other peer and waiting for a SYN_ACK to make this our primary connection. |
GNUNET_TRANSPORT_PS_DISCONNECT | Disconnect in progress (we're sending the DISCONNECT message to the other peer; after that is finished, the state will be cleaned up). |
GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED | We're finished with the disconnect; and are cleaning up the state now! We put the struct into this state when we are really in the task that calls 'free' on it and are about to remove the record from the map. We should never find a 'struct NeighbourMapEntry' in this state in the map. Accessing a 'struct NeighbourMapEntry' in this state virtually always means using memory that has been freed (the exception being the cleanup code in free_neighbour()). |
Definition at line 219 of file gnunet_transport_service.h.
Possible states of a session in a plugin.
Enumerator | |
---|---|
GNUNET_TRANSPORT_SS_INIT | The session was created (first call for each session object). |
GNUNET_TRANSPORT_SS_HANDSHAKE | Initial session handshake is in progress. |
GNUNET_TRANSPORT_SS_UP | Session is fully UP. |
GNUNET_TRANSPORT_SS_UPDATE | This is just an update about the session, the state did not change. |
GNUNET_TRANSPORT_SS_DONE | Session is being torn down and about to disappear. Last call for each session object. |
Definition at line 455 of file gnunet_transport_service.h.
struct GNUNET_TRANSPORT_HelloGetHandle* GNUNET_TRANSPORT_hello_get | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
enum GNUNET_TRANSPORT_AddressClass | ac, | ||
GNUNET_TRANSPORT_HelloUpdateCallback | rec, | ||
void * | rec_cls | ||
) |
Obtain updates on changes to the HELLO message for this peer.
The callback given in this function is never called synchronously.
cfg | configuration to use |
ac | which network type should the addresses from the HELLO belong to? |
rec | function to call with the HELLO |
rec_cls | closure for rec |
Obtain updates on changes to the HELLO message for this peer.
The callback given in this function is never called synchronously.
cfg | configuration |
ac | which network type should the addresses from the HELLO belong to? |
rec | function to call with the HELLO, sender will be our peer identity; message and sender will be NULL on timeout (handshake with transport service pending/failed). cost estimate will be 0. |
rec_cls | closure for rec |
Definition at line 230 of file transport_api_hello_get.c.
References ac, GNUNET_TRANSPORT_HelloGetHandle::ac, cfg, GNUNET_TRANSPORT_HelloGetHandle::cfg, GNUNET_free, GNUNET_new, GNUNET_TRANSPORT_HelloGetHandle::mq, GNUNET_TRANSPORT_HelloGetHandle::rec, GNUNET_TRANSPORT_HelloGetHandle::rec_cls, and reconnect().
Referenced by GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_start_peer(), p1_transport_connect_cache_callback(), and run().
void GNUNET_TRANSPORT_hello_get_cancel | ( | struct GNUNET_TRANSPORT_HelloGetHandle * | ghh | ) |
Stop receiving updates about changes to our HELLO message.
ghh | handle to cancel |
Definition at line 258 of file transport_api_hello_get.c.
References GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_TRANSPORT_HelloGetHandle::mq, and GNUNET_TRANSPORT_HelloGetHandle::reconnect_task.
Referenced by cleanup_occ(), GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_stop_peer(), hello_callback(), hello_update_cb(), and shutdown_task().
int GNUNET_TRANSPORT_hello_parse | ( | const struct GNUNET_MessageHeader * | hello, |
GNUNET_TRANSPORT_AddressCallback | cb, | ||
void * | cb_cls | ||
) |
Parse a HELLO message that we have received into its constituent addresses.
hello | message to parse |
cb | function to call on each address found |
cb_cls | closure for cb |
struct GNUNET_TRANSPORT_ManipulationHandle* GNUNET_TRANSPORT_manipulation_connect | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Connect to the transport service.
Note that the connection may complete (or fail) asynchronously.
cfg | configuration to use |
Definition at line 208 of file transport_api_manipulation.c.
References cfg, GNUNET_ARM_Handle::cfg, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_new, h, LOG, GNUNET_ARM_Handle::mq, and reconnect().
Referenced by GNUNET_TRANSPORT_TESTING_start_peer(), and run().
void GNUNET_TRANSPORT_manipulation_disconnect | ( | struct GNUNET_TRANSPORT_ManipulationHandle * | handle | ) |
Disconnect from the transport service.
handle | handle returned from connect |
handle | handle to the service as returned from GNUNET_TRANSPORT_manipulation_connect() |
Definition at line 233 of file transport_api_manipulation.c.
References disconnect_and_schedule_reconnect(), GNUNET_free, GNUNET_SCHEDULER_cancel(), handle, and GNUNET_DNS_Handle::reconnect_task.
Referenced by do_shutdown(), GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_stop_peer(), and run().
void GNUNET_TRANSPORT_manipulation_set | ( | struct GNUNET_TRANSPORT_ManipulationHandle * | handle, |
const struct GNUNET_PeerIdentity * | peer, | ||
const struct GNUNET_ATS_Properties * | prop, | ||
struct GNUNET_TIME_Relative | delay_in, | ||
struct GNUNET_TIME_Relative | delay_out | ||
) |
Set transport metrics for a peer and a direction.
handle | transport handle |
peer | the peer to set the metric for |
prop | the performance metrics to set |
delay_in | inbound delay to introduce |
delay_out | outbound delay to introduce |
Note: Delay restrictions in receiving direction will be enforced with one message delay.
Definition at line 175 of file transport_api_manipulation.c.
References delay_in, delay_out, env, GNUNET_ATS_properties_hton(), GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_TIME_relative_hton(), handle, GNUNET_DNS_Handle::mq, msg, and peer.
Referenced by run().
struct GNUNET_TRANSPORT_OfferHelloHandle* GNUNET_TRANSPORT_offer_hello | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const struct GNUNET_MessageHeader * | hello, | ||
GNUNET_SCHEDULER_TaskCallback | cont, | ||
void * | cont_cls | ||
) |
Offer the transport service the HELLO of another peer.
Note that the transport service may just ignore this message if the HELLO is malformed or useless due to our local configuration.
cfg | configuration |
hello | the hello message |
cont | continuation to call when HELLO has been sent, tc reason GNUNET_SCHEDULER_REASON_TIMEOUT for fail tc reasong GNUNET_SCHEDULER_REASON_READ_READY for success |
cont_cls | closure for cont |
struct GNUNET_TRANSPORT_OfferHelloHandle
handle or NULL on failure, in case of failure cont will not be called Definition at line 87 of file transport_api_offer_hello.c.
References cfg, GNUNET_TRANSPORT_OfferHelloHandle::cls, GNUNET_TRANSPORT_OfferHelloHandle::cont, env, finished_hello(), GNUNET_break, GNUNET_CLIENT_connect(), GNUNET_free, GNUNET_HELLO_get_id(), GNUNET_MESSAGE_TYPE_HELLO, GNUNET_MQ_msg_copy(), GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), GNUNET_new, GNUNET_OK, GNUNET_TRANSPORT_OfferHelloHandle::mq, peer, and GNUNET_MessageHeader::type.
Referenced by attempt_connect_task(), GCP_set_hello(), gnunet_try_connect(), offer_hello(), and send_hello().
void GNUNET_TRANSPORT_offer_hello_cancel | ( | struct GNUNET_TRANSPORT_OfferHelloHandle * | ohh | ) |
Cancel the request to transport to offer the HELLO message.
ohh | the struct GNUNET_TRANSPORT_OfferHelloHandle to cancel |
Definition at line 129 of file transport_api_offer_hello.c.
References GNUNET_free, GNUNET_MQ_destroy(), and GNUNET_TRANSPORT_OfferHelloHandle::mq.
Referenced by cleaning_task(), cleanup_occ_lp2c(), cleanup_rocc(), destroy_peer(), finished_hello(), GCP_set_hello(), GNUNET_TRANSPORT_TESTING_connect_peers_cancel(), libgnunet_plugin_dhtu_gnunet_done(), notify_connect(), and offer_hello().
struct GNUNET_TRANSPORT_AddressToStringContext* GNUNET_TRANSPORT_address_to_string | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const struct GNUNET_HELLO_Address * | address, | ||
int | numeric, | ||
struct GNUNET_TIME_Relative | timeout, | ||
GNUNET_TRANSPORT_AddressToStringCallback | aluc, | ||
void * | aluc_cls | ||
) |
Convert a binary address into a human readable address.
cfg | configuration to use |
address | address to convert (binary format) |
numeric | should (IP) addresses be displayed in numeric form (otherwise do reverse DNS lookup) |
timeout | how long is the lookup allowed to take at most |
aluc | function to call with the results |
aluc_cls | closure for aluc |
Definition at line 177 of file transport_api_address_to_string.c.
References address, GNUNET_TRANSPORT_AddressToStringContext::cb, GNUNET_TRANSPORT_AddressToStringContext::cb_cls, cfg, env, GNUNET_break, GNUNET_CLIENT_connect(), GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING, GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_TIME_relative_hton(), handlers, GNUNET_TRANSPORT_AddressToStringContext::mq, mq_error_handler(), msg, numeric, and timeout.
Referenced by ats_perf_cb(), ats_perf_mon_cb(), plugin_monitoring_cb(), print_address(), and resolve_peer_address().
void GNUNET_TRANSPORT_address_to_string_cancel | ( | struct GNUNET_TRANSPORT_AddressToStringContext * | alc | ) |
Cancel request for address conversion.
alc | the context handle |
Definition at line 255 of file transport_api_address_to_string.c.
References GNUNET_free, GNUNET_MQ_destroy(), and GNUNET_TRANSPORT_AddressToStringContext::mq.
Referenced by ats_perf_mon_cb(), end(), handle_reply(), mq_error_handler(), operation_timeout(), plugin_monitoring_cb(), and shutdown_task().
const char* GNUNET_TRANSPORT_ps2s | ( | enum GNUNET_TRANSPORT_PeerState | state | ) |
Convert a transport state to a human readable string.
state | the state |
Convert a transport state to a human readable string.
state | the state value |
Definition at line 132 of file transport_api_monitor_peers.c.
References GNUNET_break, GNUNET_TRANSPORT_PS_CONNECTED, GNUNET_TRANSPORT_PS_DISCONNECT, GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED, GNUNET_TRANSPORT_PS_INIT_ATS, GNUNET_TRANSPORT_PS_NOT_CONNECTED, GNUNET_TRANSPORT_PS_RECONNECT_ATS, GNUNET_TRANSPORT_PS_RECONNECT_SENT, GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT, GNUNET_TRANSPORT_PS_SYN_RECV_ACK, GNUNET_TRANSPORT_PS_SYN_RECV_ATS, GNUNET_TRANSPORT_PS_SYN_SENT, and state.
Referenced by disconnect_neighbour(), GNUNET_TRANSPORT_is_connected(), GST_neighbours_handle_session_ack(), GST_neighbours_handle_session_syn(), GST_neighbours_handle_session_syn_ack(), GST_neighbours_session_terminated(), master_task(), neighbours_changed_notification(), print_info(), send_peer_information(), set_state_and_timeout(), and switch_address_bl_check_cont().
int GNUNET_TRANSPORT_is_connected | ( | enum GNUNET_TRANSPORT_PeerState | state | ) |
Check if a state is defined as connected.
state | the state value |
Definition at line 93 of file transport_api_monitor_peers.c.
References GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_NO, GNUNET_SYSERR, GNUNET_TRANSPORT_ps2s(), GNUNET_TRANSPORT_PS_CONNECTED, GNUNET_TRANSPORT_PS_DISCONNECT, GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED, GNUNET_TRANSPORT_PS_INIT_ATS, GNUNET_TRANSPORT_PS_NOT_CONNECTED, GNUNET_TRANSPORT_PS_RECONNECT_ATS, GNUNET_TRANSPORT_PS_RECONNECT_SENT, GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT, GNUNET_TRANSPORT_PS_SYN_RECV_ACK, GNUNET_TRANSPORT_PS_SYN_RECV_ATS, GNUNET_TRANSPORT_PS_SYN_SENT, GNUNET_YES, and state.
Referenced by print_info(), process_peer_iteration_cb(), send_outbound_quota_to_clients(), set_state_and_timeout(), and test_connected().
struct GNUNET_TRANSPORT_PeerMonitoringContext* GNUNET_TRANSPORT_monitor_peers | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const struct GNUNET_PeerIdentity * | peer, | ||
int | one_shot, | ||
GNUNET_TRANSPORT_PeerIterateCallback | peer_callback, | ||
void * | peer_callback_cls | ||
) |
Return information about a specific peer or all peers currently known to transport service once or in monitoring mode.
To obtain information about a specific peer, a peer identity can be passed. To obtain information about all peers currently known to transport service, NULL can be passed as peer identity.
For each peer, the callback is called with information about the address used to communicate with this peer, the state this peer is currently in and the the current timeout for this state.
Upon completion, the GNUNET_TRANSPORT_PeerIterateCallback is called one more time with NULL
. After this, the operation must no longer be explicitly canceled.
The GNUNET_TRANSPORT_monitor_peers_cancel call MUST not be called in the the peer_callback!
cfg | configuration to use |
peer | a specific peer identity to obtain information for, NULL for all peers |
one_shot | GNUNET_YES to return the current state and then end (with NULL+NULL), GNUNET_NO to monitor peers continuously |
peer_callback | function to call with the results |
peer_callback_cls | closure for peer_callback |
Definition at line 393 of file transport_api_monitor_peers.c.
References GNUNET_TRANSPORT_PeerMonitoringContext::cb, GNUNET_TRANSPORT_PeerMonitoringContext::cb_cls, cfg, GNUNET_TRANSPORT_PeerMonitoringContext::cfg, do_peer_connect(), GNUNET_free, GNUNET_new, GNUNET_TRANSPORT_PeerMonitoringContext::mq, GNUNET_TRANSPORT_PeerMonitoringContext::one_shot, peer, and GNUNET_TRANSPORT_PeerMonitoringContext::peer.
Referenced by run().
void GNUNET_TRANSPORT_monitor_peers_cancel | ( | struct GNUNET_TRANSPORT_PeerMonitoringContext * | pic | ) |
Cancel request to monitor peers.
pic | handle for the request to cancel |
Definition at line 425 of file transport_api_monitor_peers.c.
References GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), and pic.
Referenced by handle_response_end(), mq_error_handler(), and shutdown_task().
struct GNUNET_TRANSPORT_Blacklist* GNUNET_TRANSPORT_blacklist | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
GNUNET_TRANSPORT_BlacklistCallback | cb, | ||
void * | cb_cls | ||
) |
Install a blacklist callback.
The service will be queried for all existing connections as well as any fresh connections to check if they are permitted. If the blacklisting callback is unregistered, all hosts that were denied in the past will automatically be whitelisted again. Cancelling the blacklist handle is also the only way to re-enable connections from peers that were previously blacklisted.
cfg | configuration to use |
cb | callback to invoke to check if connections are allowed |
cb_cls | closure for cb |
Definition at line 163 of file transport_api_blacklist.c.
References GNUNET_TRANSPORT_Blacklist::cb, GNUNET_TRANSPORT_Blacklist::cb_cls, cfg, GNUNET_TRANSPORT_Blacklist::cfg, GNUNET_free, GNUNET_new, GNUNET_TRANSPORT_Blacklist::mq, and reconnect().
Referenced by disconnect_notify(), run(), and setup_ac().
void GNUNET_TRANSPORT_blacklist_cancel | ( | struct GNUNET_TRANSPORT_Blacklist * | br | ) |
Abort the blacklist.
Note that this function is the only way for removing a peer from the blacklist.
br | handle of the request that is to be cancelled |
Definition at line 190 of file transport_api_blacklist.c.
References GNUNET_free, GNUNET_MQ_destroy(), and GNUNET_TRANSPORT_Blacklist::mq.
Referenced by do_shutdown(), shutdown_task(), and whitelist_peers().
struct GNUNET_TRANSPORT_PluginMonitor* GNUNET_TRANSPORT_monitor_plugins | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
GNUNET_TRANSPORT_SessionMonitorCallback | cb, | ||
void * | cb_cls | ||
) |
Install a plugin session state monitor callback.
The callback will be notified whenever the session changes.
cfg | configuration to use |
cb | callback to invoke on events |
cb_cls | closure for cb |
Definition at line 412 of file transport_api_monitor_plugins.c.
References GNUNET_TRANSPORT_PluginMonitor::cb, GNUNET_TRANSPORT_PluginMonitor::cb_cls, cfg, GNUNET_TRANSPORT_PluginMonitor::cfg, do_plugin_connect(), GNUNET_CONTAINER_multihashmap32_create(), GNUNET_free, GNUNET_new, GNUNET_TRANSPORT_PluginMonitor::mq, pm, and GNUNET_TRANSPORT_PluginMonitor::sessions.
Referenced by run().
void GNUNET_TRANSPORT_monitor_plugins_cancel | ( | struct GNUNET_TRANSPORT_PluginMonitor * | pm | ) |
Cancel monitoring the plugin session state.
The callback will be called once for each session that is up with the "info" argument being NULL (this is just to enable client-side cleanup).
pm | handle of the request that is to be cancelled |
The callback will be called once for each session that is up with the information #GNUNET_TRANSPORT_SS_FINI (even though the session may stay up; this is just to enable client-side cleanup).
pm | handle of the request that is to be cancelled |
Definition at line 442 of file transport_api_monitor_plugins.c.
References free_entry(), GNUNET_CONTAINER_multihashmap32_destroy(), GNUNET_CONTAINER_multihashmap32_iterate(), GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_TRANSPORT_PluginMonitor::mq, pm, GNUNET_TRANSPORT_PluginMonitor::reconnect_task, and GNUNET_TRANSPORT_PluginMonitor::sessions.
Referenced by shutdown_task().
struct GNUNET_TRANSPORT_CoreHandle* GNUNET_TRANSPORT_core_connect | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const struct GNUNET_PeerIdentity * | self, | ||
const struct GNUNET_MQ_MessageHandler * | handlers, | ||
void * | cls, | ||
GNUNET_TRANSPORT_NotifyConnect | nc, | ||
GNUNET_TRANSPORT_NotifyDisconnect | nd, | ||
GNUNET_TRANSPORT_NotifyExcessBandwidth | neb | ||
) |
Connect to the transport service.
Note that the connection may complete (or fail) asynchronously.
cfg | configuration to use |
self | our own identity (API should check that it matches the identity found by transport), or NULL (no check) |
handlers | array of message handlers; note that the closures provided will be ignored and replaced with the respective return value from nc |
handlers | array with handlers to call when we receive messages, or NULL |
cls | closure for the nc, nd and neb callbacks |
nc | function to call on connect events, or NULL |
nd | function to call on disconnect events, or NULL |
neb | function to call if we have excess bandwidth to a peer, or NULL |
Note that the connection may complete (or fail) asynchronously.
cfg | configuration to use |
self | our own identity (API should check that it matches the identity found by transport), or NULL (no check) |
cls | closure for the callbacks |
rec | receive function to call |
nc | function to call on connect events |
nd | function to call on disconnect events |
neb | function to call if we have excess bandwidth to a peer |
Definition at line 859 of file transport_api_core.c.
References cfg, GNUNET_ARM_Handle::cfg, GNUNET_TRANSPORT_CoreHandle::cls, GNUNET_CONTAINER_multipeermap_create(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_memcpy, GNUNET_new, GNUNET_new_array, GNUNET_TIME_UNIT_ZERO, GNUNET_YES, h, handlers, LOG, GNUNET_ARM_Handle::mq, nc, reconnect(), and STARTING_NEIGHBOURS_SIZE.
void GNUNET_TRANSPORT_core_disconnect | ( | struct GNUNET_TRANSPORT_CoreHandle * | handle | ) |
Disconnect from the transport service.
handle | handle returned from connect |
handle | handle to the service as returned from GNUNET_TRANSPORT_core_connect() |
Definition at line 912 of file transport_api_core.c.
struct GNUNET_MQ_Handle* GNUNET_TRANSPORT_core_get_mq | ( | struct GNUNET_TRANSPORT_CoreHandle * | handle, |
const struct GNUNET_PeerIdentity * | peer | ||
) |
Checks if a given peer is connected to us and get the message queue.
handle | connection to transport service |
peer | the peer to check |
Definition at line 687 of file transport_api2_core.c.
References handle, Neighbour::mq, neighbour_find(), and peer.
Referenced by rocc_cache_get_handle_transport_cb().