SNMP--Windows API--SnmpExtensionInit

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

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

 

SnmpExtensionInit Callback Function

The Microsoft SNMP service calls the SnmpExtensionInit function to initialize the SNMP extension agent DLL.
这个Microsoft SNMP服务调用SnmpExtensionInit函数去初始化SNMP扩展代理DLL的。
This function is an element of the SNMP Extension Agent API.
这个函数是SNMP扩展代理API中的一个元素。

Syntax
BOOL SnmpExtensionInit(
  __in   DWORD dwUptimeReference,
  __out  HANDLE* phSubagentTrapEvent,
  __out  AsnObjectIdentifier* pFirstSupportedRegion
);

Parameters
dwUptimeReference
Specifies a time-zero reference for the extension agent.
指定一个计时零点作为扩展代理的参考。
Note  Extension agents should ignore this parameter.
注意:扩展代理应该忽略这个参数。
The SNMP extension agent DLL should use the SnmpSvcGetUptime function to retrieve the number of centiseconds the SNMP service has been running.
这个SNMP扩展代理DLL应该使用SnmpSvcGetUptime函数去取回SNMP已经运行的厘秒数。
For more information, see the following Remarks section.
更多信息,请看以下备注部分。
phSubagentTrapEvent
Pointer to an event handle the extension agent passes back to the SNMP service.
指针指向扩展代理传回到SNMP服务的一个事件句柄。
This handle is used to notify the service that the extension agent has one or more traps to send.
这个句柄是去通知使用的扩展代理有一个或多个trap去发送服务。
For additional information about allocating and deallocating the event handle, see the following Remarks section.
额外的信息有关分配和释放事件句柄,请看以下备注部分。
pFirstSupportedRegion
Pointer to an AsnObjectIdentifier structure to receive the first MIB subtree that the extension agent supports.
指针指向一个AsnObjectIdentifier结构体去取回扩展代理支持的第一个MIB子树。
For additional information about allocating and deallocating resources for this structure, see the following Remarks section.
额外的信息有关分配和释放这个结构体资源,请看以下备注部分。
The extension agent can register additional MIB subtrees by implementing the SnmpExtensionInitEx entry point function.
这个扩展代理可以通过实现SnmpExtensionInitEx入口点函数注册额外的MIB子树。
Return Value
If the function succeeds, the return value is TRUE.
如果这个函数成功,返回值是TRUE。
If the function fails, the return value is FALSE.
如果这个函数失败,返回值是FALSE。
Remarks
Extension agents should ignore the dwUptimeReference parameter.
扩展代理应该忽略dwUptimeReference参数。
Instead, they should call the SnmpSvcGetUptime function to retrieve the number of centiseconds that the Microsoft SNMP service has been running.
相反,它们应该调用SnmpSvcGetUptime取回Microsoft SNMP服务运行的厘秒数。
Because the dwUptimeReference parameter stores the elapsed time as a DWORD value in milliseconds, the time can wrap to zero and reflect an inaccurate time interval.
因为这个dwUptimeReference参数存储经过的时间的一个DWORD类型的毫秒值,这个时间可能转换到0并且反映一个不精确的时间间隔。

The extension agent notifies the SNMP service that it needs to send one or more traps by setting the event handle passed back in the phSubagentTrapEvent parameter to the signaled state.
这个扩展代理通知SNMP服务它需要通过设置事件句柄发送一个或多个traps在phSubagentTrapEvent参数中传回信号状态。
After this event has been signaled, the SNMP service repeatedly calls the extension agent's SnmpExtensionTrap entry point until the function returns a value of FALSE.
如果这个时间已经发出信号,这个SNMP服务反复地调用扩展代理的SnmpExtensionTrap入口点直到这个函数返回一个FALSE值。
This indicates that the extension agent has no more traps to send.
这个表名这个扩展代理没有更多的traps去发送了。
If the extension agent does not generate traps, the phSubagentTrapEvent parameter should return a value of NULL.
如果这个扩展代理不生成traps,这个phSubagentTrapEvent参数饮歌返回一个NULL值。

The SNMP extension agent must allocate and deallocate resources for the trap event handle.
这个SNMP扩展代理必须申请和释放trap事件句柄的资源。
When the SNMP service calls the SnmpExtensionInit function, the extension agent must call the CreateEvent function to allocate the event handle.
当这个SNMP服务调用SnmpExtensionInit函数时,这个扩展代理必须调用CreateEvent函数去申请事件句柄。
The extension agent passes the handle to the SNMP service in the phSubagentTrapEvent parameter.
这个扩展代理传递这个句柄在phSubagentTrapEvent参数中到SNMP服务。
When the SNMP service calls the SnmpExtensionClose function, the extension agent must deallocate resources for the trap event handle.
当这个SNMP服务调用SnmpExtensionClose函数时,这个扩展代理必须释放trap事件句柄的资源。
The SNMP service makes a copy of the AsnObjectIdentifier structure the extension agent returns in the pFirstSupportedRegion parameter.
这个SNMP服务生成一个AsnObjectIdentifier结构体的拷贝在pFirstSupportedRegion参数的扩展代理中返回。
The extension agent must allocate and deallocate the resources associated with the original structure.
这个扩展代理必须申请和释放与源结构相关的资源。
It can do this when the SNMP service calls the SnmpExtensionClose function.
当SNMP服务调用SnmpExtensionClose函数时,它可以做到这些。
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
AsnObjectIdentifier
CreateEvent
SnmpExtensionTrap
SnmpSvcGetUptime
SnmpExtensionClose
SnmpExtensionMonitor

 

Send comments about this topic to Microsoft

Build date: 3/8/2008

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值