class Pio::LLDP

LLDP frame parser and generator.

LLDP frame parser and generator.

LLDP frame parser and generator.

Public Class Methods

new(options) click to toggle source
# File lib/pio/lldp.rb, line 42
def initialize(options)
  @frame = Frame.new(Options.new(options).to_hash)
end
read(raw_data) click to toggle source
# File lib/pio/lldp.rb, line 30
def self.read(raw_data)
  begin
    frame = Frame.read(raw_data)
  rescue
    raise Pio::ParseError, $ERROR_INFO.message
  end

  lldp = allocate
  lldp.instance_variable_set :@frame, frame
  lldp
end

Public Instance Methods

port_number() click to toggle source
# File lib/pio/lldp.rb, line 46
def port_number
  @frame.port_id.get.snapshot
end
to_binary() click to toggle source
# File lib/pio/lldp.rb, line 50
def to_binary
  @frame.to_binary_s + "\000" * (64 - @frame.num_bytes)
end