aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/snmp/snmp.asn
blob: 5626538d5791d23962ace1fe53c2cb7f8fd635d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
-- $id:$
   RFC1157-SNMP DEFINITIONS ::= BEGIN

--      IMPORTS
--          ObjectName, ObjectSyntax, NetworkAddress, IpAddress, TimeTicks
--              FROM RFC1155-SMI;

-- Local imports
--      IMPORTS
--          ObjectName, ObjectSyntax, NetworkAddress, IpAddress, TimeTicks
--              FROM RFC1155-SMI;

-- names of objects
-- (Note that these definitions of ObjectName and NotificationName
--  are not to be IMPORTed by MIB modules.)

ObjectName ::=
    OBJECT IDENTIFIER

NotificationName ::=
    OBJECT IDENTIFIER

-- syntax of objects

-- the "base types" defined here are:
--   3 built-in ASN.1 types: INTEGER, OCTET STRING, OBJECT IDENTIFIER
--   8 application-defined types: Integer32, IpAddress, Counter32,
--              Gauge32, Unsigned32, TimeTicks, Opaque, and Counter64

ObjectSyntax ::=
    CHOICE {
        simple
            SimpleSyntax,

          -- note that SEQUENCEs for conceptual tables and
          -- rows are not mentioned here...

        application-wide
            ApplicationSyntax
    }
-- built-in ASN.1 types

SimpleSyntax ::=
    CHOICE {
        -- INTEGERs with a more restrictive range
        -- may also be used
        integer-value		Integer-value,

        -- OCTET STRINGs with a more restrictive size
        -- may also be used
        string-value		String-value,

        objectID-value		ObjectID-value,
		empty				Empty
		-- Added from RFC 1155 for Ethereal
							      }
String-value ::= OCTET STRING (SIZE (0..65535))

Integer-value ::=               -- includes Integer32
            INTEGER (-2147483648..2147483647)
        -- OCTET STRINGs with a more restrictive size
        -- may also be used

-- indistinguishable from INTEGER, but never needs more than
-- 32-bits for a two's complement representation
Integer32 ::= INTEGER (-2147483648..2147483647)

ObjectID-value ::= OBJECT IDENTIFIER

Empty ::= NULL
							-- Added from RFC 1155 for Ethereal

-- application-wide types

ApplicationSyntax ::=
    CHOICE {
        ipAddress-value
            IpAddress,

        counter-value
            Counter32,

        timeticks-value
            TimeTicks,

        arbitrary-value
            Opaque,

        big-counter-value
            Counter64,

        unsigned-integer-value  -- includes Gauge32
            Unsigned32
    }

NetworkAddress ::=
                 CHOICE {
                      internet
                      IpAddress
                     }

-- in network-byte order
-- (this is a tagged type for historical reasons)
IpAddress ::=
    [APPLICATION 0]
        IMPLICIT OCTET STRING (SIZE (4))

-- this wraps
Counter32 ::=
    [APPLICATION 1]
        IMPLICIT INTEGER (0..4294967295)

-- this doesn't wrap
Gauge32 ::=
    [APPLICATION 2]
        IMPLICIT INTEGER (0..4294967295)

-- an unsigned 32-bit quantity
-- indistinguishable from Gauge32
Unsigned32 ::=
    [APPLICATION 2]
        IMPLICIT INTEGER (0..4294967295)

-- hundredths of seconds since an epoch
TimeTicks ::=
    [APPLICATION 3]
        IMPLICIT INTEGER (0..4294967295)

-- for backward-compatibility only
Opaque ::=
    [APPLICATION 4]
        IMPLICIT OCTET STRING

-- for counters that wrap in less than one hour with only 32 bits
Counter64 ::=
    [APPLICATION 6]
        IMPLICIT INTEGER (0..18446744073709551615)




-- End Import
          -- top-level message

          Message ::=
                  SEQUENCE {
                      version    Version,      -- version-1 for this RFC

                      community        -- community name
                          OCTET STRING,

                      data             -- e.g., PDUs if trivial
							PDUs
--                          ANY          
-- authentication is being used
                  }

Version ::= INTEGER {
	version-1(0),
	v2c(1),
	v2u (2),
	snmpv3(3)
        }


    Messagev2u ::=
         SEQUENCE {
             version Version,
--                 INTEGER { v2 (2) },

             parameters
                 OCTET STRING,
             -- <model=1>
             --      <qoS><agentID><agentBoots><agentTime><maxSize>
             --      <userLen><userName><authLen><authDigest>
             --      <contextSelector>

             datav2u
                 CHOICE {
                     plaintext
                         PDUs,
                     encrypted
                         OCTET STRING
                 }
         }
