SNMP--Windows API--SnmpExtensionQuery

150 篇文章 0 订阅
11 篇文章 0 订阅

原文来自MSDN Library for Visual Studio 2008 SP1,翻译部分仅为个人观点,想要看更多信息请看MSDN,如有版权问题请联系QQ 643166601,邮件643166601@qq.com

 

SnmpExtensionQuery Callback Function

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.
这个Microsoft的SNMP服务调用SnmpExtensionQuery函数去解决SNMP请求变量里面有一个或更多的SNMP扩展代理的注册MIB子树。
This function is an element of the SNMP Extension Agent API.
这个函数是SNMP扩展代理API中的一个元素。
Note  The extension agent must export the SnmpExtensionQuery function if the extension agent runs on Windows NT 3.51 or 4.0.
注意:如果这个扩展代理运行在 Windows NT 3.51或 4.0上这个扩展代理必须导出SnmpExtensionQuery函数。
However, it is recommended that you use the SnmpExtensionQueryEx function, which supports SNMP version 2C (SNMPv2C) data types and multiphase SNMP SET operations.
然而,推荐使用SnmpExtensionQueryEx函数,它支持SNMP的2C版(SNMPv2C)数据类型和多相SNMP设置操作。

Syntax
BOOL SnmpExtensionQuery(
__in     BYTE bPduType,
__inout  SnmpVarBindList* pVarBindList,
__out    AsnInteger32* pErrorStatus,
__out    AsnInteger32* pErrorIndex
);

Parameters
bPduType
Specifies the SNMP version 1 (SNMPv1) PDU request type.
指定SNMP版本1 (SNMPv1)PDU的请求类型。
This parameter can be one of the following values.
这个参数可以是以下值中的一个。
Value Meaning
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.
 写一个值在指定变量中。

Note that PDU request types have been renamed.
注意PDU请求类型已经重命名。
For additional information, see SNMP Variable Types and Request PDU Types.
额外的信息,请看SNMP Variable Types and Request PDU Types。
pVarBindList
Pointer to the variable bindings list.
指针指向的变量绑定list。
pErrorStatus
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.
这个参数可以是由SNMPv1定义的以下值中的一个。
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消息中。
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
Pointer to a variable in which the error index result will be returned.
指针指向一个变量它返回的结果是错误索引。
Return Value
If the function succeeds, the return value is TRUE.
如果这个函数成功,返回值是TRUE。
If the function fails, the return value is FALSE.
如果这个函数失败,返回值是FALSE。
Remarks
When the SNMP service receives an SNMP PDU request, it calls the SnmpExtensionQuery function to process the request.
当SNMP服务接收一个SNMP PDU请求时它调用SnmpExtensionQuery函数去处理这个请求。
The extension agent must follow the rules in RFC 1157 to either resolve the variable bindings or generate an error.
这个扩展代理必须采用在 RFC 1157中的规定去处理变量绑定或生成一个错误。
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.
如果扩展代理不能解决变量绑定在Get Next请求中,它必须立即改变SnmpVarBind结构体的name字段的标识符到随后的 当前支持的MIB子树视图的下一个标识符。
For example, if the extension agent supports view ".1.3.6.1.4.1.77.1", a Get Next request 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".
例如,如果扩展代理支持视图".1.3.6.1.4.1.77.1",一个Get Next请求在".1.3.6.1.4.1.77.1.5.1"上的结果将是在一个被修改的".1.3.6.1.4.1.77.2"的name字段。
This signals the SNMP service to continue the attempt to resolve the variable bindings with other extension agents.
这个符号的SNMP服务去继续尝试去解决变量绑定和其他扩展代理。
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.
它是重要的注意SNMP服务和扩展代理可能需要去改变动态申请的内存在调用SnmpExtensionQuery函数期间。
The service dynamically allocates the object identifier in each SnmpVarBind structure it passes to the extension agent.
这个服务动态的在每个SnmpVarBind结构体中申请对象标识符传递到扩展代理中。
However, the extension agent must release this memory in order to replace the object identifier when it processes a Get Next request.
然而,当它处理一个Get Next请求时,这个扩展代理必须释放这个内存替换对象标识符。
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.
这个SNMP服务释放这个内存之后对象放置到请求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.
为了避免堆损坏和内存泄漏,SNMP服务和扩展代理都必须使用内存申请程序来解决相同堆。
The extension agent must use the SnmpUtilMemAlloc function to allocate memory that it passes to the SNMP service.
这个扩展代理必须使用SnmpUtilMemAlloc函数去申请内存,它传递到SNMP服务。
It must use the SnmpUtilMemFree function to release the memory the service passes back to the extension agent.
她必须使用SnmpUtilMemFree函数去释放内存这个服务传回到扩展代理。
These functions are located in the utility dynamic-link library SNMPAPI.DLL.
这个函数位于实用动态链接库SNMPAPI.DLL中。
Requirements
Client Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95.
Server Requires Windows Server 2008, Windows Server 2003, Windows 2000 Server, or Windows NT Server.
Header Declared in Snmp.h.
 

See Also
Simple Network Management Protocol (SNMP) Overview
SNMP Functions
SnmpVarBind
SnmpExtensionInit
SnmpUtilMemAlloc
SnmpUtilMemFree

 

Send comments about this topic to Microsoft

Build date: 3/8/2008

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值