- sync wait period with deamon
[oweals/gnunet.git] / src / regex / regex_test_lib.h
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  * @return 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