def squery(self, name, rtype): packet = proto.packet() try: if self.nsrecurse: packet.setflags(["recurse"]) except AttributeError: pass packet.addq(rec.rrhead(name, rtype)) return self.resolve(packet)
def decoderecord(self, name, record): set = pickle.loads(record) rrset = [] for cur in set: head = rec.rrhead(name, cur[0]) data = cur[2] newrr = rec.rr(head, cur[1], data) newrr.setflags(cur[3]) rrset += [newrr] return rrset
def handle(self, query, pkt): resp = zone.handle(self, query, pkt) if not "internal" in pkt.flags: if resp is None: resp = proto.responsefor(pkt) soa = zone.handle(self, rec.rrhead(self.origin, "SOA"), pkt) resp.aulist += soa.anlist resp.rescode = proto.NXDOMAIN else: resolver.resolvecnames(resp, self.aurecres) nsrecs = zone.handle(self, rec.rrhead(self.origin, "NS"), pkt) if nsrecs is not None: resp.aulist += nsrecs.anlist for rr in nsrecs.anlist: resolver.resolveadditional(resp, rr, self.aurecres) else: if resp is None: return None resp.setflags(["auth"]) return resp
def squery(self, name, rtype): if type(name) == str: name = dn.fromstring(name) if not name.rooted: namelist = [name + prefix for prefix in self.prelist] + [name + dn.fromstring(".")] else: namelist = [name] for name in namelist: packet = proto.packet() packet.setflags(["recurse"]) packet.addq(rec.rrhead(name, rtype)) res = self.resolve(packet) if res.rescode == 0: break return res