Getting winpcap, Click and Cygwin to work together
Douglas S. J. De Couto
decouto at lcs.mit.edu
Tue Jul 9 14:17:05 EDT 2002
Gibson, Ian wrote:
> Hi there,
>
> It's been a bit of a steep learning curve, but we've got Click-1.2.4 built
> and running under Cygwin, and also built wincap using the Cygwin gcc patch
> provided by Nate Lawson (now part of the winpcap download).
>
Ian, sounds great! i was playing with this, and had to patch the
configure scripts to get click to find and use u_intXX_t -- I couldn't
find uintXX_t in my cygwin installation anywhere. I was using click
from CVS, though. what versions of cygwin were you using? i think i
was using 1.3.12-2, installed last week....i am enclosing my patched for
this at the end of the email....
i had another random problem with my cygwin installation's toolchain not
compiling c++ code correctly: global object constructors weren't being
called....have you seen any problems with this?
> So, the next step beckons - how best to get the userlevel Click to talk to
> winpcap.
>
> The two options that present themselves are:
>
> 1) Write specific elements to provide an equivalent of the ToHost and
> FromHost functionality.
>
> 2) Try and get the libpcap.a file produced under gcc/Cygwin to link in with
> the existing Click version.
>
>
> Option (2) would be more pleasing, but I suspect option (1) would be easier.
>
> Any suggestions welcome!
>
There are two problems:
a) KernelTap: to send/receive packets to/from the o/s
Does the winpcap provide this functionality? On linux/BSD it's done
with the tun/tap devices.
b) To/FromDevice.u: send/receive packets to/from network devices. This
is done with pcap on the linux/BSD, and i think is what winpcap can be
used for. Your option (2) sounds best for this, since it could avoid a
lot of mess in the configure scripts and avoids polluting To/FromDevice
with win32 code.
------------------------------------8<-----------------------
Index: config.h.in
===================================================================
RCS file: /home/butt/click/cvsroot/release/one/config.h.in,v
retrieving revision 1.18
diff -u -r1.18 config.h.in
--- config.h.in 30 Apr 2002 06:11:07 -0000 1.18
+++ config.h.in 8 Jul 2002 22:01:17 -0000
@@ -18,8 +18,25 @@
/* Define if PollDevice should run fast to get good benchmark numbers */
#undef CLICK_WARP9
+/* Define if we should use u_intXX_t instead of uintXX_t int types */
+#undef HAVE_U_INTXX_TYPES
+#ifdef HAVE_U_INTXX_TYPES
+#include <sys/types.h>
+typedef u_int8_t uint8_t;
+typedef u_int16_t uint16_t;
+typedef u_int32_t uint32_t;
+typedef unsigned int uintptr_t; /* XXX ??? */
+#endif
+
/* Define if 64-bit integer types are enabled. */
#undef HAVE_INT64_TYPES
+
+/* Define if we should use u_int64_t instead of uint64_t */
+#undef HAVE_U_INT64_TYPE
+#ifdef HAVE_U_INT64_TYPE
+#include <sys/types.h>
+typedef u_int64_t uint64_t;
+#endif
/* Define if the machine is indifferent to alignment. */
#undef HAVE_INDIFFERENT_ALIGNMENT
Index: acclick.m4
===================================================================
RCS file: /home/butt/click/cvsroot/release/one/acclick.m4,v
retrieving revision 1.14
diff -u -r1.14 acclick.m4
--- acclick.m4 3 May 2002 16:00:44 -0000 1.14
+++ acclick.m4 8 Jul 2002 22:01:03 -0000
@@ -420,31 +420,35 @@
dnl CLICK_CHECK_INTEGER_TYPES
dnl Finds definitions for 'int8_t' ... 'int32_t' and 'uint8_t' ...
'uint32_t'.
dnl Also defines shell variable 'have_inttypes_h' to 'yes' iff the header
-dnl file <inttypes.h> exists.
+dnl file <inttypes.h> exists. If 'uintXX_t' doesn't exist, try
'u_intXX_t'.
dnl
-
AC_DEFUN([CLICK_CHECK_INTEGER_TYPES], [
AC_CHECK_HEADERS(inttypes.h, have_inttypes_h=yes, have_inttypes_h=no)
if test $have_inttypes_h = no; then
-
AC_CACHE_CHECK(for uintXX_t typedefs, ac_cv_uint_t,
-
[AC_EGREP_HEADER(uint32_t, sys/types.h, ac_cv_uint_t=yes, ac_cv_uint_t=no)])
+
AC_CACHE_VAL(ac_cv_uint_t,
+
[AC_CHECK_TYPE(uint32_t, ac_cv_uint_t=yes, ac_cv_uint_t=no)])
if test $ac_cv_uint_t = no; then
-
AC_MSG_ERROR([
+
AC_CACHE_VAL(ac_cv_u_int_t,
+ [AC_CHECK_TYPE(u_int32_t, ac_cv_u_int_t=yes, ac_cv_u_int_t=no)])
+
if test $ac_cv_u_int_t = no; then
+
AC_MSG_ERROR([
=========================================
-uint32_t not defined by <inttypes.h> or <sys/types.h>!
+Neither uint32_t nor u_int32_t defined by <inttypes.h> or <sys/types.h>!
=========================================])
+
else
+
AC_DEFINE(HAVE_U_INTXX_TYPES)
+
fi
fi
fi])
-
dnl
dnl CLICK_CHECK_INT64_TYPES
dnl Finds definitions for 'int64_t' and 'uint64_t'.
dnl On input, shell variable 'have_inttypes_h' should be 'yes' if the
header
-dnl file <inttypes.h> exists.
+dnl file <inttypes.h> exists. If no 'uint64_t', looks for 'u_int64_t'.
dnl
AC_DEFUN([CLICK_CHECK_INT64_TYPES], [
@@ -454,17 +458,24 @@
inttypes_hdr='sys/types.h'
fi
- AC_CACHE_CHECK(for int64_t typedef, ac_cv_int64_t,
-[AC_EGREP_HEADER(int64_t, $inttypes_hdr, ac_cv_int64_t=yes,
ac_cv_int64_t=no)])
- AC_CACHE_CHECK(for uint64_t typedef, ac_cv_uint64_t,
-[AC_EGREP_HEADER(uint64_t, $inttypes_hdr, ac_cv_uint64_t=yes,
ac_cv_uint64_t=no)])
+ AC_CACHE_VAL(ac_cv_int64_t,
+[AC_CHECK_TYPE(int64_t, ac_cv_int64_t=yes, ac_cv_int64_t=no)])
+ AC_CACHE_VAL(ac_cv_uint64_t,
+[AC_CHECK_TYPE(uint64_t, ac_cv_uint64_t=yes, ac_cv_uint64_t=no)])
+ if test $ac_cv_uint64_t = no; then
+
AC_CACHE_VAL(ac_cv_u_int64_t,
+
[AC_CHECK_TYPE(u_int64_t, ac_cv_u_int64_t=yes, ac_cv_u_int64_t=no)])
+
if test $ac_cv_u_int64_t = yes; then
+
AC_DEFINE(HAVE_U_INT64_TYPE)
+
fi
+ fi
have_int64_types=
- if test $ac_cv_int64_t = no -o $ac_cv_uint64_t = no; then
+ if test $ac_cv_int64_t = no -o \( $ac_cv_uint64_t = no -a
$ac_cv_u_int64_t = no \); then
AC_MSG_ERROR([
=========================================
-int64_t types not defined by $inttypes_hdr!
+int64_t types not defined in $inttypes_hdr!
Compile with "'`'"--disable-int64'.
=========================================])
------------------------------------8<------------------------
--
Douglas S. J. De Couto decouto at lcs.mit.edu
More information about the click
mailing list