SNMP--Windows API--SnmpExtensionTrap

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

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

 

SnmpExtensionTrap Callback Function

The Microsoft SNMP service calls the SnmpExtensionTrap function to retrieve information the service needs to generate traps for the SNMP extension agent.
这个Microsoft的SNMP服务调用 SnmpExtensionTrap 函数去检索信息服务需要去为SNMP扩展代理生成traps。
The service calls this function only after the extension agent sets the trap event handle to the signaled state during a call to the SnmpExtensionInit function.
只有扩展代理设置trap事件句柄后,这个服务才调用这个函数去信号状态期间调用到SnmpExtensionInit函数。
The SnmpExtensionTrap function is an element of the SNMP Extension Agent API.
这个 SnmpExtensionTrap 函数是SNMP扩展代理API中的一个元素。

Syntax
BOOL SnmpExtensionTrap(
__out  AsnObjectIdentifier* pEnterpriseOid,
__out  AsnInteger32* pGenericTrapId,
__out  AsnInteger32* pSpecificTrapId,
__out  AsnTimeticks* pTimeStamp,
__out  SnmpVarBindList* pVarBindList
);

Parameters
pEnterpriseOid
Pointer to an AsnObjectIdentifier structure to receive the object identifier of the enterprise that generated the trap.
指针指向一个 AsnObjectIdentifier 结构体去接收生成trap的企业的对象标识符。
The SNMP service does not free the memory for this variable.
这个SNMP服务不释放这个变量的内存。
pGenericTrapId
Pointer to a variable to receive an indication of the generic trap.
指针指向一个变量去接收一个一般trap的指示。
This parameter can be one of the following values.
这个参数可以是以下值中的一个。
Value Meaning
SNMP_GENERICTRAP_COLDSTART
 The agent is initializing protocol entities on the managed mode.
 这个代理是在管理模式上初始化的协议入口。
 It may alter objects in its view.
 它可以在视图中修改对象。
SNMP_GENERICTRAP_WARMSTART
 The agent is reinitializing itself but will not alter objects within its view.
 这个代理是重新初始它自己但是将不能在它的视图中修改对象。
SNMP_GENERICTRAP_LINKDOWN
 An attached interface has changed from the "up" state to the "down" state.
 一个额外的接口已经从"up"状态改变到"down"状态。
 The first variable identifies the interface.
 这是第一个变量标识符接口。
SNMP_GENERICTRAP_LINKUP
 An attached interface has changed from the "down" state to the "up" state.
 一个额外的接口已经从"down"状态改变到"up"状态。
 The first variable identifies the interface.
 这是第一个变量标识符接口。
SNMP_GENERICTRAP_AUTHFAILURE
 An SNMP entity has sent an SNMP message, but has falsely claimed to belong to a known community.
 一个SNMP入口发送一个SNMP消息,但是谎称属于一个未知的团体。
SNMP_GENERICTRAP_EGPNEIGHLOSS
 An EGP peer has changed to the down state.
 一个对等路由器改变到down状态。
 The first variable identifies the IP address of the EGP peer.
 第一个变量标识符是对等路由器的IP地址。
SNMP_GENERICTRAP_ENTERSPECIFIC
 Signals an extraordinary event that is identified in the pSpecificTrapId parameter.
 事件是一个特别的事件,在pSpecificTrapId参数中定义。

pSpecificTrapId
Pointer to a variable to receive an indication of the specific trap generated.
指针指向一个变量去接收一个指定trap生成的指示。
pTimeStamp
Pointer to a variable to receive the time stamp.
指针指向一个变量去接收时间戳。
It is recommended that you initialize this parameter with the value returned by a call to the SnmpSvcGetUptime function.
它推荐你通过调用SnmpSvcGetUptime函数的返回值去初始化这个参数。
pVarBindList
Pointer to the variable bindings list.
指针指向变量绑定List。
The extension agent must allocate the memory for this parameter.
这个扩展代理必须为这个参数申请内存。
The SNMP service frees the memory with a call to the SnmpUtilVarBindListFree function.
这个SNMP服务用SnmpUtilVarBindListFree 函数释放内存。
Return Value
If the SnmpExtensionTrap function returns a trap, the return value is TRUE.
如果 SnmpExtensionTrap 函数返回一个trap,返回值TRUE。
The SNMP service repeatedly calls the function until it returns a value of FALSE.
这个SNMP服务重复调用这个函数直到它返回FALSE值。
For additional information, see the following Remarks section.
额外信息,请看以下备注部分。
Remarks
The SNMP service repeatedly calls the SnmpExtensionTrap function when the phSubagentTrapEvent event handle is set to the signaled state.
当 phSubagentTrapEvent事件句柄设置到信号状态时,这个SNMP服务重复调用 SnmpExtensionTrap 函数。
This handle is passed back during the call to the SnmpExtensionInit entry point function.
这个句柄是在调用 SnmpExtensionInit 入口点函数传回的。
The SnmpExtensionTrap function must return TRUE to indicate that the parameters contain valid data for a single trap.
这个 SnmpExtensionTrap 必须返回TRUE去指示参数包含一个单独trap的有效数据。
The function must return FALSE to indicate that the parameters do not represent valid trap data, and to stop the service's repeated calls.
这个函数必须返回FALSE去指示参数不代表有效trap数据并且去停止服务的重复调用。
Note that after the SNMP service sends a trap, it frees the memory associated with the variable binding list.
注意在SNMP发送一个trap后,它释放内存关联的变量绑定list。
It is important to note that earlier documentation stated that the extension agent should dynamically allocate memory for the enterprise object identifier because the SNMP service would attempt to release the memory after sending a trap.
它是重要的去注意早起的文档规定扩展代理应该动态为企业对象标识符申请内存因为SNMP服务在发送trap后将试图去释放内存。
The service will not release the memory associated with the enterprise object identifier.
这个服务将不释放管理企业对象标识符的内存。
It is recommended that you return a pointer to a static AsnObjectIdentifier structure instead.
它推荐你返回一个指针指向static AsnObjectIdentifier结构体代替。
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
SetEvent
SnmpUtilMemAlloc
SnmpUtilVarBindListFree
SnmpVarBindList
SnmpSvcGetUptime
SnmpExtensionInit

 

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、付费专栏及课程。

余额充值