each source file, only the headers that file needs, and all the headers
it needs in order to compile on various platforms and not to get any
avoidable compiler warnings on those platforms (as well as any
incomplete structure definitions needed to avoid those warnings).
That also means that <pcap.h> doesn't include <pcap-stdinc.h> on UNIX;
we don't want it to include <pcap-stdinc.h>, at least on UNIX, as doing
so
1) would mean we'd have to install that, so that programs can
build with libpcap
and
2) would mean that programs including <pcap.h> would drag in a
bunch of header files that they don't need.
Put a newline at the end of "inet.c" - the Sun C compiler doesn't like
it if the last line doesn't end with a newline.
#if !(defined(lint) || defined(KERNEL) || defined(_KERNEL))
static const char rcsid[] =
#if !(defined(lint) || defined(KERNEL) || defined(_KERNEL))
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/bpf/net/bpf_filter.c,v 1.37 2002-08-01 08:33:12 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/bpf/net/bpf_filter.c,v 1.38 2002-08-02 03:44:22 guy Exp $ (LBL)";
+#else /* WIN32 */
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
#define SOLARIS (defined(sun) && (defined(__SVR4) || defined(__svr4__)))
#if defined(__hpux) || SOLARIS
# include <sys/sysmacros.h>
#define SOLARIS (defined(sun) && (defined(__SVR4) || defined(__svr4__)))
#if defined(__hpux) || SOLARIS
# include <sys/sysmacros.h>
# define MLEN(m) ((m)->m_len)
#endif
# define MLEN(m) ((m)->m_len)
#endif
#include <net/bpf.h>
#if !defined(KERNEL) && !defined(_KERNEL)
#include <net/bpf.h>
#if !defined(KERNEL) && !defined(_KERNEL)
+#ifndef WIN32
+#include <netinet/in.h>
+#endif
#define EXTRACT_SHORT(p) ((u_short)ntohs(*(u_short *)p))
#define EXTRACT_LONG(p) (ntohl(*(u_int32 *)p))
#define EXTRACT_SHORT(p) ((u_short)ntohs(*(u_short *)p))
#define EXTRACT_LONG(p) (ntohl(*(u_int32 *)p))
*/
#ifndef lint
static const char rcsid[] =
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.170 2002-08-01 08:33:01 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.171 2002-08-02 03:44:19 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <pcap-stdinc.h>
#ifdef __MINGW32__
#include "IP6_misc.h"
#endif
#include <pcap-stdinc.h>
#ifdef __MINGW32__
#include "IP6_misc.h"
#endif
+#else /* WIN32 */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/time.h>
#ifdef __NetBSD__
#include <sys/param.h>
#endif
#ifdef __NetBSD__
#include <sys/param.h>
#endif
struct rtentry; /* declarations in <net/if.h> */
#include <net/if.h>
struct rtentry; /* declarations in <net/if.h> */
#include <net/if.h>
+#include <netinet/in.h>
+
+#endif /* WIN32 */
+
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include "ppp.h"
#include "sll.h"
#include "arcnet.h"
#include "ppp.h"
#include "sll.h"
#include "arcnet.h"
+#include <netdb.h> /* for "struct addrinfo" */
#include <pcap-namedb.h>
#define ETHERMTU 1500
#include <pcap-namedb.h>
#define ETHERMTU 1500
*/
#ifndef lint
static const char rcsid[] =
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.73 2002-08-01 08:33:02 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/grammar.y,v 1.74 2002-08-02 03:44:20 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#else /* WIN32 */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#endif
#if __STDC__
struct mbuf;
struct rtentry;
#endif
#if __STDC__
struct mbuf;
struct rtentry;
#endif
+#include <net/if.h>
+
+#include <netinet/in.h>
+#endif /* WIN32 */
+
#include <stdio.h>
#include "pcap-int.h"
#include <stdio.h>
#include "pcap-int.h"
#ifndef lint
static const char rcsid[] =
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.51 2002-08-01 08:33:02 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.52 2002-08-02 03:44:20 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#else /* WIN32 */
+
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
#ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
#endif
#ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
#endif
+#include <sys/time.h> /* concession to AIX */
struct mbuf; /* Squelch compiler warnings on some platforms for */
struct rtentry; /* declarations in <net/if.h> */
#include <net/if.h>
struct mbuf; /* Squelch compiler warnings on some platforms for */
struct rtentry; /* declarations in <net/if.h> */
#include <net/if.h>
+#include <netinet/in.h>
+#endif /* WIN32 */
#include <ctype.h>
#include <errno.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif /* WIN32 */
#ifdef HAVE_LIMITS_H
#include <limits.h>
#else
#ifdef HAVE_LIMITS_H
#include <limits.h>
#else
-#endif /* WIN32 */
\ No newline at end of file
#ifndef lint
static const char rcsid[] =
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.65 2002-08-01 08:33:03 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.66 2002-08-02 03:44:20 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <pcap-stdinc.h>
#ifdef __MINGW32__
#include "IP6_misc.h"
#endif
#include <pcap-stdinc.h>
#ifdef __MINGW32__
#include "IP6_misc.h"
#endif
+#include <sys/param.h>
+#include <sys/types.h> /* concession to AIX */
+#include <sys/socket.h>
+#include <sys/time.h>
+
+#include <netinet/in.h>
#ifdef HAVE_ETHER_HOSTTON
#ifdef HAVE_NETINET_IF_ETHER_H
struct mbuf; /* Squelch compiler warnings on some platforms for */
#ifdef HAVE_ETHER_HOSTTON
#ifdef HAVE_NETINET_IF_ETHER_H
struct mbuf; /* Squelch compiler warnings on some platforms for */
#include <netinet/if_ether.h>
#endif /* HAVE_NETINET_IF_ETHER_H */
#endif /* HAVE_ETHER_HOSTTON */
#include <netinet/if_ether.h>
#endif /* HAVE_NETINET_IF_ETHER_H */
#endif /* HAVE_ETHER_HOSTTON */
+#include <arpa/inet.h>
+#include <netdb.h>
+#endif /* WIN32 */
#include <ctype.h>
#include <errno.h>
#include <ctype.h>
#include <errno.h>
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#define SIZEOF_CHAR 1
#define SIZEOF_SHORT 2
#define SIZEOF_CHAR 1
#define SIZEOF_SHORT 2
#define vsnprintf _vsnprintf
#define inline __inline
#define vsnprintf _vsnprintf
#define inline __inline
-#else
-
-#include <unistd.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/timeb.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#ifdef HAVE_SYS_SOCKIO_H
-#include <sys/sockio.h>
-#include <arpa/inet.h>
-#endif
-
#ifndef lint
static const char rcsid[] =
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.40 2002-08-01 08:33:04 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.41 2002-08-02 03:44:21 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#else /* WIN32 */
+#include <sys/types.h>
+#endif /* WIN32 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
#include <fcntl.h>
#include <errno.h>
#include <fcntl.h>
#include <errno.h>
if (p->adapter != NULL) {
PacketCloseAdapter(p->adapter);
p->adapter = NULL;
if (p->adapter != NULL) {
PacketCloseAdapter(p->adapter);
p->adapter = NULL;
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.36 2002-08-01 08:33:04 risso Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.37 2002-08-02 03:44:21 guy Exp $ (LBL)
*/
#ifndef lib_pcap_h
#define lib_pcap_h
*/
#ifndef lib_pcap_h
#define lib_pcap_h
+#else /* WIN32 */
+#include <sys/types.h>
+#include <sys/time.h>
+#endif /* WIN32 */
#ifndef lint
static const char rcsid[] =
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.88 2002-08-01 08:33:05 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/scanner.l,v 1.89 2002-08-02 03:44:21 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
#include "gencode.h"
#ifdef INET6
#include "gencode.h"
#ifdef INET6
#include <pcap-stdinc.h>
#ifdef __MINGW32__
#include "IP6_misc.h"
#endif
#include <pcap-stdinc.h>
#ifdef __MINGW32__
#include "IP6_misc.h"
#endif
+#else /* WIN32 */
+#include <sys/socket.h> /* for "struct sockaddr" in "struct addrinfo" */
+#include <netdb.h> /* for "struct addrinfo" */
+#endif /* WIN32 */
/* Workaround for AIX 4.3 */
#if !defined(AI_NUMERICHOST)
/* Workaround for AIX 4.3 */
#if !defined(AI_NUMERICHOST)