Rename the logging primitive functions and utility functions, prefixing
all with 'serval_log', eg: logMessage() -> serval_logf() etc.
Add an XPRINTF xhexdump() function and use it to implement the
serval_log_hexdump() utility, renamed from dump(). Add macros
WHY_dump(), WARN_dump(), HINT_dump() and DEBUG_dump(), and use them
everywhere.
Remove the 'log.console.dump_config' and 'log.file.dump_config'
configuration options; configuration is now dumped in every log prolog.
The logging system now constructs the log prolog by invoking the new
'log_prolog' trigger, so that it no longer depends on the version string
and configuration system. Any system that wants to present a message in
the log prolog can define its own trigger, which calls standard log
primitives to print the message.
Split the logging system into a front-end (log.c) that provides the
logging primitives and is independent of the configuration system, and a
set of back-end "outputters" (log_output_console.c, log_output_file.c,
log_output_android.c) that may depend on the configuration system and
are decoupled from the front-end using the 'logoutput' link section.
These log outputters are explicitly linked into executables by the
Makefile rules, but could also be linked in using USE_FEATURE(). The
USE_FEATURE() calls have _not_ been added to servald_features.c, so that
different daemon executables can be built with the same feature set but
different log outputs.
Trigger names cannot exceed 11 characters on OS X, so the new "config_change" trigger
has been renamed to "conf_change" and the "config_change_log" trigger has been renamed
to "conf_log".
This is required to support feature-driven linking, in which the exact
list of which functions to call in response to a configuration re-load
is not known until link time.
The "config_change_log" trigger is called before "config_change", so
that the logger can respond to the change before other subsystems.
The CLI and server main loop now have no conditional JNI code. All JNI
code has been moved into separate source files, which #include the new
"jni_common.h" instead of <jni.h>. The "cli.h" header no longer
includes <jni.h>, so the rest of the Serval source code is now
unaffected by JNI definitions.
The 'cf_limbo' global variable is now thread-local, so that each thread
has its own independent copy of the loaded configuration. The JNI
server entry point now calls cf_init() once. The new 'cf_initialised'
flag prevents clobbering the config state by redundant calls to
cf_init().
The CLI "stop" command now sends SIGHUP to the specific thread in which
the server is running. This is achieved by writing the PID and TID
(Linux Thread ID) into the pidfile, separated by a space, on systems
that support the Linux gettid() and tgkill() system calls. The server's
signal handler has been overhauled, and its logging improved.
Original DEBUG() and DEBUGF() macros renamed to _DEBUG() and _DEBUGF()
New DEBUG() and DEBUGF() macros, first argument is flagname
New DEBUGF2(foo, bar, ...) macro does if(config.debug.foo||config.debug.bar) test
Replace almost all config.debug.xxx references to IF_DEBUG(xxx)
In STRUCT() and ARRAY() declarations, change the optional "validator"
arg from taking a bare function name to enclose the function name in
VALIDATOR(function)
Make .o files in separate subdirectories for servald and library
Factor struct __sourceloc and __WHENCE__ from "log.h" into "whence.h"
Factor sid_t etc from "serval.h" into "serval_types.h"
Factor rhizome_bid_t etc from "rhizome.h" into "rhizome_types.h"
Do not include "serval.h" in library sources
Add log_stderr.c and logMessage.c for stand-alone executables
Ensure that timestamp always advances by at least one second every time
the config file is modified, add test case
Refactor test defs: detecting started HTTPD is not specific to Rhizome
Refactor struct file_meta and associated functions into "io.h" and io.c
Add various strbuf helper functions for formatting struct timespec
and struct file_meta to assist debug logging
Move config-dependent code (recvwithttl) from net.c to mdp_net.c (new)
Move log-implementation-independent code from log.c to log_util.c (new)
Build config_test binary in Makefile
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
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.
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.
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.
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.
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.
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.