Greenbone Security Assistant  8.0.0
validator.h
Go to the documentation of this file.
1 /* Copyright (C) 2009-2018 Greenbone Networks GmbH
2  *
3  * SPDX-License-Identifier: GPL-2.0-or-later
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program 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
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
25 #ifndef _VALIDATOR_H
26 #define _VALIDATOR_H
27 
28 #include <glib.h>
29 
33 typedef GHashTable *validator_t;
34 
39 {
40  gchar *alias_for;
41  gchar *regex;
42  gboolean is_binary;
43 };
44 
49 
52 
53 void
54 gvm_validator_add (validator_t, const char *, const char *);
55 
56 void
58 
59 int
60 gvm_validator_alias (validator_t, const char *, const char *);
61 
62 gchar *
63 gvm_validator_alias_for (validator_t, const char *);
64 
65 int
66 gvm_validate (validator_t, const char *, const char *);
67 
69 
70 #endif /* not _VALIDATOR_H */
void gvm_validator_free(validator_t)
Free a validator.
Definition: validator.c:266
gchar * regex
Regular expression.
Definition: validator.h:41
A validator rule.
Definition: validator.h:38
void gvm_validator_add(validator_t, const char *, const char *)
Add or overwrite a validation rule.
Definition: validator.c:116
gboolean is_binary
Whether to expect raw byte data, skip UTF-8 checks.
Definition: validator.h:42
int gvm_validator_alias(validator_t, const char *, const char *)
Make an alias for a rule name.
Definition: validator.c:145
gchar * alias_for
Name of the rule for which this is an alias.
Definition: validator.h:40
validator_t gvm_validator_new()
Create a new validator.
Definition: validator.c:102
GHashTable * validator_t
A set of name rule pairs.
Definition: validator.h:33
gchar * gvm_validator_alias_for(validator_t, const char *)
Get the name of the rule for which a rule is an alias.
Definition: validator.c:172
int gvm_validate(validator_t, const char *, const char *)
Validate a string for a given rule.
Definition: validator.c:197
void gvm_validator_add_binary(validator_t, const char *)
Add or overwrite a validation rule for a binary data param.
Definition: validator.c:129