![]() |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
![A hyphen indicates that the information in this topic is not relevant for this platform, or that the platform does not support the API that is listed. Windows Mobile Not Supported](../local/windowsmobile_off.gif)
![A checkmark indicates that the information in this topic is relevant for this platform, and that any API listed is also supported on this platform. Windows Embedded CE Supported](../local/windowsembeddedce_on.gif)
This function is called by the Microsoft SNMP service to resolve SNMP requests that contain variables within one or more of the SNMP extension agent's registered MIB subtrees. This function is an element of the SNMP Extension Agent API.
Syntax
BOOL SnmpExtensionQuery( BYTE bPduType , SnmpVarBindList pVarBindList , AsnInteger32 pErrorStatus , AsnInteger32 pErrorIndex ); |
Parameters
- bPduType
-
[in] Specifies the SNMP version 1 (SNMPv1) PDU request type. This parameter can be one of the following values.
Value Description SNMP_PDU_GET
Retrieve the value or values of the specified variables.
SNMP_PDU_GETNEXT
Retrieve the value or values of the lexicographic successor of the specified variable.
SNMP_PDU_SET
Write a value within a specific variable.
- pVarBindList
-
[in, out] Pointer to the variable bindings list.
- pErrorStatus
-
[out] Pointer to a variable in which the result of the error status will be returned. This parameter can be one of the following values defined by SNMPv1
Value Description SNMP_ERRORSTATUS_NOERROR
The agent reports that no errors occurred during transmission.
SNMP_ERRORSTATUS_TOOBIG
The agent could not place the results of the requested operation into a single SNMP message.
SNMP_ERRORSTATUS_NOSUCHNAME
The requested operation identified an unknown variable.
SNMP_ERRORSTATUS_BADVALUE
The requested operation tried to change a variable but it specified either a syntax or value error.
SNMP_ERRORSTATUS_READONLY
The requested operation tried to change a variable that was not allowed to change according to the community profile of the variable.
SNMP_ERRORSTATUS_GENERR
An error other than one of those listed here occurred during the requested operation.
- pErrorIndex
-
[out] Pointer to a variable in which the error index result will be returned.
Return Value
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.
Remarks
When the SNMP service receives an SNMP PDU request, it calls the SnmpExtensionQueryfunction to process the request. The extension agent must follow the rules in RFC 1157 to either resolve the variable bindings or generate an error.
If the extension agent cannot resolve the variable bindings on a Get Nextrequest, it must change the namefield of the SnmpVarBindstructure to the value of the object identifier immediately following that of the currently supported MIB subtree view. For example, if the extension agent supports view .1.3.6.1.4.1.77.1, a Get Nextrequest on .1.3.6.1.4.1.77.1.5.1 would result in a modified namefield of .1.3.6.1.4.1.77.2. This signals the SNMP service to continue the attempt to resolve the variable bindings with other extension agents.
It is important to note that the SNMP service and the extension agent may need to exchange dynamically allocated memory during a call to the SnmpExtensionQueryfunction. The service dynamically allocates the object identifier in each SnmpVarBindstructure it passes to the extension agent. However, the extension agent must release this memory in order to replace the object identifier when it processes a GetNextrequest. The extension agent allocates dynamic memory for variable-length object types. The SNMP service releases this memory after the object is placed in the response PDU.
In order to avoid heap corruption and memory leaks, both the SNMP service and the extension agent must use memory allocation routines that resolve to the same heap. The extension agent must use the SnmpUtilMemAllocfunction to allocate memory that it passes to the SNMP service. It must use the SnmpUtilMemFreefunction to release the memory the service passes back to the extension agent. These functions are located in the utility dynamic-link library SNMPAPI.DLL.
Requirements
Header | snmp.h |
Library | snmp.lib |
Windows Embedded CE | Windows CE 3.0 and later |