summaryrefslogtreecommitdiff
path: root/pysnmp/carrier/base.py
diff options
context:
space:
mode:
authorelie <elie>2015-01-20 16:57:59 +0000
committerelie <elie>2015-01-20 16:57:59 +0000
commitc317a137113d4f39a60052c0ae59a9c48b0dd334 (patch)
tree19fbd1d94927e20894d140fd1a77ac439462167e /pysnmp/carrier/base.py
parent48fa5f20c6a341708db517dc6a78dbd84d057192 (diff)
downloadpysnmp-git-c317a137113d4f39a60052c0ae59a9c48b0dd334.tar.gz
- 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.
Diffstat (limited to 'pysnmp/carrier/base.py')
-rw-r--r--pysnmp/carrier/base.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/pysnmp/carrier/base.py b/pysnmp/carrier/base.py
index 448b74d4..51c76eb0 100644
--- a/pysnmp/carrier/base.py
+++ b/pysnmp/carrier/base.py
@@ -179,8 +179,21 @@ class AbstractTransportDispatcher:
self.unregisterRecvCbFun()
self.unregisterTimerCbFun()
+class AbstractTransportAddress:
+ _localAddress = None
+ def setLocalAddress(self, s):
+ self._localAddress = s
+ return self
+
+ def getLocalAddress(self):
+ return self._localAddress
+
+ def clone(self, localAddress=None):
+ return self.__class__(self).setLocalAddress(localAddress is None and self.getLocalAddress() or localAddress)
+
class AbstractTransport:
protoTransportDispatcher = None
+ addressType = AbstractTransportAddress
_cbFun = None
@classmethod
def isCompatibleWithDispatcher(cls, transportDispatcher):