共用方式為


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")