gnunet-ext

Template for writing GNUnet extensions
Log | Files | Refs | README | LICENSE

commit d299b411ec72826aa87f629b52d07cdc5fc4ad29
parent 394dd1a50989a7096511a604ff0d8a0a7f8a5fe2
Author: Alessio Vanni <vannilla@firemail.cc>
Date:   Sun,  8 Sep 2019 16:29:11 +0200

Add initialization to service

Signed-off-by: Christian Grothoff <christian@grothoff.org>

Diffstat:
Msrc/ext/gnunet-service-ext.c | 32++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+), 0 deletions(-)

diff --git a/src/ext/gnunet-service-ext.c b/src/ext/gnunet-service-ext.c @@ -68,6 +68,38 @@ struct ClientContext */ static const struct GNUNET_CONFIGURATION_Handle *cfg; +/** + * This structure holds informations about the project. + */ +static const struct GNUNET_OS_ProjectData gnunetext_pd = +{ + .libname = "libgnunetext", + .project_dirname = "gnunet-ext", + .binary_name = "gnunet-service-ext", + .env_varname = "GNUNET_EXT_PREFIX", + .base_config_varname = "GNUNET_EXT_BASE_CONFIG", + .bug_email = "gnunet-developers@gnu.org", + .homepage = "http://www.gnu.org/s/gnunet/", + .config_file = "gnunet-ext.conf", + .user_config_file = "~/.config/gnunet-ext.conf", + .version = "1.0", + .is_gnu = 1, + .gettext_domain = PACKAGE, + .gettext_path = NULL, +}; + +/** + * Initialize the project with the data set in the + * GNUNET_OS_ProjectData structure. This is defined with + * __attribute__ ((constructor)) because it has to be called before + * the main function (implicitly defined by GNUNET_SERVICE_MAIN.) + * Other "pre-main" initialization can be performed here too. + */ +static void __attribute__ ((constructor)) +project_data_initialize (void) +{ + GNUNET_OS_init (&gnunetext_pd); +} /** * Handle EXT-message.