The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::Frame::Layer::CDP::Address - Address encoding for CDP addresses TLV

SYNOPSIS

   use Net::Frame::Simple;
   use Net::Frame::Layer::CDP qw(:consts);

   my $layer = Net::Frame::Layer::CDP::Address->new(
      protocolType   => NF_CDP_ADDRESS_PROTOCOL_TYPE_NLPID,
      protocolLength => 1,
      protocol       => NF_CDP_ADDRESS_PROTOCOL_IP,
      addressLength  => 4,
      address        => '127.0.0.1',
   );

   #
   # Read a raw layer
   #
   my $layer = Net::Frame::Layer::CDP->new(raw => $raw);

   print $layer->print."\n";
   print 'PAYLOAD: '.unpack('H*', $layer->payload)."\n"
      if $layer->payload;

DESCRIPTION

This modules implements the encoding and decoding addresses for the Addresses and ManagementAddresses CDP message type.

ATTRIBUTES

protocolType

Protocol type. See CONSTANTS for values.

protocolLength

Length of protocol value.

protocol

Protocol value. This is a pack('H*', $string) where $string represents the protocol. See CONSTANTS for values.

addressLength

Length of address.

address

Address.

The following are inherited attributes. See Net::Frame::Layer for more information.

raw
payload
nextLayer

METHODS

new
new (hash)

Object constructor. You can pass attributes that will overwrite default ones. See SYNOPSIS for default values.

ipv4Address
ipv4Address (hash)

Alias to new.

ipv6Address
ipv6Address (hash)

Alias to new.

Object constructor for IPv6 specific address.

      protocolType   => NF_CDP_ADDRESS_PROTOCOL_TYPE_8022,
      protocolLength => 8,
      protocol       => NF_CDP_ADDRESS_PROTOCOL_IPv6,
      addressLength  => 16,
      address        => '::1',

The following are inherited methods. Some of them may be overriden in this layer, and some others may not be meaningful in this layer. See Net::Frame::Layer for more information.

layer
computeLengths
computeChecksums
pack
unpack
encapsulate
getLength
getPayloadLength
print
dump

CONSTANTS

NF_CDP_ADDRESS_PROTOCOL_TYPE_NLPID
NF_CDP_ADDRESS_PROTOCOL_TYPE_8022

Protocol types.

NF_CDP_ADDRESS_PROTOCOL_IP
NF_CDP_ADDRESS_PROTOCOL_IPv6

Protocols.

SEE ALSO

Net::Frame::Layer::CDP::Addresses, Net::Frame::Layer::CDP::ManagementAddresses, Net::Frame::Layer::CDP, Net::Frame::Layer

AUTHOR

Michael Vincent

COPYRIGHT AND LICENSE

Copyright (c) 2013, Michael Vincent

You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.