- Move munge_null() to Info.pm
- Change munge_caps() to munge_bits() from Info.pm
This commit is contained in:
43
Info/LLDP.pm
43
Info/LLDP.pm
@@ -71,30 +71,15 @@ $VERSION = '1.09';
|
|||||||
|
|
||||||
|
|
||||||
%MUNGE = (
|
%MUNGE = (
|
||||||
'lldp_sysdesc' => \&munge_null,
|
'lldp_sysdesc' => \&SNMP::Info::munge_null,
|
||||||
'lldp_sysname' => \&munge_null,
|
'lldp_sysname' => \&SNMP::Info::munge_null,
|
||||||
'lldp_rem_sysname' => \&munge_null,
|
'lldp_rem_sysname' => \&SNMP::Info::munge_null,
|
||||||
'lldp_rem_sysdesc' => \&munge_null,
|
'lldp_rem_sysdesc' => \&SNMP::Info::munge_null,
|
||||||
'lldp_rem_port_desc' => \&munge_null,
|
'lldp_rem_port_desc' => \&SNMP::Info::munge_null,
|
||||||
'lldp_sys_cap' => \&munge_caps,
|
'lldp_sys_cap' => \&SNMP::Info::munge_bits,
|
||||||
'lldp_rem_sys_cap' => \&munge_caps,
|
'lldp_rem_sys_cap' => \&SNMP::Info::munge_bits,
|
||||||
);
|
);
|
||||||
|
|
||||||
sub munge_null {
|
|
||||||
my $text = shift || return;
|
|
||||||
|
|
||||||
$text =~ s/\0//g;
|
|
||||||
return $text;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub munge_caps {
|
|
||||||
my $caps = shift;
|
|
||||||
return unless defined $caps;
|
|
||||||
|
|
||||||
my $bits = unpack("b*",$caps);
|
|
||||||
return $bits;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub hasLLDP {
|
sub hasLLDP {
|
||||||
my $lldp = shift;
|
my $lldp = shift;
|
||||||
|
|
||||||
@@ -296,7 +281,8 @@ LLDP is a Layer 2 protocol that allows a network device to advertise its
|
|||||||
identity and capabilities on the local network providing topology information.
|
identity and capabilities on the local network providing topology information.
|
||||||
The protocol is defined in the IEEE standard 802.1AB.
|
The protocol is defined in the IEEE standard 802.1AB.
|
||||||
|
|
||||||
Create or use a device subclass that inherits this class. Do not use directly.
|
Create or use a device subclass that inherits this class. Do not use
|
||||||
|
directly.
|
||||||
|
|
||||||
=head2 Inherited Classes
|
=head2 Inherited Classes
|
||||||
|
|
||||||
@@ -340,8 +326,8 @@ Nulls are removed before the value is returned.
|
|||||||
=item $lldp->lldp_sysdesc()
|
=item $lldp->lldp_sysdesc()
|
||||||
|
|
||||||
The string value used to identify the system description of the local system.
|
The string value used to identify the system description of the local system.
|
||||||
If the local agent supports IETF RFC 3418, C<lldpLocSysDesc> object should have
|
If the local agent supports IETF RFC 3418, C<lldpLocSysDesc> object should
|
||||||
the same value of C<sysDesc> object.
|
have the same value of C<sysDesc> object.
|
||||||
|
|
||||||
Nulls are removed before the value is returned.
|
Nulls are removed before the value is returned.
|
||||||
|
|
||||||
@@ -406,8 +392,8 @@ lldp_addr if you want any return address type.
|
|||||||
|
|
||||||
=item $lldp->lldp_addr()
|
=item $lldp->lldp_addr()
|
||||||
|
|
||||||
Returns remote address. Type may be any IANA Address Family Number. Currently
|
Returns remote address. Type may be any IANA Address Family Number.
|
||||||
only returns IPv4 or MAC addresses.
|
Currently only returns IPv4 or MAC addresses.
|
||||||
|
|
||||||
=item $lldp->lldp_port()
|
=item $lldp->lldp_port()
|
||||||
|
|
||||||
@@ -458,7 +444,8 @@ Nulls are removed before the value is returned.
|
|||||||
|
|
||||||
=item $lldp->lldp_rem_sysname()
|
=item $lldp->lldp_rem_sysname()
|
||||||
|
|
||||||
Returns the string value used to identify the system name of the remote system.
|
Returns the string value used to identify the system name of the remote
|
||||||
|
system.
|
||||||
|
|
||||||
Nulls are removed before the value is returned.
|
Nulls are removed before the value is returned.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user