Platform SDK: Network Management

smiVALUE

The WinSNMP smiVALUE structure describes the value associated with a variable name in a variable binding entry.

The syntax member of the smiVALUE structure contains a WinSNMP data type that indicates the type of data in the value member. The value member of the structure is the union of all possible WinSNMP data types.

typedef struct {                // smiVALUE portion of VarBind 
   smiUINT32    syntax;         // Insert SNMP_SYNTAX_<type> 
     union {
       smiINT    sNumber;       // SNMP_SYNTAX_INT 
                                // SNMP_SYNTAX_INT32 
       smiUINT32 uNumber;       // SNMP_SYNTAX_UINT32 
                                // SNMP_SYNTAX_CNTR32 
                                // SNMP_SYNTAX_GAUGE32 
                                // SNMP_SYNTAX_TIMETICKS 
       smiCNTR64 hNumber;       // SNMP_SYNTAX_CNTR64 
       smiOCTETS string;        // SNMP_SYNTAX_OCTETS 
                                // SNMP_SYNTAX_OPAQUE 
                                // SNMP_SYNTAX_IPADDR 
                                // SNMP_SYNTAX_NSAPADDR 
       smiOID    oid;           // SNMP_SYNTAX_OID 
       smiBYTE   empty;         // SNMP_SYNTAX_NULL 
                                // SNMP_SYNTAX_NOSUCHOBJECT 
                                // SNMP_SYNTAX_NOSUCHINSTANCE 
                                // SNMP_SYNTAX_ENDOFMIBVIEW 
     } value;    // union 
} smiVALUE, *smiLPVALUE; 

Members

syntax
Specifies an unsigned long integer that indicates the syntax data type of the value member. This member can be only one of the types listed in the following table. For more information, see WinSNMP Data Types and RFC 1902, "Structure of Management Information for Version 2 of the Simple Network Management Protocol (SNMPv2)."
Syntax data type Meaning
SNMP_SYNTAX_INT Indicates a 32-bit signed integer variable.
SNMP_SYNTAX_OCTETS Indicates an octet string variable that is binary or textual data.
SNMP_SYNTAX_NULL Indicates a NULL value.
SNMP_SYNTAX_OID Indicates an object identifier variable that is an assigned name with a maximum of 128 subidentifiers.
SNMP_SYNTAX_INT32 Indicates a 32-bit signed integer variable.
SNMP_SYNTAX_IPADDR Indicates a 32-bit Internet address variable.
SNMP_SYNTAX_CNTR32 Indicates a counter variable that increases until it reaches a maximum value of (2^32) – 1.
SNMP_SYNTAX_GAUGE32 Indicates a gauge variable that is a non-negative integer that can increase or decrease, but never exceed a maximum value.
SNMP_SYNTAX_TIMETICKS Indicates a counter variable that measures the time in hundredths of a second, until it reaches a maximum value of (2^32) – 1. It is a non-negative integer that is relative to a specific timer event.
SNMP_SYNTAX_OPAQUE This type provides backward compatibility, and should not be used for new object types. It supports the capability to pass arbitrary Abstract Syntax Notation One (ASN.1) syntax.
SNMP_SYNTAX_CNTR64 Indicates a counter variable that increases until it reaches a maximum value of (2^64) – 1.
SNMP_SYNTAX_UINT32 Indicates a 32-bit unsigned integer variable.
SNMP_SYNTAX_NOSUCHOBJECT Indicates that the agent does not support the object type that corresponds to the variable.
SNMP_SYNTAX_NOSUCHINSTANCE Indicates that the object instance does not exist for the operation.
SNMP_SYNTAX_ENDOFMIBVIEW Indicates the WinSNMP application is attempting to reference an object identifier that is beyond the end of the MIB tree that the agent supports.

The last three syntax types describe exception conditions under the SNMP version 2C (SNMPv2C) framework.

value
Specifies the union of all possible WinSNMP syntax data types, including the smiOID or smiOCTETS descriptor types.

Remarks

A WinSNMP application must check the syntax member of an smiVALUE structure to correctly dereference the value member. The value member can contain a simple scalar value or a non-scalar value like an smiOCTETS or an smiOID descriptor structure.

If the syntax member indicates that the value member is an smiOCTETS or an smiOID descriptor structure, the WinSNMP application must determine whether to free the resources allocated for the structure. The Microsoft WinSNMP implementation allocates and deallocates memory for all output smiOCTETS and smiOID structures. The application must call the SnmpFreeDescriptor function to free the memory for the ptr member of these structures.

Because the WinSNMP application allocates memory for input descriptors with variable lengths, it must free that memory. For more information, see WinSNMP Data Management Concepts.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Header: Declared in Winsnmp.h.

See Also

WinSNMP API Overview, WinSNMP Structures, smiOCTETS, smiOID, SnmpGetVb, SnmpCreateVbl, SnmpFreeDescriptor