From b2446e8a9841625abed2e0b67185751b7f17b208 Mon Sep 17 00:00:00 2001 From: elie Date: Sun, 5 Jul 2015 14:22:26 +0000 Subject: - original asynsock transport and AsyncsockDispatcher renamed into asyncore and AsyncoreDispatcher respectively to provide better hint to fellow devs on the underlying transport being used - backward compatibility preserved through dummy asynsock symbols --- CHANGES.txt | 1017 ++++++++++++++++++++ examples/v1arch/agent/cmdrsp.py | 6 +- examples/v1arch/agent/ntforg.py | 6 +- examples/v1arch/manager/bulkgen.py | 6 +- .../v1arch/manager/get-v2c-spoof-source-address.py | 6 +- .../get-v2c-udp-broadcast-agent-discovery.py | 6 +- examples/v1arch/manager/getgen.py | 6 +- examples/v1arch/manager/nextgen.py | 6 +- examples/v1arch/manager/ntfrcv.py | 6 +- examples/v1arch/manager/setgen.py | 6 +- .../agent/cmdrsp/v1-read-and-write-communities.py | 2 +- .../agent/cmdrsp/v2c-custom-scalar-mib-objects.py | 2 +- .../agent/cmdrsp/v2c-custom-tabular-mib-objects.py | 2 +- .../v3arch/agent/cmdrsp/v2c-multiple-interfaces.py | 2 +- .../v3arch/agent/cmdrsp/v2c-multiple-transports.py | 2 +- .../agent/cmdrsp/v3-alternative-mib-controller.py | 2 +- examples/v3arch/agent/cmdrsp/v3-alternative-mib.py | 2 +- .../v3arch/agent/cmdrsp/v3-custom-engine-id.py | 2 +- .../agent/cmdrsp/v3-multiple-snmp-engines.py | 6 +- examples/v3arch/agent/cmdrsp/v3-multiple-users.py | 2 +- .../agent/cmdrsp/v3-observe-request-processing.py | 2 +- .../v3-preserve-original-destination-address.py | 2 +- .../agent/ntforg/inform-multiple-protocols.py | 2 +- examples/v3arch/agent/ntforg/inform-v2c.py | 2 +- examples/v3arch/agent/ntforg/inform-v3.py | 2 +- .../agent/ntforg/trap-v1-from-specific-address.py | 2 +- examples/v3arch/agent/ntforg/trap-v1.py | 2 +- .../v3arch/agent/ntforg/trap-v2c-custom-pdu.py | 2 +- .../agent/ntforg/trap-v2c-multiple-addresses.py | 2 +- .../agent/ntforg/trap-v2c-multiple-targets.py | 2 +- .../agent/ntforg/trap-v2c-multiple-transports.py | 2 +- .../v3arch/agent/ntforg/trap-v2c-with-objects.py | 2 +- examples/v3arch/agent/ntforg/trap-v2c.py | 2 +- examples/v3arch/agent/ntforg/trap-v3.py | 2 +- examples/v3arch/manager/cmdgen/get-v1.py | 2 +- .../manager/cmdgen/get-v2c-custom-timeout.py | 2 +- .../manager/cmdgen/get-v2c-spoof-source-address.py | 2 +- .../v3arch/manager/cmdgen/get-v3-custom-context.py | 2 +- .../cmdgen/get-v3-observe-request-processing.py | 2 +- examples/v3arch/manager/cmdgen/get-v3.py | 2 +- examples/v3arch/manager/cmdgen/getbulk-v2c.py | 2 +- examples/v3arch/manager/cmdgen/getbulk-v3.py | 2 +- examples/v3arch/manager/cmdgen/getnext-v1.py | 2 +- .../cmdgen/getnext-v2c-from-specific-address.py | 2 +- .../getnext-v2c-with-mib-compilation-and-lookup.py | 2 +- .../v3arch/manager/cmdgen/getnext-v3-over-ipv6.py | 2 +- .../manager/cmdgen/getnext-v3-pull-subtree.py | 2 +- examples/v3arch/manager/cmdgen/set-v1.py | 2 +- examples/v3arch/manager/cmdgen/set-v2c.py | 2 +- examples/v3arch/manager/cmdgen/set-v3.py | 2 +- .../manager/ntfrcv/v2c-multiple-interfaces.py | 2 +- .../manager/ntfrcv/v2c-multiple-transports.py | 2 +- .../ntfrcv/v2c-observe-request-processing.py | 2 +- .../ntfrcv/v2c-with-regexp-community-name.py | 2 +- .../manager/ntfrcv/v2c-with-request-details.py | 2 +- .../v3arch/manager/ntfrcv/v3-multiple-users.py | 2 +- .../ntforg/inform-async-multiple-snmp-engines.py | 4 +- .../cmdgen/get-async-multiple-snmp-engines.py | 4 +- .../v3arch/proxy/cmd/udp6-to-udp4-conversion.py | 2 +- examples/v3arch/proxy/cmd/v2c-to-v1-conversion.py | 2 +- examples/v3arch/proxy/cmd/v2c-to-v3-conversion.py | 2 +- examples/v3arch/proxy/cmd/v3-to-v2c-conversion.py | 2 +- pysnmp/carrier/asyncore/base.py | 89 ++ pysnmp/carrier/asyncore/dgram/base.py | 154 +++ pysnmp/carrier/asyncore/dgram/udp.py | 14 + pysnmp/carrier/asyncore/dgram/udp6.py | 34 + pysnmp/carrier/asyncore/dgram/unix.py | 50 + pysnmp/carrier/asyncore/dispatch.py | 42 + pysnmp/entity/config.py | 2 +- pysnmp/entity/rfc3413/oneliner/target.py | 2 +- pysnmp/proto/secmod/rfc2576.py | 2 +- setup.py | 2 + 72 files changed, 1488 insertions(+), 86 deletions(-) create mode 100644 CHANGES.txt create mode 100644 pysnmp/carrier/asyncore/base.py create mode 100644 pysnmp/carrier/asyncore/dgram/base.py create mode 100644 pysnmp/carrier/asyncore/dgram/udp.py create mode 100644 pysnmp/carrier/asyncore/dgram/udp6.py create mode 100644 pysnmp/carrier/asyncore/dgram/unix.py create mode 100644 pysnmp/carrier/asyncore/dispatch.py diff --git a/CHANGES.txt b/CHANGES.txt new file mode 100644 index 0000000..7b751e8 --- /dev/null +++ b/CHANGES.txt @@ -0,0 +1,1017 @@ +Revision 4.3.0 +-------------- + +- Critical error fixed in key localization procedure for AES192/AES256/3DES + cyphers. Previous versions might never worked properly in this respect. +- Initial PySMI integration. Original ASN.1 MIBs could now be parsed, stored + at a local pysnmp MIBs repository and loaded into SNMP Engine. Relevant + example scripts added. Obsolete libsmi-based scripts removed. +- Major rewrite of native SNMPv3 CommandGenerator and NotificationOriginator + applications towards the following goals: + * avoid binding to specific SNMP engine instance to promote single + SNMP app instance using many SNMP engine instances + * support two APIs for working with request data: one operates on the + whole PDU object while the other on PDU contents + * keep callback context data in stack rather than in stateful application + cache + * newly introduced sendVarBinds() method offers a more functional and + logical signatures. + * Promote the use of dedicated classes for dealing with OID-value pairs. + Instances of those classes resemble OBJECT-IDENTITY, OBJECT-TYPE and + NOTIFICATION-TYPE MIB structures. + * keep backward compatibility for all existing major/documented interfaces +- Execution Observer facility implemented to give app an inside view + of SNMP engine inner workings. This is thought to be a generic + framework for viewing (and modifying) various internal states + of pysnmp engine. Previously introduced non-standard APIs (like + getting peer's transport endpoint which is not suggested in RFCs) + will be gradually migrated to this new framework. +- Initial support for the asyncio & Trollius frameworks and + coroutines-based SNMP Applications interfaces added. Both IPv4 and IPv6 + datagram transports are currently supported. +- Original asynsock transport and AsyncsockDispatcher renamed into + asyncore and AsyncoreDispatcher respectively to provide better hint + to fellow devs on the underlying transport being used. Backward + compatibility preserved. +- The asyncore-based transport subsystem extended to support POSIX + sendmsg()/recvmsg() based socket communication what could be used, + among other things, in the context of a transparent SNMP proxy + application. Technically, the following features were brought + into pysnmp with this update: + * Sending SNMP packets from a non-local IP address + * Receiving IP packets for non-local IP addresses + * Responding to SNMP requests from exactly the same IP address + the query was sent to. This proves to be useful when listening + on both primary and secondary IP interfaces. +- Internal oneliner apps configuration cache moved from respective + apps objects to [a singular] snmpEngine "user context" object. + That would allow for better cache reuse and allow for a single app + working with many snmpEngine instances. +- Legacy interfaces and APIs dropped in new oneliner AsyncCommandGenerator + and AsyncNotificationOriginator classes (notice 'c' in Async). Original + AsynCommandGenerator and AsynNotificationOriginator implementations + rebuilt on top of these new optimized versions keeping all the legacy + for compatibility reasons. These classes no more keep references to + SnmpEngine what makes them reusable with many SnmpEngine class instances. +- Oneliner GETBULK Command Generator now strips possible excessive OIDs + off the bottom of returned var-binds table. +- Built-in debugging is now based on Python logging module. +- Example on a single Transport Dispatcher use with multiple SnmpEngine's + in oneliner AsyncCommandGenerator & AsyncNotificationOriginator based + applicatons added. +- Example script on transport timeout & retries manipulation added. +- Example script explaining incoming message's communityName re-mapping added. +- Some more examples on MIB lookup and use at oneliner CommandGenerator added. +- Broadcast socket option can now be enabled with the .enableBroadcast() + call for any datagram-based transport (namely, UDP and UDP6). +- AbstractTransportDispatcher's jobStarted() and jobFinished() methods + now accept optional 'count' parameter which is a way for an app to indicate + how many responses are expected or have been processed in bulk. +- Example script on SNMP Agents UDP broadcast-based discovery added. +- Oneliner transport object now supports setLocalAddress() method to + force socket binding to specified local interface. +- New public DgramSocketTransport.getLocalAddress() returns local endpoint + address underlying BSD socket is currently bound to. +- Passing request details to access control callback at CommandResponder + reworked towards more robust and simple design with the execution observer + facility. +- MIB instrumentation example improved to cover table index building facility. +- Handle the case of null writer at Debug printer. +- Do not cache snmpEngineId & snmpAdminString at CommandGenerator to let it + be reused with many different snmpEngines. +- TRAP PDU agent address evaluation at proto.api made lazy to improve + startup time. +- Multiple fixes to verify pyasn1 decoder.decode() return to withstand + broken SNMP messages or its components. +- First attempt made to make some of SNMP Engine settings persistent + across reboots. +- Make config.delTransport() returning detached transport object. Asyncio + examples now use this facility to explicitly shutdown transport object. +- Parts of SMIv1 remnant MIBs (RFC1213-MIB, RFC1158-MIB) added to provide + complete compatibility with SMIv1. Symbols defined in these MIBs only + present in SMIv1 so they can't be substituted with their SMIv2 analogues. +- MibBuilder.addMibSources() convenience method added. +- The smi.MibBuilder() will now raise more specific exceptions (MibLoadError, + MibNotFoundError) on MIB loading problems rather than more generic + SmiError. +- The oneliner's MibVariable MIB lookup subsystem redesigned for more + generality to mimic OBJECT-TYPE macro capabilities related to SNMP + PDU handling. The two new classed are ObjectIdentity and ObjectType. + The ObjectIdentity class additionally supports just a MIB module name + initializer in which case if resolves into either first or last symbol + in given MIB. Another option is just a MIB symbol initializer without + specifying MIB module. + This new subsystem is moved from the scope of oneliner to more common + pysnmp.smi.rfc1903 scope to more naturally invoke it from whatever + part of pysnmp requires MIB services. +- MibBuilder now prepends the contents of environment variables it + recognizes (PYSNMP_MIB_DIR, PYSNMP_MIB_DIRS, PYSNMP_MIB_PKGS) rather + than using them instead of its default core MIBs. +- Removed RowStatus default value as it may collide with possible subclass + constraints. +- A few additional MIB tree management methods added to MibViewController + to better address ordered nature of MIB tree nodes (namely, getFirst*, + getLast* family of methods). +- Fix to authoritative engine side snmpEngineID discovery procedure: + respond with notInTimeWindows rather then with unsupportedSecurityLevel + at time synchronization phase. +- Fix to rfc1902.Bits type to make it accepting hex and binary initializers, + cope with missing bits identifieirs at prettyPrint(). +- Memory leak fixed in CommandForwarder examples. +- Fix to BULK CommandGenerator to use the same nonRepeaters OIDs across + multiple GETBULK iterations so returned table for nonRepeaters columns + would hold the same var-bind. +- Fix to CommandGenerator to make sendRequestHandle persistent across + multiple iterations of GETNEXT/GETBULK queries. +- Fix to sendNotification() error handling at NotificationOriginator. +- Fix to preserve possible 'fixed length' setting atrfc1902.OctetString + on clone()'ing and subtype()'ing. +- Fix to rfc1902.OctetString & Bits to base them on OctetString class to + make the 'fixed length' property working. +- Fix to .clone() method of rfc1902.Bits class to make its signature + matching the rest of classes. This may broke code which used to pass + namedValue parameter positionally rather than binding it by name. +- Fix to PDU translation service (proto.proxy.rfc2576) to make it + initializing errorIndex & errorStatus components of the resulting PDU. +- Fix to MsgAndPduDispatcher.sendPdu() to clean up request queue on + pysnmp-level processing failure. +- Fix to SNMPv1/v2c message processing subsystem to make it serving + unique PDU request-id's in both outgoing and incoming confirmed + and response PDU types. Duplicate request-id's in unrelated PDUs may + cause cache errors otherwise. +- Fix to licensing terms of multiple twisted backend modules to make + the whole pysnmp package licensed under BSD 2-Clause license. This + change has been explicitly permitted by the original modules authors. +- Fix to asyncore-based transport not to use asyncore's cheap inheritance + from socket object what caused warnings. +- Fix at NotificationOriginator to make is using MibInstrumentationController + when expanding Notification OBJECTS into Managed Objects Instances. +- Missing wrongLength and wrongEncoding SMI errors added. +- Fix to file descriptor leak at MibBuilder. +- Fix to rfc2576.v2ToV1() to ignore impossible errorStatus. +- Fix to rfc2576.v1ToV2() to reset ErrorStatus==noSuchName on proxying. +- Fix to smi.builder to explicitly fail on any MIB file access error + (but ENOENT) and raise IOError uniformly on any directory/egg access + failure. + +Revision 4.2.5 +-------------- + +- License updated to vanilla BSD 2-Clause to ease package use + (http://opensource.org/licenses/BSD-2-Clause). +- A dozen of lightweight Twisted-based example scripts replaced more + complex example implementations used previously. +- SNMP Proxy example apps separated into a larger set of more specialized + ones. +- Most of Command Generator examples re-pointed to a live SNMP Agent + at demo.snmplabs.com to ease experimentation and adoption. +- Multithreaded oneliner CommandGenerator example added. +- Packet-level SNMP API (pysnmp.proto.api) getErrorIndex() method can now + be instructed to ignore portentially malformed errorIndex SNMP packet + value what sometimes happens with buggy SNMP implementations. +- Standard SNMP Apps and built-in proxy now ignores malformed errorIndex + value. +- Built-in logging now includes timestamps. +- Multi-lingual capabilities of all CommandGenerator & NotificationOriginator + apps re-worked and improved. For instance it is now it's possible to run + getBulk() against a SNMPv1 Agent invoking built-in SNMP Proxy behind the + scene. +- The $PYSNMP_MIB_DIR & $PYSNMP_MIB_DIRS & $PYSNMP_MIB_PKGS path separator + made platform-specific. +- Change to rfc2576.v1tov2() logic: errorStatus = noSuchName is now + translated into rfc1905.noSuchObject exception value for *all* var-bindings + at once. Although RFC2576 does not suggest error-status -> v2c exception + translation, historically pysnmp used to perform it for a long time so we + can't easily stop doing that. +- Exception re-raising improved at MibInstrumController.flipFlopFsm() and + asynsock/twisted dispatchers so that original traceback is preserved. +- A single instance of transport dispatcher can now serve multiple + receivers (identified by IDs) chosen by a public data routing method. +- SnmpEngine.[un]registerTransportDispatcher() methods now accept optional + receiver ID token to be used by transport dispatcher's data router. This + allows for multiple SNMP engines registration with a single transport + dispatcher. +- Distribute is gone, switched to setuptools completely. +- The snmpCommunityTable row selection improved to follow RFC2576, clause + 5.2.1. +- Asyncore-based dispatcher attempts to use poll() whenever available + on the platform. It would help handling a really large number (>1024) + of file descriptors. +- AsynCommandGenerator.makeReadVarBinds() generalized into a new + makeVarBinds() method which replaces somewhat redundant code at setCmd() + and AsynNotificationOriginator.sendNotification(). +- AsynCommandGenerator.uncfgCmdGen() & AsynNotificationOriginator.uncfgCmdGen() + methods now accept optional authData parameter to remove specific entries + from LCD. This can be useful for modifying security parameters for + specific securityName. +- SNMP credentials management reworked to separate userName from securityName + in snmpCommunityEntry and usmUserEntry tables. Changes made to addV1System(), + addV3User() functions as well as to their oneliner's wrappers. +- The contextEngineId parameter of config.addV3User() and auth.UsmUserData() + renamed into securityEngineId as it's semantically correct +- Oneliner UsmUserData() and CommunityData() classes now support clone()'ing + to facilitate authentication data management in user applications. +- Oneliner transport target classes now support the getTransportInfo() + method that returns network addresses used on protocol level. +- Oneliner CommandGenerator.getNext() & .getBulk() methods now support the + maxCalls kwarg to limit the maximum number of iterations to perform. +- The config.addSocketTransport() helper renamed into config.addTransport() + and improved by automatically instantiating compatible TransportDispatcher + making it dispatcher-agnostic. As an additional bonus, application may not + call registerTransportDispatcher() as it would be called by addTransport(). +- The SnmpV3MessageProcessingModel.getPeerEngineInfo() method is implemented + to communicate discovered peer SNMP engine information to SNMP apps what + can be used for fine usmUserTable configuration. +- AsynNotificationOriginator.cfgCmdGen() does not take into account + securityModel & securityLevel when reducing LCD access via addTrapUser(). + This improves LCD consistency on sparse add/del operatons but also + does not let you to configure different securityModels per securityname + at VACM though the cfgCmdGen() wrapper. +- MIB builder traceback formatting and reporting improved. +- SNMP Engine object now has a snmpEngineID attribute exposed. +- Fix to inet_ntop()/inet_pton() support on Windows at TRANSPORT-ADDRESS-MIB. +- Fix to usmUserSecurityName table column implementation -- automatic value + generation from index value removed. +- Fix and significant logic rework of snmpCommunityTable to make it working + in both Generator and Responder modes and better follow RFC2576 + requirements on sequential entries lookup and selection. As a side effect, + untagged snmpCommunityTable entries will *not* match tagged + snmpTargetAddrTable entries and vice versa. +- Fix to Twisted-based NotificationOriginator to make it serving INFORMs again. +- Fix to rfc2576.v1tov2() logic: errorStatus = noSuchName is now translated + into rfc1905.noSuchObject exception value for *all* var-bindings. Although + this is not mentioned in RFC, it looks as a more consistent approach. +- Fix of rounding error to base I/O dispatcher's next timer call calculation. +- Explicit twisted dispatcher's timer resolution (of 1 sec) removed to make + use of global default of 0.5 sec. +- Fix to twisted/udp non-default local endpoint binding features. Common + socket ('host', port) notation is now supported. +- Fix to Twisted-based transport to make it closing UDP port / UNIX pipe + on shutdown. +- Fix to Twisted-based dispatcher not to close transport on unregistration + at dispatcher as transports can potentially be reused elsewhere. +- Fix to asyncore-based transport to work only with AsynsockDispatcher's + socket map and not to touch default asyncore's one. The latter have caused + dispatcher/transport restarting issues. +- The delV3User() function improved to drop all rows from USM table that + were cloned from the target one. +- Fix to exceptions handling at MsgAndPduDispatcher.sendPdu() to avoid + sendPduHandle miss (followed by system crash) on cache expiration run. +- Break cyclic references at CommandResponder and NotificationReceiver apps + through close() method. +- Fix to octet string typing at 3DES codec (used to throw an exception). +- Fix to SnmpAdminString, SnmpTagList, SnmpTagValue types to make them + supporting UTF-8 initializers. +- Fix to v1/v2c message processing module which used to refer to a + bogus stateReference in some cases what causes SNMP engine crashes. +- Fix to IPv6 transport to zero ZoneID, FlowID and ScopeID components + sometimes coming along with incoming packet. +- Fix to SNMPv1 MP module to pass stateReference to registered app on + unconfirmed notifications reception (to let NotificationReceiver + Apps browsing request details). + (transport information at the moment) at SNMP engine. +- Asyncsock sockets now configured with SO_REUSEADDR option to fix possible + Windows error 10048. +- Gracefully handle malformed SnmpEngineID at USM coming from SNMPv3 header. +- Typos fixed in error-status constants at CommandResponder +- Missing import added to oneliner auth module. +- Cosmetic changes to v3arch example scripts. + +Revision 4.2.4 +-------------- + +- SNMPv3 high-level and native API examples reworked and extended to cover + many use cases. +- The missing functionality of NOTIFICATION-TYPE objects being looked up + at local Management Instrumentation and attached to TRAP/INFORM message + by Notification Originator is now fully implemented. +- The missing functionality of passing Response PDU contents of INFORM + request is now implemented at Notification Originator app. The return + value of NotificationOriginator.sendNotification is now a composite object + that includes errorStatus, errorIndex and varBinds. +- The missing functionality of passing lookupNames & lookupValues params + to Notification Originator is now implemented. It may make sense for + INFORMs. +- The missing functionality of passing contextName to oneliner + version of NotificationOriginator.sendNotification is now implemented. +- Oneliner example apps now include cases where non-default SNMP + ContextEngineId/ContextName/SecurityEngineId is used. +- The contextName parameter of SnmpContext.getMibInstrum made optional. +- AbstractMibInstrumController class added as a base class for all possible + kinds of Management Instrumentation controllers. +- Report package version on debugging code initialization. +- MibInstrumController.getMibBuilder() added. +- I/O sockets buffer sizes made configurable, minimum default is now + forced to be no less than 2**17 (to fit two huge datagrams). +- Catch possible exceptions on pyasn1 encoder invocation. +- VACM modules converted from a function into an object to let it keep + state (caches) in the future. +- Unnecessary *MibSource explicit initialization calls removed at MibBuilder. +- Example configuration for Net-SNMP's snmptrapd added. +- Cast additionalVarBinds into ObjectIdentifier type at + NotificationOriginator.sendNotification() +- Standard SNMPv3 Apps hardened to catch protocol-related exceptions and + report them as errorIndication's. +- Catch and mute possible failure of getsockname(), that seems to happen + on Windows only so far. +- Memory leak fixed at oneliner cache of already configured targets. +- Fixes to at AsynNotificationOriginator.sendNotification() to make + a) the notificationType param mandatory b)t e varBinds param really + optional +- Fixes to ContextEngineId/ContextName support at the oneliner API: now + both items should be passed to request PDU through *Cmd() request + initiation method, the items of authData object should be used only for + LCD configuration. +- Fix to MibVariable handling of the MIB, initializers. +- Fix to outgoing queue processing order at socket transport. Now + it's a FIFO discipline rather than LIFO. +- Fix to NotificationOriginator's additionalVarBinds parameter - it is + not mandatory anymore with the oneliner API. Also additionalVarBinds + defaulted value changed from None to () meaning no var-binds. +- Attempt to convert Windows style EOL into UNIX ones in MIB source + modules appeared to be unnecessary and even destructive to modules + data in some cases. So the convertion code removed altogether. +- Fix to isAccessAllowed() error handling at NotificationOriginator. System + used to crash on access denied condition. +- Fix to NotificationOriginator to make it use system uptime and trap OID + values from SNMP engine's instrumentation rather then from SNMP context. +- Fix a couple of bugs at MibTable* logic involved for table instances + creation. +- Fix to Management Instrumentation code to handle cases of non-initialized + or not-compliant-to-constraints Managed Objects Instances. +- Fix to Management Instrumentation code to make table row removal through + SNMP working again. Wrong method (instumClone) was probed at terminal + MIB nodes values instead of the right one (setValue). + +Revision 4.2.3 +-------------- + +- SECURITY FIX: USM subsystem did not verify securityLevel of a request + to an authoritative SNMP engine against auth/priv protocols + configured for the user in question. That allowed unauthenticated/unciphered + access to pysnmp-based Agent even if USM user is configured to provide one. +- Oneliner [Asyn]CommandGenerator now supports optional keyword args + lookupNames, lookupValues that enable response OID / value looked up at + MIB and reported as a MibVariable container object carrying relevant + MIB info. +- Oneliner [Asyn]CommandGenerator now supports symbolic MIB object names to be + passed within a MibVariable container object which would do a deferred + MIB lookup for name resolution. This is a new and preferred API which + obsoletes the tuple-based one (it is still suppored though). +- Oneliner CommandGenerator's class attributes lexicographicMode, maxRows + and ignoreNonIncreasingOid moved to optional keyword args of nextGen() + and bulkGen() methods. +- IPv6/UDP and Local Domain Socket transport interfaces added to the + oneliner API. +- Mib Instrumentation subsystem re-worked to replace excessive + MibNode's smiCreate()/smiWrite()/smiDestroy() methods with + MibScalarInstance's getValue()/setValue() +- MibTree.readTest[Get]Next() reworked to be called uniformely so + user could tap on these methods at any level of the MIB tree. +- MibTableColumn.getNextNodeWithValue() unpublished API method obsoleted + and removed for clarity. +- Hex dumps of binary parts of the protocol added to ease system + operations analysis. +- SnmpEngineId autogeneration does not call DNS resolver but uses + local hostname not to depend upon local IP availability and performance. +- Example apps reworked, additional SNMPv3 auth/priv protocols and transports + added. +- Package version is now available as __init__.__version__ and it is + in-sync with distutils. +- Package meta-information updated. +- The __init__.py's made non-empty (rumors are that they may be optimized + out by package managers). +- Multiple fixes to UNIX domain socket transport to make it fully + operational again. +- Use sysUpTime value whenever it is included in Notification PDU, otheriwese + resort to SNMP engine uptime reading. +- SNMPv2c Message is now defined in rfc1901.py what matches standard + definition. +- Types defined within SNMPv1/v2c data structures (rfc1157.py/rfc1905.py) + moved to module scope to become accessible by wrapper routines + (v1.py/v2c.py). This is used for setting strictly typed default values + to corresponding SNMP data structures. +- The obsolete and unpublished MibInstrumController.readVarsFast() method + removed for API clarity. +- MibBuilder now distinguishes case of MIB modules filenames even if + underlying OS does not. +- LCD configuration caching is implemented at pysnmp.entity.rfc3413.config + that improves performance of repetitive calls by 10% and might hugely + improve NotificationOriginator's performance when working on a large + number of targets. +- A caching maps implemented at rfc2576 subsystem to speed-up communityName + to/from securityName resolution. The also makes transport tags processing + better compliant to the standard. +- Community and Transport tags processing changed at the oneliner interface + to make the whole mechanism more compliant with the standard. Most + importantly, it is now possible to tag authentication and transport + information separately. +- The NoSuchInstanceError exception class is no more inherits from + NoSuchObjectError to make class hierarchy closer to SNMP specification + which states that these errors are separate and independent. +- The Next & BulkCommandGenerator's split onto single-run and iterative + impementations. The former just process a single interaction and complete + while the latter run as many interactions as user callback function + indicates to. +- The pysnmp.entity.rfc3413.mibvar module is now obsolete by + pysnmp.entity.rfc3413.oneliner.mibvar featuring basically the same + features but within a stateful, dedicated object. +- Auth & target configuration container classes moved to their separate + modules at oneliner API. +- The notificationType parameter of AsynNotificationOriginator.sendNotification + made defaulted to reflect its optional nature. +- Oneliner UsmUserData, UdpTransportTarget, Udp6TransportTarget instances + are not hashable anymore as they are intended to act more like a data + structure than object. +- Built-in debugger now supports negating debugging categories. +- An async/getgen.py example script added. +- Fix to MIB data reading routine to make it working with possible + Windows end-of-line's. +- Fix to CommandGenerator's SNMPv3 engine autodiscovery algorithm + when retryCount is administratively set to 0. +- Fix to Notification Originator to make it communicating a single + sendPduHandle to an application even when multiple INFORMs are triggered + and processed by a single call by way of transport tagging feature. +- Fix to rfc2576:processIncomingMessage() to take SecurityModel into account + when lookup up SecurityName by CommunityName. This allows mixed SNMPv1/v2c + communication with the same target. +- Fix to internal MessageProcessing and SecurityModel timers so they become + dependant on system timer resolution. +- Fix to v1.PDUAPI.setDefaults() method that used to set wrongly typed + time-stamp component. +- Fix to IPv6 address handling to prevent system from crashing whilst + running Python3. +- Fix to SNMPv2 exception objects translation into SNMPv1 PDU and NEXT + OIDs calculation. +- Fix to MibTree class to properly report noSuchObject & noSuchInstance + SNMP special values. +- Fix to libsmi2pysnmp tool to make it working again in Python < 2.7 +- Fix to exception handling at decodeMessageVersion() caller to prevent + ASN.1 parsing errors crashing the whole app. +- Fix to GenericTrap type processing at rfc2576:v1Tov2c() which used to + crash the whole SNMP engine. +- Fix to [possibly uninizilaized] pyasn1 objects printouts at + MibInstrumController.__indexMib() +- Fix to maxSizeResponseScopedPDU calculation at rfc3414/service.py. +- Dedicated 'withmib' example set is obsolete and removed. +- Another SNMP proxy example app added (1to3.py). +- Fix to MIB modules loading code to make it using __import__() properly. + This also makes pysnmp working again with Python 3.3rc0. +- Typo fix to snmpInASNParseErrs MIB instance object. +- Typo fix to errind.EngineIdMismatch class and its instance. + +Revision 4.2.2 +-------------- + +- Oneliner CommandGenerator can now limit the number of SNMP table + rows returned by nextCmd()/bulkCmd() methods. +- Oneliner CommunityData configuration object can now be initialized + with community name only, security name will be chosen automatically. +- Oneliner LCD configuration routines reworked towards clarity. The + side-effect of this change is that repetitive oneliner call with the same + securityName and different configuration options will only honor + the first settings. Previous implementation would override older settings. +- Transport dispatcher now provides its own time expressed in + fractions of second. SNMP engine uses this notion of time for + handling requests timeout to make packet flow time bound + to async I/O core operations rather than to real time. +- The libsmi2pysnmp tool improved to handle incomplete SMI v1->v2 + conversion performed by smidump. The remaining core SMIv1 modules + excluded from the core MIB set. +- The pyasn1 constraint and enumeration objects put into ASN1-* + MIB modules what appears to be more in-line with SMI. Existing + MIB modules as well as libsmi2pysnmp tool corrected accordingly. +- SMIv1 MIB modules (including RFC1155 and RFC1213) were moved to + pysnmp-mibs as pysnmp is SMIv2-based. +- The MibBuilder.importSymbols() now takes optional kwargs and + push them into MIB modules globals(). This is to facilitate + passing user infomation, such as DB connection handler, to MIB + module namespace so it could be used by ManagedObjects implementations. +- When running on Python3, SMI will re-raise exceptions with the original + traceback for easier diagnostics. +- Out of PYTHONPATH MIB paths now supported. +- Added pyasn1 decoder failures diagnistics in debug mode. +- Fix to non-MT-safe class attributes at SNMPv3 MP & SEC modules. +- Fix to ContextName handling in bytes form whilst running Python3. Data + mismatch error would return otherwise. +- Fix to SNMPv3 MP peer engine ID discovery not to learn and use + user-specified ContextEngineId. +- Fix to socket.error processing at Py3 on Windows. +- Fix to oneliner GETNEXT/GETBULK implementation to properly support + ignoreNonIncreasingOIDs option. +- Fix to setEndOfMibError()/setNoSuchInstanceError() at v1 PDU not to + loose errorIndex. +- Fix to api.v2c.getVarBindTable() to ignore possible non-rectangular GETBULK + response tables. +- Fix to oneliner getnext/getbulk response table rectangulation procedure + to gracefully handle an empty column condition. +- Fix to legacy MibBuilder.getMibPath() to prevent it from missing + .egg-based components in path. +- Fix to oneliner configuration routine that used to implicitly + tag SNMPv1/v2c auth and transport LCD rows what resulted in + huge delays when processing incoming messages with large number + of peers configured. +- Fix to UDP6 transport handling at rfc2576 security module. +- Fix to SnmpEngineID value autogeneration (used to fail on Mac). +- SNMPv2-SMI.ObjectType.__repr__() fixed to do a repr() on its components. +- All SNMPv2-SMI.MibNode-based objects, once exported to a mibBuilder, will + carry an embedded label symbol. +- Exlicit repr() calls replaced with '%r' +- Fix to error processing at GETNEXT & GETBULK apps response handlers. +- Fix to libsmi2pysnmp to make it supporting long (256+) list of function + params. +- Fix to libsmi2pysnmp to support inheritance of MIB types. + +Revision 4.2.1 +-------------- + +- Support string OIDs at one-liner API. +- Code quality of libsmi2pysnmp tool improved, MIBs re-built. +- SNMP-PROXY-MIB & SNMP-USER-BASED-SM-3DES-MIB added +- v1arch bulkgen.py example added +- Major overhawl for Python 2.4 -- 3.2 compatibility: + + get rid of old-style types + + drop string module usage + + switch to rich comparation + + drop explicit long integer type use + + map()/filter() replaced with list comprehension + + apply() replaced with */**args + + dictionary operations made 2K/3K compatible + + division operator made 2K/3K compatible + + sorting function now operates on key + + iterators returned by some funcs in py3k converted to lists + + exception syntax made 2K/3K compatible + + tuple function arguments resolved to scalars to become py3k compatible + + BER octetstream is now of type bytes (Py3k) or still string (Py2k) + +Revision 4.1.16d +---------------- + +- Fix to SNMPv1 Trap PDU agentAddress setter shortcut method. + +Revision 4.1.16c +---------------- + +- Missing module import fixed in privacy subsystem + +Revision 4.1.16b +---------------- + +- Oneliner CommandGenerator can now optionally ignore non-increasing OIDs. +- Default CommandResponder now skips non-compliant (Counter64) values + when responding to a v1 Manager. +- Fix to state information handling at CommandResponder app. +- Fix to Twisted reactor shutdown condition. +- Fix to distutils dependencies syntax. + +Revision 4.1.16a +---------------- + +- Extended Security Options (3DESEDE, AES192, AES256) privacy + protocols implemented. +- The error-indication codes moved from literals to objects for reliability + and clarity +- Fix to v1.TrapPDUAPI.getVarBinds() to address PDU component at the right + position. +- Fix to rfc1902.Bits initialization from named bits sequence. +- Fix to MIB builder by-extension module filtering code to cope with .pyw + files. +- Internal caches structure improved. +- Sync versions of oneliner apps split off async implementation for clarity. +- Randomize initial in various numeric sequences. +- MsgAndPduDsp expectResponse parameters passing reworked. +- GetNext/GetBulk response processing logic moved to getNextVarBinds() +- Changes towards performance improvement: + + all dict.has_key() & dict.get() invocations replaced with modern syntax + (this breaks compatibility with Python 2.1 and older). + + introduce the MibInstrumControlle.readVarsFast() method (which skips + the "testing" phase of MIB value readin) for dealing with internal + configuration (LCD). + + default debug.logger is now just a zero value instead of an object + what saves big on frequent calls + + SNMPv2-SMI columnar indices <-> index values convertion code optimized. + + pre-compute and re-use some of ASN.1 structures. + + avoid setting PDU defaults to save on unnecessary initialization. + + skip ASN.1 types verification where possible. + + at oneliner Command Generator, avoid looking up pure OID arguments + at MIB as it's pointless but takes time. + + cache MIB columnar objects instance ID <-> symbolic index representation + mapping + +Revision 4.1.15a +---------------- + +- SNMP Proxy example added. +- End-of-MIB condition detection reworked what caused backward + incompatibility at v1arch GETNEXT API. Previous pysnmp versions + used value = None in var-binds as returned by getVarBindTable() + API method. This version uses rfc1905 exception values (v2c/v3) + or pyasn1 Null (v1). + Built-in GETNEXT/GETBULK apps now do not require user to track + end-of-mib conditions anymore -- this is now done automatically. +- CommandResponder API now supports async mode of operation. +- SNMP exception values now exported from rfc1905 module, and made + pretty printable. +- Lexicographic walking mode is now supported at oneliner CommandGenerator. +- ContextEngineId&ContextName parameters passing implemented at + v3arch oneliner API. +- Multiple instances of the same transport domain now supported. +- Initial snmpEngineId value generation improved not to accidentally + collide within an administrative domain. +- MibTableColumn instances now build value-to-column-instance map + to speedup by-value search. +- SNMPv2-CONF::AgentCapabilities macro implemented. +- The libsmi2pysnmp tool handles some more MACROs. +- Void access control module implemented to let apps disabling [default] VACM. +- Allow standard SNMP apps to choose access control method to use. +- Twisted-based CommandResponder example added. +- Fix/rework of Twisted GETNEXT/BULK CommandGenerator callback API to + make it simpler and uniform with other CommandGenerators +- Fix to SNMPv3 security module to store peer SNMP engine timeline + only if taken from an authenticated message. Prior to this fix + SNMP engine was not been protected from spoofing. +- Fix to $SMIPATH initialization at build-pysnmp-mib. +- Fix to maxSizeResponseScopedPDU calculation. +- Fix to Next/Bulk CommandGenerators to catch a non-increasing OID + error condition (what prevents looping). +- Fix to Opaque value tagging at rfc1155.Opaque type. +- Fix to handle (fail gracefully) zero-length user password. +- Fix to SNMP error propagation at Twisted driver (SF tracker ID #3054505). +- Fix to Agent-role snmpEngineId discovery procedure that allows + authenticated ReportPDU generation. +- Fix to SNMPv1 PDU handling at CommandResponder & NotificationReceiver + apps. +- Fix to CommandResponder app to skip Counter64 SMI values when responding + to SNMPv1 Manager. +- Fix to protocol translator code (rfc2576) to handle Counter64 type + in v2c-to-v1 PDU translation. +- Fix to non-response var-binds translation in rfc2576.v2ToV1(). +- Fix to wrong exceptions used in pysnmp/entity modules. +- Fix to noauth/nopriv security module so that it would not crash SNMP + engine if called accidentally. +- Fix to CommandResponder not to return out-of-range errorIndex along + with genErr +- Fix to GETBULK CommandResponder to do a by-column MIB walk, not by-raw. +- Fix to getVarBindTable() API function logic. +- Fix to example Manager scripts to use errorIndex when available. +- Fix to dummy encryptData()/decryptData() API +- Fix to oneliner GETBULK table collection code to make it stripping + uneven rows off table tail. + +Revision 4.1.14a +---------------- + +- Fix to maxSizeResponseScopedPDU calculation at USM security module: now + more precise and robust against screwed values on input. +- Fix to MIB loading logic that used to load same-name modules at + disticts search paths on each loadModules() call. +- Fix to AsynsockDispatcher.runDispatcher() to make use of optional + non-default select() timeout value. +- AbstractTransportDispatcher now allows user application registering + multiple timer callbacks each with dedicated call period. +- Asynsock mainloop default idle period reduced to 0.5 sec for better + timer resolution. +- Fix to SNMPv1->SNMPv2c error status handling at proxy module. This + defect may have caused an infinite loop on a multiple var-bind + SNMPv1 GetNext operation. +- Fix to contextName processing at config.addV1System -- typo rendered + passed contextName not committed into LCD. +- Fix to unknown ContextName exception handling at CommandResponder App. +- config.addVacmUser() now accepts an optional contextName what makes + it usable for configuring multiple contextName-bound bases of Managed + Objects to SnmpEngine. +- MP pending states cache management re-worked so that SNMP engine will + now handle an unlimited number of pending request/responses. +- Fix to SNMP discovery procedure: include ContentName in SNMP discovery + messaging. +- Many fixes to AES crypto code that makes it actually working. +- Fix to SNMPv2-SMI createUndo operations. +- Fix to INFORM sending error handling at oneliner. +- Fix to mismatched response PDU handling at CommandGenerator application. +- Debug category 'app' (for Application) added to facilitate + Standard SNMP Applications debugging. +- The retryCount semantic of CommandGenerator application changed to include + sole retries and do not include initial request. Thus, retryCount=1 will + now send up to two packets, not just one as it used to be. +- Debugging printout now escapes non-printable characters. + +Revision 4.1.13a +---------------- + +- UDP over IPv6 transport implemented. +- Fix to MIB tree walking code that used to fail on table columns where + indices have identical leading parts. +- SNMPv1/v2c snmpCommunityTransportTag-based imcoming message filtering + implemented (rfc2576). + +Revision 4.1.12a +---------------- + +- API versioning retired (pysnmp.v4 -> pysnmp). +- MIB loading mechanics re-designed to allow ZIP import. +- MIB loader supports code objects (py[co]) +- Installer now uses setuptools for package management whenever available. +- The libsmi2pysnmp tool improved to build constraints of more than + 256 items (Python has a limit on the number of function params). +- Missing SNMPTrap PDU API implemented at proto.api.v2c, RFC2576 proxy + code reworked. +- Fix to sysUpTime OID at SNMPv2 TRAP PDU. + +Revision 4.1.11a +---------------- + +- Twisted integration implemented. +- Attempt to use hashlib whenever available. +- Fix to oneliner Manager code on < Python 2.4. +- Let NotificationReceiver and CommandResponder Apps browsing request details + (transport information at the moment) at SNMP engine. +- Fix to config.addV1System() to allow multiple systems to co-exist in LCD. +- Fix to wrongly succeeding user-parameters-by-community-name searching code + in rfc2576 processIncomingMsg() method. +- Do sanity checking on PYSNMP_MODULE_ID, Groups and Notifications in + libsmi2pysnmp (SF bug #2122489). +- Fix to oneliner Notification Originator that sometimes used to send multiple + requests at once. +- Oneliners LCD names generation code reworked to avoid accidental clashes. +- Fix and re-work of sysUpTime value management in LCD. +- Fix to pending inform request data caching in mpmod/rfc2576.py -- previous + code led to cache data corruption on multple outstanding requests. +- In SMI configuration wrapper functions, catch access to non-configured + entries and raise an exception. +- Allow multuple callback timer functions in all transport dispatchers. +- Fix to libsmi2pysnmp code to preserve more underscored object names and + to guess the right type between indistinguishable ObjectGroup & + NotificationGroup +- Fix to MibScalarInstance value setting logic - previous code failed + when modifying the same OID multiple times within a single SET operation. +- Minor usability improvements to tools/build-pysnmp-mib. +- Made MIB objects unexport feature operational. + +Revision 4.1.10a +---------------- + +- Internal MIB indexing method __indexMib() unmangled to facilitate + setting up mutex there for sharing MIB stuff between threads. +- Fixed broken IpAddress value handling in SET operation. +- Broken MibBuilder.unloadModules() method now works. +- Use getLabel() SMI object method when building MIB tree (in builder.py) + in addition to direct attribute access for clearer object protocol. +- The MIB building tools updated to match significantly improved + smidump tool (libsmi version > 0.4.5). +- Made libsmi2pysnmp tool optionally building MIB text fields into pysnmp + MIB code (enabled by default) and MibBuilder conditionally loading them + up (disabled by default). +- SnmpEngine and MsgAndPduDispatcher constructors now optionally + take msgAndPduDspr and mibInstrumController class instances + respectively to facilitate these objects sharing within a process. +- Unique integers, for various parts of the system, are now generated + by a nextid.py module. This fixes possible issues with duplicate + request IDs and handlers. +- Built-in MIBs re-generated to include text fields. + +Revision 4.1.9a +--------------- + +- UNSTABLE ALPHA RELEASE. +- At onliner CommandGenerator, close transport on destruction to + prevent socket leak. Implicit async transports registration at + default asyncore's socket map has been disabled to avoid side + effects. +- Fix to rfc2576.v1ToV2c() PDU converter to perform noSuchName error code + translation. +- Fixes to Notification PDU convertion code at rfc2576 in part of + snmpTrapOID handling. +- Fix to nonRepeaters object use as sequence slicer (must be int) at + cmdrsp.CommandResponderApplication +- Make AsynsockDispatcher using its own socket map by default for + threading safety. This will break asyncore apps that rely on pysnmp + sharing the same socket map with them. A solution would be to either + set asyncore map to pysnmp (AsynsockDispatcher.setSocketMap()) or pass + pysnmp map (AsynsockDispatcher.getSocketMap()) to asyncore. +- Fix to response timeout roundup bug at CommandGenerator and + NotificationOriginator code. +- Oneline configuration classes made hashable to prevent memory leaks + when committing them into CommandGenerator/NotificationOriginator + internal repository. +- Security information is now released properly in all MP modules. + This might fix a significant memory leak. +- Typo fix to rfc3411 confirmed class PDU members. + +Revision 4.1.8a +--------------- + +- UNSTABLE ALPHA RELEASE. +- SMI/dispatcher timeout convertion multiplier is actually 100 (1/100 sec) + rather than 1/1000. This fix affects timeouts specified through SMI. +- __repr__() implemented for UdpTransportTarget, CommunityData, UsmUserData + in oneliner module. +- Automatically initialize table index values on table management + operations (SF bug ID #1671989). +- Fix to carrier code: ignore BADFD socket error as it may happen upon + FD closure on n-1 select() event. +- Fix to MibBuilder.setMibPath() to preserve previously loaded modules + intact. Otherwise loadModules() called after setMibPath() might fail + with 'MIB file not found in search path' exception. +- Fix to oneliner classes that now invoke unconfiguration methods on + destruction. This might have caused memory leaks. +- Automatically initialize SNMP-USER-BASED-SM-MIB::UsmUserSecurityName + columnar object instance on creation, as stated in DESCRIPTION (SF + tracker ID #1620392). +- Fix to USM timeframe arithmetics (SF bug #1649032). +- VACM shortcuts merged into universal add/delVacmUser() to let notifications + and requests to co-exist for the same user. +- At oneliners, build LCD tables keys from a hashed mix of input parameters + to make sure these automatic entries won't interfere or exceed constraints + on keys values. +- Made use of notificationType parameter of the sendNotification method + in NotificationOriginator applications. This parameter used to be + ignored in the past. Note, that previously used (and ignored) syntax + has been changed in an incompatible way. +- Allow plain Python values in setCmd() and sendNotification() + methods in CommandGenerator and NotificationOriginator applications + respectively. +- Multi-target oneliner API-based example script added. +- Ignore more socket errors in datagram-type async socket code. +- AES cipher now supported (rfc3826). +- Fix to messed up tagIDs of noSuchInstance and noSuchObject types. +- SET Command Responder fixed to obscure access to non-existing variables + by returning notWritable error (SF bug #1764839). +- AsynsockDispatcher.setSocketMap() method added to facilitate pysnmp + transport integration into third-party asyncore-based applications. +- Fix to errorIndex generation at CommandResponder application, the value + should be a one-based. + +Revision 4.1.7a +--------------- + +- UNSTABLE ALPHA RELEASE. +- Low-level debugging facility implemented. +- Support UdpTransportTarget timeout and retries parameters in oneliner API. +- Fix to snmpTrapOID construction at ...proxy.rfc2576.v1ToV2() + function. +- Fix to MibViewController.getNodeName() to take MIB module name + into account (SF bug #1505847). +- Do explicit check for Counter32,Unsigned32,TimeTicks,Counter64 value types + in MibTableRow index convertion and in TextualConvention.prettyPrint() + methods (SF bug #1506341). Handle Bits in indices as RFC2578 suggests. +- Apply read-create column status to libsmi2pysnmp-generated code + whenever MIB text specifies that (SF bug #1508955). +- Honor and apply DISPLAY-HINT specification when building TextualConvention + class at libsmi2pysnmp. +- Managed Objects Instances files (smi/mibs/instances/) are now + double-underscore prefixed to make them imported explicitly by these + prefixed names. They used to be imported as a side-effect of + Managed Objects files import what is way too hackerish. +- The libsmi2pysnmp now supports future libsmi bugfix that would generate + "ranges" subtree along with the legacy and ambiguous "range" one. +- SMI support for fixed-length string indices implemented (SF bug #1584799, + #1653908). +- Managed Object Instances may now have smiRead, smiWrite, smiCreate methods + to support specific value mangling. These methods, if present, would be + invoked from SNMP [Agent] core instead of conventional clone() method. + The reason is to separate trivial value duplication from specific + Instance value mangling that may have Agent-specific side effects + (such as RowStatus). +- MIB table row destruction now works (SF bug #1555010). +- LCD unconfiguration functions for oneliners implemented (SF bug #1635270). +- unloadModules() and unexportSymbols() implemented at MibBuilder +- Notification type PDU proxy code fixed to produce symmetrical + convertion. +- Various SNMP engine-internal caches expiration implemented. +- SMI-level access control now takes effect only if AC object is + passed to MIB instrumentation API. +- LCD management code now uses generic MIB instrumentation features. +- Fix to oneliner manager code to have individual UdpSocketTransport + instance per each SnmpEngine. Multithreaded apps might fail otherwise. + (SF bug ID #1586420). +- Exclude the PYSNMP_MODULE_ID symbol from MIB view index, as it may get + resolved into OID label instead of actual MIB object name. +- Memory leak fixed in indices.OidOrderedDict implementation. +- Fix to VACM shortcuts to let notifications and requests to co-exist + for the same user otherwise. +- Fix to ...oneliner.cmdgen.UsmUserData to support non-default ciphers. +- USM now uses local notion of snmpEngineBoots/Time when authoritative + and cached estimate otherwise. Also, a security fix applied to to USM + time-window verification (SF bug #1649032). +- Fix to notification objects resolution code at + NotificationOriginator.sendNotification() +- Do not raise securityLevel for USM error reports that lacks user + information, as these reports could never be ciphered (SF bug #1624720). +- Non-default BULK PDU params now actually applied. +- SnmpEngineID default value generation algorithmic function changed + to allow multiple SNMP engines running on the same host. +- Documentation updated. +- A handful of minor fixes applied (SourceForge tracker IDs #1537592, + #1537600, #1537659, #1548208, #1560939, #1563715, #1575697, #1599220, + #1615077, #1615365, #1616579). + +Revision 4.1.6a +--------------- + +- UNSTABLE ALPHA RELEASE. +- pysnmpUsmSecretAuthKey and pysnmpUsmSecretPrivKey length increased + up to 256 octets. There seems no limit on this in RFC, though. +- A workaround for probably broken Agents: SNMPv3 Manager code defaults + ContextEngineId to SecurityEngineId whenever ContextEngineId is not + reported by authoritative SNMP engine on discovery. +- Use empty PDU in engine-discovery report at mpmod/rfc3412.py. +- MibBuilder.loadModules() now fails on missing MIB files. +- MibBuilder.exportSymbols() now accepts unnamed objects (likely Managed + Objects Instances) +- SNMPv2-SMI.MibScalarInstance objects now support create*/destroy* + Management Instrumentation methods to pass Columnar Object creation and + removal events. MibTableColumn class invoke these methods accordingly. +- Fix to AsynNotificationOriginator.asyncSendNotification() callback + formal parameters +- Initial VACM configuration implemented according to rfc3415 Appendix 1 +- tools/buildmibs.sh split-up and re-implemented as tools/build-pysnmp-mib + and pysnmp-mibs/tools/rebuild-pysnmp-mibs for better usability. These + and libsmi2pysnmp scripts made installable. +- Types/Notifications/Groups exportSymbols() call chunking implemented + in tools/libsmi2pysnmp +- Initial values specified to pyasn1 types to comply with latest pyasn1 API. +- Documentation improved +- Minor fixes towards Python 1.5 compatibility + +Revision 4.1.5a +--------------- + +- UNSTABLE ALPHA RELEASE. +- Multi-lingual SNMP Trap/Inform Applications completed; examples added +- SMI model re-designed to make a clear separation between + Managed Objects and their specification (AKA Agent and Manager side) +- SNMP SET Application support completed +- Minor, though backward incompatible, changes to one-liner API +- Many bugfixes + +Revision 4.1.4a +--------------- + +- UNSTABLE ALPHA RELEASE. +- SHA-based authentication fixed and privacy implemented +- ...oneliner.cmdgen.UsmUserData constructor now takes + authProtocol and privProtocol parameters in a backward incompatible + manner. + +Revision 4.1.3a +--------------- + +- UNSTABLE ALPHA RELEASE. +- rfc3413 applications API changes (related to callback function + behaviour). +- TransportDispatcher now provides "jobs" interface to clients + for better control of dispatcher's execution. +- Many minor fixes. + +Revision 4.1.2a +--------------- + +- UNSTABLE ALPHA RELEASE. +- Top-level application classes renamed into longer, self descripting names + for clarity. +- CommandResponder & NotificationOriginator applications now uses + stand-alone SnmpContext for application registration. +- Many minor fixes (inspired by testing on WinXP) + +Revision 4.1.1a +--------------- + +- UNSTABLE ALPHA RELEASE. +- SNMPv3 code first published +- SNMP engine and applications implemented on library level +- Major re-design towards SNMPv3-style API. + +Release 4.0.2a +-------------- + +- Adopted to slightly changed asyncore API (as shipped with python 2,4) + +Release 4.0.1a +-------------- + +- Minor bug/typo fixes, mostly in example/ scripts. + +Release 4.0.0a +-------------- + +- UNSTABLE EARLY ALPHA RELEASE. +- Major re-design and re-implementation. +- Rudimental API versioning implemented to let incompatible package + branches to co-exist within the same Python installation. +- SMI framework designed and implemented. This framework provides + 1) various access to MIB data 2) a way to implement custom MIB + instrumentation objects. There's also a tool for building SMI classes + from libsmi(3) output (smidump -f python). +- ASN.1 subtyping machinery implemented. Now dynamic ASN.1 instances + subtyping and quering becomes available. Previously, this has been done + through Python classes inheritance what proved to be a wrong concept. +- ASN.1 codecs framework re-designed and re-implemented aimed at a more + consistent design and better performance. Highlights include abstract + codec interface and serialized data caching (at encoder). +- Asn1Item constraints machinery re-implemented based on Mike C. Fletcher's + design and code. Now various constrains are implemented as stand-alone + objects serving interested Asn1Object derivatives through some abstract + protocol (that's probably the Decorator design pattern). +- ASN.1 tagging facility re-implemented along the client-server design + pattern. Besides this seems to be a more appropriate design, it allows + an easier way for dynamic subtyping. diff --git a/examples/v1arch/agent/cmdrsp.py b/examples/v1arch/agent/cmdrsp.py index 73e1413..1007a47 100644 --- a/examples/v1arch/agent/cmdrsp.py +++ b/examples/v1arch/agent/cmdrsp.py @@ -1,6 +1,6 @@ # Command Responder Application (GET/GETNEXT) -from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher -from pysnmp.carrier.asynsock.dgram import udp, udp6, unix +from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher +from pysnmp.carrier.asyncore.dgram import udp, udp6, unix from pyasn1.codec.ber import encoder, decoder from pysnmp.proto import api import time, bisect @@ -97,7 +97,7 @@ def cbFun(transportDispatcher, transportDomain, transportAddress, wholeMsg): ) return wholeMsg -transportDispatcher = AsynsockDispatcher() +transportDispatcher = AsyncoreDispatcher() transportDispatcher.registerRecvCbFun(cbFun) # UDP/IPv4 diff --git a/examples/v1arch/agent/ntforg.py b/examples/v1arch/agent/ntforg.py index 5b79132..66c8a53 100644 --- a/examples/v1arch/agent/ntforg.py +++ b/examples/v1arch/agent/ntforg.py @@ -1,6 +1,6 @@ # Notification Originator Application (TRAP) -from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher -from pysnmp.carrier.asynsock.dgram import udp, udp6, unix +from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher +from pysnmp.carrier.asyncore.dgram import udp, udp6, unix from pyasn1.codec.ber import encoder from pysnmp.proto import api @@ -23,7 +23,7 @@ pMod.apiMessage.setDefaults(trapMsg) pMod.apiMessage.setCommunity(trapMsg, 'public') pMod.apiMessage.setPDU(trapMsg, trapPDU) -transportDispatcher = AsynsockDispatcher() +transportDispatcher = AsyncoreDispatcher() # UDP/IPv4 transportDispatcher.registerTransport( diff --git a/examples/v1arch/manager/bulkgen.py b/examples/v1arch/manager/bulkgen.py index 5e37d9f..d4c7ca7 100644 --- a/examples/v1arch/manager/bulkgen.py +++ b/examples/v1arch/manager/bulkgen.py @@ -1,6 +1,6 @@ # GETBULK Command Generator (SNMPv2c only) -from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher +from pysnmp.carrier.asyncore.dgram import udp from pyasn1.codec.ber import encoder, decoder from pysnmp.proto.api import v2c from time import time @@ -77,7 +77,7 @@ def cbRecvFun(transportDispatcher, transportDomain, transportAddress, startedAt = time() return wholeMsg -transportDispatcher = AsynsockDispatcher() +transportDispatcher = AsyncoreDispatcher() transportDispatcher.registerRecvCbFun(cbRecvFun) transportDispatcher.registerTimerCbFun(cbTimerFun) diff --git a/examples/v1arch/manager/get-v2c-spoof-source-address.py b/examples/v1arch/manager/get-v2c-spoof-source-address.py index 28f2190..acaefac 100644 --- a/examples/v1arch/manager/get-v2c-spoof-source-address.py +++ b/examples/v1arch/manager/get-v2c-spoof-source-address.py @@ -1,5 +1,5 @@ -from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.proto import api from pyasn1.codec.ber import encoder, decoder from time import time @@ -53,7 +53,7 @@ def cbRecvFun(transportDispatcher, transportDomain, transportAddress, transportDispatcher.jobFinished(1) return wholeMsg -transportDispatcher = AsynsockDispatcher() +transportDispatcher = AsyncoreDispatcher() transportDispatcher.registerRecvCbFun(cbRecvFun) transportDispatcher.registerTimerCbFun(cbTimerFun) diff --git a/examples/v1arch/manager/get-v2c-udp-broadcast-agent-discovery.py b/examples/v1arch/manager/get-v2c-udp-broadcast-agent-discovery.py index 7bba894..2ac0f18 100644 --- a/examples/v1arch/manager/get-v2c-udp-broadcast-agent-discovery.py +++ b/examples/v1arch/manager/get-v2c-udp-broadcast-agent-discovery.py @@ -1,5 +1,5 @@ -from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher +from pysnmp.carrier.asyncore.dgram import udp from pyasn1.codec.ber import encoder, decoder from pysnmp.proto import api from time import time @@ -51,7 +51,7 @@ def cbRecvFun(transportDispatcher, transportDomain, transportAddress, transportDispatcher.jobFinished(1) return wholeMsg -transportDispatcher = AsynsockDispatcher() +transportDispatcher = AsyncoreDispatcher() transportDispatcher.registerRecvCbFun(cbRecvFun) transportDispatcher.registerTimerCbFun(cbTimerFun) diff --git a/examples/v1arch/manager/getgen.py b/examples/v1arch/manager/getgen.py index c5233db..a44707e 100644 --- a/examples/v1arch/manager/getgen.py +++ b/examples/v1arch/manager/getgen.py @@ -1,6 +1,6 @@ # GET Command Generator -from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher -from pysnmp.carrier.asynsock.dgram import udp, udp6, unix +from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher +from pysnmp.carrier.asyncore.dgram import udp, udp6, unix from pyasn1.codec.ber import encoder, decoder from pysnmp.proto import api from time import time @@ -46,7 +46,7 @@ def cbRecvFun(transportDispatcher, transportDomain, transportAddress, transportDispatcher.jobFinished(1) return wholeMsg -transportDispatcher = AsynsockDispatcher() +transportDispatcher = AsyncoreDispatcher() transportDispatcher.registerRecvCbFun(cbRecvFun) transportDispatcher.registerTimerCbFun(cbTimerFun) diff --git a/examples/v1arch/manager/nextgen.py b/examples/v1arch/manager/nextgen.py index d15a4ef..d0cefc3 100644 --- a/examples/v1arch/manager/nextgen.py +++ b/examples/v1arch/manager/nextgen.py @@ -1,6 +1,6 @@ # GETNEXT Command Generator -from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher +from pysnmp.carrier.asyncore.dgram import udp from pyasn1.codec.ber import encoder, decoder from pysnmp.proto import api from time import time @@ -70,7 +70,7 @@ def cbRecvFun(transportDispatcher, transportDomain, transportAddress, startedAt = time() return wholeMsg -transportDispatcher = AsynsockDispatcher() +transportDispatcher = AsyncoreDispatcher() transportDispatcher.registerRecvCbFun(cbRecvFun) transportDispatcher.registerTimerCbFun(cbTimerFun) diff --git a/examples/v1arch/manager/ntfrcv.py b/examples/v1arch/manager/ntfrcv.py index cda81a6..3a1b026 100644 --- a/examples/v1arch/manager/ntfrcv.py +++ b/examples/v1arch/manager/ntfrcv.py @@ -1,6 +1,6 @@ # Notification Receiver (TRAP PDU) -from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher -from pysnmp.carrier.asynsock.dgram import udp, udp6, unix +from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher +from pysnmp.carrier.asyncore.dgram import udp, udp6, unix from pyasn1.codec.ber import decoder from pysnmp.proto import api @@ -50,7 +50,7 @@ def cbFun(transportDispatcher, transportDomain, transportAddress, wholeMsg): print('%s = %s' % (oid.prettyPrint(), val.prettyPrint())) return wholeMsg -transportDispatcher = AsynsockDispatcher() +transportDispatcher = AsyncoreDispatcher() transportDispatcher.registerRecvCbFun(cbFun) diff --git a/examples/v1arch/manager/setgen.py b/examples/v1arch/manager/setgen.py index e369a80..f7c22bb 100644 --- a/examples/v1arch/manager/setgen.py +++ b/examples/v1arch/manager/setgen.py @@ -1,6 +1,6 @@ # SET Command Generator -from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher +from pysnmp.carrier.asyncore.dgram import udp from pyasn1.codec.ber import encoder, decoder from pysnmp.proto import api from time import time @@ -48,7 +48,7 @@ def cbRecvFun(transportDispatcher, transportDomain, transportAddress, transportDispatcher.jobFinished(1) return wholeMsg -transportDispatcher = AsynsockDispatcher() +transportDispatcher = AsyncoreDispatcher() transportDispatcher.registerRecvCbFun(cbRecvFun) transportDispatcher.registerTimerCbFun(cbTimerFun) diff --git a/examples/v3arch/agent/cmdrsp/v1-read-and-write-communities.py b/examples/v3arch/agent/cmdrsp/v1-read-and-write-communities.py index c8ff23c..d7e3a4d 100644 --- a/examples/v3arch/agent/cmdrsp/v1-read-and-write-communities.py +++ b/examples/v3arch/agent/cmdrsp/v1-read-and-write-communities.py @@ -16,7 +16,7 @@ # from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, context -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp # Create SNMP engine with autogenernated engineID and pre-bound # to socket transport dispatcher diff --git a/examples/v3arch/agent/cmdrsp/v2c-custom-scalar-mib-objects.py b/examples/v3arch/agent/cmdrsp/v2c-custom-scalar-mib-objects.py index db14628..4761038 100644 --- a/examples/v3arch/agent/cmdrsp/v2c-custom-scalar-mib-objects.py +++ b/examples/v3arch/agent/cmdrsp/v2c-custom-scalar-mib-objects.py @@ -17,7 +17,7 @@ import sys from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, context -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.proto.api import v2c # Create SNMP engine diff --git a/examples/v3arch/agent/cmdrsp/v2c-custom-tabular-mib-objects.py b/examples/v3arch/agent/cmdrsp/v2c-custom-tabular-mib-objects.py index a631493..f6381dc 100644 --- a/examples/v3arch/agent/cmdrsp/v2c-custom-tabular-mib-objects.py +++ b/examples/v3arch/agent/cmdrsp/v2c-custom-tabular-mib-objects.py @@ -25,7 +25,7 @@ # from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, context -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.proto.api import v2c # Create SNMP engine diff --git a/examples/v3arch/agent/cmdrsp/v2c-multiple-interfaces.py b/examples/v3arch/agent/cmdrsp/v2c-multiple-interfaces.py index 91af55e..8d67802 100644 --- a/examples/v3arch/agent/cmdrsp/v2c-multiple-interfaces.py +++ b/examples/v3arch/agent/cmdrsp/v2c-multiple-interfaces.py @@ -16,7 +16,7 @@ # from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, context -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp # Create SNMP engine with autogenernated engineID and pre-bound # to socket transport dispatcher diff --git a/examples/v3arch/agent/cmdrsp/v2c-multiple-transports.py b/examples/v3arch/agent/cmdrsp/v2c-multiple-transports.py index a17c490..f9115e7 100644 --- a/examples/v3arch/agent/cmdrsp/v2c-multiple-transports.py +++ b/examples/v3arch/agent/cmdrsp/v2c-multiple-transports.py @@ -17,7 +17,7 @@ # from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, context -from pysnmp.carrier.asynsock.dgram import udp, udp6 +from pysnmp.carrier.asyncore.dgram import udp, udp6 # Create SNMP engine with autogenernated engineID and pre-bound # to socket transport dispatcher diff --git a/examples/v3arch/agent/cmdrsp/v3-alternative-mib-controller.py b/examples/v3arch/agent/cmdrsp/v3-alternative-mib-controller.py index bc2d87c..5fe26a7 100644 --- a/examples/v3arch/agent/cmdrsp/v3-alternative-mib-controller.py +++ b/examples/v3arch/agent/cmdrsp/v3-alternative-mib-controller.py @@ -17,7 +17,7 @@ # from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, context -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.smi import instrum from pysnmp.proto.api import v2c diff --git a/examples/v3arch/agent/cmdrsp/v3-alternative-mib.py b/examples/v3arch/agent/cmdrsp/v3-alternative-mib.py index 95ff5b8..eabb989 100644 --- a/examples/v3arch/agent/cmdrsp/v3-alternative-mib.py +++ b/examples/v3arch/agent/cmdrsp/v3-alternative-mib.py @@ -18,7 +18,7 @@ # from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, context -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.smi import instrum, builder from pysnmp.proto.api import v2c diff --git a/examples/v3arch/agent/cmdrsp/v3-custom-engine-id.py b/examples/v3arch/agent/cmdrsp/v3-custom-engine-id.py index af1605e..4a58de3 100644 --- a/examples/v3arch/agent/cmdrsp/v3-custom-engine-id.py +++ b/examples/v3arch/agent/cmdrsp/v3-custom-engine-id.py @@ -16,7 +16,7 @@ # from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, context -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.proto import rfc1902 # Create SNMP engine diff --git a/examples/v3arch/agent/cmdrsp/v3-multiple-snmp-engines.py b/examples/v3arch/agent/cmdrsp/v3-multiple-snmp-engines.py index 8a13b40..870363a 100644 --- a/examples/v3arch/agent/cmdrsp/v3-multiple-snmp-engines.py +++ b/examples/v3arch/agent/cmdrsp/v3-multiple-snmp-engines.py @@ -26,8 +26,8 @@ from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, context from pysnmp.proto import rfc1902 -from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher +from pysnmp.carrier.asyncore.dgram import udp # Configuration parameters for each of SNMP Engines snmpEngineInfo = ( @@ -36,7 +36,7 @@ snmpEngineInfo = ( ) # Instantiate the single transport dispatcher object -transportDispatcher = AsynsockDispatcher() +transportDispatcher = AsyncoreDispatcher() # Setup a custom data routing function to select snmpEngine by transportDomain transportDispatcher.registerRoutingCbFun(lambda td,t,d: td) diff --git a/examples/v3arch/agent/cmdrsp/v3-multiple-users.py b/examples/v3arch/agent/cmdrsp/v3-multiple-users.py index b89567e..1f11a58 100644 --- a/examples/v3arch/agent/cmdrsp/v3-multiple-users.py +++ b/examples/v3arch/agent/cmdrsp/v3-multiple-users.py @@ -19,7 +19,7 @@ # from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, context -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp # Create SNMP engine snmpEngine = engine.SnmpEngine() diff --git a/examples/v3arch/agent/cmdrsp/v3-observe-request-processing.py b/examples/v3arch/agent/cmdrsp/v3-observe-request-processing.py index 842f1d7..53dad9a 100644 --- a/examples/v3arch/agent/cmdrsp/v3-observe-request-processing.py +++ b/examples/v3arch/agent/cmdrsp/v3-observe-request-processing.py @@ -20,7 +20,7 @@ # from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, context -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp # Create SNMP engine snmpEngine = engine.SnmpEngine() diff --git a/examples/v3arch/agent/cmdrsp/v3-preserve-original-destination-address.py b/examples/v3arch/agent/cmdrsp/v3-preserve-original-destination-address.py index a371cd6..55e282f 100644 --- a/examples/v3arch/agent/cmdrsp/v3-preserve-original-destination-address.py +++ b/examples/v3arch/agent/cmdrsp/v3-preserve-original-destination-address.py @@ -32,7 +32,7 @@ # from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, context -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp # Create SNMP engine snmpEngine = engine.SnmpEngine() diff --git a/examples/v3arch/agent/ntforg/inform-multiple-protocols.py b/examples/v3arch/agent/ntforg/inform-multiple-protocols.py index 8f70ef9..d8093ad 100644 --- a/examples/v3arch/agent/ntforg/inform-multiple-protocols.py +++ b/examples/v3arch/agent/ntforg/inform-multiple-protocols.py @@ -17,7 +17,7 @@ # 1.3.6.1.2.1.1.1.0 = 'Example Notificator' # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntforg from pysnmp.proto.api import v2c diff --git a/examples/v3arch/agent/ntforg/inform-v2c.py b/examples/v3arch/agent/ntforg/inform-v2c.py index 9c52655..dd10f85 100644 --- a/examples/v3arch/agent/ntforg/inform-v2c.py +++ b/examples/v3arch/agent/ntforg/inform-v2c.py @@ -14,7 +14,7 @@ # 1.3.6.1.2.1.1.5.0 = 'Notificator Example' # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntforg from pysnmp.proto.api import v2c diff --git a/examples/v3arch/agent/ntforg/inform-v3.py b/examples/v3arch/agent/ntforg/inform-v3.py index ef5355a..6a888df 100644 --- a/examples/v3arch/agent/ntforg/inform-v3.py +++ b/examples/v3arch/agent/ntforg/inform-v3.py @@ -12,7 +12,7 @@ # * include managed object information 1.3.6.1.2.1.1.5.0 = 'system name' # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntforg from pysnmp.proto.api import v2c diff --git a/examples/v3arch/agent/ntforg/trap-v1-from-specific-address.py b/examples/v3arch/agent/ntforg/trap-v1-from-specific-address.py index 04dcd56..b99389a 100644 --- a/examples/v3arch/agent/ntforg/trap-v1-from-specific-address.py +++ b/examples/v3arch/agent/ntforg/trap-v1-from-specific-address.py @@ -12,7 +12,7 @@ # * with TRAP ID 'coldStart' specified as an OID # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntforg from pysnmp.proto.api import v2c diff --git a/examples/v3arch/agent/ntforg/trap-v1.py b/examples/v3arch/agent/ntforg/trap-v1.py index 2ac5071..83500f2 100644 --- a/examples/v3arch/agent/ntforg/trap-v1.py +++ b/examples/v3arch/agent/ntforg/trap-v1.py @@ -16,7 +16,7 @@ # * include managed object information '1.3.6.1.2.1.1.1.0' = 'my system' # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntforg from pysnmp.proto.api import v2c #from pysnmp import debug diff --git a/examples/v3arch/agent/ntforg/trap-v2c-custom-pdu.py b/examples/v3arch/agent/ntforg/trap-v2c-custom-pdu.py index 8dd1275..f1e67e8 100644 --- a/examples/v3arch/agent/ntforg/trap-v2c-custom-pdu.py +++ b/examples/v3arch/agent/ntforg/trap-v2c-custom-pdu.py @@ -13,7 +13,7 @@ # 1.3.6.1.6.3.1.1.4.1.0 = 1.3.6.1.6.3.1.1.5.1 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntforg from pysnmp.proto.api import v2c diff --git a/examples/v3arch/agent/ntforg/trap-v2c-multiple-addresses.py b/examples/v3arch/agent/ntforg/trap-v2c-multiple-addresses.py index 709e972..5b994cf 100644 --- a/examples/v3arch/agent/ntforg/trap-v2c-multiple-addresses.py +++ b/examples/v3arch/agent/ntforg/trap-v2c-multiple-addresses.py @@ -15,7 +15,7 @@ # 1.3.6.1.2.1.1.5.0 = 'Notificator Example' # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntforg from pysnmp.proto.api import v2c diff --git a/examples/v3arch/agent/ntforg/trap-v2c-multiple-targets.py b/examples/v3arch/agent/ntforg/trap-v2c-multiple-targets.py index cd6432b..65bb20d 100644 --- a/examples/v3arch/agent/ntforg/trap-v2c-multiple-targets.py +++ b/examples/v3arch/agent/ntforg/trap-v2c-multiple-targets.py @@ -15,7 +15,7 @@ # 1.3.6.1.2.1.1.5.0 = 'Notificator Example' # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntforg from pysnmp.proto.api import v2c diff --git a/examples/v3arch/agent/ntforg/trap-v2c-multiple-transports.py b/examples/v3arch/agent/ntforg/trap-v2c-multiple-transports.py index e2589da..e8b674d 100644 --- a/examples/v3arch/agent/ntforg/trap-v2c-multiple-transports.py +++ b/examples/v3arch/agent/ntforg/trap-v2c-multiple-transports.py @@ -14,7 +14,7 @@ # 1.3.6.1.2.1.1.5.0 = 'Notificator Example' # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp, udp6 +from pysnmp.carrier.asyncore.dgram import udp, udp6 from pysnmp.entity.rfc3413 import ntforg from pysnmp.proto.api import v2c diff --git a/examples/v3arch/agent/ntforg/trap-v2c-with-objects.py b/examples/v3arch/agent/ntforg/trap-v2c-with-objects.py index ad17348..4124a39 100644 --- a/examples/v3arch/agent/ntforg/trap-v2c-with-objects.py +++ b/examples/v3arch/agent/ntforg/trap-v2c-with-objects.py @@ -23,7 +23,7 @@ # To run this example make sure to have IF-MIB.py in search path. # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntforg from pysnmp.smi import rfc1902, view diff --git a/examples/v3arch/agent/ntforg/trap-v2c.py b/examples/v3arch/agent/ntforg/trap-v2c.py index d63a371..1ada77b 100644 --- a/examples/v3arch/agent/ntforg/trap-v2c.py +++ b/examples/v3arch/agent/ntforg/trap-v2c.py @@ -14,7 +14,7 @@ # 1.3.6.1.2.1.1.5.0 = 'Notificator Example' # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntforg from pysnmp.proto.api import v2c diff --git a/examples/v3arch/agent/ntforg/trap-v3.py b/examples/v3arch/agent/ntforg/trap-v3.py index 266d91e..db2c965 100644 --- a/examples/v3arch/agent/ntforg/trap-v3.py +++ b/examples/v3arch/agent/ntforg/trap-v3.py @@ -12,7 +12,7 @@ # * include managed object information 1.3.6.1.2.1.1.5.0 = 'system name' # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntforg from pysnmp.proto.api import v2c diff --git a/examples/v3arch/manager/cmdgen/get-v1.py b/examples/v3arch/manager/cmdgen/get-v1.py index 4fbfb8b..af54eb8 100644 --- a/examples/v3arch/manager/cmdgen/get-v1.py +++ b/examples/v3arch/manager/cmdgen/get-v1.py @@ -12,7 +12,7 @@ # $ snmpget -v1 -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1.1.0 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import cmdgen # Create SNMP engine instance diff --git a/examples/v3arch/manager/cmdgen/get-v2c-custom-timeout.py b/examples/v3arch/manager/cmdgen/get-v2c-custom-timeout.py index 5ea17a4..5fbd3eb 100644 --- a/examples/v3arch/manager/cmdgen/get-v2c-custom-timeout.py +++ b/examples/v3arch/manager/cmdgen/get-v2c-custom-timeout.py @@ -13,7 +13,7 @@ # $ snmpget -v2c -c public -ObentU -r 5 -t 1 195.218.195.228 1.3.6.1.2.1.1.1.0 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import cmdgen # Create SNMP engine instance diff --git a/examples/v3arch/manager/cmdgen/get-v2c-spoof-source-address.py b/examples/v3arch/manager/cmdgen/get-v2c-spoof-source-address.py index 036cf3f..cab2912 100644 --- a/examples/v3arch/manager/cmdgen/get-v2c-spoof-source-address.py +++ b/examples/v3arch/manager/cmdgen/get-v2c-spoof-source-address.py @@ -23,7 +23,7 @@ # # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import cmdgen # Create SNMP engine instance diff --git a/examples/v3arch/manager/cmdgen/get-v3-custom-context.py b/examples/v3arch/manager/cmdgen/get-v3-custom-context.py index 0be8da9..01fd25d 100644 --- a/examples/v3arch/manager/cmdgen/get-v3-custom-context.py +++ b/examples/v3arch/manager/cmdgen/get-v3-custom-context.py @@ -15,7 +15,7 @@ # $ snmpget -v3 -l authNoPriv -u usr-md5-none -A authkey1 -E 80004fb805636c6f75644dab22cc -n da761cfc8c94d3aceef4f60f049105ba -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.1.0 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import cmdgen from pysnmp.proto import rfc1902 diff --git a/examples/v3arch/manager/cmdgen/get-v3-observe-request-processing.py b/examples/v3arch/manager/cmdgen/get-v3-observe-request-processing.py index 09c543b..d05be2d 100644 --- a/examples/v3arch/manager/cmdgen/get-v3-observe-request-processing.py +++ b/examples/v3arch/manager/cmdgen/get-v3-observe-request-processing.py @@ -16,7 +16,7 @@ # $ snmpget -v3 -l authPriv -u usr-sha-aes -a SHA -A authkey1 -x AES -X privkey1 -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.1.0 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import cmdgen # Create SNMP engine instance diff --git a/examples/v3arch/manager/cmdgen/get-v3.py b/examples/v3arch/manager/cmdgen/get-v3.py index 68a6106..9820543 100644 --- a/examples/v3arch/manager/cmdgen/get-v3.py +++ b/examples/v3arch/manager/cmdgen/get-v3.py @@ -12,7 +12,7 @@ # $ snmpget -v3 -l authPriv -u usr-sha-aes -a SHA -A authkey1 -x AES -X privkey1 -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.1.0 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import cmdgen # Create SNMP engine instance diff --git a/examples/v3arch/manager/cmdgen/getbulk-v2c.py b/examples/v3arch/manager/cmdgen/getbulk-v2c.py index 697c4cd..6c451a3 100644 --- a/examples/v3arch/manager/cmdgen/getbulk-v2c.py +++ b/examples/v3arch/manager/cmdgen/getbulk-v2c.py @@ -15,7 +15,7 @@ # from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdgen -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp # Create SNMP engine instance snmpEngine = engine.SnmpEngine() diff --git a/examples/v3arch/manager/cmdgen/getbulk-v3.py b/examples/v3arch/manager/cmdgen/getbulk-v3.py index 660dcb2..934fcd6 100644 --- a/examples/v3arch/manager/cmdgen/getbulk-v3.py +++ b/examples/v3arch/manager/cmdgen/getbulk-v3.py @@ -15,7 +15,7 @@ # from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdgen -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp # Create SNMP engine instance snmpEngine = engine.SnmpEngine() diff --git a/examples/v3arch/manager/cmdgen/getnext-v1.py b/examples/v3arch/manager/cmdgen/getnext-v1.py index a5a17b4..5d4420c 100644 --- a/examples/v3arch/manager/cmdgen/getnext-v1.py +++ b/examples/v3arch/manager/cmdgen/getnext-v1.py @@ -13,7 +13,7 @@ # $ snmpwalk -v1 -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import cmdgen # Create SNMP engine instance diff --git a/examples/v3arch/manager/cmdgen/getnext-v2c-from-specific-address.py b/examples/v3arch/manager/cmdgen/getnext-v2c-from-specific-address.py index dd8e4fd..4ce9877 100644 --- a/examples/v3arch/manager/cmdgen/getnext-v2c-from-specific-address.py +++ b/examples/v3arch/manager/cmdgen/getnext-v2c-from-specific-address.py @@ -14,7 +14,7 @@ # $ snmpwalk -v2c -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import cmdgen # Create SNMP engine instance diff --git a/examples/v3arch/manager/cmdgen/getnext-v2c-with-mib-compilation-and-lookup.py b/examples/v3arch/manager/cmdgen/getnext-v2c-with-mib-compilation-and-lookup.py index eab7906..59e0bba 100644 --- a/examples/v3arch/manager/cmdgen/getnext-v2c-with-mib-compilation-and-lookup.py +++ b/examples/v3arch/manager/cmdgen/getnext-v2c-with-mib-compilation-and-lookup.py @@ -13,7 +13,7 @@ # $ snmpwalk -v1 -c public -ObentU 195.218.195.228 1.3.6.1.2.1.1 1.3.6.1.4.1.1 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import cmdgen from pysnmp.smi import compiler, view, rfc1902 diff --git a/examples/v3arch/manager/cmdgen/getnext-v3-over-ipv6.py b/examples/v3arch/manager/cmdgen/getnext-v3-over-ipv6.py index 2a9e93a..ebdcb8a 100644 --- a/examples/v3arch/manager/cmdgen/getnext-v3-over-ipv6.py +++ b/examples/v3arch/manager/cmdgen/getnext-v3-over-ipv6.py @@ -13,7 +13,7 @@ # $ snmpwalk -v3 -l authNoPriv -u usr-md5-none -A authkey1 -ObentU udp6:[::1]:161 1.3.6.1.2.1.1 1.3.6.1.4.1.1 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp6 +from pysnmp.carrier.asyncore.dgram import udp6 from pysnmp.entity.rfc3413 import cmdgen # Create SNMP engine instance diff --git a/examples/v3arch/manager/cmdgen/getnext-v3-pull-subtree.py b/examples/v3arch/manager/cmdgen/getnext-v3-pull-subtree.py index 0c870a7..abf3bab 100644 --- a/examples/v3arch/manager/cmdgen/getnext-v3-pull-subtree.py +++ b/examples/v3arch/manager/cmdgen/getnext-v3-pull-subtree.py @@ -13,7 +13,7 @@ # $ snmpwalk -v3 -l noAuthNoPriv -u usr-none-none -ObentU 195.218.195.228:161 1.3.6.1.2.1.1 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import cmdgen from pysnmp.proto import rfc1902 diff --git a/examples/v3arch/manager/cmdgen/set-v1.py b/examples/v3arch/manager/cmdgen/set-v1.py index ba94a3b..05e8292 100644 --- a/examples/v3arch/manager/cmdgen/set-v1.py +++ b/examples/v3arch/manager/cmdgen/set-v1.py @@ -12,7 +12,7 @@ # $ snmpset -v1 -c private -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.9.1.3.1 s 'my value' 1.3.6.1.2.1.1.9.1.4.1 t 123 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import cmdgen from pysnmp.proto import rfc1902 diff --git a/examples/v3arch/manager/cmdgen/set-v2c.py b/examples/v3arch/manager/cmdgen/set-v2c.py index 00db8a0..620eded 100644 --- a/examples/v3arch/manager/cmdgen/set-v2c.py +++ b/examples/v3arch/manager/cmdgen/set-v2c.py @@ -12,7 +12,7 @@ # $ snmpset -v2c -c private -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.9.1.4.1 t 123 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import cmdgen from pysnmp.proto import rfc1902 diff --git a/examples/v3arch/manager/cmdgen/set-v3.py b/examples/v3arch/manager/cmdgen/set-v3.py index fd48438..790fb3f 100644 --- a/examples/v3arch/manager/cmdgen/set-v3.py +++ b/examples/v3arch/manager/cmdgen/set-v3.py @@ -12,7 +12,7 @@ # $ snmpset -v3 -l authNoPriv -u usr-sha-none -a SHA -A authkey1 -ObentU 195.218.195.228:161 1.3.6.1.2.1.1.9.1.3.1 s 'my new value' # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import cmdgen from pysnmp.proto import rfc1902 diff --git a/examples/v3arch/manager/ntfrcv/v2c-multiple-interfaces.py b/examples/v3arch/manager/ntfrcv/v2c-multiple-interfaces.py index 182338b..c4dbae8 100644 --- a/examples/v3arch/manager/ntfrcv/v2c-multiple-interfaces.py +++ b/examples/v3arch/manager/ntfrcv/v2c-multiple-interfaces.py @@ -16,7 +16,7 @@ # $ snmpinform -v2c -c public 127.0.0.1:2162 123 1.3.6.1.6.3.1.1.5.1 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntfrcv # Create SNMP engine with autogenernated engineID and pre-bound diff --git a/examples/v3arch/manager/ntfrcv/v2c-multiple-transports.py b/examples/v3arch/manager/ntfrcv/v2c-multiple-transports.py index 1f9c739..2b54998 100644 --- a/examples/v3arch/manager/ntfrcv/v2c-multiple-transports.py +++ b/examples/v3arch/manager/ntfrcv/v2c-multiple-transports.py @@ -17,7 +17,7 @@ # $ snmpinform -v2c -c public 127.0.0.1 123 1.3.6.1.6.3.1.1.5.1 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp, udp6 +from pysnmp.carrier.asyncore.dgram import udp, udp6 from pysnmp.entity.rfc3413 import ntfrcv # Create SNMP engine with autogenernated engineID and pre-bound diff --git a/examples/v3arch/manager/ntfrcv/v2c-observe-request-processing.py b/examples/v3arch/manager/ntfrcv/v2c-observe-request-processing.py index 41796dd..5651a6f 100644 --- a/examples/v3arch/manager/ntfrcv/v2c-observe-request-processing.py +++ b/examples/v3arch/manager/ntfrcv/v2c-observe-request-processing.py @@ -18,7 +18,7 @@ # $ snmpinform -v2c -c public 127.0.0.1 123 1.3.6.1.6.3.1.1.5.1 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp, udp6 +from pysnmp.carrier.asyncore.dgram import udp, udp6 from pysnmp.entity.rfc3413 import ntfrcv # Create SNMP engine with autogenernated engineID and pre-bound diff --git a/examples/v3arch/manager/ntfrcv/v2c-with-regexp-community-name.py b/examples/v3arch/manager/ntfrcv/v2c-with-regexp-community-name.py index 61507a4..57a7030 100644 --- a/examples/v3arch/manager/ntfrcv/v2c-with-regexp-community-name.py +++ b/examples/v3arch/manager/ntfrcv/v2c-with-regexp-community-name.py @@ -24,7 +24,7 @@ # CommunityName's, not explicitly configured to local SNMP Engine. # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntfrcv from pysnmp.proto.api import v2c import re diff --git a/examples/v3arch/manager/ntfrcv/v2c-with-request-details.py b/examples/v3arch/manager/ntfrcv/v2c-with-request-details.py index e7f1301..ea3aafb 100644 --- a/examples/v3arch/manager/ntfrcv/v2c-with-request-details.py +++ b/examples/v3arch/manager/ntfrcv/v2c-with-request-details.py @@ -15,7 +15,7 @@ # $ snmptrap -v2c -c public 127.0.0.1:162 123 1.3.6.1.6.3.1.1.5.1 1.3.6.1.2.1.1.5.0 s test # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntfrcv # Create SNMP engine with autogenernated engineID and pre-bound diff --git a/examples/v3arch/manager/ntfrcv/v3-multiple-users.py b/examples/v3arch/manager/ntfrcv/v3-multiple-users.py index 9f26839..f78d11c 100644 --- a/examples/v3arch/manager/ntfrcv/v3-multiple-users.py +++ b/examples/v3arch/manager/ntfrcv/v3-multiple-users.py @@ -19,7 +19,7 @@ # $ snmpinform -v3 -u usr-sha-aes128 -l authPriv -a SHA -A authkey1 -x AES -X privkey1 127.0.0.1 123 1.3.6.1.6.3.1.1.5.1 # from pysnmp.entity import engine, config -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity.rfc3413 import ntfrcv from pysnmp.proto.api import v2c diff --git a/examples/v3arch/oneliner/agent/ntforg/inform-async-multiple-snmp-engines.py b/examples/v3arch/oneliner/agent/ntforg/inform-async-multiple-snmp-engines.py index 2dfbc55..fcceaf0 100644 --- a/examples/v3arch/oneliner/agent/ntforg/inform-async-multiple-snmp-engines.py +++ b/examples/v3arch/oneliner/agent/ntforg/inform-async-multiple-snmp-engines.py @@ -26,7 +26,7 @@ # from pysnmp.entity.rfc3413.oneliner import ntforg from pysnmp.entity import engine -from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher +from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher # List of targets in the following format: # ( ( authData, transportTarget ), ... ) @@ -54,7 +54,7 @@ def cbFun(snmpEngine, sendRequestHandle, errorIndication, print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) # Instantiate the single transport dispatcher object -transportDispatcher = AsynsockDispatcher() +transportDispatcher = AsyncoreDispatcher() # Setup a custom data routing function to select snmpEngine by transportDomain transportDispatcher.registerRoutingCbFun( diff --git a/examples/v3arch/oneliner/manager/cmdgen/get-async-multiple-snmp-engines.py b/examples/v3arch/oneliner/manager/cmdgen/get-async-multiple-snmp-engines.py index 94c1f54..45ae42b 100644 --- a/examples/v3arch/oneliner/manager/cmdgen/get-async-multiple-snmp-engines.py +++ b/examples/v3arch/oneliner/manager/cmdgen/get-async-multiple-snmp-engines.py @@ -27,7 +27,7 @@ # from pysnmp.entity.rfc3413.oneliner import cmdgen from pysnmp.entity import engine -from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher +from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher # List of targets in the followin format: # ( ( authData, transportTarget, varNames ), ... ) @@ -77,7 +77,7 @@ def cbFun(snmpEngine, sendRequestHandle, errorIndication, # Instantiate the single transport dispatcher object -transportDispatcher = AsynsockDispatcher() +transportDispatcher = AsyncoreDispatcher() # Setup a custom data routing function to select snmpEngine by transportDomain transportDispatcher.registerRoutingCbFun( diff --git a/examples/v3arch/proxy/cmd/udp6-to-udp4-conversion.py b/examples/v3arch/proxy/cmd/udp6-to-udp4-conversion.py index 96947c7..07497b4 100644 --- a/examples/v3arch/proxy/cmd/udp6-to-udp4-conversion.py +++ b/examples/v3arch/proxy/cmd/udp6-to-udp4-conversion.py @@ -21,7 +21,7 @@ # initial request PDUs from different Managers, into unique values to # avoid sending duplicate request-IDs to Agents. # -from pysnmp.carrier.asynsock.dgram import udp, udp6 +from pysnmp.carrier.asyncore.dgram import udp, udp6 from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, cmdgen, context from pysnmp.proto.api import v2c diff --git a/examples/v3arch/proxy/cmd/v2c-to-v1-conversion.py b/examples/v3arch/proxy/cmd/v2c-to-v1-conversion.py index c2b54e0..e6a805c 100644 --- a/examples/v3arch/proxy/cmd/v2c-to-v1-conversion.py +++ b/examples/v3arch/proxy/cmd/v2c-to-v1-conversion.py @@ -21,7 +21,7 @@ # initial request PDUs from different Managers, into unique values to # avoid sending duplicate request-IDs to Agents. # -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, cmdgen, context from pysnmp.proto.api import v2c diff --git a/examples/v3arch/proxy/cmd/v2c-to-v3-conversion.py b/examples/v3arch/proxy/cmd/v2c-to-v3-conversion.py index dae1e6b..453d8bb 100644 --- a/examples/v3arch/proxy/cmd/v2c-to-v3-conversion.py +++ b/examples/v3arch/proxy/cmd/v2c-to-v3-conversion.py @@ -21,7 +21,7 @@ # initial request PDUs from different Managers, into unique values to # avoid sending duplicate request-IDs to Agents. # -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, cmdgen, context from pysnmp.proto.api import v2c diff --git a/examples/v3arch/proxy/cmd/v3-to-v2c-conversion.py b/examples/v3arch/proxy/cmd/v3-to-v2c-conversion.py index a0d8671..992ff7f 100644 --- a/examples/v3arch/proxy/cmd/v3-to-v2c-conversion.py +++ b/examples/v3arch/proxy/cmd/v3-to-v2c-conversion.py @@ -21,7 +21,7 @@ # initial request PDUs from different Managers, into unique values to # avoid sending duplicate request-IDs to Agents. # -from pysnmp.carrier.asynsock.dgram import udp +from pysnmp.carrier.asyncore.dgram import udp from pysnmp.entity import engine, config from pysnmp.entity.rfc3413 import cmdrsp, cmdgen, context from pysnmp.proto.api import v2c diff --git a/pysnmp/carrier/asyncore/base.py b/pysnmp/carrier/asyncore/base.py new file mode 100644 index 0000000..45e2fb2 --- /dev/null +++ b/pysnmp/carrier/asyncore/base.py @@ -0,0 +1,89 @@ +# Defines standard API to asyncore-based transport +import socket, sys +import asyncore +from pysnmp.carrier import error +from pysnmp.carrier.base import AbstractTransport +from pysnmp.carrier.asyncore.dispatch import AsyncoreDispatcher +from pysnmp import debug + +class AbstractSocketTransport(asyncore.dispatcher, AbstractTransport): + protoTransportDispatcher = AsyncoreDispatcher + sockFamily = sockType = None + retryCount = 0; retryInterval = 0 + bufferSize = 131070 + def __init__(self, sock=None, sockMap=None): + asyncore.dispatcher.__init__(self) + if sock is None: + if self.sockFamily is None: + raise error.CarrierError( + 'Address family %s not supported' % self.__class__.__name__ + ) + if self.sockType is None: + raise error.CarrierError( + 'Socket type %s not supported' % self.__class__.__name__ + ) + try: + sock = socket.socket(self.sockFamily, self.sockType) + except socket.error: + raise error.CarrierError('socket() failed: %s' % sys.exc_info()[1]) + + try: + for b in socket.SO_RCVBUF, socket.SO_SNDBUF: + bsize = sock.getsockopt(socket.SOL_SOCKET, b) + if bsize < self.bufferSize: + sock.setsockopt(socket.SOL_SOCKET, b, self.bufferSize) + debug.logger & debug.flagIO and debug.logger('%s: socket %d buffer size increased from %d to %d for buffer %d' % (self.__class__.__name__, sock.fileno(), bsize, self.bufferSize, b)) + except Exception: + debug.logger & debug.flagIO and debug.logger('%s: socket buffer size option mangling failure for buffer %d: %s' % (self.__class__.__name__, b, sys.exc_info()[1])) + + # The socket map is managed by the AsyncoreDispatcher on + # which this transport is registered. Here we just prepare + # socket and postpone transport registration at dispatcher + # till AsyncoreDispatcher invokes registerSocket() + + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + sock.setblocking(0) + self.set_socket(sock) + + def __hash__(self): return hash(self.socket) + + # The following two methods are part of base class so here we overwrite + # them to separate socket management from dispatcher registration tasks. + # These two are just for dispatcher registration. + def add_channel(self, map=None): + if map is not None: + map[self._fileno] = self + self.connected = True + + def del_channel(self, map=None): + if map is not None and self._fileno in map: + del map[self._fileno] + self.connected = False + + def registerSocket(self, sockMap=None): + self.add_channel(sockMap) + + def unregisterSocket(self, sockMap=None): + self.del_channel(sockMap) + + # Public API + + def openClientMode(self, iface=None): + raise error.CarrierError('Method not implemented') + + def openServerMode(self, iface=None): + raise error.CarrierError('Method not implemented') + + def sendMessage(self, outgoingMessage, transportAddress): + raise error.CarrierError('Method not implemented') + + def closeTransport(self): + AbstractTransport.closeTransport(self) + self.close() + + # asyncore API + def handle_close(self): raise error.CarrierError( + 'Transport unexpectedly closed' + ) + def handle_error(self): raise + diff --git a/pysnmp/carrier/asyncore/dgram/base.py b/pysnmp/carrier/asyncore/dgram/base.py new file mode 100644 index 0000000..5b87e70 --- /dev/null +++ b/pysnmp/carrier/asyncore/dgram/base.py @@ -0,0 +1,154 @@ +# Implements asyncore-based generic DGRAM transport +import socket, errno, sys +from pysnmp.carrier.asyncore.base import AbstractSocketTransport +from pysnmp.carrier import sockfix, sockmsg, error +from pysnmp import debug + +sockErrors = { # Ignore these socket errors + errno.ESHUTDOWN: 1, + errno.ENOTCONN: 1, + errno.ECONNRESET: 0, + errno.ECONNREFUSED: 0, + errno.EAGAIN: 0, + errno.EWOULDBLOCK: 0 + } +if hasattr(errno, 'EBADFD'): + # bad FD may happen upon FD closure on n-1 select() event + sockErrors[errno.EBADFD] = 1 + +class DgramSocketTransport(AbstractSocketTransport): + sockType = socket.SOCK_DGRAM + retryCount = 3; retryInterval = 1 + addressType = lambda x: x + def __init__(self, sock=None, sockMap=None): + self.__outQueue = [] + self._sendto = lambda s,b,a: s.sendto(b, a) + def __recvfrom(s, sz): + d, a = s.recvfrom(sz) + return d, self.addressType(a) + self._recvfrom = __recvfrom + AbstractSocketTransport.__init__(self, sock, sockMap) + + def openClientMode(self, iface=None): + if iface is not None: + try: + self.socket.bind(iface) + except socket.error: + raise error.CarrierError('bind() for %s failed: %s' % (iface is None and "" or iface, sys.exc_info()[1])) + return self + + def openServerMode(self, iface): + try: + self.socket.bind(iface) + except socket.error: + raise error.CarrierError('bind() for %s failed: %s' % (iface, sys.exc_info()[1],)) + return self + + def enableBroadcast(self, flag=1): + try: + self.socket.setsockopt( + socket.SOL_SOCKET, socket.SO_BROADCAST, flag + ) + except socket.error: + raise error.CarrierError('setsockopt() for SO_BROADCAST failed: %s' % (sys.exc_info()[1],)) + debug.logger & debug.flagIO and debug.logger('enableBroadcast: %s option SO_BROADCAST on socket %s' % (turnOn and "enabled" or "disabled", self.socket.fileno())) + return self + + def enablePktInfo(self, flag=1): + if not hasattr(self.socket, 'sendmsg') or \ + not hasattr(self.socket, 'recvmsg'): + raise error.CarrierError('sendmsg()/recvmsg() interface is not supported by this OS and/or Python version') + + try: + if self.socket.family in (socket.AF_INET,socket.AF_INET6): + self.socket.setsockopt(socket.SOL_IP, socket.IP_PKTINFO, flag) + if self.socket.family == socket.AF_INET6: + self.socket.setsockopt(socket.SOL_IPV6, socket.IPV6_RECVPKTINFO, flag) + except socket.error: + raise error.CarrierError('setsockopt() for %s failed: %s' % (self.socket.family == socket.AF_INET6 and "IPV6_RECVPKTINFO" or "IP_PKTINFO", sys.exc_info()[1])) + + self._sendto = sockmsg.getSendTo(self.addressType) + self._recvfrom = sockmsg.getRecvFrom(self.addressType) + + debug.logger & debug.flagIO and debug.logger('enablePktInfo: %s option %s on socket %s' % (self.socket.family == socket.AF_INET6 and "IPV6_RECVPKTINFO" or "IP_PKTINFO", flag and "enabled" or "disabled", self.socket.fileno())) + return self + + def enableTransparent(self, flag=1): + try: + if self.socket.family == socket.AF_INET: + self.socket.setsockopt( + socket.SOL_IP, socket.IP_TRANSPARENT, flag + ) + if self.socket.family == socket.AF_INET6: + self.socket.setsockopt( + socket.SOL_IPV6, socket.IP_TRANSPARENT, flag + ) + except socket.error: + raise error.CarrierError('setsockopt() for IP_TRANSPARENT failed: %s' % sys.exc_info()[1]) + except PermissionError: + raise error.CarrierError('IP_TRANSPARENT socket option requires superusre previleges') + + debug.logger & debug.flagIO and debug.logger('enableTransparent: %s option IP_TRANSPARENT on socket %s' % (flag and "enabled" or "disabled", self.socket.fileno())) + return self + + def sendMessage(self, outgoingMessage, transportAddress): + self.__outQueue.append( + (outgoingMessage, self.normalizeAddress(transportAddress)) + ) + debug.logger & debug.flagIO and debug.logger('sendMessage: outgoingMessage queued (%d octets) %s' % (len(outgoingMessage), debug.hexdump(outgoingMessage))) + + def normalizeAddress(self, transportAddress): + if not isinstance(transportAddress, self.addressType): + transportAddress = self.addressType(transportAddress) + if not transportAddress.getLocalAddress(): + transportAddress.setLocalAddress(self.getLocalAddress()) + return transportAddress + + def getLocalAddress(self): + # one evil OS does not seem to support getsockname() for DGRAM sockets + try: + return self.socket.getsockname() + except: + return ('0.0.0.0', 0) + + # asyncore API + def handle_connect(self): pass + def writable(self): return self.__outQueue + def handle_write(self): + outgoingMessage, transportAddress = self.__outQueue.pop(0) + debug.logger & debug.flagIO and debug.logger('handle_write: transportAddress %r -> %r outgoingMessage (%d octets) %s' % (transportAddress.getLocalAddress(), transportAddress, len(outgoingMessage), debug.hexdump(outgoingMessage))) + if not transportAddress: + debug.logger & debug.flagIO and debug.logger('handle_write: missing dst address, loosing outgoing msg') + return + try: + self._sendto( + self.socket, outgoingMessage, transportAddress + ) + except socket.error: + if sys.exc_info()[1].args[0] in sockErrors: + debug.logger & debug.flagIO and debug.logger('handle_write: ignoring socket error %s' % (sys.exc_info()[1],)) + else: + raise error.CarrierError('sendto() failed for %s: %s' % (transportAddress, sys.exc_info()[1])) + + def readable(self): return 1 + def handle_read(self): + try: + incomingMessage, transportAddress = self._recvfrom( + self.socket, 65535 + ) + transportAddress = self.normalizeAddress(transportAddress) + debug.logger & debug.flagIO and debug.logger('handle_read: transportAddress %r -> %r incomingMessage (%d octets) %s' % (transportAddress, transportAddress.getLocalAddress(), len(incomingMessage), debug.hexdump(incomingMessage))) + if not incomingMessage: + self.handle_close() + return + else: + self._cbFun(self, transportAddress, incomingMessage) + return + except socket.error: + if sys.exc_info()[1].args[0] in sockErrors: + debug.logger & debug.flagIO and debug.logger('handle_read: known socket error %s' % (sys.exc_info()[1],)) + sockErrors[sys.exc_info()[1].args[0]] and self.handle_close() + return + else: + raise error.CarrierError('recvfrom() failed: %s' % (sys.exc_info()[1],)) + def handle_close(self): pass # no datagram connection diff --git a/pysnmp/carrier/asyncore/dgram/udp.py b/pysnmp/carrier/asyncore/dgram/udp.py new file mode 100644 index 0000000..c1cf202 --- /dev/null +++ b/pysnmp/carrier/asyncore/dgram/udp.py @@ -0,0 +1,14 @@ +# Implements asyncore-based UDP transport domain +from socket import AF_INET +from pysnmp.carrier.base import AbstractTransportAddress +from pysnmp.carrier.asyncore.dgram.base import DgramSocketTransport + +domainName = snmpUDPDomain = (1, 3, 6, 1, 6, 1, 1) + +class UdpTransportAddress(tuple, AbstractTransportAddress): pass + +class UdpSocketTransport(DgramSocketTransport): + sockFamily = AF_INET + addressType = UdpTransportAddress + +UdpTransport = UdpSocketTransport diff --git a/pysnmp/carrier/asyncore/dgram/udp6.py b/pysnmp/carrier/asyncore/dgram/udp6.py new file mode 100644 index 0000000..73d0d66 --- /dev/null +++ b/pysnmp/carrier/asyncore/dgram/udp6.py @@ -0,0 +1,34 @@ +# Implements asyncore-based UDP6 transport domain +from pysnmp.carrier import sockfix +from pysnmp.carrier.base import AbstractTransportAddress +from pysnmp.carrier.asyncore.dgram.base import DgramSocketTransport +import socket + +domainName = snmpUDP6Domain = (1, 3, 6, 1, 2, 1, 100, 1, 2) + +class Udp6TransportAddress(tuple, AbstractTransportAddress): pass + +class Udp6SocketTransport(DgramSocketTransport): + sockFamily = socket.has_ipv6 and socket.AF_INET6 or None + addressType = Udp6TransportAddress + + def normalizeAddress(self, transportAddress): + if '%' in transportAddress[0]: # strip zone ID + ta = self.addressType( + (transportAddress[0].split('%')[0], + transportAddress[1], + 0, # flowinfo + 0) # scopeid + ) + else: + ta = self.addressType( + (transportAddress[0], transportAddress[1], 0, 0) + ) + + if isinstance(transportAddress, self.addressType) and \ + transportAddress.getLocalAddress(): + return ta.setLocalAddress(transportAddress.getLocalAddress()) + else: + return ta.setLocalAddress(self.getLocalAddress()) + +Udp6Transport = Udp6SocketTransport diff --git a/pysnmp/carrier/asyncore/dgram/unix.py b/pysnmp/carrier/asyncore/dgram/unix.py new file mode 100644 index 0000000..de53d44 --- /dev/null +++ b/pysnmp/carrier/asyncore/dgram/unix.py @@ -0,0 +1,50 @@ +# Implements asyncore-based UNIX transport domain +import os +import random +try: + from socket import AF_UNIX +except ImportError: + AF_UNIX = None +from pysnmp.carrier.base import AbstractTransportAddress +from pysnmp.carrier.asyncore.dgram.base import DgramSocketTransport + +domainName = snmpLocalDomain = (1, 3, 6, 1, 2, 1, 100, 1, 13) + +random.seed() + +class UnixTransportAddress(str, AbstractTransportAddress): pass + +class UnixSocketTransport(DgramSocketTransport): + sockFamily = AF_UNIX + addressType = UnixTransportAddress + + def openClientMode(self, iface=None): + if iface is None: + # UNIX domain sockets must be explicitly bound + iface = '' + while len(iface) < 8: + iface += chr(random.randrange(65, 91)) + iface += chr(random.randrange(97, 123)) + iface = os.path.sep + 'tmp' + os.path.sep + 'pysnmp' + iface + if os.path.exists(iface): + os.remove(iface) + DgramSocketTransport.openClientMode(self, iface) + self.__iface = iface + return self + + def openServerMode(self, iface): + DgramSocketTransport.openServerMode(self, iface) + self.__iface = iface + return self + + def closeTransport(self): + DgramSocketTransport.closeTransport(self) + try: + os.remove(self.__iface) + except OSError: + pass + +UnixTransport = UnixSocketTransport + +# Compatibility stub +UnixDgramSocketTransport = UnixSocketTransport diff --git a/pysnmp/carrier/asyncore/dispatch.py b/pysnmp/carrier/asyncore/dispatch.py new file mode 100644 index 0000000..790152d --- /dev/null +++ b/pysnmp/carrier/asyncore/dispatch.py @@ -0,0 +1,42 @@ +# Implements I/O over asynchronous sockets +from time import time +from sys import exc_info +from traceback import format_exception +from asyncore import socket_map +from asyncore import loop +from pysnmp.carrier.base import AbstractTransportDispatcher +from pysnmp.error import PySnmpError + +class AsyncoreDispatcher(AbstractTransportDispatcher): + def __init__(self): + self.__sockMap = {} # use own map for MT safety + self.timeout = 0.5 + AbstractTransportDispatcher.__init__(self) + + def getSocketMap(self): return self.__sockMap + def setSocketMap(self, sockMap=socket_map): self.__sockMap = sockMap + + def registerTransport(self, tDomain, t): + AbstractTransportDispatcher.registerTransport(self, tDomain, t) + t.registerSocket(self.__sockMap) + + def unregisterTransport(self, tDomain): + self.getTransport(tDomain).unregisterSocket(self.__sockMap) + AbstractTransportDispatcher.unregisterTransport(self, tDomain) + + def transportsAreWorking(self): + for transport in self.__sockMap.values(): + if transport.writable(): + return 1 + return 0 + + def runDispatcher(self, timeout=0.0): + while self.jobsArePending() or self.transportsAreWorking(): + try: + loop(timeout and timeout or self.timeout, + use_poll=True, map=self.__sockMap, count=1) + except KeyboardInterrupt: + raise + except: + raise PySnmpError('poll error: %s' % ';'.join(format_exception(*exc_info()))) + self.handleTimerTick(time()) diff --git a/pysnmp/entity/config.py b/pysnmp/entity/config.py index 085eea5..5c1bd83 100644 --- a/pysnmp/entity/config.py +++ b/pysnmp/entity/config.py @@ -1,7 +1,7 @@ # Initial SNMP engine configuration functions. During further operation, # SNMP engine might be configured remotely (through SNMP). from pyasn1.compat.octets import null -from pysnmp.carrier.asynsock.dgram import udp, udp6, unix +from pysnmp.carrier.asyncore.dgram import udp, udp6, unix from pysnmp.proto.secmod.rfc3414.auth import hmacmd5, hmacsha, noauth from pysnmp.proto.secmod.rfc3414.priv import des, nopriv from pysnmp.proto.secmod.rfc3826.priv import aes diff --git a/pysnmp/entity/rfc3413/oneliner/target.py b/pysnmp/entity/rfc3413/oneliner/target.py index 447fcc8..04ecb5f 100644 --- a/pysnmp/entity/rfc3413/oneliner/target.py +++ b/pysnmp/entity/rfc3413/oneliner/target.py @@ -1,5 +1,5 @@ import socket, sys -from pysnmp.carrier.asynsock.dgram import udp, udp6, unix +from pysnmp.carrier.asyncore.dgram import udp, udp6, unix from pysnmp import error from pyasn1.compat.octets import null diff --git a/pysnmp/proto/secmod/rfc2576.py b/pysnmp/proto/secmod/rfc2576.py index 7210ad8..6a7d1e9 100644 --- a/pysnmp/proto/secmod/rfc2576.py +++ b/pysnmp/proto/secmod/rfc2576.py @@ -3,7 +3,7 @@ import sys from pyasn1.codec.ber import encoder from pyasn1.error import PyAsn1Error from pysnmp.proto.secmod import base -from pysnmp.carrier.asynsock.dgram import udp, udp6, unix +from pysnmp.carrier.asyncore.dgram import udp, udp6, unix from pysnmp.smi.error import NoSuchInstanceError from pysnmp.proto import errind, error from pysnmp import debug diff --git a/setup.py b/setup.py index fe7789a..fccda85 100644 --- a/setup.py +++ b/setup.py @@ -96,6 +96,8 @@ params.update( { 'pysnmp.carrier', 'pysnmp.carrier.asynsock', 'pysnmp.carrier.asynsock.dgram', + 'pysnmp.carrier.asyncore', + 'pysnmp.carrier.asyncore.dgram', 'pysnmp.carrier.twisted', 'pysnmp.carrier.twisted.dgram', 'pysnmp.carrier.asyncio', -- cgit v1.2.1