RFC 3780 - SMIng - Next Generation Structure of Management I(6)

时间:2006-10-30 来源: 作者: 点击:
hardwareorsoftware,analternativemeansofentryand display,suchashexadecimal,maybeprovided. Forinformationencodedin7-bitUS-ASCII,theUTF-8 encodingisidenticaltotheUS-ASCIIencoding. UTF-8mayrequiremultipl
  
            hardware or software, an alternative means of entry and
            display, such as hexadecimal, may be provided.

            For information encoded in 7-bit US-ASCII, the UTF-8
            encoding is identical to the US-ASCII encoding.

            UTF-8 may require multiple bytes to represent a single
            character / code point; thus the length of a Utf8String in
            octets may be different from the number of characters
            encoded.  Similarly, size constraints refer to the number
            of encoded octets, not the number of characters
            represented by an encoding.";
    };

    typedef Utf8String255 {
        type        Utf8String (0..255);
        format      "255t";
        description
           "A Utf8String with a maximum length of 255 octets.  Note
            that the size of an Utf8String is measured in octets, not
            characters.";
    };

    identity null {
        description
           "An identity used to represent null pointer values.";
    };

};

Appendix B. SMIng ABNF Grammar

   The SMIng grammar conforms to the Augmented Backus-Naur Form (ABNF)
   [RFC2234].

