Skip Menu |

This queue is for tickets about the Net-Pcap CPAN distribution.

Report information
The Basics
Id: 7594
Status: resolved
Priority: 0/
Queue: Net-Pcap

People
Owner: Nobody in particular
Requestors: edomat [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: 0.06



Subject: pcap_setnonblock and pcap_getnonblock functions not implemented
Hi, this two functions are described on the manpage of pcap but are not defined on the Perl module. I don't know if this is because it's difficult to implement them or what, but it would be nice if they're incorporated to the module. These functions (as described on the manpage) puts the capture descriptor into non-blocking mode that I think is a very nice feature. Thanks for all y congratulations for this work. Greettings. Ernesto
From: edomat [...] gmail.com
Finally, I implement this functions by looking at the Pcap.xs file (I never made a Perl module and how no idea on how they're really created) and it seems to be working properly. The documentation part is missing still and I know that the implementation could be better (arguments check and maybe some more errors checks) but at least this is a begining (I hope). It would be great if someone with more experience with Perl modules check this patch and does finally implement the functions on the main package. Greettings. Ernesto
--- Pcap.xs.old 2003-06-14 09:15:18.000000000 -0300 +++ Pcap.xs.new 2004-09-09 16:41:59.000000000 -0300 @@ -89,7 +89,7 @@ char *dev; dev = pcap_lookupdev(errbuf); - if (!strcmp(dev,"\\")) { + if (!strcmp(dev,"\\")) { pcap_if_t *alldevs; if (pcap_findalldevs(&alldevs, errbuf) == -1) { sv_setpv(err_sv, errbuf); @@ -114,6 +114,53 @@ err int +pcap_setnonblock(p, nb, err) + pcap_t *p + int nb + SV *err + + CODE: + char *errbuf = safemalloc(PCAP_ERRBUF_SIZE); + SV *err_sv = SvRV(err); + + RETVAL = pcap_setnonblock(p, nb, errbuf); + + if (RETVAL == -1) { + sv_setpv(err_sv, errbuf); + } else { + err_sv = &PL_sv_undef; + } + + safefree(errbuf); + + OUTPUT: + RETVAL + err + +int +pcap_getnonblock(p, err) + pcap_t *p + SV *err + + CODE: + char *errbuf = safemalloc(PCAP_ERRBUF_SIZE); + SV *err_sv = SvRV(err); + + RETVAL = pcap_getnonblock(p, errbuf); + + if (RETVAL == -1) { + sv_setpv(err_sv, errbuf); + } else { + err_sv = &PL_sv_undef; + } + + safefree(errbuf); + + OUTPUT: + RETVAL + err + +int pcap_lookupnet(device, net, mask, err) char *device SV *net
From: saper [...] cpan.org
[guest - Thu Sep 9 16:19:52 2004]: Show quoted text
> Finally, I implement this functions by looking at the Pcap.xs file (I > never made a Perl module and how no idea on how they're really created) > and it seems to be working properly. The documentation part is missing > still and I know that the implementation could be better (arguments > check and maybe some more errors checks) but at least this is a begining > (I hope). > > It would be great if someone with more experience with Perl modules > check this patch and does finally implement the functions on the main > package.
Hello, I applied your patch. It will be in version 0.06. Now I need documentation and test cases for these functions. :-) Regards -- Close the world, txEn eht nepO.