snmp-session-master/0000755000000000000000000000000012147473377013522 5ustar rootrootsnmp-session-master/README0000644000000000000000000000661512147473377014412 0ustar rootroot SNMP support for Perl 5 ----------------------- Copyright (c) 1995-2007, Simon Leinen All rights reserved This program is free software; you can redistribute it under the "Artistic License" included in this distribution (file "Artistic"). Author: Simon Leinen Contributors: Tobias Oetiker Matthew Trunnell Andrzej Tobola Dave Rand Heine Peters Yufang HU Philippe Simonet Daniel L. Needles Dan Cox Iouri Pakhomenko Niels Bakker Mike Mitchell Alan Nichols Mike McCauley Andrew W. Elble Paul E. Erkkila Johannes Demel Rik Hoorelbeke Brett T Warden Alistair Mills Bert Driehuis Michael Deegan Jakob Ilves (/IlvJa) Jan Kasprzak Valerio Bontempi Lorenzo Colitti Joerg Kummer Christopher J. Tengi Luc Pauwels Milen Pavlov Andrew Cornford-Matheson Gerry Dalton Jan van Keulen Armin Wolfermann http://www.switch.ch/misc/leinen/snmp/perl/index.html This archive contains Perl 5 modules SNMP_Session.pm and BER.pm, which, when used together, provide rudimentary access to remote SNMP (v1/v2) agents. This module differs from existing SNMP packages in that it is completely stand-alone, i.e. you don't need to have another SNMP package such as Net-SNMP. It is also written entirely in Perl, so you don't have to compile any C modules. It uses the Perl 5 Socket.pm module and should therefore be very portable, even to non-Unix systems. The SNMP operations currently supported are "get", "get-next", and "set", as well as trap generation and reception. For an excellent example of the type of application this is useful for, see Tobias Oetiker's ``mrtg'' (Multi Router Traffic Grapher) tool: Usage ..... See the EXAMPLES section of the POD documentation in SNMP_Session.pm. Future Plans ............ SNMPv3 Support The code could first be restructured to follow the modularization proposed in RFC 2271 (An Architecture for Describing SNMP Management Frameworks). The existing SNMPv1 and SNMPv2c support must somehow be retrofitted to this framework. Later, one could add support for SNMPv3 PDU formats and for user-based security. Higher-Level APIs The current programming interface is very close to the level of SNMP operations and PDUs. For actual management applications, there are probably more convenient interfaces that could be defined. snmp-session-master/Makefile.PL0000644000000000000000000000033212147473377015472 0ustar rootrootuse ExtUtils::MakeMaker; WriteMakefile( 'NAME' => 'SNMP_Session', 'VERSION_FROM' => 'lib/SNMP_Session.pm', # finds $VERSION 'dist' => {COMPRESS=>'gzip -9f', SUFFIX => 'gz'}, ); snmp-session-master/t/0000755000000000000000000000000012147473377013765 5ustar rootrootsnmp-session-master/t/00ber.t0000644000000000000000000000335112147473377015064 0ustar rootroot#!/usr/bin/perl ### ### Test BER.pm encoding and decoding routines use strict; use warnings; use Test::More tests => 15; use BER; ### en_decode_test VALUE, ENCODER, TEMPLATE [, ENCODED] ### ### Test both encoding and decoding. ### sub en_decode_test ($$$@) { my ($value, $encoder, $template, $encoded) = @_; if (defined $encoded) { is(&$encoder ($value), $encoded); } else { $encoded = &$encoder ($value); } my ($x) = decode_by_template ($encoded, $template); is($x, $value); } ### tt PDU, TEMPLATE, EXPECTED, ARGS... ### ### Test decoding by template. The PDU is decoded using TEMPLATE and ### (optionally) ARGS. The resulting values are then compared against ### EXPECTED, which is a reference to a vector of expected values. ### sub tt ($$$@) { my ($pdu, $template, $desired_result, @args) = @_; my @values = decode_by_template ($pdu, $template, @args); print "# ".join ("; ", @values)."\n"; is_deeply (\@values, $desired_result); } en_decode_test ("foo", \&encode_string, "%s", "\x04\x03foo"); en_decode_test (123, \&encode_int, "%i", "\x02\x01\x7b"); is (encode_oid (1,3,6,1), "\x06\x03\x2b\x06\x01"); tt ("\x02\x01\x03", "%i", [3]); tt ("\x02\x01\x03", "%u", [3]); tt ("\x02\x01\xff", "%i", [-1]); tt ("\x30\x03\x02\x01\xff", "%{%i", [-1]); tt ("\x30\x0b\x02\x01\x12\x02\x01\x02\x04\x03foo", "%{%i%i%s", [18, 2, "foo"]); tt ("\x30\x0b\x02\x01\x12\x02\x01\x02\x04\x03foo", "%{%i%2i%s", [18, "foo"]); tt ("\x30\x0b\x02\x01\x12\x02\x01\x02\x04\x03foo", "%{%i%2i%*s", [18], "foo"); tt ("\x04\x03foo", "%s", ["foo"]); tt ("\x38\x03\x02\x01\xff", "%*{%i", [-1], 0x38); is (join (":",decode_sequence ("\x30\x05\x02\x00\x02\x01\x01\x30\x05\x02\x00\x02\x01\x01")), "\x02\x00\x02\x01\x01:\x30\x05\x02\x00\x02\x01\x01"); snmp-session-master/README.SNMP_util0000644000000000000000000003521312147473377016217 0ustar rootroot README for SNMP_util.pm Copyright (c) 1998-2002, Mike Mitchell All rights reserved This program is free software; you can redistribute it under the "Artistic License" included in this distribution (file "Artistic"). Author: Mike Mitchell Contributors: Tobias Oetiker Simon Leinen Jeff Allen Johannes Demel Laurent Girod Ian Duplisse I was using Simon Leinen's SNMP tools in various perl scripts, and I found that I was using the same functions over and over. I grouped the common routines into a separate perl module so that I would only have to make changes in one place, rather than track down all the different perl scripts that included the code. The result is the 'SNMP_utils.pm' module. Thanks goes to Tobias Oetiker (tobi@oetiker.ch) of MRTG fame for the basic layout of the functions. The SNMP_utils.pm module contains the functions snmpmapOID(text, OID, [text, OID ...]) snmpMIB_to_OID(filename) snmpLoad_OID_Cache(filename) snmpQueue_MIB_File(filename, [filename]) snmpget(community@host:port:timeout:retries:backoff:version, OID, [OID...]) snmpgetnext(community@host:port:timeout:retries:backoff:version, OID, [OID...]) snmpwalk(community@host:port:timeout:retries:backoff:version, OID, [OID...]) snmpgetbulk(community@host:port:timeout:retries:backoff:version, non_repeat, max_repeat, OID, [OID...]) snmpset(community@host:port:timeout:retries:backoff:version, OID, type, value, [OID, type, value ...]) snmptrap(community@host:port:timeout:retries:backoff:version, enterpriseOID, agent, generalID, specificID, OID, type, value, [OID, type, value ...]) snmpmaptable(community@host:port:timeout:retries:backoff:version, function, OID, [OID...]) snmpmaptable4(community@host:port:timeout:retries:backoff:version, function, max_repetitions, OID, [OID...]) snmpwalkhash(community@host:port:timeout:retries:backoff:version, function, OID, [OID...], [hash ref]) The functions have a small mapping table for commonly used OIDs. The OIDs from RFC1213 (MIB-II) and RFC1315 (Frame Relay) are preloaded. It is much easier to say "ifInOctets.4" instead of "1.3.6.1.2.1.2.2.1.10.4". The snmpmapOID() function will let you add your own entries to the mapping table. It doesn't return anything. Be sure to leave off any instance number from the OID passed to snmpmapOID()! The example above would be &snmpmapOID("ifInOctets", "1.3.6.1.2.1.2.2.1.10"). Don't use &snmpmapOID("ifInOctets.4", "1.3.6.1.2.1.2.2.1.10.4"). The trailing ".4" is interpreted as an instance number, and not the entire OID. The snmpmapOID function will ignore the attempt to add a mapping entry that includes an instance number. The call &snmpmapOID("ifInOctets.four", "1.3.6.1.2.1.2.2.1.10.4") would be accepted, because the text ".four" is interpreted differently than the number 4. The snmpMIB_to_OID() function will open the passed-in MIB file name and read it. It will create text mappings for the appropriate OID number. It returns the number of text mappings added, so a zero or negative return indicates an error. The snmpLoad_OID_Cache() function will open the passed-in file name and read the file. It is expecting lines with a text string in the first column and an OID number in the second column, like ifInOctets 1.3.6.1.2.1.2.2.1.10 ifOutOctets 1.3.6.1.2.1.2.2.1.16 It will add the text to OID mappings in the file to the internal list by calling the "snmpmapOID()" function. This way the extra overhead of parsing a MIB file can be avoided if you have a pre-parsed version of the MIB handy. The snmpQueue_MIB_File() function queues up file names for use by the "snmpMIB_to_OID()" function. If there are filenames passed into "snmpQueue_MIB_File()", when an OID can't be found in the internal table, the queued MIB files are loaded one after another until the OID can be found (or the list is exhausted). This delays the MIB parsing until the OID value is actually needed. A cache file with the looked up text-to-OID mappings is maintained. It's name is "OID_cache.txt", and can be changed by setting the variable $SNMP_util::CacheFile to the name of the file you desire. This cache file is automatically loaded before the queued MIB files are parsed. If the OID is found in the cache file, the MIB file doesn't have to be parsed. The rest of the functions require a hostname/IP address as the first argument. The community string, port number, timeout, retries, backoff, and version parameters are all optional. If the community string isn't specified, "public" is used. If the port number isn't specified, the default value from SNMP_Sesssion.pm (port 161) is used for everything but snmptrap(). snmptrap() uses port 162 as its default. The port parameter was recently augmented to allow the specification of the IP address (or hostname) and port of the machine doing the query in addition to the IP address (or hostname) and port of the machine being queried. Some machines have additional security features that only allow SNMP queries to come from certain IP addresses. If the host doing the query has multiple interface, it may be necessary to specify the interface the query should come from. The port parameter is further broken down into "remote_port!local_address!local_port". Here are some examples: somehost somehost:161 somehost:161!192.168.2.4!4000 use 192.168.2.4 and port 4000 as source somehost:!192.168.2.4 use 192.168.2.4 as source somehost:!!4000 use port 4000 as source Most people will only need to use the first form ("somehost"). The timeout, retries, and backoff parameters default to whatever SNMP_Session.pm uses. For SNMP_Session.pm version 0.83 they are 2 seconds, 5 retries, and a 1.0 backoff factor. The backoff factor is used as a multiplier to increase the timeout after every retry. With a backoff factor of 1.0 the timeout stays the same for every retry. The version parameter defaults to SNMP version 1. Some SNMP values such as 64-bit counters have to be queried using SNMP version 2. Specifying "2" or "2c" as the version parameter will accomplish this. The snmpgetbulk routine is only supported in SNMP version 2 and higher. Several parameters internal to SNMP_Session can be set by passing a hash as the first OID. The keys to the hash are the parameters to modify. Here is a list of parameters and their default values in SNMP_Session version 0.91: 'community' => "public" 'timeout' => 2.0 'retries' => 5 'backoff' => 1.0 'debug' => 0 'default_max_repetitions' => 12 'use_getbulk' => 1 'lenient_source_address_matching' => 1 'lenient_source_port_matching' => 1 Consult the documentation and/or source code for SNMP_Session for further information of these parameters. The snmpget function returns an array with the results of the 'get' operation. The value associated with each OID is returned as a separate value in the array. The snmpgetnext function returns an array with the results of the 'getnext' operation. The OID number is added to the result as a prefix with a colon separator, like '1.3.6.1.2.1.2.2.1.2.1:ethernet' The snmpwalk function returns an array with all the OID numbers and values, like the 'snmpgetnext' function. If only one OID is specified for the walk, only the instance part of the OID number is added as a prefix. If multiple OID are specified for the walk, the entire OID number is added as a prefix. For instance, a walk of just '1.3.6.1.2.1.2.2.1.2' will return values like '1:ethernet', '2:ethernet', '3:fddi'. A walk multiple OIDs will return values like '1.3.6.1.2.1.2.2.1.2.1:ethernet'. The snmpwalk function will use a 'getbulk' query for efficiency if the SNMP version is 2 or higher. The snmpgetbulk function, like the snmpgetnext function, returns an array with the results of the 'getbulk' operation. The OID number is added to the result as a prefix with a colon separator, like '1.3.6.1.2.1.2.2.1.2.1:ethernet' The 'non_repeat' argument is the number of OID arguments that should be retrieved no more than once. The 'max_repeat' argument is the number of times that other variables beyond those specified by the 'non_repeat' argument should be retrieved. The getbulk query is only supported at SNMP version 2 or higher. The snmpset function is passed OID, type, and value triplets. It returns an array with the result of the set. The snmpmaptable function can be used for walking tables. The OID arguments are the columns of the table sharing the same index, and the passed-in function is called once per row. The passed-in function will be given the row index as a partial OID in dotted notation, e.g. "1.3", or "10.0.1.34", and values of the requested table columns in that row. The snmpmaptable4 function is just like snmpmaptable, only the third argument is the number of table rows to request in a single SNMP query. The snmpmaptable function uses the default of 12 rows. The snmpwalkhash acts like snmpwalk, but will call the passed-in function once per returned value. The function is passed a reference to a hash, the hostname, the textual OID, the dotted-numeric OID, the instance, the value, and the textual OID you requested. That function can customize the result you want, in a hash of hashes, so you can extract the value later by hosts, by oid_names, by oid_numbers, by instances... like these: $hash{$host}{$name}{$inst} = $value; $hash{$host}{$oid}{$inst} = $value; $hash{$name}{$inst} = $value; $hash{$oid}{$inst} = $value; $hash{$oid . '.' . $ints} = $value; $hash{$inst} = $value; ... If the last argument to snmpwalkhash is a reference to a hash, that hash reference is passed to the passed-in function instead of a local hash reference. That way your function can look up other objects unrelated to the current invocation of snmpwalkhash. Here is a simple example of using the functions: #! /usr/local/bin/perl5 BEGIN { ### # Finally, SNMPGet fully written in PERL5. # Thanks to Simon Leinen # More on: http://www.switch.ch/misc/leinen/snmp/perl/ #### # There older perls tend to behave peculiar with # large integers ... require 5.004; use SNMP_util "0.89"; } use strict; sub printfun { my($ind, $desc, $phy) = @_; my($a, $b, $c, $d, $e, $f, $mac); ($a, $b, $c, $d, $e, $f) = unpack("C6", $phy); $mac = sprintf("%02x-%02x-%02x-%02x-%02x-%02x", $a, $b, $c, $d, $e, $f); print "interface $ind: MAC $mac $desc\n"; } sub my_hash_with_host { my($h_ref, $host, $name, $oid, $inst, $value, $tree) = @_; $inst =~ s/^\.+//; if ($name =~ /ifPhysAddress/) { my $mac = ''; map { $mac .= sprintf("%02X", $_) } unpack "CCCCCC", $value; $value = $mac; } $h_ref->{$host}->{$name}->{$inst} = $value; } sub main { my($oid, $host, $response, $cont); my($desc, @ret, $nrows); $host = "127.0.0.1"; $cont = "Your Name"; # This snmpmapOID() isn't necessary, as it is already in # the internal map table. It is just an example... &snmpmapOID("ifDescr", "1.3.6.1.2.1.2.2.1.2"); print "Trying 'getnext' on $host\n"; @ret = &snmpgetnext($host, "ifDescr"); foreach $desc (@ret) { ($oid, $desc) = split(':', $desc, 2); print "$oid = $desc\n"; } print "Trying 'getnext' on $host with different timeout and retries\n"; @ret = &snmpgetnext($host, { 'timeout' => 4, 'retries' => 2 }, "ifDescr"); foreach $desc (@ret) { ($oid, $desc) = split(':', $desc, 2); print "$oid = $desc\n"; } print "Trying 'walk' on $host\n"; @ret = &snmpwalk($host, "ifDescr"); foreach $desc (@ret) { ($oid, $desc) = split(':', $desc, 2); print "$oid = $desc\n"; } print "Trying 'walkhash' on $host\n"; my %ret_hash = &snmpwalkhash($host, \&my_hash_with_host, "ifEntry"); foreach $oid (sort keys %{$ret_hash{$host}}) { foreach my $inst (sort { $a <=> $b } keys %{$ret_hash{$host}{$oid}}) { printf("%20s\t: %-15s %3s = %s\n", $host, $oid, $inst, $ret_hash{$host}{$oid}{$inst}); } } print "Trying 'walkhash' on $host, using own hash\n"; my(%myhash); %ret_hash = &snmpwalkhash($host, \&my_hash_with_host, "ifEntry", \%myhash); foreach $oid (sort keys %{$myhash{$host}}) { foreach my $inst (sort { $a <=> $b } keys %{$myhash{$host}{$oid}}) { printf("%20s\t: %-15s %3s = %s\n", $host, $oid, $inst, $myhash{$host}{$oid}{$inst}); } } print "Before set:\n"; $oid = "sysContact"; ($response) = &snmpget($host, $oid); if ($response) { print "GET $oid : $response\n"; } else { warn "$host did not respond to SNMP query\n"; } my $oldContact = $response; print "setting contact to $cont\n"; ($response) = &snmpset("security\@$host", $oid, 'string', $cont); if ($response) { print "SET: $oid : $response\n"; } else { die "$host did not respond to SNMP set\n"; } print "After set:\n"; ($response) = &snmpget($host, $oid); if ($response) { print "GET $oid : $response\n"; } else { die "$host did not respond to SNMP query\n"; } print "Setting contact back to $oldContact\n"; ($response) = &snmpset("security\@$host", $oid, 'string', $oldContact); if ($response) { print "SET: $oid : $response\n"; } else { die "$host did not respond to SNMP set\n"; } print "After 2nd set:\n"; ($response) = &snmpget($host, $oid); if ($response) { print "GET $oid : $response\n"; } else { die "$host did not respond to SNMP query\n"; } print "Walking table of interface description and physical address\n"; $nrows = &snmpmaptable($host, \&printfun, "ifDescr", "ifPhysAddress"); print "walked $nrows rows in the table\n"; } main; exit(0); ----------------------------------------------------- Here is an example using the MIB parsing functions. First create a file with a simple MIB: cat > dummy.mib < * lib/SNMP_Session.pm: Improved initialization of the flags for non-blocking behavior in receive_response_3(). The __DIE__ and __WARN__ signal handlers should be bound to the defaults, because the caller might be binding those and get in our way. Also, we only want to compute the flags once, on initialization. 2007-12-22 Simon Leinen * lib/SNMP_util.pm, lib/SNMP_Session.pm, lib/BER.pm: Upgraded to Artistic License 2.0. Copyright notice updated for 2008. * Artistic: Upgraded to Artistic License 2.0, from http://svn.perl.org/viewcvs/parrot/trunk/LICENSE?view=markup&rev=19096 2007-11-01 Simon Leinen * lib/SNMP_util.pm: New MIB parsing code from Mike Mitchell. 2007-10-13 Simon Leinen * lib/SNMP_Session.pm ($VERSION): Upgraded to 1.11, to pick up change to SNMP_util.pm. * changes.html: Document loop detection fix in SNMP_util.pm. * faq.html, index.html: Updated my e-mail address. * README, README.SNMP_util, lib/SNMP_Session.pm, lib/SNMP_util.pm, changes.html: Changed Tobi Oetiker's mail address. * README, index.html: Changed MRTG URL. * lib/SNMP_util.pm: [All changes from Mike Mitchell] Global replace || => or, && => and, to avoid precedence errors. (snmpwalk_flg): Improved loop detection. 2007-10-13 Simon Leinen * lib/SNMP_Session.pm ($VERSION): Upgraded to 1.11, to pick up change to SNMP_util.pm. * README, README.SNMP_util, changes.html, lib/SNMP_Session.pm: Changed Tobi Oetiker's mail address. * lib/SNMP_util.pm: [All changes from Mike Mitchell] Changed Tobi Oetiker's mail address. Global replace || => or, && => and, to avoid precedence errors. (snmpwalk_flg): Improved loop detection. * README: Changed MRTG URL. 2007-05-18 Simon Leinen * README, changes.html, index.html: Updated copyright. * lib/SNMP_util.pm (Check_OID): Fix regexp for qualified OID case (Mike Mitchell). 2007-05-03 Simon Leinen * lib/SNMP_Session.pm: Added Mike Fischer as a contributor. ($VERSION): Incremented to 1.10. (receive_response_3): Added optional "dont_block" argument. If this is present and non-zero, pass MSG_DONTWAIT to the recv() call. MSG_DONTWAIT is wrapped in an eval, to avoid breaking the code on systems that don't have the flag. (request_response_5): Pass dont_block=1 to receive_response_3. According to Mike Fisher, Linux sometimes blocks on recv() even though a select() for readability has returned, for example when a checksum fails. 2007-05-03 Simon Leinen * lib/SNMP_Session.pm: Added Mike Fischer as a contributor. ($VERSION): Incremented to 1.10. (receive_response_3): Added optional "dont_block" argument. If this is present and non-zero, pass MSG_DONTWAIT to the recv() call. MSG_DONTWAIT is wrapped in an eval, to avoid breaking the code on systems that don't have the flag. (request_response_5): Pass dont_block=1 to receive_response_3. According to Mike Fisher, Linux sometimes blocks on recv() even though a select() for readability has returned, for example when a checksum fails. 2007-01-06 Simon Leinen * lib/BER.pm: Updated copyright notice. (pretty_print): Use PDU names according to RFC3416. 2006-12-21 Simon Leinen * test/cricket-genconf-sensor: Try to install newly generated configuration, where possible. * test/cricket-genconf-sensor: Added header comment. * test/cricket-genconf-sensor: New script. 2006-12-15 Simon Leinen * test/entls (router_pretty_name): New subroutine, greps RANCID configuration file for `hostname' command. Caches the result so that files are only opened once. (print_physical): Use new forms of per-router defaults. * test/entls: Changed so that `-t' generates a Cricket configuration file to measure all transceivers that support DOM (Digital Optical Monitoring). This involves some structural changes. (print_phys_tree): Implemented in terms of the new `print_phys_tree_1'. (print_phys_tree_1): Maintain a stack of parent nodes when traversing the node tree. This stack is stored in each node's `parent_stack' slot, and can be used by the node class' `tostring' method. * test/entls ($print_vendor_type, $print_ent_physical_index): New variables. (Entity::PhysicalEntry::tostring): Added optional printing of index and entPhysicalVendorType, controlled by the above variables. 2006-10-12 Simon Leinen * lib/SNMP_Session.pm, lib/BER.pm: Updated copyright string. 2006-08-06 Simon Leinen * faq.html: Updated SNMPv3 text, mentioning that SNMPv3 is supported by MRTG 2.13 and up, using Net::SNMP. * lib/SNMP_util.pm (snmpLoad_OID_Cache): Strip single or double quotes around the OID and value. This allows us to read SunNet Manager OID files, which are also distributed by e.g. Cisco (ftp://ftp.cisco.com/pub/mibs/oid). Idea by Jan van Keulen, code cleanup by Mike Mitchell. 2006-07-13 Simon Leinen * lib/SNMP_Session.pm ($VERSION): Incremented to 1.08. * lib/SNMP_Session.pm (BEGIN): Bind the __DIE__ signal handler, so that detection of IPv6 capability works even when someone else has bound that handler. (Patch from Tobi Oetiker.) 2006-04-09 Simon Leinen * lib/SNMP_Table.pm (snmp_row_to_object): Added. 2006-04-05 Simon Leinen * test/trap-listener: Added prettyfication of OIDs. Suppressed less-than-useful output such as the trap community or the source port. 2006-03-16 Simon Leinen * README: Update copyright notice for 2006. 2006-02-17 Simon Leinen * test/entls: New "entls" script. 2006-01-20 Simon Leinen * test/qosls: Slight improvements in output for readability. * README: Credit Jan van Keulen. * lib/SNMP_Session.pm ($VERSION): Incremented to 1.08. * lib/SNMP_util.pm: Some fixes from Mike Mitchell, notably in the area of OID translation. 2006-01-17 Simon Leinen * test/find-admin-up-oper-down.pl: Find interfaces that are admin up but oper down. 2006-01-15 Simon Leinen * index.html: Fixed $session -> $trap_session in trap receipt example. Thanks to rahul shah for noticing this. 2005-12-10 Simon Leinen * lib/SNMP_Session.pm (SNMPv2c_Session::map_table_start_end): Slight reindentation. * lib/SNMP_Session.pm (SNMPv2c_Session::map_table_start_end): Call `SNMP_Session::index_compare' rather than just `index_compare'. 2005-11-05 Simon Leinen * faq.html: Upgraded SNMP URI syntax reference from draft to RFC 4088. 2005-07-12 Simon Leinen * changes.html: Added missing `mailto:'. * index.html, changes.html: README.SNMP_util -> dist/ 2005-07-08 Simon Leinen * lib/SNMP_util.pm (snmpwalk_flg): Bug fix by Laurent Girod. 2005-04-24 Simon Leinen * lib/SNMP_Table.pm: Repository : :ext:diotima:/home/leinen/CVS Module : SNMP_Session/lib Working dir: ~/perl/SNMP_Session/lib/ In directory .: Up-To-Date 1.38 BER.pm Up-To-Date 1.145 SNMP_Session.pm Added SNMP_Table.pm Up-To-Date 1.51 SNMP_util.pm --------------------- End --------------------- -- last cmd: cvs -f status -v -- 2005-03-29 Simon Leinen * test/qosls: *** empty log message *** * test/if-counters.pl: New options: -B to avoid use of get-bulk. -C to avoid use of curses. * test/bgpls: *** empty log message *** 2005-01-21 Simon Leinen * faq.html: Updated. 2004-12-19 Simon Leinen * test/msdpls: Added `-n' option to suppress resolving IP addresses. (usage): Made more readable. * test/msdpls (usage): Explain options. * test/msdpls (usage): Added. 2004-12-07 Simon Leinen * lib/SNMP_Session.pm: Removed strange formatting. 2004-11-05 Simon Leinen * test/sorrento-nest-list (%short_types): Added a few new types. (@nestmasters): Beginning of update. 2004-10-29 Simon Leinen * lib/SNMP_Session.pm: Require BER.pm 1.05. ($VERSION): Incremented to 1.07. * lib/SNMP_Session.pm: context_flag -> context_flag() to fix error message from "use strict subs" with recent Perl versions. Acknowledged Gerry Dalton. * changes.html: Documented 1.06 (SNMPv2 inform parsing) and 1.07 (strict subs bug with newer Perl versions) changes to SNMP_Session.pm. * MANIFEST (META.yml): Added by MakeMaker. * README: Added Gerry Dalton. 2004-09-17 Simon Leinen * test/if-counters.pl: Added `-s' option to look at L3 switching statistics on a Catalyst 6500 and probably some other Cisco L3 switches. (out_switching_engine): New subroutine. 2004-09-15 Simon Leinen * test/msdpls: Added `-d' flag. Added debugging output. 2004-09-04 Simon Leinen * lib/SNMP_Session.pm: Mention Andrew Cornford-Matheson in the header comment. * lib/SNMP_Session.pm ($VERSION): 1.05 -> 1.06. (decode_trap_request): Understand inform requests, too. 2004-09-02 Simon Leinen * README, index.html: CMU SNMP -> Net-SNMP. * index.html (decode_trap_request): Mention that it supports SNMPv2 informs, too. * README (Contributors): Added Andrew Cornford-Matheson. (decode_trap_request): Mention that it supports SNMPv2 informs, too. * changes.html: Upgraded to 1.05. 2004-08-23 Simon Leinen * index.html: New distribution site http://www.switch.ch/misc/leinen/snmp/perl/dist/ Made pointers more absolute. 2004-07-15 Simon Leinen * lib/BER.pm ($VERSION): Upped to 1.05. (BEGIN): Register various pretty printers. (pretty_printer): Simplified because most types are handled by registered pretty printers now. * lib/SNMP_Session.pm ($VERSION): Upped to 1.05. * changes.html: Document 1.04 change (in SNMP_util.pm). * ChangeLog: Updated using C-x v a. * index.html: Updated copyright years. * lib/SNMP_util.pm, lib/SNMP_Session.pm ($VERSION): Upped to 1.04. * lib/SNMP_util.pm (snmpget, snmpgetnext, snmpset): Use wantarray() to determine whether to return an array or just the first value. 2004-07-15 Simon Leinen * lib/SNMP_util.pm, lib/SNMP_Session.pm ($VERSION): Upped to 1.04. * lib/SNMP_util.pm (snmpget, snmpgetnext, snmpset): Use wantarray() to determine whether to return an array or just the first value. 2004-06-22 Simon Leinen * README: Updated copyright years. 2004-03-22 Simon Leinen * lib/SNMP_util.pm: Require recent versions of BER.pm and SNMP_Session.pm. ($VERSION): Incremented to 1.03. * lib/SNMP_Session.pm ($VERSION): Incremented to 1.03. * changes.html (SNMP_util.pm): Documented 1.03 fix. * lib/SNMP_util.pm (snmpwalk_flg): Added missing line from Mike Mitchell's patch. 2004-03-21 Simon Leinen * lib/SNMP_Session.pm ($VERSION): Incremented to 1.02. * changes.html: Document BER.pm 1.01 and 1.02. * lib/SNMP_Session.pm: Require BER.pm 1.01, because previous versions lack support for a variant of integer encoding. ($VERSION): Incremented to 1.01. 2004-02-17 Simon Leinen * BER-1.01-Mike-Mitchell.diff, BER-1.01-02.diff: Applied. * lib/SNMP_util.pm (snmpwalkhash, snmpwalk_flg): Implemented the new hash-reference argument. * changes.html: Documented BER.pm and SNMP_util.pm news in 1.02. * test/ber-test.pl: Use strict. Added function prototypes. * lib/BER.pm (%pretty_printer): New variable. This is a hash of pretty-printers per BER type code. It is manipulated by register_pretty_printer() and unregister_pretty_printer(), and used by pretty_print(). (register_pretty_printer, unregister_pretty_printer): New subroutines, contributed by Mike Mitchell. (pretty_print): If a pretty-printer has been registered for the type code, call it. (encode_intlike): In the Math::BigInt case, copy the integer before taking its bmod(), because bmod() is destructive. * README.SNMP_util: Document additional optional `hash ref' argument to snmpwalkhash(). 2004-02-08 Simon Leinen * lib/BER.pm (decode_intlike_s): Use decode_length(). (decode_length): Accept an optional second argument, specifying the offset into the first argument at which to begin parsing. This eliminates a substr() operation for every object. The callers have been adapted accordingly. * README: Added Milen Pavlov. 2003-12-14 Simon Leinen * lib/SNMP_Session.pm ($VERSION): 0.99 -> 1.00. * changes.html: 0.100 -> 1.00. * test/iftop: Added support for 64-bit counters. * lib/SNMP_Session.pm ($default_use_16bit_request_ids): New variable. (encode_request_3): Obey `use_16bit_request_ids' in request ID generation. * changes.html: Added note on `use_16bit_request_ids'. * README: Added Luc Pauwels as a contributor. 2003-12-04 Simon Leinen * index.html: Added new "Served Individual Item Link" to the "Essential SNMP" book on Amazon, but commented it out because it breaks the formatting. Removed the "NEW" icon from the existing Essential SNMP pointer. 2003-11-26 Simon Leinen * test/iftop: Adding iftop * test/README (iftop): Added URL. * test/README, MANIFEST: Added Dave Plonka's `iftop'. 2003-11-09 Simon Leinen * changes.html: Document Mike Mitchell's snmpset support for all known types. * lib/SNMP_util.pm (snmpset): Encode all known types. 2003-11-07 Simon Leinen * changes.html: Mentioned Christopher J. Tengi. * README, lib/SNMP_util.pm: Added Christopher J. Tengi to contributors list. * changes.html: Document 0.99 changes. * lib/SNMP_util.pm ($VERSION): Incremented to 0.99. * lib/SNMP_util.pm (snmpset): Support Gauge32 values. 2003-10-20 Simon Leinen * lib/SNMP_Session.pm ($VERSION): Incremented to 0.99. * lib/SNMP_Session.pm (SNMPv1_Session::open): Simplify initial request_id generation. * lib/SNMP_Session.pm (encode_request_3): Handle avoid_negative_request_ids in a saner way. Thanks to Mike Mitchell. 2003-09-26 Simon Leinen * test/trap-send: Added forward declarations. Thanks to Bret Allibone for pointing out the problem. 2003-09-09 Simon Leinen * changes.html: Documented 0.98 changes. * lib/SNMP_Session.pm ($VERSION): Incremented to 0.98. * lib/SNMP_Session.pm: Require BER version 0.95. Fixed a portability issue in the IPv6 code. * lib/SNMP_util.pm: Require BER version 0.95. 2003-09-08 Simon Leinen * lib/SNMP_util.pm: Changes from Mike Mitchell: Depend on SNMP_Session.pm 0.97. Fix parsing of OIDs with multiple quoted strings. ($VERSION): Incremented to 0.98. 2003-09-02 Simon Leinen * lib/SNMP_Session.pm: Undid most of the last change. * lib/SNMP_Session.pm: Removed ``use strict "subs"'' in a few places. * README: Added Joerg Kummer to credits. * lib/SNMP_util.pm ($VERSION): Increased to 0.97. (snmpset): Added TimeTicks support, courtesy Joerg Kummer. * changes.html: TimeTicks support in snmpset. * changes.html: Added IPv6; $default_avoid_negative_request_ids notes. * contrib/SNMP_util.pm, test/util-trap.pl, test/v6-list-prefixes, test/vc-counters.pl, test/verio-problem.pl: Initial import of the essential parts of SNMP_Session * contrib/SNMP_util.pm, test/util-trap.pl, test/v6-list-prefixes, test/vc-counters.pl, test/verio-problem.pl: New file. * faq.html, p2.htm, security.html, test/atol-test.c, test/bad-trap.pl, test/bay-atm-test.pl, test/bgp-check-routes, test/bulkwalkbug.pl, test/cammer, test/capturetest.pl, test/counter64-test.pl, test/d.pl, test/digital-bug, test/fore-test.pl, test/inexist.pl, test/list-bgp4-table, test/mcount.pl, test/mdebug, test/negative-counter.pl, test/sequence-bug.pl, test/set-test.pl, test/shipmr, test/snmptrap.note, test/snmptrap.pl: Initial import of the essential parts of SNMP_Session * faq.html, p2.htm, security.html, test/atol-test.c, test/bad-trap.pl, test/bay-atm-test.pl, test/bgp-check-routes, test/bulkwalkbug.pl, test/cammer, test/capturetest.pl, test/counter64-test.pl, test/d.pl, test/digital-bug, test/fore-test.pl, test/inexist.pl, test/list-bgp4-table, test/mcount.pl, test/mdebug, test/negative-counter.pl, test/sequence-bug.pl, test/set-test.pl, test/shipmr, test/snmptrap.note, test/snmptrap.pl: New file. 2003-06-30 Simon Leinen * README: Updated Philippe Simonet's e-mail. Added Valerio Bontempi and Lorenzo Colitti. * lib/SNMP_Session.pm ($SNMP_Session::default_avoid_negative_request_ids): Exported. 2003-06-04 Simon Leinen * lib/SNMP_Session.pm: Changes from Lorenzo Colitti: Avoid eval() in some places to make code more robust. 2003-05-29 Simon Leinen * test/wwwtest: Also use CGI.pm to generate HTML. * test/wwwtest (snmp_get, write_query_form): Use CGI.pm methods. * test/wwwtest: Use CGI.pm for query parsing. Open SNMPv2c_Session. (parse_query): Deleted. ($ipv4_only_p): New variable. * test/test.pl: Parse option arguments: `-4', `-v (1|2)'. * test/test.pl: Add subroutine prototypes; use strict. Use additional arguments to SNMP_Session->open to activate IPv6 code. * lib/SNMP_Session.pm (SNMPv1_Session::open): Create an IO::Socket::INET object, rather than an IO::Socket::INET6 object, whenever sockfamily is AF_INET. (SNMPv2c_Session::open): Avoid trying to bless() an undefined object, to improve error diagnostics. * test/wwwtest: Added subroutine prototypes. ($community_file_name): New variable. (write_query_form): Compute