| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::Wireless::802_11::AP; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20658
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
32
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use base 'Error::Helper'; |
|
|
1
|
|
|
|
|
12
|
|
|
|
1
|
|
|
|
|
756
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Net::Wireless::802_11::AP - Provides a OO representation to 802.11 AP based on WPA supplicant. |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.1.1 |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.1.1'; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use Net::Wireless::802_11::AP; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $foo = Net::Wireless::802_11::AP->new({ ssid=>'"foo"' }); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#scan for value for scan_ssid |
|
27
|
|
|
|
|
|
|
$foo->setKey('scan_ssid', '1'); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#set the key management and key |
|
30
|
|
|
|
|
|
|
$foo->setKey( 'key_mgmt', 'WPA-PSK' ); |
|
31
|
|
|
|
|
|
|
$foo->setKey( 'psk', '"bar..."' ); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#gets the ssid |
|
34
|
|
|
|
|
|
|
my $ssid=$foo->getKey( 'ssid' ); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#get the bssid |
|
37
|
|
|
|
|
|
|
my $bssid=$foo->getKey( 'bssid' ); |
|
38
|
|
|
|
|
|
|
if( defined($bssid) ){ |
|
39
|
|
|
|
|
|
|
print 'BSSID='.$bssid."\n"; |
|
40
|
|
|
|
|
|
|
}else{ |
|
41
|
|
|
|
|
|
|
print "No BSSID set.\n"; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 METHODS |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 new |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This initiates the object. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
One arguement is required and it is the a hash reference to initiate |
|
51
|
|
|
|
|
|
|
the object with. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
The hash reference has one required value and that is 'ssid'. This is |
|
54
|
|
|
|
|
|
|
SSID of the base station in question. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
The others may be any valid key for a configured AP in wpa_supplicant.conf. |
|
57
|
|
|
|
|
|
|
For more information, please see wpa_supplicant.conf(5). |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
There is one break from this and this is the key 'networkID'. This represents the |
|
60
|
|
|
|
|
|
|
numeric ID used for with wpa_cli to reference that configured AP. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $new=$foo=Net::Wireless::802_11::AP->new( { ssid=>'"foo"' } ); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub new{ |
|
67
|
0
|
|
|
0
|
1
|
|
my %args; |
|
68
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
|
69
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
|
0
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $self={ |
|
73
|
|
|
|
|
|
|
perror=>undef, |
|
74
|
|
|
|
|
|
|
error=>undef, |
|
75
|
|
|
|
|
|
|
errorString=>'', |
|
76
|
|
|
|
|
|
|
ssid=>undef, |
|
77
|
|
|
|
|
|
|
scan_ssid=>undef, |
|
78
|
|
|
|
|
|
|
bssid=>undef, |
|
79
|
|
|
|
|
|
|
priority=>undef, |
|
80
|
|
|
|
|
|
|
mode=>undef, |
|
81
|
|
|
|
|
|
|
proto=>undef, |
|
82
|
|
|
|
|
|
|
key_mgmt=>undef, |
|
83
|
|
|
|
|
|
|
auth_alg=>undef, |
|
84
|
|
|
|
|
|
|
pairwise=>undef, |
|
85
|
|
|
|
|
|
|
group=>undef, |
|
86
|
|
|
|
|
|
|
psk=>undef, |
|
87
|
|
|
|
|
|
|
eapol_flags=>undef, |
|
88
|
|
|
|
|
|
|
eap=>undef, |
|
89
|
|
|
|
|
|
|
identity=>undef, |
|
90
|
|
|
|
|
|
|
anonymous_identity=>undef, |
|
91
|
|
|
|
|
|
|
mixed_cell=>undef, |
|
92
|
|
|
|
|
|
|
password=>undef, |
|
93
|
|
|
|
|
|
|
ca_cert=>undef, |
|
94
|
|
|
|
|
|
|
client_cert=>undef, |
|
95
|
|
|
|
|
|
|
private_key=>undef, |
|
96
|
|
|
|
|
|
|
private_key_passwd=>undef, |
|
97
|
|
|
|
|
|
|
dh_file=>undef, |
|
98
|
|
|
|
|
|
|
subject_match=>undef, |
|
99
|
|
|
|
|
|
|
phase1=>undef, |
|
100
|
|
|
|
|
|
|
phase2=>undef, |
|
101
|
|
|
|
|
|
|
ca_cert2=>undef, |
|
102
|
|
|
|
|
|
|
client_cert2=>undef, |
|
103
|
|
|
|
|
|
|
private_key2=>undef, |
|
104
|
|
|
|
|
|
|
private_key2_passwd=>undef, |
|
105
|
|
|
|
|
|
|
dh_file2=>undef, |
|
106
|
|
|
|
|
|
|
subject_match2=>undef, |
|
107
|
|
|
|
|
|
|
eappsk=>undef, |
|
108
|
|
|
|
|
|
|
nai=>undef, |
|
109
|
|
|
|
|
|
|
server_nai=>undef, |
|
110
|
|
|
|
|
|
|
pac_file=>undef, |
|
111
|
|
|
|
|
|
|
eap_workaround=>undef, |
|
112
|
|
|
|
|
|
|
networkID=>undef, |
|
113
|
|
|
|
|
|
|
wep_tx_keyidx=>undef, |
|
114
|
|
|
|
|
|
|
wep_key0=>undef, |
|
115
|
|
|
|
|
|
|
wep_key1=>undef, |
|
116
|
|
|
|
|
|
|
wep_key2=>undef, |
|
117
|
|
|
|
|
|
|
wep_key4=>undef, |
|
118
|
|
|
|
|
|
|
valid=>{ |
|
119
|
|
|
|
|
|
|
ssid=>1, |
|
120
|
|
|
|
|
|
|
scan_ssid=>1, |
|
121
|
|
|
|
|
|
|
bssid=>1, |
|
122
|
|
|
|
|
|
|
priority=>1, |
|
123
|
|
|
|
|
|
|
mode=>1, |
|
124
|
|
|
|
|
|
|
proto=>1, |
|
125
|
|
|
|
|
|
|
key_mgmt=>1, |
|
126
|
|
|
|
|
|
|
auth_alg=>1, |
|
127
|
|
|
|
|
|
|
pairwise=>1, |
|
128
|
|
|
|
|
|
|
group=>1, |
|
129
|
|
|
|
|
|
|
psk=>1, |
|
130
|
|
|
|
|
|
|
eapol_flags=>1, |
|
131
|
|
|
|
|
|
|
eap=>1, |
|
132
|
|
|
|
|
|
|
identity=>1, |
|
133
|
|
|
|
|
|
|
anonymous_identity=>1, |
|
134
|
|
|
|
|
|
|
mixed_cell=>1, |
|
135
|
|
|
|
|
|
|
password=>1, |
|
136
|
|
|
|
|
|
|
ca_cert=>1, |
|
137
|
|
|
|
|
|
|
client_cert=>1, |
|
138
|
|
|
|
|
|
|
private_key=>1, |
|
139
|
|
|
|
|
|
|
private_key_passwd=>1, |
|
140
|
|
|
|
|
|
|
dh_file=>1, |
|
141
|
|
|
|
|
|
|
subject_match=>1, |
|
142
|
|
|
|
|
|
|
phase1=>1, |
|
143
|
|
|
|
|
|
|
phase2=>1, |
|
144
|
|
|
|
|
|
|
ca_cert2=>1, |
|
145
|
|
|
|
|
|
|
client_cert2=>1, |
|
146
|
|
|
|
|
|
|
private_key2=>1, |
|
147
|
|
|
|
|
|
|
private_key2_passwd=>1, |
|
148
|
|
|
|
|
|
|
dh_file2=>1, |
|
149
|
|
|
|
|
|
|
subject_match2=>1, |
|
150
|
|
|
|
|
|
|
eappsk=>1, |
|
151
|
|
|
|
|
|
|
nai=>1, |
|
152
|
|
|
|
|
|
|
server_nai=>1, |
|
153
|
|
|
|
|
|
|
pac_file=>1, |
|
154
|
|
|
|
|
|
|
eap_workaround=>1, |
|
155
|
|
|
|
|
|
|
networkID=>1, |
|
156
|
|
|
|
|
|
|
wep_tx_keyidx=>1, |
|
157
|
|
|
|
|
|
|
wep_key0=>1, |
|
158
|
|
|
|
|
|
|
wep_key1=>1, |
|
159
|
|
|
|
|
|
|
wep_key2=>1, |
|
160
|
|
|
|
|
|
|
wep_key4=>1, |
|
161
|
|
|
|
|
|
|
}, |
|
162
|
|
|
|
|
|
|
wpaKeys=>{ |
|
163
|
|
|
|
|
|
|
ssid=>1, |
|
164
|
|
|
|
|
|
|
scan_ssid=>1, |
|
165
|
|
|
|
|
|
|
bssid=>1, |
|
166
|
|
|
|
|
|
|
priority=>1, |
|
167
|
|
|
|
|
|
|
mode=>1, |
|
168
|
|
|
|
|
|
|
proto=>1, |
|
169
|
|
|
|
|
|
|
key_mgmt=>1, |
|
170
|
|
|
|
|
|
|
auth_alg=>1, |
|
171
|
|
|
|
|
|
|
pairwise=>1, |
|
172
|
|
|
|
|
|
|
group=>1, |
|
173
|
|
|
|
|
|
|
psk=>1, |
|
174
|
|
|
|
|
|
|
eapol_flags=>1, |
|
175
|
|
|
|
|
|
|
eap=>1, |
|
176
|
|
|
|
|
|
|
identity=>1, |
|
177
|
|
|
|
|
|
|
anonymous_identity=>1, |
|
178
|
|
|
|
|
|
|
mixed_cell=>1, |
|
179
|
|
|
|
|
|
|
password=>1, |
|
180
|
|
|
|
|
|
|
ca_cert=>1, |
|
181
|
|
|
|
|
|
|
client_cert=>1, |
|
182
|
|
|
|
|
|
|
private_key=>1, |
|
183
|
|
|
|
|
|
|
private_key_passwd=>1, |
|
184
|
|
|
|
|
|
|
dh_file=>1, |
|
185
|
|
|
|
|
|
|
subject_match=>1, |
|
186
|
|
|
|
|
|
|
phase1=>1, |
|
187
|
|
|
|
|
|
|
phase2=>1, |
|
188
|
|
|
|
|
|
|
ca_cert2=>1, |
|
189
|
|
|
|
|
|
|
client_cert2=>1, |
|
190
|
|
|
|
|
|
|
private_key2=>1, |
|
191
|
|
|
|
|
|
|
private_key2_passwd=>1, |
|
192
|
|
|
|
|
|
|
dh_file2=>1, |
|
193
|
|
|
|
|
|
|
subject_match2=>1, |
|
194
|
|
|
|
|
|
|
eappsk=>1, |
|
195
|
|
|
|
|
|
|
nai=>1, |
|
196
|
|
|
|
|
|
|
server_nai=>1, |
|
197
|
|
|
|
|
|
|
pac_file=>1, |
|
198
|
|
|
|
|
|
|
eap_workaround=>1, |
|
199
|
|
|
|
|
|
|
wep_tx_keyidx=>1, |
|
200
|
|
|
|
|
|
|
wep_key0=>1, |
|
201
|
|
|
|
|
|
|
wep_key1=>1, |
|
202
|
|
|
|
|
|
|
wep_key2=>1, |
|
203
|
|
|
|
|
|
|
wep_key4=>1, |
|
204
|
|
|
|
|
|
|
} |
|
205
|
|
|
|
|
|
|
}; |
|
206
|
0
|
|
|
|
|
|
bless $self; |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
#down syncs everything from the args hash to the object |
|
209
|
0
|
|
|
|
|
|
my $int=0; |
|
210
|
0
|
|
|
|
|
|
my @keys=keys(%args); |
|
211
|
0
|
|
|
|
|
|
while( defined( $keys[$int] ) ){ |
|
212
|
0
|
0
|
|
|
|
|
if(! defined( $self->{valid}{$keys[$int]} ) ){ |
|
213
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
214
|
0
|
|
|
|
|
|
$self->{error}=2; |
|
215
|
0
|
|
|
|
|
|
$self->{errorString}='"'.$keys[$int].'" is not a valid key'; |
|
216
|
|
|
|
|
|
|
} |
|
217
|
|
|
|
|
|
|
|
|
218
|
0
|
|
|
|
|
|
$self->{$keys[$int]}=$args{$keys[$int]}; |
|
219
|
|
|
|
|
|
|
|
|
220
|
0
|
|
|
|
|
|
$int++; |
|
221
|
|
|
|
|
|
|
} |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
#make sure we have a SSID |
|
224
|
0
|
0
|
|
|
|
|
if( ! defined( $self->{ssid} ) ){ |
|
225
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
226
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
227
|
0
|
|
|
|
|
|
$self->{errorString}='No SSID specified'; |
|
228
|
0
|
|
|
|
|
|
return $self; |
|
229
|
|
|
|
|
|
|
} |
|
230
|
|
|
|
|
|
|
|
|
231
|
0
|
|
|
|
|
|
return $self; |
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head2 getKey |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
This returns the requested keys. |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
One value is required and that is the requested key. |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
Undef is a valid return value for this if the requested key is not defined. |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
Error checking is not required as long as the requested key is defined and |
|
243
|
|
|
|
|
|
|
is valid. |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
my $key=$foo->getKey( $key ); |
|
246
|
|
|
|
|
|
|
if( $foo->error ){ |
|
247
|
|
|
|
|
|
|
warn('error:'.$foo->error.': '.$foo->errorString); |
|
248
|
|
|
|
|
|
|
} |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=cut |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
sub getKey{ |
|
253
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
254
|
0
|
|
|
|
|
|
my $key=$_[1]; |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
#try to blank the previous error |
|
257
|
0
|
0
|
|
|
|
|
if( ! $self->errorblank ){ |
|
258
|
0
|
|
|
|
|
|
return undef; |
|
259
|
|
|
|
|
|
|
} |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
#make sure we have a key |
|
262
|
0
|
0
|
|
|
|
|
if(!defined( $key )){ |
|
263
|
0
|
|
|
|
|
|
$self->{error}=3; |
|
264
|
0
|
|
|
|
|
|
$self->{errorString}='No key specified'; |
|
265
|
0
|
|
|
|
|
|
return undef; |
|
266
|
|
|
|
|
|
|
} |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
#make sure it is a valid key |
|
269
|
0
|
0
|
|
|
|
|
if(!defiend( $self->{valid}{$key} )){ |
|
270
|
0
|
|
|
|
|
|
$self->{error}=2; |
|
271
|
0
|
|
|
|
|
|
$self->{errorString}='"'.$key.'" is not a valid key'; |
|
272
|
0
|
|
|
|
|
|
return undef; |
|
273
|
|
|
|
|
|
|
} |
|
274
|
|
|
|
|
|
|
|
|
275
|
0
|
|
|
|
|
|
return $self->{key}; |
|
276
|
|
|
|
|
|
|
} |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head2 listKeys |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
This returns a list of defined keys. |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
No arguments are taken. |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
As long as the new method suceeded, this |
|
285
|
|
|
|
|
|
|
method will not error. |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
my %APkeys=$foo->listKeys; |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=cut |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
sub listKeys{ |
|
292
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
#try to blank the previous error |
|
295
|
0
|
0
|
|
|
|
|
if( ! $self->errorblank ){ |
|
296
|
0
|
|
|
|
|
|
return undef; |
|
297
|
|
|
|
|
|
|
} |
|
298
|
|
|
|
|
|
|
|
|
299
|
0
|
|
|
|
|
|
my %toreturn; |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
#check for defined keys |
|
302
|
0
|
|
|
|
|
|
my @keys=keys( %{ $self->{valid} } ); |
|
|
0
|
|
|
|
|
|
|
|
303
|
0
|
|
|
|
|
|
my $int=0; |
|
304
|
0
|
|
|
|
|
|
while( defined( $keys[$int] ) ){ |
|
305
|
0
|
0
|
|
|
|
|
if( defined( $self->{$keys[$int]} ) ){ |
|
306
|
0
|
|
|
|
|
|
$toreturn{$keys[$int]}=$self->{$keys[$int]}; |
|
307
|
|
|
|
|
|
|
} |
|
308
|
|
|
|
|
|
|
|
|
309
|
0
|
|
|
|
|
|
$int++; |
|
310
|
|
|
|
|
|
|
} |
|
311
|
|
|
|
|
|
|
|
|
312
|
0
|
|
|
|
|
|
return %toreturn; |
|
313
|
|
|
|
|
|
|
} |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=head2 listValidKeys |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
This list the valid key possibilities. |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
The returned value is a array. |
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
my @validKeys=$foo->listValidKeys; |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=cut |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
sub listValidKeys{ |
|
326
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
#try to blank the previous error |
|
329
|
0
|
0
|
|
|
|
|
if( ! $self->errorblank ){ |
|
330
|
0
|
|
|
|
|
|
return undef; |
|
331
|
|
|
|
|
|
|
} |
|
332
|
|
|
|
|
|
|
|
|
333
|
0
|
|
|
|
|
|
return keys( %{ $self->{valid} } ); |
|
|
0
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
} |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=head2 listWPAkeys |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
This is very similar to listValidKeys, but it does not include |
|
339
|
|
|
|
|
|
|
'networkID', which represents the WPA supplicant network ID in |
|
340
|
|
|
|
|
|
|
the config file, but is not a valid key in the the config. |
|
341
|
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
my @WPAkeys=$foo->listWPAkeys; |
|
343
|
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
=cut |
|
345
|
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
sub listWPAkeys{ |
|
347
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
#try to blank the previous error |
|
350
|
0
|
0
|
|
|
|
|
if( ! $self->errorblank ){ |
|
351
|
0
|
|
|
|
|
|
return undef; |
|
352
|
|
|
|
|
|
|
} |
|
353
|
|
|
|
|
|
|
|
|
354
|
0
|
|
|
|
|
|
return keys( %{ $self->{wpaKeys} } ); |
|
|
0
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
} |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=head2 setKey |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
This sets a key value. |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
Two values are taken. The first is the key and is required. The |
|
362
|
|
|
|
|
|
|
second is the key value, which may be undefined. |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
No error checking is required as long as the the key is valid. No |
|
365
|
|
|
|
|
|
|
value verification is done at this time. |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
$foo->setKey( $key, $value ); |
|
368
|
|
|
|
|
|
|
if( $foo->error ){ |
|
369
|
|
|
|
|
|
|
warn('error:'.$foo->error.': '.$foo->errorString); |
|
370
|
|
|
|
|
|
|
} |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
=cut |
|
373
|
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
sub setKey{ |
|
375
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
376
|
0
|
|
|
|
|
|
my $key=$_[1]; |
|
377
|
0
|
|
|
|
|
|
my $value=$_[2]; |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
#try to blank the previous error |
|
380
|
0
|
0
|
|
|
|
|
if( ! $self->errorblank ){ |
|
381
|
0
|
|
|
|
|
|
return undef; |
|
382
|
|
|
|
|
|
|
} |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
#make sure we have a key |
|
385
|
0
|
0
|
|
|
|
|
if(!defined( $key )){ |
|
386
|
0
|
|
|
|
|
|
$self->{error}=3; |
|
387
|
0
|
|
|
|
|
|
$self->{errorString}='No key specified'; |
|
388
|
0
|
|
|
|
|
|
return undef; |
|
389
|
|
|
|
|
|
|
} |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
#make sure it is a valid key |
|
392
|
0
|
0
|
|
|
|
|
if(!defined( $self->{valid}{$key} )){ |
|
393
|
0
|
|
|
|
|
|
$self->{error}=2; |
|
394
|
0
|
|
|
|
|
|
$self->{errorString}='"'.$key.'" is not a valid key'; |
|
395
|
0
|
|
|
|
|
|
return undef; |
|
396
|
|
|
|
|
|
|
} |
|
397
|
|
|
|
|
|
|
|
|
398
|
0
|
|
|
|
|
|
$self->{$key}=$value; |
|
399
|
|
|
|
|
|
|
|
|
400
|
0
|
|
|
|
|
|
return 1; |
|
401
|
|
|
|
|
|
|
} |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
=head1 ERROR CODES |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=head2 1 |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
No SSID specified. |
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
=head2 2 |
|
410
|
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
Invalid key. |
|
412
|
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
=head2 3 |
|
414
|
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
No key specified. |
|
416
|
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
=head1 AUTHOR |
|
418
|
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
Zane C. Bowers-Hadley, C<< >> |
|
420
|
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
=head1 BUGS |
|
422
|
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
424
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
425
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
426
|
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
=head1 SUPPORT |
|
431
|
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
perldoc Net::Wireless::802_11::AP |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
You can also look for information at: |
|
438
|
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=over 4 |
|
440
|
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
442
|
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
L |
|
444
|
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
L |
|
448
|
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
450
|
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
L |
|
452
|
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
=item * Search CPAN |
|
454
|
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
L |
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
=back |
|
458
|
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
461
|
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
464
|
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
Copyright 2011 Zane C. Bowers-Hadley. |
|
466
|
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
468
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
469
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
470
|
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
=cut |
|
475
|
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
1; # End of Net::Wireless::802_11::AP |