3. Définitions
SNMPv2-PDU DEFINITIONS ::= BEGIN
-- Unités de données de protocole
PDUs ::=
CHOICE {
get-request
GetRequest-PDU,
get-next-request
GetNextRequest-PDU,
get-bulk-request
GetBulkRequest-PDU,
response
Response-PDU,
set-request
SetRequest-PDU,
inform-request
InformRequest-PDU,
snmpV2-trap
SNMPv2-Trap-PDU,
report
Report-PDU
}
-- Types de PDU
GetRequest-PDU ::=
[0]
IMPLICIT PDU
GetNextRequest-PDU ::=
[1]
IMPLICIT PDU
Response-PDU ::=
[2]
IMPLICIT PDU
SetRequest-PDU ::=
[3]
IMPLICIT PDU
-- [4] est obsolète
GetBulkRequest-PDU ::=
[5]
IMPLICIT BulkPDU
InformRequest-PDU ::=
[6]
IMPLICIT PDU
SNMPv2-Trap-PDU ::=
[7]
IMPLICIT PDU
-- L'utilisation et la sémantique précise du Report-PDU ne sont actuellement pas définies.
-- Tout cadre de gestion SNMP utilisant ce PDU doit définir son utilisation et sa sémantique.
Report-PDU ::=
[8]
IMPLICIT PDU
max-bindings
INTEGER ::= 2147483647
PDU ::=
SEQUENCE {
request-id
Integer32,
error-status -- parfois ignoré
INTEGER {
noError(0),
tooBig(1),
noSuchName(2), -- pour la compatibilité proxy
badValue(3), -- pour la compatibilité proxy
readOnly(4), -- pour la compatibilité proxy
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 -- parfois ignoré
INTEGER (0..max-bindings),
variable-bindings -- les valeurs sont parfois ignorées
VarBindList
}
BulkPDU ::= -- La structure DOIT être identique à PDU
SEQUENCE {
request-id
Integer32,
non-repeaters
INTEGER (0..max-bindings),
max-repetitions
INTEGER (0..max-bindings),
variable-bindings -- les valeurs sont ignorées
VarBindList
}
-- Liaison de variable
VarBind ::=
SEQUENCE {
name
ObjectName,
CHOICE {
value
ObjectSyntax,
unSpecified -- dans les requêtes de récupération
NULL,
-- exceptions dans les réponses
noSuchObject[0]
IMPLICIT NULL,
noSuchInstance[1]
IMPLICIT NULL,
endOfMibView[2]
IMPLICIT NULL
}
}
-- Liste de liaisons de variables
VarBindList ::=
SEQUENCE (SIZE (0..max-bindings)) OF
VarBind
-- Définitions d'autres modules
Integer32 ::= [UNIVERSAL 2] IMPLICIT INTEGER (-2147483648..2147483647)
ObjectName ::= [UNIVERSAL 6] IMPLICIT OBJECT IDENTIFIER
ObjectSyntax ::= CHOICE {
simple
SimpleSyntax,
application-wide
ApplicationSyntax
}
SimpleSyntax ::= CHOICE {
integer-value
INTEGER (-2147483648..2147483647),
string-value
OCTET STRING (SIZE (0..65535)),
objectID-value
OBJECT IDENTIFIER
}
ApplicationSyntax ::= CHOICE {
ipAddress-value
IpAddress,
counter-value
Counter32,
timeticks-value
TimeTicks,
arbitrary-value
Opaque,
big-counter-value
Counter64,
unsigned-integer-value
Unsigned32
}
IpAddress ::=
[APPLICATION 0]
IMPLICIT OCTET STRING (SIZE (4))
Counter32 ::=
[APPLICATION 1]
IMPLICIT INTEGER (0..4294967295)
Unsigned32 ::=
[APPLICATION 2]
IMPLICIT INTEGER (0..4294967295)
Gauge32 ::= Unsigned32
TimeTicks ::=
[APPLICATION 3]
IMPLICIT INTEGER (0..4294967295)
Opaque ::=
[APPLICATION 4]
IMPLICIT OCTET STRING
Counter64 ::=
[APPLICATION 6]
IMPLICIT INTEGER (0..18446744073709551615)
END
Ce module ASN.1 définit la structure des unités de données de protocole (PDU) SNMP version 2. Le module comprend :
- Types de PDU: GetRequest, GetNextRequest, GetBulkRequest, Response, SetRequest, InformRequest, SNMPv2-Trap et Report
- Codes d'état d'erreur (error status codes): Utilisés dans Response-PDU pour indiquer les résultats du traitement
- Liaisons de variables (variable bindings): Le mécanisme pour associer les noms d'objets à leurs valeurs ou exceptions
- Types de données (data types): À la fois des types simples (INTEGER, OCTET STRING, OBJECT IDENTIFIER) et des types à l'échelle de l'application (IpAddress, Counter32, Counter64, Gauge32, TimeTicks, Opaque, Unsigned32)