Jonathan Paisley
4/11/2005 9:35:00 AM
On Sat, 09 Apr 2005 00:15:14 +0900, Ghislain Mary wrote:
> So I was wondering if you know of an other library to handle pcap files
> in ruby or if someone is working on a newer version for this library. If
> not, I could try to update it to handle the last version of libpcap.
I've used that library and linked against libpcap 0.8.3. I don't think the
libpcap API has changed much.
The only change I made was to correct a run-time warning to do with symbols.
See patch below.
diff -ur orig/pcap/Pcap.c pcap/Pcap.c
--- orig/pcap/Pcap.c Sun Aug 13 06:56:31 2000
+++ pcap/Pcap.c Tue Dec 9 02:08:19 2003
@@ -782,9 +782,9 @@
/* define class PcapStat */
cPcapStat = rb_funcall(rb_cStruct, rb_intern("new"), 4,
Qnil,
- INT2NUM(rb_intern("recv")),
- INT2NUM(rb_intern("drop")),
- INT2NUM(rb_intern("ifdrop")));
+ ID2SYM(rb_intern("recv")),
+ ID2SYM(rb_intern("drop")),
+ ID2SYM(rb_intern("ifdrop")));
rb_define_const(mPcap, "Stat", cPcapStat);
/* define exception classes */