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

Side by Side Diff: third_party/google-endpoints/pyasn1_modules/rfc1905.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 # SNMPv2c PDU syntax
3 #
4 # ASN.1 source from:
5 # http://www.ietf.org/rfc/rfc1905.txt
6 #
7 from pyasn1.type import univ, namedtype, namedval, tag, constraint
8 from pyasn1_modules import rfc1902
9
10 max_bindings = rfc1902.Integer(2147483647)
11
12 class _BindValue(univ.Choice):
13 componentType = namedtype.NamedTypes(
14 namedtype.NamedType('value', rfc1902.ObjectSyntax()),
15 namedtype.NamedType('unSpecified', univ.Null()),
16 namedtype.NamedType('noSuchObject', univ.Null().subtype(implicitTag=tag. Tag(tag.tagClassContext, tag.tagFormatSimple, 0))),
17 namedtype.NamedType('noSuchInstance', univ.Null().subtype(implicitTag=ta g.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))),
18 namedtype.NamedType('endOfMibView', univ.Null().subtype(implicitTag=tag. Tag(tag.tagClassContext, tag.tagFormatSimple, 2)))
19 )
20
21 class VarBind(univ.Sequence):
22 componentType = namedtype.NamedTypes(
23 namedtype.NamedType('name', rfc1902.ObjectName()),
24 namedtype.NamedType('', _BindValue())
25 )
26
27 class VarBindList(univ.SequenceOf):
28 componentType = VarBind()
29 subtypeSpec = univ.SequenceOf.subtypeSpec + constraint.ValueSizeConstraint(
30 0, max_bindings
31 )
32
33 class PDU(univ.Sequence):
34 componentType = namedtype.NamedTypes(
35 namedtype.NamedType('request-id', rfc1902.Integer32()),
36 namedtype.NamedType('error-status', univ.Integer(namedValues=namedval.Na medValues(('noError', 0), ('tooBig', 1), ('noSuchName', 2), ('badValue', 3), ('r eadOnly', 4), ('genErr', 5), ('noAccess', 6), ('wrongType', 7), ('wrongLength', 8), ('wrongEncoding', 9), ('wrongValue', 10), ('noCreation', 11), ('inconsistent Value', 12), ('resourceUnavailable', 13), ('commitFailed', 14), ('undoFailed', 1 5), ('authorizationError', 16), ('notWritable', 17), ('inconsistentName', 18)))) ,
37 namedtype.NamedType('error-index', univ.Integer().subtype(subtypeSpec=co nstraint.ValueRangeConstraint(0, max_bindings))),
38 namedtype.NamedType('variable-bindings', VarBindList())
39 )
40
41 class BulkPDU(univ.Sequence):
42 componentType = namedtype.NamedTypes(
43 namedtype.NamedType('request-id', rfc1902.Integer32()),
44 namedtype.NamedType('non-repeaters', univ.Integer().subtype(subtypeSpec= constraint.ValueRangeConstraint(0, max_bindings))),
45 namedtype.NamedType('max-repetitions', univ.Integer().subtype(subtypeSpe c=constraint.ValueRangeConstraint(0, max_bindings))),
46 namedtype.NamedType('variable-bindings', VarBindList())
47 )
48
49 class GetRequestPDU(PDU):
50 tagSet = PDU.tagSet.tagImplicitly(
51 tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)
52 )
53
54 class GetNextRequestPDU(PDU):
55 tagSet = PDU.tagSet.tagImplicitly(
56 tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)
57 )
58
59 class ResponsePDU(PDU):
60 tagSet = PDU.tagSet.tagImplicitly(
61 tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)
62 )
63
64 class SetRequestPDU(PDU):
65 tagSet = PDU.tagSet.tagImplicitly(
66 tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)
67 )
68
69 class GetBulkRequestPDU(BulkPDU):
70 tagSet = PDU.tagSet.tagImplicitly(
71 tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 5)
72 )
73
74 class InformRequestPDU(PDU):
75 tagSet = PDU.tagSet.tagImplicitly(
76 tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 6)
77 )
78
79 class SNMPv2TrapPDU(PDU):
80 tagSet = PDU.tagSet.tagImplicitly(
81 tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 7)
82 )
83
84 class ReportPDU(PDU):
85 tagSet = PDU.tagSet.tagImplicitly(
86 tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 8)
87 )
88
89 class PDUs(univ.Choice):
90 componentType = namedtype.NamedTypes(
91 namedtype.NamedType('get-request', GetRequestPDU()),
92 namedtype.NamedType('get-next-request', GetNextRequestPDU()),
93 namedtype.NamedType('get-bulk-request', GetBulkRequestPDU()),
94 namedtype.NamedType('response', ResponsePDU()),
95 namedtype.NamedType('set-request', SetRequestPDU()),
96 namedtype.NamedType('inform-request', InformRequestPDU()),
97 namedtype.NamedType('snmpV2-trap', SNMPv2TrapPDU()),
98 namedtype.NamedType('report', ReportPDU())
99 )
100
OLDNEW
« no previous file with comments | « third_party/google-endpoints/pyasn1_modules/rfc1902.py ('k') | third_party/google-endpoints/pyasn1_modules/rfc2251.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698