The extensible agent calls the SnmpExtensionQuery function in the extension agent DLL to resolve SNMP requests that contain variables within one or more of the extension agent’s registered MIB subtrees.
BOOL SnmpExtensionQuery(
BYTE requestType, | |
RFC1157VarBindList *variableBindings, | |
AsnInteger *errorStatus, | |
AsnInteger *errorIndex | |
); |
Value |
Meaning |
ASN_RFC1157_GETREQUEST |
Search and receive a value from a specified variable. |
ASN_RFC1157_GETNEXTREQUEST |
Search and receive a value from a variable without knowing the name of the variable. |
ASN_RFC1157_SETREQUEST |
Store a value within a specific variable. |
Value |
Meaning |
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. |
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.
When the extensible agent must resolve a Get, Get Next, or Set command within the subtree indicated by the SnmpExtensionInit function, it must call the SnmpExtensionQuery function. For Get or Set commands, the extension agent must follow the rules in RFC 1157 to either resolve the variable bindings request or generate an error.
A Get Next command is more complicated to process because the extension agent may not be able to resolve the requested variable binding. If the variable binding can be resolved, the extension agent must follow the rules in RFC 1157 to either resolve the variable bindings request or generate an error. If the extension agent cannot resolve the variable binding, it must change the name field of the RFC1157VarBind structure to the value following the MIB subtree value specified in the supportedView parameter of the SnmpExtensionInit function. For example, if the agent supports view ".1.3.6.1.4.1.77.1", a Get Next command on ".1.3.6.1.4.1.77.1.5.1" would result in a modified name field of ".1.3.6.1.4.1.77.2". This signals the extensible agent to continue the attempt to resolve the variable bindings with other extension agents.
It is important to note that the extensible agent and the extension agent may need to exchange dynamically allocated memory during a call to the SnmpExtensionQuery function. The extensible agent dynamically allocates the object identifier in each RFC1157VarBind 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 extensible agent needs to release this memory after the object is placed in the response.
In order to avoid heap corruption and memory leaks, both the extensible agent and the extension agent must use memory allocation routines that resolve to the same heap. Extension agents should use the SnmpUtilMemAlloc function to allocate memory and the SnmpUtilMemFree function to release memory. These functions are located in the utility dynamic-link library SNMPAPI.DLL.
RFC1157VarBind, SnmpExtensionInit, SnmpUtilMemAlloc, SnmpUtilMemFree
file: /Techref/os/win/api/win32/func/src/f85_21.htm, 7KB, , updated: 2001/8/27 01:35, local time: 2024/11/19 23:19,
3.149.245.230:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/os/win/api/win32/func/src/f85_21.htm"> SnmpExtensionQuery</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.