OpenVAS Libraries
7.0.6
Main Page
Related Pages
Data Structures
Files
File List
Globals
base
openvas_hosts.h
Go to the documentation of this file.
1
/* openvas-libraries/base
2
* $Id$
3
* Description: API (structs and protos) for Hosts objects
4
*
5
* Authors:
6
* Hani Benhabiles <hani.benhabiles@greenbone.net>
7
* Jan-Oliver Wagner <jan-oliver.wagner@greenbone.net>
8
*
9
* Copyright:
10
* Copyright (C) 2013 Greenbone Networks GmbH
11
*
12
* This program is free software; you can redistribute it and/or modify
13
* it under the terms of the GNU General Public License version 2,
14
* or, at your option, any later version as published by the Free
15
* Software Foundation
16
*
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software
24
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
25
*/
26
35
#ifndef _OPENVAS_HOSTS_H
36
#define _OPENVAS_HOSTS_H
37
38
#include "
openvas_networking.h
"
39
40
#include <glib.h>
41
#include <ctype.h>
42
#include <string.h>
43
#include <stdio.h>
44
#include <stdlib.h>
45
#include <errno.h>
46
#include <arpa/inet.h>
47
#include <netdb.h>
48
49
/* Static values */
50
51
enum
host_type
{
52
HOST_TYPE_NAME
= 0,
/* Hostname eg. foo */
53
HOST_TYPE_IPV4
,
/* eg. 192.168.1.1 */
54
HOST_TYPE_CIDR_BLOCK
,
/* eg. 192.168.15.0/24 */
55
HOST_TYPE_RANGE_SHORT
,
/* eg. 192.168.15.10-20 */
56
HOST_TYPE_RANGE_LONG
,
/* eg. 192.168.15.10-192.168.18.3 */
57
HOST_TYPE_IPV6
,
/* eg. ::1 */
58
HOST_TYPE_CIDR6_BLOCK
,
/* eg. ::ffee/120 */
59
HOST_TYPE_RANGE6_LONG
,
/* eg. ::1:200:7-::1:205:500 */
60
HOST_TYPE_RANGE6_SHORT
,
/* eg. ::1-fe10 */
61
HOST_TYPE_MAX
/* Boundary checking. */
62
};
63
64
/* Typedefs */
65
typedef
struct
openvas_host
openvas_host_t
;
66
typedef
struct
openvas_hosts
openvas_hosts_t
;
67
68
/* Data structures. */
69
76
struct
openvas_host
77
{
78
union
{
79
gchar *
name
;
/* Hostname. */
80
struct
in_addr
addr
;
/* IPv4 address */
81
struct
in6_addr
addr6
;
/* IPv6 address */
82
};
83
enum
host_type
type
;
/* HOST_TYPE_NAME, HOST_TYPE_IPV4 or HOST_TYPE_IPV6. */
84
};
85
92
struct
openvas_hosts
93
{
94
gchar *
orig_str
;
/* Original hosts definition string. */
95
GList *
hosts
;
/* Hosts objects list. */
96
GList *
current
;
/* Current host object in iteration. */
97
unsigned
int
count
;
/* Number of single host objects in hosts list. */
98
unsigned
int
removed
;
/* Number of duplicate/excluded values. */
99
};
100
101
/* Function prototypes. */
102
103
/* openvas_hosts_t related */
104
openvas_hosts_t
*
105
openvas_hosts_new
(
const
gchar *);
106
107
openvas_hosts_t
*
108
openvas_hosts_new_with_max
(
const
gchar *,
unsigned
int
);
109
110
openvas_host_t
*
111
openvas_hosts_next
(
openvas_hosts_t
*);
112
113
void
114
openvas_hosts_free
(
openvas_hosts_t
*);
115
116
void
117
openvas_hosts_shuffle
(
openvas_hosts_t
*);
118
119
void
120
openvas_hosts_reverse
(
openvas_hosts_t
*);
121
122
void
123
openvas_hosts_resolve
(
openvas_hosts_t
*);
124
125
int
126
openvas_hosts_exclude
(
openvas_hosts_t
*,
const
gchar *,
int
);
127
128
int
129
openvas_hosts_reverse_lookup_only
(
openvas_hosts_t
*);
130
131
int
132
openvas_hosts_reverse_lookup_unify
(
openvas_hosts_t
*);
133
134
unsigned
int
135
openvas_hosts_count
(
const
openvas_hosts_t
*);
136
137
unsigned
int
138
openvas_hosts_removed
(
const
openvas_hosts_t
*);
139
140
/* openvas_host_t related */
141
142
int
143
openvas_host_in_hosts
(
const
openvas_host_t
*,
const
struct
in6_addr *,
144
const
openvas_hosts_t
*);
145
146
gchar *
147
openvas_host_type_str
(
const
openvas_host_t
*);
148
149
int
150
openvas_host_type
(
const
openvas_host_t
*);
151
152
gchar *
153
openvas_host_value_str
(
const
openvas_host_t
*);
154
155
int
156
openvas_host_resolve
(
const
openvas_host_t
*,
void
*,
int
);
157
158
int
159
openvas_host_get_addr6
(
const
openvas_host_t
*,
struct
in6_addr *);
160
161
#endif
/* not _OPENVAS_HOSTS_H */
Generated by
1.8.3.1