OpenVAS Libraries  4.0+rc3.SVN
base/severity_filter.h
00001 /* OpenVAS-Client
00002  *
00003  * Description: Structures and protos for Severity Filters
00004  *
00005  * Authors:
00006  * Jan-Oliver Wagner <jan-oliver.wagner@greenbone.net>
00007  *
00008  * Copyright:
00009  * Copyright (C) 2009 Greenbone Networks GmbH
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License version 2,
00013  * or, at your option, any later version as published by the Free
00014  * Software Foundation
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
00024  */
00025 
00026 #ifndef _UTIL_SEVERITYFILTER_H
00027 #define _UTIL_SEVERITYFILTER_H
00028 
00029 #include <glib.h>
00030 
00034 typedef struct severity_filter
00035 {
00036   gchar *name;        
00037   gchar *filename;    
00038   GSList *overrides;  
00039 } severity_filter_t;
00040 
00041 /* temporary, should be part of the global context */
00042 extern severity_filter_t *global_filter;
00043 
00058 typedef struct severity_override
00059 {
00060   gchar *name;      
00061   gchar *host;      
00062   gchar *port;      
00064   gchar *OID;       
00065   gchar *reason;    
00066   gchar *severity_from; 
00067   gchar *severity_to;   
00068   gboolean active;  
00069 } severity_override_t;
00070 
00071 
00072 severity_filter_t *severity_filter_new (const gchar *, const gchar *);
00073 void severity_filter_free (severity_filter_t *);
00074 gboolean severity_filter_contains_conflicting_override (const severity_filter_t
00075                                                         * filter,
00076                                                         const
00077                                                         severity_override_t *
00078                                                         override);
00079 gboolean severity_filter_contains_conflicting (const severity_filter_t * filter,
00080                                                const gchar * host,
00081                                                const gchar * port,
00082                                                const gchar * oid,
00083                                                const gchar * from);
00084 gboolean severity_filter_add (severity_filter_t *, const severity_override_t *);
00085 const gchar *severity_filter_apply (const gchar *, const gchar *, const gchar *,
00086                                     const gchar *);
00087 gboolean severity_filter_remove (severity_filter_t * filter,
00088                                  severity_override_t * override);
00089 
00090 const severity_override_t *severity_override_new (const gchar *, const gchar *,
00091                                                   const gchar *, const gchar *,
00092                                                   const gchar *, const gchar *,
00093                                                   const gchar *, gboolean);
00094 const severity_override_t *severity_override_duplicate (const
00095                                                         severity_override_t *);
00096 void severity_override_free (severity_override_t *);
00097 
00098 severity_filter_t *severity_filter_from_xml (const gchar *);
00099 
00100 #endif /* _UTIL_SEVERITYFILTER_H */