OpenVAS Libraries  4.0+rc3.SVN
hg/hosts_gatherer.h
00001 /*
00002  * Copyright (C) 1999 Renaud Deraison
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public
00015  * License along with this library; if not, write to the Free
00016  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00017  */
00018 
00019 #ifndef HOSTS_GATHERER_H__
00020 #define HOSTS_GATHERER_H__
00021 
00022 #include <netinet/in.h>         /* for in_addr */
00023 #include "../misc/arglists.h"
00024 
00025 #ifndef INADDR_NONE
00026 #define INADDR_NONE 0xffffffff
00027 #endif
00028 
00029 
00030 #undef DEBUG
00031 #undef DEBUG_HIGH
00032 
00033 
00034 /* Flags for hg_hlobals */
00035 #define HG_NFS                1
00036 #define HG_DNS_AXFR           2
00037 #define HG_SUBNET             4
00038 #define HG_PING               8
00039 #define HG_REVLOOKUP       16 /* Are we allowed to use the DNS ? */
00040 #define HG_REVLOOKUP_AS_PING 32
00041 #define HG_DISTRIBUTE      64
00042 
00043 struct hg_host
00044 {
00045   char *hostname;       
00046   char *domain;                 
00047   struct in_addr addr;  
00048   struct in6_addr in6addr;      /* Host IP */
00049   int cidr_netmask;     
00050   /* When given a /N notation, we 
00051      put this as the upper limit
00052      of the network */
00053   struct in_addr min;
00054   struct in_addr max;
00055   struct in6_addr min6;
00056   struct in6_addr max6;
00057   int use_max:1;                /* use the field above ?        */
00058   unsigned int tested:1;
00059   unsigned int alive:1;
00060   struct hg_host *next;
00061 };
00062 
00063 struct hg_globals
00064 {
00065   struct hg_host *host_list;           
00066   struct hg_host *tested;              
00067   int flags;                           
00068   char *input;                         
00069   char *marker;
00070   int counter;
00071   unsigned int distribute;
00072 };
00073 
00074 struct hg_globals *hg_init (char *, int);
00075 int hg_next_host (struct hg_globals *, struct in6_addr *, char *, int);
00076 void hg_cleanup (struct hg_globals *);
00077 
00078 int hg_test_syntax (char *hostname, int flags);
00079 
00080 #endif