def _PPIGuessPayloadClass(p, **kargs):
 if (len(p) >= 4):
  (t, pfh_len) = struct.unpack('<HH', p[:4])
  cls = getPPIType(t, 'default')
  pfh_len += 4
  out = cls(p[:pfh_len], **kargs)
  if out.payload:
   out.payload = conf.raw_layer(out.payload.load)
   if (len(p) > pfh_len):
    out.payload.payload = conf.padding_layer(p[pfh_len:])
  elif (len(p) > pfh_len):
   out.payload = conf.padding_layer(p[pfh_len:])
 else:
  out = conf.raw_layer(p, **kargs)
 return out

def _PPIGuessPayloadClass ( p , ** kargs ) : if ( len ( p ) >= 4 ) : ( t , pfh_len ) = struct . unpack ( '<HH' , p [ : 4 ] ) cls = getPPIType ( t , 'default' ) pfh_len += 4 out = cls ( p [ : pfh_len ] , ** kargs ) if out . payload : out . payload = conf . raw_layer ( out . payload . load ) if ( len ( p ) > pfh_len ) : out . payload . payload = conf . padding_layer ( p [ pfh_len : ] ) elif ( len ( p ) > pfh_len ) : out . payload = conf . padding_layer ( p [ pfh_len : ] ) else : out = conf . raw_layer ( p , ** kargs ) return out
this function tells the packetlistfield how it should extract the tlvs from the payload .