Skip to content

Commit

Permalink
Strip or relocate more includes from nmap.h
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Jul 1, 2015
1 parent 982e087 commit ea4096c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 65 deletions.
1 change: 1 addition & 0 deletions TargetGroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
#include "libnetutil/netutil.h"

#include <sstream>
#include <errno.h>

#define BITVECTOR_BITS (sizeof(bitvector_t) * CHAR_BIT)
#define BIT_SET(v, n) ((v)[(n) / BITVECTOR_BITS] |= 1UL << ((n) % BITVECTOR_BITS))
Expand Down
6 changes: 6 additions & 0 deletions nmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@
#include <signal.h>
#endif

#include <fcntl.h>

#ifdef HAVE_PWD_H
#include <pwd.h>
#endif

#ifdef WIN32
#include "winfix.h"
/* This name collides in the following include. */
Expand Down
66 changes: 1 addition & 65 deletions nmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,79 +151,19 @@
#include <unistd.h>
#endif

#ifdef STDC_HEADERS
#include <stdlib.h>
#else
void *malloc();
void *realloc();
#endif

#if STDC_HEADERS || HAVE_STRING_H
#include <string.h>
#if !STDC_HEADERS && HAVE_MEMORY_H
#include <memory.h>
#endif
#endif
#if HAVE_STRINGS_H
#include <strings.h>
#endif

#ifdef HAVE_BSTRING_H
#include <bstring.h>
#endif

#include <ctype.h>
#include <sys/types.h>

#ifndef WIN32 /* from nmapNT -- seems to work */
#include <sys/wait.h>
#endif /* !WIN32 */

#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h> /* Defines MAXHOSTNAMELEN on BSD*/
#endif

#if HAVE_RPC_TYPES_H
/* Is this needed any more since rpcgrind was converted to NSE? */
#include <rpc/types.h>
#endif

#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif

#include <sys/stat.h>

#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif

#include <errno.h>

#if HAVE_NETDB_H
#include <netdb.h>
#endif

#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif

#include <fcntl.h>

#ifdef HAVE_PWD_H
#include <pwd.h>
#endif

#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif

/* For systems without SCTP in netinet/in.h, such as MacOS X */
#ifndef IPPROTO_SCTP
#define IPPROTO_SCTP 132
Expand All @@ -234,10 +174,6 @@ void *realloc();

#include <assert.h>

#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif

/*#include <net/if_arp.h> *//* defines struct arphdr needed for if_ether.h */
// #if HAVE_NET_IF_H
// #ifndef NET_IF_H /* why doesn't OpenBSD do this?! */
Expand Down
2 changes: 2 additions & 0 deletions nmap_error.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@
#include "NmapOps.h"
#include "xml.h"

#include <errno.h>

extern NmapOps o;

#ifdef WIN32
Expand Down
1 change: 1 addition & 0 deletions osscan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
#include "Target.h"
#include "nmap_error.h"

#include <errno.h>
#include <stdarg.h>
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
Expand Down
2 changes: 2 additions & 0 deletions scan_engine_connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@
#include "libnetutil/netutil.h" /* for max_sd() */
#include "NmapOps.h"

#include <errno.h>

extern NmapOps o;

/* Sets this UltraProbe as type UP_CONNECT, preparing to connect to given
Expand Down
2 changes: 2 additions & 0 deletions service_scan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@

#include "nmap_tty.h"

#include <errno.h>

#if HAVE_OPENSSL
/* OpenSSL 1.0.0 needs _WINSOCKAPI_ to be defined, otherwise it loads
<windows.h> (through openssl/dtls1.h), which is incompatible with the
Expand Down
3 changes: 3 additions & 0 deletions utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
#include "utils.h"
#include "NmapOps.h"

#include <fcntl.h>
#include <errno.h>

extern NmapOps o;

/* Test a wildcard mask against a test string. Wildcard mask can include '*' and
Expand Down

0 comments on commit ea4096c

Please sign in to comment.