Greenbone Vulnerability Manager  21.4.4
manage_sql_configs.h
1 /* Copyright (C) 2019-2020 Greenbone Networks GmbH
2  *
3  * SPDX-License-Identifier: AGPL-3.0-or-later
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as
7  * published by the Free Software Foundation, either version 3 of the
8  * 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 Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef _GVMD_MANAGE_SQL_CONFIGS_H
20 #define _GVMD_MANAGE_SQL_CONFIGS_H
21 
22 #include "manage.h"
23 
27 #define CONFIG_ITERATOR_FILTER_COLUMNS \
28  { GET_ITERATOR_FILTER_COLUMNS, "nvt_selector", "families_total", \
29  "nvts_total", "families_trend", "nvts_trend", "type", "usage_type", \
30  "predefined", NULL }
31 
35 #define CONFIG_ITERATOR_COLUMNS \
36  { \
37  GET_ITERATOR_COLUMNS (configs), \
38  { "nvt_selector", NULL, KEYWORD_TYPE_STRING }, \
39  { "family_count", "families_total", KEYWORD_TYPE_INTEGER }, \
40  { "nvt_count", "nvts_total", KEYWORD_TYPE_INTEGER}, \
41  { "families_growing", "families_trend", KEYWORD_TYPE_INTEGER}, \
42  { "nvts_growing", "nvts_trend", KEYWORD_TYPE_INTEGER }, \
43  { "type", NULL, KEYWORD_TYPE_INTEGER }, \
44  { "scanner", NULL, KEYWORD_TYPE_INTEGER }, \
45  { "0", NULL, KEYWORD_TYPE_INTEGER }, \
46  { "usage_type", NULL, KEYWORD_TYPE_STRING }, \
47  { "predefined", NULL, KEYWORD_TYPE_INTEGER }, \
48  { NULL, NULL, KEYWORD_TYPE_UNKNOWN } \
49  }
50 
54 #define CONFIG_ITERATOR_TRASH_COLUMNS \
55  { \
56  GET_ITERATOR_COLUMNS (configs_trash), \
57  { "nvt_selector", NULL, KEYWORD_TYPE_STRING }, \
58  { "family_count", "families_total", KEYWORD_TYPE_INTEGER }, \
59  { "nvt_count", "nvts_total", KEYWORD_TYPE_INTEGER}, \
60  { "families_growing", "families_trend", KEYWORD_TYPE_INTEGER}, \
61  { "nvts_growing", "nvts_trend", KEYWORD_TYPE_INTEGER }, \
62  { "type", NULL, KEYWORD_TYPE_INTEGER }, \
63  { "scanner", NULL, KEYWORD_TYPE_INTEGER }, \
64  { "scanner_location", NULL, KEYWORD_TYPE_INTEGER }, \
65  { "usage_type", NULL, KEYWORD_TYPE_STRING }, \
66  { "predefined", NULL, KEYWORD_TYPE_INTEGER }, \
67  { NULL, NULL, KEYWORD_TYPE_UNKNOWN } \
68  }
69 
70 gchar *
71 configs_extra_where (const char *);
72 
73 int
74 create_config_no_acl (const char *, const char *, int, const char *,
75  int, const array_t *, const array_t *, const char *,
76  const char *, config_t *, char **);
77 
78 gboolean
79 find_config_no_acl (const char *, config_t *);
80 
81 gboolean
82 find_trash_config_no_acl (const char *, config_t *);
83 
84 int
85 config_predefined (config_t config);
86 
87 int
88 trash_config_predefined (config_t);
89 
90 void
92 
93 int
94 config_updated_in_feed (config_t, const gchar *);
95 
96 void
97 update_config (config_t, const gchar *, const gchar *, const gchar *,
98  const gchar *, int, const array_t*, const array_t*);
99 
100 void
102 
103 void
105 
106 #endif /* not _GVMD_MANAGE_SQL_CONFIGS_H */
int config_predefined(config_t config)
Return whether a config is predefined.
Definition: manage_sql_configs.c:2917
void check_whole_only_in_configs()
Check whole-only families.
Definition: manage_sql_configs.c:4958
int create_config_no_acl(const char *config_id, const char *proposed_name, int make_name_unique, const char *comment, int all_selector, const array_t *selectors, const array_t *preferences, const char *config_type, const char *usage_type, config_t *config, char **name)
Create a config.
Definition: manage_sql_configs.c:2649
void check_db_configs()
Check configs, for startup.
Definition: manage_sql_configs.c:4935
int config_updated_in_feed(config_t config, const gchar *path)
Check if a config has been updated in the feed.
Definition: manage_sql_configs.c:4811
int trash_config_predefined(config_t config)
Return whether a trash config is predefined.
Definition: manage_sql_configs.c:2932
void migrate_predefined_configs()
Migrate old ownerless configs to the Feed Owner.
Definition: manage_sql_configs.c:4789
gboolean find_config_no_acl(const char *uuid, config_t *config)
Find a config given a UUID.
Definition: manage_sql_configs.c:2102
gboolean find_trash_config_no_acl(const char *uuid, config_t *config)
Find a trash config given a UUID.
Definition: manage_sql_configs.c:2139
gchar * configs_extra_where(const char *usage_type)
Generate an extra WHERE clause for selecting configs.
Definition: manage_sql_configs.c:2743
void update_config(config_t config, const gchar *type, const gchar *name, const gchar *comment, const gchar *usage_type, int all_selector, const array_t *selectors, const array_t *preferences)
Update a config from an XML file.
Definition: manage_sql_configs.c:4847