示例#1
0
 def decode_name(self):
     """
         Decode label at current offset in buffer (following pointers
         to cached elements where necessary)
     """
     label = []
     done = False
     while not done:
         (len,) = self.unpack("!B")
         if get_bits(len,6,2) == 3:
             # Pointer
             self.offset -= 1
             pointer = get_bits(self.unpack("!H")[0],0,14)
             save = self.offset
             self.offset = pointer
             label.extend(self.decode_name().label)
             self.offset = save
             done = True
         else:
             if len > 0:
                 label.append(self.get(len))
             else:
                 done = True
     return DNSLabel(label)
示例#2
0
 def decode_name(self):
     """
         Decode label at current offset in buffer (following pointers
         to cached elements where necessary)
     """
     label = []
     done = False
     while not done:
         (len, ) = self.unpack("!B")
         if get_bits(len, 6, 2) == 3:
             # Pointer
             self.offset -= 1
             pointer = get_bits(self.unpack("!H")[0], 0, 14)
             save = self.offset
             self.offset = pointer
             label.extend(self.decode_name().label)
             self.offset = save
             done = True
         else:
             if len > 0:
                 label.append(self.get(len))
             else:
                 done = True
     return DNSLabel(label)
示例#3
0
文件: dns.py 项目: carriercomm/pydnsd
 def get_rcode(self):
     return get_bits(self.bitmap,0,4)
示例#4
0
文件: dns.py 项目: carriercomm/pydnsd
 def get_ra(self):
     return get_bits(self.bitmap,7)
示例#5
0
文件: dns.py 项目: carriercomm/pydnsd
 def get_rd(self):
     return get_bits(self.bitmap,8)
示例#6
0
文件: dns.py 项目: carriercomm/pydnsd
 def get_tc(self):
     return get_bits(self.bitmap,9)
示例#7
0
文件: dns.py 项目: carriercomm/pydnsd
 def get_aa(self):
     return get_bits(self.bitmap,10)
示例#8
0
文件: dns.py 项目: carriercomm/pydnsd
 def get_opcode(self):
     return get_bits(self.bitmap,11,4)
示例#9
0
文件: dns.py 项目: carriercomm/pydnsd
 def get_qr(self):
     return get_bits(self.bitmap,15)
示例#10
0
 def get_rcode(self):
     return get_bits(self.bitmap, 0, 4)
示例#11
0
 def get_ra(self):
     return get_bits(self.bitmap, 7)
示例#12
0
 def get_rd(self):
     return get_bits(self.bitmap, 8)
示例#13
0
 def get_tc(self):
     return get_bits(self.bitmap, 9)
示例#14
0
 def get_aa(self):
     return get_bits(self.bitmap, 10)
示例#15
0
 def get_opcode(self):
     return get_bits(self.bitmap, 11, 4)
示例#16
0
 def get_qr(self):
     return get_bits(self.bitmap, 15)