Trap一般是网络设备发出的,由网管程序(Manager)接收。
没听说要对设备发送Trap。这有什么用吗?接收Trap的程序我倒是有。
没听说要对设备发送Trap。这有什么用吗?接收Trap的程序我倒是有。
解决方案 »
- 非MFC DLL undeclared identifier
- win32的 WORD 类详解
- 如何在MFC的Dialog上面点击按钮,实现无闪烁画图
- 在线求救一个联通SGIP的问题
- vc中怎样才能将另一工程的resource.h合并到本工程中啊?
- 请问怎么样在菜单栏前加上图标
- 上VC论坛上请教: 我在eVC中使用m_listCtrl.InsertColumn(0, "From", LVCFMT_LEFT, 10),为什么出现了下面的错误?在VC根本没错误。
- WSAAsyncSelect模式时,为何只有最后一个连接到服务器的套接字可正确被服务器接收?
- 请教有关内存分配问题!
- 我该拿什么样的作品去面试.................................
- wrox的Professional C#被电子工业翻译过来了 值得购买嘛?
- c++和windows编程要学到什么程度才能学vc?平时你们编应用程序的时候是自己编写全部代码么?
SnmpExtensionInit
SnmpExtensionInitEx
SnmpExtensionMonitor
SnmpExtensionQuery
SnmpExtensionQueryEx
SnmpExtensionTrap SnmpMgrClose
SnmpMgrGetTrap
SnmpMgrGetTrapEx
SnmpMgrOidToStr
SnmpMgrOpen
SnmpMgrRequest
SnmpMgrStrToOid
SnmpMgrTrapListen SnmpSvcGetUptime
SnmpSvcSetLogLevel
SnmpSvcSetLogType
SnmpUtilAsnAnyCpy
SnmpUtilAsnAnyFree
SnmpUtilDbgPrintSnmpUtilIdsToA
SnmpUtilMemAlloc
SnmpUtilMemFree
SnmpUtilMemReAlloc
SnmpUtilOctetsCmp
SnmpUtilOctetsCpy
SnmpUtilOctetsFree
SnmpUtilOctetsNCmp
SnmpUtilOidAppend
SnmpUtilOidCmp
SnmpUtilOidCpy
SnmpUtilOidFree
SnmpUtilOidNCmpSnmpUtilOidToA
SnmpUtilPrintAsnAny
SnmpUtilPrintOid
SnmpUtilVarBindCpy
SnmpUtilVarBindListCpy
SnmpUtilVarBindFree
SnmpUtilVarBindListFree 这些API中,能具体介绍几个与Trap相关的也行。就介绍介绍基本用法和基本原理。
SnmpExtensionInit
SnmpExtensionInitEx
SnmpExtensionMonitor
SnmpExtensionQuery
SnmpExtensionQueryEx
SnmpExtensionTrap SnmpMgrClose
SnmpMgrGetTrap
SnmpMgrGetTrapEx
SnmpMgrOidToStr
SnmpMgrOpen
SnmpMgrRequest
SnmpMgrStrToOid
SnmpMgrTrapListen SnmpSvcGetUptime
SnmpSvcSetLogLevel
SnmpSvcSetLogType
SnmpUtilAsnAnyCpy
SnmpUtilAsnAnyFree
SnmpUtilDbgPrintSnmpUtilIdsToA
SnmpUtilMemAlloc
SnmpUtilMemFree
SnmpUtilMemReAlloc
SnmpUtilOctetsCmp
SnmpUtilOctetsCpy
SnmpUtilOctetsFree
SnmpUtilOctetsNCmp
SnmpUtilOidAppend
SnmpUtilOidCmp
SnmpUtilOidCpy
SnmpUtilOidFree
SnmpUtilOidNCmpSnmpUtilOidToA
SnmpUtilPrintAsnAny
SnmpUtilPrintOid
SnmpUtilVarBindCpy
SnmpUtilVarBindListCpy
SnmpUtilVarBindFree
SnmpUtilVarBindListFree 这些API中,能具体介绍几个与Trap相关的也行。就介绍介绍基本用法和基本原理。
SnmpExtensionInit
SnmpExtensionInitEx
SnmpExtensionMonitor
SnmpExtensionQuery
SnmpExtensionQueryEx
SnmpExtensionTrap SnmpMgrClose
SnmpMgrGetTrap
SnmpMgrGetTrapEx
SnmpMgrOidToStr
SnmpMgrOpen
SnmpMgrRequest
SnmpMgrStrToOid
SnmpMgrTrapListen SnmpSvcGetUptime
SnmpSvcSetLogLevel
SnmpSvcSetLogType
SnmpUtilAsnAnyCpy
SnmpUtilAsnAnyFree
SnmpUtilDbgPrintSnmpUtilIdsToA
SnmpUtilMemAlloc
SnmpUtilMemFree
SnmpUtilMemReAlloc
SnmpUtilOctetsCmp
SnmpUtilOctetsCpy
SnmpUtilOctetsFree
SnmpUtilOctetsNCmp
SnmpUtilOidAppend
SnmpUtilOidCmp
SnmpUtilOidCpy
SnmpUtilOidFree
SnmpUtilOidNCmpSnmpUtilOidToA
SnmpUtilPrintAsnAny
SnmpUtilPrintOid
SnmpUtilVarBindCpy
SnmpUtilVarBindListCpy
SnmpUtilVarBindFree
SnmpUtilVarBindListFree 这些API中,能具体介绍几个与Trap相关的也行。就介绍介绍基本用法和基本原理。
Syntax:
SNMPAPI_STATUS SnmpRegister (
IN HSNMP_SESSION session,
IN HSNMP_ENTITY srcEntity,
IN HSNMP_ENTITY dstEntity,
IN HSNMP_CONTEXT context,
IN smiLPCOID notification,
IN smiUINT32 status);Parameter Description
session Identifies the session which is interested in registering.
srcEntity Identifies the management entity (manager role) of interest--this will be the trap recipient. (This is the “source” of the notification request.)
dstEntity Identifies the management entity (agent role) of interest--this will be the trap sender. (This is the “target” of the notification request.)
context Identifies the context of interest.
notification Identifies the trap/notification OID matching sequence to be registered or un-registered.
status Indicates whether to register (SNMPAPI_ON) or un-register (SNMPAPI_OFF) for the subject notification..
Returns:If the function is successful, the return value is SNMPAPI_SUCCESS.
If the function fails, the return value is SNMPAPI_FAILURE. Use the SnmpGetLastError function to obtain extended error information.
SnmpGetLastError() Description
"Common Error Codes" See Section 2.10.1 Common Error Codes..
SNMPAPI_SESSION_INVALID Indicates that the session parameter is invalid.
SNMPAPI_ENTITY_INVALID Indicates that the entity parameter is invalid.
SNMPAPI_CONTEXT_INVALID Indicates that the context parameter is invalid.
SNMPAPI_OID_INVALID Indicates that the notification parameter is invalid.
SNMPAPI_TL_NOT_INITIALIZED Transport layer not initialized
SNMPAPI_TL_IN_USE Trap port not available
SNMPAPI_TL_NOT_AVAILABLE Network subsystem has failed
Comments:In WinSNMP all traps are delivered to the applications are SNMPv2 traps. If an implementation receives an SNMPv1 trap from an SNMPv1 agent, it must convert it to an SNMPv2 trap in accordance with RFC 1452 (the “Coexistence” document).See Appendix A. Mapping Traps Between SNMPv1 and SNMPv2.Notifications, traps or informs, are defined using OBJECT IDENTIFIERs, as specified in SNMPv2. Hence, an application interested in receiving coldStart traps should construct an OBJECT IDENTIFIER corresponding to this trap based upon the SNMPv2 MIB (RFC 1450) and use this as the notification parameter.The value of the notification parameter is used for pattern matching against the OIDs of received traps and notifications. That is, if the first ‘n’ sub-ids of a received SnmpTrapOID match all the sub-ids (‘n’) of a notification value passed to SnmpRegister, than that SnmpTrapOID is a match. Accordingly, a received SnmpTrapOID with fewer sub-ids than a given notification parameters must fail the matching process with respect to that particular notification parameter.An application may pass NULL for any or all of the srcEntity, dstEntity, context, and notification parameters. The significance of NULL in any of these parameters is, effectively, to tell the implementation to not filter out any received traps or notifications on the basis of this parameter.If the notification parameter is NULL, then the application is indicating that it is interested in registering or unregistering for any and all notifications from the dstEntity, as indicated by the status parameter.If the status parameter contains any value other than SNMPAPI_OFF or SNMPAPI_ON, it will be treated as though it were SNMPAPI_ON.
Upon receipt of a trap/notification, the hWnd parameter specified in the SnmpOpen call for the registered session is sent the wMsg specified. The application should call SnmpRecvMsg with this session to retrieve the appropriate results.Note that it is the responsibility of a Level 3 implementation to acknowledge the receipt of an InformRequest-PDU. This tells the issuing management entity that the inform made it to the implementation "platform", but not necessarily to any particular application(s).In the case where a NULL dstEntity parameter to SnmpRegister results in the implementation creating an entity object for the srcEntity parameter on a future SnmpRecvMsg call, the entity will "belong" to the application as though it had caused its creation with SnmpStrToEntity. Put differently, the behavior
in this respect will be the same as for SnmpDecodeMsg. This is equally true--although perhaps less likely to occur--with respect to the srcEntity and context parameters as well.Note that this functionality relates to [not] filtering traps/notifications received by the implementation. It does not address the issue of how such traps/notifications get directed to the implementation in the first place. This is assumed to occur "out-of-band" from the perspective of application making use of NULL filtering parameters as described above.