Greenbone Vulnerability Manager  22.4.0~dev1
manage_sql_configs.h
1 /* Copyright (C) 2019-2022 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", "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  { "0", NULL, KEYWORD_TYPE_INTEGER }, \
44  { "usage_type", NULL, KEYWORD_TYPE_STRING }, \
45  { "predefined", NULL, KEYWORD_TYPE_INTEGER }, \
46  { NULL, NULL, KEYWORD_TYPE_UNKNOWN } \
47  }
48 
52 #define CONFIG_ITERATOR_TRASH_COLUMNS \
53  { \
54  GET_ITERATOR_COLUMNS (configs_trash), \
55  { "nvt_selector", NULL, KEYWORD_TYPE_STRING }, \
56  { "family_count", "families_total", KEYWORD_TYPE_INTEGER }, \
57  { "nvt_count", "nvts_total", KEYWORD_TYPE_INTEGER}, \
58  { "families_growing", "families_trend", KEYWORD_TYPE_INTEGER}, \
59  { "nvts_growing", "nvts_trend", KEYWORD_TYPE_INTEGER }, \
60  { "scanner_location", NULL, KEYWORD_TYPE_INTEGER }, \
61  { "usage_type", NULL, KEYWORD_TYPE_STRING }, \
62  { "predefined", NULL, KEYWORD_TYPE_INTEGER }, \
63  { NULL, NULL, KEYWORD_TYPE_UNKNOWN } \
64  }
65 
66 gchar *
67 configs_extra_where (const char *);
68 
69 int
70 create_config_no_acl (const char *, const char *, int, const char *,
71  int, const array_t *, const array_t *, const char *,
72  config_t *, char **);
73 
74 gboolean
75 find_config_no_acl (const char *, config_t *);
76 
77 gboolean
78 find_trash_config_no_acl (const char *, config_t *);
79 
80 int
81 config_predefined (config_t config);
82 
83 int
84 trash_config_predefined (config_t);
85 
86 void
88 
89 int
90 config_updated_in_feed (config_t, const gchar *);
91 
92 void
93 update_config (config_t, const gchar *, const gchar *, const gchar *,
94  int, const array_t*, const array_t*);
95 
96 void
98 
99 void
101 
102 #endif /* not _GVMD_MANAGE_SQL_CONFIGS_H */
void update_config(config_t config, 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:4369
int config_predefined(config_t config)
Return whether a config is predefined.
Definition: manage_sql_configs.c:2683
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 *usage_type, config_t *config, char **name)
Create a config.
Definition: manage_sql_configs.c:2625
void check_whole_only_in_configs()
Check whole-only families.
Definition: manage_sql_configs.c:4487
void check_db_configs()
Check configs, for startup.
Definition: manage_sql_configs.c:4464
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:4334
int trash_config_predefined(config_t config)
Return whether a trash config is predefined.
Definition: manage_sql_configs.c:2698
void migrate_predefined_configs()
Migrate old ownerless configs to the Feed Owner.
Definition: manage_sql_configs.c:4312
gboolean find_config_no_acl(const char *uuid, config_t *config)
Find a config given a UUID.
Definition: manage_sql_configs.c:2098
gboolean find_trash_config_no_acl(const char *uuid, config_t *config)
Find a trash config given a UUID.
Definition: manage_sql_configs.c:2135
gchar * configs_extra_where(const char *usage_type)
Generate an extra WHERE clause for selecting configs.
Definition: manage_sql_configs.c:2648