Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
src
include
regex.h
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 2 of the License, or
5
* (at your option) any later version.
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software
14
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15
*/
16
#ifndef _FR_REGEX_H
17
#define _FR_REGEX_H
18
#ifdef HAVE_REGEX
19
/**
20
* $Id: 68e79a747b85b8feb0aa407813c22d44b86e9712 $
21
*
22
* @file include/regex.h
23
* @brief Wrappers around various regular expression libraries.
24
*
25
* @copyright 2014 The FreeRADIUS server project
26
*/
27
RCSIDH
(regex_h,
"$Id: 68e79a747b85b8feb0aa407813c22d44b86e9712 $"
)
28
29
# ifdef __cplusplus
30
extern
"C"
{
31
# endif
32
# ifdef HAVE_PCRE
33
# include <pcre.h>
34
/*
35
* Versions older then 8.20 didn't have the JIT functionality
36
* gracefully degrade.
37
*/
38
# ifndef PCRE_STUDY_JIT_COMPILE
39
# define PCRE_STUDY_JIT_COMPILE 0
40
# endif
41
/*
42
* libpcre defines its matches as an array of ints which is a
43
* multiple of three.
44
*/
45
typedef
struct
regmatch {
46
int
a;
47
int
b;
48
int
c;
49
} regmatch_t;
50
51
typedef
struct
regex {
52
bool
precompiled;
//!< Whether this regex was precompiled, or compiled for one of evaluation.
53
pcre *compiled;
//!< Compiled regular expression.
54
pcre_extra *extra;
//!< Result of studying a regular expression.
55
} regex_t;
56
# else
57
# include <
regex.h
>
58
/*
59
* Allow REG_EXTENDED and REG_NOSUB to be or'd with flags
60
* if they're not defined.
61
*/
62
# ifndef REG_EXTENDED
63
# define REG_EXTENDED (0)
64
# endif
65
66
# ifndef REG_NOSUB
67
# define REG_NOSUB (0)
68
# endif
69
# endif
70
ssize_t regex_compile(TALLOC_CTX *ctx, regex_t **out,
char
const
*pattern,
size_t
len,
71
bool
ignore_case,
bool
multiline,
bool
subcaptures,
bool
runtime);
72
int
regex_exec(regex_t *preg,
char
const
*
string
,
size_t
len, regmatch_t pmatch[],
size_t
*nmatch);
73
# ifdef __cplusplus
74
}
75
# endif
76
#endif
77
#endif
/* _FR_REGEX_H */
RCSIDH
#define RCSIDH(h, id)
Definition:
build.h:136
regex.h
Generated on Sun Aug 28 2016 14:19:45 by
1.8.6