Debian Codegraph @

src/common/oscap_pcre.h

raw symbols SCIP
1 /*
2 * Copyright 2023 Red Hat Inc., Durham, North Carolina.
3 * All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Authors:
20 * Evgenii Kolesnikov <[email protected]>
21 */
22
23 #ifndef OSCAP_PCRE_
24 #define OSCAP_PCRE_cxx . . $ `src/common/oscap_pcre.h:24:9`!
25
26 typedef struct oscap_pcrecxx . . $ oscap_pcre# oscap_pcre_tcxx . . $ oscap_pcre_t#;
27
28 typedef enumcxx . . $ $anonymous_type_77e852865db6f584_0# {
29 OSCAP_PCRE_OPTS_NONEcxx . . $ OSCAP_PCRE_OPTS_NONE. = 0x0001,
30 OSCAP_PCRE_OPTS_UTF8cxx . . $ OSCAP_PCRE_OPTS_UTF8. = 0x0002,
31 OSCAP_PCRE_OPTS_MULTILINEcxx . . $ OSCAP_PCRE_OPTS_MULTILINE. = 0x0004,
32 OSCAP_PCRE_OPTS_DOTALLcxx . . $ OSCAP_PCRE_OPTS_DOTALL. = 0x0008,
33 OSCAP_PCRE_OPTS_CASELESScxx . . $ OSCAP_PCRE_OPTS_CASELESS. = 0x0010,
34 OSCAP_PCRE_OPTS_NO_UTF8_CHECKcxx . . $ OSCAP_PCRE_OPTS_NO_UTF8_CHECK. = 0x0020,
35 OSCAP_PCRE_OPTS_PARTIALcxx . . $ OSCAP_PCRE_OPTS_PARTIAL. = 0x0040,
36 } oscap_pcre_options_tcxx . . $ oscap_pcre_options_t#;
37
38 typedef enumcxx . . $ $anonymous_type_77e852865db6f584_1# {
39 OSCAP_PCRE_ERR_NOMATCHcxx . . $ OSCAP_PCRE_ERR_NOMATCH. = -1,
40 OSCAP_PCRE_ERR_PARTIALcxx . . $ OSCAP_PCRE_ERR_PARTIAL. = -2,
41 OSCAP_PCRE_ERR_BADPARTIALcxx . . $ OSCAP_PCRE_ERR_BADPARTIAL. = -3,
42 OSCAP_PCRE_ERR_BADUTF8cxx . . $ OSCAP_PCRE_ERR_BADUTF8. = -10,
43 OSCAP_PCRE_ERR_RECURSIONLIMITcxx . . $ OSCAP_PCRE_ERR_RECURSIONLIMIT. = -21,
44 OSCAP_PCRE_ERR_UNKNOWNcxx . . $ OSCAP_PCRE_ERR_UNKNOWN. = -100,
45 } oscap_pcre_error_tcxx . . $ oscap_pcre_error_t#;
46
47
48 /**
49 * Compile a regular expression string into PCRE object and returns it.
50 * Caller is responsible for freeing the returned object or the error message
51 * if the result is NULL (USE oscap_pcre_err_free()!).
52 * @param pattern expresstion string
53 * @param options compile options
54 * @param errptr a return value for a string representation of error
55 * @param erroffset the offset in the expression where the problem was detected
56 * @return a PCRE object
57 * NULL on failure
58 */
59 oscap_pcre_tcxx . . $ oscap_pcre_t#* oscap_pcre_compilecxx . . $ oscap_pcre_compile(29ca11f2d36a957a).(const char *pattern, oscap_pcre_options_tcxx . . $ oscap_pcre_options_t# options,
60 char **errptr, int *erroffset);
61
62 /**
63 * Execute the compiled regular expression against a string subject and returns
64 * matches count (or a negative error code).
65 * @param opcre the oscap_pcre_t object
66 * @param subject target string
67 * @param length target string length
68 * @param startoffset the offset for the target string
69 * @param options match options
70 * @param ovector the output vector for match offset pairs, see pcre_exec for details
71 * @param ovecsize the size of ovector, see pcre_exec for details
72 * @return matches count
73 * negative error code on failure
74 */
75 int oscap_pcre_execcxx . . $ oscap_pcre_exec(7630dfd25fd504ec).(const oscap_pcre_tcxx . . $ oscap_pcre_t# *opcre, const char *subject,
76 int length, int startoffset, oscap_pcre_options_tcxx . . $ oscap_pcre_options_t# options,
77 int *ovector, int ovecsize);
78
79 /**
80 * Free the compiled regular expression object.
81 * @param opcre the oscap_pcre_t object
82 */
83 void oscap_pcre_freecxx . . $ oscap_pcre_free(804bb72472b0846e).(oscap_pcre_tcxx . . $ oscap_pcre_t# *opcre);
84
85 /**
86 * Limit the compiled regular expression object's recursion depth for future
87 * matches.
88 * @param opcre the oscap_pcre_t object
89 * @param limit maximum depth
90 */
91 void oscap_pcre_set_match_limit_recursioncxx . . $ oscap_pcre_set_match_limit_recursion(c2fa3d2ab1823f32).(oscap_pcre_tcxx . . $ oscap_pcre_t# *opcre, unsigned long limit);
92
93 /**
94 * Match a regular expression and return substrings.
95 * Caller is responsible for freeing the returned array.
96 * @param str subject string
97 * @param ofs starting offset in str
98 * @param re compiled regular expression
99 * @param want_substrs if non-zero, substrings will be returned
100 * @param substrings contains returned substrings
101 * @return count of matched substrings, 0 if no match
102 * negative value on failure
103 */
104 int oscap_pcre_get_substringscxx . . $ oscap_pcre_get_substrings(60fafe1d399fec14).(char *str, int *ofs, oscap_pcre_tcxx . . $ oscap_pcre_t# *re, int want_substrs, char ***substrings);
105
106 /**
107 * Free the error message returned by oscap_pcre_compile. DON'T USE REGULAR free()!
108 * @param err the message
109 */
110 void oscap_pcre_err_freecxx . . $ oscap_pcre_err_free(fda57c8427c60377).(char *err);
111
112 #endif