def fastmatch(t1, t2): """ Calculates a match between t1 and t2. See figure 10 in reference. """ M = Bimap() label(t1) label(t2) depth = max(get_depth(t1), get_depth(t2)) while 0 <= depth: nodes1 = get_depth_nodes(t1, depth) nodes2 = get_depth_nodes(t2, depth) equal = utils.partial(depth_equal, 0.6, 0.5, M) _match(nodes1, nodes2, M, equal) depth -= 1 return M
QTYPE = Bimap({ 1: 'A', 2: 'NS', 5: 'CNAME', 6: 'SOA', 12: 'PTR', 15: 'MX', 16: 'TXT', 17: 'RP', 18: 'AFSDB', 24: 'SIG', 25: 'KEY', 28: 'AAAA', 29: 'LOC', 33: 'SRV', 35: 'NAPTR', 36: 'KX', 37: 'CERT', 39: 'DNAME', 41: 'OPT', 42: 'APL', 43: 'DS', 44: 'SSHFP', 45: 'IPSECKEY', 46: 'RRSIG', 47: 'NSEC', 48: 'DNSKEY', 49: 'DHCID', 50: 'NSEC3', 51: 'NSEC3PARAM', 55: 'HIP', 99: 'SPF', 249: 'TKEY', 250: 'TSIG', 251: 'IXFR', 252: 'AXFR', 255: '*', 32768: 'TA', 32769: 'DLV' })