Ethernet Methods

ethernet – Ethernet Helper Functions

moddy.lib.net.ethernet.eth_bcast_addr()[source]
Returns

Ethernet Broadcast MAC Address “FF:FF:FF:FF:FF:FF”

moddy.lib.net.ethernet.eth_flight_time(net_speed, n_bytes)[source]

Compute flight time of an Ethernet frame If nBytes are below the minimum Ethernet frame length, the flight time of the minimum frame length is returned.

Parameters
  • netSpeed – physical link speed in bits/second

  • nBytes – number of bytes to transmit

Returns

transmission time on wire in seconds

moddy.lib.net.ethernet.eth_hdr_len()[source]
Returns

Ethernet header byte length

moddy.lib.net.ethernet.eth_pdu(src, dst, eth_type, payload)[source]

Create an Ethernet Pdu

Parameters
  • src (str) – Source MAC address

  • dst (str) – Destination MAC address

  • eht_type – Ethernet type

  • payload (Pdu) – Ethernet payload

Returns

filled Pdu