![]() |
GNUnet
0.11.x
|
Low-level communication with other peers. More...
Data Structures | |
struct | GNUNET_TRANSPORT_MonitorInformation |
Information about another peer's address. More... | |
struct | GNUNET_TRANSPORT_SessionInfo |
Information about a plugin's session. More... | |
Macros | |
#define | GNUNET_TRANSPORT_COMMUNICATION_VERSION 0x00000000 |
Version number of the transport communication API. More... | |
#define | GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED UINT64_MAX |
Queue length. More... | |
#define | GNUNET_TRANSPORT_CORE_VERSION 0x00000000 |
Version number of the transport API. More... | |
#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_MONITOR_VERSION 0x00000000 |
Version number of the transport API. More... | |
#define | GNUNET_TRANSPORT_VERSION 0x00000003 |
Version number of the transport API. More... | |
Typedefs | |
typedef int(* | GNUNET_TRANSPORT_CommunicatorMqInit) (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address) |
Function called by the transport service to initialize a message queue given address information about another peer. More... | |
typedef void(* | GNUNET_TRANSPORT_CommunicatorNotify) (void *cls, const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *msg) |
Function called when the transport service has received a backchannel message for this communicator (!) via a different return path. More... | |
typedef void(* | GNUNET_TRANSPORT_MessageCompletedCallback) (void *cls, int success) |
Function called to notify communicator that we have received and processed the message. 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_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_MonitorCallback) (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_TRANSPORT_MonitorInformation *mi) |
Function to call with information about a peer. 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... | |
Low-level communication with other peers.
Low-level P2P IO.
address information
Communication with other peers.
#define GNUNET_TRANSPORT_COMMUNICATION_VERSION 0x00000000 |
Version number of the transport communication API.
Definition at line 51 of file gnunet_transport_communication_service.h.
#define GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED UINT64_MAX |
Queue length.
Definition at line 56 of file gnunet_transport_communication_service.h.
Referenced by GNUNET_TRANSPORT_TESTING_transport_communicator_send(), setup_queue(), setup_receiver_mq(), and try_handle_plaintext().
#define GNUNET_TRANSPORT_CORE_VERSION 0x00000000 |
Version number of the transport API.
Definition at line 48 of file gnunet_transport_core_service.h.
#define GNUNET_TRANSPORT_HELLO_VERSION 0x00000000 |
Version number of the transport API.
Definition at line 52 of file gnunet_transport_hello_service.h.
#define GNUNET_TRANSPORT_MANIPULATION_VERSION 0x00000003 |
Version number of the transport API.
Definition at line 53 of file gnunet_transport_manipulation_service.h.
#define GNUNET_TRANSPORT_MONITOR_VERSION 0x00000000 |
Version number of the transport API.
Definition at line 53 of file gnunet_transport_monitor_service.h.
#define GNUNET_TRANSPORT_VERSION 0x00000003 |
Version number of the transport API.
Definition at line 51 of file gnunet_transport_service.h.
typedef int(* GNUNET_TRANSPORT_CommunicatorMqInit) (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address) |
Function called by the transport service to initialize a message queue given address information about another peer.
If and when the communication channel is established, the communicator must call GNUNET_TRANSPORT_communicator_mq_add() to notify the service that the channel is now up. It is the responsibility of the communicator to manage sane retries and timeouts for any peer/address combination provided by the transport service. Timeouts and retries do not need to be signalled to the transport service.
cls | closure |
peer | identity of the other peer |
address | where to send the message, human-readable communicator-specific format, 0-terminated, UTF-8 |
Definition at line 76 of file gnunet_transport_communication_service.h.
typedef void(* GNUNET_TRANSPORT_CommunicatorNotify) (void *cls, const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *msg) |
Function called when the transport service has received a backchannel message for this communicator (!) via a different return path.
Typically used to receive messages of type GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_FC_LIMITS or GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_KX_CONFIRMATION as well as communicator-specific messages to assist with NAT traversal.
cls | closure |
sender | which peer sent the notification |
msg | payload |
Definition at line 128 of file gnunet_transport_communication_service.h.
typedef void(* GNUNET_TRANSPORT_MessageCompletedCallback) (void *cls, int success) |
Function called to notify communicator that we have received and processed the message.
Used for flow control (if supported by the communicator).
cls | closure |
success | GNUNET_SYSERR on failure (try to disconnect/reset connection) GNUNET_OK on success |
Definition at line 184 of file gnunet_transport_communication_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 69 of file gnunet_transport_core_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 86 of file gnunet_transport_core_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 120 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 166 of file gnunet_transport_hello_service.h.
typedef void(* GNUNET_TRANSPORT_MonitorCallback) (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_TRANSPORT_MonitorInformation *mi) |
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 |
mi | monitoring data on the peer |
Definition at line 125 of file gnunet_transport_monitor_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 118 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 329 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 397 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 544 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 596 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 613 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 635 of file gnunet_transport_service.h.
What characteristics does this communicator have?
FIXME: may want to distinguish bi-directional as well, should we define a bit for that? Needed in DV logic (handle_dv_learn)!
Definition at line 94 of file gnunet_transport_communication_service.h.
Possible states of a connection.
Definition at line 230 of file gnunet_transport_communication_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 61 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 214 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 447 of file gnunet_transport_service.h.
struct GNUNET_TRANSPORT_CommunicatorHandle* GNUNET_TRANSPORT_communicator_connect | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | config_section, | ||
const char * | addr_prefix, | ||
enum GNUNET_TRANSPORT_CommunicatorCharacteristics | cc, | ||
GNUNET_TRANSPORT_CommunicatorMqInit | mq_init, | ||
void * | mq_init_cls, | ||
GNUNET_TRANSPORT_CommunicatorNotify | notify_cb, | ||
void * | notify_cb_cls | ||
) |
Connect to the transport service.
cfg | configuration to use |
config_section | section of the configuration to use for options |
addr_prefix | address prefix for addresses supported by this communicator, could be NULL for incoming-only communicators |
cc | what characteristics does the communicator have? |
mq_init | function to call to initialize a message queue given the address of another peer, can be NULL if the communicator only supports receiving messages |
mq_init_cls | closure for mq_init |
notify_cb | function to pass backchannel messages to communicator |
notify_cb_cls | closure for notify_cb |
cfg | configuration to use |
config_section | section of the configuration to use for options |
addr_prefix | address prefix for addresses supported by this communicator, could be NULL for incoming-only communicators |
cc | what characteristics does the communicator have? |
mtu | maximum message size supported by communicator, 0 if sending is not supported, SIZE_MAX for no MTU |
mq_init | function to call to initialize a message queue given the address of another peer, can be NULL if the communicator only supports receiving messages |
mq_init_cls | closure for mq_init |
notify_cb | function to pass backchannel messages to communicator |
notify_cb_cls | closure for notify_cb |
Definition at line 815 of file transport_api2_communication.c.
References GNUNET_TRANSPORT_CommunicatorHandle::addr_prefix, GNUNET_TRANSPORT_CommunicatorHandle::cc, cfg, GNUNET_TRANSPORT_CommunicatorHandle::cfg, ch, GNUNET_TRANSPORT_CommunicatorHandle::config_section, DEFAULT_MAX_QUEUE_LENGTH, GNUNET_CONFIGURATION_get_value_number(), GNUNET_free, GNUNET_new, GNUNET_OK, GNUNET_TRANSPORT_CommunicatorHandle::max_queue_length, GNUNET_TRANSPORT_CommunicatorHandle::mq, GNUNET_TRANSPORT_CommunicatorHandle::mq_init, mq_init(), GNUNET_TRANSPORT_CommunicatorHandle::mq_init_cls, GNUNET_TRANSPORT_CommunicatorHandle::notify_cb, GNUNET_TRANSPORT_CommunicatorHandle::notify_cb_cls, and reconnect().
Referenced by init_socket(), and run().
void GNUNET_TRANSPORT_communicator_disconnect | ( | struct GNUNET_TRANSPORT_CommunicatorHandle * | ch | ) |
Disconnect from the transport service.
ch | handle returned from connect |
Definition at line 858 of file transport_api2_communication.c.
References GNUNET_TRANSPORT_CommunicatorHandle::ai_head, disconnect(), GNUNET_break, GNUNET_free, and GNUNET_TRANSPORT_communicator_address_remove().
Referenced by do_shutdown().
int GNUNET_TRANSPORT_communicator_receive | ( | struct GNUNET_TRANSPORT_CommunicatorHandle * | ch, |
const struct GNUNET_PeerIdentity * | sender, | ||
const struct GNUNET_MessageHeader * | msg, | ||
struct GNUNET_TIME_Relative | expected_addr_validity, | ||
GNUNET_TRANSPORT_MessageCompletedCallback | cb, | ||
void * | cb_cls | ||
) |
Notify transport service that the communicator has received a message.
handle | connection to transport service |
sender | presumed sender of the message (details to be checked by higher layers) |
msg | the message |
expected_addr_validity | how long does the communicator believe it will continue to be able to receive messages from the same address on which it received this message? |
cb | function to call once handling the message is done, NULL if flow control is not supported by this communicator |
cb_cls | closure for cb |
ch | connection to transport service |
sender | presumed sender of the message (details to be checked by higher layers) |
msg | the message |
expected_addr_validity | how long does the communicator believe it will continue to be able to receive messages from the same address on which it received this message? |
cb | function to call once handling the message is done, NULL if flow control is not supported by this communicator |
cb_cls | closure for cb |
Definition at line 895 of file transport_api2_communication.c.
References FlowControl::cb, FlowControl::cb_cls, env, GNUNET_TRANSPORT_CommunicatorHandle::fc_gen, GNUNET_TRANSPORT_CommunicatorHandle::fc_head, GNUNET_TRANSPORT_CommunicatorHandle::fc_tail, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG, GNUNET_MQ_get_length(), GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_relative_hton(), GNUNET_YES, FlowControl::id, GNUNET_TRANSPORT_CommunicatorHandle::max_queue_length, GNUNET_TRANSPORT_CommunicatorHandle::mq, FlowControl::sender, and GNUNET_MessageHeader::size.
Referenced by pass_plaintext_to_core(), and select_read_cb().
struct GNUNET_TRANSPORT_QueueHandle* GNUNET_TRANSPORT_communicator_mq_add | ( | struct GNUNET_TRANSPORT_CommunicatorHandle * | ch, |
const struct GNUNET_PeerIdentity * | peer, | ||
const char * | address, | ||
uint32_t | mtu, | ||
uint64_t | q_len, | ||
uint32_t | priority, | ||
enum GNUNET_NetworkType | nt, | ||
enum GNUNET_TRANSPORT_ConnectionStatus | cs, | ||
struct GNUNET_MQ_Handle * | mq | ||
) |
Notify transport service that a MQ became available due to an "inbound" connection or because the communicator discovered the presence of another peer.
ch | connection to transport service |
peer | peer with which we can now communicate |
address | address in human-readable format, 0-terminated, UTF-8 |
mtu | maximum message size supported by queue, 0 if sending is not supported, SIZE_MAX for no MTU |
q_len | number of messages that can be send through this queue |
priority | queue priority. Queues with highest priority should be used |
nt | which network type does the address belong to? |
cs | what is the connection status of the queue? |
mq | message queue of the peer |
Notify transport service that a MQ became available due to an "inbound" connection or because the communicator discovered the presence of another peer.
ch | connection to transport service |
peer | peer with which we can now communicate |
address | address in human-readable format, 0-terminated, UTF-8 |
mtu | maximum message size supported by queue, 0 if sending is not supported, SIZE_MAX for no MTU |
q_len | number of messages that can be send through this queue |
priority | queue priority. Queues with highest priority should be used |
nt | which network type does the address belong to? |
cc | what characteristics does the communicator have? |
cs | what is the connection status of the queue? |
mq | message queue of the peer |
Definition at line 976 of file transport_api2_communication.c.
References GNUNET_TRANSPORT_QueueHandle::address, ch, GNUNET_TRANSPORT_QueueHandle::ch, GNUNET_TRANSPORT_QueueHandle::cs, GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_strdup, mq, GNUNET_TRANSPORT_QueueHandle::mq, GNUNET_TRANSPORT_QueueHandle::mtu, nt, GNUNET_TRANSPORT_QueueHandle::nt, peer, GNUNET_TRANSPORT_QueueHandle::peer, GNUNET_TRANSPORT_QueueHandle::priority, GNUNET_TRANSPORT_QueueHandle::q_len, GNUNET_TRANSPORT_CommunicatorHandle::queue_gen, GNUNET_TRANSPORT_CommunicatorHandle::queue_head, GNUNET_TRANSPORT_QueueHandle::queue_id, GNUNET_TRANSPORT_CommunicatorHandle::queue_tail, and send_add_queue().
Referenced by setup_queue(), setup_receiver_mq(), and try_handle_plaintext().
void GNUNET_TRANSPORT_communicator_mq_update | ( | struct GNUNET_TRANSPORT_CommunicatorHandle * | ch, |
const struct GNUNET_TRANSPORT_QueueHandle * | u_qh, | ||
uint64_t | q_len, | ||
uint32_t | priority | ||
) |
Notify transport service that an MQ was updated.
ch | connection to transport service |
qh | the queue to update |
q_len | number of messages that can be send through this queue |
priority | queue priority. Queues with highest priority should be used |
Definition at line 1016 of file transport_api2_communication.c.
References GNUNET_assert, GNUNET_TRANSPORT_QueueHandle::next, GNUNET_TRANSPORT_QueueHandle::priority, GNUNET_TRANSPORT_QueueHandle::q_len, GNUNET_TRANSPORT_CommunicatorHandle::queue_head, and send_update_queue().
Referenced by add_acks().
void GNUNET_TRANSPORT_communicator_mq_del | ( | struct GNUNET_TRANSPORT_QueueHandle * | qh | ) |
Notify transport service that an MQ became unavailable due to a disconnect or timeout.
qh | handle for the queue that must be invalidated |
Definition at line 1043 of file transport_api2_communication.c.
References GNUNET_TRANSPORT_QueueHandle::address, ch, GNUNET_TRANSPORT_QueueHandle::ch, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_TRANSPORT_QueueHandle::mq, GNUNET_TRANSPORT_CommunicatorHandle::queue_head, GNUNET_TRANSPORT_CommunicatorHandle::queue_tail, and send_del_queue().
Referenced by queue_destroy(), and receiver_destroy().
struct GNUNET_TRANSPORT_AddressIdentifier* GNUNET_TRANSPORT_communicator_address_add | ( | struct GNUNET_TRANSPORT_CommunicatorHandle * | ch, |
const char * | address, | ||
enum GNUNET_NetworkType | nt, | ||
struct GNUNET_TIME_Relative | expiration | ||
) |
Notify transport service about an address that this communicator provides for this peer.
ch | connection to transport service |
address | our address in human-readable format, 0-terminated, UTF-8 |
nt | which network type does the address belong to? |
expiration | when does the communicator forsee this address expiring? |
Definition at line 1065 of file transport_api2_communication.c.
References GNUNET_TRANSPORT_AddressIdentifier::address, ai, GNUNET_TRANSPORT_CommunicatorHandle::ai_head, GNUNET_TRANSPORT_CommunicatorHandle::ai_tail, GNUNET_TRANSPORT_AddressIdentifier::aid, GNUNET_TRANSPORT_CommunicatorHandle::aid_gen, ch, GNUNET_TRANSPORT_AddressIdentifier::ch, expiration, GNUNET_TRANSPORT_AddressIdentifier::expiration, GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_strdup, nt, GNUNET_TRANSPORT_AddressIdentifier::nt, and send_add_address().
Referenced by nat_address_cb(), and run().
void GNUNET_TRANSPORT_communicator_address_remove | ( | struct GNUNET_TRANSPORT_AddressIdentifier * | ai | ) |
Notify transport service about an address that this communicator no longer provides for this peer.
ai | address that is no longer provided |
Definition at line 1091 of file transport_api2_communication.c.
References GNUNET_TRANSPORT_AddressIdentifier::address, GNUNET_TRANSPORT_CommunicatorHandle::ai_head, GNUNET_TRANSPORT_CommunicatorHandle::ai_tail, ch, GNUNET_TRANSPORT_AddressIdentifier::ch, GNUNET_CONTAINER_DLL_remove, GNUNET_free, and send_del_address().
Referenced by do_shutdown(), GNUNET_TRANSPORT_communicator_address_remove_all(), GNUNET_TRANSPORT_communicator_disconnect(), and nat_address_cb().
void GNUNET_TRANSPORT_communicator_address_remove_all | ( | struct GNUNET_TRANSPORT_CommunicatorHandle * | ch | ) |
Notify transport service that this communicator no longer provides all its addresses for this peer.
ch | The communicator handle. |
Definition at line 1108 of file transport_api2_communication.c.
References ai, GNUNET_TRANSPORT_CommunicatorHandle::ai_head, GNUNET_TRANSPORT_communicator_address_remove(), and GNUNET_TRANSPORT_AddressIdentifier::next.
Referenced by do_shutdown().
void GNUNET_TRANSPORT_communicator_notify | ( | struct GNUNET_TRANSPORT_CommunicatorHandle * | ch, |
const struct GNUNET_PeerIdentity * | pid, | ||
const char * | comm, | ||
const struct GNUNET_MessageHeader * | header | ||
) |
The communicator asks the transport service to route a message via a different path to another communicator service at another peer.
This must only be done for special control traffic (as there is no flow control for this API), such as acknowledgements, and generally only be done if the communicator is uni-directional (i.e. cannot send the message back itself).
While backchannel messages are signed and encrypted, communicators must protect against replay attacks when using this backchannel communication!
ch | handle of this communicator |
pid | peer to send the message to |
comm | name of the communicator to send the message to |
header | header of the message to transmit and pass via the notify-API to pid's communicator comm |
This must only be done for special control traffic (as there is no flow control for this API), such as acknowledgements, and generally only be done if the communicator is uni-directional (i.e. cannot send the message back itself).
ch | handle of this communicator |
pid | peer to send the message to |
comm | name of the communicator to send the message to |
header | header of the message to transmit and pass via the notify-API to pid's communicator comm |
Definition at line 1135 of file transport_api2_communication.c.
References FlowControl::cb, env, GNUNET_assert, GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_TRANSPORT_CommunicatorHandle::mq, pid, and GNUNET_MessageHeader::size.
Referenced by consider_ss_ack().
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 | ||
) |
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 |
Referenced by GNUNET_TRANSPORT_core_get_mq(), GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_start_peer(), GSC_KX_init(), opstart_get_handle_transport(), run(), and transport_connect_adapter().
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.
References ch, disconnect_and_schedule_reconnect(), Neighbour::env, GNUNET_assert, GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_MESSAGE_TYPE_TRANSPORT_RECV_OK, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SCHEDULER_cancel(), GNUNET_TRANSPORT_CoreHandle::handlers, RecvOkMessage::increase_window_delta, LOG, GNUNET_TRANSPORT_CoreHandle::mq, GNUNET_TRANSPORT_CoreHandle::neighbours, RecvOkMessage::peer, Neighbour::pid, GNUNET_TRANSPORT_CoreHandle::reconnect_task, and GNUNET_TRANSPORT_CoreHandle::rom_pending.
Referenced by GNUNET_TRANSPORT_core_get_mq(), GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_stop_peer(), GSC_KX_done(), oprelease_get_handle_transport(), shutdown_task(), and transport_disconnect_adapter().
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 GNUNET_TRANSPORT_HelloGetHandle::ac, GNUNET_TRANSPORT_HelloGetHandle::cfg, ghh, 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 GNUNET_TRANSPORT_ManipulationHandle::cfg, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_new, h, LOG, GNUNET_TRANSPORT_ManipulationHandle::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(), and GNUNET_TRANSPORT_ManipulationHandle::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 TrafficMetricMessage::delay_in, TrafficMetricMessage::delay_out, env, GNUNET_ATS_properties_hton(), GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_TIME_relative_hton(), GNUNET_TRANSPORT_ManipulationHandle::mq, msg, peer, TrafficMetricMessage::peer, TrafficMetricMessage::properties, and TrafficMetricMessage::reserved.
Referenced by run().
struct GNUNET_TRANSPORT_MonitorContext* GNUNET_TRANSPORT_monitor | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const struct GNUNET_PeerIdentity * | peer, | ||
int | one_shot, | ||
GNUNET_TRANSPORT_MonitorCallback | cb, | ||
void * | cb_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 |
cb | function to call with the results |
cb_cls | closure for mc |
Definition at line 254 of file transport_api2_monitor.c.
References GNUNET_TRANSPORT_MonitorContext::cb, GNUNET_TRANSPORT_MonitorContext::cb_cls, GNUNET_TRANSPORT_MonitorContext::cfg, GNUNET_free, GNUNET_new, mc, GNUNET_TRANSPORT_MonitorContext::mq, GNUNET_TRANSPORT_MonitorContext::one_shot, GNUNET_TRANSPORT_MonitorContext::peer, and reconnect().
void GNUNET_TRANSPORT_monitor_cancel | ( | struct GNUNET_TRANSPORT_MonitorContext * | mc | ) |
Cancel request to monitor peers.
mc | handle for the request to cancel |
pmc | handle for the request to cancel |
Definition at line 285 of file transport_api2_monitor.c.
References disconnect(), and GNUNET_free.
Referenced by handle_monitor_end().
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 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, and GNUNET_TRANSPORT_OfferHelloHandle::mq.
Referenced by attempt_connect_task(), GCP_set_hello(), offer_hello(), send_hello(), and try_connect().
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 |
ohh | the handle for the operation to cancel |
Definition at line 134 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(), free_connect_info(), GCP_set_hello(), GNUNET_TRANSPORT_TESTING_connect_peers_cancel(), notify_connect(), offer_hello(), and try_connect().
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 GNUNET_HELLO_Address::address, GNUNET_HELLO_Address::address_length, AddressLookupMessage::addrlen, GNUNET_TRANSPORT_AddressToStringContext::cb, GNUNET_TRANSPORT_AddressToStringContext::cb_cls, 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(), GNUNET_TRANSPORT_AddressToStringContext::mq, mq_error_handler(), msg, AddressLookupMessage::numeric_only, GNUNET_HELLO_Address::peer, AddressLookupMessage::timeout, and GNUNET_HELLO_Address::transport_name.
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 do_peer_connect(), 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, and GNUNET_TRANSPORT_PS_SYN_SENT.
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, and GNUNET_YES.
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 |
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_address_callback |
Definition at line 419 of file transport_api_monitor_peers.c.
References GNUNET_TRANSPORT_PeerMonitoringContext::cb, GNUNET_TRANSPORT_PeerMonitoringContext::cb_cls, GNUNET_TRANSPORT_PeerMonitoringContext::cfg, do_peer_connect(), GNUNET_free, GNUNET_new, GNUNET_TRANSPORT_PeerMonitoringContext::mq, GNUNET_TRANSPORT_PeerMonitoringContext::one_shot, 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 451 of file transport_api_monitor_peers.c.
References GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_TRANSPORT_PeerMonitoringContext::mq, and GNUNET_TRANSPORT_PeerMonitoringContext::reconnect_task.
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, 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, 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, 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 GNUNET_MQ_MessageHandler::cb, cfg, GNUNET_TRANSPORT_CoreHandle::cfg, GNUNET_TRANSPORT_CoreHandle::check_self, 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, Neighbour::h, GNUNET_TRANSPORT_CoreHandle::handlers, LOG, GNUNET_TRANSPORT_CoreHandle::mq, nc, GNUNET_TRANSPORT_CoreHandle::nc_cb, GNUNET_TRANSPORT_CoreHandle::nd_cb, GNUNET_TRANSPORT_CoreHandle::neb_cb, GNUNET_TRANSPORT_CoreHandle::neighbours, reconnect(), GNUNET_TRANSPORT_CoreHandle::reconnect_delay, GNUNET_TRANSPORT_CoreHandle::self, and STARTING_NEIGHBOURS_SIZE.
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 666 of file transport_api2_core.c.
References GNUNET_MQ_MessageHandler::cb, cfg, GNUNET_TRANSPORT_CoreHandle::cfg, ch, GNUNET_TRANSPORT_CoreHandle::check_self, GNUNET_TRANSPORT_CoreHandle::cls, disconnect(), Neighbour::env, GNUNET_CONTAINER_multipeermap_create(), GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_i2s(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TRANSPORT_RECV_OK, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, GNUNET_new_array, GNUNET_SCHEDULER_cancel(), GNUNET_TIME_UNIT_ZERO, GNUNET_TRANSPORT_core_connect(), GNUNET_TRANSPORT_core_disconnect(), GNUNET_YES, Neighbour::h, handle, GNUNET_TRANSPORT_CoreHandle::handlers, handlers, RecvOkMessage::increase_window_delta, LOG, Neighbour::mq, GNUNET_TRANSPORT_CoreHandle::mq, nc, GNUNET_TRANSPORT_CoreHandle::nc_cb, GNUNET_TRANSPORT_CoreHandle::nd_cb, neighbour_find(), GNUNET_TRANSPORT_CoreHandle::neighbours, RecvOkMessage::peer, Neighbour::pid, reconnect(), GNUNET_TRANSPORT_CoreHandle::reconnect_delay, GNUNET_TRANSPORT_CoreHandle::reconnect_task, GNUNET_TRANSPORT_CoreHandle::self, and STARTING_NEIGHBOURS_SIZE.
Referenced by rocc_cache_get_handle_transport_cb().