Greenbone Vulnerability Manager  22.4.0~dev1
manage_port_lists.h
1 /* Copyright (C) 2020-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_PORT_LISTS_H
20 #define _GVMD_MANAGE_PORT_LISTS_H
21 
22 #include "manage.h"
23 
24 #include <glib.h>
25 
26 gboolean
27 find_port_list (const char*, port_list_t*);
28 
29 gboolean
30 find_port_list_with_permission (const char *, port_list_t *, const char *);
31 
32 gboolean
33 find_port_range (const char*, port_list_t*);
34 
35 int
36 trash_port_list_predefined (port_list_t);
37 
38 int
39 port_list_predefined (port_list_t);
40 
41 int
42 create_port_list (const char *, const char *, const char *, const char *,
43  array_t *, port_list_t *);
44 
45 int
46 copy_port_list (const char *, const char *, const char *, port_list_t *);
47 
48 int
49 modify_port_list (const char *, const char *, const char *);
50 
51 int
52 create_port_range (const char *, const char *, const char *, const char *,
53  const char *, port_range_t *);
54 
55 int
56 delete_port_list (const char *, int);
57 
58 int
59 delete_port_range (const char *, int);
60 
61 int
62 port_list_count (const get_data_t *);
63 
64 int
66 
67 int
69 
70 int
72 
73 int
75 
76 int
78 
79 char*
80 port_list_uuid (port_list_t);
81 
82 char*
83 port_range_uuid (port_range_t);
84 
85 int
86 port_list_in_use (port_list_t);
87 
88 int
89 trash_port_list_in_use (port_list_t);
90 
91 int
92 trash_port_list_writable (port_list_t);
93 
94 int
95 port_list_writable (port_list_t);
96 
97 int
98 trash_port_list_readable_uuid (const gchar *);
99 
100 void
101 init_port_range_iterator (iterator_t *, port_range_t, int, int, const char *);
102 
103 const char*
104 port_range_iterator_uuid (iterator_t *);
105 
106 const char*
108 
109 const char*
110 port_range_iterator_start (iterator_t *);
111 
112 const char*
113 port_range_iterator_end (iterator_t *);
114 
115 const char*
117 
118 void
119 init_port_list_target_iterator (iterator_t *, port_list_t, int);
120 
121 const char*
122 port_list_target_iterator_uuid (iterator_t *);
123 
124 const char*
125 port_list_target_iterator_name (iterator_t *);
126 
127 int
129 
130 gboolean
131 port_lists_feed_dir_exists ();
132 
133 void
134 manage_sync_port_lists ();
135 
136 int
137 manage_rebuild_port_lists ();
138 
139 gboolean
140 should_sync_port_lists ();
141 
142 #endif /* not _GVMD_MANAGE_PORT_LISTS_H */
char * port_range_uuid(port_range_t port_range)
Return the UUID of a port_range.
Definition: manage_sql_port_lists.c:2066
int trash_port_list_writable(port_list_t port_list)
Check whether a trashcan Port List is writable.
Definition: manage_sql_port_lists.c:2125
int modify_port_list(const char *port_list_id, const char *name, const char *comment)
Modify a Port List.
Definition: manage_sql_port_lists.c:1445
int create_port_range(const char *port_list_id, const char *type, const char *start, const char *end, const char *comment, port_range_t *port_range_return)
Create a port range in a port list.
Definition: manage_sql_port_lists.c:1530
int create_port_list(const char *id, const char *name, const char *comment, const char *port_ranges, array_t *ranges, port_list_t *port_list_return)
Create a port list.
Definition: manage_sql_port_lists.c:1335
int port_list_iterator_count_tcp(iterator_t *iterator)
Get the TCP port count from a port_list iterator.
Definition: manage_sql_port_lists.c:2010
void init_port_range_iterator(iterator_t *iterator, port_list_t port_list, int trash, int ascending, const char *sort_field)
Initialise a port_range iterator.
Definition: manage_sql_port_lists.c:2159
gboolean find_port_list(const char *uuid, port_list_t *port_list)
Find a port list given a UUID.
Definition: manage_sql_port_lists.c:724
int port_list_target_iterator_readable(iterator_t *iterator)
Get the read permission status from a GET iterator.
Definition: manage_sql_port_lists.c:2366
gboolean find_port_list_with_permission(const char *uuid, port_list_t *port_list, const char *permission)
Find a port list for a specific permission, given a UUID.
Definition: manage_sql_port_lists.c:803
int delete_port_list(const char *port_list_id, int ultimate)
Delete a port list.
Definition: manage_sql_port_lists.c:1638
int trash_port_list_in_use(port_list_t port_list)
Check whether a trashcan Port List is in use.
Definition: manage_sql_port_lists.c:2095
int copy_port_list(const char *name, const char *comment, const char *port_list_id, port_list_t *new_port_list)
Create Port List from an existing Port List.
Definition: manage_sql_port_lists.c:1382
const char * port_range_iterator_type(iterator_t *iterator)
Get the type from a port range iterator.
Definition: manage_sql_port_lists.c:2271
char * port_list_uuid(port_list_t port_list)
Return the UUID of a port_list.
Definition: manage_sql_port_lists.c:2052
int trash_port_list_readable_uuid(const gchar *port_list_id)
Return whether a trashcan port list is readable.
Definition: manage_sql_port_lists.c:2138
void init_port_list_target_iterator(iterator_t *iterator, port_list_t port_list, int ascending)
Initialise a port list target iterator.
Definition: manage_sql_port_lists.c:2308
int init_port_list_iterator(iterator_t *iterator, const get_data_t *get)
Initialise a Port List iterator, including observed Port Lists.
Definition: manage_sql_port_lists.c:1970
int port_list_iterator_count_udp(iterator_t *iterator)
Get the UDP port count from a port_list iterator.
Definition: manage_sql_port_lists.c:2024
int port_list_in_use(port_list_t port_list)
Return whether a port_list is in use by a task.
Definition: manage_sql_port_lists.c:2080
int trash_port_list_predefined(port_list_t port_list)
Return whether a trash port list is predefined.
Definition: manage_sql_port_lists.c:870
const char * port_range_iterator_comment(iterator_t *iterator)
Get the comment from a port range iterator.
Definition: manage_sql_port_lists.c:2234
int delete_port_range(const char *port_range_id, int dummy)
Delete a port range.
Definition: manage_sql_port_lists.c:1784
int port_list_writable(port_list_t port_list)
Check whether a Port List is writable.
Definition: manage_sql_port_lists.c:2112
int port_list_count(const get_data_t *get)
Count the number of Port Lists.
Definition: manage_sql_port_lists.c:1950
int port_list_iterator_count_all(iterator_t *iterator)
Get the port count from a port_list iterator.
Definition: manage_sql_port_lists.c:1996
int port_list_predefined(port_list_t port_list)
Return whether a port list is predefined.
Definition: manage_sql_port_lists.c:855
int port_list_iterator_predefined(iterator_t *iterator)
Get predefined status from a port_list iterator.
Definition: manage_sql_port_lists.c:2038
Command data for a get command.
Definition: manage_get.h:35
A generic SQL iterator structure.
Definition: iterator.h:50