TEXTUAL-CONVENTION 宏

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

注意

有关安装提供程序的详细信息,请参阅 设置 WMI SNMP 环境

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

  • SYNTAX 子句中的命名类型定义将逐字映射到 CIM 属性限定符 object_syntax
  • 当 SYNTAX 子句显式引用 SNMPv2C TEXTUAL-CONVENTION 宏的文本约定或引用隐含文本约定时,请使用下表来映射文本约定。 默认值始终 NULL
文本约定 CIM 变体类型 CIM 限定符
DateAndTime VT_BSTR textual_convention:DateAndTime
编码:OCTETSTRING
object_syntax:DateAndTime
cimtype: string
Displaystring VT_BSTR textual_convention:Displaystring
编码:OCTETSTRING
object_syntax:Displaystring
cimtype: string
MacAddress VT_BSTR textual_convention:MacAddress
编码:OCTETSTRING
object_syntax:MacAddress
cimtype: string
PhysAddress VT_BSTR textual_convention:PhysAddress
编码:OCTETSTRING
object_syntax:PhysAddress
cimtype: string
SnmpUDPAddress VT_BSTR textual_convention: SnmpUDPAddress
编码:OCTETSTRING
object_syntax: SnmpUDPAddress
cimtype: string
SnmpOSIAddress VT_BSTR textual_convention: SnmpOSIAddress
编码:OCTETSTRING
object_syntax:SnmpOSIAddress
cimtype: string
SnmpIPXAddress VT_BSTR textual_convention: SnmpIPXAddress
编码:OCTETSTRING
object_syntax:SnmpIPXAddress
cimtype: string
  • CIM 定义的变体类型和 CIM 属性限定符使用基础基元类型 textual_convention编码object_syntaxcimtype 映射。
  • 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")