-- USMSecurityParametersSyntax DEFINITIONS IMPLICIT TAGS ::= BEGIN

      UsmSecurityParameters ::=
          SEQUENCE {
           -- global User-based security parameters
              msgAuthoritativeEngineID     SnmpEngineID,
              msgAuthoritativeEngineBoots  INTEGER (0..2147483647),
              msgAuthoritativeEngineTime   INTEGER (0..2147483647),
              msgUserName                  OCTET STRING (SIZE(1..32)),
           -- authentication protocol specific parameters
              msgAuthenticationParameters  OCTET STRING,
           -- privacy protocol specific parameters
              msgPrivacyParameters         OCTET STRING
          }
 --  END USMSecurityParametersSyntax

SnmpEngineID ::= OCTET STRING

-- SNMPv3MessageSyntax DEFINITIONS IMPLICIT TAGS ::= BEGIN

       SNMPv3Message ::= SEQUENCE {
           -- identify the layout of the SNMPv3Message
           -- this element is in same position as in SNMPv1
           -- and SNMPv2c, allowing recognition
           -- the value 3 is used for snmpv3
           msgVersion Version, 
		   -- INTEGER ( 0 .. 2147483647 ),
           -- administrative parameters
           msgGlobalData HeaderData,
           -- security model-specific parameters
           -- format defined by Security Model
           msgSecurityParameters OCTET STRING,
           msgData  ScopedPduData
       }

       HeaderData ::= SEQUENCE {
           msgID      INTEGER (0..2147483647),
           msgMaxSize INTEGER (484..2147483647),

           msgFlags   OCTET STRING (SIZE(1)),
                      --  .... ...1   authFlag
                      --  .... ..1.   privFlag
                      --  .... .1..   reportableFlag
                      --              Please observe:
                      --  .... ..00   is OK, means noAuthNoPriv
                      --  .... ..01   is OK, means authNoPriv
                      --  .... ..10   reserved, must NOT be used.
                      --  .... ..11   is OK, means authPriv

           msgSecurityModel INTEGER (1..2147483647)
       }


       ScopedPduData ::= CHOICE {
           plaintext    ScopedPDU,
           encryptedPDU OCTET STRING  -- encrypted scopedPDU value
       }

       ScopedPDU ::= SEQUENCE {
           contextEngineID  OCTET STRING,
           contextName      OCTET STRING,
           data             PDUs
		   -- ANY 
		   -- e.g., PDUs as defined in RFC 1905
       }

-- END SNMPv3MessageSyntax
          -- protocol data units

          PDUs ::=
                  CHOICE {
                              get-request
                                  GetRequest-PDU,

                              get-next-request
                                  GetNextRequest-PDU,

                              get-response
                                  GetResponse-PDU,

                              set-request
                                  SetRequest-PDU,

                              trap
                                  Trap-PDU,
								  -- v2 added ?

							  getBulkRequest
								  GetBulkRequest-PDU,

							  informRequest
								  InformRequest-PDU,

							  sNMPv2-Trap
								  SNMPv2-Trap-PDU,

							  report
								  Report-PDU	  	
                          }

          -- PDUs

          GetRequest-PDU ::=
              [0]
                  IMPLICIT PDU

          GetNextRequest-PDU ::=
              [1]
                  IMPLICIT PDU

          GetResponse-PDU ::=
              [2]
                  IMPLICIT PDU

          SetRequest-PDU ::=
              [3]
                  IMPLICIT PDU
-- v2 added
    -- [4] is obsolete

     GetBulkRequest-PDU ::=
         [5]
             IMPLICIT BulkPDU

     InformRequest-PDU ::=
         [6]
             IMPLICIT PDU

     SNMPv2-Trap-PDU ::=
         [7]
             IMPLICIT PDU

     --   Usage and precise semantics of Report-PDU are not presently
     --   defined.  Any SNMP administrative framework making use of
     --   this PDU must define its usage and semantics.
     Report-PDU ::=
         [8]
             IMPLICIT PDU


          PDU ::=
                  SEQUENCE {
                     request-id
                          INTEGER,

                      error-status      -- sometimes ignored
                          INTEGER {
                     noError(0),
                     tooBig(1),
                     noSuchName(2),   -- for proxy compatibility
                     badValue(3),     -- for proxy compatibility
                     readOnly(4),     -- for proxy compatibility
                     genErr(5),
                     noAccess(6),
                     wrongType(7),
                     wrongLength(8),
                     wrongEncoding(9),
                     wrongValue(10),
                     noCreation(11),
                     inconsistentValue(12),
                     resourceUnavailable(13),
                     commitFailed(14),
                     undoFailed(15),
                     authorizationError(16),
                     notWritable(17),
                     inconsistentName(18)
                 },


                      error-index       -- sometimes ignored
                         INTEGER,

                      variable-bindings -- values are sometimes ignored
                          VarBindList
                  }
