perltidy
This commit is contained in:
@@ -4,20 +4,20 @@
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
@@ -33,69 +33,73 @@ package SNMP::Info::IEEE802dot11;
|
||||
use strict;
|
||||
use Exporter;
|
||||
|
||||
@SNMP::Info::IEEE802dot11::ISA = qw/Exporter/;
|
||||
@SNMP::Info::IEEE802dot11::ISA = qw/Exporter/;
|
||||
@SNMP::Info::IEEE802dot11::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '1.09';
|
||||
|
||||
%MIBS = (
|
||||
'IEEE802dot11-MIB' => 'dot11DesiredSSID',
|
||||
);
|
||||
%MIBS = ( 'IEEE802dot11-MIB' => 'dot11DesiredSSID', );
|
||||
|
||||
%GLOBALS = (
|
||||
);
|
||||
%GLOBALS = ();
|
||||
|
||||
%FUNCS = (
|
||||
# dot11PhyOFDMTable
|
||||
'dot11_cur_freq' => 'dot11CurrentFrequency',
|
||||
# dot11PhyDSSSTable
|
||||
'dot11_cur_ch' => 'dot11CurrentChannel',
|
||||
# dot11PhyOperationTable
|
||||
'dot11_phy_type' => 'dot11PHYType',
|
||||
'dot11_reg_dom' => 'dot11CurrentRegDomain',
|
||||
# dot11ResourceInfoTable
|
||||
'dot11_prod_ver' => 'dot11manufacturerProductVersion',
|
||||
'dot11_prod_name' => 'dot11manufacturerProductName',
|
||||
'dot11_man_name' => 'dot11manufacturerName',
|
||||
# dot11OperationTable
|
||||
'dot11_mac' => 'dot11MACAddress',
|
||||
# dot11StationConfigTable
|
||||
'dot11_bss_type' => 'dot11DesiredBSSType',
|
||||
'i_ssidlist' => 'dot11DesiredSSID',
|
||||
'dot11_pwr_mode' => 'dot11PowerManagementMode',
|
||||
'dot11_sta_id' => 'dot11StationID',
|
||||
# dot11PhyTxPowerTable
|
||||
'dot11_cur_tx_pwr' => 'dot11CurrentTxPowerLevel',
|
||||
'dot11_tx_pwr_level_1' => 'dot11TxPowerLevel1',
|
||||
'dot11_tx_pwr_level_2' => 'dot11TxPowerLevel2',
|
||||
'dot11_tx_pwr_level_3' => 'dot11TxPowerLevel3',
|
||||
'dot11_tx_pwr_level_4' => 'dot11TxPowerLevel4',
|
||||
'dot11_tx_pwr_level_5' => 'dot11TxPowerLevel5',
|
||||
'dot11_tx_pwr_level_6' => 'dot11TxPowerLevel6',
|
||||
'dot11_tx_pwr_level_7' => 'dot11TxPowerLevel7',
|
||||
'dot11_tx_pwr_level_8' => 'dot11TxPowerLevel8',
|
||||
);
|
||||
%FUNCS = (
|
||||
|
||||
%MUNGE = (
|
||||
'dot11_mac' => \&SNMP::Info::munge_mac,
|
||||
'dot11_sta_id' => \&SNMP::Info::munge_mac,
|
||||
);
|
||||
# dot11PhyOFDMTable
|
||||
'dot11_cur_freq' => 'dot11CurrentFrequency',
|
||||
|
||||
# dot11PhyDSSSTable
|
||||
'dot11_cur_ch' => 'dot11CurrentChannel',
|
||||
|
||||
# dot11PhyOperationTable
|
||||
'dot11_phy_type' => 'dot11PHYType',
|
||||
'dot11_reg_dom' => 'dot11CurrentRegDomain',
|
||||
|
||||
# dot11ResourceInfoTable
|
||||
'dot11_prod_ver' => 'dot11manufacturerProductVersion',
|
||||
'dot11_prod_name' => 'dot11manufacturerProductName',
|
||||
'dot11_man_name' => 'dot11manufacturerName',
|
||||
|
||||
# dot11OperationTable
|
||||
'dot11_mac' => 'dot11MACAddress',
|
||||
|
||||
# dot11StationConfigTable
|
||||
'dot11_bss_type' => 'dot11DesiredBSSType',
|
||||
'i_ssidlist' => 'dot11DesiredSSID',
|
||||
'dot11_pwr_mode' => 'dot11PowerManagementMode',
|
||||
'dot11_sta_id' => 'dot11StationID',
|
||||
|
||||
# dot11PhyTxPowerTable
|
||||
'dot11_cur_tx_pwr' => 'dot11CurrentTxPowerLevel',
|
||||
'dot11_tx_pwr_level_1' => 'dot11TxPowerLevel1',
|
||||
'dot11_tx_pwr_level_2' => 'dot11TxPowerLevel2',
|
||||
'dot11_tx_pwr_level_3' => 'dot11TxPowerLevel3',
|
||||
'dot11_tx_pwr_level_4' => 'dot11TxPowerLevel4',
|
||||
'dot11_tx_pwr_level_5' => 'dot11TxPowerLevel5',
|
||||
'dot11_tx_pwr_level_6' => 'dot11TxPowerLevel6',
|
||||
'dot11_tx_pwr_level_7' => 'dot11TxPowerLevel7',
|
||||
'dot11_tx_pwr_level_8' => 'dot11TxPowerLevel8',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
'dot11_mac' => \&SNMP::Info::munge_mac,
|
||||
'dot11_sta_id' => \&SNMP::Info::munge_mac,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
my $dot11 = shift;
|
||||
|
||||
my $names = $dot11->dot11_man_name();
|
||||
|
||||
foreach my $iid (keys %$names){
|
||||
|
||||
foreach my $iid ( keys %$names ) {
|
||||
my $vendor = $names->{$iid};
|
||||
next unless defined $vendor;
|
||||
if ( $vendor =~ /^(\S+)/ ) {
|
||||
return lc($1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,12 +107,12 @@ sub model {
|
||||
my $dot11 = shift;
|
||||
|
||||
my $names = $dot11->dot11_prod_name();
|
||||
|
||||
foreach my $iid (keys %$names){
|
||||
|
||||
foreach my $iid ( keys %$names ) {
|
||||
my $prod = $names->{$iid};
|
||||
next unless defined $prod;
|
||||
return lc($prod);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -116,15 +120,15 @@ sub os_ver {
|
||||
my $dot11 = shift;
|
||||
|
||||
my $versions = $dot11->dot11_prod_ver();
|
||||
|
||||
foreach my $iid (keys %$versions){
|
||||
|
||||
foreach my $iid ( keys %$versions ) {
|
||||
my $ver = $versions->{$iid};
|
||||
next unless defined $ver;
|
||||
if ( $ver =~ /([\d\.]+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -133,18 +137,18 @@ sub i_80211channel {
|
||||
|
||||
my $phy_type = $dot11->dot11_phy_type() || {};
|
||||
my $cur_freq = $dot11->dot11_cur_freq() || {};
|
||||
my $cur_ch = $dot11->dot11_cur_ch() || {};
|
||||
my $cur_ch = $dot11->dot11_cur_ch() || {};
|
||||
|
||||
my %i_80211channel;
|
||||
foreach my $iid (keys %$phy_type){
|
||||
foreach my $iid ( keys %$phy_type ) {
|
||||
my $type = $phy_type->{$iid};
|
||||
next unless defined $type;
|
||||
if ($type =~ /dsss/) {
|
||||
if ( $type =~ /dsss/ ) {
|
||||
my $ch = $cur_ch->{$iid};
|
||||
next unless defined $ch;
|
||||
$i_80211channel{$iid} = $ch;
|
||||
}
|
||||
elsif ($type =~ /ofdm/) {
|
||||
elsif ( $type =~ /ofdm/ ) {
|
||||
my $ch = $cur_freq->{$iid};
|
||||
next unless defined $ch;
|
||||
$i_80211channel{$iid} = $ch;
|
||||
@@ -158,17 +162,20 @@ sub i_80211channel {
|
||||
}
|
||||
|
||||
sub dot11_cur_tx_pwr_mw {
|
||||
my $dot11 = shift;
|
||||
my $partial = shift;
|
||||
my $cur = $dot11->dot11_cur_tx_pwr($partial);
|
||||
my $dot11 = shift;
|
||||
my $partial = shift;
|
||||
my $cur = $dot11->dot11_cur_tx_pwr($partial);
|
||||
my $dot11_cur_tx_pwr_mw = {};
|
||||
foreach my $idx (keys %$cur) {
|
||||
foreach my $idx ( keys %$cur ) {
|
||||
my $pwr = $cur->{$idx};
|
||||
if ($pwr >= 1 && $pwr <= 8) {
|
||||
# ToDo - Look at string eval
|
||||
my $mw = eval "\$dot11->dot11_tx_pwr_level_$pwr(\$idx)"; ## no critic
|
||||
if ( $pwr >= 1 && $pwr <= 8 ) {
|
||||
|
||||
# ToDo - Look at string eval
|
||||
my $mw
|
||||
= eval "\$dot11->dot11_tx_pwr_level_$pwr(\$idx)"; ## no critic
|
||||
$dot11_cur_tx_pwr_mw->{$idx} = $mw->{$idx};
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
}
|
||||
@@ -204,9 +211,9 @@ Eric Miller
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
SNMP::Info::IEEE802dot11 is a subclass of SNMP::Info that provides an interface
|
||||
to F<IEEE802dot11-MIB>. This MIB is used in standards based 802.11 wireless
|
||||
devices.
|
||||
SNMP::Info::IEEE802dot11 is a subclass of SNMP::Info that provides an
|
||||
interface to F<IEEE802dot11-MIB>. This MIB is used in standards based
|
||||
802.11 wireless devices.
|
||||
|
||||
Use or create a subclass of SNMP::Info that inherits this one.
|
||||
Do not use directly.
|
||||
@@ -270,8 +277,8 @@ interface.
|
||||
|
||||
=item $dot11->dot11_cur_tx_pwr_mw()
|
||||
|
||||
Returns reference to hash. Current transmit power, in milliwatts, of the radio
|
||||
interface.
|
||||
Returns reference to hash. Current transmit power, in milliwatts, of the
|
||||
radio interface.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
Reference in New Issue
Block a user