diff --git a/FPEngine.cc b/FPEngine.cc index 31c36cbe8..483c2bb7f 100644 --- a/FPEngine.cc +++ b/FPEngine.cc @@ -132,7 +132,6 @@ #include "osscan.h" #include "libnetutil/npacket.h" #include "linear.h" -#include extern NmapOps o; diff --git a/FingerPrintResults.h b/FingerPrintResults.h index fedba1341..81fee1400 100644 --- a/FingerPrintResults.h +++ b/FingerPrintResults.h @@ -130,6 +130,7 @@ class FingerPrintResults; #include "nmap.h" +#include "global_structures.h" #include "FPEngine.h" /* Maximum number of results allowed in one of these things ... */ diff --git a/NmapOps.cc b/NmapOps.cc index a4c2f7108..9837d8d6c 100644 --- a/NmapOps.cc +++ b/NmapOps.cc @@ -124,6 +124,7 @@ /* $Id$ */ #include "nmap.h" +#include "nbase.h" #include "NmapOps.h" #include "services.h" #include "utils.h" diff --git a/NmapOps.h b/NmapOps.h index d47bad93f..ad9003113 100644 --- a/NmapOps.h +++ b/NmapOps.h @@ -124,10 +124,8 @@ /* $Id$ */ -#ifndef NMAPOPS_H -#define NMAPOPS_H - #include "nmap.h" +#include "global_structures.h" #include "output.h" #include #include @@ -426,4 +424,4 @@ class NmapOps { u8 spoof_mac[6]; bool spoof_mac_set; }; -#endif /* NMAPOPS_H */ + diff --git a/idle_scan.h b/idle_scan.h index 7434c16f5..bb1709cee 100644 --- a/idle_scan.h +++ b/idle_scan.h @@ -132,6 +132,8 @@ #define IDLE_SCAN_H #include "nmap.h" +#include "global_structures.h" +#include class Target; diff --git a/nmap.cc b/nmap.cc index 744107f7d..c648bc67d 100644 --- a/nmap.cc +++ b/nmap.cc @@ -129,10 +129,12 @@ #include "osscan2.h" #include "scan_engine.h" #include "idle_scan.h" +#include "timing.h" #include "NmapOps.h" #include "MACLookup.h" #include "traceroute.h" #include "nmap_tty.h" +#include "nmap_dns.h" #include "services.h" #include "protocols.h" #include "targets.h" @@ -143,10 +145,6 @@ #include "utils.h" #include "xml.h" -#include -#include -#include - #ifndef NOLUA #include "nse_main.h" #endif diff --git a/nmap.h b/nmap.h index 2d1cc4bd6..b0185e169 100644 --- a/nmap.h +++ b/nmap.h @@ -173,6 +173,9 @@ void *realloc(); #include #endif +#include +#include + #ifndef WIN32 /* from nmapNT -- seems to work */ #include #endif /* !WIN32 */ @@ -181,6 +184,8 @@ void *realloc(); #include /* Defines MAXHOSTNAMELEN on BSD*/ #endif +#include + #if HAVE_RPC_TYPES_H #include #endif @@ -189,10 +194,14 @@ void *realloc(); #include #endif +#include + #if HAVE_NETINET_IN_H #include #endif +#include + #if HAVE_NETDB_H #include #endif @@ -208,6 +217,8 @@ void *realloc(); # endif #endif +#include +#include #ifdef HAVE_PWD_H #include @@ -225,6 +236,7 @@ void *realloc(); /* Keep assert() defined for security reasons */ #undef NDEBUG +#include #include #if HAVE_SYS_RESOURCE_H diff --git a/nmap_dns.cc b/nmap_dns.cc index 5857f657f..7665a09e9 100644 --- a/nmap_dns.cc +++ b/nmap_dns.cc @@ -194,6 +194,7 @@ #include #include #include +#include #include extern NmapOps o; diff --git a/nmap_dns.h b/nmap_dns.h index 97ffc8ffa..fc86ba0d2 100644 --- a/nmap_dns.h +++ b/nmap_dns.h @@ -120,8 +120,6 @@ * * ***************************************************************************/ -#ifndef NMAP_DNS_H -#define NMAP_DNS_H class Target; #include "nbase.h" @@ -133,4 +131,3 @@ void nmap_mass_rdns(Target ** targets, int num_targets); const char *lookup_cached_host(u32 ip); std::list get_dns_servers(); -#endif /* NMAP_DNS_H */ diff --git a/nmap_error.cc b/nmap_error.cc index 9917127f5..237de7211 100644 --- a/nmap_error.cc +++ b/nmap_error.cc @@ -127,7 +127,6 @@ #include "output.h" #include "NmapOps.h" #include "xml.h" -#include extern NmapOps o; diff --git a/nmap_tty.cc b/nmap_tty.cc index ea12cdeed..7491103de 100644 --- a/nmap_tty.cc +++ b/nmap_tty.cc @@ -121,6 +121,10 @@ * * ***************************************************************************/ +#ifndef WIN32 +#include "nmap_config.h" +#endif + #include "nmap.h" #include diff --git a/nmap_tty.h b/nmap_tty.h index 69f606361..944d9166b 100644 --- a/nmap_tty.h +++ b/nmap_tty.h @@ -121,9 +121,6 @@ * * ***************************************************************************/ -#ifndef NMAP_TTY_H -#define NMAP_TTY_H - /* * Initializes the terminal for unbuffered non-blocking input. Also * registers tty_done() via atexit(). You need to call this before @@ -136,4 +133,4 @@ void tty_init(); being returned means a nonstandard key has been pressed and the calling method should print a status message */ bool keyWasPressed(); -#endif /* NMAP_TTY_H */ + diff --git a/nse_main.cc b/nse_main.cc index 0ee525436..362d1675d 100644 --- a/nse_main.cc +++ b/nse_main.cc @@ -1,4 +1,5 @@ #include "nmap.h" +#include "nbase.h" #include "nmap_error.h" #include "portlist.h" #include "nsock.h" @@ -7,7 +8,6 @@ #include "Target.h" #include "nmap_tty.h" #include "xml.h" -#include #include "nse_main.h" #include "nse_utility.h" diff --git a/nse_main.h b/nse_main.h index a21d5d789..c264d7631 100644 --- a/nse_main.h +++ b/nse_main.h @@ -14,6 +14,7 @@ extern "C" { } #include "nmap.h" +#include "global_structures.h" class ScriptResult { diff --git a/nse_ssl_cert.h b/nse_ssl_cert.h index f49afcdfb..c8ef4bcaa 100644 --- a/nse_ssl_cert.h +++ b/nse_ssl_cert.h @@ -122,9 +122,6 @@ ***************************************************************************/ /* $Id:$ */ -#ifndef NSE_SSL_CERT_H -#define NSE_SSL_CERT_H int l_get_ssl_certificate(lua_State *L); void nse_nsock_init_ssl_cert(lua_State *L); -#endif /* NSE_SSL_CERT_H */ diff --git a/nsock/examples/nsock_telnet.c b/nsock/examples/nsock_telnet.c index 20ba126fd..8f81c50e2 100644 --- a/nsock/examples/nsock_telnet.c +++ b/nsock/examples/nsock_telnet.c @@ -64,7 +64,9 @@ #include #include #include +#include #include +#include #include #include diff --git a/nsock/examples/nsock_test_timers.c b/nsock/examples/nsock_test_timers.c index 7a9781242..f317f3d38 100644 --- a/nsock/examples/nsock_test_timers.c +++ b/nsock/examples/nsock_test_timers.c @@ -64,6 +64,7 @@ #include #include #include +#include #include #include diff --git a/osscan.h b/osscan.h index d5ce5cd4e..5437d6b3a 100644 --- a/osscan.h +++ b/osscan.h @@ -128,6 +128,7 @@ #define OSSCAN_H #include "nmap.h" +#include "global_structures.h" #include "FingerPrintResults.h" #include "Target.h" diff --git a/osscan2.cc b/osscan2.cc index 1db961731..eed70db70 100644 --- a/osscan2.cc +++ b/osscan2.cc @@ -137,7 +137,6 @@ #include "struct_ip.h" #include -#include extern NmapOps o; diff --git a/osscan2.h b/osscan2.h index e6c799490..e5a273192 100644 --- a/osscan2.h +++ b/osscan2.h @@ -129,6 +129,8 @@ #define OSSCAN2_H #include "nmap.h" +#include "global_structures.h" +#include "nbase.h" #include #include #include "Target.h" diff --git a/output.cc b/output.cc index a658f39a2..90b9025eb 100644 --- a/output.cc +++ b/output.cc @@ -139,10 +139,12 @@ #include "Target.h" #include "utils.h" #include "xml.h" +#include "nbase.h" #include "libnetutil/netutil.h" #include +#include #include #include #include diff --git a/output.h b/output.h index b82668174..52bab7c73 100644 --- a/output.h +++ b/output.h @@ -165,6 +165,7 @@ #include "portlist.h" #include "nmap.h" +#include "global_structures.h" #include #include diff --git a/payload.cc b/payload.cc index 330bf2534..3710cdb47 100644 --- a/payload.cc +++ b/payload.cc @@ -134,6 +134,7 @@ #include #include "NmapOps.h" +#include "nbase.h" #include "payload.h" #include "utils.h" diff --git a/protocols.h b/protocols.h index 1d6f1bc13..3fb7aa4c4 100644 --- a/protocols.h +++ b/protocols.h @@ -132,6 +132,8 @@ #endif #include "nmap.h" +#include "global_structures.h" +#include "nbase.h" #define PROTOCOL_TABLE_SIZE 256 diff --git a/scan_engine.h b/scan_engine.h index 7172346fd..c1988ac8c 100644 --- a/scan_engine.h +++ b/scan_engine.h @@ -129,6 +129,7 @@ #define SCAN_ENGINE_H #include "nmap.h" +#include "global_structures.h" #include struct probespec_tcpdata { diff --git a/service_scan.h b/service_scan.h index 53b2323ab..2ee692b69 100644 --- a/service_scan.h +++ b/service_scan.h @@ -129,6 +129,7 @@ #define SERVICE_SCAN_H #include "nmap.h" +#include "global_structures.h" #include "portlist.h" #include diff --git a/services.h b/services.h index 78ff26503..49d43019b 100644 --- a/services.h +++ b/services.h @@ -128,7 +128,15 @@ #ifndef SERVICES_H #define SERVICES_H +#ifdef WIN32 +#include "mswin32\winclude.h" +#else +#include +#endif #include "nmap.h" +#include "global_structures.h" + +#include "nbase.h" #define SERVICE_TABLE_SIZE 1024 diff --git a/targets.h b/targets.h index 5f74b4387..aa5aa5e73 100644 --- a/targets.h +++ b/targets.h @@ -127,7 +127,29 @@ #ifndef TARGETS_H #define TARGETS_H +#ifdef HAVE_CONFIG_H +#include "nmap_config.h" +#else +#ifdef WIN32 +#include "nmap_winconfig.h" +#endif /* WIN32 */ +#endif /* HAVE_CONFIG_H */ + +/* This contains pretty much everything we need ... */ +#if HAVE_SYS_TIME_H +#include +#endif + +#if HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include /* Defines MAXHOSTNAMELEN on BSD*/ +#endif + #include "nmap.h" +#include "global_structures.h" #include "TargetGroup.h" class TargetGroup { diff --git a/tcpip.h b/tcpip.h index a434d702e..a2b40d306 100644 --- a/tcpip.h +++ b/tcpip.h @@ -129,7 +129,78 @@ #ifndef TCPIP_H #define TCPIP_H -#include "nmap.h" +#ifdef HAVE_CONFIG_H +#include "nmap_config.h" +#endif + +#include "nbase.h" + +#ifdef WIN32 +#include "mswin32\winclude.h" +#else + +#ifdef STDC_HEADERS +#include +#else +void *malloc(); +void *realloc(); +#endif + +#if STDC_HEADERS || HAVE_STRING_H +#include +#if !STDC_HEADERS && HAVE_MEMORY_H +#include +#endif +#endif +#if HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_BSTRING_H +#include +#endif + +#include +#include + +#ifdef HAVE_SYS_PARAM_H +#include /* Defines MAXHOSTNAMELEN on BSD*/ +#endif + +#include + +#if HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_RPC_TYPES_H +#include +#endif + +#ifdef HAVE_NETDB_H +#include +#endif + +#if HAVE_SYS_SOCKET_H +#include +#endif + +#include +#if HAVE_UNISTD_H +#include +#endif +#include + +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif #include @@ -144,14 +215,17 @@ extern "C" { #if HAVE_SYS_SOCKIO_H #include /* SIOCGIFCONF for Solaris */ #endif +#endif /* WIN32 */ #include #include #include #include -/* from Target.h */ -class Target; + + +#include "nmap.h" +#include "global_structures.h" #ifndef INET_ADDRSTRLEN #define INET_ADDRSTRLEN 16 diff --git a/timing.cc b/timing.cc index c0e9aaaf8..12e9a6e25 100644 --- a/timing.cc +++ b/timing.cc @@ -130,7 +130,6 @@ #include "NmapOps.h" #include "utils.h" #include "xml.h" -#include extern NmapOps o; diff --git a/timing.h b/timing.h index 9a9af61d1..d60a67ded 100644 --- a/timing.h +++ b/timing.h @@ -130,6 +130,7 @@ #define NMAP_TIMING_H #include "nmap.h" +#include "global_structures.h" /* Call this function on a newly allocated struct timeout_info to initialize the values appropriately */ diff --git a/traceroute.h b/traceroute.h index fbe1e601e..c603f378b 100644 --- a/traceroute.h +++ b/traceroute.h @@ -123,8 +123,6 @@ /* $Id: nmap.h 6676 2008-01-12 22:39:34Z fyodor $ */ -#ifndef NMAP_TRACEROUTE_H -#define NMAP_TRACEROUTE_H #include "Target.h" #include @@ -132,4 +130,3 @@ int traceroute(std::vector &Targets); void traceroute_hop_cache_clear(); -#endif /* NMAP_TRACEROUTE_H */ diff --git a/utils.cc b/utils.cc index 917ff3508..4283fc50c 100644 --- a/utils.cc +++ b/utils.cc @@ -126,7 +126,6 @@ #include "nmap.h" #include "utils.h" #include "NmapOps.h" -#include extern NmapOps o; diff --git a/utils.h b/utils.h index 1026833e3..1506fb963 100644 --- a/utils.h +++ b/utils.h @@ -133,12 +133,38 @@ #include #include #include "nmap.h" +#ifdef WIN32 +#include "mswin32\winclude.h" +#else +#include -#ifndef WIN32 -#include +#if HAVE_NETINET_IN_H +#include #endif +#include +#include "nmap_config.h" +#endif + +#if HAVE_UNISTD_H +#include +#endif + +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +#include "nbase.h" + #include "nmap_error.h" +#include "global_structures.h" /* Arithmatic difference modulo 2^32 */ #ifndef MOD_DIFF