2 This file is part of GNUnet
3 (C) 2012 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file src/regex/regex_internal.h
22 * @brief common internal definitions for regex library
23 * @author Maximilian Szengel
25 #ifndef REGEX_INTERNAL_H
26 #define REGEX_INTERNAL_H
28 #include "gnunet_regex_lib.h"
33 #if 0 /* keep Emacsens' auto-indent happy */
39 * char array of literals that are allowed inside a regex (apart from the
42 #define ALLOWED_LITERALS "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
46 * Get the canonical regex of the given automaton.
47 * When constructing the automaton a proof is computed for each state,
48 * consisting of the regular expression leading to this state. A complete
49 * regex for the automaton can be computed by combining these proofs.
50 * As of now this function is only useful for testing.
52 * @param a automaton for which the canonical regex should be returned.
57 GNUNET_REGEX_get_canonical_regex (struct GNUNET_REGEX_Automaton *a);
61 * Generate a (pseudo) random regular expression of length 'rx_length', as well
62 * as a (optional) string that will be matched by the generated regex. The
63 * returned regex needs to be freed.
65 * @param rx_length length of the random regex.
66 * @param matching_str (optional) pointer to a string that will contain a string
67 * that will be matched by the generated regex, if
68 * 'matching_str' pointer was not NULL.
70 * @return NULL if 'rx_length' is 0, a random regex of length 'rx_length', which
71 * needs to be freed, otherwise.
74 GNUNET_REGEX_generate_random_regex (size_t rx_length, char *matching_str);
78 * Generate a random string of maximum length 'max_len' that only contains literals allowed
79 * in a regular expression. The string might be 0 chars long but is garantueed
80 * to be shorter or equal to 'max_len'.
82 * @param max_len maximum length of the string that should be generated.
84 * @return random string that needs to be freed.
87 GNUNET_REGEX_generate_random_string (size_t max_len);
89 #if 0 /* keep Emacsens' auto-indent happy */