ETHERNET(3)

πŸ’– ETHERNET(3) πŸ’–

okay bestie, so this is packet.link.ethernet β€” the ETHERNET module from ethernet 1.3, and she's here to decode the ethernet layer, RFC 894 style. Ethernet II, specifically. no cap. πŸ¦‹


✨ DESCRIPTION ✨

Decode ethernet layer (RFC 894) Ethernet II.

that's the whole job. she takes the raw bytes and goes "oh this is a MAC address, and this is a MAC address, and this is what's inside" and honestly? she ate. πŸ’…


πŸ‘‘ CLASSES πŸ‘‘

🌸 class ETHERNET(baseobj.BaseObj) 🌸

the Ethernet object herself. main character energy, fr fr.

πŸ’« Usage

from packet.link.ethernet import ETHERNET

x = ETHERNET(pktt)

πŸŽ€ Object definition

ETHERNET(
    dst   = MacAddr(),  # destination MAC address
    src   = MacAddr(),  # source MAC address
    type  = int,        # payload type
    psize = int,        # payload data size
    data  = string,     # raw data of payload if type is not supported
)

so you got dst (destination MAC address), src (source MAC address), type (payload type), psize (payload data size), and data (raw data of payload if type is not supported). all five, all present, all iconic. ✨

🧚 Methods defined here:


__init__(self, pktt)

Constructor. Initializes the object's private data. πŸ’–

  • pktt: Packet trace object (packet.pktt.Pktt) so this layer has access to the parent layers.

it literally just needs the parent layers to know what's going on. give her the pktt, she does the rest. 🫢


__str__(self)

String representation of object. πŸŽ€

The representation depends on the verbose level set by debug_repr().

  • If set to 0 the generic object representation is returned.
  • If set to 1 the representation of the object is condensed:
'00:0c:29:54:09:ef -> 60:33:4b:29:6e:9d '
  • If set to 2 the representation of the object also includes the type of payload:
'00:0c:29:54:09:ef -> 60:33:4b:29:6e:9d, type: 0x800(IPv4)'

level 0 = beige, level 1 = the little arrow fit, level 2 = she also tells you what's inside. the way that 0x800(IPv4) drops at the end?? obsessed. 🌈


πŸ”₯ SEE ALSO πŸ”₯

go read the whole friend group, they're all linked up, iykyk. πŸ‘‘


πŸ’€ BUGS πŸ’€

No known bugs.

not a single one. she's clean. she's thriving. πŸ™ˆ


🌟 AUTHOR 🌟

Jorge Mora (mora@netapp.com) β€” the goat, respectfully. 🫢


okay that's the whole page bestie!! this was NFStest 3.2, dated 21 March 2023 β€” so if you're reading this from the future, hey, the ethernet layer still says hi. mwah, slay, periodt. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’