Class: FFI::Packets::Eth::Hdr

Inherits:
Struct
  • Object
show all
Includes:
DRY::NetStructHelper
Defined in:
lib/ffi/packets/eth.rb

Overview

struct :dst, EthAddr, :desc => ‘destination address’

struct :src,   EthAddr, :desc => 'source address'
field  :etype, :ushort, :desc => 'ethernet payload type'

Defined Under Namespace

Modules: Etype

Instance Method Summary collapse

Instance Method Details

#_divert_set_ethObject



63
# File 'lib/ffi/packets/eth.rb', line 63

alias _divert_set_eth etype=

#etype=(val) ⇒ Object



65
66
67
68
69
70
# File 'lib/ffi/packets/eth.rb', line 65

def etype=(val)
  if val.kind_of? String or val.kind_of? Symbol
    val = Etype[ val ] or raise(ArgumentError, "invalid eth type #{val}")
  end
  _divert_set_eth(val)
end

#lookup_etypeObject



59
60
61
# File 'lib/ffi/packets/eth.rb', line 59

def lookup_etype
  Etype[ self.etype ]
end