config input handling improvements

This commit changes a few things in the config handling:

* When reading the configuration from multiple sources, a source can now
  override settings already set by a preceding source for settings that
  are not lists.  Previously, trying to change the value of a setting in a
  subsequence file would be considered an error, just like trying to set
  the value of a particular setting multiple times in a single
  configuration file.

* A configuration fragment in CYCLONEDDS_URI now no longer requires the
  CycloneDDS top-level tag to be specified.  If it is missing it will be
  assumed.  This is only true for configuration fragments contained in
  CYCLONEDDS_URI, not for data read from a file.

* A configuration fragment in CYCLONEDDS_URI no longer requires that all
  elements are properly closed: a missing close tag is treated as-if it
  is the end of the fragment and any elements are implicitly closed.
  Again this does not apply to files.

* The configuration dump now lists explicitly which sources affected
  each setting, with a default value indicated by an empty set.

The result of the latter two is that one can almost pretend that it is a
sane format instead of XML.  For example, if one would like to override
tracing settings, one could just write:

  CYCLONEDDS_URI="$CYCLONEDDS_URI,<Tracing><Verbosity>finest"

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-05-07 15:00:40 +08:00 committed by eboasson
parent c2cf340a1b
commit a6d92aac8c
5 changed files with 1159 additions and 1248 deletions

View file

@ -238,7 +238,7 @@ struct config
char *tracingOutputFileName;
int tracingTimestamps;
int tracingAppendToFile;
unsigned allowMulticast;
uint32_t allowMulticast;
enum transport_selector transport_selector;
enum boolean_default compat_use_ipv6;
enum boolean_default compat_tcp_enable;
@ -413,6 +413,7 @@ struct cfgst;
struct cfgst *config_init (const char *configfile);
void config_print_cfgst (struct cfgst *cfgst);
void config_free_source_info (struct cfgst *cfgst);
void config_fini (struct cfgst *cfgst);
#ifdef DDSI_INCLUDE_NETWORK_PARTITIONS

File diff suppressed because it is too large Load diff

View file

@ -584,8 +584,10 @@ int rtps_config_prep (struct cfgst *cfgst)
thread_states_init (max_threads);
}
/* Now the per-thread-log-buffers are set up, so print the configuration */
/* Now the per-thread-log-buffers are set up, so print the configuration. After this there
is no value to the source information for the various configuration elements, so free those. */
config_print_cfgst (cfgst);
config_free_source_info (cfgst);
return 0;
err_config_late_error: