GNUnet 0.22.2
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. More...
 
struct GNUNET_DHTU_PluginFunctionsDHTU_gnunet_init (struct GNUNET_DHTU_PluginEnvironment *e)
 Entry point for the plugin. More...
 

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 551 of file plugin_dhtu_gnunet.c.

552{
553 struct Plugin *plugin = api->cls;
554
555 if (NULL != plugin->nse)
557 plugin->env->network_size_cb (plugin->env->cls,
559 0.0,
560 0.0);
561 if (NULL != plugin->core)
563 if (NULL != plugin->transport)
565 if (NULL != plugin->peerstore_notify)
566 GNUNET_PEERSTORE_monitor_stop (plugin->peerstore_notify);
567 if (NULL != plugin->peerstore)
569 // GPI_plugins_unload ();
570 GNUNET_free (plugin->my_priv);
573 return NULL;
574}
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:729
#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 584 of file plugin_dhtu_gnunet.c.

585{
586 struct GNUNET_DHTU_PluginFunctions *api;
587 struct Plugin *plugin;
589 GNUNET_MQ_hd_var_size (core_message,
592 NULL),
594 };
595
596 plugin = GNUNET_new (struct Plugin);
598 env->cfg);
599 plugin->env = env;
601 api->cls = plugin;
603 api->hold = &gnunet_hold;
604 api->drop = &gnunet_drop;
605 api->send = &gnunet_send;
606 plugin->peerstore = GNUNET_PEERSTORE_connect (env->cfg);
607 plugin->transport = GNUNET_TRANSPORT_application_init (env->cfg);
608 plugin->core = GNUNET_CORE_connect (env->cfg,
609 plugin,
613 handlers);
614 plugin->nse = GNUNET_NSE_connect (env->cfg,
615 &nse_cb,
616 plugin);
617 if ( (NULL == plugin->transport) ||
618 (NULL == plugin->core) ||
619 (NULL == plugin->nse) )
620 {
621 GNUNET_break (0);
622 DHTU_gnunet_done (api);
623 return NULL;
624 }
625 // GPI_plugins_load (env->cfg);
626 return api;
627}
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)
Connect to the core service.
Definition: core_api.c:691
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.
void * DHTU_gnunet_done(struct GNUNET_DHTU_PluginFunctions *api)
Exit point from the plugin.
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 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).
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_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, 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: