Class: Libnet::Ethernet

Inherits:
Header
  • Object
show all
Defined in:
lib/libnet4r/header.rb

Overview

Ethernet

Class to represent an IEEE 802.3 Ethernet header.

Example

e = Libnet::Ethernet.new

e.dst     = 'aa:bb:cc:dd:ee:ff'
e.src     = [0x11, 0x22, 0x33, 0x44, 0x55, 0x66].pack("C*")
e.type    = 0x1234
e.payload = "this is the message"

Public Class Methods

decode(string) -> new Ethernet object

Decode a packed ethernet packet.

Public Instance Methods

dst, dst=, dst?

Get/set/query the destination MAC address.

src, src=, src?

Get/set/query the source MAC address.

type, type=, type?

Get/set/query the protocol type.

payload, payload=, payload?

Get/set/query the ethernet payload. Optional.

ptag

Get the ptag value for this header object. Set by the Libnet builder method.

Constant Summary

Constants inherited from Header

Header::DEFAULT_OPTS, Header::HWADDR_RE, Header::IPADDR_RE, Header::UNIT_MULTIPLIERS

Instance Attribute Summary

Attributes inherited from Header

#ptag

Method Summary

Methods inherited from Header

assignment_filter, decode, fields, inherited, #initialize, octets_field, unsigned_field

Methods included from Helpers

#check_integer, #check_string

Constructor Details

This class inherits a constructor from Libnet::Header