title: binding similar custom layers in Scapy
body: <p>I've created 2 custom layers in Scapy which are very similar. They are both UDP and have the same length, but have different fields.</p>
  
  <pre><code>class Message_1(Packet):
      name = "Message_1"
      len = 10
      fields_desc = [
          BitField("TYPE", 1, size=4),
          BitField("A", 0, size=3),
          BitField("B", 0, size=1),
          BitField("C", 0, size=4),
          BitField("D", 0, size=4)
      ]
  
  class Message_2(Packet):
      name = "Message_2"
      len = 10
      fields_desc = [
          BitField("TYPE", 2, size=4),
          BitField("V", 0, size=1),
          BitField("W", 0, size=2),
          BitField("X", 0, size=1),
          BitField("Y", 0, size=4),
          BitField("Z", 0, size=4)
      ]
  </code></pre>
  
  <p>I'm trying to bind the layers so I can parse the packets that are captured, but I can't figure out how to differentiate the layers. I think I should be using guess_payload_class but I don't understand how.</p>
  
  <p>EDIT - I setup Scapy's sniffer and send 2 packets, 1 is Message_1 and the 2nd is Message_2. When I try to parse a captured packet Scapy thinks both packets are Message_1 because they're both UDP and length 10. I need to find a way to use the TYPE field to determine if the packet is a Message_1 or Message_2.</p>