Configuration management. More...
Data Structures | |
struct | GNUNET_CONFIGURATION_ConfigSettings |
Closure for GNUNET_CONFIGURATION_config_tool_run() with settings for what should be done with the configuration. More... | |
Macros | |
#define | GNUNET_CONFIGURATION_CONFIG_OPTIONS(cs) |
Macro that expands to a set of GNUNET-getopt directives to initialize a struct GNUNET_CONFIGURATION_ConfigSettings from the command line. More... | |
Typedefs | |
typedef enum GNUNET_GenericReturnValue(* | GNUNET_CONFIGURATION_Callback) (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Signature of a function to be run with a configuration. More... | |
typedef void(* | GNUNET_CONFIGURATION_Iterator) (void *cls, const char *section, const char *option, const char *value) |
Function to iterate over options. More... | |
typedef void(* | GNUNET_CONFIGURATION_SectionIterator) (void *cls, const char *section) |
Function to iterate over section. More... | |
Functions | |
struct GNUNET_CONFIGURATION_Handle * | GNUNET_CONFIGURATION_create (void) |
Create a new configuration object. More... | |
struct GNUNET_CONFIGURATION_Handle * | GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Duplicate an existing configuration object. More... | |
void | GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg) |
Destroy configuration object. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename) |
Load configuration. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, const char *defaults_d) |
Load default configuration. More... | |
struct GNUNET_CONFIGURATION_Handle * | GNUNET_CONFIGURATION_default (void) |
Return GNUnet's default configuration. More... | |
char * | GNUNET_CONFIGURATION_default_filename (void) |
Return the filename of the default configuration filename that is used when no explicit configuration entry point has been specified. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename) |
Parse a configuration file, add all of the options in the file to the configuration environment. More... | |
char * | GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size) |
Serializes the given configuration. More... | |
char * | GNUNET_CONFIGURATION_serialize_diagnostics (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Serializes the given configuration with diagnostics information. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, const char *mem, size_t size, const char *source_filename) |
De-serializes configuration. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename) |
Write configuration file. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_write_diffs (const struct GNUNET_CONFIGURATION_Handle *cfg_default, const struct GNUNET_CONFIGURATION_Handle *cfg_new, const char *filename) |
Write only configuration entries that have been changed to configuration file. More... | |
struct GNUNET_CONFIGURATION_Handle * | GNUNET_CONFIGURATION_get_diff (const struct GNUNET_CONFIGURATION_Handle *cfg_default, const struct GNUNET_CONFIGURATION_Handle *cfg_new) |
Compute configuration with only entries that have been changed. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Test if there are configuration options that were changed since the last save. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_parse_and_run (const char *filename, GNUNET_CONFIGURATION_Callback cb, void *cb_cls) |
Parse a configuration file filename and run the function cb with the resulting configuration object. More... | |
void | GNUNET_CONFIGURATION_enable_diagnostics (struct GNUNET_CONFIGURATION_Handle *cfg) |
Enable extra diagnostics. More... | |
void | GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CONFIGURATION_Iterator iter, void *iter_cls) |
Iterate over all options in the configuration. More... | |
void | GNUNET_CONFIGURATION_iterate_sections (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CONFIGURATION_SectionIterator iter, void *iter_cls) |
Iterate over all sections in the configuration. More... | |
void | GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cfg, const char *section) |
Remove the given section and all options in it. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number) |
Get a configuration value that should be a number. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_get_value_float (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, float *number) |
Get a configuration value that should be a floating point number. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time) |
Get a configuration value that should be a relative time. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_get_value_size (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *size) |
Get a configuration value that should be a size in bytes. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option) |
Test if we have a value for a particular option. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value) |
Get a configuration value that should be a string. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_get_value_filename (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value) |
Get a configuration value that should be the name of a file or directory. More... | |
int | GNUNET_CONFIGURATION_iterate_value_filenames (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, GNUNET_FileNameCallback cb, void *cb_cls) |
Iterate over the set of filenames stored in a configuration value. More... | |
void | GNUNET_CONFIGURATION_iterate_section_values (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, GNUNET_CONFIGURATION_Iterator iter, void *iter_cls) |
Iterate over values of a section in the configuration. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_get_value_choice (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, const char *const *choices, const char **value) |
Get a configuration value that should be in a set of predefined strings. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option) |
Get a configuration value that should be in a set of "YES" or "NO". More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_get_data (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, void *buf, size_t buf_size) |
Get Crockford32-encoded fixed-size binary data from a configuration. More... | |
char * | GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg, char *orig) |
Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" where either in the "PATHS" section or the environment "FOO" is set to "DIRECTORY". More... | |
void | GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long number) |
Set a configuration value that should be a number. More... | |
void | GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, const char *value) |
Set a configuration value that should be a string. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_remove_value_filename (struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, const char *value) |
Remove a filename from a configuration value that represents a list of filenames. More... | |
enum GNUNET_GenericReturnValue | GNUNET_CONFIGURATION_append_value_filename (struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, const char *value) |
Append a filename to a configuration value that represents a list of filenames. More... | |
void | GNUNET_CONFIGURATION_config_settings_free (struct GNUNET_CONFIGURATION_ConfigSettings *cs) |
Free resources associated with cs. More... | |
void | GNUNET_CONFIGURATION_config_tool_run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Main task to run to perform operations typical for gnunet-config as per the configuration settings given in cls. More... | |
Configuration management.
#define GNUNET_CONFIGURATION_CONFIG_OPTIONS | ( | cs | ) |
Macro that expands to a set of GNUNET-getopt directives to initialize a struct GNUNET_CONFIGURATION_ConfigSettings
from the command line.
cs | configuration settings to initialize |
Definition at line 716 of file gnunet_configuration_lib.h.
typedef enum GNUNET_GenericReturnValue(* GNUNET_CONFIGURATION_Callback) (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Signature of a function to be run with a configuration.
cls | closure |
cfg | the configuration |
Definition at line 223 of file gnunet_configuration_lib.h.
typedef void(* GNUNET_CONFIGURATION_Iterator) (void *cls, const char *section, const char *option, const char *value) |
Function to iterate over options.
cls | closure |
section | name of the section |
option | name of the option |
value | value of the option |
Definition at line 286 of file gnunet_configuration_lib.h.
typedef void(* GNUNET_CONFIGURATION_SectionIterator) (void *cls, const char *section) |
Function to iterate over section.
cls | closure |
section | name of the section |
Definition at line 299 of file gnunet_configuration_lib.h.
struct GNUNET_CONFIGURATION_Handle* GNUNET_CONFIGURATION_create | ( | void | ) |
Create a new configuration object.
Definition at line 223 of file configuration.c.
References cfg, GNUNET_CONFIGURATION_set_value_string(), GNUNET_free, GNUNET_new, GNUNET_OS_installation_get_path(), GNUNET_OS_IPK_BINDIR, GNUNET_OS_IPK_DATADIR, GNUNET_OS_IPK_DOCDIR, GNUNET_OS_IPK_ICONDIR, GNUNET_OS_IPK_LIBDIR, GNUNET_OS_IPK_LIBEXECDIR, GNUNET_OS_IPK_LOCALEDIR, GNUNET_OS_IPK_PREFIX, and p.
Referenced by auto_config_cb(), callback_scan_for_rooms(), create_unique_cfgs(), gg_load_configuration(), GNUNET_ATS_solvers_experimentation_load(), GNUNET_CONFIGURATION_config_tool_run(), GNUNET_CONFIGURATION_default(), GNUNET_CONFIGURATION_dup(), GNUNET_CONFIGURATION_get_diff(), GNUNET_CRYPTO_eddsa_setup_key(), GNUNET_SERVICE_run_(), GNUNET_TESTBED_barrier_wait(), GNUNET_TESTBED_extract_config_(), GNUNET_TESTING_service_run(), GNUNET_TESTING_system_create_with_portrange(), GNUNET_TRANSPORT_TESTING_start_peer(), GNUNET_TRANSPORT_TESTING_transport_communicator_service_start(), handle_auto_result(), handle_autoconfig_request(), helper_mst(), iter_check_config(), iterate_save_rooms(), LEGACY_SERVICE_run(), load_member(), load_member_session(), load_member_session_next(), load_operation(), main(), run(), save_member(), save_operation(), start_peer_run(), and tokenizer_cb().
struct GNUNET_CONFIGURATION_Handle* GNUNET_CONFIGURATION_dup | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Duplicate an existing configuration object.
cfg | configuration to duplicate |
Definition at line 1529 of file configuration.c.
References cfg, copy_entry(), GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_iterate(), and ret.
Referenced by associate_shared_service(), auto_config_cb(), controller_status_cb(), create_unique_cfgs(), GNUNET_CONFIGURATION_config_tool_run(), GNUNET_NAT_autoconfig_start(), GNUNET_TESTBED_controller_connect(), GNUNET_TESTBED_host_create_with_id(), GNUNET_TESTBED_host_replace_cfg_(), GNUNET_TESTBED_run(), GNUNET_TESTING_peer_configure(), GST_connection_pool_get_handle(), handle_autoconfig_request(), run(), set_cont(), and testbed_run().
void GNUNET_CONFIGURATION_destroy | ( | struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Destroy configuration object.
cfg | configuration to destroy |
Definition at line 308 of file configuration.c.
Referenced by associate_shared_service(), auto_config_cb(), callback_scan_for_rooms(), clean_node(), cleanup(), cleanup_prc(), conclude_autoconfig_request(), controller_status_cb(), create_unique_cfgs(), destroy_pooled_connection(), do_shutdown(), GNUNET_ATS_solvers_experimentation_load(), GNUNET_ATS_solvers_experimentation_stop(), GNUNET_CONFIGURATION_config_tool_run(), GNUNET_CONFIGURATION_default(), GNUNET_CRYPTO_eddsa_setup_key(), GNUNET_NAT_autoconfig_cancel(), GNUNET_SERVICE_run_(), GNUNET_TESTBED_barrier_wait(), GNUNET_TESTBED_barrier_wait_cancel(), GNUNET_TESTBED_controller_disconnect(), GNUNET_TESTBED_host_destroy(), GNUNET_TESTBED_host_replace_cfg_(), GNUNET_TESTBED_run(), GNUNET_TESTING_peer_destroy(), GNUNET_TESTING_service_run(), GNUNET_TESTING_system_destroy(), GNUNET_TRANSPORT_TESTING_start_peer(), GNUNET_TRANSPORT_TESTING_stop_peer(), GNUNET_TRANSPORT_TESTING_transport_communicator_service_start(), GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop(), GST_destroy_peer(), GST_destroy_peers(), handle_add_host(), handle_auto_result(), handle_autoconfig_request(), handle_link_controllers_result(), helper_mst(), iterate_save_rooms(), LEGACY_SERVICE_run(), load_member(), load_member_session(), load_member_session_next(), load_operation(), main(), next_phase(), oprelease_get_slave_config(), oprelease_peer_getinfo(), oprelease_service_connect(), save_member(), save_operation(), shutdown_task(), start_peer_run(), tokenizer_cb(), and update_peer_config().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_load | ( | struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | filename | ||
) |
Load configuration.
This function will first parse the defaults and then parse the specific configuration file to overwrite the defaults.
cfg | configuration to update |
filename | name of the configuration file, NULL to load defaults |
Load configuration.
cfg | configuration to update |
filename | name of the configuration file, NULL to load defaults |
Definition at line 2421 of file configuration.c.
Referenced by auto_config_cb(), create_unique_cfgs(), gg_load_configuration(), GNUNET_ATS_solvers_experimentation_load(), GNUNET_CONFIGURATION_config_tool_run(), GNUNET_CONFIGURATION_default(), GNUNET_CRYPTO_eddsa_setup_key(), GNUNET_SERVICE_run_(), GNUNET_TESTBED_barrier_wait(), GNUNET_TESTING_service_run(), GNUNET_TRANSPORT_TESTING_start_peer(), GNUNET_TRANSPORT_TESTING_transport_communicator_service_start(), iter_check_config(), LEGACY_SERVICE_run(), main(), and start_peer_run().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_load_from | ( | struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | defaults_d | ||
) |
Load default configuration.
This function will parse the defaults from the given defaults_d directory.
cfg | configuration to update |
defaults_d | directory with the defaults |
Definition at line 2161 of file configuration.c.
struct GNUNET_CONFIGURATION_Handle* GNUNET_CONFIGURATION_default | ( | void | ) |
Return GNUnet's default configuration.
A new configuration is allocated each time and it's up to the caller to destroy it when done. This function returns GNUnet's configuration even when GNUNET_OS_init has been called with a value different from GNUNET_OS_project_data_default.
Definition at line 2421 of file configuration.c.
References cfg, GNUNET_OS_ProjectData::config_file, getenv(), GNUNET_asprintf(), GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_load(), GNUNET_DISK_file_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_OK, GNUNET_OS_init(), GNUNET_OS_project_data_default(), GNUNET_OS_project_data_get(), GNUNET_strdup, LOG, GNUNET_OS_ProjectData::project_dirname, and GNUNET_OS_ProjectData::user_config_file.
char* GNUNET_CONFIGURATION_default_filename | ( | void | ) |
Return the filename of the default configuration filename that is used when no explicit configuration entry point has been specified.
Definition at line 2379 of file configuration.c.
References GNUNET_OS_ProjectData::config_file, DIR_SEPARATOR_STR, getenv(), GNUNET_asprintf(), GNUNET_DISK_file_test_read(), GNUNET_free, GNUNET_OK, GNUNET_OS_project_data_get(), GNUNET_strdup, GNUNET_OS_ProjectData::project_dirname, and GNUNET_OS_ProjectData::user_config_file.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_parse | ( | struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | filename | ||
) |
Parse a configuration file, add all of the options in the file to the configuration environment.
cfg | configuration to update |
filename | name of the configuration file |
Definition at line 684 of file configuration.c.
Referenced by callback_scan_for_rooms(), load_member(), load_member_session(), load_member_session_next(), load_operation(), and run().
char* GNUNET_CONFIGURATION_serialize | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
size_t * | size | ||
) |
Serializes the given configuration.
cfg | configuration to serialize |
size | will be set to the size of the serialized memory block |
Definition at line 1129 of file configuration.c.
References cfg, do_skip(), GNUNET_asprintf(), GNUNET_assert, GNUNET_free, GNUNET_malloc, GNUNET_memcpy, len, ConfigEntry::next, ConfigSection::next, GNUNET_CONFIGURATION_Handle::sections, and size.
Referenced by conclude_autoconfig_request(), GNUNET_NAT_AUTO_autoconfig_start(), GNUNET_TESTBED_compress_cfg_(), GNUNET_TESTBED_create_helper_init_msg_(), GNUNET_TESTBED_peer_update_configuration(), GNUNET_TESTBED_register_host(), handle_peer_get_config(), handle_slave_get_config(), opstart_peer_create(), and tokenizer_cb().
char* GNUNET_CONFIGURATION_serialize_diagnostics | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Serializes the given configuration with diagnostics information.
Diagnostics information will only be available if diagnostics have been enabled before parsing.
cfg | configuration to serialize |
Definition at line 1227 of file configuration.c.
References buf, cfg, do_skip(), GNUNET_buffer_reap_str(), GNUNET_buffer_write_fstr(), GNUNET_buffer_write_str(), GNUNET_free, GNUNET_malloc, GNUNET_CONFIGURATION_Handle::loaded_files_head, GNUNET_CONFIGURATION_Handle::main_filename, ConfigEntry::next, ConfigSection::next, ConfigFile::next, and GNUNET_CONFIGURATION_Handle::sections.
Referenced by GNUNET_CONFIGURATION_config_tool_run().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_deserialize | ( | struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | mem, | ||
size_t | size, | ||
const char * | source_filename | ||
) |
De-serializes configuration.
cfg | configuration to update |
mem | the memory block of serialized configuration |
size | the size of the memory block |
source_filename | source filename, will be used to resolve relative @INLINE@ statements |
Definition at line 684 of file configuration.c.
References cfg, GNUNET_CONFIGURATION_Handle::diagnostics, e, find_entry(), GNUNET_strdup, and ConfigEntry::hint_filename.
Referenced by GNUNET_TESTBED_extract_config_(), handle_auto_result(), handle_autoconfig_request(), helper_mst(), and tokenizer_cb().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_write | ( | struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | filename | ||
) |
Write configuration file.
cfg | configuration to write |
filename | where to write the configuration |
Definition at line 1227 of file configuration.c.
Referenced by associate_shared_service(), create_unique_cfgs(), GNUNET_CONFIGURATION_config_tool_run(), GNUNET_TESTING_peer_configure(), handle_delete_message(), handle_rename_message(), iterate_save_rooms(), save_member(), save_operation(), set_cont(), testing_main(), and tokenizer_cb().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_write_diffs | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg_default, |
const struct GNUNET_CONFIGURATION_Handle * | cfg_new, | ||
const char * | filename | ||
) |
Write only configuration entries that have been changed to configuration file.
cfg_default | default configuration |
cfg_new | new configuration |
filename | where to write the configuration diff between default and new |
Definition at line 1570 of file configuration.c.
Referenced by auto_config_cb(), GNUNET_CONFIGURATION_config_tool_run(), and main().
struct GNUNET_CONFIGURATION_Handle* GNUNET_CONFIGURATION_get_diff | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg_default, |
const struct GNUNET_CONFIGURATION_Handle * | cfg_new | ||
) |
Compute configuration with only entries that have been changed.
cfg_default | original configuration |
cfg_new | new configuration |
Definition at line 1570 of file configuration.c.
References DiffHandle::cfg_default, DiffHandle::cfgDiff, compare_entries(), GNUNET_CONFIGURATION_create(), and GNUNET_CONFIGURATION_iterate().
Referenced by conclude_autoconfig_request(), and next_phase().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_is_dirty | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Test if there are configuration options that were changed since the last save.
cfg | configuration to inspect |
Definition at line 684 of file configuration.c.
Referenced by auto_config_cb().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_parse_and_run | ( | const char * | filename, |
GNUNET_CONFIGURATION_Callback | cb, | ||
void * | cb_cls | ||
) |
Parse a configuration file filename and run the function cb with the resulting configuration object.
Then free the configuration object and return the status value from cb.
filename | configuration to parse, NULL for "default" |
cb | function to run |
cb_cls | closure for cb |
Definition at line 308 of file configuration.c.
Referenced by GNUNET_DISK_purge_cfg_dir().
void GNUNET_CONFIGURATION_enable_diagnostics | ( | struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Enable extra diagnostics.
Will produce more log output and allocate more memory.
cfg | configuration handle |
Definition at line 215 of file configuration.c.
References cfg, and GNUNET_CONFIGURATION_Handle::diagnostics.
Referenced by GNUNET_CONFIGURATION_config_tool_run().
void GNUNET_CONFIGURATION_iterate | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
GNUNET_CONFIGURATION_Iterator | iter, | ||
void * | iter_cls | ||
) |
Iterate over all options in the configuration.
cfg | configuration to inspect |
iter | function to call on each option |
iter_cls | closure for iter |
Definition at line 1398 of file configuration.c.
References cfg, ConfigEntry::next, ConfigSection::next, and GNUNET_CONFIGURATION_Handle::sections.
Referenced by get_cont(), GNUNET_CONFIGURATION_dup(), GNUNET_CONFIGURATION_get_diff(), and GNUNET_TESTING_configuration_create_().
void GNUNET_CONFIGURATION_iterate_sections | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
GNUNET_CONFIGURATION_SectionIterator | iter, | ||
void * | iter_cls | ||
) |
Iterate over all sections in the configuration.
cfg | configuration to inspect |
iter | function to call on each section |
iter_cls | closure for iter |
Definition at line 1446 of file configuration.c.
References cfg, ConfigSection::name, ConfigSection::next, and GNUNET_CONFIGURATION_Handle::sections.
Referenced by GNUNET_CONFIGURATION_config_tool_run(), GNUNET_TESTING_configuration_create_(), handle_delete_message(), handle_rename_message(), and run().
void GNUNET_CONFIGURATION_remove_section | ( | struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section | ||
) |
Remove the given section and all options in it.
cfg | configuration to inspect |
section | name of the section to remove |
Definition at line 1465 of file configuration.c.
References cfg, GNUNET_CONFIGURATION_Handle::dirty, ConfigSection::entries, GNUNET_free, GNUNET_YES, ConfigEntry::hint_filename, ConfigSection::hint_inlined_from_filename, ConfigSection::hint_secret_filename, ConfigSection::hint_secret_stat, ConfigEntry::key, ConfigSection::name, ConfigEntry::next, ConfigSection::next, GNUNET_CONFIGURATION_Handle::sections, and ConfigEntry::val.
Referenced by collect_files_cb(), and GNUNET_TESTING_peer_configure().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option, | ||
unsigned long long * | number | ||
) |
Get a configuration value that should be a number.
cfg | configuration to inspect |
section | section of interest |
option | option of interest |
number | where to store the numeric value of the option |
Definition at line 1642 of file configuration.c.
Referenced by client_configure_plugin(), event_cb(), GCD_init(), GCO_init(), get_server_addresses(), GNUNET_ATS_solvers_load_quotas(), GNUNET_CLIENT_connect(), GNUNET_CLIENT_test(), GNUNET_HOSTLIST_server_start(), GNUNET_NAT_AUTO_test_start(), GNUNET_REVOCATION_revoke(), GNUNET_SERVICE_run_(), GNUNET_SOCKS_do_connect(), GNUNET_TESTBED_controller_connect(), GNUNET_TESTBED_run(), GNUNET_TRANSPORT_communicator_connect(), GSF_cadet_start_server(), GSF_pending_request_init_(), GST_plugins_load(), LEGACY_SERVICE_get_server_addresses(), LEGACY_SERVICE_run(), libgnunet_plugin_block_revocation_init(), libgnunet_plugin_datastore_heap_init(), libgnunet_plugin_dhtu_ip_init(), libgnunet_plugin_transport_tcp_init(), libgnunet_plugin_transport_udp_init(), load_member_session(), load_op_add_address(), load_op_del_address(), load_op_start_request(), load_op_start_set_preference(), load_op_start_set_property(), load_op_stop_request(), load_op_stop_set_preference(), load_op_stop_set_property(), load_operation(), run(), run_service(), server_configure_plugin(), server_get_addresses(), setup_exit_helper_args(), test_service_configuration(), test_stun(), testbed_run(), and update_config().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_float | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option, | ||
float * | number | ||
) |
Get a configuration value that should be a floating point number.
cfg | configuration to inspect |
section | section of interest |
option | option of interest |
number | where to store the floating value of the option |
Definition at line 1642 of file configuration.c.
Referenced by GNUNET_RPS_connect(), and libgnunet_plugin_ats_proportional_init().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_time | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option, | ||
struct GNUNET_TIME_Relative * | time | ||
) |
Get a configuration value that should be a relative time.
cfg | configuration to inspect |
section | section of interest |
option | option of interest |
time | set to the time value stored in the configuration |
Definition at line 1642 of file configuration.c.
Referenced by GCD_init(), GNUNET_ATS_solvers_experimentation_load(), GNUNET_REVOCATION_revoke(), GNUNET_SPEEDUP_start_(), GNUNET_TESTBED_run(), GSF_push_init_(), GST_manipulation_init(), libgnunet_plugin_block_revocation_init(), libgnunet_plugin_rest_openid_connect_init(), libgnunet_plugin_transport_tcp_init(), libgnunet_plugin_transport_udp_init(), load_episodes(), load_op_start_set_preference(), load_op_start_set_property(), RECLAIM_TICKETS_init(), run(), run_service(), setup_service(), testbed_run(), and token_endpoint().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_size | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option, | ||
unsigned long long * | size | ||
) |
Get a configuration value that should be a size in bytes.
cfg | configuration to inspect |
section | section of interest |
option | option of interest |
size | set to the size in bytes as stored in the configuration |
Definition at line 1642 of file configuration.c.
Referenced by GNUNET_DATACACHE_create(), and run().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_have_value | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option | ||
) |
Test if we have a value for a particular option.
cfg | configuration to inspect |
section | section of interest |
option | option of interest |
Definition at line 1642 of file configuration.c.
Referenced by check_config(), get_server_addresses(), GNUNET_CLIENT_connect(), GNUNET_CLIENT_test(), GNUNET_HOSTLIST_server_start(), GNUNET_SERVICE_run_(), GNUNET_SOCKS_check_service(), GNUNET_TESTBED_run(), GNUNET_TESTING_peer_configure(), LEGACY_SERVICE_get_server_addresses(), LEGACY_SERVICE_run(), LEGACY_SERVICE_stop(), process_acl4(), process_acl6(), server_configure_plugin(), server_get_addresses(), setup_service(), test_service_configuration(), and update_config_sections().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option, | ||
char ** | value | ||
) |
Get a configuration value that should be a string.
cfg | configuration to inspect |
section | section of interest |
option | option of interest |
value | will be set to a freshly allocated configuration value, or NULL if option is not specified |
Definition at line 1642 of file configuration.c.
Referenced by advertise_dns_exit(), check_authorization(), check_config(), client_configure_plugin(), client_connect_cb(), communicator_start(), expand_dollar(), GAS_plugin_init(), get_bootstrap_server(), get_server_addresses(), gg_load_configuration(), GNUNET_ATS_solvers_experimentation_load(), GNUNET_ATS_solvers_load_quotas(), GNUNET_CLIENT_connect(), GNUNET_CLIENT_test(), GNUNET_CONFIGURATION_config_tool_run(), GNUNET_CONFIGURATION_iterate_value_filenames(), GNUNET_CONVERSATION_phone_create(), GNUNET_DATACACHE_create(), GNUNET_FS_unindex_do_extract_keywords_(), GNUNET_GNS_lookup_with_tld(), GNUNET_HOSTLIST_client_start(), GNUNET_HOSTLIST_server_start(), GNUNET_OS_check_helper_binary(), GNUNET_PQ_connect_with_cfg2(), GNUNET_SERVICE_run_(), GNUNET_SOCKS_do_connect(), GNUNET_TESTBED_run(), GNUNET_TESTING_peer_configure(), GNUNET_TESTING_service_run(), GPI_plugins_load(), GST_plugins_load(), handle_ego_delete(), handle_ego_rename(), handle_init(), handle_register(), handle_uri(), identity_continuation(), LEGACY_SERVICE_get_server_addresses(), LEGACY_SERVICE_run(), LEGACY_SERVICE_stop(), libgnunet_plugin_dhtu_ip_init(), libgnunet_plugin_transport_udp_init(), load_episode(), load_member_session(), load_member_session_next(), load_op_add_address(), load_op_del_address(), load_op_start_set_preference(), load_op_start_set_property(), load_op_stop_set_preference(), load_op_stop_set_property(), load_quota(), login_redirect(), mq_init(), print_quotas(), process_acl4(), process_acl6(), read_service_conf(), run(), server_configure_plugin(), server_get_addresses(), setup_exit_helper_args(), setup_service(), sock_read(), start_process(), test_icmp_client(), test_icmp_server(), test_service_configuration(), testbed_run(), token_endpoint(), and update_config_sections().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option, | ||
char ** | value | ||
) |
Get a configuration value that should be the name of a file or directory.
cfg | configuration to inspect |
section | section of interest |
option | option of interest |
value | will be set to a freshly allocated configuration value, or NULL if option is not specified |
Definition at line 2017 of file configuration.c.
Referenced by create_service(), database_setup(), get_oidc_dir_path(), get_pid_file_name(), get_serialization_file_name(), get_serialization_file_name_in_dir(), get_server_addresses(), get_update_information_directory(), get_user_name(), GNUNET_ATS_solvers_experimentation_load(), GNUNET_CLIENT_test(), GNUNET_CONFIGURATION_config_tool_run(), GNUNET_CRYPTO_eddsa_key_create_from_configuration(), GNUNET_FRIENDS_parse(), GNUNET_FRIENDS_write_start(), GNUNET_HOSTLIST_client_start(), GNUNET_PQ_connect_with_cfg2(), GNUNET_TESTBED_controller_start(), GNUNET_TESTBED_is_host_habitable(), GNUNET_TESTBED_run(), GNUNET_TESTING_peer_configure(), GST_stats_init(), LEGACY_SERVICE_get_server_addresses(), libgnunet_plugin_transport_unix_init(), load(), load_hostlist_file(), logger_run(), main_init(), new_sub(), print_filename_option(), read_index_list(), run(), run_service(), save(), save_hostlist_file(), setup_service(), test_service_configuration(), testbed_run(), tokenizer_cb(), try_unixpath(), write_index_list(), and write_proof().
int GNUNET_CONFIGURATION_iterate_value_filenames | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option, | ||
GNUNET_FileNameCallback | cb, | ||
void * | cb_cls | ||
) |
Iterate over the set of filenames stored in a configuration value.
cfg | configuration to inspect |
section | section of interest |
option | option of interest |
cb | function to call on each filename |
cb_cls | closure for cb |
Definition at line 2087 of file configuration.c.
References cfg, end, GNUNET_assert, GNUNET_CONFIGURATION_get_value_string(), GNUNET_free, GNUNET_OK, GNUNET_SYSERR, list, and ret.
void GNUNET_CONFIGURATION_iterate_section_values | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
GNUNET_CONFIGURATION_Iterator | iter, | ||
void * | iter_cls | ||
) |
Iterate over values of a section in the configuration.
cfg | configuration to inspect |
section | the section |
iter | function to call on each option |
iter_cls | closure for iter |
Definition at line 1417 of file configuration.c.
References cfg, ConfigSection::entries, GNUNET_ERROR_TYPE_WARNING, ConfigSection::inaccessible, ConfigEntry::key, LOG, ConfigSection::name, ConfigEntry::next, ConfigSection::next, GNUNET_CONFIGURATION_Handle::sections, and ConfigEntry::val.
Referenced by associate_shared_service(), authorize_endpoint(), auto_config_cb(), get_cont(), GNUNET_CONFIGURATION_config_tool_run(), GNUNET_TESTING_system_create_with_portrange(), read_blacklist_configuration(), and run().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_choice | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option, | ||
const char *const * | choices, | ||
const char ** | value | ||
) |
Get a configuration value that should be in a set of predefined strings.
cfg | configuration to inspect |
section | section of interest |
option | option of interest |
choices | NULL-terminated list of legal values |
value | will be set to an entry in the legal list, or NULL if option is not specified and no default given |
Definition at line 1642 of file configuration.c.
Referenced by start_process().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_yesno | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option | ||
) |
Get a configuration value that should be in a set of "YES" or "NO".
cfg | configuration to inspect |
section | section of interest |
option | option of interest |
Definition at line 2017 of file configuration.c.
Referenced by advertise_dns_exit(), client_configure_plugin(), create_listen_socket(), get_server_addresses(), gg_load_configuration(), GNS_resolver_init(), GNUNET_ATS_solvers_experimentation_load(), GNUNET_CONNECTION_create_from_connect_to_unixpath(), GNUNET_DATACACHE_create(), GNUNET_STATISTICS_create(), GNUNET_TRANSPORT_TESTING_transport_communicator_service_start(), GSF_pending_request_init_(), GSF_push_init_(), LEGACY_SERVICE_get_server_addresses(), libgnunet_plugin_datacache_sqlite_init(), libgnunet_plugin_transport_http_client_init(), libgnunet_plugin_transport_tcp_init(), libgnunet_plugin_transport_udp_init(), libgnunet_plugin_transport_unix_init(), load_underlay(), main_init(), parse_ip_options(), run(), server_configure_plugin(), setup_broadcast(), setup_service(), sign_ephemeral_key(), start_process(), tcp_address_to_sockaddr_port_only(), test_icmp_client(), test_icmp_server(), test_master(), udp_address_to_sockaddr(), and update_config().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_data | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option, | ||
void * | buf, | ||
size_t | buf_size | ||
) |
Get Crockford32-encoded fixed-size binary data from a configuration.
cfg | configuration to access |
section | section to access |
option | option to access |
buf | where to store the decoded binary result |
buf_size | exact number of bytes to store in buf |
Definition at line 1642 of file configuration.c.
References cfg, GNUNET_CONFIGURATION_set_value_string(), GNUNET_snprintf(), and number.
Referenced by callback_scan_for_rooms(), load_member(), load_member_session_next(), and load_operation().
char* GNUNET_CONFIGURATION_expand_dollar | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
char * | orig | ||
) |
Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" where either in the "PATHS" section or the environment "FOO" is set to "DIRECTORY".
We also support default expansion, i.e. ${VARIABLE:-default} will expand to $VARIABLE if VARIABLE is set in PATHS or the environment, and otherwise to "default". Note that "default" itself can also be a $-expression, thus "${VAR1:-{$VAR2}}" will expand to VAR1 and if that is not defined to VAR2.
cfg | configuration to use for path expansion |
orig | string to $-expand (will be freed!) Note that multiple $-expressions can be present in this string. They will all be $-expanded. |
Definition at line 2017 of file configuration.c.
References cfg, expand_dollar(), GNUNET_assert, GNUNET_free, GNUNET_memcpy, GNUNET_realloc, GNUNET_strdup, and len.
Referenced by expand_dollar(), GNUNET_TESTING_peer_start(), run(), and start_process().
void GNUNET_CONFIGURATION_set_value_number | ( | struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option, | ||
unsigned long long | number | ||
) |
Set a configuration value that should be a number.
cfg | configuration to update |
section | section of interest |
option | option of interest |
number | value to set |
Definition at line 1642 of file configuration.c.
Referenced by handle_peer_create(), next_phase(), run(), save_operation(), and set_value().
void GNUNET_CONFIGURATION_set_value_string | ( | struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option, | ||
const char * | value | ||
) |
Set a configuration value that should be a string.
cfg | configuration to update |
section | section of interest |
option | option of interest |
value | value to set |
Definition at line 1600 of file configuration.c.
References cfg, e, ConfigSection::entries, find_entry(), find_section(), GNUNET_free, GNUNET_new, GNUNET_strdup, ConfigSection::name, ConfigSection::next, GNUNET_CONFIGURATION_Handle::sections, and value.
Referenced by associate_shared_service(), auto_conf_iter(), auto_config_cb(), cfg_copy_iterator(), compare_entries(), copy_entry(), GNUNET_CONFIGURATION_config_tool_run(), GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_get_data(), GNUNET_NAT_autoconfig_start(), GNUNET_TESTING_configuration_create_(), handle_ego_delete(), handle_ego_rename(), helper_mst(), identity_cb(), iterate_save_rooms(), next_phase(), process_if(), result_callback(), run(), save_member(), save_operation(), set_external_ipv4(), set_value(), start_peer_run(), test_local_ip(), test_upnpc(), update_config(), update_config_sections(), and update_enable_upnpc_option().
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_remove_value_filename | ( | struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option, | ||
const char * | value | ||
) |
Remove a filename from a configuration value that represents a list of filenames.
cfg | configuration to update |
section | section of interest |
option | option of interest |
value | filename to remove |
Definition at line 2161 of file configuration.c.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_append_value_filename | ( | struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section, | ||
const char * | option, | ||
const char * | value | ||
) |
Append a filename to a configuration value that represents a list of filenames.
cfg | configuration to update |
section | section of interest |
option | option of interest |
value | filename to append |
Definition at line 2161 of file configuration.c.
References GNUNET_malloc, and value.
void GNUNET_CONFIGURATION_config_settings_free | ( | struct GNUNET_CONFIGURATION_ConfigSettings * | cs | ) |
Free resources associated with cs.
[in] | cs | settings to free (actual memory of cs itself is not released) |
Definition at line 294 of file configuration_helper.c.
References GNUNET_free, GNUNET_CONFIGURATION_ConfigSettings::option, GNUNET_CONFIGURATION_ConfigSettings::section, and GNUNET_CONFIGURATION_ConfigSettings::value.
Referenced by main().
void GNUNET_CONFIGURATION_config_tool_run | ( | void * | cls, |
char *const * | args, | ||
const char * | cfgfile, | ||
const struct GNUNET_CONFIGURATION_Handle * | cfg | ||
) |
Main task to run to perform operations typical for gnunet-config as per the configuration settings given in cls.
cls | closure with the struct GNUNET_CONFIGURATION_ConfigSettings |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 108 of file configuration_helper.c.
References _, consensus-simulation::args, cfg, config_file, GNUNET_CONFIGURATION_ConfigSettings::diagnostics, DIR_SEPARATOR_STR, EXIT_INVALIDARGUMENT, EXIT_NOTCONFIGURED, GNUNET_CONFIGURATION_ConfigSettings::full, getenv(), GNUNET_CONFIGURATION_ConfigSettings::global_ret, GNUNET_asprintf(), GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_dup(), GNUNET_CONFIGURATION_enable_diagnostics(), GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONFIGURATION_iterate_section_values(), GNUNET_CONFIGURATION_iterate_sections(), GNUNET_CONFIGURATION_load(), GNUNET_CONFIGURATION_serialize_diagnostics(), GNUNET_CONFIGURATION_set_value_string(), GNUNET_CONFIGURATION_write(), GNUNET_CONFIGURATION_write_diffs(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log_config_missing(), GNUNET_OK, GNUNET_OS_project_data_get(), GNUNET_strdup, GNUNET_YES, GNUNET_CONFIGURATION_ConfigSettings::is_filename, GNUNET_CONFIGURATION_ConfigSettings::list_sections, GNUNET_CONFIGURATION_ConfigSettings::option, print_filename_option(), print_option(), print_section_name(), GNUNET_CONFIGURATION_ConfigSettings::rewrite, GNUNET_CONFIGURATION_ConfigSettings::section, GNUNET_CONFIGURATION_ConfigSettings::value, and value.
Referenced by run().