/usr/lib/python3/dist-packages/pysnmp/carrier/twisted/dgram/udp.py is in python3-pysnmp4 4.2.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # Implements twisted-based UDP transport
import sys
from twisted.internet import reactor
from pysnmp.carrier.twisted.dgram.base import DgramTwistedTransport
from pysnmp.carrier import error
domainName = snmpUDPDomain = (1, 3, 6, 1, 6, 1, 1)
class UdpTwistedTransport(DgramTwistedTransport):
# AbstractTwistedTransport API
def openClientMode(self, iface=('', 0)):
try:
self._lport = reactor.listenUDP(iface[1], self, iface[0])
except Exception:
raise error.CarrierError(sys.exc_info()[1])
return self
def openServerMode(self, iface=('', 161)):
try:
self._lport = reactor.listenUDP(iface[1], self, iface[0])
except Exception:
raise error.CarrierError(sys.exc_info()[1])
return self
def closeTransport(self):
d = self._lport.stopListening()
d and d.addCallback(lambda x: None)
DgramTwistedTransport.closeTransport(self)
UdpTransport = UdpTwistedTransport
|