Net::CDP::Address - Cisco Discovery Protocol (CDP) port address
use Net::CDP::Address qw(:protos); # Constructors $address = new Net::CDP::Address($ip); $address = new Net::CDP::Address($protocol, $packed); $cloned = clone $address; # Object methods $protocol = $address->protocol; $address = $address->address; $packed = $address->packed;
A Net::CDP::Address object represents a single addres in the Addresses or Management Addresses field of a CDP packet. Net::CDP::Address objects are immutable.
$address = new Net::CDP::Address($ip) $address = new Net::CDP::Address($protocol, $packed)
Returns a new Net::CDP::Address object.
If only one argument is provided, new will attempt to parse it as an IPv4 or IPv6 address.
new
Otherwise, you must specify the protocol and the bytes that comprise the address. $protocol should be one of the following constants:
$protocol
CDP_ADDR_PROTO_CLNP CDP_ADDR_PROTO_IPV4 CDP_ADDR_PROTO_IPV6 CDP_ADDR_PROTO_DECNET CDP_ADDR_PROTO_APPLETALK CDP_ADDR_PROTO_IPX CDP_ADDR_PROTO_VINES CDP_ADDR_PROTO_XNS CDP_ADDR_PROTO_APOLLO
These constants can be exported using the tag :protos. See Exporter.
:protos
$packed must be a string consisting of the bytes that make up the address in network order. You may find the pack function useful in generating this string.
$packed
pack
$cloned = clone $packet
Returns a deep copy of the supplied Net::CDP::Address object.
$protocol = $address->protocol()
Returns this address's protocol.
$ip = $address->address()
If this is an IPv4 or IPv6 address, returns its standard string representation, otherwise undef.
undef
$packed = $address->packed()
Returns this address as a string consisting of the bytes that comprise it in network order.
Net::CDP
Michael Chapman, <cpan@very.puzzling.org>
Copyright (C) 2005 by Michael Chapman
libcdp is released under the terms and conditions of the GNU Library General Public License version 2. Net::CDP may be redistributed and/or modified under the same terms as Perl itself.
To install Net::CDP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::CDP
CPAN shell
perl -MCPAN -e shell install Net::CDP
For more information on module installation, please visit the detailed CPAN module installation guide.