diff --git a/NmapOps.h b/NmapOps.h index 7a290fd63..78ea32476 100644 --- a/NmapOps.h +++ b/NmapOps.h @@ -135,7 +135,8 @@ #include "nmap.h" /* MAX_DECOYS */ #include "scan_lists.h" -#include "output.h" +#include "output.h" /* LOG_NUM_FILES */ +#include #include #include #include diff --git a/Target.h b/Target.h index 91d12675c..a4e3e656b 100644 --- a/Target.h +++ b/Target.h @@ -136,7 +136,7 @@ #include "nbase.h" -#include "libnetutil/netutil.h" +#include "libnetutil/netutil.h" /* devtype */ #ifndef NOLUA #include "nse_main.h" diff --git a/nmap.h b/nmap.h index f00ea6ecc..e5e3f8e24 100644 --- a/nmap.h +++ b/nmap.h @@ -148,8 +148,6 @@ #include "nmap_amigaos.h" #endif -#include - #if HAVE_UNISTD_H #include #endif diff --git a/scan_engine.h b/scan_engine.h index 629c2935e..a711bcba3 100644 --- a/scan_engine.h +++ b/scan_engine.h @@ -141,10 +141,6 @@ #include "timing.h" -#ifndef IPPROTO_SCTP -#include "libnetutil/netutil.h" -#endif - #include #include #include @@ -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; } diff --git a/scan_engine_raw.cc b/scan_engine_raw.cc index cf157eb34..89652dc01 100644 --- a/scan_engine_raw.cc +++ b/scan_engine_raw.cc @@ -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) {