diff options
author | Maximilian Szengel <gnunet@maxsz.de> | 2012-08-27 09:58:39 +0000 |
---|---|---|
committer | Maximilian Szengel <gnunet@maxsz.de> | 2012-08-27 09:58:39 +0000 |
commit | d8f4240d4e37ef783723cb5190ffd378a4388b66 (patch) | |
tree | f2f41c65a945a73747281a6f0e0887e53269986d /src/regex/regex_internal.h | |
parent | 93292d53e8470b6e7302ccf1c86f7cb12535c7f1 (diff) |
Fixes
Diffstat (limited to 'src/regex/regex_internal.h')
-rw-r--r-- | src/regex/regex_internal.h | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/src/regex/regex_internal.h b/src/regex/regex_internal.h index 20e81d93cd..c132f2e238 100644 --- a/src/regex/regex_internal.h +++ b/src/regex/regex_internal.h @@ -315,13 +315,65 @@ GNUNET_REGEX_automaton_traverse (const struct GNUNET_REGEX_Automaton *a, * * @param a automaton for which the canonical regex should be returned. * - * @return + * @return canonical regex string. */ const char * GNUNET_REGEX_get_canonical_regex (struct GNUNET_REGEX_Automaton *a); /** + * Get the number of transitions that are contained in the given automaton. + * + * @param a automaton for which the number of transitions should be returned. + * + * @return number of transitions in the given automaton. + */ +unsigned int +GNUNET_REGEX_get_transition_count (struct GNUNET_REGEX_Automaton *a); + + +/** + * Context that contains an id counter for states and transitions as well as a + * DLL of automatons used as a stack for NFA construction. + */ +struct GNUNET_REGEX_Context +{ + /** + * Unique state id. + */ + unsigned int state_id; + + /** + * Unique transition id. + */ + unsigned int transition_id; + + /** + * DLL of GNUNET_REGEX_Automaton's used as a stack. + */ + struct GNUNET_REGEX_Automaton *stack_head; + + /** + * DLL of GNUNET_REGEX_Automaton's used as a stack. + */ + struct GNUNET_REGEX_Automaton *stack_tail; +}; + + +/** + * Adds multi-strided transitions to the given 'dfa'. + * + * @param regex_ctx regex context needed to add transitions to the automaton. + * @param dfa DFA to which the multi strided transitions should be added. + * @param stride_len length of the strides. + */ +void +GNUNET_REGEX_add_multi_strides_to_dfa (struct GNUNET_REGEX_Context *regex_ctx, + struct GNUNET_REGEX_Automaton *dfa, + const unsigned int stride_len); + + +/** * Generate a (pseudo) random regular expression of length 'rx_length', as well * as a (optional) string that will be matched by the generated regex. The * returned regex needs to be freed. |