Greenbone Vulnerability Manager 22.5.2
manage_report_formats.h
1/* Copyright (C) 2020-2022 Greenbone AG
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_REPORT_FORMATS_H
20#define _GVMD_MANAGE_REPORT_FORMATS_H
21
22#include "manage.h"
23
24#include <glib.h>
25
26gboolean
27find_report_format_with_permission (const char*, report_format_t*,
28 const char *);
29
33typedef struct
34{
35 gchar *fallback;
36 gchar *name;
37 gchar *type;
38 gchar *type_max;
39 gchar *type_min;
40 gchar *value;
42
43int
44create_report_format (const char *, const char *, const char *, const char *,
45 const char *, const char *, array_t *, array_t *,
46 array_t *, const char *, report_format_t *);
47
48int
49copy_report_format (const char *, const char *, report_format_t*);
50
51int
52modify_report_format (const char *, const char *, const char *, const char *,
53 const char *, const char *);
54
55int
56delete_report_format (const char *, int);
57
58int
59verify_report_format (const char *);
60
61char *
62report_format_uuid (report_format_t);
63
64char *
65report_format_owner_uuid (report_format_t);
66
67char *
68report_format_name (report_format_t);
69
70char *
71report_format_content_type (report_format_t);
72
73char *
74report_format_extension (report_format_t);
75
76int
77report_format_global (report_format_t);
78
79int
80trash_report_format_global (report_format_t);
81
82int
83report_format_predefined (report_format_t);
84
85int
86trash_report_format_predefined (report_format_t);
87
88int
89report_format_active (report_format_t);
90
91int
92report_format_trust (report_format_t);
93
94int
95report_format_in_use (report_format_t);
96
97int
98trash_report_format_in_use (report_format_t);
99
100int
101trash_report_format_writable (report_format_t);
102
103int
104report_format_writable (report_format_t);
105
106int
107report_format_count (const get_data_t *);
108
109int
110init_report_format_iterator (iterator_t*, const get_data_t *);
111
112const char*
113report_format_iterator_extension (iterator_t *);
114
115const char*
116report_format_iterator_content_type (iterator_t *);
117
118const char*
119report_format_iterator_description (iterator_t *);
120
121int
122report_format_iterator_active (iterator_t *);
123
124const char*
125report_format_iterator_signature (iterator_t *);
126
127const char*
128report_format_iterator_trust (iterator_t *);
129
130const char*
131report_format_iterator_summary (iterator_t *);
132
133time_t
134report_format_iterator_trust_time (iterator_t *);
135
136void
137init_report_format_alert_iterator (iterator_t*, report_format_t);
138
139const char*
140report_format_alert_iterator_name (iterator_t*);
141
142const char*
143report_format_alert_iterator_uuid (iterator_t*);
144
145int
146report_format_alert_iterator_readable (iterator_t*);
147
151typedef struct
152{
153 GPtrArray *start;
154 gpointer *current;
155 gchar *dir_name;
157
158int
160
161void
163
164gboolean
166
167const char*
169
170gchar*
172
179typedef enum
180{
181 REPORT_FORMAT_PARAM_TYPE_BOOLEAN = 0,
182 REPORT_FORMAT_PARAM_TYPE_INTEGER = 1,
183 REPORT_FORMAT_PARAM_TYPE_SELECTION = 2,
184 REPORT_FORMAT_PARAM_TYPE_STRING = 3,
185 REPORT_FORMAT_PARAM_TYPE_TEXT = 4,
186 REPORT_FORMAT_PARAM_TYPE_REPORT_FORMAT_LIST = 5,
187 REPORT_FORMAT_PARAM_TYPE_ERROR = 100
188} report_format_param_type_t;
189
190const char *
191report_format_param_type_name (report_format_param_type_t);
192
193report_format_param_type_t
195
196void
197init_report_format_param_iterator (iterator_t*, report_format_t, int,
198 int, const char*);
199
200report_format_param_t
201report_format_param_iterator_param (iterator_t*);
202
203const char*
204report_format_param_iterator_name (iterator_t *);
205
206const char*
207report_format_param_iterator_value (iterator_t *);
208
209const char*
210report_format_param_iterator_type_name (iterator_t *);
211
212report_format_param_type_t
213report_format_param_iterator_type (iterator_t *);
214
215long long int
216report_format_param_iterator_type_min (iterator_t *);
217
218long long int
219report_format_param_iterator_type_max (iterator_t *);
220
221const char*
222report_format_param_iterator_fallback (iterator_t *);
223
224void
225init_param_option_iterator (iterator_t*, report_format_param_t, int,
226 const char *);
227
228const char*
229param_option_iterator_value (iterator_t *);
230
231gboolean
233
234void
236
237int
239
240gboolean
242
243#endif /* not _GVMD_MANAGE_REPORT_FORMATS_H */
gboolean find_report_format_with_permission(const char *uuid, report_format_t *report_format, const char *permission)
Find a report format for a specific permission, given a UUID.
Definition: manage_report_formats.c:59
int manage_rebuild_report_formats()
Rebuild port lists from the feed.
Definition: manage_report_formats.c:839
const char * report_format_param_type_name(report_format_param_type_t type)
Get the name of a report format param type.
Definition: manage_report_formats.c:101
int init_report_format_file_iterator(file_iterator_t *iterator, report_format_t report_format)
Initialise a report format file iterator.
Definition: manage_report_formats.c:235
report_format_param_type_t report_format_param_type_from_name(const char *name)
Get a report format param type from a name.
Definition: manage_report_formats.c:132
void manage_sync_report_formats()
Sync report formats with the feed.
Definition: manage_report_formats.c:828
void cleanup_file_iterator(file_iterator_t *iterator)
Cleanup a report type iterator.
Definition: manage_report_formats.c:273
const char * file_iterator_name(file_iterator_t *iterator)
Return the name from a file iterator.
Definition: manage_report_formats.c:304
int trash_report_format_writable(report_format_t report_format)
Return whether a trashcan report_format is writable.
Definition: manage_report_formats.c:88
int report_format_writable(report_format_t report_format)
Return whether a report format is writable.
Definition: manage_report_formats.c:75
gboolean report_formats_feed_dir_exists()
Tests if the report formats feed directory exists.
Definition: manage_report_formats.c:819
gboolean should_sync_report_formats()
Checks if the report formats should be synced with the feed.
Definition: manage_report_formats.c:850
gchar * file_iterator_content_64(file_iterator_t *iterator)
Return the file contents from a file iterator.
Definition: manage_report_formats.c:317
gboolean next_file(file_iterator_t *iterator)
Increment a report type iterator.
Definition: manage_report_formats.c:289
Struct for defining a report format param.
Definition: manage_report_formats.h:34
gchar * fallback
Fallback value.
Definition: manage_report_formats.h:35
gchar * name
Name.
Definition: manage_report_formats.h:36
gchar * type_max
Maximum value for integer type.
Definition: manage_report_formats.h:38
gchar * type_min
Minimum value for integer type.
Definition: manage_report_formats.h:39
gchar * type
Type (boolean, string, integer, ...).
Definition: manage_report_formats.h:37
gchar * value
Value of param.
Definition: manage_report_formats.h:40
A report format file iterator.
Definition: manage_report_formats.h:152
GPtrArray * start
Array of files.
Definition: manage_report_formats.h:153
gpointer * current
Current file.
Definition: manage_report_formats.h:154
gchar * dir_name
Dir holding files.
Definition: manage_report_formats.h:155
Command data for a get command.
Definition: manage_get.h:35
A generic SQL iterator structure.
Definition: iterator.h:50