5 #define TYRRSZ(rrtype,size,func) { (rrtype), (size), (func) }
7 #define TYRRSZ(sizememb) (sizeof(((adns_answer*)0)->rrs.sizememb))
9 static const typeinfo typeinfos
[] = {
10 /* Must be in ascending order of rrtype ! */
12 { adns_r_a
, TYRR(inaddr
), rpf_inaddr
},
13 { adns_r_ns_raw
, TYRR(str
), rpf_domain_raw
},
14 { adns_r_cname
, TYRR(str
), rpf_domain_raw
},
15 { adns_r_soa_raw
, TYRR(soa
), rpf_soa
},
16 { adns_r_null
, 0, rpf_null
},
17 { adns_r_ptr_raw
, TYRR(str
), rpf_domain_raw
},
18 { adns_r_hinfo
, TYRR(strpair
), rpf_hinfo
},
19 { adns_r_mx_raw
, TYRR(intstr
), rpf_mx_raw
},
20 { adns_r_txt
, TYRR(str
), rpf_txt
},
21 { adns_r_rp_raw
, TYRR(strpair
), rpf_rp
},
23 { adns_r_ns
, TYRR(dmaddr
), rpf_dmaddr
},
24 { adns_r_ptr
, TYRR(str
), rpf_ptr
},
25 { adns_r_mx
, TYRR(intdmaddr
), rpf_mx
},
27 { adns_r_soa
, TYRR(soa
), rpf_soa
},
28 { adns_r_rp
, TYRR(strpair
), rpf_rp
},
31 const typeinfo
adns__findtype(adns_rrtype type
) {
32 const typeinfo
*begin
, *end
;
34 begin
= typeinfos
; end
= typeinfos
+(sizeof(typeinfos
)/sizeof(typeinfo
));
37 mid
= begin
+ ((end
-begin
)>>1);
38 if (mid
->type
== type
) return mid
;
39 if (type
> mid
->type
) begin
= mid
+1;