Start command-line programs. More...
Macros | |
#define | GNUNET_DAEMON_MAIN(daemon_name, daemon_help, init_cb) |
Typedefs | |
typedef void(* | GNUNET_PROGRAM_Main) (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Main function that will be run. More... | |
Functions | |
enum GNUNET_GenericReturnValue | GNUNET_PROGRAM_run2 (const struct GNUNET_OS_ProjectData *pd, int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls, int run_without_scheduler) |
Run a standard GNUnet command startup sequence (initialize loggers and configuration, parse options). More... | |
enum GNUNET_GenericReturnValue | GNUNET_PROGRAM_run (const struct GNUNET_OS_ProjectData *pd, int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls) |
Run a standard GNUnet command startup sequence (initialize loggers and configuration, parse options). More... | |
enum GNUNET_GenericReturnValue | GNUNET_DAEMON_register (const char *daemon_name, const char *daemon_desc, GNUNET_PROGRAM_Main task) |
void | GNUNET_PROGRAM_monolith_main (const struct GNUNET_OS_ProjectData *pd, int argc, char *const *argv, struct GNUNET_CONFIGURATION_Handle *cfg) |
Start all services and daemons in a single process. More... | |
enum GNUNET_GenericReturnValue | GNUNET_PROGRAM_conf_and_options (const struct GNUNET_OS_ProjectData *pd, int argc, char *const *argv, struct GNUNET_CONFIGURATION_Handle *cfg) |
Create configuration handle from options and configuration file. More... | |
void | GNUNET_DAEMON_main (const struct GNUNET_OS_ProjectData *pd, int argc, char *const *argv, struct GNUNET_CONFIGURATION_Handle *cfg, enum GNUNET_GenericReturnValue with_scheduler) |
Run the mainloop in a monolithic libgnunet. More... | |
Start command-line programs.
#define GNUNET_DAEMON_MAIN | ( | daemon_name, | |
daemon_help, | |||
init_cb | |||
) |
Definition at line 150 of file gnunet_program_lib.h.
typedef void(* GNUNET_PROGRAM_Main) (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Main function that will be run.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 64 of file gnunet_program_lib.h.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run2 | ( | const struct GNUNET_OS_ProjectData * | pd, |
int | argc, | ||
char *const * | argv, | ||
const char * | binaryName, | ||
const char * | binaryHelp, | ||
const struct GNUNET_GETOPT_CommandLineOption * | options, | ||
GNUNET_PROGRAM_Main | task, | ||
void * | task_cls, | ||
int | run_without_scheduler | ||
) |
Run a standard GNUnet command startup sequence (initialize loggers and configuration, parse options).
pd | project data for the project the program belongs to |
argc | number of command line arguments in argv |
argv | command line arguments |
binaryName | our expected name |
binaryHelp | help text for the program |
options | command line options |
task | main function to run |
task_cls | closure for task |
run_without_scheduler | GNUNET_NO start the scheduler, GNUNET_YES do not start the scheduler just run the main task |
Definition at line 132 of file program.c.
References _, CommandContext::args, bindtextdomain, cfg, CommandContext::cfg, CommandContext::cfgfile, cleanup(), cmd_sorter(), GNUNET_OS_ProjectData::config_file, getenv(), GNUNET_OS_ProjectData::gettext_domain, GNUNET_OS_ProjectData::gettext_path, GNUNET_array_append, GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_default_filename(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_have_value(), GNUNET_CONFIGURATION_load(), GNUNET_CONFIGURATION_set_value_string(), GNUNET_DISK_file_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_GETOPT_option_cfgfile(), GNUNET_GETOPT_option_help(), GNUNET_GETOPT_option_logfile(), GNUNET_GETOPT_option_loglevel(), GNUNET_GETOPT_option_version(), GNUNET_GETOPT_run(), GNUNET_log, GNUNET_log_setup(), GNUNET_memcpy, GNUNET_new_array, GNUNET_NO, GNUNET_OK, GNUNET_OS_installation_get_path(), GNUNET_OS_IPK_LOCALEDIR, GNUNET_RESOLVER_connect(), GNUNET_SCHEDULER_run(), GNUNET_strdup, GNUNET_SYSERR, GNUNET_TIME_set_offset(), GNUNET_YES, name, GNUNET_GETOPT_CommandLineOption::name, options, program_main(), ret, GNUNET_GETOPT_CommandLineOption::shortName, CommandContext::task, CommandContext::task_cls, textdomain, GNUNET_OS_ProjectData::user_config_file, and GNUNET_OS_ProjectData::version.
Referenced by GNUNET_PROGRAM_run(), and main().
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run | ( | const struct GNUNET_OS_ProjectData * | pd, |
int | argc, | ||
char *const * | argv, | ||
const char * | binaryName, | ||
const char * | binaryHelp, | ||
const struct GNUNET_GETOPT_CommandLineOption * | options, | ||
GNUNET_PROGRAM_Main | task, | ||
void * | task_cls | ||
) |
Run a standard GNUnet command startup sequence (initialize loggers and configuration, parse options).
pd | project data for the project the program belongs to |
argc | number of command line arguments |
argv | command line arguments |
binaryName | our expected name |
binaryHelp | helptext for "-h" option (about the app) |
options | command line options |
task | main function to run |
task_cls | closure for task |
Definition at line 407 of file program.c.
References GNUNET_NO, GNUNET_PROGRAM_run2(), and options.
Referenced by GNUNET_TRANSPORT_TESTING_connect_check(), and main().
enum GNUNET_GenericReturnValue GNUNET_DAEMON_register | ( | const char * | daemon_name, |
const char * | daemon_desc, | ||
GNUNET_PROGRAM_Main | task | ||
) |
Definition at line 683 of file program.c.
References DaemonHandleList::d, DaemonHandleList::daemon_name, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_new, GNUNET_OK, hll_head, hll_tail, and LOG.
void GNUNET_PROGRAM_monolith_main | ( | const struct GNUNET_OS_ProjectData * | pd, |
int | argc, | ||
char *const * | argv, | ||
struct GNUNET_CONFIGURATION_Handle * | cfg | ||
) |
Start all services and daemons in a single process.
pd | project data for the project the program belongs to |
argc | number of command line arguments |
argv | command line arguments |
Definition at line 582 of file program.c.
References cfg, GNUNET_PROGRAM_conf_and_options(), GNUNET_SCHEDULER_run(), GNUNET_YES, mc, monolith_main(), GNUNET_CONFIGURATION_Handle::pd, and MonoContext::pd.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_conf_and_options | ( | const struct GNUNET_OS_ProjectData * | pd, |
int | argc, | ||
char *const * | argv, | ||
struct GNUNET_CONFIGURATION_Handle * | cfg | ||
) |
Create configuration handle from options and configuration file.
pd | project data for the project the program belongs to |
argc | number of command line arguments |
argv | command line arguments |
Definition at line 429 of file program.c.
References _, cfg, cfg_filename, GNUNET_OS_ProjectData::config_file, DIR_SEPARATOR_STR, getenv(), gettext_noop, GNUNET_asprintf(), GNUNET_break, GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_load(), GNUNET_DISK_file_test(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_GETOPT_option_cfgfile(), GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_help(), GNUNET_GETOPT_option_logfile(), GNUNET_GETOPT_option_loglevel(), GNUNET_GETOPT_option_version(), GNUNET_GETOPT_run(), GNUNET_log, GNUNET_log_setup(), GNUNET_NO, GNUNET_OK, GNUNET_SPEEDUP_stop_(), GNUNET_strdup, GNUNET_SYSERR, GNUNET_YES, ret, GNUNET_OS_ProjectData::user_config_file, and GNUNET_OS_ProjectData::version.
Referenced by GNUNET_DAEMON_main(), GNUNET_PROGRAM_monolith_main(), and GNUNET_SERVICE_main().
void GNUNET_DAEMON_main | ( | const struct GNUNET_OS_ProjectData * | pd, |
int | argc, | ||
char *const * | argv, | ||
struct GNUNET_CONFIGURATION_Handle * | cfg, | ||
enum GNUNET_GenericReturnValue | with_scheduler | ||
) |
Run the mainloop in a monolithic libgnunet.
Must be called such that services are actually launched.
pd | project data for the project the program belongs to |
argc | number of command line arguments |
argv | command line arguments |
Definition at line 658 of file program.c.
References cfg, GNUNET_ERROR_TYPE_DEBUG, GNUNET_PROGRAM_conf_and_options(), GNUNET_SCHEDULER_run(), GNUNET_YES, launch_daemons(), LOG, and GNUNET_CONFIGURATION_Handle::pd.
Referenced by monolith_main().