Class: PacketFu::EthMac
- Defined in:
- lib/packetfu/protos/eth/header.rb
Overview
Instance Attribute Summary collapse
-
#nic ⇒ Object
Returns the value of attribute nic.
-
#oui ⇒ Object
Returns the value of attribute oui.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ EthMac
constructor
A new instance of EthMac.
-
#read(str) ⇒ Object
Reads a string to populate the object.
-
#to_s ⇒ Object
Returns the object in string form.
Methods inherited from Struct
Constructor Details
Instance Attribute Details
#nic ⇒ Object
Returns the value of attribute nic
104 105 106 |
# File 'lib/packetfu/protos/eth/header.rb', line 104 def nic @nic end |
#oui ⇒ Object
Returns the value of attribute oui
104 105 106 |
# File 'lib/packetfu/protos/eth/header.rb', line 104 def oui @oui end |
Instance Method Details
#read(str) ⇒ Object
Reads a string to populate the object.
118 119 120 121 122 123 124 |
# File 'lib/packetfu/protos/eth/header.rb', line 118 def read(str) force_binary(str) return self if str.nil? self.oui.read str[0,3] self.nic.read str[3,3] self end |
#to_s ⇒ Object
Returns the object in string form.
113 114 115 |
# File 'lib/packetfu/protos/eth/header.rb', line 113 def to_s "#{self[:oui]}#{self[:nic]}" end |