wpcap: Implement pcap_lib_version.

This commit is contained in:
André Hentschel 2014-08-07 00:15:00 +02:00 committed by Alexandre Julliard
parent 0703567998
commit fa67586811
6 changed files with 115 additions and 1 deletions

64
configure vendored
View File

@ -676,6 +676,7 @@ XSLT_LIBS
XSLT_CFLAGS
XML2_LIBS
XML2_CFLAGS
LIBPCAP
X_EXTRA_LIBS
X_LIBS
X_PRE_LIBS
@ -822,6 +823,7 @@ with_opencl
with_opengl
with_osmesa
with_oss
with_pcap
with_png
with_pthread
with_sane
@ -2091,6 +2093,7 @@ Optional Packages:
--without-opengl do not use OpenGL
--without-osmesa do not use the OSMesa library
--without-oss do not use the OSS sound support
--without-pcap do not use the Packet Capture library
--without-png do not use PNG
--without-pthread do not use the pthread library
--without-sane do not use SANE (scanner support)
@ -3322,6 +3325,12 @@ if test "${with_oss+set}" = set; then :
fi
# Check whether --with-pcap was given.
if test "${with_pcap+set}" = set; then :
withval=$with_pcap; if test "x$withval" = "xno"; then ac_cv_header_pcap_pcap_h=no; fi
fi
# Check whether --with-png was given.
if test "${with_png+set}" = set; then :
withval=$with_png;
@ -6495,6 +6504,7 @@ for ac_header in \
netinet/in_systm.h \
netinet/tcp.h \
netinet/tcp_fsm.h \
pcap/pcap.h \
poll.h \
port.h \
process.h \
@ -10510,6 +10520,60 @@ esac
fi
test "x$ac_cv_lib_OpenCL_clGetPlatformInfo" != xyes && enable_opencl=${enable_opencl:-no}
if test "$ac_cv_header_pcap_pcap_h" = "yes"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcap_create in -lpcap" >&5
$as_echo_n "checking for pcap_create in -lpcap... " >&6; }
if ${ac_cv_lib_pcap_pcap_create+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpcap $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char pcap_create ();
int
main ()
{
return pcap_create ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_pcap_pcap_create=yes
else
ac_cv_lib_pcap_pcap_create=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcap_pcap_create" >&5
$as_echo "$ac_cv_lib_pcap_pcap_create" >&6; }
if test "x$ac_cv_lib_pcap_pcap_create" = xyes; then :
LIBPCAP="-lpcap"
fi
fi
if test "x$ac_cv_lib_pcap_pcap_create" != xyes; then :
case "x$with_pcap" in
x) as_fn_append wine_notices "|pcap ${notice_platform}development files not found, wpcap won't be supported." ;;
xno) ;;
*) as_fn_error $? "pcap ${notice_platform}development files not found, wpcap won't be supported.
This is an error since --with-pcap was requested." "$LINENO" 5 ;;
esac
fi
test "x$ac_cv_lib_pcap_pcap_create" != xyes && enable_wpcap=${enable_wpcap:-no}
if test "x$with_xml" != "xno"
then

View File

@ -67,6 +67,8 @@ AC_ARG_WITH(opencl, AS_HELP_STRING([--without-opencl],[do not use OpenCL]),
AC_ARG_WITH(opengl, AS_HELP_STRING([--without-opengl],[do not use OpenGL]))
AC_ARG_WITH(osmesa, AS_HELP_STRING([--without-osmesa],[do not use the OSMesa library]))
AC_ARG_WITH(oss, AS_HELP_STRING([--without-oss],[do not use the OSS sound support]))
AC_ARG_WITH(pcap, AS_HELP_STRING([--without-pcap],[do not use the Packet Capture library]),
[if test "x$withval" = "xno"; then ac_cv_header_pcap_pcap_h=no; fi])
AC_ARG_WITH(png, AS_HELP_STRING([--without-png],[do not use PNG]))
AC_ARG_WITH(pthread, AS_HELP_STRING([--without-pthread],[do not use the pthread library]),
[if test "x$withval" = "xno"; then ac_cv_header_pthread_h=no; fi])
@ -448,6 +450,7 @@ AC_CHECK_HEADERS(\
netinet/in_systm.h \
netinet/tcp.h \
netinet/tcp_fsm.h \
pcap/pcap.h \
poll.h \
port.h \
process.h \
@ -1268,6 +1271,15 @@ WINE_NOTICE_WITH(opencl,[test "x$ac_cv_lib_OpenCL_clGetPlatformInfo" != xyes],
[OpenCL ${notice_platform}development files not found, OpenCL won't be supported.])
test "x$ac_cv_lib_OpenCL_clGetPlatformInfo" != xyes && enable_opencl=${enable_opencl:-no}
dnl **** Check for libpcap ****
if test "$ac_cv_header_pcap_pcap_h" = "yes"
then
AC_CHECK_LIB(pcap,pcap_create,[AC_SUBST(LIBPCAP,["-lpcap"])])
fi
WINE_NOTICE_WITH(pcap,[test "x$ac_cv_lib_pcap_pcap_create" != xyes],
[pcap ${notice_platform}development files not found, wpcap won't be supported.])
test "x$ac_cv_lib_pcap_pcap_create" != xyes && enable_wpcap=${enable_wpcap:-no}
dnl **** Check for libxml2 ****
if test "x$with_xml" != "xno"

View File

@ -1 +1,5 @@
MODULE = wpcap.dll
EXTRALIBS = @LIBPCAP@
C_SRCS = \
wpcap.c

31
dlls/wpcap/wpcap.c Normal file
View File

@ -0,0 +1,31 @@
/*
* WPcap.dll Proxy.
*
* Copyright 2011 André Hentschel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <pcap/pcap.h>
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wpcap);
const char* CDECL wine_pcap_lib_version(void)
{
const char* ret = pcap_lib_version();
TRACE("%s\n", debugstr_a(ret));
return ret;
}

View File

@ -33,7 +33,7 @@
@ stub pcap_getevent
@ stub pcap_getnonblock
@ stub pcap_is_swapped
@ stub pcap_lib_version
@ cdecl pcap_lib_version() wine_pcap_lib_version
@ stub pcap_list_datalinks
@ stub pcap_live_dump
@ stub pcap_live_dump_ended

View File

@ -570,6 +570,9 @@
/* Define to 1 if `numaudioengines' is a member of `oss_sysinfo'. */
#undef HAVE_OSS_SYSINFO_NUMAUDIOENGINES
/* Define to 1 if you have the <pcap/pcap.h> header file. */
#undef HAVE_PCAP_PCAP_H
/* Define to 1 if you have the `pclose' function. */
#undef HAVE_PCLOSE