core: load and save fingerprints to XML

We always use the global fingerprint table - maybe this should just not
be a parameter of the accessor functions?

The syntax is very simple - the raw data is encoded as a hex string, the
rest of the components are hex numbers.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2021-10-30 16:31:29 -07:00
parent 33527cb9e5
commit 2b1db9da82
4 changed files with 67 additions and 0 deletions

View file

@ -186,6 +186,16 @@ void reset_dc_settings(struct parser_state *state)
state->cur_settings.dc.deviceid = 0;
}
void reset_fingerprint(struct parser_state *state)
{
free((void *)state->cur_settings.fingerprint.data);
state->cur_settings.fingerprint.data = NULL;
state->cur_settings.fingerprint.model = 0;
state->cur_settings.fingerprint.serial = 0;
state->cur_settings.fingerprint.fdeviceid = 0;
state->cur_settings.fingerprint.fdiveid = 0;
}
void settings_start(struct parser_state *state)
{
state->in_settings = true;
@ -196,6 +206,20 @@ void settings_end(struct parser_state *state)
state->in_settings = false;
}
void fingerprint_settings_start(struct parser_state *state)
{
reset_fingerprint(state);
}
void fingerprint_settings_end(struct parser_state *state)
{
create_fingerprint_node_from_hex(state->fingerprints,
state->cur_settings.fingerprint.model,
state->cur_settings.fingerprint.serial,
state->cur_settings.fingerprint.data,
state->cur_settings.fingerprint.fdeviceid,
state->cur_settings.fingerprint.fdiveid);
}
void dc_settings_start(struct parser_state *state)
{
reset_dc_settings(state);