SnmpExtensionQuery callback function
[SNMP is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use Windows Remote Management, which is the Microsoft implementation of WS-Man.]
The Microsoft SNMP service calls the SnmpExtensionQuery function 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.
BOOL SnmpExtensionQuery( _In_ BYTE bPduType, _Inout_ SnmpVarBindList *pVarBindList, _Out_ AsnInteger32 *pErrorStatus, _Out_ AsnInteger32 *pErrorIndex );
- bPduType [in]
Specifies the SNMP version 1 (SNMPv1) PDU request type. This parameter can be one of the following values.
Retrieve the value or values of the specified variables.
Retrieve the value or values of the lexicographic successor of the specified variable.
Write a value within a specific variable.
Note that PDU request types have been renamed. For additional information, see SNMP Variable Types and Request PDU Types.
- pVarBindList [in, out]
Pointer to the variable bindings list.
- pErrorStatus [out]
Pointer to a variable in which the error status result will be returned. This parameter can be one of the following values defined by SNMPv1.
- pErrorIndex [out]
Pointer to a variable in which the error index result will be returned.
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.
When the SNMP service receives an SNMP PDU request, it calls the SnmpExtensionQuery function 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 Next request, it must change the name field of the SnmpVarBind structure 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 ".188.8.131.52.184.108.40.206", a Get Next request on ".220.127.116.11.18.104.22.168.5.1" would result in a modified name field of ".22.214.171.124.126.96.36.199". 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 SnmpExtensionQuery function. The service dynamically allocates the object identifier in each SnmpVarBind structure 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 Get Next request. 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 SnmpUtilMemAlloc function to allocate memory that it passes to the SNMP service. It must use the SnmpUtilMemFree function to release the memory the service passes back to the extension agent. These functions are located in the utility dynamic-link library SNMPAPI.DLL.
Minimum supported client
|Windows 2000 Professional [desktop apps only]|
Minimum supported server
|Windows 2000 Server [desktop apps only]|
- Simple Network Management Protocol (SNMP) Overview
- SNMP Functions