management of CORE-level end-to-end connections; establishes end-to-end routes and transmits messages along the route More...
#include "platform.h"
#include "gnunet_signatures.h"
#include "gnunet-service-cadet_connection.h"
#include "gnunet-service-cadet_channel.h"
#include "gnunet-service-cadet_paths.h"
#include "gnunet-service-cadet_tunnels.h"
#include "gnunet_cadet_service.h"
#include "gnunet_statistics_service.h"
#include "cadet_protocol.h"
Go to the source code of this file.
Data Structures | |
struct | CadetConnection |
Low-level connection to a destination. More... | |
Macros | |
#define | LOG(level, ...) GNUNET_log_from (level, "cadet-con", __VA_ARGS__) |
#define | INITIAL_CONNECTION_CREATE_RETRY_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 200) |
How long do we wait initially before retransmitting the KX? TODO: replace by 2 RTT if/once we have connection-level RTT data! More... | |
#define | LOG2(level, ...) GNUNET_log_from_nocheck (level, "cadet-con", __VA_ARGS__) |
Enumerations | |
enum | CadetConnectionState { CADET_CONNECTION_NEW , CADET_CONNECTION_SENDING_CREATE , CADET_CONNECTION_SENT , CADET_CONNECTION_CREATE_RECEIVED , CADET_CONNECTION_READY } |
All the states a connection can be in. More... | |
Functions | |
struct CadetConnection * | GCC_lookup (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid) |
Lookup a connection by its identifier. More... | |
static void | update_state (struct CadetConnection *cc, enum CadetConnectionState new_state, int new_mqm_ready) |
Update the connection state. More... | |
static void | GCC_destroy (struct CadetConnection *cc) |
Destroy a connection, part of the internal implementation. More... | |
void | GCC_destroy_without_core (struct CadetConnection *cc) |
Destroy a connection, called when the CORE layer is already done (i.e. More... | |
void | GCC_destroy_without_tunnel (struct CadetConnection *cc) |
Destroy a connection, called if the tunnel association with the connection was already broken, but we still need to notify the CORE layer about the breakage. More... | |
struct CadetTConnection * | GCC_get_ct (struct CadetConnection *cc) |
Return the tunnel associated with this connection. More... | |
const struct CadetConnectionMetrics * | GCC_get_metrics (struct CadetConnection *cc) |
Obtain performance metrics from cc. More... | |
static void | send_keepalive (void *cls) |
Send a GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE through the tunnel to prevent it from timing out. More... | |
static void | keepalive_done (void *cls, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid) |
Keepalive was transmitted. More... | |
void | GCC_ack_expected (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid) |
We sent a message for which we expect to receive an ACK via the connection identified by cti. More... | |
void | GCC_ack_observed (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid) |
We observed an ACK for a message that was originally sent via the connection identified by cid. More... | |
void | GCC_latency_observed (const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, struct GNUNET_TIME_Relative latency) |
We observed some the given latency on the connection identified by cti. More... | |
void | GCC_handle_connection_create_ack (struct CadetConnection *cc) |
A GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK was received for this connection, implying that the end-to-end connection is up. More... | |
void | GCC_handle_kx (struct CadetConnection *cc, const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg) |
Handle KX message. More... | |
void | GCC_handle_kx_auth (struct CadetConnection *cc, const struct GNUNET_CADET_TunnelKeyExchangeAuthMessage *msg) |
Handle KX_AUTH message. More... | |
void | GCC_handle_encrypted (struct CadetConnection *cc, const struct GNUNET_CADET_TunnelEncryptedMessage *msg) |
Handle encrypted message. More... | |
static void | set_monotime_sig (struct GNUNET_CADET_ConnectionCreateMessage *msg) |
Set the signature for a monotime value on a GNUNET_CADET_ConnectionCreateMessage. More... | |
static void | send_create (void *cls) |
Send a GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE message to the first hop. More... | |
static void | send_create_ack (void *cls) |
Send a CREATE_ACK message towards the origin. More... | |
void | GCC_handle_duplicate_create (struct CadetConnection *cc) |
We got a GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE for a connection that we already have. More... | |
static void | manage_first_hop_mq (void *cls, int available) |
There has been a change in the message queue existence for our peer at the first hop. More... | |
static struct CadetConnection * | connection_create (struct CadetPeer *destination, struct CadetPeerPath *path, unsigned int off, struct CadetTConnection *ct, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, enum CadetConnectionState init_state, GCC_ReadyCallback ready_cb, void *ready_cb_cls) |
Create a connection to destination via path and notify cb whenever we are ready for more data. More... | |
struct CadetConnection * | GCC_create_inbound (struct CadetPeer *destination, struct CadetPeerPath *path, struct CadetTConnection *ct, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, GCC_ReadyCallback ready_cb, void *ready_cb_cls) |
Create a connection to destination via path and notify cb whenever we are ready for more data. More... | |
struct CadetConnection * | GCC_create (struct CadetPeer *destination, struct CadetPeerPath *path, unsigned int off, struct CadetTConnection *ct, GCC_ReadyCallback ready_cb, void *ready_cb_cls) |
Create a connection to destination via path and notify cb whenever we are ready for more data. More... | |
void | GCC_transmit (struct CadetConnection *cc, struct GNUNET_MQ_Envelope *env) |
Transmit message msg via connection cc. More... | |
struct CadetPeerPath * | GCC_get_path (struct CadetConnection *cc, unsigned int *off) |
Obtain the path used by this connection. More... | |
const struct GNUNET_CADET_ConnectionTunnelIdentifier * | GCC_get_id (struct CadetConnection *cc) |
Obtain unique ID for the connection. More... | |
const char * | GCC_2s (const struct CadetConnection *cc) |
Get a (static) string for a connection. More... | |
void | GCC_debug (struct CadetConnection *cc, enum GNUNET_ErrorType level) |
Log connection info. More... | |
management of CORE-level end-to-end connections; establishes end-to-end routes and transmits messages along the route
Definition in file gnunet-service-cadet_connection.c.
#define LOG | ( | level, | |
... | |||
) | GNUNET_log_from (level, "cadet-con", __VA_ARGS__) |
Definition at line 39 of file gnunet-service-cadet_connection.c.
#define INITIAL_CONNECTION_CREATE_RETRY_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 200) |
How long do we wait initially before retransmitting the KX? TODO: replace by 2 RTT if/once we have connection-level RTT data!
Definition at line 46 of file gnunet-service-cadet_connection.c.
#define LOG2 | ( | level, | |
... | |||
) | GNUNET_log_from_nocheck (level, "cadet-con", __VA_ARGS__) |
Definition at line 1040 of file gnunet-service-cadet_connection.c.
enum CadetConnectionState |
All the states a connection can be in.
Enumerator | |
---|---|
CADET_CONNECTION_NEW | Uninitialized status, we have not yet even gotten the message queue. |
CADET_CONNECTION_SENDING_CREATE | Connection create message in queue, awaiting transmission by CORE. |
CADET_CONNECTION_SENT | Connection create message sent, waiting for ACK. |
CADET_CONNECTION_CREATE_RECEIVED | We are an inbound connection, and received a CREATE. Need to send an CREATE_ACK back. |
CADET_CONNECTION_READY | Connection confirmed, ready to carry traffic. |
Definition at line 53 of file gnunet-service-cadet_connection.c.
struct CadetConnection * GCC_lookup | ( | const struct GNUNET_CADET_ConnectionTunnelIdentifier * | cid | ) |
Lookup a connection by its identifier.
cid | identifier to resolve |
Definition at line 186 of file gnunet-service-cadet_connection.c.
References CadetConnection::cid, GNUNET_CADET_ConnectionTunnelIdentifier::connection_of_tunnel, connections, and GNUNET_CONTAINER_multishortmap_get().
Referenced by data_sent_cb(), GCC_ack_expected(), GCC_ack_observed(), GCC_latency_observed(), handle_connection_broken(), handle_connection_create(), handle_connection_create_ack(), handle_connection_destroy(), handle_tunnel_encrypted(), handle_tunnel_kx(), and handle_tunnel_kx_auth().
|
static |
Update the connection state.
Also triggers the necessary MQM notifications.
cc | connection to update the state for |
new_state | new state for cc |
new_mqm_ready | new mqm_ready state for cc |
Definition at line 202 of file gnunet-service-cadet_connection.c.
References CADET_CONNECTION_READY, CadetConnection::ct, GCT_2s(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_YES, LOG, CadetConnection::mqm_ready, CadetConnection::ready_cb, CadetConnection::ready_cb_cls, CadetConnection::state, and CadetTConnection::t.
Referenced by GCC_handle_connection_create_ack(), GCC_handle_duplicate_create(), manage_first_hop_mq(), send_create(), and send_create_ack().
|
static |
Destroy a connection, part of the internal implementation.
Called only from #GCC_destroy_from_core() or #GCC_destroy_from_tunnel().
cc | connection to destroy |
Definition at line 244 of file gnunet-service-cadet_connection.c.
References connections, GCC_2s(), GCC_get_id(), GCP_remove_connection(), GCP_request_mq_cancel(), GCPP_del_connection(), GCPP_get_peer_at_offset(), GCT_send_cancel(), GNUNET_assert, GNUNET_CONTAINER_multishortmap_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_YES, CadetConnection::keepalive_qe, LOG, CadetConnection::mq_man, CadetConnection::off, CadetConnection::path, and CadetConnection::task.
Referenced by GCC_destroy_without_core(), and GCC_destroy_without_tunnel().
void GCC_destroy_without_core | ( | struct CadetConnection * | cc | ) |
Destroy a connection, called when the CORE layer is already done (i.e.
has received a BROKEN message), but if we still have to communicate the destruction of the connection to the tunnel (if one exists).
cc | connection to destroy |
Definition at line 284 of file gnunet-service-cadet_connection.c.
References CadetConnection::ct, GCC_destroy(), and GCT_connection_lost().
Referenced by handle_connection_broken(), and handle_connection_destroy().
void GCC_destroy_without_tunnel | ( | struct CadetConnection * | cc | ) |
Destroy a connection, called if the tunnel association with the connection was already broken, but we still need to notify the CORE layer about the breakage.
cc | connection to destroy |
Definition at line 303 of file gnunet-service-cadet_connection.c.
References CADET_CONNECTION_SENDING_CREATE, GNUNET_CADET_ConnectionDestroyMessage::cid, CadetConnection::cid, CadetConnection::ct, env, GCC_destroy(), GCP_request_mq_cancel(), GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, GNUNET_MQ_msg, CadetConnection::mq_man, and CadetConnection::state.
Referenced by destroy_t_connection(), and GCC_create_inbound().
struct CadetTConnection * GCC_get_ct | ( | struct CadetConnection * | cc | ) |
Return the tunnel associated with this connection.
cc | connection to query |
Definition at line 329 of file gnunet-service-cadet_connection.c.
References CadetTConnection::cc, and CadetConnection::ct.
const struct CadetConnectionMetrics * GCC_get_metrics | ( | struct CadetConnection * | cc | ) |
Obtain performance metrics from cc.
cc | connection to query |
Definition at line 342 of file gnunet-service-cadet_connection.c.
References CadetConnection::metrics.
Referenced by data_sent_cb(), and evaluate_connection().
|
static |
Send a GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE through the tunnel to prevent it from timing out.
cls | the struct CadetConnection to keep alive. |
Definition at line 386 of file gnunet-service-cadet_connection.c.
References CADET_TUNNEL_KEY_OK, CadetConnection::ct, GCC_2s(), GCT_2s(), GCT_get_estate(), GCT_send(), GNUNET_assert, GNUNET_ERROR_TYPE_INFO, GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE, GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_STATISTICS_update(), GNUNET_YES, keepalive_done(), keepalive_period, CadetConnection::keepalive_qe, LOG, CadetConnection::mqm_ready, msg, send_keepalive(), GNUNET_MessageHeader::size, stats, CadetTConnection::t, CadetConnection::task, and GNUNET_MessageHeader::type.
Referenced by GCC_handle_connection_create_ack(), keepalive_done(), manage_first_hop_mq(), send_create_ack(), and send_keepalive().
|
static |
Keepalive was transmitted.
Remember this, and possibly schedule the next one.
cls | the struct CadetConnection to keep alive. |
cid | identifier of the connection within the tunnel, NULL if transmission failed |
Definition at line 367 of file gnunet-service-cadet_connection.c.
References GNUNET_SCHEDULER_add_delayed(), GNUNET_YES, keepalive_period, CadetConnection::keepalive_qe, CadetConnection::mqm_ready, send_keepalive(), and CadetConnection::task.
Referenced by send_keepalive().
void GCC_ack_expected | ( | const struct GNUNET_CADET_ConnectionTunnelIdentifier * | cid | ) |
We sent a message for which we expect to receive an ACK via the connection identified by cti.
cid | connection identifier where we expect an ACK |
Definition at line 421 of file gnunet-service-cadet_connection.c.
References CadetConnection::cid, GCC_lookup(), CadetConnection::metrics, and CadetConnectionMetrics::num_acked_transmissions.
Referenced by data_sent_cb().
void GCC_ack_observed | ( | const struct GNUNET_CADET_ConnectionTunnelIdentifier * | cid | ) |
We observed an ACK for a message that was originally sent via the connection identified by cid.
We observed an ACK for a message that was originally sent via the connection identified by cti.
cid | connection identifier where we got an ACK for a message that was originally sent via this connection (the ACK may have gotten back to us via a different connection). |
Definition at line 441 of file gnunet-service-cadet_connection.c.
References CadetConnection::cid, GCC_lookup(), CadetConnection::metrics, and CadetConnectionMetrics::num_successes.
Referenced by handle_matching_ack().
void GCC_latency_observed | ( | const struct GNUNET_CADET_ConnectionTunnelIdentifier * | cti, |
struct GNUNET_TIME_Relative | latency | ||
) |
We observed some the given latency on the connection identified by cti.
(The same connection was taken in both directions.)
cti | connection identifier where we measured latency |
latency | the observed latency |
Definition at line 453 of file gnunet-service-cadet_connection.c.
References CadetConnectionMetrics::aged_latency, CadetConnection::cid, GCC_lookup(), GNUNET_NO, GNUNET_STATISTICS_update(), CadetConnection::latency_datapoints, CadetConnection::metrics, GNUNET_TIME_Relative::rel_value_us, result, and stats.
Referenced by handle_matching_ack().
void GCC_handle_connection_create_ack | ( | struct CadetConnection * | cc | ) |
A GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK was received for this connection, implying that the end-to-end connection is up.
Process it.
cc | the connection that got the ACK. |
Definition at line 480 of file gnunet-service-cadet_connection.c.
References CadetConnectionMetrics::age, CADET_CONNECTION_READY, GCC_2s(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_cancel(), GNUNET_TIME_absolute_get(), GNUNET_YES, keepalive_period, CadetConnection::keepalive_qe, LOG, CadetConnection::metrics, CadetConnection::mqm_ready, send_keepalive(), CadetConnection::state, CadetConnection::task, and update_state().
Referenced by GCC_handle_encrypted(), GCC_handle_kx(), GCC_handle_kx_auth(), and handle_connection_create_ack().
void GCC_handle_kx | ( | struct CadetConnection * | cc, |
const struct GNUNET_CADET_TunnelKeyExchangeMessage * | msg | ||
) |
Handle KX message.
cc | connection that received encrypted message |
msg | the key exchange message |
Definition at line 510 of file gnunet-service-cadet_connection.c.
References CADET_CONNECTION_SENT, CadetConnection::cid, GNUNET_CADET_ConnectionTunnelIdentifier::connection_of_tunnel, CadetConnection::ct, GCC_2s(), GCC_handle_connection_create_ack(), GCT_handle_kx(), GNUNET_e2s(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_sh2s(), LOG, msg, and CadetConnection::state.
Referenced by handle_tunnel_kx().
void GCC_handle_kx_auth | ( | struct CadetConnection * | cc, |
const struct GNUNET_CADET_TunnelKeyExchangeAuthMessage * | msg | ||
) |
Handle KX_AUTH message.
cc | connection that received encrypted message |
msg | the key exchange message |
Definition at line 538 of file gnunet-service-cadet_connection.c.
References CADET_CONNECTION_SENT, CadetConnection::cid, GNUNET_CADET_ConnectionTunnelIdentifier::connection_of_tunnel, CadetConnection::ct, GCC_2s(), GCC_handle_connection_create_ack(), GCT_handle_kx_auth(), GNUNET_e2s(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_sh2s(), LOG, msg, and CadetConnection::state.
Referenced by handle_tunnel_kx_auth().
void GCC_handle_encrypted | ( | struct CadetConnection * | cc, |
const struct GNUNET_CADET_TunnelEncryptedMessage * | msg | ||
) |
Handle encrypted message.
cc | connection that received encrypted message |
msg | the encrypted message to decrypt |
Definition at line 566 of file gnunet-service-cadet_connection.c.
References CADET_CONNECTION_SENT, CadetConnection::ct, GCC_2s(), GCC_handle_connection_create_ack(), GCT_handle_encrypted(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_TIME_absolute_get(), CadetConnectionMetrics::last_use, LOG, CadetConnection::metrics, msg, and CadetConnection::state.
Referenced by handle_tunnel_encrypted().
|
static |
Set the signature for a monotime value on a GNUNET_CADET_ConnectionCreateMessage.
msg | The GNUNET_CADET_ConnectionCreateMessage. |
Definition at line 589 of file gnunet-service-cadet_connection.c.
References GNUNET_CRYPTO_eddsa_sign, GNUNET_SIGNATURE_PURPOSE_CADET_CONNECTION_INITIATOR, msg, my_private_key, GNUNET_CRYPTO_EccSignaturePurpose::purpose, and CadetConnectionCreatePS::purpose.
Referenced by send_create().
|
static |
Send a GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE message to the first hop.
cls | the struct CadetConnection to initiate |
Definition at line 610 of file gnunet-service-cadet_connection.c.
References CADET_CONNECTION_SENT, CADET_TUNNEL_KEY_UNINITIALIZED, cfg, GNUNET_CADET_ConnectionCreateMessage::cid, CadetConnection::cid, CadetConnection::create_at, CadetConnection::destination, env, CadetConnection::env, GCC_2s(), GCP_get_id(), GCP_get_tunnel(), GCP_send(), GCPP_get_peer_at_offset(), GCT_alice_or_betty(), GCT_get_estate(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, GNUNET_MQ_msg_extra, GNUNET_NO, GNUNET_TIME_absolute_get_monotonic(), GNUNET_TIME_absolute_hton(), GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_STD_BACKOFF, GNUNET_YES, GNUNET_CADET_ConnectionCreateMessage::has_monotime, LOG, GNUNET_CADET_ConnectionCreateMessage::monotime, CadetConnection::mq_man, CadetConnection::mqm_ready, my_full_id, CadetConnection::off, GNUNET_CADET_ConnectionCreateMessage::options, CadetConnection::path, CadetConnection::retry_delay, set_monotime_sig(), t, CadetConnection::task, and update_state().
Referenced by manage_first_hop_mq().
|
static |
Send a CREATE_ACK message towards the origin.
cls | the struct CadetConnection to initiate |
Definition at line 661 of file gnunet-service-cadet_connection.c.
References CADET_CONNECTION_CREATE_RECEIVED, CADET_CONNECTION_READY, GNUNET_CADET_ConnectionCreateAckMessage::cid, CadetConnection::cid, CadetConnection::create_ack_at, env, CadetConnection::env, GCC_2s(), GCP_send(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK, GNUNET_MQ_msg, GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_STD_BACKOFF, GNUNET_YES, keepalive_period, LOG, CadetConnection::mq_man, CadetConnection::mqm_ready, CadetConnection::retry_delay, send_keepalive(), CadetConnection::state, CadetConnection::task, and update_state().
Referenced by GCC_handle_duplicate_create(), and manage_first_hop_mq().
void GCC_handle_duplicate_create | ( | struct CadetConnection * | cc | ) |
We got a GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE for a connection that we already have.
Either our ACK got lost or something is fishy. Consider retransmitting the ACK.
cc | connection that got the duplicate CREATE |
Definition at line 695 of file gnunet-service-cadet_connection.c.
References CADET_CONNECTION_CREATE_RECEIVED, CadetConnection::create_ack_at, GCC_2s(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_SCHEDULER_add_at(), GNUNET_SCHEDULER_cancel(), GNUNET_YES, LOG, CadetConnection::mqm_ready, send_create_ack(), CadetConnection::task, and update_state().
Referenced by handle_connection_create().
|
static |
There has been a change in the message queue existence for our peer at the first hop.
Adjust accordingly.
cls | the struct CadetConnection |
available | GNUNET_YES if sending is now possible, GNUNET_NO if sending is no longer possible GNUNET_SYSERR if sending is no longer possible and the last envelope was discarded |
Definition at line 734 of file gnunet-service-cadet_connection.c.
References CadetConnectionMetrics::age, CADET_CONNECTION_CREATE_RECEIVED, CADET_CONNECTION_NEW, CADET_CONNECTION_READY, CADET_CONNECTION_SENDING_CREATE, CADET_CONNECTION_SENT, CadetConnection::create_ack_at, CadetConnection::create_at, GCC_2s(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_NO, GNUNET_SCHEDULER_add_at(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_cancel(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get(), GNUNET_YES, INITIAL_CONNECTION_CREATE_RETRY_DELAY, keepalive_period, CadetConnection::keepalive_qe, LOG, CadetConnection::metrics, CadetConnection::mqm_ready, CadetConnection::retry_delay, send_create(), send_create_ack(), send_keepalive(), CadetConnection::state, CadetConnection::task, and update_state().
Referenced by connection_create().
|
static |
Create a connection to destination via path and notify cb whenever we are ready for more data.
Shared logic independent of who is initiating the connection.
destination | where to go |
path | which path to take (may not be the full path) |
off | offset of destination on path |
ct | which tunnel uses this connection |
init_state | initial state for the connection |
ready_cb | function to call when ready to transmit |
ready_cb_cls | closure for cb |
Definition at line 813 of file gnunet-service-cadet_connection.c.
References CadetConnection::cid, connections, CadetConnection::ct, CadetConnection::destination, GCC_2s(), GCC_get_id(), GCP_add_connection(), GCP_request_mq(), GCPP_2s(), GCPP_add_connection(), GCPP_get_peer_at_offset(), GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CONTAINER_multishortmap_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_new, GNUNET_OK, GNUNET_TIME_relative_multiply(), INITIAL_CONNECTION_CREATE_RETRY_DELAY, LOG, manage_first_hop_mq(), CadetConnection::mq_man, CadetConnection::off, CadetConnection::path, CadetConnection::ready_cb, CadetConnection::ready_cb_cls, CadetConnection::retry_delay, and CadetConnection::state.
Referenced by GCC_create(), GCC_create_inbound(), and GCO_init().
struct CadetConnection * GCC_create_inbound | ( | struct CadetPeer * | destination, |
struct CadetPeerPath * | path, | ||
struct CadetTConnection * | ct, | ||
const struct GNUNET_CADET_ConnectionTunnelIdentifier * | cid, | ||
GCC_ReadyCallback | ready_cb, | ||
void * | ready_cb_cls | ||
) |
Create a connection to destination via path and notify cb whenever we are ready for more data.
This is an inbound tunnel, so we must use the existing cid
destination | where to go |
path | which path to take (may not be the full path) |
ct | which tunnel uses this connection |
ready_cb | function to call when ready to transmit |
ready_cb_cls | closure for cb |
Definition at line 870 of file gnunet-service-cadet_connection.c.
References CADET_CONNECTION_CREATE_RECEIVED, CadetConnection::cid, connection_create(), CadetConnection::ct, CadetConnection::destination, GCC_2s(), GCC_destroy_without_tunnel(), GCPP_2s(), GCPP_find_peer(), GCPP_get_connection(), GCT_connection_lost(), GNUNET_assert, GNUNET_break_op, GNUNET_ERROR_TYPE_DEBUG, GNUNET_memcmp, LOG, CadetConnection::off, CadetConnection::path, CadetConnection::ready_cb, and CadetConnection::ready_cb_cls.
Referenced by GCT_add_inbound_connection().
struct CadetConnection * GCC_create | ( | struct CadetPeer * | destination, |
struct CadetPeerPath * | path, | ||
unsigned int | off, | ||
struct CadetTConnection * | ct, | ||
GCC_ReadyCallback | ready_cb, | ||
void * | ready_cb_cls | ||
) |
Create a connection to destination via path and notify cb whenever we are ready for more data.
destination | where to go |
path | which path to take (may not be the full path) |
off | offset of destination on path |
ct | which tunnel uses this connection |
ready_cb | function to call when ready to transmit |
ready_cb_cls | closure for cb |
Definition at line 932 of file gnunet-service-cadet_connection.c.
References CADET_CONNECTION_NEW, connection_create(), GNUNET_CRYPTO_QUALITY_NONCE, and GNUNET_CRYPTO_random_block().
Referenced by consider_path_cb().
void GCC_transmit | ( | struct CadetConnection * | cc, |
struct GNUNET_MQ_Envelope * | env | ||
) |
Transmit message msg via connection cc.
Must only be called (once) after the connection has signalled that it is ready via the ready_cb
. Clients can also use #GCC_is_ready() to check if the connection is right now ready for transmission.
cc | connection identification |
env | envelope with message to transmit; must NOT yet have a GNUNET_MQ_notify_sent() callback attached to it |
Definition at line 964 of file gnunet-service-cadet_connection.c.
References CADET_CONNECTION_READY, env, GCC_2s(), GCP_send(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_TIME_absolute_get(), GNUNET_YES, CadetConnectionMetrics::last_use, LOG, CadetConnection::metrics, CadetConnection::mq_man, CadetConnection::mqm_ready, CadetConnection::state, and CadetConnection::task.
Referenced by send_kx(), send_kx_auth(), and try_send_normal_payload().
struct CadetPeerPath * GCC_get_path | ( | struct CadetConnection * | cc, |
unsigned int * | off | ||
) |
Obtain the path used by this connection.
cc | connection | |
[out] | off | set to the length of the path we use |
Definition at line 990 of file gnunet-service-cadet_connection.c.
References CadetConnection::off, and CadetConnection::path.
Referenced by evaluate_connection(), handle_connection_broken(), handle_connection_create_ack(), handle_connection_destroy(), handle_tunnel_encrypted(), handle_tunnel_kx(), and handle_tunnel_kx_auth().
const struct GNUNET_CADET_ConnectionTunnelIdentifier * GCC_get_id | ( | struct CadetConnection * | cc | ) |
Obtain unique ID for the connection.
cc | connection. |
Definition at line 1004 of file gnunet-service-cadet_connection.c.
References CadetConnection::cid.
Referenced by connection_create(), GCC_destroy(), GCP_add_connection(), GCP_remove_connection(), handle_plaintext_channel_destroy(), handle_plaintext_channel_open(), handle_plaintext_channel_open_ack(), handle_plaintext_data(), handle_plaintext_data_ack(), send_kx(), send_kx_auth(), and try_send_normal_payload().
const char * GCC_2s | ( | const struct CadetConnection * | cc | ) |
Get a (static) string for a connection.
cc | Connection. |
Definition at line 1016 of file gnunet-service-cadet_connection.c.
References CadetConnection::cid, GNUNET_CADET_ConnectionTunnelIdentifier::connection_of_tunnel, CadetConnection::ct, GCT_2s(), GNUNET_sh2s(), GNUNET_snprintf(), and CadetTConnection::t.
Referenced by connection_create(), connection_ready_cb(), consider_path_cb(), evaluate_connection(), GCC_create_inbound(), GCC_debug(), GCC_destroy(), GCC_handle_connection_create_ack(), GCC_handle_duplicate_create(), GCC_handle_encrypted(), GCC_handle_kx(), GCC_handle_kx_auth(), GCC_transmit(), GCP_add_connection(), GCP_remove_connection(), GCPP_add_connection(), GCPP_del_connection(), GCT_add_inbound_connection(), GCT_handle_kx(), manage_first_hop_mq(), send_create(), send_create_ack(), send_keepalive(), and try_send_normal_payload().
void GCC_debug | ( | struct CadetConnection * | cc, |
enum GNUNET_ErrorType | level | ||
) |
Log connection info.
cc | connection |
level | Debug level to use. |
Definition at line 1051 of file gnunet-service-cadet_connection.c.
References CadetConnection::destination, GCC_2s(), GCP_2s(), GCPP_2s(), GNUNET_ERROR_TYPE_BULK, GNUNET_get_log_call_status(), GNUNET_YES, LOG2, CadetConnection::mqm_ready, CadetConnection::path, and CadetConnection::state.
Referenced by GCT_debug().