db-parser: remove dead code from r_find_node()

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: rename i to match_length in r_find_node()
db-parser: rename nodelen to current_node_key_length in r_find_node()
db-parser: rename j to parser_ndx in r_find_node()
db-parser: extract r_find_matching_prefix() from r_find_node()

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
db-parser: rename match_length to literal_length in r_find_node()
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>