pcaprub : make it compilable under mingw on windows , need some more testing but it looks like it is running too, see issue #4554 for comment
git-svn-id: file:///home/svn/framework3/trunk@12770 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
f33cc502f0
commit
c022ac447e
|
@ -1,16 +1,10 @@
|
|||
require 'mkmf'
|
||||
|
||||
if /i386-mswin32/ =~ RUBY_PLATFORM
|
||||
pcap_dir = with_config("pcap-dir", "C:\WpdPack")
|
||||
pcap_includedir = with_config("pcap-includedir", pcap_dir + "\\include")
|
||||
pcap_libdir = with_config("pcap-libdir", pcap_dir + "\\lib")
|
||||
|
||||
$CFLAGS = "-DWIN32 -I#{pcap_includedir}"
|
||||
$LDFLAGS = "/link /LIBPATH:#{pcap_libdir}"
|
||||
have_library("wpcap", "pcap_open_live")
|
||||
if /i386-mingw32/ =~ RUBY_PLATFORM
|
||||
dir_config("pcap","C:/WpdPack/include","C:/WpdPack/lib")
|
||||
have_library("wpcap", "pcap_open_live")
|
||||
have_library("wpcap", "pcap_setnonblock")
|
||||
else
|
||||
have_library("pcap", "pcap_open_live")
|
||||
have_library("pcap", "pcap_open_live")
|
||||
have_library("pcap", "pcap_setnonblock")
|
||||
end
|
||||
|
||||
|
|
|
@ -10,9 +10,10 @@
|
|||
#if !defined(WIN32)
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
|
||||
static VALUE rb_cPcap;
|
||||
|
||||
|
@ -459,7 +460,11 @@ rbpcap_capture(VALUE self)
|
|||
|
||||
if(! rbpcap_ready(rbp)) return self;
|
||||
|
||||
#if !defined(WIN32)
|
||||
fno = pcap_get_selectable_fd(rbp->pd);
|
||||
#else
|
||||
fno = pcap_fileno(rbp->pd);
|
||||
#endif
|
||||
|
||||
for(;;) {
|
||||
VALUE packet = rbpcap_next(self);
|
||||
|
|
Loading…
Reference in New Issue