;;
;; sming.abnf -- SMIng grammar in ABNF notation (RFC 2234).
;;
;; @(#) $Id: sming.abnf,v 1.33 2003/10/23 19:31:55 strauss Exp $
;;
;; Copyright (C) The Internet Society (2004). All Rights Reserved.
;;

smingFile               = optsep *(moduleStatement optsep)

;;
;; Statement rules.

;;

moduleStatement         = moduleKeyword sep ucIdentifier optsep
                              "{" stmtsep
                              *(importStatement stmtsep)
                              organizationStatement stmtsep
                              contactStatement stmtsep
                              descriptionStatement stmtsep
                              *1(referenceStatement stmtsep)
                              1*(revisionStatement stmtsep)
                              *(extensionStatement stmtsep)
                              *(typedefStatement stmtsep)
                              *(identityStatement stmtsep)
                              *(classStatement stmtsep)
                          "}" optsep ";"

extensionStatement      = extensionKeyword sep lcIdentifier optsep
                              "{" stmtsep
                              statusStatement stmtsep
                              descriptionStatement stmtsep
                              *1(referenceStatement stmtsep)
                              *1(abnfStatement stmtsep)
                          "}" optsep ";"

typedefStatement        = typedefKeyword sep ucIdentifier optsep
                              "{" stmtsep
                              typedefTypeStatement stmtsep
                              *1(defaultStatement stmtsep)
                              *1(formatStatement stmtsep)
                              *1(unitsStatement stmtsep)
                              statusStatement stmtsep
                              descriptionStatement stmtsep
                              *1(referenceStatement stmtsep)
                          "}" optsep ";"

identityStatement       = identityStmtKeyword sep lcIdentifier optsep
                              "{" stmtsep
                              *1(parentStatement stmtsep)
                              statusStatement stmtsep
                              descriptionStatement stmtsep
                              *1(referenceStatement stmtsep)
                          "}" optsep ";"

classStatement          = classKeyword sep ucIdentifier optsep
                              "{" stmtsep
                              *1(extendsStatement stmtsep)
                              *(attributeStatement stmtsep)
                              *1(uniqueStatement stmtsep)

                              *(eventStatement stmtsep)
                              statusStatement stmtsep
                              descriptionStatement stmtsep
                              *1(referenceStatement stmtsep)
                          "}" optsep ";"

attributeStatement      = attributeKeyword sep
                              lcIdentifier optsep
                              "{" stmtsep
                              typeStatement stmtsep
                              *1(accessStatement stmtsep)
                              *1(defaultStatement stmtsep)
                              *1(formatStatement stmtsep)
                              *1(unitsStatement stmtsep)
                              statusStatement stmtsep
                              descriptionStatement stmtsep
                              *1(referenceStatement stmtsep)
                          "}" optsep ";"

uniqueStatement         = uniqueKeyword optsep
                              "(" optsep qlcIdentifierList
                              optsep ")" optsep ";"

eventStatement          = eventKeyword sep lcIdentifier
                              optsep "{" stmtsep
                              statusStatement stmtsep
                              descriptionStatement stmtsep
                              *1(referenceStatement stmtsep)
                          "}" optsep ";"

importStatement         = importKeyword sep ucIdentifier optsep
                              "(" optsep
                              identifierList optsep
                          ")" optsep ";"

revisionStatement       = revisionKeyword optsep "{" stmtsep
                              dateStatement stmtsep
                              descriptionStatement stmtsep
                          "}" optsep ";"

typedefTypeStatement    = typeKeyword sep refinedBaseType optsep ";"

typeStatement           = typeKeyword sep
                          (refinedBaseType / refinedType) optsep ";"

parentStatement         = parentKeyword sep qlcIdentifier optsep ";"

extendsStatement        = extendsKeyword sep qucIdentifier optsep ";"

dateStatement           = dateKeyword sep date optsep ";"

organizationStatement   = organizationKeyword sep text optsep ";"

contactStatement        = contactKeyword sep text optsep ";"

formatStatement         = formatKeyword sep format optsep ";"

unitsStatement          = unitsKeyword sep units optsep ";"

statusStatement         = statusKeyword sep status optsep ";"

accessStatement         = accessKeyword sep access optsep ";"

defaultStatement        = defaultKeyword sep anyValue optsep ";"

descriptionStatement    = descriptionKeyword sep text optsep ";"

referenceStatement      = referenceKeyword sep text optsep ";"

abnfStatement           = abnfKeyword sep text optsep ";"

;;
;;
;;

refinedBaseType         = ObjectIdentifierKeyword /
                          OctetStringKeyword *1(optsep numberSpec) /
                          PointerKeyword *1(optsep pointerSpec) /
                          Integer32Keyword *1(optsep numberSpec) /
                          Unsigned32Keyword *1(optsep numberSpec) /
                          Integer64Keyword *1(optsep numberSpec) /
                          Unsigned64Keyword *1(optsep numberSpec) /
                          Float32Keyword *1(optsep floatSpec) /
                          Float64Keyword *1(optsep floatSpec) /
                          Float128Keyword *1(optsep floatSpec) /
                          EnumerationKeyword
                                      optsep namedSignedNumberSpec /
                          BitsKeyword optsep namedNumberSpec

refinedType             = qucIdentifier *1(optsep anySpec)

anySpec                 = pointerSpec / numberSpec / floatSpec

pointerSpec             = "(" optsep qlcIdentifier optsep ")"

numberSpec              = "(" optsep numberElement
                              *furtherNumberElement
                              optsep ")"

furtherNumberElement    = optsep "|" optsep numberElement

numberElement           = signedNumber *1numberUpperLimit

numberUpperLimit        = optsep ".." optsep signedNumber

floatSpec               = "(" optsep floatElement
                              *furtherFloatElement
                              optsep ")"

furtherFloatElement     = optsep "|" optsep floatElement

floatElement            = floatValue *1floatUpperLimit

floatUpperLimit         = optsep ".." optsep floatValue

namedNumberSpec         = "(" optsep namedNumberList optsep ")"

namedNumberList         = namedNumberItem
                              *(optsep "," optsep namedNumberItem)

namedNumberItem         = lcIdentifier optsep "(" optsep number
                              optsep ")"

namedSignedNumberSpec   = "(" optsep namedSignedNumberList optsep ")"

namedSignedNumberList   = namedSignedNumberItem
                              *(optsep "," optsep
                                           namedSignedNumberItem)

namedSignedNumberItem   = lcIdentifier optsep "(" optsep signedNumber
                              optsep ")"

identifierList          = identifier
                              *(optsep "," optsep identifier)

qIdentifierList         = qIdentifier
                              *(optsep "," optsep qIdentifier)

qlcIdentifierList       = qlcIdentifier
                              *(optsep "," optsep qlcIdentifier)

bitsValue               = "(" optsep bitsList optsep ")"

bitsList                = *1(lcIdentifier
                              *(optsep "," optsep lcIdentifier))

;;
;; Other basic rules.
;;

identifier              = ucIdentifier / lcIdentifier

qIdentifier             = qucIdentifier / qlcIdentifier

ucIdentifier            = ucAlpha *63(ALPHA / DIGIT / "-")

qucIdentifier           = *1(ucIdentifier "::") ucIdentifier

lcIdentifier            = lcAlpha *63(ALPHA / DIGIT / "-")

qlcIdentifier           = *1(ucIdentifier "::") lcIdentifier

attrIdentifier          = lcIdentifier *("." lcIdentifier)

qattrIdentifier         = *1(ucIdentifier ".") attrIdentifier

cattrIdentifier         = ucIdentifier "."
                              lcIdentifier *("." lcIdentifier)

qcattrIdentifier        = qucIdentifier "."
                              lcIdentifier *("." lcIdentifier)

text                    = textSegment *(optsep textSegment)

textSegment             = DQUOTE *textAtom DQUOTE
                          ; See Section 4.2.

textAtom                = textVChar / HTAB / SP / lineBreak

date                    = DQUOTE 4DIGIT "-" 2DIGIT "-" 2DIGIT
                              *1(" " 2DIGIT ":" 2DIGIT)
                              DQUOTE
                          ; always in UTC

format                  = textSegment

units                   = textSegment

anyValue                = bitsValue /
                          signedNumber /
                          hexadecimalNumber /

                          floatValue /
                          text /
                          objectIdentifier
                          ; Note: `objectIdentifier’ includes the
                          ; syntax of enumeration labels and
                          ; identities.
                          ; They are not named literally to
                          ; avoid reduce/reduce conflicts when
                          ; building LR parsers based on this
                          ; grammar.

status                  = currentKeyword /
                          deprecatedKeyword /
                          obsoleteKeyword

access                  = eventonlyKeyword /
                          readonlyKeyword /
                          readwriteKeyword

objectIdentifier        = (qlcIdentifier / subid "." subid)
                              *127("." subid)

subid                   = decimalNumber

number                  = hexadecimalNumber / decimalNumber

negativeNumber          = "-" decimalNumber

signedNumber            = number / negativeNumber

decimalNumber           = "0" / (nonZeroDigit *DIGIT)

zeroDecimalNumber       = 1*DIGIT

hexadecimalNumber       = %x30 %x78 ; "0x" with x only lower-case
                          1*(HEXDIG HEXDIG)

floatValue              = neginfKeyword /
                          posinfKeyword /
                          snanKeyword /
                          qnanKeyword /
                          signedNumber "." zeroDecimalNumber
                              *1("E" ("+"/"-") zeroDecimalNumber)

;;
;; Rules to skip unknown statements
;; with arbitrary arguments and blocks.
;;

unknownStatement        = unknownKeyword optsep *unknownArgument
                              optsep ";"

unknownArgument         = ("(" optsep unknownList optsep ")") /
                          ("{" optsep *unknownStatement optsep "}") /
                          qucIdentifier /
                          anyValue /
                          anySpec

unknownList             = namedNumberList /
                          qIdentifierList

unknownKeyword          = lcIdentifier

;;
;; Keyword rules.
;;
;; Typically, keywords are represented by tokens returned from the
;; lexical analyzer.  Note, that the lexer has to be stateful to
;; distinguish keywords from identifiers depending on the context
;; position in the input stream.
;;

moduleKeyword       =  %x6D %x6F %x64 %x75 %x6C %x65
importKeyword       =  %x69 %x6D %x70 %x6F %x72 %x74
revisionKeyword     =  %x72 %x65 %x76 %x69 %x73 %x69 %x6F %x6E
dateKeyword         =  %x64 %x61 %x74 %x65
organizationKeyword =  %x6F %x72 %x67 %x61 %x6E %x69 %x7A %x61 %x74
                       %x69 %x6F %x6E
contactKeyword      =  %x63 %x6F %x6E %x74 %x61 %x63 %x74
descriptionKeyword  =  %x64 %x65 %x73 %x63 %x72 %x69 %x70 %x74 %x69
                       %x6F %x6E
referenceKeyword    =  %x72 %x65 %x66 %x65 %x72 %x65 %x6E %x63 %x65
extensionKeyword    =  %x65 %x78 %x74 %x65 %x6E %x73 %x69 %x6F %x6E
typedefKeyword      =  %x74 %x79 %x70 %x65 %x64 %x65 %x66
typeKeyword         =  %x74 %x79 %x70 %x65
parentKeyword       =  %x70 %x61 %x72 %x65 %x6E %x74
identityStmtKeyword =  %x69 %x64 %x65 %x6E %x74 %x69 %x74 %x79
classKeyword        =  %x63 %x6C %x61 %x73 %x73
extendsKeyword      =  %x65 %x78 %x74 %x65 %x6E %x64 %x73
attributeKeyword    =  %x61 %x74 %x74 %x72 %x69 %x62 %x75 %x74 %x65
uniqueKeyword       =  %x75 %x6E %x69 %x71 %x75 %x65
eventKeyword        =  %x65 %x76 %x65 %x6E %x74
formatKeyword       =  %x66 %x6F %x72 %x6D %x61 %x74
unitsKeyword        =  %x75 %x6E %x69 %x74 %x73
statusKeyword       =  %x73 %x74 %x61 %x74 %x75 %x73
accessKeyword       =  %x61 %x63 %x63 %x65 %x73 %x73
defaultKeyword      =  %x64 %x65 %x66 %x61 %x75 %x6C %x74

abnfKeyword         =  %x61 %x62 %x6E %x66

;; Base type keywords.

OctetStringKeyword  =  %x4F %x63 %x74 %x65 %x74 %x53 %x74 %x72 %x69
                       %x6E %x67
PointerKeyword      =  %x50 %x6F %x69 %x6E %x74 %x65 %x72
ObjectIdentifierKeyword  =  %x4F %x62 %x6A %x65 %x63 %x74 %x49 %x64
                       %x65 %x6E %x74 %x69 %x66 %x69 %x65 %x72
Integer32Keyword    =  %x49 %x6E %x74 %x65 %x67 %x65 %x72 %x33 %x32
Unsigned32Keyword   =  %x55 %x6E %x73 %x69 %x67 %x6E %x65 %x64 %x33
                       %x32
Integer64Keyword    =  %x49 %x6E %x74 %x65 %x67 %x65 %x72 %x36 %x34
Unsigned64Keyword   =  %x55 %x6E %x73 %x69 %x67 %x6E %x65 %x64 %x36
                       %x34
Float32Keyword      =  %x46 %x6C %x6F %x61 %x74 %x33 %x32
Float64Keyword      =  %x46 %x6C %x6F %x61 %x74 %x36 %x34
Float128Keyword     =  %x46 %x6C %x6F %x61 %x74 %x31 %x32 %x38
BitsKeyword         =  %x42 %x69 %x74 %x73
EnumerationKeyword  =  %x45 %x6E %x75 %x6D %x65 %x72 %x61 %x74 %x69
                       %x6F %x6E

;; Status keywords.

currentKeyword      =  %x63 %x75 %x72 %x72 %x65 %x6E %x74
deprecatedKeyword   =  %x64 %x65 %x70 %x72 %x65 %x63 %x61 %x74 %x65
                       %x64
obsoleteKeyword     =  %x6F %x62 %x73 %x6F %x6C %x65 %x74 %x65

;; Access keywords.

eventonlyKeyword    =  %x65 %x76 %x65 %x6E %x74 %x6F %x6E %x6C %x79
readonlyKeyword     =  %x72 %x65 %x61 %x64 %x6F %x6E %x6C %x79
readwriteKeyword    =  %x72 %x65 %x61 %x64 %x77 %x72 %x69 %x74 %x65

;; Special floating point values’ keywords.

neginfKeyword       =  %x6E %x65 %x67 %x69 %x6E %x66
posinfKeyword       =  %x70 %x6F %x73 %x69 %x6E %x66
snanKeyword         =  %x73 %x6E %x61 %x6E
qnanKeyword         =  %x71 %x6E %x61 %x6E

;;
;; Some low level rules.
;; These tokens are typically skipped by the lexical analyzer.
;;

sep                     = 1*(comment / lineBreak / WSP)
                          ; unconditional separator

optsep                  = *(comment / lineBreak / WSP)

stmtsep                 = *(comment /
                            lineBreak /
                            WSP /
                            unknownStatement)

comment                 = "//" *(WSP / VCHAR) lineBreak

lineBreak               = CRLF / LF

;;
;; Encoding specific rules.
;;

textVChar               = %x21 / %x23-7E
                          ; any VCHAR except DQUOTE

ucAlpha                 = %x41-5A
------分隔线----------------------------
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
最新评论 查看所有评论
发表评论 查看所有评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 密码: 验证码:
推荐内容