### Home Classes Methods

### In Files

- lib/packetfu/protos/eth/header.rb

### Parent

Struct.new(:n0, :n1, :n2)

### Methods

- ::new
- #read
- #to_s

### Files

- .document
- README.rdoc

### Class/Module Index

Quicksearch

- PacketFu
- PacketFu::ARPHeader
- PacketFu::ARPHeaderMixin
- PacketFu::ARPPacket
- PacketFu::AddrIpv6
- PacketFu::Capture
- PacketFu::Config
- PacketFu::EthHeader
- PacketFu::EthHeaderMixin
- PacketFu::EthMac
- PacketFu::EthNic
- PacketFu::EthOui
- PacketFu::EthPacket
- PacketFu::HSRPHeader
- PacketFu::HSRPHeaderMixin
- PacketFu::HSRPPacket
- PacketFu::ICMPHeader
- PacketFu::ICMPHeaderMixin
- PacketFu::ICMPPacket
- PacketFu::IPHeader
- PacketFu::IPHeaderMixin
- PacketFu::IPPacket
- PacketFu::IPv6Header
- PacketFu::IPv6HeaderMixin
- PacketFu::IPv6Packet
- PacketFu::Inject
- PacketFu::InvalidHeader
- PacketFu::InvalidPacket
- PacketFu::LLDPHeader
- PacketFu::LLDPHeaderMixin
- PacketFu::LLDPPacket
- PacketFu::Octets
- PacketFu::Packet
- PacketFu::PcapFile
- PacketFu::PcapHeader
- PacketFu::PcapPacket
- PacketFu::PcapPackets
- PacketFu::Read
- PacketFu::TCPHeader
- PacketFu::TCPHeaderMixin
- PacketFu::TCPPacket
- PacketFu::TcpEcn
- PacketFu::TcpFlags
- PacketFu::TcpHlen
- PacketFu::TcpOption
- PacketFu::TcpOption::ECHO
- PacketFu::TcpOption::ECHOREPLY
- PacketFu::TcpOption::EOL
- PacketFu::TcpOption::MSS
- PacketFu::TcpOption::NOP
- PacketFu::TcpOption::SACK
- PacketFu::TcpOption::SACKOK
- PacketFu::TcpOption::TS
- PacketFu::TcpOption::WS
- PacketFu::TcpOptions
- PacketFu::TcpReserved
- PacketFu::Timestamp
- PacketFu::UDPHeader
- PacketFu::UDPHeaderMixin
- PacketFu::UDPPacket
- PacketFu::Utils
- PacketFu::Write
- StructFu
- StructFu::Int
- StructFu::Int16
- StructFu::Int16be
- StructFu::Int16le
- StructFu::Int32
- StructFu::Int32be
- StructFu::Int32le
- StructFu::Int8
- StructFu::IntString
- StructFu::String
- Struct

No matching classes.

# PacketFu::EthNic

EthNic is the Network Interface Controler portion of a MAC address, used in EthHeader.

#### Header Definition

    Fixnum :n1
    Fixnum :n2
    Fixnum :n3

### Public Class Methods

new(args={}) click to toggle source

EthNic does not enjoy StructFu typing.

    # File lib/packetfu/protos/eth/header.rb, line 77
    def initialize(args={})
      args.each_pair {|k,v| args[k] = 0 unless v}
      super(args[:n0], args[:n1], args[:n2])
    end

### Public Instance Methods

read(str) click to toggle source

Reads a string to populate the object.

    # File lib/packetfu/protos/eth/header.rb, line 88
    def read(str)
      force_binary(str)
      return self if str.nil?
      self[:n0], self[:n1], self[:n2] = str[0,3].unpack("C3")
      self
    end

to_s() click to toggle source

Returns the object in string form.

    # File lib/packetfu/protos/eth/header.rb, line 83
    def to_s
      [n0,n1,n2].map {|x| x.to_i}.pack("C3")
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.