Branch Coverage

src/LDNS.xs
Criterion Covered Total %
branch 307 604 50.8


line true false branch
79 1 0 I32 context = GIMME_V;
82 0 1 if (context == G_VOID)
88 0 1 if(!fp)
94 0 1 if(s != LDNS_STATUS_OK)
104 0 1 if (context == G_SCALAR)
111 0 1 mXPUSHs(rr2sv(ldns_rr_clone(soa)));
112 15 1 for(i = 0; i < n; ++i)
114 0 15 mXPUSHs(rr2sv(ldns_rr_clone(ldns_rr_list_rr(rrs,i))));
129 1 17 if (items == 1 ) { /* Called without arguments, use resolv.conf */
135 17 16 for (i=1;i
140 0 17 SvGETMAGIC(ST(i));
0 0 SvGETMAGIC(ST(i));
141 17 0 addr = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, SvPV_nolen(ST(i)));
142 1 16 if ( addr == NULL) {
143 1 0 addr = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, SvPV_nolen(ST(i)));
145 1 16 if ( addr == NULL ) {
146 1 0 croak("Failed to parse IP address: %s", SvPV_nolen(ST(i)));
150 0 16 if(s != LDNS_STATUS_OK)
180 1 20 if(!t)
186 1 19 if(!c)
192 1 18 if(domain==NULL)
197 16 2 if(ldns_resolver_recursive(obj))
202 0 18 if(ldns_resolver_dnssec_cd(obj))
208 1 17 if ( status != LDNS_STATUS_OK) {
212 1 0 if (ns != NULL) {
214 0 1 if ( s != LDNS_STATUS_OK) {
239 3 2 if(items>1) {
240 0 3 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
241 3 0 ldns_resolver_set_recursive(obj, SvIV(ST(1)));
251 2 2 if ( items > 1 ) {
252 0 2 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
253 2 0 ldns_resolver_set_debug(obj, SvIV(ST(1)));
263 3 2 if ( items > 1 ) {
264 0 3 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
265 3 0 ldns_resolver_set_dnssec(obj, SvIV(ST(1)));
275 2 2 if ( items > 1 ) {
276 0 2 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
277 2 0 ldns_resolver_set_dnssec_cd(obj, SvIV(ST(1)));
287 2 2 if ( items > 1 ) {
288 0 2 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
289 2 0 ldns_resolver_set_usevc(obj, SvIV(ST(1)));
299 2 2 if ( items > 1 ) {
300 0 2 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
301 2 0 ldns_resolver_set_igntc(obj, SvIV(ST(1)));
311 1 1 if ( items > 1 ) {
312 0 1 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
313 1 0 ldns_resolver_set_retry(obj, SvIV(ST(1)));
323 1 1 if ( items > 1 ) {
324 0 1 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
325 1 0 ldns_resolver_set_retrans(obj, SvIV(ST(1)));
335 2 2 if( items > 1 )
337 0 2 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
338 2 0 ldns_resolver_set_edns_udp_size(obj, (U16)SvIV(ST(1)));
348 0 0 if( items > 1 )
350 0 0 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
351 0 0 ldns_resolver_set_port(obj, (U16)SvIV(ST(1)));
368 2 0 context = GIMME_V;
370 0 2 if(context == G_VOID)
376 0 2 if(dname==NULL)
385 1 1 if (context == G_SCALAR)
392 2 1 for(i = 0; i < n; ++i)
399 0 2 mXPUSHs(sv);
417 2 0 context = GIMME_V;
419 0 2 if(context == G_VOID)
425 0 2 if(addr_rdf==NULL)
429 0 2 if(addr_rdf==NULL)
438 1 1 if (context == G_SCALAR)
445 1 1 for(i = 0; i < n; ++i)
452 0 1 mXPUSHs(sv);
471 0 2 SvGETMAGIC(callback);
0 0 SvGETMAGIC(callback);
472 0 2 if(SvTYPE(SvRV(callback)) != SVt_PVCV)
478 0 2 if(domain==NULL)
484 0 2 if(!cl)
493 0 2 if(status != LDNS_STATUS_OK)
499 34 0 while (!ldns_axfr_complete(obj))
504 1 33 if(rr==NULL)
507 1 0 if(pkt != NULL)
524 0 33 PUSHMARK(SP);
525 0 33 mXPUSHs(rr2sv(rr));
530 0 33 if(count != 1)
537 33 0 if(!SvTRUE(ret))
0 33 if(!SvTRUE(ret))
0 0 if(!SvTRUE(ret))
0 33 if(!SvTRUE(ret))
0 0 if(!SvTRUE(ret))
0 0 if(!SvTRUE(ret))
0 33 if(!SvTRUE(ret))
0 0 if(!SvTRUE(ret))
0 0 if(!SvTRUE(ret))
0 0 if(!SvTRUE(ret))
0 0 if(!SvTRUE(ret))
0 0 if(!SvTRUE(ret))
33 0 if(!SvTRUE(ret))
33 0 if(!SvTRUE(ret))
1 32 if(!SvTRUE(ret))
0 1 if(!SvTRUE(ret))
0 0 if(!SvTRUE(ret))
1 32 if(!SvTRUE(ret))
0 0 if(!SvTRUE(ret))
543 32 0 FREETMPS;
563 0 0 if(domain==NULL)
568 0 0 if(!cl)
601 0 0 if(rr==NULL)
633 1 2 if( items > 1)
638 0 1 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
639 1 0 dec_part = modf(SvNV(ST(1)), &int_part);
656 1 1 if(items >= 2)
660 0 1 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
661 1 0 address = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, SvPV_nolen(ST(1)));
662 0 1 if(address == NULL)
664 0 0 address = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, SvPV_nolen(ST(1)));
666 0 1 if(address == NULL)
668 0 0 croak("Failed to parse IP address: %s", SvPV_nolen(ST(1)));
717 0 4 if(!rr_type)
723 0 4 if(!rr_class)
729 0 4 if(rr_name == NULL)
748 12 4 if ( items > 1 ) {
749 0 12 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
750 12 0 if ( strnEQ("NOERROR", SvPV_nolen(ST(1)), 7) ) {
1 11 if ( strnEQ("NOERROR", SvPV_nolen(ST(1)), 7) ) {
753 11 0 else if ( strnEQ("FORMERR", SvPV_nolen(ST(1)), 7) ) {
1 10 else if ( strnEQ("FORMERR", SvPV_nolen(ST(1)), 7) ) {
756 10 0 else if ( strnEQ("SERVFAIL", SvPV_nolen(ST(1)), 8) ) {
1 9 else if ( strnEQ("SERVFAIL", SvPV_nolen(ST(1)), 8) ) {
759 9 0 else if ( strnEQ("NXDOMAIN", SvPV_nolen(ST(1)), 8) ) {
1 8 else if ( strnEQ("NXDOMAIN", SvPV_nolen(ST(1)), 8) ) {
762 8 0 else if ( strnEQ("NOTIMPL", SvPV_nolen(ST(1)), 7) ) {
1 7 else if ( strnEQ("NOTIMPL", SvPV_nolen(ST(1)), 7) ) {
765 7 0 else if ( strnEQ("REFUSED", SvPV_nolen(ST(1)), 7) ) {
1 6 else if ( strnEQ("REFUSED", SvPV_nolen(ST(1)), 7) ) {
768 6 0 else if ( strnEQ("YXDOMAIN", SvPV_nolen(ST(1)), 8) ) {
1 5 else if ( strnEQ("YXDOMAIN", SvPV_nolen(ST(1)), 8) ) {
771 5 0 else if ( strnEQ("YXRRSET", SvPV_nolen(ST(1)), 7) ) {
1 4 else if ( strnEQ("YXRRSET", SvPV_nolen(ST(1)), 7) ) {
774 4 0 else if ( strnEQ("NXRRSET", SvPV_nolen(ST(1)), 7) ) {
1 3 else if ( strnEQ("NXRRSET", SvPV_nolen(ST(1)), 7) ) {
777 3 0 else if ( strnEQ("NOTAUTH", SvPV_nolen(ST(1)), 7) ) {
1 2 else if ( strnEQ("NOTAUTH", SvPV_nolen(ST(1)), 7) ) {
780 2 0 else if ( strnEQ("NOTZONE", SvPV_nolen(ST(1)), 7) ) {
1 1 else if ( strnEQ("NOTZONE", SvPV_nolen(ST(1)), 7) ) {
784 1 0 croak("Unknown RCODE: %s", SvPV_nolen(ST(1)));
797 6 3 if ( items > 1 ) {
798 0 6 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
799 6 0 if ( strnEQ("QUERY", SvPV_nolen(ST(1)), 5) ) {
1 5 if ( strnEQ("QUERY", SvPV_nolen(ST(1)), 5) ) {
802 5 0 else if ( strnEQ("IQUERY", SvPV_nolen(ST(1)), 6) ) {
1 4 else if ( strnEQ("IQUERY", SvPV_nolen(ST(1)), 6) ) {
805 4 0 else if ( strnEQ("STATUS", SvPV_nolen(ST(1)), 6) ) {
1 3 else if ( strnEQ("STATUS", SvPV_nolen(ST(1)), 6) ) {
808 3 0 else if ( strnEQ("NOTIFY", SvPV_nolen(ST(1)), 6) ) {
1 2 else if ( strnEQ("NOTIFY", SvPV_nolen(ST(1)), 6) ) {
811 2 0 else if ( strnEQ("UPDATE", SvPV_nolen(ST(1)), 6) ) {
1 1 else if ( strnEQ("UPDATE", SvPV_nolen(ST(1)), 6) ) {
815 1 0 croak("Unknown OPCODE: %s", SvPV_nolen(ST(1)));
828 2 1 if ( items > 1 ) {
829 0 2 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
830 2 0 ldns_pkt_set_id(obj, (U16)SvIV(ST(1)));
840 1 3 if ( items > 1 ) {
841 0 1 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
842 1 0 ldns_pkt_set_qr(obj, SvIV(ST(1)));
852 1 3 if ( items > 1 ) {
853 0 1 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
854 1 0 ldns_pkt_set_aa(obj, SvIV(ST(1)));
864 1 3 if ( items > 1 ) {
865 0 1 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
866 1 0 ldns_pkt_set_tc(obj, SvIV(ST(1)));
876 1 4 if ( items > 1 ) {
877 0 1 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
878 1 0 ldns_pkt_set_rd(obj, SvIV(ST(1)));
888 1 3 if ( items > 1 ) {
889 0 1 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
890 1 0 ldns_pkt_set_cd(obj, SvIV(ST(1)));
900 1 3 if ( items > 1 ) {
901 0 1 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
902 1 0 ldns_pkt_set_ra(obj, SvIV(ST(1)));
912 1 3 if ( items > 1 ) {
913 0 1 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
914 1 0 ldns_pkt_set_ad(obj, SvIV(ST(1)));
924 1 3 if ( items > 1 ) {
925 0 1 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
926 1 0 ldns_pkt_set_edns_do(obj, SvIV(ST(1)));
944 2 3 if ( items > 1 ) {
945 0 2 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
946 2 0 ldns_pkt_set_querytime(obj, (U32)SvIV(ST(1)));
956 3 6 if(items >= 2)
960 0 3 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
961 3 0 address = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, SvPV_nolen(ST(1)));
962 0 3 if(address == NULL)
964 0 0 address = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, SvPV_nolen(ST(1)));
966 0 3 if(address == NULL)
968 0 0 croak("Failed to parse IP address: %s", SvPV_nolen(ST(1)));
983 3 5 if(items >= 2)
988 0 3 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
989 1 2 dec_part = modf(SvNV(ST(1)), &int_part);
1007 18 0 I32 context = GIMME_V;
1009 0 18 if (context == G_VOID)
1017 6 12 if (context == G_SCALAR)
1022 20 12 for(i = 0; i < n; ++i)
1024 0 20 mXPUSHs(rr2sv(ldns_rr_clone(ldns_rr_list_rr(rrs,i))));
1035 1 0 I32 context = GIMME_V;
1037 0 1 if (context == G_VOID)
1045 1 0 if (context == G_SCALAR)
1050 0 0 for(i = 0; i < n; ++i)
1052 0 0 mXPUSHs(rr2sv(ldns_rr_clone(ldns_rr_list_rr(rrs,i))));
1063 1 0 I32 context = GIMME_V;
1065 0 1 if (context == G_VOID)
1073 1 0 if (context == G_SCALAR)
1078 0 0 for(i = 0; i < n; ++i)
1080 0 0 mXPUSHs(rr2sv(ldns_rr_clone(ldns_rr_list_rr(rrs,i))));
1091 1 0 I32 context = GIMME_V;
1093 0 1 if (context == G_VOID)
1101 1 0 if (context == G_SCALAR)
1106 0 0 for(i = 0; i < n; ++i)
1108 0 0 mXPUSHs(rr2sv(ldns_rr_clone(ldns_rr_list_rr(rrs,i))));
1125 18 3 for(; *p; p++) *p = tolower(*p);
1127 3 0 if(strncmp(lbuf, "answer", 6)==0)
1131 0 0 else if(strncmp(lbuf, "additional", 10)==0)
1135 0 0 else if(strncmp(lbuf, "authority", 9)==0)
1139 0 0 else if(strncmp(lbuf, "question", 8)==0)
1186 0 3 if(status != LDNS_STATUS_OK)
1208 0 1 SvGETMAGIC(buf);
0 0 SvGETMAGIC(buf);
1209 1 0 status = ldns_wire2pkt(&pkt, (const uint8_t *)SvPV_nolen(buf), SvCUR(buf));
1210 0 1 if(status != LDNS_STATUS_OK)
1230 2 2 if(items>=2)
1232 0 2 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
1233 1 1 ldns_pkt_set_edns_udp_size(obj, (U16)SvIV(ST(1)));
1243 1 2 if(items>=2)
1245 0 1 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
1246 1 0 ldns_pkt_set_edns_extended_rcode(obj, (U8)SvIV(ST(1)));
1256 0 0 if(items>=2)
1258 0 0 SvGETMAGIC(ST(1));
0 0 SvGETMAGIC(ST(1));
1259 0 0 ldns_pkt_set_edns_version(obj, (U8)SvIV(ST(1)));
1318 0 22 SvGETMAGIC(sv);
0 0 SvGETMAGIC(sv);
1319 22 0 ldns_pkt *obj = INT2PTR(ldns_pkt *, SvIV((SV *)SvRV(sv)));
1347 2 4 if(rr==NULL)
1408 0 21 if(s != LDNS_STATUS_OK)
1494 1 9 if(rdf==NULL)
1716 2 0 if(algorithm==1||algorithm==5||algorithm==7||algorithm==8||algorithm==10)
0 2 if(algorithm==1||algorithm==5||algorithm==7||algorithm==8||algorithm==10)
0 0 if(algorithm==1||algorithm==5||algorithm==7||algorithm==8||algorithm==10)
0 0 if(algorithm==1||algorithm==5||algorithm==7||algorithm==8||algorithm==10)
0 0 if(algorithm==1||algorithm==5||algorithm==7||algorithm==8||algorithm==10)
1720 0 2 if(data[0] == 0)
1731 0 0 else if(algorithm==3||algorithm==6)
0 0 else if(algorithm==3||algorithm==6)
1736 0 0 else if(algorithm==2)
1804 20 4 for(; *p; p++) *p = tolower(*p);
1806 1 3 if(strEQ(lbuf,"sha1"))
1810 1 2 else if(strEQ(lbuf, "sha256"))
1814 1 1 else if(strEQ(lbuf, "sha384"))
1818 1 0 else if(strEQ(lbuf,"gost"))
1929 0 5 if(av_len(rrset_in)==-1)
1934 0 5 if(av_len(keys_in)==-1)
1943 5 5 for(i = 0; i <= av_len(rrset_in); ++i)
1947 5 0 if (rrsv != NULL) {
1948 0 5 SvGETMAGIC(*rrsv);
0 0 SvGETMAGIC(*rrsv);
1949 5 0 IV tmp = SvIV((SV*)SvRV(*rrsv));
1951 5 0 if(rr != NULL)
1959 8 5 for(i = 0; i <= av_len(keys_in); ++i)
1963 8 0 IV tmp = SvIV((SV*)SvRV(*rrsv));
1965 8 0 if(rr != NULL)
2017 69 3 while(typestring[pos] != '\0')
2020 18 51 if(typestring[pos] == ' ')
2023 0 18 if(hv_store(res,typestring,pos,newSViv(1),0)==NULL)
2088 0 1 if(ldns_nsec3_salt_length(obj) > 0)
2125 9 1 while(typestring[pos] != '\0')
2128 3 6 if(typestring[pos] == ' ')
2131 0 3 if(hv_store(res,typestring,pos,newSViv(1),0)==NULL)
2204 1 0 if(ldns_rdf_size(rdf) > 0)