GNUnet CADET service with encryption. More...
#include "gnunet_util_lib.h"
#include "cadet.h"
#include "gnunet_statistics_service.h"
#include "gnunet_transport_application_service.h"
#include "gnunet-service-cadet.h"
#include "gnunet-service-cadet_channel.h"
#include "gnunet-service-cadet_core.h"
#include "gnunet-service-cadet_dht.h"
#include "gnunet-service-cadet_hello.h"
#include "gnunet-service-cadet_tunnels.h"
#include "gnunet-service-cadet_peer.h"
#include "gnunet-service-cadet_paths.h"
#include "gnunet_constants.h"
Go to the source code of this file.
Data Structures | |
struct | CadetClient |
Struct containing information about a client of the service. More... | |
Macros | |
#define | LOG(level, ...) GNUNET_log (level, __VA_ARGS__) |
Functions | |
void | GSC_send_to_client (struct CadetClient *c, struct GNUNET_MQ_Envelope *env) |
Send a message to a client. More... | |
const char * | GSC_2s (struct CadetClient *c) |
Return identifier for a client as a string. More... | |
static struct CadetChannel * | lookup_channel (struct CadetClient *c, struct GNUNET_CADET_ClientChannelNumber ccn) |
Lookup channel of client c by ccn. More... | |
static struct GNUNET_CADET_ClientChannelNumber | client_get_next_ccn (struct CadetClient *c) |
Obtain the next LID to use for incoming connections to the given client. More... | |
struct GNUNET_CADET_ClientChannelNumber | GSC_bind (struct CadetClient *c, struct CadetChannel *ch, struct CadetPeer *dest, const struct GNUNET_HashCode *port, uint32_t options) |
Bind incoming channel to this client, and notify client about incoming connection. More... | |
static int | destroy_tunnels_now (void *cls, const struct GNUNET_PeerIdentity *pid, void *value) |
Callback invoked on all peers to destroy all tunnels that may still exist. More... | |
static int | destroy_paths_now (void *cls, const struct GNUNET_PeerIdentity *pid, void *value) |
Callback invoked on all peers to destroy all tunnels that may still exist. More... | |
static void | shutdown_rest () |
Shutdown everything once the clients have disconnected. More... | |
static void | shutdown_task (void *cls) |
Task run during shutdown. More... | |
static int | bind_loose_channel (void *cls, const struct GNUNET_HashCode *port, void *value) |
We had a remote connection value to port h_port before client cls opened port port. More... | |
static void | handle_port_open (void *cls, const struct GNUNET_CADET_PortMessage *pmsg) |
Handle port open request. More... | |
static void | handle_port_close (void *cls, const struct GNUNET_CADET_PortMessage *pmsg) |
Handler for port close requests. More... | |
static void | handle_channel_create (void *cls, const struct GNUNET_CADET_LocalChannelCreateMessage *tcm) |
Handler for requests for us creating a new channel to another peer and port. More... | |
static void | handle_channel_destroy (void *cls, const struct GNUNET_CADET_LocalChannelDestroyMessage *msg) |
Handler for requests of destroying an existing channel. More... | |
static int | check_local_data (void *cls, const struct GNUNET_CADET_LocalData *msg) |
Check for client traffic data message is well-formed. More... | |
static void | handle_local_data (void *cls, const struct GNUNET_CADET_LocalData *msg) |
Handler for client payload traffic to be send on a channel to another peer. More... | |
static void | handle_local_ack (void *cls, const struct GNUNET_CADET_LocalAck *msg) |
Handler for client's ACKs for payload traffic. More... | |
static int | get_all_peers_iterator (void *cls, const struct GNUNET_PeerIdentity *peer, void *value) |
Iterator over all peers to send a monitoring client info about each peer. More... | |
static void | handle_get_peers (void *cls, const struct GNUNET_MessageHeader *message) |
Handler for client's INFO PEERS request. More... | |
static int | path_info_iterator (void *cls, struct CadetPeerPath *path, unsigned int off) |
Iterator over all paths of a peer to build an InfoPeer message. More... | |
static void | handle_show_path (void *cls, const struct GNUNET_CADET_RequestPathInfoMessage *msg) |
Handler for client's GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PATH request. More... | |
static int | get_all_tunnels_iterator (void *cls, const struct GNUNET_PeerIdentity *peer, void *value) |
Iterator over all tunnels to send a monitoring client info about each tunnel. More... | |
static void | handle_info_tunnels (void *cls, const struct GNUNET_MessageHeader *message) |
Handler for client's GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_TUNNELS request. More... | |
static void | handle_drop_message (void *cls, const struct GNUNET_CADET_RequestDropCadetMessage *message) |
Handler for client's GNUNET_MESSAGE_TYPE_CADET_DROP_CADET_MESSAGE request. More... | |
static void * | client_connect_cb (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq) |
Callback called when a client connects to the service. More... | |
void | GSC_handle_remote_channel_destroy (struct CadetClient *c, struct GNUNET_CADET_ClientChannelNumber ccn, struct CadetChannel *ch) |
A channel was destroyed by the other peer. More... | |
void | GSC_drop_loose_channel (const struct GNUNET_HashCode *h_port, struct CadetChannel *ch) |
A client that created a loose channel that was not bound to a port disconnected, drop it from the loose_channels list. More... | |
static int | channel_destroy_iterator (void *cls, uint32_t key, void *value) |
Iterator for deleting each channel whose client endpoint disconnected. More... | |
static int | client_release_ports (void *cls, const struct GNUNET_HashCode *port, void *value) |
Remove client's ports from the global hashmap on disconnect. More... | |
static void | client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *client, void *internal_cls) |
Callback called when a client disconnected from the service. More... | |
static void | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_SERVICE_Handle *service) |
Setup CADET internals. More... | |
GNUNET_SERVICE_MAIN (GNUNET_OS_project_data_gnunet(), "cadet", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_fixed_size(port_open, GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN, struct GNUNET_CADET_PortMessage, NULL), GNUNET_MQ_hd_fixed_size(port_close, GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE, struct GNUNET_CADET_PortMessage, NULL), GNUNET_MQ_hd_fixed_size(channel_create, GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE, struct GNUNET_CADET_LocalChannelCreateMessage, NULL), GNUNET_MQ_hd_fixed_size(channel_destroy, GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY, struct GNUNET_CADET_LocalChannelDestroyMessage, NULL), GNUNET_MQ_hd_var_size(local_data, GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA, struct GNUNET_CADET_LocalData, NULL), GNUNET_MQ_hd_fixed_size(local_ack, GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK, struct GNUNET_CADET_LocalAck, NULL), GNUNET_MQ_hd_fixed_size(get_peers, GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PEERS, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_fixed_size(show_path, GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PATH, struct GNUNET_CADET_RequestPathInfoMessage, NULL), GNUNET_MQ_hd_fixed_size(info_tunnels, GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_TUNNELS, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_fixed_size(drop_message, GNUNET_MESSAGE_TYPE_CADET_DROP_CADET_MESSAGE, struct GNUNET_CADET_RequestDropCadetMessage, NULL), GNUNET_MQ_handler_end()) | |
Define "main" method using service macro. More... | |
Variables | |
const struct GNUNET_CONFIGURATION_Handle * | cfg |
Handle to our configuration. More... | |
struct GNUNET_STATISTICS_Handle * | stats |
Handle to the statistics service. More... | |
struct GNUNET_TRANSPORT_ApplicationHandle * | transport |
Handle to Transport service. More... | |
struct GNUNET_PeerIdentity | my_full_id |
Local peer own ID. More... | |
struct GNUNET_CRYPTO_EddsaPrivateKey * | my_private_key |
Own private key. More... | |
int | shutting_down |
Signal that shutdown is happening: prevent recovery measures. More... | |
static struct CadetClient * | clients_head |
DLL with all the clients, head. More... | |
static struct CadetClient * | clients_tail |
DLL with all the clients, tail. More... | |
static unsigned int | next_client_id |
Next ID to assign to a client. More... | |
struct GNUNET_CONTAINER_MultiHashMap * | open_ports |
All ports clients of this peer have opened. More... | |
struct GNUNET_CONTAINER_MultiHashMap * | loose_channels |
Map from ports to channels where the ports were closed at the time we got the inbound connection. More... | |
struct GNUNET_CONTAINER_MultiPeerMap * | peers |
Map from PIDs to struct CadetPeer entries. More... | |
struct GNUNET_CONTAINER_MultiShortmap * | connections |
Map from struct GNUNET_CADET_ConnectionTunnelIdentifier hash codes to struct CadetConnection objects. More... | |
unsigned long long | ratchet_messages |
How many messages are needed to trigger an AXOLOTL ratchet advance. More... | |
struct GNUNET_TIME_Relative | ratchet_time |
How long until we trigger a ratched advance due to time. More... | |
struct GNUNET_TIME_Relative | keepalive_period |
How frequently do we send KEEPALIVE messages on idle connections? More... | |
unsigned long long | drop_percent |
Set to non-zero values to create random drops to test retransmissions. More... | |
GNUnet CADET service with encryption.
Dictionary:
Definition in file gnunet-service-cadet.c.
#define LOG | ( | level, | |
... | |||
) | GNUNET_log (level, __VA_ARGS__) |
Definition at line 50 of file gnunet-service-cadet.c.
void GSC_send_to_client | ( | struct CadetClient * | c, |
struct GNUNET_MQ_Envelope * | env | ||
) |
Send a message to a client.
c | client to get the message |
env | envelope with the message |
Definition at line 206 of file gnunet-service-cadet.c.
References env, GNUNET_MQ_send(), and CadetClient::mq.
Referenced by GCCH_handle_channel_plaintext_data(), GCCH_handle_local_ack(), GCCH_handle_local_data(), GSC_bind(), GSC_handle_remote_channel_destroy(), and send_ack_to_client().
const char * GSC_2s | ( | struct CadetClient * | c | ) |
Return identifier for a client as a string.
c | client to identify |
Definition at line 221 of file gnunet-service-cadet.c.
References GNUNET_snprintf(), and CadetClient::id.
Referenced by channel_destroy_iterator(), client_connect_cb(), client_disconnect_cb(), client_release_ports(), GCCH_bind(), GCCH_channel_local_destroy(), GCCH_channel_local_new(), GCCH_debug(), GCCH_handle_channel_plaintext_data(), GCCH_handle_local_ack(), handle_channel_create(), handle_channel_destroy(), handle_local_ack(), handle_local_data(), handle_port_close(), handle_port_open(), and send_ack_to_client().
|
static |
Lookup channel of client c by ccn.
c | client to look in |
ccn | channel ID to look up |
Definition at line 241 of file gnunet-service-cadet.c.
References GNUNET_CADET_ClientChannelNumber::channel_of_client, CadetClient::channels, and GNUNET_CONTAINER_multihashmap32_get().
Referenced by client_get_next_ccn(), handle_channel_create(), handle_channel_destroy(), handle_drop_message(), handle_local_ack(), and handle_local_data().
|
static |
Obtain the next LID to use for incoming connections to the given client.
c | client handle |
Definition at line 256 of file gnunet-service-cadet.c.
References GNUNET_CADET_ClientChannelNumber::channel_of_client, GNUNET_CADET_LOCAL_CHANNEL_ID_CLI, and lookup_channel().
Referenced by GSC_bind().
struct GNUNET_CADET_ClientChannelNumber GSC_bind | ( | struct CadetClient * | c, |
struct CadetChannel * | ch, | ||
struct CadetPeer * | dest, | ||
const struct GNUNET_HashCode * | port, | ||
uint32_t | options | ||
) |
Bind incoming channel to this client, and notify client about incoming connection.
Caller is responsible for notifying the other peer about our acceptance of the channel.
c | client to bind to |
ch | channel to be bound |
dest | peer that establishes the connection |
port | port number |
options | options |
Definition at line 290 of file gnunet-service-cadet.c.
References GNUNET_CADET_LocalChannelCreateMessage::ccn, ch, GNUNET_CADET_ClientChannelNumber::channel_of_client, client_get_next_ccn(), warningfilter::dest, env, GCCH_2s(), GCP_2s(), GCP_get_id(), GNUNET_assert, GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE, GNUNET_MQ_msg, GNUNET_YES, GSC_send_to_client(), LOG, GNUNET_CADET_LocalChannelCreateMessage::opt, options, GNUNET_CADET_LocalChannelCreateMessage::peer, GNUNET_CADET_LocalChannelCreateMessage::port, and port.
Referenced by GCCH_bind().
|
static |
Callback invoked on all peers to destroy all tunnels that may still exist.
cls | NULL |
pid | identify of a peer |
value | a struct CadetPeer that may still have a tunnel |
Definition at line 337 of file gnunet-service-cadet.c.
References GCP_get_tunnel(), GCT_destroy_tunnel_now(), GNUNET_NO, GNUNET_OK, t, and value.
Referenced by shutdown_rest().
|
static |
Callback invoked on all peers to destroy all tunnels that may still exist.
cls | NULL |
pid | identify of a peer |
value | a struct CadetPeer that may still have a tunnel |
Definition at line 361 of file gnunet-service-cadet.c.
References GCP_drop_owned_paths(), GNUNET_OK, and value.
Referenced by shutdown_rest().
|
static |
Shutdown everything once the clients have disconnected.
Definition at line 376 of file gnunet-service-cadet.c.
References connections, destroy_paths_now(), destroy_tunnels_now(), GCD_shutdown(), GCH_shutdown(), GCP_destroy_all_peers(), GCP_iterate_all(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_CONTAINER_multishortmap_destroy(), GNUNET_free, GNUNET_NO, GNUNET_STATISTICS_destroy(), GNUNET_TRANSPORT_application_done(), loose_channels, my_private_key, open_ports, peers, stats, and transport.
Referenced by client_disconnect_cb(), and shutdown_task().
|
static |
Task run during shutdown.
cls | unused |
Definition at line 430 of file gnunet-service-cadet.c.
References clients_head, GCO_shutdown(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_YES, shutdown_rest(), and shutting_down.
Referenced by run().
|
static |
We had a remote connection value to port h_port before client cls opened port port.
Bind them now.
cls | the struct CadetClient |
port | the hashed port |
value | the struct CadetChannel |
Definition at line 451 of file gnunet-service-cadet.c.
References ch, GCCH_bind(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_remove(), GNUNET_YES, loose_channels, op, and value.
Referenced by handle_port_open().
|
static |
Handle port open request.
Creates a mapping from the port to the respective client and checks whether we have loose channels trying to bind to the port. If so, those are bound.
cls | Identification of the client. |
pmsg | The actual message. |
Definition at line 479 of file gnunet-service-cadet.c.
References bind_loose_channel(), OpenPort::c, CadetClient::client, GCCH_hash_port(), GNUNET_break, GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GSC_2s(), LOG, loose_channels, my_full_id, op, open_ports, GNUNET_CADET_PortMessage::port, and CadetClient::ports.
|
static |
Handler for port close requests.
Marks this port as closed (unless of course we have another client with the same port open). Note that existing channels accepted on the port are not affected.
cls | Identification of the client. |
pmsg | The actual message. |
Definition at line 530 of file gnunet-service-cadet.c.
References OpenPort::c, CadetClient::client, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_YES, GSC_2s(), LOG, op, open_ports, GNUNET_CADET_PortMessage::port, and CadetClient::ports.
|
static |
Handler for requests for us creating a new channel to another peer and port.
cls | Identification of the client. |
tcm | The actual message. |
Definition at line 575 of file gnunet-service-cadet.c.
References GNUNET_CADET_LocalChannelCreateMessage::ccn, ch, GNUNET_CADET_ClientChannelNumber::channel_of_client, CadetClient::channels, CadetClient::client, GCCH_channel_local_new(), GCP_get(), GNUNET_assert, GNUNET_break, GNUNET_CADET_LOCAL_CHANNEL_ID_CLI, GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_i2s(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_YES, GSC_2s(), LOG, lookup_channel(), GNUNET_CADET_LocalChannelCreateMessage::opt, GNUNET_CADET_LocalChannelCreateMessage::peer, and GNUNET_CADET_LocalChannelCreateMessage::port.
|
static |
Handler for requests of destroying an existing channel.
cls | client identification of the client |
msg | the actual message |
Definition at line 637 of file gnunet-service-cadet.c.
References ch, CadetClient::channels, CadetClient::client, GCCH_2s(), GCCH_channel_local_destroy(), GNUNET_assert, GNUNET_CONTAINER_multihashmap32_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_SERVICE_client_continue(), GNUNET_YES, GSC_2s(), LOG, lookup_channel(), and msg.
|
static |
Check for client traffic data message is well-formed.
cls | identification of the client |
msg | the actual message |
Definition at line 682 of file gnunet-service-cadet.c.
References GNUNET_break, GNUNET_break_op, GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_memcpy, GNUNET_OK, GNUNET_SYSERR, LOG, msg, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.
|
static |
Handler for client payload traffic to be send on a channel to another peer.
cls | identification of the client |
msg | the actual message |
Definition at line 736 of file gnunet-service-cadet.c.
References ch, CadetClient::client, GCCH_2s(), GCCH_handle_local_data(), GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_NO, GNUNET_OK, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_STATISTICS_update(), GSC_2s(), LOG, lookup_channel(), msg, GNUNET_MessageHeader::size, and stats.
|
static |
Handler for client's ACKs for payload traffic.
cls | identification of the client. |
msg | The actual message. |
Definition at line 787 of file gnunet-service-cadet.c.
References ch, CadetClient::client, GCCH_2s(), GCCH_handle_local_ack(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_SERVICE_client_continue(), GSC_2s(), LOG, lookup_channel(), and msg.
|
static |
Iterator over all peers to send a monitoring client info about each peer.
Definition at line 823 of file gnunet-service-cadet.c.
References env, GCP_count_paths(), GCP_get_tunnel(), GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NO, GNUNET_YES, CadetClient::mq, msg, p, and value.
Referenced by handle_get_peers().
|
static |
Handler for client's INFO PEERS request.
cls | Identification of the client. |
message | The actual message. |
Definition at line 852 of file gnunet-service-cadet.c.
References CadetClient::client, env, GCP_iterate_all(), get_all_peers_iterator(), GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS_END, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SERVICE_client_continue(), and CadetClient::mq.
|
static |
Iterator over all paths of a peer to build an InfoPeer message.
Message contains blocks of peers, first not included.
cls | message queue for transmission |
path | Path itself |
off | offset of the peer on path |
Definition at line 880 of file gnunet-service-cadet.c.
References env, GCP_get_id(), GCPP_get_length(), GCPP_get_peer_at_offset(), GNUNET_ERROR_TYPE_WARNING, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PATH, GNUNET_MIN, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_YES, id, LOG, mq, and GNUNET_CADET_LocalInfoPath::off.
Referenced by handle_show_path().
|
static |
Handler for client's GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PATH request.
cls | Identification of the client. |
msg | The actual message. |
Definition at line 933 of file gnunet-service-cadet.c.
References CadetClient::client, env, GCP_get(), GCP_iterate_indirect_paths(), GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PATH_END, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NO, GNUNET_SERVICE_client_continue(), CadetClient::mq, msg, p, and path_info_iterator().
|
static |
Iterator over all tunnels to send a monitoring client info about each tunnel.
Definition at line 964 of file gnunet-service-cadet.c.
References env, GCP_get_tunnel(), GCT_count_any_connections(), GCT_count_channels(), GCT_get_estate(), GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NO, GNUNET_YES, CadetClient::mq, msg, p, t, and value.
Referenced by handle_info_tunnels().
|
static |
Handler for client's GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_TUNNELS request.
cls | client Identification of the client. |
message | The actual message. |
Definition at line 998 of file gnunet-service-cadet.c.
References CadetClient::client, env, GCP_iterate_all(), get_all_tunnels_iterator(), GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS_END, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SERVICE_client_continue(), and CadetClient::mq.
|
static |
Handler for client's GNUNET_MESSAGE_TYPE_CADET_DROP_CADET_MESSAGE request.
cls | client Identification of the client. |
message | The actual message. |
Definition at line 1022 of file gnunet-service-cadet.c.
References GNUNET_CADET_RequestDropCadetMessage::ccn, ch, CadetClient::client, GCCH_assign_type_to_drop(), GNUNET_SERVICE_client_continue(), and lookup_channel().
|
static |
Callback called when a client connects to the service.
cls | closure for the service |
client | the new client that connected to the service |
mq | the message queue used to send messages to the client |
Definition at line 1047 of file gnunet-service-cadet.c.
References CadetClient::channels, CadetClient::client, clients_head, clients_tail, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_multihashmap32_create(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_new, GNUNET_NO, GNUNET_STATISTICS_update(), GSC_2s(), CadetClient::id, LOG, mq, CadetClient::mq, next_client_id, and stats.
void GSC_handle_remote_channel_destroy | ( | struct CadetClient * | c, |
struct GNUNET_CADET_ClientChannelNumber | ccn, | ||
struct CadetChannel * | ch | ||
) |
A channel was destroyed by the other peer.
Tell our client.
c | client that lost a channel |
ccn | channel identification number for the client |
ch | the channel object |
Definition at line 1081 of file gnunet-service-cadet.c.
References GNUNET_CADET_LocalChannelDestroyMessage::ccn, ch, GNUNET_CADET_ClientChannelNumber::channel_of_client, CadetClient::channels, env, GNUNET_assert, GNUNET_CONTAINER_multihashmap32_remove(), GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY, GNUNET_MQ_msg, GNUNET_YES, and GSC_send_to_client().
Referenced by GCCH_handle_remote_destroy(), and signal_remote_destroy_cb().
void GSC_drop_loose_channel | ( | const struct GNUNET_HashCode * | h_port, |
struct CadetChannel * | ch | ||
) |
A client that created a loose channel that was not bound to a port disconnected, drop it from the loose_channels list.
h_port | the hashed port the channel was trying to bind to |
ch | the channel that was lost |
Definition at line 1102 of file gnunet-service-cadet.c.
References ch, GNUNET_assert, GNUNET_CONTAINER_multihashmap_remove(), GNUNET_YES, and loose_channels.
Referenced by channel_destroy().
|
static |
Iterator for deleting each channel whose client endpoint disconnected.
cls | Closure (client that has disconnected). |
key | The local channel id in host byte order |
value | The value stored at the key (channel to destroy). |
Definition at line 1121 of file gnunet-service-cadet.c.
References ch, GNUNET_CADET_ClientChannelNumber::channel_of_client, CadetClient::channels, GCCH_2s(), GCCH_channel_local_destroy(), GNUNET_assert, GNUNET_CONTAINER_multihashmap32_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_OK, GNUNET_YES, GSC_2s(), key, LOG, and value.
Referenced by client_disconnect_cb().
|
static |
Remove client's ports from the global hashmap on disconnect.
cls | the struct CadetClient |
port | the port. |
value | the struct OpenPort to remove |
Definition at line 1154 of file gnunet-service-cadet.c.
References OpenPort::c, GNUNET_assert, GNUNET_CONTAINER_multihashmap_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_OK, GNUNET_YES, GSC_2s(), LOG, op, open_ports, port, CadetClient::ports, and value.
Referenced by client_disconnect_cb().
|
static |
Callback called when a client disconnected from the service.
cls | closure for the service |
client | the client that disconnected |
internal_cls | should be equal to c |
Definition at line 1187 of file gnunet-service-cadet.c.
References channel_destroy_iterator(), CadetClient::channels, CadetClient::client, client_release_ports(), clients_head, clients_tail, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap32_destroy(), GNUNET_CONTAINER_multihashmap32_iterate(), GNUNET_CONTAINER_multihashmap32_size(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_YES, GSC_2s(), LOG, CadetClient::ports, shutdown_rest(), shutting_down, and stats.
|
static |
Setup CADET internals.
cls | closure |
c | configuration to use |
Definition at line 1233 of file gnunet-service-cadet.c.
References cfg, connections, drop_percent, GCD_init(), GCH_init(), GCO_init(), GNUNET_break, GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_time(), GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multipeermap_create(), GNUNET_CONTAINER_multishortmap_create(), GNUNET_CRYPTO_eddsa_key_create_from_configuration(), GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_ERROR_TYPE_INFO, GNUNET_ERROR_TYPE_WARNING, GNUNET_i2s(), GNUNET_log, GNUNET_log_config_invalid(), GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_STATISTICS_create(), GNUNET_TIME_UNIT_HOURS, GNUNET_TIME_UNIT_MINUTES, GNUNET_TRANSPORT_application_init(), GNUNET_YES, keepalive_period, LOG, loose_channels, my_full_id, my_private_key, open_ports, peers, GNUNET_PeerIdentity::public_key, ratchet_messages, ratchet_time, shutdown_task(), stats, and transport.
Define "main" method using service macro.
const struct GNUNET_CONFIGURATION_Handle* cfg |
Handle to our configuration.
Handle to our configuration.
Definition at line 112 of file gnunet-service-cadet.c.
Referenced by run().
struct GNUNET_STATISTICS_Handle* stats |
Handle to the statistics service.
Definition at line 117 of file gnunet-service-cadet.c.
Referenced by client_connect_cb(), client_disconnect_cb(), handle_local_data(), run(), and shutdown_rest().
struct GNUNET_TRANSPORT_ApplicationHandle* transport |
Handle to Transport service.
Definition at line 122 of file gnunet-service-cadet.c.
Referenced by consider_peer_activate(), GCP_set_hello(), print_info(), run(), and shutdown_rest().
struct GNUNET_PeerIdentity my_full_id |
Local peer own ID.
Definition at line 127 of file gnunet-service-cadet.c.
Referenced by handle_port_open(), and run().
struct GNUNET_CRYPTO_EddsaPrivateKey* my_private_key |
Own private key.
Definition at line 132 of file gnunet-service-cadet.c.
Referenced by run(), and shutdown_rest().
int shutting_down |
Signal that shutdown is happening: prevent recovery measures.
Definition at line 137 of file gnunet-service-cadet.c.
Referenced by client_disconnect_cb(), GCT_destroy_tunnel_now(), and shutdown_task().
|
static |
DLL with all the clients, head.
Definition at line 142 of file gnunet-service-cadet.c.
Referenced by client_connect_cb(), client_disconnect_cb(), and shutdown_task().
|
static |
DLL with all the clients, tail.
Definition at line 147 of file gnunet-service-cadet.c.
Referenced by client_connect_cb(), and client_disconnect_cb().
|
static |
Next ID to assign to a client.
Definition at line 152 of file gnunet-service-cadet.c.
Referenced by client_connect_cb().
struct GNUNET_CONTAINER_MultiHashMap* open_ports |
All ports clients of this peer have opened.
Maps from a hashed port to a struct OpenPort
.
Definition at line 158 of file gnunet-service-cadet.c.
Referenced by client_release_ports(), GCCH_channel_incoming_new(), GCCH_channel_local_new(), handle_port_close(), handle_port_open(), run(), and shutdown_rest().
struct GNUNET_CONTAINER_MultiHashMap* loose_channels |
Map from ports to channels where the ports were closed at the time we got the inbound connection.
Indexed by h_port, contains struct CadetChannel
.
Definition at line 165 of file gnunet-service-cadet.c.
Referenced by bind_loose_channel(), GCCH_channel_incoming_new(), GCCH_channel_local_new(), GSC_drop_loose_channel(), handle_port_open(), run(), and shutdown_rest().
struct GNUNET_CONTAINER_MultiPeerMap* peers |
Map from PIDs to struct CadetPeer
entries.
Definition at line 170 of file gnunet-service-cadet.c.
Referenced by check_n_peers_ready(), clients_notify_stream_peer(), collect_peers_cb(), collect_peers_info_cb(), destroy_peer(), GCP_destroy_all_peers(), GCP_get(), GCP_iterate_all(), GNUNET_CONSENSUS_create(), GNUNET_SECRETSHARING_create_session(), handle_client_seed(), handle_peer_pull_reply(), handle_view_update(), load_debug(), peer_info_ready_cb(), peers_ready_cb(), run(), send_stream_peers(), shutdown_rest(), test_master(), and test_run().
struct GNUNET_CONTAINER_MultiShortmap* connections |
Map from struct GNUNET_CADET_ConnectionTunnelIdentifier
hash codes to struct CadetConnection
objects.
Definition at line 176 of file gnunet-service-cadet.c.
Referenced by connection_create(), GCC_destroy(), GCC_lookup(), run(), and shutdown_rest().
unsigned long long ratchet_messages |
How many messages are needed to trigger an AXOLOTL ratchet advance.
Definition at line 181 of file gnunet-service-cadet.c.
Referenced by run().
struct GNUNET_TIME_Relative ratchet_time |
How long until we trigger a ratched advance due to time.
Definition at line 186 of file gnunet-service-cadet.c.
Referenced by run(), t_ax_encrypt(), and update_ax_by_kx().
struct GNUNET_TIME_Relative keepalive_period |
How frequently do we send KEEPALIVE messages on idle connections?
Definition at line 191 of file gnunet-service-cadet.c.
Referenced by GCC_handle_connection_create_ack(), handle_connection_create(), keepalive_done(), manage_first_hop_mq(), run(), send_create_ack(), send_keepalive(), and timeout_cb().
unsigned long long drop_percent |
Set to non-zero values to create random drops to test retransmissions.
Definition at line 196 of file gnunet-service-cadet.c.
Referenced by get_channel_weight(), run(), and should_I_drop().