def bitmap2RRlist(bitmap):
 RRlist = []
 while bitmap:
  if (len(bitmap) < 2):
   warning(('bitmap too short (%i)' % len(bitmap)))
   return
  window_block = ord(bitmap[0])
  offset = (256 * window_block)
  bitmap_len = ord(bitmap[1])
  if ((bitmap_len <= 0) or (bitmap_len > 32)):
   warning(('bitmap length is no valid (%i)' % bitmap_len))
   return
  tmp_bitmap = bitmap[2:(2 + bitmap_len)]
  for b in xrange(len(tmp_bitmap)):
   v = 128
   for i in xrange(8):
    if (ord(tmp_bitmap[b]) & v):
     RRlist += [((offset + (b * 8)) + i)]
    v = (v >> 1)
  bitmap = bitmap[(2 + bitmap_len):]
 return RRlist

def bitmap2RRlist ( bitmap ) : RRlist = [ ] while bitmap : if ( len ( bitmap ) < 2 ) : warning ( ( 'bitmap too short (%i)' % len ( bitmap ) ) ) return window_block = ord ( bitmap [ 0 ] ) offset = ( 256 * window_block ) bitmap_len = ord ( bitmap [ 1 ] ) if ( ( bitmap_len <= 0 ) or ( bitmap_len > 32 ) ) : warning ( ( 'bitmap length is no valid (%i)' % bitmap_len ) ) return tmp_bitmap = bitmap [ 2 : ( 2 + bitmap_len ) ] for b in xrange ( len ( tmp_bitmap ) ) : v = 128 for i in xrange ( 8 ) : if ( ord ( tmp_bitmap [ b ] ) & v ) : RRlist += [ ( ( offset + ( b * 8 ) ) + i ) ] v = ( v >> 1 ) bitmap = bitmap [ ( 2 + bitmap_len ) : ] return RRlist
decode the type bit maps field of the nsec resource record into an integer list .