/usr/share/pyshared/pysnmp/smi/mibs/SNMPv2-TM.py is in python-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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | try:
from socket import inet_ntop, inet_pton, AF_INET
except ImportError:
from socket import inet_ntoa, inet_aton, AF_INET
inet_ntop = lambda x,y: inet_ntoa(y)
inet_pton = lambda x,y: inet_aton(y)
from pyasn1.compat.octets import int2oct, oct2int
( OctetString, ) = mibBuilder.importSymbols('ASN1', 'OctetString')
( ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint")
( ModuleIdentity, MibIdentifier, ObjectIdentity, snmpModules, snmpDomains, snmpProxys ) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'MibIdentifier', 'ObjectIdentity', 'snmpModules', 'snmpDomains', 'snmpProxys')
( TextualConvention, ) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention')
snmpv2tm = ModuleIdentity(snmpModules.name + (19,)).setRevisions(("2002-10-16 00:00",))
snmpUDPDomain = ObjectIdentity(snmpDomains.name + (1,))
class SnmpUDPAddress(TextualConvention, OctetString):
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(6, 6)
displayHint = "1d.1d.1d.1d/2d"
def prettyIn(self, value):
if isinstance(value, tuple):
# Wild hack -- need to implement TextualConvention.prettyIn
value = inet_pton(AF_INET, value[0]) + \
int2oct((value[1] >> 8) & 0xff) + \
int2oct(value[1] & 0xff)
return OctetString.prettyIn(self, value)
# Socket address syntax coercion
def __getitem__(self, i):
if not hasattr(self, '__tuple_value'):
v = self.asOctets()
self.__tuple_value = (
inet_ntop(AF_INET, v[:4]),
oct2int(v[4]) << 8 | oct2int(v[5])
)
return self.__tuple_value[i]
snmpCLNSDomain = ObjectIdentity(snmpDomains.name + (2,))
snmpCONSDomain = ObjectIdentity(snmpDomains.name + (3,))
class SnmpOSIAddress(TextualConvention, OctetString):
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(1, 85)
displayHint = "*1x:/1x:"
snmpDDPDomain = ObjectIdentity(snmpDomains.name + (4,))
class SnmpNBPAddress(OctetString, TextualConvention):
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(3, 99)
snmpIPXDomain = ObjectIdentity(snmpDomains.name + (5,))
class SnmpIPXAddress(TextualConvention, OctetString):
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(12, 12)
displayHint = "4x.1x:1x:1x:1x:1x:1x.2d"
rfc1157Proxy = MibIdentifier(snmpProxys.name + (1,))
rfc1157Domain = MibIdentifier(rfc1157Proxy.name + (1,))
# Module identity
mibBuilder.exportSymbols("SNMPv2-TM", PYSNMP_MODULE_ID=snmpv2tm)
mibBuilder.exportSymbols(
'SNMPv2-TM', snmpv2tm=snmpv2tm, snmpUDPDomain=snmpUDPDomain,
SnmpUDPAddress=SnmpUDPAddress,
snmpCLNSDomain=snmpCLNSDomain, snmpCONSDomain=snmpCONSDomain,
SnmpOSIAddress=SnmpOSIAddress, snmpDDPDomain=snmpDDPDomain,
SnmpNBPAddress=SnmpNBPAddress, snmpIPXDomain=snmpIPXDomain,
SnmpIPXAddress=SnmpIPXAddress, rfc1157Proxy=rfc1157Proxy,
rfc1157Domain=rfc1157Domain
)
|