GNUnet 0.22.2
gnunet-service-cadet_core.h File Reference

cadet service; interaction with CORE service More...

#include "gnunet_util_lib.h"
Include dependency graph for gnunet-service-cadet_core.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void GCO_init (const struct GNUNET_CONFIGURATION_Handle *c)
 Initialize the CORE subsystem. More...
 
void GCO_shutdown (void)
 Shut down the CORE subsystem. More...
 

Detailed Description

cadet service; interaction with CORE service

Author
Bartlomiej Polot
Christian Grothoff

All functions in this file should use the prefix GCO (Gnunet Cadet cOre (bottom))

Definition in file gnunet-service-cadet_core.h.

Function Documentation

◆ GCO_init()

void GCO_init ( const struct GNUNET_CONFIGURATION_Handle c)

Initialize the CORE subsystem.

Parameters
cConfiguration.

Definition at line 1262 of file gnunet-service-cadet_core.c.

1263{
1268 NULL),
1269 GNUNET_MQ_hd_fixed_size (connection_create_ack,
1272 NULL),
1273 GNUNET_MQ_hd_fixed_size (connection_broken,
1276 NULL),
1280 NULL),
1281 GNUNET_MQ_hd_fixed_size (tunnel_kx,
1284 NULL),
1285 GNUNET_MQ_hd_fixed_size (tunnel_kx_auth,
1288 NULL),
1289 GNUNET_MQ_hd_var_size (tunnel_encrypted,
1292 NULL),
1294
1296 "CADET",
1297 "MAX_ROUTES",
1298 &max_routes))
1299 max_routes = 5000;
1301 "CADET",
1302 "MAX_MSGS_QUEUE",
1303 &max_buffers))
1304 max_buffers = 10000;
1308 NULL,
1309 &core_init_cb,
1312 handlers);
1313}
struct GNUNET_MQ_MessageHandlers handlers[]
Definition: 003.c:1
static void connection_destroy(struct Connection *connection)
Destroys a receiving state due to timeout or shutdown.
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.
static void * core_connect_cb(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq)
Method called whenever a given peer connects.
static struct GNUNET_CORE_Handle * core
Handle to the CORE service.
static struct GNUNET_CONTAINER_Heap * route_heap
Heap of routes, MIN-sorted by last activity.
static unsigned long long max_routes
Maximum number of concurrent routes this peer will support.
static void core_disconnect_cb(void *cls, const struct GNUNET_PeerIdentity *peer, void *peer_cls)
Method called whenever a peer disconnects.
static struct GNUNET_CONTAINER_MultiShortmap * routes
Routes on which this peer is an intermediate.
static unsigned long long max_buffers
Maximum number of envelopes we will buffer at this peer.
static void core_init_cb(void *cls, const struct GNUNET_PeerIdentity *my_identity)
Function called after GNUNET_CORE_connect has succeeded (or failed for good).
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
struct GNUNET_CORE_Handle * GNUNET_CORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, GNUNET_CORE_StartupCallback init, GNUNET_CORE_ConnectEventHandler connects, GNUNET_CORE_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers)
Connect to the core service.
Definition: core_api.c:691
struct GNUNET_CONTAINER_MultiShortmap * GNUNET_CONTAINER_multishortmap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
struct GNUNET_CONTAINER_Heap * GNUNET_CONTAINER_heap_create(enum GNUNET_CONTAINER_HeapOrder order)
Create a new heap.
@ GNUNET_CONTAINER_HEAP_ORDER_MIN
Heap with the minimum cost at the root.
@ GNUNET_OK
@ GNUNET_NO
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK
Send origin an ACK that the connection is complete.
#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
Notify that a connection is no longer valid.
#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX
Axolotl key exchange.
#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
Request the destruction of a connection.
#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX_AUTH
Axolotl key exchange response with authentication.
#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE
Request the creation of a connection.
#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED
Axolotl encrypted data.
Message for notifying a disconnection in a path.
Message for ack'ing a connection.
Message for cadet connection creation.
Message to destroy a connection.
Axolotl-encrypted tunnel message with application payload.
Message for a Key eXchange for a tunnel, with authentication.
Message for a Key eXchange for a tunnel.
Message handler for a specific message type.

References connection_create(), connection_destroy(), core, core_connect_cb(), core_disconnect_cb(), core_init_cb(), GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONTAINER_heap_create(), GNUNET_CONTAINER_HEAP_ORDER_MIN, GNUNET_CONTAINER_multishortmap_create(), GNUNET_CORE_connect(), GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK, GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY, GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED, GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX, GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX_AUTH, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_NO, GNUNET_OK, handlers, max_buffers, max_routes, route_heap, and routes.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GCO_shutdown()

void GCO_shutdown ( void  )

Shut down the CORE subsystem.

Definition at line 1317 of file gnunet-service-cadet_core.c.

1318{
1319 if (NULL != core)
1320 {
1322 core = NULL;
1323 }
1326 routes = NULL;
1328 route_heap = NULL;
1329 if (NULL != timeout_task)
1330 {
1332 timeout_task = NULL;
1333 }
1334}
static struct GNUNET_SCHEDULER_Task * timeout_task
Task to timeout routes.
void GNUNET_CORE_disconnect(struct GNUNET_CORE_Handle *handle)
Disconnect from the core service.
Definition: core_api.c:729
void GNUNET_CONTAINER_multishortmap_destroy(struct GNUNET_CONTAINER_MultiShortmap *map)
Destroy a hash map.
unsigned int GNUNET_CONTAINER_multishortmap_size(const struct GNUNET_CONTAINER_MultiShortmap *map)
Get the number of key-value pairs in the map.
void GNUNET_CONTAINER_heap_destroy(struct GNUNET_CONTAINER_Heap *heap)
Destroys the heap.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:980

References core, GNUNET_assert, GNUNET_CONTAINER_heap_destroy(), GNUNET_CONTAINER_multishortmap_destroy(), GNUNET_CONTAINER_multishortmap_size(), GNUNET_CORE_disconnect(), GNUNET_SCHEDULER_cancel(), route_heap, routes, and timeout_task.

Referenced by shutdown_task().

Here is the call graph for this function:
Here is the caller graph for this function: