Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
Other versions of this page are also available for the following:
Windows Mobile Not Supported Windows Embedded CE Supported
8/28/2008

This function is called by the Microsoft SNMP service to retrieve information the service needs to generate traps for the SNMP extension agent. The service calls this function only after the extension agent sets the trap event handle to the signaled state during a call to the SnmpExtensionInitfunction. The SnmpExtensionTrapfunction is an element of the SNMP Extension Agent API.

Syntax


BOOL SnmpExtensionTrap(
  AsnObjectIdentifier 
pEnterpriseOid
, 
  AsnInteger32
 pGenericTrapId
, 
  AsnInteger32
 pSpecificTrapId
, 
  AsnTimeticks 
pTimeStamp
, 
  SnmpVarBindList
 pVarBindList 

);

Parameters

pEnterpriseOid

[out] Pointer to an AsnObjectIdentifier, structure to receive the object identifier of the enterprise that generated the trap. The SNMP service does not free the memory for this variable.

pGenericTrapId

[out] Pointer to a variable to receive an indication of the generic trap. This parameter can be one of the following values.

Value Description

SNMP_GENERICTRAP_COLDSTART

The agent is initializing protocol entities on the managed node. It may alter objects in its view.

SNMP_GENERICTRAP_WARMSTART

The agent is re-initializing itself but will not alter objects within its view.

SNMP_GENERICTRAP_LINKDOWN

An attached interface has changed from the upstate to the downstate. The first variable identifies the interface.

SNMP_GENERICTRAP_LINKUP

An attached interface has changed from the downstate to the upstate. 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_GENERICTRAP_EGPNEIGHLOSS

An EGP peer has changed to the downstate. The first variable identifies the IP address of the EGP peer.

SNMP_GENERICTRAP_ENTERSPECIFIC

Signals an extraordinary event that is identified in the pSpecificTrapIdparameter.

pSpecificTrapId

[out] Pointer to a variable to receive an indication of the specific trap generated.

pTimeStamp

[out] 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 SnmpSvcGetUptimefunction.

pVarBindList

[out] Pointer to the variable bindings list. The extension agent must allocate the memory for this parameter. The SNMP service frees the memory with a call to the SnmpVarBindListFreefunction.

Return Value

If the SnmpExtensionTrapfunction returns a trap, the return value is TRUE. The SNMP service repeatedly calls the function until it returns a value of FALSE. For additional information, see the following Remarks section.

Remarks

The SNMP service repeatedly calls the SnmpExtensionTrapfunction when the phSubagentTrapEventevent handle is set to the signaled state. This handle is passed back during the call to the SnmpExtensionInitentry point function. The SnmpExtensionTrapfunction must return TRUE to indicate that the parameters contain valid data for a single 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.

Note that after the SNMP service sends a trap, it frees the memory associated with the variable binding 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. The service will not release the memory associated with the enterprise object identifier. It is recommended that you return a pointer to a static AsnObjectIdentifierstructure instead.

Requirements

Header snmp.h
Library snmp.lib
Windows Embedded CE Windows CE 3.0 and later

See Also