From: Arran Cudbard-Bell Date: Fri, 5 Oct 2018 06:47:42 +0000 (+0700) Subject: Split regex functions into a separate header X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=32999f782adb3b0149fb4cc013c609dccd4e46c3;p=thirdparty%2Ffreeradius-server.git Split regex functions into a separate header --- diff --git a/src/lib/server/base.h b/src/lib/server/base.h index a2903456b90..febfccaca36 100644 --- a/src/lib/server/base.h +++ b/src/lib/server/base.h @@ -176,26 +176,6 @@ void rad_suid_down(void); void rad_suid_up(void); void rad_suid_down_permanent(void); bool rad_suid_is_down_permanent(void); -/* regex.c */ - -#ifdef HAVE_REGEX -/* - * Increasing this is essentially free - * It just increases memory usage. 12-16 bytes for each additional subcapture. - */ -# define REQUEST_MAX_REGEX 32 - -void regex_sub_to_request(REQUEST *request, regex_t **preg, fr_regmatch_t **regmatch); - -int regex_request_to_sub(TALLOC_CTX *ctx, char **out, REQUEST *request, uint32_t num); - -/* - * Named capture groups only supported by PCRE. - */ -# if defined(HAVE_REGEX_PCRE2) || defined(HAVE_REGEX_PCRE) -int regex_request_to_sub_named(TALLOC_CTX *ctx, char **out, REQUEST *request, char const *name); -# endif -#endif /* auth.c */ rlm_rcode_t rad_authenticate (REQUEST *); diff --git a/src/lib/server/cond_eval.c b/src/lib/server/cond_eval.c index e56e6c74f09..5b8f66aafa4 100644 --- a/src/lib/server/cond_eval.c +++ b/src/lib/server/cond_eval.c @@ -28,6 +28,7 @@ RCSID("$Id$") #include #include #include +#include #include #include diff --git a/src/lib/server/paircmp.c b/src/lib/server/paircmp.c index 4408a2c8660..5f337eeaaee 100644 --- a/src/lib/server/paircmp.c +++ b/src/lib/server/paircmp.c @@ -31,8 +31,9 @@ RCSID("$Id$") #include -#include #include +#include +#include typedef struct paircmp_s paircmp_t; struct paircmp_s { diff --git a/src/lib/server/regex.c b/src/lib/server/regex.c index 583a7639fb2..fd325ce5839 100644 --- a/src/lib/server/regex.c +++ b/src/lib/server/regex.c @@ -25,7 +25,7 @@ RCSID("$Id$") -#include +#include #include #ifdef HAVE_REGEX diff --git a/src/lib/server/regex.h b/src/lib/server/regex.h new file mode 100644 index 00000000000..87d0ba9db79 --- /dev/null +++ b/src/lib/server/regex.h @@ -0,0 +1,58 @@ +#pragma once +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * $Id$ + * + * @file lib/server/regex.h + * @brief Regular expression functions used by the server library. + * + * @copyright 2014 The FreeRADIUS server project + */ +RCSIDH(server_regex_h, "$Id$") + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_REGEX +#include +#include + +#include + +/* + * Increasing this is essentially free + * It just increases memory usage. 12-16 bytes for each additional subcapture. + */ +# define REQUEST_MAX_REGEX 32 + +void regex_sub_to_request(REQUEST *request, regex_t **preg, fr_regmatch_t **regmatch); + +int regex_request_to_sub(TALLOC_CTX *ctx, char **out, REQUEST *request, uint32_t num); + +/* + * Named capture groups only supported by PCRE. + */ +# if defined(HAVE_REGEX_PCRE2) || defined(HAVE_REGEX_PCRE) +int regex_request_to_sub_named(TALLOC_CTX *ctx, char **out, REQUEST *request, char const *name); +# endif +#endif + +#ifdef __cplusplus +} +#endif diff --git a/src/lib/server/xlat_eval.c b/src/lib/server/xlat_eval.c index 060db1c017d..2733483335c 100644 --- a/src/lib/server/xlat_eval.c +++ b/src/lib/server/xlat_eval.c @@ -27,10 +27,12 @@ RCSID("$Id$") #include -#include #include -#include +#include #include +#include +#include +#include #include #include "xlat_priv.h" diff --git a/src/lib/server/xlat_tokenize.c b/src/lib/server/xlat_tokenize.c index 16858995618..dd8f56173c0 100644 --- a/src/lib/server/xlat_tokenize.c +++ b/src/lib/server/xlat_tokenize.c @@ -26,8 +26,9 @@ RCSID("$Id$") -#include #include +#include +#include #include #include "xlat_priv.h"