rfc1155.py (2178B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\common\lib\pyasn1_modules\rfc1155.py 2 from pyasn1.type import univ, namedtype, namedval, tag, constraint 3 4 class ObjectName(univ.ObjectIdentifier): 5 pass 6 7 8 class SimpleSyntax(univ.Choice): 9 componentType = namedtype.NamedTypes(namedtype.NamedType('number', univ.Integer()), namedtype.NamedType('string', univ.OctetString()), namedtype.NamedType('object', univ.ObjectIdentifier()), namedtype.NamedType('empty', univ.Null())) 10 11 12 class IpAddress(univ.OctetString): 13 tagSet = univ.OctetString.tagSet.tagImplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 0)) 14 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueSizeConstraint(4, 4) 15 16 17 class NetworkAddress(univ.Choice): 18 componentType = namedtype.NamedTypes(namedtype.NamedType('internet', IpAddress())) 19 20 21 class Counter(univ.Integer): 22 tagSet = univ.Integer.tagSet.tagImplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 1)) 23 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(0, 4294967295L) 24 25 26 class Gauge(univ.Integer): 27 tagSet = univ.Integer.tagSet.tagImplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 2)) 28 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(0, 4294967295L) 29 30 31 class TimeTicks(univ.Integer): 32 tagSet = univ.Integer.tagSet.tagImplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 3)) 33 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(0, 4294967295L) 34 35 36 class Opaque(univ.OctetString): 37 tagSet = univ.OctetString.tagSet.tagImplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 4)) 38 39 40 class ApplicationSyntax(univ.Choice): 41 componentType = namedtype.NamedTypes(namedtype.NamedType('address', NetworkAddress()), namedtype.NamedType('counter', Counter()), namedtype.NamedType('gauge', Gauge()), namedtype.NamedType('ticks', TimeTicks()), namedtype.NamedType('arbitrary', Opaque())) 42 43 44 class ObjectSyntax(univ.Choice): 45 componentType = namedtype.NamedTypes(namedtype.NamedType('simple', SimpleSyntax()), namedtype.NamedType('application-wide', ApplicationSyntax()))