GNUnet debian-0.24.3-29-g453fda2cf
 
Loading...
Searching...
No Matches
plugin_dhtu_gnunet.h File Reference
Include dependency graph for plugin_dhtu_gnunet.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void * DHTU_gnunet_done (struct GNUNET_DHTU_PluginFunctions *p)
 Exit point from the plugin.
 
struct GNUNET_DHTU_PluginFunctionsDHTU_gnunet_init (struct GNUNET_DHTU_PluginEnvironment *e)
 Entry point for the plugin.
 

Function Documentation

◆ DHTU_gnunet_done()

void * DHTU_gnunet_done ( struct GNUNET_DHTU_PluginFunctions api)

Exit point from the plugin.

Parameters
clsclosure (our struct Plugin)
Returns
NULL

Definition at line 553 of file plugin_dhtu_gnunet.c.

554{
555 struct Plugin *plugin = api->cls;
556
557 if (NULL != plugin->nse)
559 plugin->env->network_size_cb (plugin->env->cls,
561 0.0,
562 0.0);
563 if (NULL != plugin->core)
565 if (NULL != plugin->transport)
567 if (NULL != plugin->peerstore_notify)
568 GNUNET_PEERSTORE_monitor_stop (plugin->peerstore_notify);
569 if (NULL != plugin->peerstore)
571 // GPI_plugins_unload ();
572 GNUNET_free (plugin->my_priv);
575 return NULL;
576}
static struct GNUNET_TESTING_PluginFunctions * plugin
Plugin to dynamically load a test case.
void GNUNET_TRANSPORT_application_done(struct GNUNET_TRANSPORT_ApplicationHandle *ch)
Shutdown TRANSPORT application client.
void GNUNET_CORE_disconnect(struct GNUNET_CORE_Handle *handle)
Disconnect from the core service.
Definition core_api.c:744
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_NSE_disconnect(struct GNUNET_NSE_Handle *h)
Disconnect from network size estimation service.
Definition nse_api.c:192
void GNUNET_PEERSTORE_monitor_stop(struct GNUNET_PEERSTORE_Monitor *zm)
Stop monitoring.
void GNUNET_PEERSTORE_disconnect(struct GNUNET_PEERSTORE_Handle *h)
Disconnect from the PEERSTORE service.
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
void * cls
Closure for all of the callbacks.
void * cls
Closure to pass to start_testcase.
Handle for a plugin.
Definition block.c:38
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
Definition block.c:47

References Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, GNUNET_TESTING_PluginFunctions::cls, GNUNET_CORE_disconnect(), GNUNET_free, GNUNET_NSE_disconnect(), GNUNET_PEERSTORE_disconnect(), GNUNET_PEERSTORE_monitor_stop(), GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TRANSPORT_application_done(), and plugin.

Referenced by DHTU_gnunet_init(), and shutdown_task().

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

◆ DHTU_gnunet_init()

struct GNUNET_DHTU_PluginFunctions * DHTU_gnunet_init ( struct GNUNET_DHTU_PluginEnvironment env)

Entry point for the plugin.

Parameters
clsclosure (the struct GNUNET_DHTU_PluginEnvironment)
Returns
the plugin's API

Definition at line 586 of file plugin_dhtu_gnunet.c.

