diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-12-17 12:35:19 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-12-17 12:35:19 +0000 |
commit | 11cc044427e734c83af65ee340dd10ec70c97b1c (patch) | |
tree | 2c807dc234644519ff2f341cf6ca2f1cb2a084f2 /src/regex/regex_test_lib.h | |
parent | 07ce0aaf09b4bcdf37b1524a9a497d4a185aba91 (diff) | |
download | gnunet-11cc044427e734c83af65ee340dd10ec70c97b1c.tar.gz gnunet-11cc044427e734c83af65ee340dd10ec70c97b1c.zip |
- move regex_from_file and combine to separate lib file
Diffstat (limited to 'src/regex/regex_test_lib.h')
-rw-r--r-- | src/regex/regex_test_lib.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/regex/regex_test_lib.h b/src/regex/regex_test_lib.h new file mode 100644 index 000000000..b21af2ebb --- /dev/null +++ b/src/regex/regex_test_lib.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * This file is part of GNUnet | ||
3 | * (C) 2012 Christian Grothoff (and other contributing authors) | ||
4 | * | ||
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. | ||
9 | * | ||
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. | ||
14 | * | ||
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. | ||
19 | */ | ||
20 | /** | ||
21 | * @file src/regex/regex_test_lib.h | ||
22 | * @brief library to read regexes representing IP networks from a file. | ||
23 | * and simplyfinying the into one big regex, in order to run | ||
24 | * tests (regex performance, mesh profiler). | ||
25 | * @author Bertlomiej Polot | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | #ifndef GNUNET_REGEX_TEST_LIB_H | ||
30 | #define GNUNET_REGEX_TEST_LIB_H | ||
31 | |||
32 | |||
33 | #ifdef __cplusplus | ||
34 | extern "C" | ||
35 | { | ||
36 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
37 | } | ||
38 | #endif | ||
39 | #endif | ||
40 | |||
41 | /** | ||
42 | * Combine an array of regexes into a single prefix-shared regex. | ||
43 | * | ||
44 | * @param regexes A NULL-terminated array of regexes. | ||
45 | * | ||
46 | * @retrun A string with a single regex that matches any of the original regexes | ||
47 | */ | ||
48 | char * | ||
49 | GNUNET_REGEX_combine(char * const regexes[]); | ||
50 | |||
51 | /** | ||
52 | * Read a set of regexes from a file, one per line and return them in an array | ||
53 | * suitable for GNUNET_REGEX_combine. | ||
54 | * The array must be free'd using GNUNET_REGEX_free_from_file. | ||
55 | * | ||
56 | * @param filename Name of the file containing the regexes. | ||
57 | * | ||
58 | * @return A newly allocated, NULL terminated array of regexes. | ||
59 | */ | ||
60 | char ** | ||
61 | GNUNET_REGEX_read_from_file (const char *filename); | ||
62 | |||
63 | |||
64 | /** | ||
65 | * Free all memory reserved for a set of regexes created by read_from_file. | ||
66 | * | ||
67 | * @param regexes NULL-terminated array of regexes. | ||
68 | */ | ||
69 | void | ||
70 | GNUNET_REGEX_free_from_file (char **regexes); | ||
71 | |||
72 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
73 | { | ||
74 | #endif | ||
75 | #ifdef __cplusplus | ||
76 | } | ||
77 | #endif | ||
78 | |||
79 | /* end of gnunet_regex_lib.h */ | ||
80 | #endif \ No newline at end of file | ||