diff options
author | elie <elie> | 2014-04-04 15:09:40 +0000 |
---|---|---|
committer | elie <elie> | 2014-04-04 15:09:40 +0000 |
commit | 11082b31367810bc736562872418a6be5fe89aa6 (patch) | |
tree | 175844c3fcaad77de2c9e0312b040f4a981c8d71 | |
parent | 33cf47df0eaf40cf917936de88c7a90031907add (diff) | |
download | pysnmp-11082b31367810bc736562872418a6be5fe89aa6.tar.gz |
_sendRspPdu() method introduced to tap onto PDU processing
this is likely to be reworked
-rw-r--r-- | pysnmp/entity/rfc3413/cmdrsp.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/pysnmp/entity/rfc3413/cmdrsp.py b/pysnmp/entity/rfc3413/cmdrsp.py index f0f3fbd..0caa1f8 100644 --- a/pysnmp/entity/rfc3413/cmdrsp.py +++ b/pysnmp/entity/rfc3413/cmdrsp.py @@ -26,9 +26,9 @@ class CommandResponderBase: self.snmpContext.contextEngineId, self.pduTypes ) self.snmpContext = self.__pendingReqs = None - + def sendRsp(self, snmpEngine, stateReference, - errorStatus, errorIndex, varBinds): + errorStatus, errorIndex, varBinds): ( messageProcessingModel, securityModel, securityName, @@ -41,12 +41,27 @@ class CommandResponderBase: maxSizeResponseScopedPDU, statusInformation ) = self.__pendingReqs[stateReference] - debug.logger & debug.flagApp and debug.logger('sendRsp: stateReference %s, errorStatus %s, errorIndex %s, varBinds %s' % (stateReference, errorStatus, errorIndex, varBinds)) - v2c.apiPDU.setErrorStatus(PDU, errorStatus) v2c.apiPDU.setErrorIndex(PDU, errorIndex) v2c.apiPDU.setVarBinds(PDU, varBinds) + debug.logger & debug.flagApp and debug.logger('sendRsp: stateReference %s, errorStatus %s, errorIndex %s, varBinds %s' % (stateReference, errorStatus, errorIndex, varBinds)) + + self._sendRspPdu(snmpEngine, stateReference, PDU) + + def _sendRspPdu(self, snmpEngine, stateReference, PDU): + ( messageProcessingModel, + securityModel, + securityName, + securityLevel, + contextEngineId, + contextName, + pduVersion, + _, + origPdu, + maxSizeResponseScopedPDU, + statusInformation ) = self.__pendingReqs[stateReference] + # Agent-side API complies with SMIv2 if messageProcessingModel == 0: PDU = rfc2576.v2ToV1(PDU, origPdu) |