Add #define HAVE_PCAP_H 1 to config.h.win32.

In libpcap.c, move wtap_pcap_encap_to_wtap_encap before libpcap_open
so that if HAVE_PCAP_H is not true, the file will still compile.

svn path=/trunk/; revision=5660
This commit is contained in:
Gilbert Ramirez 2002-06-10 15:45:30 +00:00
parent 4754a67c12
commit 87e011637c
2 changed files with 15 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $Id: config.h.win32,v 1.8 2001/04/06 03:52:45 gram Exp $ */
/* $Id: config.h.win32,v 1.9 2002/06/10 15:45:30 gram Exp $ */
/* config.h.win32 Generated manually. :-) */
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
@ -48,6 +48,7 @@
#define HAVE_IO_H 1
#define open _open
#define close _close
#define HAVE_PCAP_H 1
/* Needed for zlib, according to http://www.winimage.com/zLibDll/ */
/*#define ZLIB_DLL 1

View File

@ -1,6 +1,6 @@
/* libpcap.c
*
* $Id: libpcap.c,v 1.76 2002/06/07 21:11:24 guy Exp $
* $Id: libpcap.c,v 1.77 2002/06/10 15:45:30 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@ -390,6 +390,18 @@ static const struct {
};
#define NUM_PCAP_ENCAPS (sizeof pcap_to_wtap_map / sizeof pcap_to_wtap_map[0])
int wtap_pcap_encap_to_wtap_encap(int encap)
{
unsigned int i;
for (i = 0; i < NUM_PCAP_ENCAPS; i++) {
if (pcap_to_wtap_map[i].dlt_value == encap)
return pcap_to_wtap_map[i].wtap_encap_value;
}
return WTAP_ENCAP_UNKNOWN;
}
int libpcap_open(wtap *wth, int *err)
{
int bytes_read;
@ -1140,17 +1152,6 @@ libpcap_close(wtap *wth)
g_free(wth->capture.pcap);
}
int wtap_pcap_encap_to_wtap_encap(int encap)
{
unsigned int i;
for (i = 0; i < NUM_PCAP_ENCAPS; i++) {
if (pcap_to_wtap_map[i].dlt_value == encap)
return pcap_to_wtap_map[i].wtap_encap_value;
}
return WTAP_ENCAP_UNKNOWN;
}
static int wtap_wtap_encap_to_pcap_encap(int encap)
{
unsigned int i;