Net-Pcap

 view release on metacpan or  search on metacpan

Pcap.xs  view on Meta::CPAN


void
pcap_findalldevs_xs(devinfo, err)
    SV * devinfo
    SV * err
 
    PREINIT:
        char    *errbuf = NULL;
        Newx(errbuf, PCAP_ERRBUF_SIZE+1, char);
    
    PPCODE:
        if ( SvROK(err) && SvROK(devinfo) && (SvTYPE(SvRV(devinfo)) == SVt_PVHV) ) {
            int r;
            pcap_if_t *alldevs, *d;
            HV *hv;
            SV *err_sv = SvRV(err);
            
            hv = (HV *)SvRV(devinfo);
            
            r = pcap_findalldevs(&alldevs, errbuf);

Pcap.xs  view on Meta::CPAN

    int size


void
pcap_getevent(p)
    pcap_t *p

    PREINIT:
        unsigned int h;

    PPCODE:
        h = (unsigned int) pcap_getevent(p);  
        ST(0) = sv_newmortal();
        sv_setref_iv(ST(0), "Win32::Event", h);
        XSRETURN(1);

 
int 
pcap_sendpacket(p, buf)
    pcap_t *p
    SV *buf

fallback/const-xs.inc  view on Meta::CPAN

	dTARGET;
#endif
	STRLEN		len;
        int		type;
	IV		iv;
	/* NV		nv;	Uncomment this if you need to return NVs */
	/* const char	*pv;	Uncomment this if you need to return PVs */
    INPUT:
	SV *		sv;
        const char *	s = SvPV(sv, len);
    PPCODE:
        /* Change this to constant(aTHX_ s, len, &iv, &nv);
           if you need to return both NVs and IVs */
	type = constant(aTHX_ s, len, &iv);
      /* Return 1 or 2 items. First is error message, or undef if no error.
           Second, if present, is found value */
        switch (type) {
        case PERL_constant_NOTFOUND:
          sv = sv_2mortal(newSVpvf("%s is not a valid pcap macro", s));
          PUSHs(sv);
          break;



( run in 0.923 second using v1.01-cache-2.11-cpan-5511b514fd6 )