Ethernet Protocol¶
pcapkit.protocols.link.ethernet contains
Ethernet
only, which implements extractor for Ethernet
Protocol *, whose structure is described as
below:
Octets |
Bits |
Name |
Description |
|---|---|---|---|
0 |
0 |
|
Destination MAC Address |
1 |
8 |
|
Source MAC Address |
2 |
16 |
|
Protocol (Internet Layer) |
-
class
pcapkit.protocols.link.ethernet.Ethernet(file=None, length=None, **kwargs)[source]¶ Bases:
pcapkit.protocols.link.link.LinkThis class implements Ethernet Protocol.
-
classmethod
__index__()[source]¶ Numeral registry index of the protocol.
- Raises
UnsupportedCall – This protocol has no registry entry.
-
_read_mac_addr()[source]¶ Read MAC address.
- Returns
Colon (
:) seperated hex encoded MAC address.- Return type
-
make(**kwargs)[source]¶ Make (construct) packet data.
- Keyword Arguments
**kwargs – Arbitrary keyword arguments.
- Returns
Constructed packet data.
- Return type
-
read(length=None, **kwargs)[source]¶ Read Ethernet Protocol [RFC 7042].
- Parameters
length (Optional[int]) – Length of packet data.
- Keyword Arguments
**kwargs – Arbitrary keyword arguments.
- Returns
Parsed packet data.
- Return type
-
property
length¶ Header length of current protocol.
- Return type
Literal[14]
-
property
name¶ Name of current protocol.
- Return type
Literal[‘Ethernet Protocol’]
-
property
protocol¶ Name of next layer protocol.
- Return type
-
classmethod
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit module.
-
class
pcapkit.protocols.link.ethernet.DataType_Ethernet¶ - Bases
TypedDict
Ethernet header.
-
type: pcapkit.const.reg.ethertype.EtherType¶ protocol (Internet layer)