Sha256: a5d454d36cd07118a39aa3e9306074448a229b5d529a04dae07e9236edc5127d
Contents?: true
Size: 1.32 KB
Versions: 6
Compression:
Stored size: 1.32 KB
Contents
# encoding: utf-8 require 'English' require 'forwardable' require 'pio/lldp/frame' require 'pio/lldp/options' # Packet parser and generator library. module Pio # LLDP frame parser and generator. class Lldp extend Forwardable def_delegator :@frame, :destination_mac def_delegator :@frame, :source_mac def_delegator :@frame, :ether_type def_delegator :@frame, :chassis_id def_delegator :@frame, :dpid def_delegator :@frame, :optional_tlv def_delegator :@frame, :port_id alias_method :port_number, :port_id def_delegator :@frame, :ttl def_delegator :@frame, :port_description def_delegator :@frame, :system_name def_delegator :@frame, :system_description def_delegator :@frame, :system_capabilities def_delegator :@frame, :enabled_capabilities def_delegator :@frame, :management_address def_delegator :@frame, :organizationally_specific 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 def initialize(options) @frame = Frame.new(Options.new(options).to_hash) end def to_binary @frame.to_binary_s + "\000" * (64 - @frame.num_bytes) end end LLDP = Lldp end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
pio-0.8.1 | lib/pio/lldp.rb |
pio-0.8.0 | lib/pio/lldp.rb |
pio-0.7.0 | lib/pio/lldp.rb |
pio-0.6.0 | lib/pio/lldp.rb |
pio-0.5.0 | lib/pio/lldp.rb |
pio-0.4.0 | lib/pio/lldp.rb |