WinSNMP Functions

[This is preliminary documentation and subject to change.]

The functions used with WinSNMP fall into the following functional groupings:

WinSNMP Communications Functions

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

Function Description
SnmpCleanup Informs the implementation that a manager application is disconnecting and no longer requires allocated resources. A manager application must call the SnmpCleanup function as the last WinSNMP function before it terminates.
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. This function provides an alternative to the SnmpOpen function for manager applications that are not Windows-based.
SnmpOpen Requests the implementation to open a WinSNMP session and allocate resources and communications mechanisms.
SnmpRecvMsg Returns SNMP messages and outstanding trap data and notifications.
SnmpRegister Informs the implementation that the manager 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 manager application. A manager application must call the SnmpStartup function successfully before it calls any other WinSNMP function.
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 manager 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.
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 manager 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 manager 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.
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 manager 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 manager 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 manager 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.