cfg: Add a cfg_load_config() function

This new function can be used to load configuration from memory, instead
of a file, which is a boon for writing tests.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
str-format: Moved format_hex_string to str-format and added delimitered version.

Added unit tests for simple and delimitered variant.
Replaced data_to_hex_string with format_hex_string_with_delimiter.

Signed-off-by: Viktor Tusa <tusa@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
persist-state: Add foreach function on persist-state entries.

Signed-off-by: Viktor Tusa <tusa@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
persist-state: Add dump and edit mode to persist_state_start.

Using edit or dump mode on an invalid file results in an error,
when starting persist-state instead of silently creating a new one.
In dump mode, the not used entries (in_use = 0) are read as well
at load time instead of being purged.

Signed-off-by: Viktor Tusa <tusa@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
persist-state: Add PersistableStatePresenter.

PersistableStatePresenter is an interface, which turns *State objects into
PresentedPersistableState.

Every *State object which has it's own PersistableStatePresenter
implementation can represent/load itself into/from a
PresentedPersistableState.

PresentedPersistableState is an abstract interface, which provides
functions to represent basic types in its implementation.
Currently it has only one implementation, JsonPresentedPersistableState.

Signed-off-by: Viktor Tusa <tusa@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
persist-state: remove tailing semicolons from the end of functions

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
pathutils: Added filesystem path-related utility functions.

Signed-off-by: Viktor Tusa <tusa@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
Merge branch 'persist-tool-integrate'