mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Straighten out some headers and the (struct) addrset type
This commit is contained in:
@@ -136,6 +136,7 @@
|
||||
#define TARGETGROUP_H
|
||||
|
||||
#include <list>
|
||||
#include <cstddef>
|
||||
|
||||
class NetBlock;
|
||||
|
||||
@@ -157,7 +158,7 @@ public:
|
||||
/* Grab the next host from this expression (if any). Returns 0 and
|
||||
fills in ss if successful. ss must point to a pre-allocated
|
||||
sockaddr_storage structure */
|
||||
int get_next_host(struct sockaddr_storage *ss, size_t *sslen);
|
||||
int get_next_host(struct sockaddr_storage *ss, std::size_t *sslen);
|
||||
/* Returns true iff the given address is the one that was resolved to create
|
||||
this target group; i.e., not one of the addresses derived from it with a
|
||||
netmask. */
|
||||
|
||||
@@ -131,17 +131,7 @@
|
||||
#define _NBASE_ADDRSET_H
|
||||
|
||||
//#define HAVE_IPV6 1
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#include "nbase.h"
|
||||
#include <limits.h> /* CHAR_BIT */
|
||||
|
||||
/* We use bit vectors to represent what values are allowed in an IPv4 octet.
|
||||
Each vector is built up of an array of bitvector_t (any convenient integer
|
||||
|
||||
2
nmap.cc
2
nmap.cc
@@ -1769,7 +1769,7 @@ int nmap_main(int argc, char *argv[]) {
|
||||
struct hostent *target = NULL;
|
||||
time_t timep;
|
||||
char mytime[128];
|
||||
addrset exclude_group;
|
||||
struct addrset exclude_group;
|
||||
#ifndef NOLUA
|
||||
/* Only NSE scripts can add targets */
|
||||
NewTargets *new_targets = NULL;
|
||||
|
||||
14
targets.cc
14
targets.cc
@@ -206,7 +206,7 @@ void returnhost(HostGroupState *hs) {
|
||||
/* Is the host passed as Target to be excluded? Much of this logic had
|
||||
to be rewritten from wam's original code to allow for the objects */
|
||||
static int hostInExclude(struct sockaddr *checksock, size_t checksocklen,
|
||||
const addrset *exclude_group) {
|
||||
const struct addrset *exclude_group) {
|
||||
if (exclude_group == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -219,7 +219,7 @@ static int hostInExclude(struct sockaddr *checksock, size_t checksocklen,
|
||||
}
|
||||
|
||||
/* Load an exclude list from a file for --excludefile. */
|
||||
int load_exclude_file(addrset *excludelist, FILE *fp) {
|
||||
int load_exclude_file(struct addrset *excludelist, FILE *fp) {
|
||||
char host_spec[1024];
|
||||
size_t n;
|
||||
|
||||
@@ -236,7 +236,7 @@ int load_exclude_file(addrset *excludelist, FILE *fp) {
|
||||
|
||||
/* Load a comma-separated exclude list from a string, the argument to
|
||||
--exclude. */
|
||||
int load_exclude_string(addrset *excludelist, const char *s) {
|
||||
int load_exclude_string(struct addrset *excludelist, const char *s) {
|
||||
const char *begin, *p;
|
||||
|
||||
p = s;
|
||||
@@ -259,7 +259,7 @@ int load_exclude_string(addrset *excludelist, const char *s) {
|
||||
|
||||
/* A debug routine to dump some information to stdout. Invoked if debugging is
|
||||
set to 4 or higher. */
|
||||
int dumpExclude(addrset *exclude_group) {
|
||||
int dumpExclude(struct addrset *exclude_group) {
|
||||
const struct addrset_elem *elem;
|
||||
|
||||
for (elem = exclude_group->head; elem != NULL; elem = elem->next)
|
||||
@@ -495,7 +495,7 @@ bail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Target *next_target(HostGroupState *hs, const addrset *exclude_group,
|
||||
static Target *next_target(HostGroupState *hs, const struct addrset *exclude_group,
|
||||
struct scan_lists *ports, int pingtype) {
|
||||
struct sockaddr_storage ss;
|
||||
size_t sslen;
|
||||
@@ -548,7 +548,7 @@ tryagain:
|
||||
return t;
|
||||
}
|
||||
|
||||
static void refresh_hostbatch(HostGroupState *hs, const addrset *exclude_group,
|
||||
static void refresh_hostbatch(HostGroupState *hs, const struct addrset *exclude_group,
|
||||
struct scan_lists *ports, int pingtype) {
|
||||
int i;
|
||||
bool arpping_done = false;
|
||||
@@ -642,7 +642,7 @@ static void refresh_hostbatch(HostGroupState *hs, const addrset *exclude_group,
|
||||
nmap_mass_rdns(hs->hostbatch, hs->current_batch_sz);
|
||||
}
|
||||
|
||||
Target *nexthost(HostGroupState *hs, const addrset *exclude_group,
|
||||
Target *nexthost(HostGroupState *hs, const struct addrset *exclude_group,
|
||||
struct scan_lists *ports, int pingtype) {
|
||||
if (hs->next_batch_no >= hs->current_batch_sz)
|
||||
refresh_hostbatch(hs, exclude_group, ports, pingtype);
|
||||
|
||||
11
targets.h
11
targets.h
@@ -133,8 +133,9 @@
|
||||
#ifndef TARGETS_H
|
||||
#define TARGETS_H
|
||||
|
||||
#include <list>
|
||||
#include "TargetGroup.h"
|
||||
#include <list>
|
||||
#include <nbase.h>
|
||||
class Target;
|
||||
|
||||
class HostGroupState {
|
||||
@@ -173,12 +174,12 @@ public:
|
||||
};
|
||||
|
||||
/* ports is used to pass information about what ports to use for host discovery */
|
||||
Target *nexthost(HostGroupState *hs,const addrset *exclude_group,
|
||||
Target *nexthost(HostGroupState *hs,const struct addrset *exclude_group,
|
||||
struct scan_lists *ports, int pingtype);
|
||||
int load_exclude_file(addrset *exclude_group, FILE *fp);
|
||||
int load_exclude_string(addrset *exclude_group, const char *s);
|
||||
int load_exclude_file(struct addrset *exclude_group, FILE *fp);
|
||||
int load_exclude_string(struct addrset *exclude_group, const char *s);
|
||||
/* a debugging routine to dump an exclude list to stdout. */
|
||||
int dumpExclude(addrset *exclude_group);
|
||||
int dumpExclude(struct addrset *exclude_group);
|
||||
/* Returns the last host obtained by nexthost. It will be given again the next
|
||||
time you call nexthost(). */
|
||||
void returnhost(HostGroupState *hs);
|
||||
|
||||
Reference in New Issue
Block a user