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) | |
download | gnunet-d8f4240d4e37ef783723cb5190ffd378a4388b66.tar.gz gnunet-d8f4240d4e37ef783723cb5190ffd378a4388b66.zip |
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 20e81d93c..c132f2e23 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, | |||
315 | * | 315 | * |
316 | * @param a automaton for which the canonical regex should be returned. | 316 | * @param a automaton for which the canonical regex should be returned. |
317 | * | 317 | * |
318 | * @return | 318 | * @return canonical regex string. |
319 | */ | 319 | */ |
320 | const char * | 320 | const char * |
321 | GNUNET_REGEX_get_canonical_regex (struct GNUNET_REGEX_Automaton *a); | 321 | GNUNET_REGEX_get_canonical_regex (struct GNUNET_REGEX_Automaton *a); |
322 | 322 | ||
323 | 323 | ||
324 | /** | 324 | /** |
325 | * Get the number of transitions that are contained in the given automaton. | ||
326 | * | ||
327 | * @param a automaton for which the number of transitions should be returned. | ||
328 | * | ||
329 | * @return number of transitions in the given automaton. | ||
330 | */ | ||
331 | unsigned int | ||
332 | GNUNET_REGEX_get_transition_count (struct GNUNET_REGEX_Automaton *a); | ||
333 | |||
334 | |||
335 | /** | ||
336 | * Context that contains an id counter for states and transitions as well as a | ||
337 | * DLL of automatons used as a stack for NFA construction. | ||
338 | */ | ||
339 | struct GNUNET_REGEX_Context | ||
340 | { | ||
341 | /** | ||
342 | * Unique state id. | ||
343 | */ | ||
344 | unsigned int state_id; | ||
345 | |||
346 | /** | ||
347 | * Unique transition id. | ||
348 | */ | ||
349 | unsigned int transition_id; | ||
350 | |||
351 | /** | ||
352 | * DLL of GNUNET_REGEX_Automaton's used as a stack. | ||
353 | */ | ||
354 | struct GNUNET_REGEX_Automaton *stack_head; | ||
355 | |||
356 | /** | ||
357 | * DLL of GNUNET_REGEX_Automaton's used as a stack. | ||
358 | */ | ||
359 | struct GNUNET_REGEX_Automaton *stack_tail; | ||
360 | }; | ||
361 | |||
362 | |||
363 | /** | ||
364 | * Adds multi-strided transitions to the given 'dfa'. | ||
365 | * | ||
366 | * @param regex_ctx regex context needed to add transitions to the automaton. | ||
367 | * @param dfa DFA to which the multi strided transitions should be added. | ||
368 | * @param stride_len length of the strides. | ||
369 | */ | ||
370 | void | ||
371 | GNUNET_REGEX_add_multi_strides_to_dfa (struct GNUNET_REGEX_Context *regex_ctx, | ||
372 | struct GNUNET_REGEX_Automaton *dfa, | ||
373 | const unsigned int stride_len); | ||
374 | |||
375 | |||
376 | /** | ||
325 | * Generate a (pseudo) random regular expression of length 'rx_length', as well | 377 | * Generate a (pseudo) random regular expression of length 'rx_length', as well |
326 | * as a (optional) string that will be matched by the generated regex. The | 378 | * as a (optional) string that will be matched by the generated regex. The |
327 | * returned regex needs to be freed. | 379 | * returned regex needs to be freed. |