Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Well, I gave it another shot, and I've compiled Net::Pcap, but it does not work (12.50% okay, practically all the tests fail). You'll have to edit Pcap.xs to make the include lines look like
#include "pcap.h" #ifdef WIN32 #undef caddr_t #endif #include "EXTERN.h" #include "perl.h" #include "XSUB.h" //#include <pcap.h> used to be here (D'oh! i should've just done a dif +f)
Also, here's what the MakeMaker INC/LIBS args should look like:
'INC' => q[ -IE:\new\wpdpack_3_0\wpdpack\Include ], 'LIBS' => [ q[ -LE:\new\wpdpack_3_0\wpdpack\Lib -lwpcap.li +b ] ],
It compiles with some warnings though
Pcap.c Pcap.c(749) : warning C4047: 'function' : 'struct _PerlIO ** ' differs + in levels of indirection from 'struct _iobuf *' Pcap.c(749) : warning C4024: 'Perl_do_open' : different types for form +al and actual parameter 8
which stem from
FILE * pcap_file(p) pcap_t *p
and I've no clue how to fix those, but I highly doubt they have anything to do with the failing tests (almost all of the functions Net::Pcap uses are deprecated in WinPcap -- like lookupdev or open_live). The generated function looks like
XS(XS_Net__Pcap_file); /* prototype to pass -Wmissing-prototypes */ XS(XS_Net__Pcap_file) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Net::Pcap::file(p)"); { pcap_t * p; FILE * RETVAL; if (sv_derived_from(ST(0), "pcap_tPtr")) { IV tmp = SvIV((SV*)SvRV(ST(0))); p = (pcap_t *) tmp; } else croak("p is not of type pcap_tPtr"); RETVAL = pcap_file(p); ST(0) = sv_newmortal(); { GV *gv = newGVgen("Net::Pcap"); if ( do_open(gv, "<&", 2, FALSE, 0, 0, RETVAL) ) sv_setsv(ST(0), sv_bless(newRV((SV*)gv), gv_stashpv("Net::Pcap +",1))); else ST(0) = &PL_sv_undef; } } XSRETURN(1); }
And the typemap specifies FILE * T_IN, and T_IN is
INPUT T_IN $var = IoIFP(sv_2io($arg)) ################### OUTPUT T_IN { GV *gv = newGVgen("$Package"); if ( do_open(gv, "<&", 2, FALSE, 0, 0, $var) ) sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package", +1))); else $arg = &PL_sv_undef; }


MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
** The Third rule of perl club is a statement of fact: pod is sexy.


In reply to Re: Net::Pcap and windows by PodMaster
in thread Net::Pcap and windows by nite_man

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others chilling in the Monastery: (2)
    As of 2025-06-23 15:51 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?
      erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.