OpenVAS Libraries  4.0+rc3.SVN
hosts_gatherer.h
1 /*
2  * Copyright (C) 1999 Renaud Deraison
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the Free
16  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef HOSTS_GATHERER_H__
20 #define HOSTS_GATHERER_H__
21 
22 #include <netinet/in.h> /* for in_addr */
23 #include "../misc/arglists.h"
24 
25 #ifndef INADDR_NONE
26 #define INADDR_NONE 0xffffffff
27 #endif
28 
29 
30 #undef DEBUG
31 #undef DEBUG_HIGH
32 
33 
34 /* Flags for hg_hlobals */
35 #define HG_NFS 1
36 #define HG_DNS_AXFR 2
37 #define HG_SUBNET 4
38 #define HG_PING 8
39 #define HG_REVLOOKUP 16 /* Are we allowed to use the DNS ? */
40 #define HG_REVLOOKUP_AS_PING 32
41 #define HG_DISTRIBUTE 64
42 
43 struct hg_host
44 {
45  char *hostname;
46  char *domain;
47  struct in_addr addr;
48  struct in6_addr in6addr; /* Host IP */
50  /* When given a /N notation, we
51  put this as the upper limit
52  of the network */
53  struct in_addr min;
54  struct in_addr max;
55  struct in6_addr min6;
56  struct in6_addr max6;
57  int use_max:1; /* use the field above ? */
58  unsigned int tested:1;
59  unsigned int alive:1;
60  struct hg_host *next;
61 };
62 
63 struct hg_globals
64 {
65  struct hg_host *host_list;
66  struct hg_host *tested;
67  int flags;
68  char *input;
69  char *marker;
70  int counter;
71  unsigned int distribute;
72 };
73 
74 struct hg_globals *hg_init (char *, int);
75 int hg_next_host (struct hg_globals *, struct in6_addr *, char *, int);
76 void hg_cleanup (struct hg_globals *);
77 
78 int hg_test_syntax (char *hostname, int flags);
79 
80 #endif