GNUnet  0.10.x
Functions
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 1255 of file gnunet-service-cadet_core.c.

References connection_create(), 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, max_buffers, and max_routes.

Referenced by run().

1256 {
1261  NULL),
1262  GNUNET_MQ_hd_fixed_size(connection_create_ack,
1265  NULL),
1266  GNUNET_MQ_hd_fixed_size(connection_broken,
1269  NULL),
1270  GNUNET_MQ_hd_fixed_size(connection_destroy,
1273  NULL),
1274  GNUNET_MQ_hd_fixed_size(tunnel_kx,
1277  NULL),
1278  GNUNET_MQ_hd_fixed_size(tunnel_kx_auth,
1281  NULL),
1282  GNUNET_MQ_hd_var_size(tunnel_encrypted,
1285  NULL),
1287 
1289  "CADET",
1290  "MAX_ROUTES",
1291  &max_routes))
1292  max_routes = 5000;
1294  "CADET",
1295  "MAX_MSGS_QUEUE",
1296  &max_buffers))
1297  max_buffers = 10000;
1301  NULL,
1302  &core_init_cb,
1303  &core_connect_cb,
1305  handlers);
1306 }
Axolotl-encrypted tunnel message with application payload.
#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_ENCRYPTED
Axolotl encrypted data.
static unsigned long long max_buffers
Maximum number of envelopes we will buffer at this peer.
int 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.
Message to destroy a connection.
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.
Message for ack'ing a connection.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
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...
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
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_CADET_MessageHandler handlers[]
Handlers, for diverse services.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
Message for a Key eXchange for a tunnel, with authentication.
#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE
Request the creation of a connection.
Message for notifying a disconnection in a path.
#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE_ACK
Send origin an ACK that the connection is complete.
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).
Heap with the minimum cost at the root.
Message handler for a specific message type.
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).
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:690
struct GNUNET_CONTAINER_Heap * GNUNET_CONTAINER_heap_create(enum GNUNET_CONTAINER_HeapOrder order)
Create a new heap.
static struct GNUNET_CONTAINER_Heap * route_heap
Heap of routes, MIN-sorted by last activity.
#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_DESTROY
Request the destuction of a connection.
Message for a Key eXchange for a tunnel.
#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX_AUTH
Axolotl key exchange response with authentication.
#define GNUNET_MESSAGE_TYPE_CADET_CONNECTION_BROKEN
Notify that a connection is no longer valid.
Message for cadet connection creation.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
static struct GNUNET_CORE_Handle * core
Handle to the CORE service.
#define GNUNET_MESSAGE_TYPE_CADET_TUNNEL_KX
Axolotl key exchange.
static struct GNUNET_CONTAINER_MultiShortmap * routes
Routes on which this peer is an intermediate.
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 1313 of file gnunet-service-cadet_core.c.

References GNUNET_assert, GNUNET_CONTAINER_heap_destroy(), GNUNET_CONTAINER_multishortmap_destroy(), GNUNET_CONTAINER_multishortmap_size(), GNUNET_CORE_disconnect(), and GNUNET_SCHEDULER_cancel().

Referenced by shutdown_task().

1314 {
1315  if (NULL != core)
1316  {
1318  core = NULL;
1319  }
1322  routes = NULL;
1324  route_heap = NULL;
1325  if (NULL != timeout_task)
1326  {
1328  timeout_task = NULL;
1329  }
1330 }
unsigned int GNUNET_CONTAINER_multishortmap_size(const struct GNUNET_CONTAINER_MultiShortmap *map)
Get the number of key-value pairs in the map.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void GNUNET_CONTAINER_heap_destroy(struct GNUNET_CONTAINER_Heap *heap)
Destroys the heap.
void GNUNET_CORE_disconnect(struct GNUNET_CORE_Handle *handle)
Disconnect from the core service.
Definition: core_api.c:728
void GNUNET_CONTAINER_multishortmap_destroy(struct GNUNET_CONTAINER_MultiShortmap *map)
Destroy a hash map.
static struct GNUNET_CONTAINER_Heap * route_heap
Heap of routes, MIN-sorted by last activity.
static struct GNUNET_SCHEDULER_Task * timeout_task
Task to timeout routes.
static struct GNUNET_CORE_Handle * core
Handle to the CORE service.
static struct GNUNET_CONTAINER_MultiShortmap * routes
Routes on which this peer is an intermediate.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:956
Here is the call graph for this function:
Here is the caller graph for this function: