rfc1902.py (3029B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\common\lib\pyasn1_modules\rfc1902.py 2 from pyasn1.type import univ, namedtype, namedval, tag, constraint 3 4 class Integer(univ.Integer): 5 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(-2147483648, 2147483647) 6 7 8 class Integer32(univ.Integer): 9 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(-2147483648, 2147483647) 10 11 12 class OctetString(univ.OctetString): 13 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueSizeConstraint(0, 65535) 14 15 16 class IpAddress(univ.OctetString): 17 tagSet = univ.OctetString.tagSet.tagImplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 0)) 18 subtypeSpec = univ.OctetString.subtypeSpec + constraint.ValueSizeConstraint(4, 4) 19 20 21 class Counter32(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 Gauge32(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 Unsigned32(univ.Integer): 32 tagSet = univ.Integer.tagSet.tagImplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 2)) 33 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(0, 4294967295L) 34 35 36 class TimeTicks(univ.Integer): 37 tagSet = univ.Integer.tagSet.tagImplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 3)) 38 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(0, 4294967295L) 39 40 41 class Opaque(univ.OctetString): 42 tagSet = univ.OctetString.tagSet.tagImplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 4)) 43 44 45 class Counter64(univ.Integer): 46 tagSet = univ.Integer.tagSet.tagImplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 6)) 47 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(0, 18446744073709551615L) 48 49 50 class Bits(univ.OctetString): 51 pass 52 53 54 class ObjectName(univ.ObjectIdentifier): 55 pass 56 57 58 class SimpleSyntax(univ.Choice): 59 componentType = namedtype.NamedTypes(namedtype.NamedType('integer-value', Integer()), namedtype.NamedType('string-value', OctetString()), namedtype.NamedType('objectID-value', univ.ObjectIdentifier())) 60 61 62 class ApplicationSyntax(univ.Choice): 63 componentType = namedtype.NamedTypes(namedtype.NamedType('ipAddress-value', IpAddress()), namedtype.NamedType('counter-value', Counter32()), namedtype.NamedType('timeticks-value', TimeTicks()), namedtype.NamedType('arbitrary-value', Opaque()), namedtype.NamedType('big-counter-value', Counter64()), namedtype.NamedType('gauge32-value', Gauge32())) 64 65 66 class ObjectSyntax(univ.Choice): 67 componentType = namedtype.NamedTypes(namedtype.NamedType('simple', SimpleSyntax()), namedtype.NamedType('application-wide', ApplicationSyntax()))