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

Side by Side Diff: third_party/google-endpoints/pyasn1_modules/rfc1157.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/rfc1157.txt
6 #
7 # Sample captures from:
8 # http://wiki.wireshark.org/SampleCaptures/
9 #
10 from pyasn1.type import univ, namedtype, namedval, tag, constraint
11 from pyasn1_modules import rfc1155
12
13 class Version(univ.Integer):
14 namedValues = namedval.NamedValues(
15 ('version-1', 0)
16 )
17 defaultValue = 0
18
19 class Community(univ.OctetString): pass
20
21 class RequestID(univ.Integer): pass
22 class ErrorStatus(univ.Integer):
23 namedValues = namedval.NamedValues(
24 ('noError', 0),
25 ('tooBig', 1),
26 ('noSuchName', 2),
27 ('badValue', 3),
28 ('readOnly', 4),
29 ('genErr', 5)
30 )
31 class ErrorIndex(univ.Integer): pass
32
33 class VarBind(univ.Sequence):
34 componentType = namedtype.NamedTypes(
35 namedtype.NamedType('name', rfc1155.ObjectName()),
36 namedtype.NamedType('value', rfc1155.ObjectSyntax())
37 )
38 class VarBindList(univ.SequenceOf):
39 componentType = VarBind()
40
41 class _RequestBase(univ.Sequence):
42 componentType = namedtype.NamedTypes(
43 namedtype.NamedType('request-id', RequestID()),
44 namedtype.NamedType('error-status', ErrorStatus()),
45 namedtype.NamedType('error-index', ErrorIndex()),
46 namedtype.NamedType('variable-bindings', VarBindList())
47 )
48
49 class GetRequestPDU(_RequestBase):
50 tagSet = _RequestBase.tagSet.tagImplicitly(
51 tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 0)
52 )
53 class GetNextRequestPDU(_RequestBase):
54 tagSet = _RequestBase.tagSet.tagImplicitly(
55 tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 1)
56 )
57 class GetResponsePDU(_RequestBase):
58 tagSet = _RequestBase.tagSet.tagImplicitly(
59 tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 2)
60 )
61 class SetRequestPDU(_RequestBase):
62 tagSet = _RequestBase.tagSet.tagImplicitly(
63 tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 3)
64 )
65
66 class TrapPDU(univ.Sequence):
67 componentType = namedtype.NamedTypes(
68 namedtype.NamedType('enterprise', univ.ObjectIdentifier()),
69 namedtype.NamedType('agent-addr', rfc1155.NetworkAddress()),
70 namedtype.NamedType('generic-trap', univ.Integer().clone(namedValues=nam edval.NamedValues(('coldStart', 0), ('warmStart', 1), ('linkDown', 2), ('linkUp' , 3), ('authenticationFailure', 4), ('egpNeighborLoss', 5), ('enterpriseSpecific ', 6)))),
71 namedtype.NamedType('specific-trap', univ.Integer()),
72 namedtype.NamedType('time-stamp', rfc1155.TimeTicks()),
73 namedtype.NamedType('variable-bindings', VarBindList())
74 )
75
76 class Pdus(univ.Choice):
77 componentType = namedtype.NamedTypes(
78 namedtype.NamedType('get-request', GetRequestPDU()),
79 namedtype.NamedType('get-next-request', GetNextRequestPDU()),
80 namedtype.NamedType('get-response', GetResponsePDU()),
81 namedtype.NamedType('set-request', SetRequestPDU()),
82 namedtype.NamedType('trap', TrapPDU())
83 )
84
85 class Message(univ.Sequence):
86 componentType = namedtype.NamedTypes(
87 namedtype.NamedType('version', Version()),
88 namedtype.NamedType('community', Community()),
89 namedtype.NamedType('data', Pdus())
90 )
OLDNEW
« no previous file with comments | « third_party/google-endpoints/pyasn1_modules/rfc1155.py ('k') | third_party/google-endpoints/pyasn1_modules/rfc1901.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698