Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
rfc1155.py97 linesDownload Raw Back to pyasn1_modules
1#2# This file is part of pyasn1-modules software.3#4# Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>5# License: http://snmplabs.com/pyasn1/license.html6#7# SNMPv1 message syntax8#9# ASN.1 source from:10# http://www.ietf.org/rfc/rfc1155.txt11#12# Sample captures from:13# http://wiki.wireshark.org/SampleCaptures/14#15from pyasn1.type import constraint16from pyasn1.type import namedtype17from pyasn1.type import tag18from pyasn1.type import univ19 20 21class ObjectName(univ.ObjectIdentifier):22    pass23 24 25class SimpleSyntax(univ.Choice):26    componentType = namedtype.NamedTypes(27        namedtype.NamedType('number', univ.Integer()),28        namedtype.NamedType('string', univ.OctetString()),29        namedtype.NamedType('object', univ.ObjectIdentifier()),30        namedtype.NamedType('empty', univ.Null())31    )32 33 34class IpAddress(univ.OctetString):35    tagSet = univ.OctetString.tagSet.tagImplicitly(36        tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 0)37    )38    subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueSizeConstraint(39        4, 440    )41 42 43class NetworkAddress(univ.Choice):44    componentType = namedtype.NamedTypes(45        namedtype.NamedType('internet', IpAddress())46    )47 48 49class Counter(univ.Integer):50    tagSet = univ.Integer.tagSet.tagImplicitly(51        tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 1)52    )53    subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(54        0, 429496729555    )56 57 58class Gauge(univ.Integer):59    tagSet = univ.Integer.tagSet.tagImplicitly(60        tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 2)61    )62    subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(63        0, 429496729564    )65 66 67class TimeTicks(univ.Integer):68    tagSet = univ.Integer.tagSet.tagImplicitly(69        tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 3)70    )71    subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(72        0, 429496729573    )74 75 76class Opaque(univ.OctetString):77    tagSet = univ.OctetString.tagSet.tagImplicitly(78        tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 4)79    )80 81 82class ApplicationSyntax(univ.Choice):83    componentType = namedtype.NamedTypes(84        namedtype.NamedType('address', NetworkAddress()),85        namedtype.NamedType('counter', Counter()),86        namedtype.NamedType('gauge', Gauge()),87        namedtype.NamedType('ticks', TimeTicks()),88        namedtype.NamedType('arbitrary', Opaque())89    )90 91 92class ObjectSyntax(univ.Choice):93    componentType = namedtype.NamedTypes(94        namedtype.NamedType('simple', SimpleSyntax()),95        namedtype.NamedType('application-wide', ApplicationSyntax())96    )97 
codekingpro/portable-devtools · Team Ai