SNMP Functions

[SNMP is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use Windows Remote Management, which is the Microsoft implementation of WS-Man.]

This topic describes three groupings of SNMP functions and lists the functions that are included in each group:

SNMP Extension Agent API Functions

The SNMP extension agent functions define the interface between the SNMP service and the third-party SNMP extension agent DLLs. The following table lists functions that applications can use to resolve variable bindings specified by incoming SNMP protocol data units (PDUs).

SNMP Extension Agent API Function Description
SnmpExtensionClose Requests that the SNMP extension agent deallocate resources and terminate operations.
SnmpExtensionInit Initializes the SNMP extension agent DLL.
SnmpExtensionInitEx Identifies any additional management information base (MIB) subtrees that the SNMP extension agent supports.
SnmpExtensionMonitor Provides the SNMP extension agent with information about the internal counters and parameters of the service.
SnmpExtensionQuery Resolves SNMP requests that contain variables in one or more of the registered MIB subtrees of the SNMP extension agent.
SnmpExtensionQueryEx Processes SNMP requests that specify variables in one or more MIB subtrees that are registered by SNMP extension agents.
SnmpExtensionTrap Retrieves information that the service requires to generate traps for the SNMP extension agent.

 

SNMP Management API Functions

The SNMP management functions define the interface between third-party SNMP manager applications and the management function dynamic-link library (DLL) Mgmtapi.dll. The DLL works in conjunction with the SNMP trap service (Snmptrap.exe), and can interact with one or more third-party SNMP manager applications. The following table lists the management functions that third-party manager applications use to perform SNMP manager operations.

SNMP Management API Function Description
SnmpMgrClose Closes the communications sockets and data structures that are associated with the specified session.
SnmpMgrCtl Sets an operating parameter that is associated with an SNMP session.
SnmpMgrGetTrap Returns outstanding trap data that the caller has not received if trap reception is enabled.
SnmpMgrGetTrapEx Returns outstanding trap data that the caller has not received if trap reception is enabled. Also returns the address of the transport source and the community trap that is associated with the trap.
SnmpMgrOidToStr Converts an internal object identifier structure to its string representation.
SnmpMgrOpen Initializes communications sockets and data structures that are required to establish communication with the SNMP agent.
SnmpMgrRequest Requests that the specified operation be performed by the specified agent.
SnmpMgrStrToOid Converts the string format of an object identifier to its internal object identifier structure.
SnmpMgrTrapListen Registers the ability of an SNMP manager application to receive SNMP traps from the SNMP Trap Service.

 

SNMP Utility API Functions

The SNMP utility functions provide capabilities that are useful during the development of SNMP applications, including simplifying the manipulation of SNMP data structures. The following table lists the SNMP utility functions.

SNMP Utility API Function Description
SnmpSvcGetUptime Retrieves the time, in centiseconds, for which the SNMP service has been running.
SnmpSvcSetLogLevel Adjusts the level of detail of the debug output from the SNMP service and from SNMP extension agents.
SnmpSvcSetLogType Adjusts the destination for the debug output from the SNMP service and from SNMP extension agents.
SnmpUtilAsnAnyCpy Copies a source AsnAny structure to a destination AsnAny structure.
SnmpUtilAsnAnyFree Frees the memory that was allocated for a specified AsnAny structure.
SnmpUtilDbgPrint Sets the level of debugging information to be received from the SNMP service or from a call to SnmpUtilDbgPrint.
SnmpUtilIdsToA Converts an object identifier (OID) to a null-terminated string.
SnmpUtilMemAlloc Allocates dynamic memory from the process heap.
SnmpUtilMemFree Frees the specified memory object.
SnmpUtilMemReAlloc Changes the size of the specified memory object.
SnmpUtilOctetsCmp Compares two octet strings.
SnmpUtilOctetsCpy Copies a source AsnOctetString structure to a destination AsnOctetString structure.
SnmpUtilOctetsFree Frees the memory that was allocated for the specified octet string.
SnmpUtilOctetsNCmp Performs a comparison of two octet strings to the specified number of subidentifiers.
SnmpUtilOidAppend Appends a source object identifier, contained in an AsnObjectIdentifier structure, to a destination object identifier.
SnmpUtilOidCmp Compares two object identifiers that are contained in AsnObjectIdentifier structures.
SnmpUtilOidCpy Copies a source AsnObjectIdentifier structure to a destination AsnObjectIdentifier structure.
SnmpUtilOidFree Frees the memory that was allocated for the specified object identifier.
SnmpUtilOidNCmp Compares two object identifiers that are contained in AsnObjectIdentifier structures to the specified number of subidentifiers.
SnmpUtilOidToA Converts an object identifier (OID) to a null-terminated string.
SnmpUtilPrintAsnAny Prints a value that is contained in an AsnAny structure for debugging and development purposes.
SnmpUtilPrintOid Formats the specified object identifier (OID) and prints the result to the standard output device.
SnmpUtilVarBindCpy Copies a source SnmpVarBind structure to a destination SnmpVarBind structure.
SnmpUtilVarBindListCpy Copies a source SnmpVarBindList structure to a destination SnmpVarBindList structure.
SnmpUtilVarBindFree Frees the memory that was allocated for the specified SnmpVarBind structure.
SnmpUtilVarBindListFree Frees the memory that was allocated for the specified SnmpVarBindList structure.