#NEWLINE# def m2i( self , pkt , m ) : #NEWLINE# #INDENT# lst = [ ] #NEWLINE# while ( len ( m ) >= 4 ) : #NEWLINE# #INDENT# ( trans_type , ) = struct . unpack ( '!H' , m [ : 2 ] ) #NEWLINE# is_tlv = ( not ( trans_type & 32768 ) ) #NEWLINE# if is_tlv : #NEWLINE# #INDENT# ( value_len , ) = struct . unpack ( '!H' , m [ 2 : 4 ] ) #NEWLINE# if ( ( value_len + 4 ) > len ( m ) ) : #NEWLINE# #INDENT# warning ( ( 'Bad length for ISAKMP tranform type=%#6x' % trans_type ) ) #NEWLINE# #UNINDENT# value = m [ 4 : ( 4 + value_len ) ] #NEWLINE# r = 0 #NEWLINE# for i in struct . unpack ( ( '!%s' % ( ( 'B' * len ( value ) ) , ) ) , value ) : #NEWLINE# #INDENT# r = ( ( r << 8 ) | i ) #NEWLINE# #UNINDENT# value = r #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# trans_type &= 32767 #NEWLINE# value_len = 0 #NEWLINE# ( value , ) = struct . unpack ( '!H' , m [ 2 : 4 ] ) #NEWLINE# #UNINDENT# m = m [ ( 4 + value_len ) : ] #NEWLINE# lst . append ( self . num2type ( trans_type , value ) ) #NEWLINE# #UNINDENT# if ( len ( m ) > 0 ) : #NEWLINE# #INDENT# warning ( ( 'Extra bytes after ISAKMP transform dissection [%r]' % m ) ) #NEWLINE# #UNINDENT# return lst