1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Move some private classes to TargetGroup.cc from TargetGroup.h

This commit is contained in:
dmiller
2017-08-05 20:49:54 +00:00
parent 0ef9cc7f83
commit f5d29c490f
2 changed files with 51 additions and 52 deletions

View File

@@ -135,20 +135,11 @@
#ifndef TARGETGROUP_H
#define TARGETGROUP_H
#include <limits.h>
#include <list>
#include <queue>
#include <set>
#include <string>
/* 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
type). */
typedef unsigned long bitvector_t;
/* A 256-element bit vector, representing legal values for one octet. */
typedef bitvector_t octet_bitvector[(256 - 1) / (sizeof(unsigned long) * CHAR_BIT) + 1];
class NetBlock {
public:
virtual ~NetBlock() {}
@@ -172,49 +163,6 @@ public:
virtual std::string str() const = 0;
};
class NetBlockIPv4Ranges : public NetBlock {
public:
octet_bitvector octets[4];
NetBlockIPv4Ranges();
bool next(struct sockaddr_storage *ss, size_t *sslen);
void apply_netmask(int bits);
std::string str() const;
private:
unsigned int counter[4];
};
class NetBlockIPv6Netmask : public NetBlock {
public:
void set_addr(const struct sockaddr_in6 *addr);
bool next(struct sockaddr_storage *ss, size_t *sslen);
void apply_netmask(int bits);
std::string str() const;
private:
bool exhausted;
struct sockaddr_in6 addr;
struct in6_addr start;
struct in6_addr cur;
struct in6_addr end;
};
class NetBlockHostname : public NetBlock {
public:
NetBlockHostname(const char *hostname, int af);
int af;
int bits;
NetBlock *resolve();
bool next(struct sockaddr_storage *ss, size_t *sslen);
void apply_netmask(int bits);
std::string str() const;
};
/* Adding new targets is for NSE scripts */
class NewTargets {
public: