dhcpkit_vpp.protocols.layer2 module¶
Classes and constants for layer 2 frames
-
class
dhcpkit_vpp.protocols.layer2.
Ethernet
(destination: bytes = b'x00x00x00x00x00x00', source: bytes = b'x00x00x00x00x00x00', ethertype: int = 0, payload: dhcpkit.protocol_element.ProtocolElement = None)[source]¶ Bases:
dhcpkit_vpp.protocols.Layer2Frame
The class for ethernet frames.
-
classmethod
determine_class
(buffer: bytes, offset: int = 0) → type[source]¶ Return the appropriate class to parse this element with.
Parameters: - buffer – The buffer to read data from
- offset – The offset in the buffer where to start reading
Returns: The best known class for this data
-
display_destination
() → dhcpkit.protocol_element.ElementDataRepresentation[source]¶ Nicer representation of destination :return: Representation of destination
-
display_ethertype
() → dhcpkit.protocol_element.ElementDataRepresentation[source]¶ Nicer representation of ethertype :return: Representation of ethertype
-
display_source
() → dhcpkit.protocol_element.ElementDataRepresentation[source]¶ Nicer representation of source :return: Representation of source
-
load_from
(buffer: bytes, offset: int = 0, length: int = None) → int[source]¶ Load the internal state of this object from the given buffer. The buffer may contain more data after the structured element is parsed. This data is ignored.
Parameters: - buffer – The buffer to read data from
- offset – The offset in the buffer where to start reading
- length – The amount of data we are allowed to read from the buffer
Returns: The number of bytes used from the buffer
-
classmethod