Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(763)

Side by Side Diff: third_party/google-endpoints/pyasn1_modules/rfc1155.py

Issue 2666783008: Add google-endpoints to third_party/. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #
2 # SNMPv1 message syntax
3 #
4 # ASN.1 source from:
5 # http://www.ietf.org/rfc/rfc1155.txt
6 #
7 # Sample captures from:
8 # http://wiki.wireshark.org/SampleCaptures/
9 #
10 from pyasn1.type import univ, namedtype, namedval, tag, constraint
11
12 class ObjectName(univ.ObjectIdentifier): pass
13
14 class SimpleSyntax(univ.Choice):
15 componentType = namedtype.NamedTypes(
16 namedtype.NamedType('number', univ.Integer()),
17 namedtype.NamedType('string', univ.OctetString()),
18 namedtype.NamedType('object', univ.ObjectIdentifier()),
19 namedtype.NamedType('empty', univ.Null())
20 )
21
22 class IpAddress(univ.OctetString):
23 tagSet = univ.OctetString.tagSet.tagImplicitly(
24 tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 0)
25 )
26 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueSizeConstraint(
27 4, 4
28 )
29 class NetworkAddress(univ.Choice):
30 componentType = namedtype.NamedTypes(
31 namedtype.NamedType('internet', IpAddress())
32 )
33
34 class Counter(univ.Integer):
35 tagSet = univ.Integer.tagSet.tagImplicitly(
36 tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 1)
37 )
38 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
39 0, 4294967295
40 )
41 class Gauge(univ.Integer):
42 tagSet = univ.Integer.tagSet.tagImplicitly(
43 tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 2)
44 )
45 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
46 0, 4294967295
47 )
48 class TimeTicks(univ.Integer):
49 tagSet = univ.Integer.tagSet.tagImplicitly(
50 tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 3)
51 )
52 subtypeSpec = univ.Integer.subtypeSpec + constraint.ValueRangeConstraint(
53 0, 4294967295
54 )
55 class Opaque(univ.OctetString):
56 tagSet = univ.OctetString.tagSet.tagImplicitly(
57 tag.Tag(tag.tagClassApplication, tag.tagFormatSimple, 4)
58 )
59
60 class ApplicationSyntax(univ.Choice):
61 componentType = namedtype.NamedTypes(
62 namedtype.NamedType('address', NetworkAddress()),
63 namedtype.NamedType('counter', Counter()),
64 namedtype.NamedType('gauge', Gauge()),
65 namedtype.NamedType('ticks', TimeTicks()),
66 namedtype.NamedType('arbitrary', Opaque())
67 )
68
69 class ObjectSyntax(univ.Choice):
70 componentType = namedtype.NamedTypes(
71 namedtype.NamedType('simple', SimpleSyntax()),
72 namedtype.NamedType('application-wide', ApplicationSyntax())
73 )
OLDNEW
« no previous file with comments | « third_party/google-endpoints/pyasn1_modules/pem.py ('k') | third_party/google-endpoints/pyasn1_modules/rfc1157.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698