I provide this syslog client support DLL free of charge for everyone who can make use of it. The purpose of this DLL is to make it for developers of Windows 95/98 or Windows NT/2000 applications as easy as possible to implement the functionality of a syslog client into their applications.
Features:
A developer can use this DLL to generate syslog messages by calling three of the four provided functions documented below. The function SlDNSLookup is not neccessary for generating syslog messages but it may be helpful in some cases by performing hostname-to-IP-address or IP-address-to-hostname (reverse lookup) functionality.
SlInitialize
The SlInitialize function initializes the Windows Sockets environment.
DWORD SlInitialize(
| void | // no parameters |
| ); |
If the function succeeds, the return value is SL_ERROR_SUCCESS.
If the function fails, the return value is SL_ERROR_INITIALIZE_WINSOCKETS if the initalization of the WinSock environment failed or SL_ERROR_SOCKET_OPERATION if an socket related error happened.
This function initializes the Windows Sockets environment and allocates necessary resources for sending syslog messages. This function has to be called by an application before any of the other two functions. It's sufficient to call this function one time for the whole application but it can be called more than once. As often as this functions is called as often must the function SlUninitialize be called.
SlUninitialize
The SlUninitialize function deinitializes the Windows Sockets environment.
DWORD SlUninitialize(
| void | // no parameters |
| ); |
If the function succeeds, the return value is SL_ERROR_SUCCESS.
If the function fails, the return value is SL_ERROR_NOT_INITIALIZED which happens if the function is called without a preceding call to SlInitialize.
This function frees allocated resources and deinitializes the Windows Sockets environment. It must be called as often as SlInitialize has been called.
SlSendMessage
The SlSendMessage function sends one syslog message to the specified host..
DWORD SlSendMessage(
| PTSTR pszHostName | // hostname or ip-address of syslog message destination |
| int nFacility | // facility code |
| int nPriority | // priority code |
| PTSTR pszText | // pointer to message text |
| ); |
If the function succeeds, the return value is SL_ERROR_SUCCESS.
If the function fails, the return value is SL_ERROR_NOT_INITIALIZED if called without a preceding call to SlInitialize, SL_ERROR_INVALID_PARAMETER if one or more of the function parameters are invalid, SL_ERROR_RESOLVE_HOSTNAME if the given hostname could not be successfully resolved to an IP-address or SL_ERROR_SOCKET_OPERATION if a socket related error occurred in sending the message.
This function is used to send one syslog message. It can only successfully be called after the Windows Sockets environment has been initialized, e.g. after a call to SlInitialize.
SlDNSLookup
The SlDNSLookup functions resolves a hostname to an IP-address or an IP-address to a hostname (reverse lookup).
DWORD SlDNSLookup(
| PTSTR pszInput | // hostname or ip-address to lookup |
| PTSTR pszOutput | // result of lookup operation (hostname or IP-address) |
| DWORD cchOutputLength | // size of output buffer in characters |
| ); |
If the function succeeds, the return value is SL_ERROR_SUCCESS.
If the function fails, the return value is SL_ERROR_NOT_INITIALIZED if called without a preceding call to SlInitialize, SL_ERROR_INVALID_PARAMETER if one or more of the function parameters are invalid, SL_ERROR_RESOLVE_HOSTNAME if the given hostname could not be successfully resolved to an IP-address or the given IP-address could not be resolved to a hostname or SL_ERROR_OUTPUT_BUFFER_TOO_SMALL if the size of the supplied output buffer is too small.
This function is used to perform DNSLookup. It can only successfully be called after the Windows Sockets environment has been initialized, e.g. after a call to SlInitialize. If the input string is a hostname a lookup is performed for the corresponding IP-address, if the input string is an IP-address a lookup is performed for the corresponding hostname (reverse lookup).