~ubuntu-branches/ubuntu/wily/net-snmp/wily-proposed

« back to all changes in this revision

Viewing changes to perl/TrapReceiver/TrapReceiver.pm

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-28 14:59:36 UTC
  • mfrom: (1.2.3 upstream) (1.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20100628145936-cbiallic69pn044g
Tags: 5.4.3~dfsg-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Set Ubuntu maintainer address.
  - net-snmp-config: Use bash. (LP: #104738)
  - Removed multiuser option when calling update-rc.d. (LP: #254261)
  - debian/snmpd.init: LSBify the init script.
  - debian/patches/52_fix_snmpcmd_1_typo.patch: Adjust a typo in snmpcmd.1
    (LP: #250459)
  - debian/snmpd.postinst: source debconf before doing work, LP: #589056
  - debian/snmp.preinst, debian/snmp.prerm: kill any/all processes owned by
    snmp user before install/uninstall, LP: #573391
  - Add apport hook (LP: #533603):
  - debian/{snmp,snmpd}.apport: Added.
  - debian/control: Build-depends on dh-apport.
  - debian/rules: 
    + Add --with apport.
    + override_dh_apport to install hook on snmpd package only.
 * Dropped patches:
   - debian/patches/99-fix-ubuntu-div0.patch: Fix dvision by zero.. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
        NETSNMPTRAPD_PRE_HANDLER
48
48
);
49
49
 
50
 
$VERSION = '5.04021';
 
50
$VERSION = '5.0403';
51
51
 
52
52
# sub new {
53
53
#     my $type = shift;
135
135
associated with it, and the value's numeric type (see NetSNMP::ASN for
136
136
further details on SNMP typing information).
137
137
 
 
138
Registered functions should return one of the following values:
 
139
 
 
140
=over 2
 
141
 
 
142
=item NETSNMPTRAPD_HANDLER_OK
 
143
 
 
144
Handling the trap succeeded, but lets the snmptrapd demon check for
 
145
further appropriate handlers.
 
146
 
 
147
=item NETSNMPTRAPD_HANDLER_FAIL
 
148
 
 
149
Handling the trap failed, but lets the snmptrapd demon check for
 
150
further appropriate handlers.
 
151
 
 
152
=item NETSNMPTRAPD_HANDLER_BREAK
 
153
 
 
154
Stops evaluating the list of handlers for this specific trap, but lets
 
155
the snmptrapd demon apply global handlers.
 
156
 
 
157
=item NETSNMPTRAPD_HANDLER_FINISH
 
158
 
 
159
Stops searching for further appropriate handlers.
 
160
 
 
161
=back
 
162
 
 
163
If a handler function does not return anything appropriate or even
 
164
nothing at all, a return value of NETSNMPTRAPD_HANDLER_OK is assumed.
 
165
 
138
166
Subroutines are registered using the NetSNMP::TrapReceiver::register
139
167
function, which takes two arguments.  The first is a string describing
140
168
the notification you want to register for (such as "linkUp" or
144
172
no other handlers are called.  The "all" keyword indicates that the
145
173
handler should ALWAYS be called for every notification.
146
174
 
 
175
 
147
176
=head1 EXAMPLE
148
177
 
149
178
As an example, put the following code into a file (say
157
186
      # print the PDU info (a hash reference)
158
187
      print "PDU INFO:\n";
159
188
      foreach my $k(keys(%{$_[0]})) {
160
 
        printf "  %-30s %s\n", $k, $_[0]{$k};
 
189
        if ($k eq "securityEngineID" || $k eq "contextEngineID") {
 
190
          printf "  %-30s 0x%s\n", $k, unpack('h*', $_[0]{$k});
 
191
        }
 
192
        else {
 
193
          printf "  %-30s %s\n", $k, $_[0]{$k};
 
194
        }
161
195
      }
162
196
 
163
197
      # print the variable bindings: