### Home Classes Methods

### In Files

- lib/packetfu/protos/lldp.rb

### Parent

Packet

### Methods

- ::can_parse?
- ::new
- #peek_format
- #read
- #recalc

### Included Modules

- PacketFu::EthHeaderMixin
- PacketFu::LLDPHeaderMixin

### 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::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.