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

Get rid of "using namespace std".

This entails using names like std::vector and std::list rather than bare
vector and list, which was already the prevailing style. The immediate
cause of this is a header file on Solaris 10 that uses a "struct map"
that conflicts with std::map.

In file included from struct_ip.h:40:0,
                 from tcpip.cc:108:
/usr/include/net/if.h:99:9: error: template argument required for 'struct map'
This commit is contained in:
david
2012-03-19 16:48:27 +00:00
parent a85a47d816
commit 9698ccabaf
3 changed files with 23 additions and 26 deletions

View File

@@ -613,7 +613,7 @@ FPEngine::~FPEngine() {
* *
* dst host fe80::250:56ff:fec0:1 * dst host fe80::250:56ff:fec0:1
*/ */
const char *FPEngine::bpf_filter(vector<Target *> &Targets) { const char *FPEngine::bpf_filter(std::vector<Target *> &Targets) {
static char pcap_filter[2048]; static char pcap_filter[2048];
/* 20 IPv6 addresses is max (46 byte addy + 14 (" or src host ")) * 20 == 1200 */ /* 20 IPv6 addresses is max (46 byte addy + 14 (" or src host ")) * 20 == 1200 */
char dst_hosts[1220]; char dst_hosts[1220];
@@ -1047,12 +1047,12 @@ static void classify(FingerPrintResultsIPv6 *FPR) {
* results and matching fingerprints. If everything goes well, the internal * results and matching fingerprints. If everything goes well, the internal
* state of the supplied target objects will be modified to reflect the results * state of the supplied target objects will be modified to reflect the results
* of the */ * of the */
int FPEngine6::os_scan(vector<Target *> &Targets) { int FPEngine6::os_scan(std::vector<Target *> &Targets) {
bool osscan_done = false; bool osscan_done = false;
const char *bpf_filter = NULL; const char *bpf_filter = NULL;
vector<FPHost6 *> curr_hosts; /* Hosts currently doing OS detection */ std::vector<FPHost6 *> curr_hosts; /* Hosts currently doing OS detection */
vector<FPHost6 *> done_hosts; /* Hosts for which we already did OSdetect */ std::vector<FPHost6 *> done_hosts; /* Hosts for which we already did OSdetect */
vector<FPHost6 *> left_hosts; /* Hosts we have not yet started with */ std::vector<FPHost6 *> left_hosts; /* Hosts we have not yet started with */
struct timeval begin_time; struct timeval begin_time;
if (o.debugging) if (o.debugging)

View File

@@ -98,11 +98,9 @@
#define __FPENGINE_H__ 1 #define __FPENGINE_H__ 1
#include "nsock.h" #include "nsock.h"
#include <list>
#include <vector> #include <vector>
#include "nmap.h" #include "nmap.h"
#include "libnetutil/npacket.h" #include "libnetutil/npacket.h"
using namespace std;
/* Mention some classes here so we don't have to place the declarations in /* Mention some classes here so we don't have to place the declarations in
* the right order (otherwise the compiler complains). */ * the right order (otherwise the compiler complains). */
@@ -176,7 +174,7 @@ class FPNetworkControl {
bool first_pcap_scheduled; /* True if we scheduled the first pcap read event. */ bool first_pcap_scheduled; /* True if we scheduled the first pcap read event. */
bool nsock_init; /* True if the nsock pool has been initialized. */ bool nsock_init; /* True if the nsock pool has been initialized. */
int rawsd; /* Raw socket. */ int rawsd; /* Raw socket. */
vector<FPHost *> callers; /* List of users of this instance (used for callbacks).*/ std::vector<FPHost *> callers; /* List of users of this instance (used for callbacks).*/
int probes_sent; /* Number of unique probes sent (not retransmissions). */ int probes_sent; /* Number of unique probes sent (not retransmissions). */
int responses_recv; /* Number of probe responses received. */ int responses_recv; /* Number of probe responses received. */
int probes_timedout; /* Number of probes that timeout after all retransms. */ int probes_timedout; /* Number of probes that timeout after all retransms. */
@@ -228,8 +226,8 @@ class FPEngine {
FPEngine(); FPEngine();
~FPEngine(); ~FPEngine();
void reset(); void reset();
virtual int os_scan(vector<Target *> &Targets) = 0; virtual int os_scan(std::vector<Target *> &Targets) = 0;
const char *bpf_filter(vector<Target *> &Targets); const char *bpf_filter(std::vector<Target *> &Targets);
}; };
@@ -242,13 +240,13 @@ class FPEngine {
class FPEngine6 : public FPEngine { class FPEngine6 : public FPEngine {
private: private:
vector<FPHost6 *> fphosts; /* Information about each target to fingerprint */ std::vector<FPHost6 *> fphosts; /* Information about each target to fingerprint */
public: public:
FPEngine6(); FPEngine6();
~FPEngine6(); ~FPEngine6();
void reset(); void reset();
int os_scan(vector<Target *> &Targets); int os_scan(std::vector<Target *> &Targets);
}; };

View File

@@ -104,7 +104,6 @@
#include <list> #include <list>
#include "Target.h" #include "Target.h"
class Target; class Target;
using namespace std;
/****************************************************************************** /******************************************************************************
@@ -212,12 +211,12 @@ class HostOsScanStats {
void initScanStats(); void initScanStats();
struct eth_nfo *fill_eth_nfo(struct eth_nfo *eth, eth_t *ethsd) const; struct eth_nfo *fill_eth_nfo(struct eth_nfo *eth, eth_t *ethsd) const;
void addNewProbe(OFProbeType type, int subid); void addNewProbe(OFProbeType type, int subid);
void removeActiveProbe(list<OFProbe *>::iterator probeI); void removeActiveProbe(std::list<OFProbe *>::iterator probeI);
/* Get an active probe from active probe list identified by probe type /* Get an active probe from active probe list identified by probe type
* and subid. returns probesActive.end() if there isn't one. */ * and subid. returns probesActive.end() if there isn't one. */
list<OFProbe *>::iterator getActiveProbe(OFProbeType type, int subid); std::list<OFProbe *>::iterator getActiveProbe(OFProbeType type, int subid);
void moveProbeToActiveList(list<OFProbe *>::iterator probeI); void moveProbeToActiveList(std::list<OFProbe *>::iterator probeI);
void moveProbeToUnSendList(list<OFProbe *>::iterator probeI); void moveProbeToUnSendList(std::list<OFProbe *>::iterator probeI);
unsigned int numProbesToSend() {return probesToSend.size();} unsigned int numProbesToSend() {return probesToSend.size();}
unsigned int numProbesActive() {return probesActive.size();} unsigned int numProbesActive() {return probesActive.size();}
FingerPrint *getFP() {return FP;} FingerPrint *getFP() {return FP;}
@@ -256,8 +255,8 @@ class HostOsScanStats {
* probesToSend and appended to probesActive. If any probes in * probesToSend and appended to probesActive. If any probes in
* probesActive are timedout, they will be moved to probesToSend and * probesActive are timedout, they will be moved to probesToSend and
* sent again till expired. */ * sent again till expired. */
list<OFProbe *> probesToSend; std::list<OFProbe *> probesToSend;
list<OFProbe *> probesActive; std::list<OFProbe *> probesActive;
/* A record of total number of probes that have been sent to this /* A record of total number of probes that have been sent to this
* host, including restranmited ones. */ * host, including restranmited ones. */
@@ -432,14 +431,14 @@ private:
class OsScanInfo { class OsScanInfo {
public: public:
OsScanInfo(vector<Target *> &Targets); OsScanInfo(std::vector<Target *> &Targets);
~OsScanInfo(); ~OsScanInfo();
float starttime; float starttime;
/* If you remove from this, you had better adjust nextI too (or call /* If you remove from this, you had better adjust nextI too (or call
* resetHostIterator() afterward). Don't let this list get empty, * resetHostIterator() afterward). Don't let this list get empty,
* then add to it again, or you may mess up nextI (I'm not sure) */ * then add to it again, or you may mess up nextI (I'm not sure) */
list<HostOsScanInfo *> incompleteHosts; std::list<HostOsScanInfo *> incompleteHosts;
unsigned int numIncompleteHosts() {return incompleteHosts.size();} unsigned int numIncompleteHosts() {return incompleteHosts.size();}
HostOsScanInfo *findIncompleteHost(struct sockaddr_storage *ss); HostOsScanInfo *findIncompleteHost(struct sockaddr_storage *ss);
@@ -459,7 +458,7 @@ class OsScanInfo {
private: private:
unsigned int numInitialTargets; unsigned int numInitialTargets;
list<HostOsScanInfo *>::iterator nextI; std::list<HostOsScanInfo *>::iterator nextI;
}; };
@@ -493,15 +492,15 @@ class OSScan {
private: private:
int ip_ver; /* IP version for the OS Scan (4 or 6) */ int ip_ver; /* IP version for the OS Scan (4 or 6) */
int chunk_and_do_scan(vector<Target *> &Targets, int family); int chunk_and_do_scan(std::vector<Target *> &Targets, int family);
int os_scan_ipv4(vector<Target *> &Targets); int os_scan_ipv4(std::vector<Target *> &Targets);
int os_scan_ipv6(vector<Target *> &Targets); int os_scan_ipv6(std::vector<Target *> &Targets);
public: public:
OSScan(); OSScan();
~OSScan(); ~OSScan();
void reset(); void reset();
int os_scan(vector<Target *> &Targets); int os_scan(std::vector<Target *> &Targets);
}; };
#endif /*OSSCAN2_H*/ #endif /*OSSCAN2_H*/