diff -u libpcap-ruby-0.6/Pcap.c libpcap-ruby-0.6/Pcap.c --- libpcap-ruby-0.6/Pcap.c +++ libpcap-ruby-0.6/Pcap.c @@ -54,6 +54,29 @@ } static VALUE +pcap_s_findalldevs(self) + VALUE self; +{ + pcap_if_t *alldevsp; + VALUE return_ary; + char pcap_errbuf[PCAP_ERRBUF_SIZE]; + + return_ary = rb_ary_new(); + + pcap_findalldevs(&alldevsp, pcap_errbuf); + + if (alldevsp == NULL) // List is empty, probably an error + rb_raise(ePcapError, "%s", pcap_errbuf); + + for (; alldevsp->next != NULL; alldevsp = alldevsp->next) + rb_ary_push(return_ary, rb_str_new2(alldevsp->name)); + + pcap_freealldevs(alldevsp); + + return return_ary; +} + +static VALUE pcap_s_lookupnet(self, dev) VALUE self; VALUE dev; @@ -723,6 +746,7 @@ /* define module Pcap */ mPcap = rb_define_module("Pcap"); rb_define_module_function(mPcap, "lookupdev", pcap_s_lookupdev, 0); + rb_define_module_function(mPcap, "findalldevs", pcap_s_findalldevs, 0); rb_define_module_function(mPcap, "lookupnet", pcap_s_lookupnet, 1); rb_global_variable(&rbpcap_convert); rb_define_singleton_method(mPcap, "convert?", pcap_s_convert, 0); diff -u libpcap-ruby-0.6/debian/changelog libpcap-ruby-0.6/debian/changelog --- libpcap-ruby-0.6/debian/changelog +++ libpcap-ruby-0.6/debian/changelog @@ -1,3 +1,10 @@ +libpcap-ruby (0.6-5ubuntu1) dapper; urgency=low + + * New function pcap_s_findalldevs() Pcap.c (Closes Malone: #28894) + * Thanks to Ohad Lutzky for the patch. + + -- Barry deFreese Mon, 3 Apr 2006 13:25:34 -0400 + libpcap-ruby (0.6-5) unstable; urgency=low * rebuild with ruby1.6 and ruby1.8, closes: #212265.