TEXTUAL-CONVENTION 宏

SNMP 文本约定映射到 CIM 定义的类型。

注意

若要详细了解如何安装提供程序,请参阅设置 WMI SNMP 环境

以下映射规则适用于 SNMP 文本约定:

  • SYNTAX 子句中的命名类型定义逐字映射到 CIM 属性限定符 object_syntax。
  • 如果 SYNTAX 子句显式引用 SNMPv2C TEXTUAL-CONVENTION 宏的文本约定或引用隐式文本约定,请使用下表来映射文本约定。 默认值为始终为 NULL。
文本约定 CIM 变体类型 CIM 限定符
DateAndTime VT_BSTR textual_convention:DateAndTime
encoding:OCTETSTRING
object_syntax:DateAndTime
cimtype:string
Displaystring VT_BSTR textual_convention:Displaystring
encoding:OCTETSTRING
object_syntax:Displaystring
cimtype:string
MacAddress VT_BSTR textual_convention:MacAddress
encoding:OCTETSTRING
object_syntax:MacAddress
cimtype:string
PhysAddress VT_BSTR textual_convention:PhysAddress
encoding:OCTETSTRING
object_syntax:PhysAddress
cimtype:string
SnmpUDPAddress VT_BSTR textual_convention:SnmpUDPAddress
encoding:OCTETSTRING
object_syntax:SnmpUDPAddress
cimtype:string
SnmpOSIAddress VT_BSTR textual_convention:SnmpOSIAddress
encoding:OCTETSTRING
object_syntax:SnmpOSIAddress
cimtype:string
SnmpIPXAddress VT_BSTR textual_convention:SnmpIPXAddress
encoding:OCTETSTRING
object_syntax:SnmpIPXAddress
cimtype:string
  • CIM 定义的变体类型以及 CIM 属性限定符 textual_convention、encoding、object_syntax 和 cimtype 使用基础基元类型进行映射。
  • SNMPv2C TEXTUAL-CONVENTION 宏的 DISPLAY-HINT 子句逐字映射到 CIM 属性限定符 display_hint。 如果没有 TEXTUAL-CONVENTION 宏,或者该宏不包含 DISPLAY-HINT 子句,则不会生成此限定符。

示例代码

以下示例介绍 SNMPv1 文本约定。

myNamedType ::= DISPLAYSTRING (SIZE (0..127))

myNamedProperty OBJECT-TYPE
SYNTAX  myNamedType
ACCESS read-only
STATUS MANDATORY
DESCRIPTION ""

此示例生成以下 CIM 限定符。

object_syntax("myNamedType"),
textual_convention("DISPLAYSTRING"),
encoding("OCTETSTRING"),
variable_length("0..127")

以下示例介绍 SNMPv2 文本约定。

myDisplaystring ::= TEXTUAL-CONVENTION
DISPLAY-HINT "255a"
STATUS current
DESCRIPTION "" 
SYNTAX OCTET STRING (SIZE (0..127))

myNamedProperty OBJECT-TYPE
SYNTAX  myDisplaystring
MAX-ACCESS read-only
STATUS current
DESCRIPTION ""

此示例生成以下 CIM 限定符。

object_syntax("myDisplaystring"),
textual_convention("OCTETSTRING"),
encoding("OCTETSTRING"),
display_hint("255a"),
variable_length("0..127")