Greenbone Security Assistant  7.0.0
validator.h
Go to the documentation of this file.
1 /* Greenbone Security Assistant (set for openvas-libraries/base)
2  * $Id$
3  * Description: String validator.
4  *
5  * Authors:
6  * Matthew Mundell <matthew.mundell@greenbone.net>
7  * Jan-Oliver Wagner <jan-oliver.wagner@greenbone.net>
8  *
9  * Copyright:
10  * Copyright (C) 2009 Greenbone Networks GmbH
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
25  */
26 
32 #ifndef _VALIDATOR_H
33 #define _VALIDATOR_H
34 
35 #include <glib.h>
36 
40 typedef GHashTable *validator_t;
41 
46 {
47  gchar *alias_for;
48  gchar *regex;
49 };
50 
55 
57 void openvas_validator_add (validator_t, const char *, const char *);
58 int openvas_validator_alias (validator_t, const char *, const char *);
59 gchar *openvas_validator_alias_for (validator_t, const char *);
60 int openvas_validate (validator_t, const char *, const char *);
62 
63 #endif /* not _VALIDATOR_H */
int openvas_validator_alias(validator_t, const char *, const char *)
Make an alias for a rule name.
Definition: validator.c:125
gchar * regex
Regular expression.
Definition: validator.h:48
A validator rule.
Definition: validator.h:45
validator_t openvas_validator_new()
Create a new validator.
Definition: validator.c:90
int openvas_validate(validator_t, const char *, const char *)
Validate a string for a given rule.
Definition: validator.c:182
void openvas_validator_add(validator_t, const char *, const char *)
Add or overwrite a validation rule.
Definition: validator.c:106
gchar * alias_for
Name of the rule for which this is an alias.
Definition: validator.h:47
gchar * openvas_validator_alias_for(validator_t, const char *)
Get the name of the rule for which a rule is an alias.
Definition: validator.c:157
GHashTable * validator_t
A set of name rule pairs.
Definition: validator.h:40
void openvas_validator_free(validator_t)
Free a validator.
Definition: validator.c:247