587{
588 struct GNUNET_DHTU_PluginFunctions *api;
589 struct Plugin *plugin;
591 GNUNET_MQ_hd_var_size (core_message,
594 NULL),
596 };
597 const struct GNUNET_CORE_ServiceInfo service_info =
598 {
600 .version = { 1, 0 },
601 .version_max = { 1, 0 },
602 .version_min = { 1, 0 },
603 };
604
605 plugin = GNUNET_new (struct Plugin);
607 env->cfg);
608 plugin->env = env;
610 api->cls = plugin;
612 api->hold = &gnunet_hold;
613 api->drop = &gnunet_drop;
614 api->send = &gnunet_send;
615 plugin->peerstore = GNUNET_PEERSTORE_connect (env->cfg);
616 plugin->transport = GNUNET_TRANSPORT_application_init (env->cfg);
617 plugin->core = GNUNET_CORE_connect (env->cfg,
618 plugin,
622 handlers,
623 &service_info);
624 plugin->nse = GNUNET_NSE_connect (env->cfg,
625 &nse_cb,
626 plugin);
627 if ( (NULL == plugin->transport) ||
628 (NULL == plugin->core) ||
629 (NULL == plugin->nse) )
630 {
631 GNUNET_break (0);
632 DHTU_gnunet_done (api);
633 return NULL;
634 }
635 // GPI_plugins_load (env->cfg);
636 return api;
637}
struct GNUNET_MQ_MessageHandlers handlers[]
Definition 003.c:1
struct GNUNET_MQ_Envelope * env
Definition 005.c:1
struct GNUNET_TRANSPORT_ApplicationHandle * GNUNET_TRANSPORT_application_init(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the TRANSPORT application client handle.
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, struct GNUNET_CORE_ServiceInfo *service_info)
Connect to the core service.
Definition core_api.c:698
@ GNUNET_CORE_SERVICE_DHT
Identifier for dht (distributed hash table) service.
struct GNUNET_CRYPTO_EddsaPrivateKey * GNUNET_CRYPTO_eddsa_key_create_from_configuration(const struct GNUNET_CONFIGURATION_Handle *cfg)
Create a new private key by reading our peer's key from the file specified in the configuration.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
struct GNUNET_NSE_Handle * GNUNET_NSE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_NSE_Callback func, void *func_cls)
Connect to the network size estimation service.
Definition nse_api.c:164
struct GNUNET_PEERSTORE_Handle * GNUNET_PEERSTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the PEERSTORE service.
#define GNUNET_MESSAGE_TYPE_DHT_CORE
Encapsulation of DHT messages in CORE service.
static void * core_connect_cb(void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq, enum GNUNET_CORE_PeerClass class)
Method called whenever a given peer connects.
void * DHTU_gnunet_done(struct GNUNET_DHTU_PluginFunctions *api)
Exit point from the plugin.
static void gnunet_drop(struct GNUNET_DHTU_PreferenceHandle *ph)
Do no long request underlay to keep the connection alive.
static void core_disconnect_cb(void *cls, const struct GNUNET_PeerIdentity *peer, void *peer_cls)
Method called whenever a peer disconnects.
static void gnunet_try_connect(void *cls, const struct GNUNET_PeerIdentity *pid, const char *address)
Request creation of a session with a peer at the given address.
static void nse_cb(void *cls, struct GNUNET_TIME_Absolute timestamp, double logestimate, double std_dev)
Callback to call when network size estimate is updated.
static struct GNUNET_DHTU_PreferenceHandle * gnunet_hold(void *cls, struct GNUNET_DHTU_Target *target)
Request underlay to keep the connection to target alive if possible.
static void gnunet_send(void *cls, struct GNUNET_DHTU_Target *target, const void *msg, size_t msg_size, GNUNET_SCHEDULER_TaskCallback finished_cb, void *finished_cb_cls)
Send message to some other participant over the network.
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).
Gnunet service info - identifying compatibility with a range of version of a service communicating ov...
enum GNUNET_CORE_Service service
Identifier of the service on top of CORE.
struct returned by the initialization function of the plugin
void(* try_connect)(void *cls, const struct GNUNET_PeerIdentity *pid, const char *address)
Request creation of a session with a peer at the given address.
void * cls
Closure to pass to all plugin functions.
struct GNUNET_DHTU_PreferenceHandle *(* hold)(void *cls, struct GNUNET_DHTU_Target *target)
Request underlay to keep the connection to target alive if possible.
void(* drop)(struct GNUNET_DHTU_PreferenceHandle *ph)
Do no longer request underlay to keep the connection alive.
void(* send)(void *cls, struct GNUNET_DHTU_Target *target, const void *msg, size_t msg_size, GNUNET_SCHEDULER_TaskCallback finished_cb, void *finished_cb_cls)
Send message to some other participant over the network.
Message handler for a specific message type.
Header for all communications.

References GNUNET_DHTU_PluginFunctions::cls, core_connect_cb(), core_disconnect_cb(), core_init_cb(), DHTU_gnunet_done(), GNUNET_DHTU_PluginFunctions::drop, env, GNUNET_break, GNUNET_CORE_connect(), GNUNET_CORE_SERVICE_DHT, GNUNET_CRYPTO_eddsa_key_create_from_configuration(), gnunet_drop(), gnunet_hold(), GNUNET_MESSAGE_TYPE_DHT_CORE, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_new, GNUNET_NSE_connect(), GNUNET_PEERSTORE_connect(), gnunet_send(), GNUNET_TRANSPORT_application_init(), gnunet_try_connect(), handlers, GNUNET_DHTU_PluginFunctions::hold, nse_cb(), plugin, GNUNET_DHTU_PluginFunctions::send, GNUNET_CORE_ServiceInfo::service, and GNUNET_DHTU_PluginFunctions::try_connect.

Referenced by load_underlay().

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