| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SNMP::NPAdmin; |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# prerequisites: |
|
4
|
|
|
|
|
|
|
# UCD SNMP v4.2.0 |
|
5
|
|
|
|
|
|
|
# SNMP module v4.2.0 |
|
6
|
|
|
|
|
|
|
# Printer MIB and HP MIB (provided) |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# assumptions |
|
9
|
|
|
|
|
|
|
# 1. only SNMPv1 will be supported initially |
|
10
|
|
|
|
|
|
|
# 2. only mib-2 and printmib will be supported initially |
|
11
|
|
|
|
|
|
|
# 3. SNMPv2 support will be added later |
|
12
|
|
|
|
|
|
|
# 4. private mib support will be added after printmib support is complete |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# a. incorporated an HP JETDIRECT MIB that I found |
|
15
|
|
|
|
|
|
|
# |
|
16
|
|
|
|
|
|
|
# types of queries |
|
17
|
|
|
|
|
|
|
# boolean |
|
18
|
|
|
|
|
|
|
# max/min |
|
19
|
|
|
|
|
|
|
# data, list format, i.e. a hash |
|
20
|
|
|
|
|
|
|
# data, table format, i.e. a list of hashes |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
require 5.005_03; |
|
23
|
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
9921
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
62
|
|
|
25
|
1
|
|
|
|
|
211
|
use vars qw/ $VERSION $CVSver @ISA $AUTOLOAD |
|
26
|
|
|
|
|
|
|
$DEBUG |
|
27
|
|
|
|
|
|
|
$VERBOSE |
|
28
|
|
|
|
|
|
|
%vendors |
|
29
|
|
|
|
|
|
|
%language_map |
|
30
|
|
|
|
|
|
|
$language_code |
|
31
|
|
|
|
|
|
|
%filter_map |
|
32
|
|
|
|
|
|
|
$filter_code |
|
33
|
|
|
|
|
|
|
%answer_map |
|
34
|
|
|
|
|
|
|
@paper_sizes |
|
35
|
|
|
|
|
|
|
$paper_sizes_indexed |
|
36
|
|
|
|
|
|
|
$answer_code |
|
37
|
1
|
|
|
1
|
|
6
|
/; |
|
|
1
|
|
|
|
|
2
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$VERSION = '1.0'; |
|
40
|
|
|
|
|
|
|
$CVSver= '$Id: NPAdmin.pm,v 1.23 2002/11/15 03:57:23 bozzio Exp $'; |
|
41
|
|
|
|
|
|
|
|
|
42
|
1
|
|
|
1
|
|
695
|
use SNMP::NPAdmin::Neon; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
##################################### PODs |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=pod |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
SNMP::NPAdmin - high-level API to query printers via SNMP |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# object-oriented |
|
55
|
|
|
|
|
|
|
$p= SNMP::NPAdmin->new( |
|
56
|
|
|
|
|
|
|
printer => 'porky', |
|
57
|
|
|
|
|
|
|
community => 'corpslp' |
|
58
|
|
|
|
|
|
|
); |
|
59
|
|
|
|
|
|
|
printf "Your printer, %s, does%s support PCL.\n", |
|
60
|
|
|
|
|
|
|
$printer, ( $p->pcl() ? "" : " not"); |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# procedural |
|
63
|
|
|
|
|
|
|
$p= npa_connect( |
|
64
|
|
|
|
|
|
|
printer => 'porky', |
|
65
|
|
|
|
|
|
|
community => 'corpslp' |
|
66
|
|
|
|
|
|
|
); |
|
67
|
|
|
|
|
|
|
printf "Your printer, %s, does%s support PCL.\n", |
|
68
|
|
|
|
|
|
|
$printer, ( npa_pcl( $p) ? "" : " not"); |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
The C package is a complete port of a SNMP/printer utility called C that provides a high-level interface to query printers via SNMP |
|
73
|
|
|
|
|
|
|
without specific knowledge of SNMP MIBs or the printer's vendor-specific configuration. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
The original C was written in C++ by Ben Woodard who continues to maintain it on SourceForge. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
The primary objective in this port is to have a B and B version of the same functionality that the original C provides. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
It is B optimized for performance at all; it is optimized for B and B. |
|
80
|
|
|
|
|
|
|
The original C is very much extremely performance, the idea being to query many printers very quickly, especially since SNMP can be quite slow. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
To be fair, C might even be slow by Perl standards due to the extensive use of run-time compilation through the AUTOLOAD subroutine. |
|
83
|
|
|
|
|
|
|
I don't necessarily believe this since a programmer/sys-admin frequently will not use all of the available methods/subroutines which would typically |
|
84
|
|
|
|
|
|
|
be compiled during startup; given that only a few methods/subroutines will be called, then only a few will be compiled during the process's lifetime. |
|
85
|
|
|
|
|
|
|
Probably the difference in speed due to this will be insignificant either way. |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
The design was chosen in order to get as much information into a maintainable table format and make the logic as generic as possible; not for speed. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
So this is your choice. If you have some unsupported printers and you want to be able to modify the code to support them then use C. |
|
90
|
|
|
|
|
|
|
If you need to support B of printers continuously with this kind of utility then you should use Ben Woodard's C. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 THE PACKAGE |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
The C package is composed of a module, C, and a script, C. |
|
95
|
|
|
|
|
|
|
The heart of this package is the C module. |
|
96
|
|
|
|
|
|
|
Everything happens in the module. |
|
97
|
|
|
|
|
|
|
All that the script does is parse command-line arguments, call the C module and report the results. |
|
98
|
|
|
|
|
|
|
Actually, two modules are provided; but only one is publicly available. |
|
99
|
|
|
|
|
|
|
I will not even tell you its name; you can find it yourself if you're so curious. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
The script is provide for two reasons. |
|
102
|
|
|
|
|
|
|
The first is to fulfill the original objective of writing a Perl-version of C which is a command-line utility. |
|
103
|
|
|
|
|
|
|
The second is to provide an example script. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 THE INTERFACE: OBJECT-ORIENTED OR PROCEDURAL? BOTH! |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
While writing this module, I received a lot a negative feedback about using OO techniques. |
|
108
|
|
|
|
|
|
|
Therefore I decided to ensure that it could be used by using both OO and procedural techniques. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
It is probably true that most modules/classes are similarly Janus-faced since Perl always passes the object-reference (or class name) as the first argument. |
|
111
|
|
|
|
|
|
|
That is not so different from the way many procedural libraries work, particularly those that establish some kind of state such as network connections: |
|
112
|
|
|
|
|
|
|
initiate a connection and pass the returned struct to future library calls as the first argument. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
B B B B B |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
The procedural API is not been fully implemented yet. But it is the current task and should be complete soon. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
##################################### class method POD: new |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=pod |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 CLASS METHODS |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 THE CONSTRUCTOR |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=over 4 |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item Bnew()>> |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This is the constructor (duh!). It returns an C object which can then be queried with the object methods that are described below. |
|
133
|
|
|
|
|
|
|
For arguments, a hash is used which can include values for five keys: C, C, C, C and C. The C |
|
134
|
|
|
|
|
|
|
key is required; the constructor B fail without it. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
$P= SNMP::NPAdmin->new( |
|
137
|
|
|
|
|
|
|
printer => 'mega-print', |
|
138
|
|
|
|
|
|
|
community => 'myhouse', |
|
139
|
|
|
|
|
|
|
); |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item B> |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This is the procedural call to start a C session for a specific printer. It accepts the same arguments and returns the same results as |
|
144
|
|
|
|
|
|
|
the constructor. I didn't bother B blessing the reference just for a procedural call. It will still work when it is passed to the query subroutines. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
$P= npa_connect( |
|
147
|
|
|
|
|
|
|
printer => 'mega-print', |
|
148
|
|
|
|
|
|
|
community => 'myhouse', |
|
149
|
|
|
|
|
|
|
); |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=back |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
##################################### new |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub new |
|
158
|
|
|
|
|
|
|
{ |
|
159
|
|
|
|
|
|
|
#warn "new"; |
|
160
|
|
|
|
|
|
|
my $class= shift; |
|
161
|
|
|
|
|
|
|
my %options= @_; |
|
162
|
|
|
|
|
|
|
my $self; |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
$self->{boolean}= $options{boolean} |
|
165
|
|
|
|
|
|
|
? delete $options{boolean} |
|
166
|
|
|
|
|
|
|
: [ qw/ 0 1 / ] |
|
167
|
|
|
|
|
|
|
; |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
$self->{Neon}= SNMP::NPAdmin::Neon->new( @_); |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
return undef if ! $self->{Neon}; |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
bless $self, $class; |
|
174
|
|
|
|
|
|
|
return $self; |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
##################################### class method POD: version |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=pod |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=over 4 |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item Bversion()>> or B> |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
This method returns the version of SNMP::NPAdmin that is being used. |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=back |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=cut |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
##################################### version |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub version |
|
194
|
|
|
|
|
|
|
{ |
|
195
|
|
|
|
|
|
|
#warn "version"; |
|
196
|
|
|
|
|
|
|
return $VERSION; |
|
197
|
|
|
|
|
|
|
} |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
##################################### class method POD: verbose |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=pod |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=over 4 |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=item Bverbose()>> or B> |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
This method toggles the 'verbose' flag for the entire class. |
|
208
|
|
|
|
|
|
|
All objects will verbosely report its progress during execution of any methods. |
|
209
|
|
|
|
|
|
|
The previous value of the 'verbose' flag is returned. |
|
210
|
|
|
|
|
|
|
Currently, the 'verbose' flag is ineffectual. |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=back |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=cut |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
##################################### verbose |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub verbose |
|
219
|
|
|
|
|
|
|
{ |
|
220
|
|
|
|
|
|
|
#warn "verbose"; |
|
221
|
|
|
|
|
|
|
my $class= shift; |
|
222
|
|
|
|
|
|
|
my $value= shift; |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
if ( defined $value ) |
|
225
|
|
|
|
|
|
|
{ |
|
226
|
|
|
|
|
|
|
$VERBOSE= $value; |
|
227
|
|
|
|
|
|
|
} |
|
228
|
|
|
|
|
|
|
else |
|
229
|
|
|
|
|
|
|
{ |
|
230
|
|
|
|
|
|
|
$VERBOSE |= 1; |
|
231
|
|
|
|
|
|
|
} |
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
##################################### class method POD: debug |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=pod |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=over 4 |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=item Bdebug()>> or B> |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
This method toggles the 'debug' flag for the entire class. |
|
243
|
|
|
|
|
|
|
All objects will report in painful detail everything that is happening during a SNMP::NPAdmin method call. |
|
244
|
|
|
|
|
|
|
The previous value of the 'debug' flag is returned. |
|
245
|
|
|
|
|
|
|
Currently, the 'debug' flag is ineffectual. |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=back |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=cut |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
##################################### debug |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
sub debug |
|
254
|
|
|
|
|
|
|
{ |
|
255
|
|
|
|
|
|
|
#warn "debug"; |
|
256
|
|
|
|
|
|
|
my $class= shift; |
|
257
|
|
|
|
|
|
|
my $value= shift; |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
if ( defined $value ) |
|
260
|
|
|
|
|
|
|
{ |
|
261
|
|
|
|
|
|
|
$DEBUG= $value; |
|
262
|
|
|
|
|
|
|
} |
|
263
|
|
|
|
|
|
|
else |
|
264
|
|
|
|
|
|
|
{ |
|
265
|
|
|
|
|
|
|
$DEBUG |= 1; |
|
266
|
|
|
|
|
|
|
} |
|
267
|
|
|
|
|
|
|
} |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
##################################### class method POD: debugsnmp |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=pod |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=over 4 |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=item Bdebugsnmp()>> or B> |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
This method toggles the 'debugsnmp' flag for all objects/sessions. |
|
278
|
|
|
|
|
|
|
All objects will report in excruciating detail everything that happens during all actual SNMP transactions. |
|
279
|
|
|
|
|
|
|
This flag is actually used by the underlying SNMP module. It does work and very well. |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=back |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=cut |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
##################################### debugsnmp |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
*debugsnmp= *SNMP::NPAdmin::Neon::debugsnmp; |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
##################################### DESTROY |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
sub DESTROY {}; |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
##################################### object PODs |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=pod |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=head1 OBJECT METHODS |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=head2 MIB queries |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
The MIB queries determine whether or not the queried printer supports the MIB in question. |
|
302
|
|
|
|
|
|
|
Currently, SNMP::NPAdmin only asks about the Printer-MIB and the Host-Resources-MIB. |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
=over 4 |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=item Bprintmib()>> or B> |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
Answers the question, "Does the printer support the Printer-MIB?" |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
=item Bhostmib()>> or B> |
|
311
|
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
Answers the question, "Does the printer support the Host-Resources-MIB?" |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
=back |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=over 4 |
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
=head2 Information queries |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
The information queries provide information that requires additional processing in addition to merely querying the printer for data. |
|
321
|
|
|
|
|
|
|
For most of these, this does involve simply querying the printer and reporting the results. |
|
322
|
|
|
|
|
|
|
The ones that do require this kind of heuristics are C, C, C, C, C, C. |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=item Bcontact()>> or B> |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
Retrieves contact and location information as contained in C and C. |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=item Bvendor()>> or B> |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
Attempts to determine the vendor/manufacturer of the printer. |
|
331
|
|
|
|
|
|
|
Currently, only a few vendors can be reliably detected: HP, Tektronix, Lexmark, IBM, Xerox, EFI, Fuji and QMS. |
|
332
|
|
|
|
|
|
|
If a device can be determined to not be a printer then 'not_a_printer' is returned. |
|
333
|
|
|
|
|
|
|
If the vendor cannot be determined then 'unknown is returned. |
|
334
|
|
|
|
|
|
|
If you are able to determine an unsupported vendor then please send the information to me (see below). |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=item Bmodel()>> or B> |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
Attempts to determine the model of the printer. |
|
339
|
|
|
|
|
|
|
The vendor is determined as the first step. So, this will only work for printers that are supported |
|
340
|
|
|
|
|
|
|
by the vendor() method. Even then, the module only guarantees its best-effort. |
|
341
|
|
|
|
|
|
|
If you are able to determine an unsupported model then please send the information to me (see below). |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=item Bcfgsrc()>> or B> |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
The configuration source or method is determined as given by the HP private MIB OID |
|
346
|
|
|
|
|
|
|
C<.iso.org.dod.internet.private.enterprises.hp.nm.interface.npCard.npCfg.npCfgSource>. |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
=item Bstatus()>> or B> |
|
349
|
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
Attempts to determine the status of the printer from the Host-Resources-MID OID C. |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
=item Bmemory()>> or B> |
|
353
|
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
Attempts to determine the amount memory in the printer from the Host-Resources-MID OID C. |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
=item Bnetconfig()>> or B> |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
Attempts to determine the network configuration of the printer from these MIB-2 OIDs: C, C, C, C. |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
=item Bpagecount()>> or B> |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
Attempts to number of pages printed by the printer from the Printer-MIB OIDs C and C. |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
=item Bcolors()>> or B> |
|
365
|
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
Attempts to determine the number of colors supported by the printer from the Printer-MIB OID C. |
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
=item Bresolution()>> or B> |
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
This returns the values for the Printer-MIB OIDs C and C. |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
??? I am not sure what they mean. |
|
373
|
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
=item Bminmargin()>> or B> |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
This really should be just C since it is determined from the C and most printers in use only have one marker. |
|
377
|
|
|
|
|
|
|
Nonetheless, this merely returns the margins for all of the markers in the printer from the Printer-MIB OIDs C, |
|
378
|
|
|
|
|
|
|
C, C and C. |
|
379
|
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
=item Benginespeed()>> or B> |
|
381
|
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
Determines the maximum speed that one of the media-paths provides from the Printer-MIB OID C. |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
=item Bmaxpapersize()>> or B> |
|
385
|
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
Determines the largest paper-size that is supported by the printer. |
|
387
|
|
|
|
|
|
|
This does not reflect the largest size paper that is actually in the printer. |
|
388
|
|
|
|
|
|
|
By "largest" and "max", we mean the paper-size with the most area, as determined from the Printer-MIB OIDs C and |
|
389
|
|
|
|
|
|
|
C. |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=item Bminpapersize()>> or B> |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
Determines the smallest paper-size that is supported by the printer. |
|
394
|
|
|
|
|
|
|
This does not reflect the smallest size paper that is actually in the printer. |
|
395
|
|
|
|
|
|
|
By "smallest" and "min", we mean the paper-size with the least area, as determined from the Printer-MIB OIDs C and |
|
396
|
|
|
|
|
|
|
C. |
|
397
|
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
=back |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
=over 4 |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
=head2 SNMP table queries |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
The next set of queries merely return the contents of the Printer-MIB tables. |
|
406
|
|
|
|
|
|
|
Just for brevity, I will only list the method/subroutine names and the respective table OIDs. |
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
=item Bdisplay()>> or B> |
|
409
|
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
printmib.prtConsoleDisplayBuffer.prtConsoleDisplayBufferTable |
|
411
|
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=item Blanguages()>> or B> |
|
413
|
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
printmib.prtInterpreter.prtInterpreterTable |
|
415
|
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=item Bcovers()>> or B> |
|
417
|
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
printmib.prtCover.prtCoverTable |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
=item Binputtray()>> or B> |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
printmib.prtInput.prtInputTable |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
=item Bmarker()>> or B> |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
printmib.prtMarker.prtMarkerTable |
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
=item Bprotocol()>> or B> |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
printmib.prtChannel.prtChannelTable |
|
431
|
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
=item Bsupplies()>> or B> |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
printmib.prtMarkerSupplies.prtMarkerSuppliesTable |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
=item Bmediapath()>> or B> |
|
437
|
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
printmib.prtMediaPath.prtMediaPathTable |
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
=item Balerts()>> or B> |
|
441
|
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
printmib.prtAlert.prtAlertTable |
|
443
|
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
=back |
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
=over 4 |
|
448
|
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=head2 Truth queries |
|
450
|
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
The truth queries answer a "Yes or No" question about the capabilities of the printer. |
|
452
|
|
|
|
|
|
|
The questions fall into one of several categories: languages (prtInterpreter), paper-size (prtMediaPath) or protocol (prtChannel). |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=item Bpjl()>> or B> |
|
455
|
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
supports PJL printer language? |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
=item Bpcl()>> or B> |
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
supports PCL printer language? |
|
461
|
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
=item Bhpgl()>> or B> |
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
supports HPGL printer language? |
|
465
|
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
=item Bpsprint()>> or B> |
|
467
|
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
supports PSPRINT printer language? |
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
=item Bpostscript()>> or B> |
|
471
|
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
supports Postscript printer language? |
|
473
|
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
=item Bautolang()>> or B> |
|
475
|
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
automatically selects the appropriate language? |
|
477
|
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
=item Bduplex()>> or B> |
|
479
|
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
supports duplex printing? |
|
481
|
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
=item Bletter()>> or B> |
|
483
|
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
supports letter papersize? |
|
485
|
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
=item Blegal()>> or B> |
|
487
|
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
supports legal papersize? |
|
489
|
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
=item Bexecutive()>> or B> |
|
491
|
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
supports executive papersize? |
|
493
|
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
=item Btabloid()>> or B> |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
supports tabloid papersize? |
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
=item Ba3()>> or B> |
|
499
|
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
supports a3 papersize? |
|
501
|
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
=item Ba4()>> or B> |
|
503
|
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
supports a4 papersize? |
|
505
|
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
=item Bb3()>> or B> |
|
507
|
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
supports b4 papersize? |
|
509
|
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
=item Bb5()>> or B> |
|
511
|
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
supports b5 papersize? |
|
513
|
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
=item Bappletalk()>> or B> |
|
515
|
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
supports Appletalk protocol? |
|
517
|
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
=item Blpd()>> or B> |
|
519
|
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
supports LPD protocol? |
|
521
|
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
=item Bnetware()>> or B> |
|
523
|
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
supports Netware protocol? |
|
525
|
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
=item Bport9100()>> or B> |
|
527
|
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
supports port 9100 bidirectional connections? |
|
529
|
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
=over |
|
531
|
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
=cut |
|
533
|
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
##################################### vendor |
|
535
|
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
use constant Xerox230_1 => '131;C1H011131;'; |
|
537
|
|
|
|
|
|
|
use constant Xerox230_2 => ';C1H017730;'; |
|
538
|
|
|
|
|
|
|
use constant Xerox265 => '3UP060485'; |
|
539
|
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
%vendors= ( |
|
541
|
|
|
|
|
|
|
HP => qr/JETDIRECT/o, |
|
542
|
|
|
|
|
|
|
Lexmark => qr/Lexmark/o, |
|
543
|
|
|
|
|
|
|
Tektronix => qr/Tektronix/o, |
|
544
|
|
|
|
|
|
|
Xerox => qr/ Xerox | @{[Xerox230_1]} | @{[Xerox230_2]} | @{[Xerox265]} /ox, |
|
545
|
|
|
|
|
|
|
QMS => qr/qms/o, |
|
546
|
|
|
|
|
|
|
IBM => qr/IBM/o, |
|
547
|
|
|
|
|
|
|
EFI => qr/EFI FieryColor Printer Server|EFI Fiery Server ZX/o, |
|
548
|
|
|
|
|
|
|
Fuji => qr/Able Model-PRII/o, |
|
549
|
|
|
|
|
|
|
not_a_printer => qr/HP-UX|HPUX|Windows NT|Sun SNMP Agent|SunOS|Macintosh|UNIX/o, |
|
550
|
|
|
|
|
|
|
); |
|
551
|
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
sub vendor |
|
553
|
|
|
|
|
|
|
{ |
|
554
|
|
|
|
|
|
|
#warn "vendor"; |
|
555
|
|
|
|
|
|
|
my $self= shift; |
|
556
|
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
my $x; |
|
558
|
|
|
|
|
|
|
$x= $self->{Neon}->mib2_system(); |
|
559
|
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
while ( my( $k, $v)= each %vendors ) |
|
561
|
|
|
|
|
|
|
{ |
|
562
|
|
|
|
|
|
|
if ( $x->{sysDescr} =~ $v ) |
|
563
|
|
|
|
|
|
|
{ |
|
564
|
|
|
|
|
|
|
$self->{vendor}= $k; |
|
565
|
|
|
|
|
|
|
last; |
|
566
|
|
|
|
|
|
|
} |
|
567
|
|
|
|
|
|
|
$self->{vendor} |= 'unknown'; |
|
568
|
|
|
|
|
|
|
} |
|
569
|
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
return { vendor => $self->{vendor} }; |
|
571
|
|
|
|
|
|
|
} |
|
572
|
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
##################################### model |
|
574
|
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
sub model |
|
576
|
|
|
|
|
|
|
{ |
|
577
|
|
|
|
|
|
|
#warn "model"; |
|
578
|
|
|
|
|
|
|
my $self= shift; |
|
579
|
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
for ( $self->vendor()->{vendor} ) |
|
581
|
|
|
|
|
|
|
{ |
|
582
|
|
|
|
|
|
|
/^EFI$/ && do { |
|
583
|
|
|
|
|
|
|
last; |
|
584
|
|
|
|
|
|
|
}; |
|
585
|
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
/^Fuji$/ && do { |
|
587
|
|
|
|
|
|
|
$self->{model}= 'Able PRII'; |
|
588
|
|
|
|
|
|
|
last; |
|
589
|
|
|
|
|
|
|
}; |
|
590
|
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
/^HP$/ && do { |
|
592
|
|
|
|
|
|
|
my $str= $self->{Neon}->hp_gdStatusId()->{gdStatusId}; |
|
593
|
|
|
|
|
|
|
$self->{model}= ( $str =~ /;(?:MODEL|MDL):\s*(.+?)\s*;/ )[0]; |
|
594
|
|
|
|
|
|
|
last; |
|
595
|
|
|
|
|
|
|
}; |
|
596
|
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
/^Lexmark$/ && do { |
|
598
|
|
|
|
|
|
|
my $x; |
|
599
|
|
|
|
|
|
|
$x= $self->{Neon}->mib2_system()->{sysDescr}; |
|
600
|
|
|
|
|
|
|
$self->{model}= ( $x =~ /Lexmark\s+(.+?) / )[0]; |
|
601
|
|
|
|
|
|
|
last; |
|
602
|
|
|
|
|
|
|
}; |
|
603
|
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
/^Xerox$/ && do { |
|
605
|
|
|
|
|
|
|
my( $x, $y); |
|
606
|
|
|
|
|
|
|
$x= $self->{Neon}->mib2_system()->{sysDescr}; |
|
607
|
|
|
|
|
|
|
if ( $x =~ /[?]{3}/ ) |
|
608
|
|
|
|
|
|
|
{ |
|
609
|
|
|
|
|
|
|
; |
|
610
|
|
|
|
|
|
|
} |
|
611
|
|
|
|
|
|
|
elsif ( $x =~ / @{[Xerox230_1]} | @{[Xerox230_2]} /ox ) |
|
612
|
|
|
|
|
|
|
{ |
|
613
|
|
|
|
|
|
|
$self->{model}= 'Document Centre 230ST'; |
|
614
|
|
|
|
|
|
|
} |
|
615
|
|
|
|
|
|
|
elsif ( $x =~ / @{[Xerox265]} /ox ) |
|
616
|
|
|
|
|
|
|
{ |
|
617
|
|
|
|
|
|
|
$self->{model}= 'Document Centre 265'; |
|
618
|
|
|
|
|
|
|
} |
|
619
|
|
|
|
|
|
|
else |
|
620
|
|
|
|
|
|
|
{ |
|
621
|
|
|
|
|
|
|
$x =~ /\s*(?:(.+?),|(.+))/; |
|
622
|
|
|
|
|
|
|
$self->{model}= $1 || $2; |
|
623
|
|
|
|
|
|
|
} |
|
624
|
|
|
|
|
|
|
last; |
|
625
|
|
|
|
|
|
|
} |
|
626
|
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
# /^IBM$/ && do { }; |
|
628
|
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
# /^QMS$/ && do { }; |
|
630
|
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
# /^Tektronix$/ && do { }; |
|
632
|
|
|
|
|
|
|
} |
|
633
|
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
return { model => $self->{model} }; |
|
635
|
|
|
|
|
|
|
} |
|
636
|
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
##################################### final PODs |
|
638
|
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
=pod |
|
640
|
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
=head1 AUTHOR |
|
642
|
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
Robert Lehr, bozzio@the-lehrs.com |
|
644
|
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
I certainly would appreciate any feedback from people that use it, including complaints, suggestions or patches. |
|
646
|
|
|
|
|
|
|
Even people that don't use it are welcome to send comments. |
|
647
|
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
649
|
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
Copyright (c) 2001 Robert Lehr. All rights reserved. This program is free software; you can redistribute it and/or |
|
651
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
|
652
|
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
Caveat emptor. Use this module at your own risk. I will accept no responsibility for any loss of any kind |
|
654
|
|
|
|
|
|
|
that is the direct or indirect result of the use of this module. |
|
655
|
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
657
|
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
the SNMP module v3.1.0; the UCD SNMP library v4.2.0 at http://www.net-snmp.org/; RFC 1759 - The Printer MIB |
|
659
|
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
=cut |
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
##################################### _check_paper_size |
|
663
|
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
use constant Name => 0; |
|
665
|
|
|
|
|
|
|
use constant Units => 1; |
|
666
|
|
|
|
|
|
|
use constant DimA => 2; |
|
667
|
|
|
|
|
|
|
use constant DimB => 3; |
|
668
|
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
use constant null => 'null'; |
|
670
|
|
|
|
|
|
|
use constant tenThousandthsOfInches => 'tenThousandthsOfInches'; |
|
671
|
|
|
|
|
|
|
use constant micrometers => 'micrometers'; |
|
672
|
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
@paper_sizes= ( |
|
674
|
|
|
|
|
|
|
[ 'other', null, -1, -1 ], |
|
675
|
|
|
|
|
|
|
[ 'unknown', null, -2, -2 ], |
|
676
|
|
|
|
|
|
|
[ 'letter', tenThousandthsOfInches, 85000, 110000 ], |
|
677
|
|
|
|
|
|
|
[ 'letter', micrometers, 215900, 279400 ], #bw# |
|
678
|
|
|
|
|
|
|
[ 'legal', tenThousandthsOfInches, 85000, 140000 ], |
|
679
|
|
|
|
|
|
|
[ 'legal', micrometers, 215900, 355600 ], #bw# |
|
680
|
|
|
|
|
|
|
[ 'tabloid', tenThousandthsOfInches, 110000, 170000 ], #bw# |
|
681
|
|
|
|
|
|
|
[ 'tabloid', micrometers, 279400, 431800 ], #bw# |
|
682
|
|
|
|
|
|
|
[ 'executive', tenThousandthsOfInches, 75000, 105000 ], #bw# |
|
683
|
|
|
|
|
|
|
[ 'executive', micrometers, 190500, 266700 ], #bw# |
|
684
|
|
|
|
|
|
|
[ 'a3', tenThousandthsOfInches, 109842, 165354 ], #bw# |
|
685
|
|
|
|
|
|
|
[ 'a3', micrometers, 297000, 420000 ], |
|
686
|
|
|
|
|
|
|
[ 'a4', tenThousandthsOfInches, 82677, 116929 ], #bw# |
|
687
|
|
|
|
|
|
|
[ 'a4', micrometers, 210000, 297000 ], |
|
688
|
|
|
|
|
|
|
[ 'b3', micrometers, 353000, 500000 ], |
|
689
|
|
|
|
|
|
|
[ 'b3', tenThousandthsOfInches, -1, -1 ], |
|
690
|
|
|
|
|
|
|
[ 'b5', micrometers, 176000, 250000 ], |
|
691
|
|
|
|
|
|
|
[ 'b5', tenThousandthsOfInches, -1, -1 ], |
|
692
|
|
|
|
|
|
|
); |
|
693
|
|
|
|
|
|
|
#bw# == Ben Woodard, extracted from npadmin, file=npaconsts.h |
|
694
|
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
map { |
|
696
|
|
|
|
|
|
|
$paper_sizes_indexed->{$_->[Name]}->{$_->[Units]}= [ undef, undef, $_->[DimA], $_->[DimB] ] |
|
697
|
|
|
|
|
|
|
} @paper_sizes; |
|
698
|
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
##################################### language_code (this points the question at the answer) |
|
700
|
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
use constant check_language => '_check_language'; |
|
702
|
|
|
|
|
|
|
use constant check_paper_size => '_check_paper_size'; |
|
703
|
|
|
|
|
|
|
use constant check_protocol => '_check_protocol'; |
|
704
|
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
%language_map= ( |
|
706
|
|
|
|
|
|
|
pcl => check_language, |
|
707
|
|
|
|
|
|
|
postscript => check_language, |
|
708
|
|
|
|
|
|
|
psprint => check_language, |
|
709
|
|
|
|
|
|
|
pjl => check_language, |
|
710
|
|
|
|
|
|
|
hpgl => check_language, |
|
711
|
|
|
|
|
|
|
autolang => check_language, |
|
712
|
|
|
|
|
|
|
legal => check_paper_size, |
|
713
|
|
|
|
|
|
|
letter => check_paper_size, |
|
714
|
|
|
|
|
|
|
b5 => check_paper_size, |
|
715
|
|
|
|
|
|
|
a3 => check_paper_size, |
|
716
|
|
|
|
|
|
|
executive => check_paper_size, |
|
717
|
|
|
|
|
|
|
b4 => check_paper_size, |
|
718
|
|
|
|
|
|
|
a4 => check_paper_size, |
|
719
|
|
|
|
|
|
|
tabloid => check_paper_size, |
|
720
|
|
|
|
|
|
|
port9100 => check_protocol, |
|
721
|
|
|
|
|
|
|
netware => check_protocol, |
|
722
|
|
|
|
|
|
|
lpd => check_protocol, |
|
723
|
|
|
|
|
|
|
appletalk => check_protocol, |
|
724
|
|
|
|
|
|
|
); |
|
725
|
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
$language_code= q[ |
|
727
|
|
|
|
|
|
|
sub ##SUBNAME## |
|
728
|
|
|
|
|
|
|
{ |
|
729
|
|
|
|
|
|
|
#warn '##SUBNAME##'; |
|
730
|
|
|
|
|
|
|
my $self= shift; |
|
731
|
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
return $self->##HANDLER##( '##SUBNAME##'); |
|
733
|
|
|
|
|
|
|
} |
|
734
|
|
|
|
|
|
|
]; |
|
735
|
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
##################################### filter_code (this fetches data and translates field names) |
|
737
|
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
%filter_map= ( |
|
739
|
|
|
|
|
|
|
status => [ |
|
740
|
|
|
|
|
|
|
'hrPrinterStatus', |
|
741
|
|
|
|
|
|
|
{ |
|
742
|
|
|
|
|
|
|
"hrPrinterStatus" => 'status', |
|
743
|
|
|
|
|
|
|
}], |
|
744
|
|
|
|
|
|
|
memory => [ |
|
745
|
|
|
|
|
|
|
'hrMemorySize', |
|
746
|
|
|
|
|
|
|
{ |
|
747
|
|
|
|
|
|
|
'hrMemorySize' => 'memsize', |
|
748
|
|
|
|
|
|
|
}], |
|
749
|
|
|
|
|
|
|
netconfig => [ |
|
750
|
|
|
|
|
|
|
'netconfig', |
|
751
|
|
|
|
|
|
|
{ |
|
752
|
|
|
|
|
|
|
'ipAdEntAddr' => 'ipaddr', |
|
753
|
|
|
|
|
|
|
'ifPhysAddress' => 'hwaddr', |
|
754
|
|
|
|
|
|
|
'ipRouteNextHop' => 'gateway', |
|
755
|
|
|
|
|
|
|
'ipAdEntNetMask' => 'netmask', |
|
756
|
|
|
|
|
|
|
}], |
|
757
|
|
|
|
|
|
|
cfgsrc => [ |
|
758
|
|
|
|
|
|
|
'hp_npCfgSource', |
|
759
|
|
|
|
|
|
|
{ |
|
760
|
|
|
|
|
|
|
'npCfgSource' => 'cfgsrc', |
|
761
|
|
|
|
|
|
|
}], |
|
762
|
|
|
|
|
|
|
storage => [ |
|
763
|
|
|
|
|
|
|
'hrStorage', |
|
764
|
|
|
|
|
|
|
{ |
|
765
|
|
|
|
|
|
|
'hrStorageDescr' => 'descr', |
|
766
|
|
|
|
|
|
|
'hrStorageSize' => 'size', |
|
767
|
|
|
|
|
|
|
'hrStorageUsed' => 'used', |
|
768
|
|
|
|
|
|
|
'hrStorageAllocationUnits' => 'allocunits', |
|
769
|
|
|
|
|
|
|
'hrStorageAllocationFailures' => 'allocfail', |
|
770
|
|
|
|
|
|
|
}], |
|
771
|
|
|
|
|
|
|
display => [ |
|
772
|
|
|
|
|
|
|
'prtConsoleDisplayBuffer', |
|
773
|
|
|
|
|
|
|
{ |
|
774
|
|
|
|
|
|
|
'prtConsoleDisplayBufferText' => 'displayBufferText', |
|
775
|
|
|
|
|
|
|
}], |
|
776
|
|
|
|
|
|
|
languages => [ |
|
777
|
|
|
|
|
|
|
'prtInterpreter', |
|
778
|
|
|
|
|
|
|
{ |
|
779
|
|
|
|
|
|
|
'prtInterpreterLangFamily' => 'langFamily', |
|
780
|
|
|
|
|
|
|
'prtInterpreterLangLevel' => 'langLevel', |
|
781
|
|
|
|
|
|
|
'prtInterpreterLangVersion' => 'langVersion', |
|
782
|
|
|
|
|
|
|
'prtInterpreterDescription' => 'description', |
|
783
|
|
|
|
|
|
|
'prtInterpreterVersion' => 'version', |
|
784
|
|
|
|
|
|
|
'prtInterpreterDefaultOrientation' => 'orientation', |
|
785
|
|
|
|
|
|
|
'prtInterpreterFeedAddressability' => 'feedAddressability', |
|
786
|
|
|
|
|
|
|
'prtInterpreterXFeedAddressability' => 'xFeedAddressability', |
|
787
|
|
|
|
|
|
|
'prtInterpreterTwoWay' => 'twoWay', |
|
788
|
|
|
|
|
|
|
}], |
|
789
|
|
|
|
|
|
|
protocol => [ |
|
790
|
|
|
|
|
|
|
'prtChannel', |
|
791
|
|
|
|
|
|
|
{ |
|
792
|
|
|
|
|
|
|
'prtChannelType' => 'type', |
|
793
|
|
|
|
|
|
|
'prtChannelProtocolVersion' => 'version', |
|
794
|
|
|
|
|
|
|
'prtChannelState' => 'state', |
|
795
|
|
|
|
|
|
|
'prtChannelStatus' => 'status', |
|
796
|
|
|
|
|
|
|
'prtChannelDefaultPageDescLangIndex' => 'defaultPageDescLang', |
|
797
|
|
|
|
|
|
|
'prtChannelCurrentJobCntlDescLangIndex' => 'currentJobControlLang', |
|
798
|
|
|
|
|
|
|
}], |
|
799
|
|
|
|
|
|
|
covers => [ |
|
800
|
|
|
|
|
|
|
'prtCover', |
|
801
|
|
|
|
|
|
|
{ |
|
802
|
|
|
|
|
|
|
'prtCoverDescription' => 'description', |
|
803
|
|
|
|
|
|
|
'prtCoverStatus' => 'status', |
|
804
|
|
|
|
|
|
|
}], |
|
805
|
|
|
|
|
|
|
mediapath => [ |
|
806
|
|
|
|
|
|
|
'prtMediaPath', |
|
807
|
|
|
|
|
|
|
{ |
|
808
|
|
|
|
|
|
|
'prtMediaPathType' => 'type', |
|
809
|
|
|
|
|
|
|
'prtMediaPathDescription' => 'description', |
|
810
|
|
|
|
|
|
|
'prtMediaPathStatus' => 'status', |
|
811
|
|
|
|
|
|
|
'prtMediaPathMediaSizeUnit' => 'mediaSizeunit', |
|
812
|
|
|
|
|
|
|
'prtMediaPathMaxMediaFeedDir' => 'maxMediaFeedDir', |
|
813
|
|
|
|
|
|
|
'prtMediaPathMaxMediaXFeedDir' => 'maxMediaXFeedDir', |
|
814
|
|
|
|
|
|
|
'prtMediaPathMinMediaFeedDir' => 'minMediaFeedDir', |
|
815
|
|
|
|
|
|
|
'prtMediaPathMinMediaXFeedDir' => 'minMediaXFeedDir', |
|
816
|
|
|
|
|
|
|
'prtMediaPathMaxSpeed' => 'maxSpeed', |
|
817
|
|
|
|
|
|
|
'prtMediaPathMaxSpeedPrintUnit' => 'maxSpeedPrintUnit', |
|
818
|
|
|
|
|
|
|
}], |
|
819
|
|
|
|
|
|
|
alerts => [ |
|
820
|
|
|
|
|
|
|
'prtAlert', |
|
821
|
|
|
|
|
|
|
{ |
|
822
|
|
|
|
|
|
|
'prtAlertTrainingLevel' => 'trainingLevel', |
|
823
|
|
|
|
|
|
|
'prtAlertGroup' => 'group', |
|
824
|
|
|
|
|
|
|
'prtAlertGroupIndex' => 'groupIndex', |
|
825
|
|
|
|
|
|
|
'prtAlertLocation' => 'location', |
|
826
|
|
|
|
|
|
|
'prtAlertCode' => 'code', |
|
827
|
|
|
|
|
|
|
'prtAlertDescription' => 'description', |
|
828
|
|
|
|
|
|
|
'prtAlertTime' => 'time', |
|
829
|
|
|
|
|
|
|
}], |
|
830
|
|
|
|
|
|
|
supplies => [ |
|
831
|
|
|
|
|
|
|
'prtMarkerSupplies', |
|
832
|
|
|
|
|
|
|
{ |
|
833
|
|
|
|
|
|
|
'prtMarkerSuppliesType' => 'type', |
|
834
|
|
|
|
|
|
|
'prtMarkerSuppliesSupplyUnit' => 'supplyunit', |
|
835
|
|
|
|
|
|
|
'prtMarkerSuppliesClass' => 'class', |
|
836
|
|
|
|
|
|
|
'prtMarkerSuppliesDescription' => 'desc', |
|
837
|
|
|
|
|
|
|
'prtMarkerSuppliesMaxCapacity' => 'maxcap', |
|
838
|
|
|
|
|
|
|
'prtMarkerSuppliesLevel' => 'level', |
|
839
|
|
|
|
|
|
|
}], |
|
840
|
|
|
|
|
|
|
marker => [ |
|
841
|
|
|
|
|
|
|
'prtMarker', |
|
842
|
|
|
|
|
|
|
{ |
|
843
|
|
|
|
|
|
|
'prtMarkerMarkTech' => 'markerTechnology', |
|
844
|
|
|
|
|
|
|
'prtMarkerCounterUnit' => 'counterUnits', |
|
845
|
|
|
|
|
|
|
'prtMarkerLifeCount' => 'lifeCount', |
|
846
|
|
|
|
|
|
|
'prtMarkerProcessColorants' => 'processColorants', |
|
847
|
|
|
|
|
|
|
'prtMarkerAddressabilityUnit' => 'addressabilityUnit', |
|
848
|
|
|
|
|
|
|
'prtMarkerAddressabilityFeedDir' => 'addressabilityFeedDir', |
|
849
|
|
|
|
|
|
|
'prtMarkerAddressabilityXFeedDir' => 'addressabilityXFeedDir', |
|
850
|
|
|
|
|
|
|
'prtMarkerNorthMargin' => 'northMargin', |
|
851
|
|
|
|
|
|
|
'prtMarkerSouthMargin' => 'southMargin', |
|
852
|
|
|
|
|
|
|
'prtMarkerEastMargin' => 'eastMargin', |
|
853
|
|
|
|
|
|
|
'prtMarkerWestMargin' => 'westMargin', |
|
854
|
|
|
|
|
|
|
'prtMarkerStatus' => 'status', |
|
855
|
|
|
|
|
|
|
}], |
|
856
|
|
|
|
|
|
|
inputtray => [ |
|
857
|
|
|
|
|
|
|
'prtInput', |
|
858
|
|
|
|
|
|
|
{ |
|
859
|
|
|
|
|
|
|
'prtInputType' => 'type', |
|
860
|
|
|
|
|
|
|
'prtInputDimUnit' => 'dimUnit', |
|
861
|
|
|
|
|
|
|
'prtInputMediaDimFeedDirChosen' => 'dimFeedDir', |
|
862
|
|
|
|
|
|
|
'prtInputMediaDimXFeedDirChosen' => 'dimXFeedDir', |
|
863
|
|
|
|
|
|
|
'prtInputCapacityUnit' => 'capUnit', |
|
864
|
|
|
|
|
|
|
'prtInputMaxCapacity' => 'maxCap', |
|
865
|
|
|
|
|
|
|
'prtInputCurrentLevel' => 'curLevel', |
|
866
|
|
|
|
|
|
|
'prtInputMediaName' => 'mediaName', |
|
867
|
|
|
|
|
|
|
'prtInputName' => 'name', |
|
868
|
|
|
|
|
|
|
'prtInputDescription' => 'description', |
|
869
|
|
|
|
|
|
|
'prtInputStatus' => 'status', |
|
870
|
|
|
|
|
|
|
}], |
|
871
|
|
|
|
|
|
|
contact => [ |
|
872
|
|
|
|
|
|
|
'mib2_system', |
|
873
|
|
|
|
|
|
|
{ |
|
874
|
|
|
|
|
|
|
"sysContact" => 'contact', |
|
875
|
|
|
|
|
|
|
"sysLocation" => 'location', |
|
876
|
|
|
|
|
|
|
}], |
|
877
|
|
|
|
|
|
|
pagecount => [ |
|
878
|
|
|
|
|
|
|
'prtMarker', |
|
879
|
|
|
|
|
|
|
{ |
|
880
|
|
|
|
|
|
|
"prtMarkerLifeCount" => 'pagecount', |
|
881
|
|
|
|
|
|
|
"prtMarkerCounterUnit" => 'countUnits', |
|
882
|
|
|
|
|
|
|
}], |
|
883
|
|
|
|
|
|
|
colors => [ |
|
884
|
|
|
|
|
|
|
'prtMarker', |
|
885
|
|
|
|
|
|
|
{ |
|
886
|
|
|
|
|
|
|
"prtMarkerProcessColorants" => 'processColorants', |
|
887
|
|
|
|
|
|
|
}], |
|
888
|
|
|
|
|
|
|
resolution => [ |
|
889
|
|
|
|
|
|
|
'prtMarker', |
|
890
|
|
|
|
|
|
|
{ |
|
891
|
|
|
|
|
|
|
"prtMarkerAddressabilityUnit" => 'addressabilityUnit', |
|
892
|
|
|
|
|
|
|
"prtMarkerAddressabilityFeedDir" => 'addressabilityFeedDir', |
|
893
|
|
|
|
|
|
|
"prtMarkerAddressabilityXFeedDir" => 'addressabilityXFeedDir', |
|
894
|
|
|
|
|
|
|
}], |
|
895
|
|
|
|
|
|
|
minmargin => [ |
|
896
|
|
|
|
|
|
|
'prtMarker', |
|
897
|
|
|
|
|
|
|
{ |
|
898
|
|
|
|
|
|
|
"prtMarkerAddressabilityUnit" => 'addressabilityUnit', |
|
899
|
|
|
|
|
|
|
"prtMarkerNorthMargin" => 'northMargin', |
|
900
|
|
|
|
|
|
|
"prtMarkerSouthMargin" => 'southMargin', |
|
901
|
|
|
|
|
|
|
"prtMarkerEastMargin" => 'eastMargin', |
|
902
|
|
|
|
|
|
|
"prtMarkerWestMargin" => 'westMargin', |
|
903
|
|
|
|
|
|
|
}], |
|
904
|
|
|
|
|
|
|
minpapersize => [ |
|
905
|
|
|
|
|
|
|
'prtMediaPath', |
|
906
|
|
|
|
|
|
|
{ |
|
907
|
|
|
|
|
|
|
"prtMediaPathMediaSizeUnit" => 'minMediaUnit', |
|
908
|
|
|
|
|
|
|
"prtMediaPathMinMediaFeedDir" => 'minMediaFeedDir', |
|
909
|
|
|
|
|
|
|
"prtMediaPathMinMediaXFeedDir" => 'minMediaXFeedDir', |
|
910
|
|
|
|
|
|
|
}, |
|
911
|
|
|
|
|
|
|
[ |
|
912
|
|
|
|
|
|
|
sub { my $x= shift; $x->{prtMediaPathMinMediaFeedDir} * $x->{prtMediaPathMinMediaXFeedDir} }, |
|
913
|
|
|
|
|
|
|
sub { my @x= @_; $x[0] < ( $x[1] || 1e99 ) }, |
|
914
|
|
|
|
|
|
|
], |
|
915
|
|
|
|
|
|
|
], |
|
916
|
|
|
|
|
|
|
maxpapersize => [ |
|
917
|
|
|
|
|
|
|
'prtMediaPath', |
|
918
|
|
|
|
|
|
|
{ |
|
919
|
|
|
|
|
|
|
"prtMediaPathMediaSizeUnit" => 'maxMediaUnit', |
|
920
|
|
|
|
|
|
|
"prtMediaPathMaxMediaFeedDir" => 'maxMediaFeedDir', |
|
921
|
|
|
|
|
|
|
"prtMediaPathMaxMediaXFeedDir" => 'maxMediaXFeedDir', |
|
922
|
|
|
|
|
|
|
}, |
|
923
|
|
|
|
|
|
|
[ |
|
924
|
|
|
|
|
|
|
sub { my $x= shift; $x->{prtMediaPathMaxMediaFeedDir} * $x->{prtMediaPathMaxMediaXFeedDir} }, |
|
925
|
|
|
|
|
|
|
sub { my @x= @_; ( $x[0] > $x[1]) }, |
|
926
|
|
|
|
|
|
|
], |
|
927
|
|
|
|
|
|
|
], |
|
928
|
|
|
|
|
|
|
enginespeed => [ |
|
929
|
|
|
|
|
|
|
'prtMediaPath', |
|
930
|
|
|
|
|
|
|
{ |
|
931
|
|
|
|
|
|
|
"prtMediaPathMaxSpeedPrintUnit" => 'maxSpeedUnit', |
|
932
|
|
|
|
|
|
|
"prtMediaPathMaxSpeed" => 'maxSpeed', |
|
933
|
|
|
|
|
|
|
}, |
|
934
|
|
|
|
|
|
|
[ |
|
935
|
|
|
|
|
|
|
sub { my $x= shift; $x->{prtMediaPathMaxSpeed} }, |
|
936
|
|
|
|
|
|
|
sub { my @x= @_; ( $x[0] > $x[1] ) }, |
|
937
|
|
|
|
|
|
|
], |
|
938
|
|
|
|
|
|
|
], |
|
939
|
|
|
|
|
|
|
); |
|
940
|
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
$filter_code= q{ |
|
942
|
|
|
|
|
|
|
sub ##SUBNAME## |
|
943
|
|
|
|
|
|
|
{ |
|
944
|
|
|
|
|
|
|
#warn '##SUBNAME##'; |
|
945
|
|
|
|
|
|
|
my $self= shift; |
|
946
|
|
|
|
|
|
|
my( $x, $y, $z); |
|
947
|
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
$x= $self->{Neon}->##SNMPTABLE##(); |
|
949
|
|
|
|
|
|
|
$x= $self->_munge_it( $x, $filter_map{##SUBNAME##}->[2]) if $filter_map{##SUBNAME##}->[2]; |
|
950
|
|
|
|
|
|
|
|
|
951
|
|
|
|
|
|
|
$z= $filter_map{##SUBNAME##}->[1]; |
|
952
|
|
|
|
|
|
|
|
|
953
|
|
|
|
|
|
|
if ( ref $x eq 'ARRAY' ) |
|
954
|
|
|
|
|
|
|
{ |
|
955
|
|
|
|
|
|
|
foreach my $var (( ref $x eq 'ARRAY' ) ? @$x : $x ) |
|
956
|
|
|
|
|
|
|
{ |
|
957
|
|
|
|
|
|
|
my %M; |
|
958
|
|
|
|
|
|
|
%M= map { ( $z->{$_}, $var->{$_}) } ( grep { my $a= $_; grep { $a eq $_ } keys %$z } keys %$var ); |
|
959
|
|
|
|
|
|
|
push @$y, \%M if %M; |
|
960
|
|
|
|
|
|
|
} |
|
961
|
|
|
|
|
|
|
} |
|
962
|
|
|
|
|
|
|
else |
|
963
|
|
|
|
|
|
|
{ |
|
964
|
|
|
|
|
|
|
$y= { map { ( $z->{$_}, $x->{$_}) } ( grep { my $a= $_; grep { $a eq $_ } keys %$z } keys %$x ) }; |
|
965
|
|
|
|
|
|
|
} |
|
966
|
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
return $y; |
|
968
|
|
|
|
|
|
|
} |
|
969
|
|
|
|
|
|
|
}; |
|
970
|
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
##################################### answer_code (this answers boolean questions) |
|
972
|
|
|
|
|
|
|
|
|
973
|
|
|
|
|
|
|
%answer_map= ( |
|
974
|
|
|
|
|
|
|
duplex => [ |
|
975
|
|
|
|
|
|
|
'prtMediaPath', |
|
976
|
|
|
|
|
|
|
[ 'longEdgeBindingDuplex', 'shortEdgeBindingDuplex'], |
|
977
|
|
|
|
|
|
|
sub { my @x= @_; grep { $x[0]->{prtMediaPathType} eq $_ } @{$x[1]} }, |
|
978
|
|
|
|
|
|
|
], |
|
979
|
|
|
|
|
|
|
_check_language => [ |
|
980
|
|
|
|
|
|
|
'prtInterpreter', |
|
981
|
|
|
|
|
|
|
{ pcl => 'langPCL', |
|
982
|
|
|
|
|
|
|
postscript => 'langPS', |
|
983
|
|
|
|
|
|
|
psprint => 'langPSPrinter', |
|
984
|
|
|
|
|
|
|
pjl => 'langPCL', |
|
985
|
|
|
|
|
|
|
hpgl => 'langHPGL', |
|
986
|
|
|
|
|
|
|
autolang => 'langAutomatic', |
|
987
|
|
|
|
|
|
|
}, |
|
988
|
|
|
|
|
|
|
sub { my @x= @_; $x[0]->{prtInterpreterLangFamily} eq $x[1]->{$x[2]} }, |
|
989
|
|
|
|
|
|
|
], |
|
990
|
|
|
|
|
|
|
_check_protocol => [ |
|
991
|
|
|
|
|
|
|
'prtChannel', |
|
992
|
|
|
|
|
|
|
{ appletalk => [ qw/ chAppleTalkPAP / ], |
|
993
|
|
|
|
|
|
|
lpd => [ qw/ chLPDServer / ], |
|
994
|
|
|
|
|
|
|
port9100 => [ qw/ chPort9100 chAppSocket chBidirPortTCP / ], |
|
995
|
|
|
|
|
|
|
}, |
|
996
|
|
|
|
|
|
|
sub { my @x= @_; grep { $x[0]->{prtChannelType} eq $_ } @{$x[1]->{$x[2]}} }, |
|
997
|
|
|
|
|
|
|
], |
|
998
|
|
|
|
|
|
|
_check_paper_size => [ |
|
999
|
|
|
|
|
|
|
'prtInput', |
|
1000
|
|
|
|
|
|
|
{}, |
|
1001
|
|
|
|
|
|
|
sub { my @x= @_; |
|
1002
|
|
|
|
|
|
|
my $a= $x[0]->{prtInputMediaDimFeedDirChosen}; |
|
1003
|
|
|
|
|
|
|
my $b= $x[0]->{prtInputMediaDimXFeedDirChosen}; |
|
1004
|
|
|
|
|
|
|
my $c= $x[0]->{prtInputDimUnit}; |
|
1005
|
|
|
|
|
|
|
my $y= $paper_sizes_indexed->{$x[2]}->{$c}->[DimA]; |
|
1006
|
|
|
|
|
|
|
my $z= $paper_sizes_indexed->{$x[2]}->{$c}->[DimB]; |
|
1007
|
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
(( $a == $y ) && ( $b == $z )) |
|
1009
|
|
|
|
|
|
|
|| |
|
1010
|
|
|
|
|
|
|
(( $a == $z ) && ( $b == $y )) |
|
1011
|
|
|
|
|
|
|
}, |
|
1012
|
|
|
|
|
|
|
], |
|
1013
|
|
|
|
|
|
|
printmib => [ |
|
1014
|
|
|
|
|
|
|
'printmib', |
|
1015
|
|
|
|
|
|
|
undef, |
|
1016
|
|
|
|
|
|
|
sub { shift()->{printmib} }, |
|
1017
|
|
|
|
|
|
|
], |
|
1018
|
|
|
|
|
|
|
hostmib => [ |
|
1019
|
|
|
|
|
|
|
'hostmib', |
|
1020
|
|
|
|
|
|
|
undef, |
|
1021
|
|
|
|
|
|
|
sub { shift()->{hostmib} }, |
|
1022
|
|
|
|
|
|
|
], |
|
1023
|
|
|
|
|
|
|
); |
|
1024
|
|
|
|
|
|
|
|
|
1025
|
|
|
|
|
|
|
$answer_code= q{ |
|
1026
|
|
|
|
|
|
|
sub ##SUBNAME## |
|
1027
|
|
|
|
|
|
|
{ |
|
1028
|
|
|
|
|
|
|
#warn "##SUBNAME##"; |
|
1029
|
|
|
|
|
|
|
my( $self, $a)= @_; |
|
1030
|
|
|
|
|
|
|
my $answer= 0; |
|
1031
|
|
|
|
|
|
|
my( $x, $y, $z); |
|
1032
|
|
|
|
|
|
|
|
|
1033
|
|
|
|
|
|
|
$x= $self->{Neon}->##SNMPTABLE##(); |
|
1034
|
|
|
|
|
|
|
$y= $answer_map{##SUBNAME##}->[2]; |
|
1035
|
|
|
|
|
|
|
$z= $answer_map{##SUBNAME##}->[1]; |
|
1036
|
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
if( ref $y =~ '^CODE(.+)' ) |
|
1038
|
|
|
|
|
|
|
{ |
|
1039
|
|
|
|
|
|
|
foreach my $var ( @$x ) |
|
1040
|
|
|
|
|
|
|
{ |
|
1041
|
|
|
|
|
|
|
$answer++ if $y->( $var, $z, $a); |
|
1042
|
|
|
|
|
|
|
} |
|
1043
|
|
|
|
|
|
|
} |
|
1044
|
|
|
|
|
|
|
else |
|
1045
|
|
|
|
|
|
|
{ |
|
1046
|
|
|
|
|
|
|
$answer= $x; |
|
1047
|
|
|
|
|
|
|
} |
|
1048
|
|
|
|
|
|
|
|
|
1049
|
|
|
|
|
|
|
return { ##VALNAME## => $self->{boolean}->[$answer?1:0] }; |
|
1050
|
|
|
|
|
|
|
} |
|
1051
|
|
|
|
|
|
|
}; |
|
1052
|
|
|
|
|
|
|
|
|
1053
|
|
|
|
|
|
|
##################################### AUTOLOAD |
|
1054
|
|
|
|
|
|
|
|
|
1055
|
|
|
|
|
|
|
sub AUTOLOAD |
|
1056
|
|
|
|
|
|
|
{ |
|
1057
|
|
|
|
|
|
|
#warn "AUTOLOAD"; |
|
1058
|
|
|
|
|
|
|
my $autoload= ( $AUTOLOAD =~ /.*::(\w+)/ )[0]; |
|
1059
|
|
|
|
|
|
|
|
|
1060
|
|
|
|
|
|
|
my( $sub, %tags); |
|
1061
|
|
|
|
|
|
|
if ( defined $language_map{$autoload} ) |
|
1062
|
|
|
|
|
|
|
{ |
|
1063
|
|
|
|
|
|
|
$sub= $language_code; |
|
1064
|
|
|
|
|
|
|
%tags= ( |
|
1065
|
|
|
|
|
|
|
'##SUBNAME##' => $autoload, |
|
1066
|
|
|
|
|
|
|
'##HANDLER##' => $language_map{$autoload}, |
|
1067
|
|
|
|
|
|
|
); |
|
1068
|
|
|
|
|
|
|
} |
|
1069
|
|
|
|
|
|
|
elsif ( defined $filter_map{$autoload} ) |
|
1070
|
|
|
|
|
|
|
{ |
|
1071
|
|
|
|
|
|
|
$sub= $filter_code; |
|
1072
|
|
|
|
|
|
|
%tags= ( |
|
1073
|
|
|
|
|
|
|
'##SUBNAME##' => $autoload, |
|
1074
|
|
|
|
|
|
|
'##SNMPTABLE##' => $filter_map{$autoload}->[0], |
|
1075
|
|
|
|
|
|
|
'##MUNGE_FILTER##' => $filter_map{$autoload}->[1], |
|
1076
|
|
|
|
|
|
|
); |
|
1077
|
|
|
|
|
|
|
} |
|
1078
|
|
|
|
|
|
|
elsif ( defined $answer_map{$autoload} ) |
|
1079
|
|
|
|
|
|
|
{ |
|
1080
|
|
|
|
|
|
|
$sub= $answer_code; |
|
1081
|
|
|
|
|
|
|
%tags= ( |
|
1082
|
|
|
|
|
|
|
'##SUBNAME##' => $autoload, |
|
1083
|
|
|
|
|
|
|
'##SNMPTABLE##' => $answer_map{$autoload}->[0], |
|
1084
|
|
|
|
|
|
|
'##VALNAME##' => ( ref $answer_map{$autoload}->[1] eq 'HASH' ) ? '$a' : $autoload, |
|
1085
|
|
|
|
|
|
|
); |
|
1086
|
|
|
|
|
|
|
} |
|
1087
|
|
|
|
|
|
|
|
|
1088
|
|
|
|
|
|
|
if ( $sub ) |
|
1089
|
|
|
|
|
|
|
{ |
|
1090
|
|
|
|
|
|
|
map { $sub=~ s/\Q$_/$tags{$_}/g } keys %tags; |
|
1091
|
|
|
|
|
|
|
eval $sub; |
|
1092
|
|
|
|
|
|
|
die $@ if $@; |
|
1093
|
|
|
|
|
|
|
goto &$autoload; |
|
1094
|
|
|
|
|
|
|
} |
|
1095
|
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
printf STDERR "Unimplemented method:\t'%s()'\n", $autoload; |
|
1097
|
|
|
|
|
|
|
return undef; |
|
1098
|
|
|
|
|
|
|
} |
|
1099
|
|
|
|
|
|
|
|
|
1100
|
|
|
|
|
|
|
##################################### _munge_it |
|
1101
|
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
sub _munge_it |
|
1103
|
|
|
|
|
|
|
{ |
|
1104
|
|
|
|
|
|
|
#warn '_munge_it'; |
|
1105
|
|
|
|
|
|
|
my( $self, $x, $F)= @_; |
|
1106
|
|
|
|
|
|
|
|
|
1107
|
|
|
|
|
|
|
my( $M, $m); |
|
1108
|
|
|
|
|
|
|
foreach my $var ( @$x ) |
|
1109
|
|
|
|
|
|
|
{ |
|
1110
|
|
|
|
|
|
|
my $a= $F->[0]->( $var); |
|
1111
|
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
if (( ! $m ) || ( $F->[1]->( $a, $m) )) |
|
1113
|
|
|
|
|
|
|
{ |
|
1114
|
|
|
|
|
|
|
$M= $var; |
|
1115
|
|
|
|
|
|
|
$m= $a; |
|
1116
|
|
|
|
|
|
|
} |
|
1117
|
|
|
|
|
|
|
} |
|
1118
|
|
|
|
|
|
|
|
|
1119
|
|
|
|
|
|
|
return $M; |
|
1120
|
|
|
|
|
|
|
} |
|
1121
|
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
##################################### the end |
|
1123
|
|
|
|
|
|
|
# |
|
1124
|
|
|
|
|
|
|
# $Id: NPAdmin.pm,v 1.23 2002/11/15 03:57:23 bozzio Exp $ |
|
1125
|
|
|
|
|
|
|
# |
|
1126
|
|
|
|
|
|
|
|
|
1127
|
|
|
|
|
|
|
1; |