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

Abstract some things to move #includes out of headers.

This commit is contained in:
dmiller
2020-01-11 16:03:29 +00:00
parent a2c75e0ef4
commit ae10c8a19d
5 changed files with 35 additions and 36 deletions

View File

@@ -135,7 +135,8 @@
#include "nmap.h" /* MAX_DECOYS */
#include "scan_lists.h"
#include "output.h"
#include "output.h" /* LOG_NUM_FILES */
#include <nbase.h>
#include <nsock.h>
#include <string>
#include <map>

View File

@@ -136,7 +136,7 @@
#include "nbase.h"
#include "libnetutil/netutil.h"
#include "libnetutil/netutil.h" /* devtype */
#ifndef NOLUA
#include "nse_main.h"

2
nmap.h
View File

@@ -148,8 +148,6 @@
#include "nmap_amigaos.h"
#endif
#include <nbase.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@@ -141,10 +141,6 @@
#include "timing.h"
#ifndef IPPROTO_SCTP
#include "libnetutil/netutil.h"
#endif
#include <pcap.h>
#include <list>
#include <vector>
@@ -233,35 +229,9 @@ public:
void setND(u8 *ndpkt, u32 ndlen);
// The 4 accessors below all return in HOST BYTE ORDER
// source port used if TCP, UDP or SCTP
u16 sport() const {
switch (mypspec.proto) {
case IPPROTO_TCP:
return probes.IP.pd.tcp.sport;
case IPPROTO_UDP:
return probes.IP.pd.udp.sport;
case IPPROTO_SCTP:
return probes.IP.pd.sctp.sport;
default:
return 0;
}
/* not reached */
}
u16 sport() const;
// destination port used if TCP, UDP or SCTP
u16 dport() const {
switch (mypspec.proto) {
case IPPROTO_TCP:
return mypspec.pd.tcp.dport;
case IPPROTO_UDP:
return mypspec.pd.udp.dport;
case IPPROTO_SCTP:
return mypspec.pd.sctp.dport;
default:
/* dport() can get called for other protos if we
* get ICMP responses during IP proto scans. */
return 0;
}
/* not reached */
}
u16 dport() const;
u32 ipid() const {
return probes.IP.ipid;
}

View File

@@ -147,6 +147,36 @@
extern NmapOps o;
u16 UltraProbe::sport() const {
switch (mypspec.proto) {
case IPPROTO_TCP:
return probes.IP.pd.tcp.sport;
case IPPROTO_UDP:
return probes.IP.pd.udp.sport;
case IPPROTO_SCTP:
return probes.IP.pd.sctp.sport;
default:
return 0;
}
/* not reached */
}
u16 UltraProbe::dport() const {
switch (mypspec.proto) {
case IPPROTO_TCP:
return mypspec.pd.tcp.dport;
case IPPROTO_UDP:
return mypspec.pd.udp.dport;
case IPPROTO_SCTP:
return mypspec.pd.sctp.dport;
default:
/* dport() can get called for other protos if we
* get ICMP responses during IP proto scans. */
return 0;
}
/* not reached */
}
/* Pass an arp packet, including ethernet header. Must be 42bytes */
void UltraProbe::setARP(u8 *arppkt, u32 arplen) {