-- v2
     BulkPDU ::=                     -- MUST be identical in
         SEQUENCE {                  -- structure to PDU
             request-id
                 Integer32,

             non-repeaters
                 INTEGER (0..2147483647),

             max-repetitions
                 INTEGER (0..2147483647),

             variable-bindings       -- values are ignored
                 VarBindList
         }

-- end v2
          Trap-PDU ::=
              [4]
                 IMPLICIT SEQUENCE {
                      enterprise        -- type of object generating
                                        -- trap, see sysObjectID in [5]


                          OBJECT IDENTIFIER,

                      agent-addr        -- address of object generating
                          NetworkAddress, -- trap

                      generic-trap      -- generic trap type
                          INTEGER {
                              coldStart(0),
                              warmStart(1),
                              linkDown(2),
                              linkUp(3),
                              authenticationFailure(4),
                              egpNeighborLoss(5),
                              enterpriseSpecific(6)
                          },

                      specific-trap  INTEGER,   
-- specific code, present even
-- if generic-trap is not
-- enterpriseSpecific

                      time-stamp	TimeTicks,
-- time elapsed between the last
-- (re)initialization of the network
-- entity and the generation of the trap

                       variable-bindings  VarBindList
-- "interesting" information
                  }


-- variable bindings

     VarBind ::=
         SEQUENCE {
             name
                 ObjectName,

             valueType ValueType
         }

ValueType ::=
             CHOICE {
                 value
                     ObjectSyntax,

                 unSpecified         -- in retrieval requests
                         NULL,

                                     -- exceptions in responses
                 noSuchObject[0]
                         IMPLICIT NULL,

                 noSuchInstance[1]
                         IMPLICIT NULL,

                 endOfMibView[2]
                         IMPLICIT NULL
						 }
 

         VarBindList ::=
                  SEQUENCE OF
                     VarBind

-- SMUX DEFINITIONS ::= BEGIN RFC 1227

SMUX-PDUs ::=
       CHOICE {
           open            -- SMUX peer uses
               OpenPDU,    -- immediately after TCP open

           close           -- either uses immediately before TCP close
               ClosePDU,

           registerRequest -- SMUX peer uses
               RReqPDU,

--           registerResponse .. SNMP agent uses
--               RRspPDU,
--
--               PDUs,
-- Revritten
			registerResponse RegisterResponse,
			    -- note that roles are reversed:
                --   SNMP agent does get/get-next/set
                --   SMUX peer does get-response/trap

           commitOrRollback -- SNMP agent uses
               SOutPDU
      }

RegisterResponse ::= CHOICE {
	rRspPDU RRspPDU,
	pDUs	PDUs
	}

  -- open PDU
   -- currently only simple authentication

   OpenPDU ::=
       CHOICE {
          smux-simple

             SimpleOpen
       }

   SimpleOpen ::=
       [APPLICATION 0] IMPLICIT
           SEQUENCE {
               smux-version     -- of SMUX protocol
                   INTEGER {
                       version-1(0)
                   },

               identity    -- of SMUX peer, authoritative
                   OBJECT IDENTIFIER,

               description -- of SMUX peer, implementation-specific
                   DisplayString,

               password    -- zero length indicates no authentication
                   OCTET STRING
           }

DisplayString ::= OCTET STRING
   -- close PDU

   ClosePDU ::=
       [APPLICATION 1] IMPLICIT
           INTEGER {
               goingDown(0),
               unsupportedVersion(1),
               packetFormat(2),
               protocolError(3),
               internalError(4),
               authenticationFailure(5)
           }


   -- insert PDU

   RReqPDU ::=
       [APPLICATION 2] IMPLICIT
           SEQUENCE {
               subtree
                   ObjectName,

               priority    -- the lower the better, "-1" means default
                   INTEGER (-1..2147483647),

               operation

                   INTEGER {
                       delete(0),    -- remove registration
                       readOnly(1),  -- add registration, objects are RO
                       readWrite(2)  --   .., objects are RW
                   }
           }

   RRspPDU ::=
       [APPLICATION 3] IMPLICIT
           INTEGER {
               failure(-1)

              -- on success the non-negative priority is returned
           }

   SOutPDU ::=
       [APPLICATION 4] IMPLICIT
           INTEGER {
               commit(0),
               rollback(1)
           }



         END