def _parse(self, raw, next_cls):
        '''
        Parse a raw bytes object and construct the list of packet header
        objects (and possible remaining bytes) that are part of this packet.
        '''
        if next_cls is None:
            from switchyard.lib.packet import Ethernet
            next_cls = Ethernet

        self._headers = []
        while issubclass(next_cls, PacketHeaderBase):
            packet_header_obj = next_cls()
            raw = packet_header_obj.from_bytes(raw)
            self.add_header(packet_header_obj)
            next_cls = packet_header_obj.next_header_class()
            if next_cls is None:
                break
        if raw:
            self.add_header(RawPacketContents(raw))
def _parse ( self , raw , next_cls ) : if next_cls is None : from switchyard . lib . packet import Ethernet next_cls = Ethernet self . _headers = [ ] while issubclass ( next_cls , PacketHeaderBase ) : packet_header_obj = next_cls ( ) raw = packet_header_obj . from_bytes ( raw ) self . add_header ( packet_header_obj ) next_cls = packet_header_obj . next_header_class ( ) if next_cls is None : break if raw : self . add_header ( RawPacketContents ( raw ) )
Parse a raw bytes object and construct the list of packet header
        objects (and possible remaining bytes) that are part of this packet.