예제 #1
0
 def check_control_bits(packet, counter):
     amount = 0
     temp_counter = Bits(int=counter, length=4)
     pos = temp_counter.find('0b1')
     pos_int = pos[0]
     for i in range(1, 8):
         temp_pos = Bits(int=i, length=4)
         res = BitArray(temp_pos ^ temp_counter)
         if res._readbin(1, pos_int) == '0' and packet._readbin(
                 1, i - 1) == '1':
             amount += 1
     return amount