Parent

Class/Module Index [+]

Quicksearch

PacketFu::LLDPPacket

Attributes

eth_header[RW]
lldp_header[RW]

Public Class Methods

can_parse?(str) click to toggle source
# File lib/packetfu/protos/lldp.rb, line 15
def self.can_parse?(str)
  return false unless EthPacket.can_parse? str
  return false unless str.size >= 6
  return false unless str[12,2] == "\x88\xcc"
  return false unless str =~ /^\x01\x80\xc2\x00\x00[\x0e\x03\x00]/
  true
end
new(args={}) click to toggle source
# File lib/packetfu/protos/lldp.rb, line 30
def initialize(args={})
  @eth_header = EthHeader.new(args).read(args[:eth])
  @lldp_header = LLDPHeader.new(args).read(args[:lldp])
  @eth_header.eth_proto = "\x88\xCC"
  @eth_header.body=@lldp_header

  @headers = [@eth_header, @lldp_header]
  super
end

Public Instance Methods

peek_format() click to toggle source

Generates summary data for LLDP packets.

# File lib/packetfu/protos/lldp.rb, line 41
def peek_format
  peek_data = ["A  "]
  peek_data << "%-5d" % self.to_s.size
  peek_data << lldp_saddr_mac
  peek_data << "(#{lldp_saddr_mac})"
  peek_data << "->"
  peek_data << "01:80:c2:00:00:0e"
  peek_data.join
end
read(str=nil,args={}) click to toggle source
# File lib/packetfu/protos/lldp.rb, line 23
def read(str=nil,args={})
  raise "Cannot parse `#{str}'" unless self.class.can_parse?(str)
  @eth_header.read(str)
  super(args)
  self
end
recalc(args={}) click to toggle source

While there are lengths in LLDPPackets, there's not much to do with them.

# File lib/packetfu/protos/lldp.rb, line 53
def recalc(args={})
  @headers[0].inspect
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.