WinSNMP 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.]

The functions used with WinSNMP fall into the following functional groupings. An alphabetic list follows.

WinSNMP Communications Functions

The WinSNMP communications functions provide an interface between the calling WinSNMP application and the Microsoft WinSNMP implementation. The implementation handles communication between the application and other management entities.

Function Description
SnmpCancelMsg Requests that the Microsoft WinSNMP implementation cancel retransmission attempts and time-out notifications for an SNMP request message.
SnmpCleanup Informs the implementation that an application is disconnecting and no longer requires allocated resources.
SnmpCleanupEx Performs cleanup when there are no outstanding successful calls to SnmpStartup or SnmpStartupEx within a WinSNMP application.
SnmpClose Enables the implementation to deallocate resources associated with a session, and to close communications mechanisms.
SnmpCreateSession Requests the implementation to open a WinSNMP session and allocate resources and communications mechanisms. When developing new WinSNMP applications, it is recommended that you call the SnmpCreateSession function to open a WinSNMP session instead of calling the SnmpOpen function.
SnmpListen Registers or unregisters a WinSNMP application as an SNMP agent.
SnmpOpen Requests the implementation to open a WinSNMP session and allocate resources and communications mechanisms. When developing new WinSNMP applications, it is recommended that you call the SnmpCreateSession function to open a WinSNMP session instead of calling the SnmpOpen function.
SnmpRecvMsg Returns SNMP messages and outstanding trap data and notifications.
SnmpRegister Informs the implementation that the application needs to register or unregister for traps and notifications.
SnmpSendMsg Requests that the implementation transmit a protocol data unit.
SnmpStartup Notifies the implementation to perform initialization procedures for the application. An application must call the SnmpStartup function successfully before it calls any other WinSNMP function.
SnmpStartupEx Notifies the Microsoft WinSNMP implementation that the WinSNMP application requires the implementation's services. SnmpStartupEx enables support for multiple independent software modules that use WinSNMP within the same application.
SNMPAPI_CALLBACK Notifies a WinSNMP session that an SNMP message or asynchronous event is available.
[!Note]
This callback function applies only to sessions opened as a result of a call to the SnmpCreateSession function.

WinSNMP Entity and Context Functions

The WinSNMP entity and context functions enable a WinSNMP application to specify user-friendly names for SNMP entities and contexts. The Microsoft WinSNMP implementation translates the name to its SNMPv1 or SNMPv2C components using the implementation's database.

Function Description
SnmpContextToStr Returns a string that identifies an SNMP context (a set of managed object resources).
SnmpEntityToStr Returns a string that identifies an SNMP management entity.
SnmpFreeContext Releases resources allocated by the SnmpStrToContext function for an SNMP context.
SnmpFreeEntity Releases resources allocated by the SnmpStrToEntity function for an SNMP management entity.
SnmpSetPort Changes the port assigned to an SNMP destination entity.
SnmpStrToContext Returns a handle to SNMP context information that is specific to the implementation.
SnmpStrToEntity Returns a handle to SNMP management entity information that is specific to the implementation.

WinSNMP Database Functions

The WinSNMP database functions provide a WinSNMP application with access to the current settings in the Microsoft WinSNMP implementation's store of administrative information. These functions permit changing the retransmission mode and the entity and context translation mode. The database functions also provide the application with the ability to manipulate the time-out and retry count values.

Function Description
SnmpGetRetransmitMode Returns the current setting of the retransmission mode.
SnmpGetRetry Returns the retry count value, in units, for the retransmission of SNMP message requests.
SnmpGetTimeout Returns the time-out value, in hundredths of a second, for the transmission of SNMP message requests.
SnmpGetTranslateMode Returns the current setting of the entity and context translation mode.
SnmpGetVendorInfo Retrieves information that identifies the WinSNMP vendor.
SnmpSetRetransmitMode Changes the retransmission mode.
SnmpSetRetry Changes the retry count value for the retransmission of SNMP message requests.
SnmpSetTimeout Changes the time-out value for the transmission of SNMP message requests.
SnmpSetTranslateMode Changes the entity and context translation mode.

WinSNMP PDU Functions

The WinSNMP PDU functions enable WinSNMP applications to extract and update the data elements (or fields) of a PDU. This includes PDUs returned by a call to the SnmpRecvMsg function or the SnmpDecodeMsg function. The PDU functions also construct PDUs for use in the SnmpSendMsg and SnmpEncodeMsg functions.

Function Description
SnmpCreatePdu Creates and initializes an SNMP protocol data unit.
SnmpDuplicatePdu Duplicates an SNMP protocol data unit.
SnmpFreePdu Releases resources associated with an SNMP protocol data unit created by the SnmpCreatePdu or the SnmpDuplicatePdu function.
SnmpGetPduData Returns selected data elements from a specified SNMP protocol data unit.
SnmpSetPduData Updates selected data elements in a specified SNMP protocol data unit.

WinSNMP Utility Functions

The WinSNMP utility functions enable a WinSNMP application to manage objects and SNMP messages across the WinSNMP interface.

Function Description
SnmpDecodeMsg Decodes an encoded or serialized SNMP message into its constituent components.
SnmpEncodeMsg Creates an encoded SNMP message.
SnmpFreeDescriptor Signals the Microsoft WinSNMP implementation that it should free the memory it allocated for a specific descriptor.
SnmpGetLastError Returns the last-error code value for the last SNMP operation.
SnmpOidCompare Compares two SNMP object identifiers.
SnmpOidCopy Copies an SNMP object identifier.
SnmpOidToStr Converts the internal binary representation of an SNMP object identifier to its dotted numeric string format.
SnmpStrToOid Converts the dotted numeric string format of an SNMP object identifier to its internal binary representation.

WinSNMP Variable Binding Functions

The WinSNMP variable binding functions enable WinSNMP applications to construct and manipulate variable binding lists, and include them in PDUs.

Function Description
SnmpCountVbl Enumerates the variable binding entries in a specified variable binding list.
SnmpCreateVbl Creates a new variable binding list.
SnmpDeleteVb Removes a variable binding entry from a variable binding list.
SnmpDuplicateVbl Copies a variable binding list.
SnmpFreeVbl Releases resources for a variable binding list allocated previously by the SnmpCreateVbl or the SnmpDuplicateVbl function.
SnmpGetVb Retrieves information from a specified variable binding entry.
SnmpSetVb Changes variable binding entries in a variable binding list; appends new variable binding entries to an existing variable binding list.

WinSNMP Functions Alphabetic List