pysnmp-sky/pysnmp/proto/mpmod/base.py

44 lines
1.7 KiB
Python
Raw Normal View History

2015-11-20 21:57:28 +01:00
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
2015-11-20 21:57:28 +01:00
# License: http://pysnmp.sf.net/license.html
#
from pysnmp.proto.mpmod import cache
from pysnmp.proto import error
2005-06-14 12:43:02 +02:00
2016-04-02 23:43:14 +02:00
2016-06-12 14:07:24 +02:00
class AbstractMessageProcessingModel(object):
snmpMsgSpec = NotImplementedError
2016-04-02 23:43:14 +02:00
2005-06-14 12:43:02 +02:00
def __init__(self):
2011-01-23 13:34:58 +01:00
self._snmpMsgSpec = self.snmpMsgSpec() # local copy
self._cache = cache.Cache()
2015-10-17 11:54:53 +02:00
def prepareOutgoingMessage(self, snmpEngine, transportDomain,
transportAddress, messageProcessingModel,
securityModel, securityName, securityLevel,
contextEngineId, contextName, pduVersion,
pdu, expectResponse, sendPduHandle):
2006-09-05 17:37:40 +02:00
raise error.ProtocolError('method not implemented')
2015-10-17 11:54:53 +02:00
def prepareResponseMessage(self, snmpEngine, messageProcessingModel,
securityModel, securityName, securityLevel,
contextEngineId, contextName, pduVersion,
pdu, maxSizeResponseScopedPDU,
stateReference, statusInformation):
2006-09-05 17:37:40 +02:00
raise error.ProtocolError('method not implemented')
2015-10-17 11:54:53 +02:00
def prepareDataElements(self, snmpEngine, transportDomain,
transportAddress, wholeMsg):
2006-09-05 17:37:40 +02:00
raise error.ProtocolError('method not implemented')
2005-06-14 12:43:02 +02:00
def releaseStateInformation(self, sendPduHandle):
2005-06-22 23:48:22 +02:00
try:
self._cache.popBySendPduHandle(sendPduHandle)
2005-06-22 23:48:22 +02:00
except error.ProtocolError:
2016-04-02 23:43:14 +02:00
pass # XXX maybe these should all follow some scheme?
2015-10-17 11:54:53 +02:00
2006-09-20 18:26:13 +02:00
def receiveTimerTick(self, snmpEngine, timeNow):
self._cache.expireCaches()