Low-level communication with other peers. More...
Data Structures | |
struct | GNUNET_TRANSPORT_MonitorInformation |
Information about another peer's address. 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_MONITOR_VERSION 0x00000000 |
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_StartBurstNotify) (const char *address, struct GNUNET_TIME_Relative rtt, struct GNUNET_PeerIdentity *peer) |
Function to start burst, if request by transport service. 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_MonitorCallback) (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_TRANSPORT_MonitorInformation *mi) |
Function to call with information about a peer. More... | |
Enumerations | |
enum | GNUNET_TRANSPORT_CommunicatorCharacteristics { GNUNET_TRANSPORT_CC_UNKNOWN = 0 , GNUNET_TRANSPORT_CC_RELIABLE = 1 , GNUNET_TRANSPORT_CC_UNRELIABLE = 2 } |
What characteristics does this communicator have? More... | |
enum | GNUNET_TRANSPORT_ConnectionStatus { GNUNET_TRANSPORT_CS_DOWN = -1 , GNUNET_TRANSPORT_CS_OUTBOUND = 0 , GNUNET_TRANSPORT_CS_INBOUND = 1 } |
Possible states of a connection. More... | |
Functions | |
struct GNUNET_TRANSPORT_ApplicationHandle * | GNUNET_TRANSPORT_application_init (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Initialize the TRANSPORT application client handle. More... | |
void | GNUNET_TRANSPORT_application_done (struct GNUNET_TRANSPORT_ApplicationHandle *ch) |
Shutdown TRANSPORT application client. More... | |
struct GNUNET_TRANSPORT_ApplicationSuggestHandle * | GNUNET_TRANSPORT_application_suggest (struct GNUNET_TRANSPORT_ApplicationHandle *ch, const struct GNUNET_PeerIdentity *peer, enum GNUNET_MQ_PriorityPreferences pk, struct GNUNET_BANDWIDTH_Value32NBO bw) |
An application would like TRANSPORT to connect to a peer. More... | |
void | GNUNET_TRANSPORT_application_suggest_cancel (struct GNUNET_TRANSPORT_ApplicationSuggestHandle *sh) |
We no longer care about being connected to a peer. More... | |
void | GNUNET_TRANSPORT_application_validate (struct GNUNET_TRANSPORT_ApplicationHandle *ch, const struct GNUNET_PeerIdentity *peer, enum GNUNET_NetworkType nt, const char *addr) |
An application (or a communicator) has received a HELLO (or other address data of another peer) and wants TRANSPORT to validate that the address is correct. More... | |
struct GNUNET_TRANSPORT_CommunicatorHandle * | GNUNET_TRANSPORT_communicator_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *config_section_name, 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, GNUNET_TRANSPORT_StartBurstNotify sb) |
Connect to the transport service. More... | |
void | GNUNET_TRANSPORT_communicator_disconnect (struct GNUNET_TRANSPORT_CommunicatorHandle *ch) |
Disconnect from the transport service. More... | |
int | GNUNET_TRANSPORT_communicator_receive (struct GNUNET_TRANSPORT_CommunicatorHandle *handle, 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. More... | |
void | GNUNET_TRANSPORT_communicator_burst_finished (struct GNUNET_TRANSPORT_CommunicatorHandle *ch) |
The communicator tells the transport service that it finished the burst. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | GNUNET_TRANSPORT_core_disconnect (struct GNUNET_TRANSPORT_CoreHandle *handle) |
Disconnect from the transport service. More... | |
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. More... | |
void | GNUNET_TRANSPORT_monitor_cancel (struct GNUNET_TRANSPORT_MonitorContext *mc) |
Cancel request to monitor peers. More... | |
Low-level communication with other peers.
Communication with other peers.
#define GNUNET_TRANSPORT_COMMUNICATION_VERSION 0x00000000 |
Version number of the transport communication API.
Definition at line 54 of file gnunet_transport_communication_service.h.
#define GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED UINT64_MAX |
Queue length.
Definition at line 59 of file gnunet_transport_communication_service.h.
#define GNUNET_TRANSPORT_CORE_VERSION 0x00000000 |
Version number of the transport API.
Definition at line 52 of file gnunet_transport_core_service.h.
#define GNUNET_TRANSPORT_MONITOR_VERSION 0x00000000 |
Version number of the transport API.
Definition at line 56 of file gnunet_transport_monitor_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 79 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 131 of file gnunet_transport_communication_service.h.
typedef void(* GNUNET_TRANSPORT_StartBurstNotify) (const char *address, struct GNUNET_TIME_Relative rtt, struct GNUNET_PeerIdentity *peer) |
Function to start burst, if request by transport service.
address | The address to start the burst against. |
Definition at line 142 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 198 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 73 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 90 of file gnunet_transport_core_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 127 of file gnunet_transport_monitor_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 97 of file gnunet_transport_communication_service.h.
Possible states of a connection.
Enumerator | |
---|---|
GNUNET_TRANSPORT_CS_DOWN | Connection is down. |
GNUNET_TRANSPORT_CS_OUTBOUND | this is an outbound connection (transport initiated) |
GNUNET_TRANSPORT_CS_INBOUND | this is an inbound connection (communicator initiated) |
Definition at line 252 of file gnunet_transport_communication_service.h.
struct GNUNET_TRANSPORT_ApplicationHandle * GNUNET_TRANSPORT_application_init | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Initialize the TRANSPORT application client handle.
cfg | configuration to use |
Initialize the TRANSPORT application client handle.
cfg | configuration to use |
Definition at line 219 of file transport_api2_application.c.
References cfg, ch, GNUNET_CONTAINER_multipeermap_create(), GNUNET_new, GNUNET_YES, and reconnect().
Referenced by connect_peers_run(), DHTU_gnunet_init(), GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_start_peer(), run(), and start_peer_run().
void GNUNET_TRANSPORT_application_done | ( | struct GNUNET_TRANSPORT_ApplicationHandle * | ch | ) |
Shutdown TRANSPORT application client.
ch | handle to destroy |
Shutdown TRANSPORT application client.
ch | handle to release |
Definition at line 257 of file transport_api2_application.c.
References ch, free_sug_handle(), GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_CONTAINER_multipeermap_iterate(), GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), and GNUNET_CADET_Channel::mq.
Referenced by cleaning_task(), DHTU_gnunet_done(), do_shutdown(), GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_stop_peer(), shutdown_rest(), and stop_peer_run().
struct GNUNET_TRANSPORT_ApplicationSuggestHandle * GNUNET_TRANSPORT_application_suggest | ( | struct GNUNET_TRANSPORT_ApplicationHandle * | ch, |
const struct GNUNET_PeerIdentity * | peer, | ||
enum GNUNET_MQ_PriorityPreferences | pk, | ||
struct GNUNET_BANDWIDTH_Value32NBO | bw | ||
) |
An application would like TRANSPORT to connect to a peer.
ch | handle |
peer | identity of the peer we need an address for |
pk | what kind of application will the application require (can be GNUNET_MQ_PRIO_BACKGROUND, we will still try to connect) |
bw | desired bandwidth, can be zero (we will still try to connect) |
Definition at line 289 of file transport_api2_application.c.
References GNUNET_TRANSPORT_ApplicationSuggestHandle::bw, ch, GNUNET_TRANSPORT_ApplicationSuggestHandle::ch, GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multipeermap_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_new, GNUNET_OK, GNUNET_TRANSPORT_ApplicationSuggestHandle::id, LOG, GNUNET_CADET_Channel::mq, pk, GNUNET_TRANSPORT_ApplicationSuggestHandle::pk, and transmit_suggestion().
Referenced by attempt_connect(), consider_peer_activate(), GCP_set_hello(), gnunet_drop(), gnunet_hold(), GNUNET_TRANSPORT_TESTING_connect_peers(), and notify_disconnect().
void GNUNET_TRANSPORT_application_suggest_cancel | ( | struct GNUNET_TRANSPORT_ApplicationSuggestHandle * | sh | ) |
We no longer care about being connected to a peer.
sh | handle to stop |
Definition at line 323 of file transport_api2_application.c.
References ch, GNUNET_assert, GNUNET_CONTAINER_multipeermap_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_i2s(), GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_OK, LOG, m, GNUNET_CADET_Channel::mq, and sh.
Referenced by attempt_connect(), consider_peer_activate(), core_disconnect_cb(), destroy_peer(), free_peer(), GCP_set_hello(), gnunet_drop(), gnunet_hold(), GNUNET_TRANSPORT_TESTING_connect_peers_cancel(), and notify_connect().
void GNUNET_TRANSPORT_application_validate | ( | struct GNUNET_TRANSPORT_ApplicationHandle * | ch, |
const struct GNUNET_PeerIdentity * | peer, | ||
enum GNUNET_NetworkType | nt, | ||
const char * | addr | ||
) |
An application (or a communicator) has received a HELLO (or other address data of another peer) and wants TRANSPORT to validate that the address is correct.
The result is NOT returned, in fact TRANSPORT may do nothing (i.e. if it has too many active validations or recently tried this one already). If the addr validates, TRANSPORT will persist the address with PEERSTORE.
ch | handle |
peer | identity of the peer we have an address for |
nt | network type of addr (as claimed by the other peer); used by TRANSPORT to avoid trying addr's that really cannot work due to network type mismatches |
addr | address to validate |
Definition at line 366 of file transport_api2_application.c.
References ch, GNUNET_ERROR_TYPE_WARNING, GNUNET_i2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_HELLO_VALIDATION, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), m, GNUNET_CADET_Channel::mq, nt, and RequestHelloValidationMessage::peer.
Referenced by connect_peers_run(), gnunet_try_connect(), and sock_read().
struct GNUNET_TRANSPORT_CommunicatorHandle * GNUNET_TRANSPORT_communicator_connect | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | config_section_name, | ||
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, | ||
GNUNET_TRANSPORT_StartBurstNotify | sb | ||
) |
Connect to the transport service.
cfg | configuration to use |
config_section_name | 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 |
sb | Function to start burst, if request by transport service. |
Definition at line 875 of file transport_api2_communication.c.
References GNUNET_TRANSPORT_CommunicatorHandle::addr_prefix, GNUNET_TRANSPORT_CommunicatorHandle::cc, cfg, ch, GNUNET_TRANSPORT_CommunicatorHandle::config_section, DEFAULT_MAX_QUEUE_LENGTH, GNUNET_CONFIGURATION_get_value_number(), GNUNET_free, GNUNET_new, GNUNET_OK, GNUNET_CADET_Channel::mq, mq_init(), GNUNET_TRANSPORT_CommunicatorHandle::mq_init_cls, notify_cb(), GNUNET_TRANSPORT_CommunicatorHandle::notify_cb_cls, reconnect(), and GNUNET_TRANSPORT_CommunicatorHandle::sb.
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 920 of file transport_api2_communication.c.
References ch, disconnect(), GNUNET_break, GNUNET_free, and GNUNET_TRANSPORT_communicator_address_remove().
Referenced by do_shutdown().
int GNUNET_TRANSPORT_communicator_receive | ( | struct GNUNET_TRANSPORT_CommunicatorHandle * | handle, |
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 |
Definition at line 937 of file transport_api2_communication.c.
References FlowControl::cb, FlowControl::cb_cls, ch, env, GNUNET_TRANSPORT_IncomingMessage::expected_address_validity, GNUNET_TRANSPORT_IncomingMessage::fc_id, GNUNET_TRANSPORT_IncomingMessage::fc_on, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_i2s(), 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_CADET_Channel::mq, msg, GNUNET_TRANSPORT_IncomingMessage::sender, FlowControl::sender, and GNUNET_MessageHeader::size.
Referenced by http_recv_data_cb(), pass_plaintext_to_core(), recv_from_streams(), and select_read_cb().
void GNUNET_TRANSPORT_communicator_burst_finished | ( | struct GNUNET_TRANSPORT_CommunicatorHandle * | ch | ) |
The communicator tells the transport service that it finished the burst.
handle | connection to transport service. |
Definition at line 1180 of file transport_api2_communication.c.
References ch, env, GNUNET_MESSAGE_TYPE_TRANSPORT_BURST_FINISHED, GNUNET_MQ_msg, GNUNET_MQ_send(), and GNUNET_CADET_Channel::mq.
Referenced by sock_read(), and udp_socket_notify().
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 |
Definition at line 1007 of file transport_api2_communication.c.
References address, GNUNET_TRANSPORT_QueueHandle::address, ch, GNUNET_TRANSPORT_QueueHandle::ch, GNUNET_TRANSPORT_QueueHandle::cs, GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_strdup, mq, GNUNET_TRANSPORT_QueueHandle::mq, GNUNET_TRANSPORT_QueueHandle::mtu, nt, GNUNET_TRANSPORT_QueueHandle::nt, GNUNET_TRANSPORT_QueueHandle::peer, GNUNET_TRANSPORT_QueueHandle::priority, GNUNET_TRANSPORT_QueueHandle::q_len, GNUNET_TRANSPORT_QueueHandle::queue_id, and send_add_queue().
Referenced by add_acks(), setup_connection_mq(), setup_peer_mq(), 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 |
u_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 1041 of file transport_api2_communication.c.
References ch, GNUNET_assert, GNUNET_TRANSPORT_QueueHandle::next, GNUNET_TRANSPORT_QueueHandle::priority, GNUNET_TRANSPORT_QueueHandle::q_len, 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 1068 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, and send_del_queue().
Referenced by connection_destroy(), peer_destroy(), 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 1090 of file transport_api2_communication.c.
References address, GNUNET_TRANSPORT_AddressIdentifier::address, ai, GNUNET_TRANSPORT_AddressIdentifier::aid, 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 1117 of file transport_api2_communication.c.
References GNUNET_TRANSPORT_AddressIdentifier::address, ai, 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 1136 of file transport_api2_communication.c.
References ai, ch, 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 |
Definition at line 1153 of file transport_api2_communication.c.
References ch, env, GNUNET_assert, GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_TRANSPORT_CommunicatorBackchannel::header, GNUNET_CADET_Channel::mq, pid, GNUNET_TRANSPORT_CommunicatorBackchannel::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_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_start_peer(), GSC_KX_init(), run(), and start_peer_run().
void GNUNET_TRANSPORT_core_disconnect | ( | struct GNUNET_TRANSPORT_CoreHandle * | handle | ) |
Disconnect from the transport service.
handle | handle returned from connect |
Referenced by GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_stop_peer(), GSC_KX_done(), shutdown_task(), and stop_peer_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, cfg, GNUNET_free, GNUNET_new, mc, 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(), GNUNET_free, and mc.
Referenced by handle_monitor_end().