db-parser: remove "parser" argument from r_insert_node()

This argument was always set to TRUE anyway and is the remnant of ancient
times when the program pattern couldn't extract information from the
message, thus no parsers were supported there.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: extract r_add_literal_match_to_debug_info() from r_find_node()

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: rename r_find_child() to r_find_child_by_first_character()

In the radix tree, the forthcoming single character uniquely identifies the
next branch of the tree, to make this more obvious rename the lookup
function to indicate this clearly.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: rename literal_length to literal_prefix_len
db-parser: extract RFindNodeState struct and merge RADIX_DBG/nonDBG code
db-parser: extract r_find_child_by_remainding_key()
db-parser: remove whole_key as recursed argument from r_find_node()

This patch moves whole_key into the RFindNodeState struct, instead of
passing it over and over recursively.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: extract r_find_node_by_parser() from r_find_node()

To continue breaking up this monstruous function.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: extend the usage of RFindNodeState

This patch adds the state argument to most of the r_find_node() helper
functions to avoid having to move conditional branches to leaf functions.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: rename matches to stored_matches

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: extract stores_matches related operations into separate functions

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: use remaining_key/keylen arguments

Instead of always recalculating the data left to be processed, call those
consistently as remaining_key and remaining_keylen.  This is the data after
the current node has extracted its portion of the input.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: rename "len" to extracted_match_len in r_find_node()

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: extract _pnode_try_parse from r_find_node()

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: extract match related operations from r_find_node() into functions

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: move conditional "store_matches" handling into functions

Signedd-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: remove current_node_key_length variable, use root->keylen instead

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: make naming a bit more consistent

This patch renames a couple of functions/variables for consistency.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: extract _try_parse_with_a_given_child

This patch extracts a large chunks of code to a separate function.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: move radix-find.c back to its compilation unit

This separation is not needed anymore, that file is not included twice.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>