Commit Graph

24 Commits

Author SHA1 Message Date
Andrew Bettison
a822dca2fa Improve config schema macros and log options
Add STRUCT_ASSIGN macro to config schema

Document STRUCT_DEFAULT and STRUCT_ASSIGN in block comments

Move 'log.file_xxx' options to 'log.file.xxx'
2013-04-05 15:00:54 +10:30
Andrew Bettison
2d09ec545e Improve configuration dump to log
Refactor much of the new code in log.c

Add new functions: cf_load_strict() and cf_reload_strict() for use by the
server, which does not want to overwrite its in-memory config at all if there
is any defect in the config file.  However, commands always want to overwrite
the default in-memory config, even with a defective config file, so that
logging has a chance to succeed.

Added `log_format.dump_config` boolean config option
2013-03-29 00:22:08 +10:30
Andrew Bettison
d3d6fa4547 Add log format config options for file and stderr
Upgrade configuration schema macros to allow optional "default label"
argument to SUB_STRUCT and VALUE_SUB_STRUCT elements.

New STRUCT_DEFAULT section declares alternative STRUCT default values
with a label.
2013-03-26 16:11:31 +10:30
Andrew Bettison
c9f9ef5ed4 New config type: bool_t (char)
Replace 'int_boolean' and 'char_boolean' representations with 'boolean'.

Clean up spacing and column alignment in conf_schema.h
2013-03-05 12:35:30 +10:30
Andrew Bettison
54ce857cff Improve config schema declaration
Remove array key SORTED flag; all arrays are now sorted by key

Use representation's comparison function for sorting arrays, not
a schema-supplied comparison function.
2013-03-01 15:27:28 +10:30
Andrew Bettison
ae787339ec Improve "config dump" command
All STRUCT cf_fmt_config_xxx() functions omit invalid values, silently
if the invalid value is the default, otherwise with a non-CFOK return
value.

The "config dump --full" option includes all options with valid values,
otherwise omits options having default values.
2013-02-28 15:18:48 +10:30
Andrew Bettison
5939aa9edc Add config cf_cmp_ functions 2013-02-27 18:11:18 +10:30
Andrew Bettison
6eb08ae805 Add new "config dump" command - not working yet
Add cf_fmt_xxx() functions for converting configuration structs into a
config object model tree.
2013-02-26 18:09:08 +10:30
Andrew Bettison
14ce5af688 Refactor configuration schema code
Replace 'parsefunc' (cf_opt_foo) function arguments in schema
declarations with 'repr' (foo) names, which are used to declare
cf_opt_foo and cf_fmt_foo.
2013-02-25 17:23:44 +10:30
Andrew Bettison
5985df751d Overhaul debug flags
Replace debugflags_t and DEBUG_XXX bit masks with config schema "debug.xxx"
entries.

No more support for "debug.all".
2012-12-11 15:59:46 +10:30
Andrew Bettison
96d524200c Support 'config get' var pattern matching 2012-12-10 15:26:35 +10:30
Andrew Bettison
8425882ffc Merge branch 'newconfig' into 'master'
Conflicts:
	commandline.c
	conf.h
	dataformats.c
	log.h
	overlay_address.c
	overlay_interface.c
	packetformats.c
	rhizome.c
	serval.h
	tests/directory_service
	vomp_console.c
2012-12-07 14:09:55 +10:30
Andrew Bettison
ecdf32fbe2 Rename cf_opt_port() to cf_opt_uint16_nonzero()
Improves the usefulness of the 'config schema' output.
2012-12-07 11:14:05 +10:30
Andrew Bettison
21509e0b67 Add 'config schema' command to dump schema
That was easy.
2012-12-06 17:54:30 +10:30
Andrew Bettison
aa638a9bfd Fix new 'interfaces' config option
Introduce CFINCOMPATIBLE config parse result flag.

Sort interface rules by unsigned integer key.

Legacy and modern 'interfaces' config styles are now incompatible.

Validate config_network_interface struct to enforce that only exactly one of
'match' and 'dummy' options are set.

Add test cases for 'interface' config option.
2012-12-05 12:58:07 +10:30
Andrew Bettison
c53789d764 Legacy 'interfaces' config option improvements
Legacy form is now incompatible with modern form.

Test case to check legacy parsing.
2012-12-04 18:22:26 +10:30
Andrew Bettison
71ed78e058 Make all 'config' tests pass
Change a test case: configuration options are now case sensitive.

Fix config file load and parse logic in conf.c, always copy 'debug' flags
from config.debug.

The config schema 'interfaces' option is no longer MANDATORY.

Introduce new CLIFLAG_PERMISSIVE_CONFIG to supress bad-config ERROR messages
from the 'config set' and 'config get' commands.

Refactor cli_execute() into cli_parse() and cli_invoke().  Use *const* struct
command_line_option everywhere.
2012-12-04 16:52:49 +10:30
Andrew Bettison
caa209fc1d Integrate new config into servald
Not passing any tests yet, but compiles and links and simple uses do not
SEGV.
2012-12-04 14:12:28 +10:30
gardners
6179240874 enable overriding default instance path at configure time. 2012-12-04 11:23:03 +10:30
Andrew Bettison
6395f757cc Fix bugs in earlier conf/log recursion logic
Reinstate better recursion control in conf.c, remove from log.c.

Add <kludge> comment to "config set" code, add the same kludge to "config
del".
2012-11-15 12:38:17 +10:30
Andrew Bettison
f2d6c6d522 Kludge "config set" to fix Batphone upgrade bug 2012-11-14 13:16:23 +10:30
Andrew Bettison
9c69eaca1c Improve logic to avoid log/config infinite recursion
Put logic in log.c, remove from conf.c.  Now messages logged while logging
another message will get appended to the log buffer, and eventually flushed.
2012-11-14 13:16:23 +10:30
Daniel O'Connor
09d0fecf28 Remove carnal knowledge of conf.c from serval.h and commandline.c by providing a function to set the instance path override. 2012-07-29 18:58:41 +09:30
gardners
93449d380e various fixes for libmonitorclient and commits made by others
inbetween. Hopefully I have captured all the changes.
2012-07-29 12:35:53 +09:30