From d299b411ec72826aa87f629b52d07cdc5fc4ad29 Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Sun, 8 Sep 2019 16:29:11 +0200 Subject: Add initialization to service Signed-off-by: Christian Grothoff --- src/ext/gnunet-service-ext.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/ext/gnunet-service-ext.c b/src/ext/gnunet-service-ext.c index 4ebcdf2..83cbd52 100644 --- 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. -- cgit v1.2.3