Leaked source code of windows server 2003
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
/*++
Copyright (c) 1998 Microsoft Corporation
Module Name : logscript.hxx
Abstract: Base implementation for ILogScripting - Automation compatible logging interface
Author:
Saurab Nog ( saurabn ) 01-Feb-1998
Project:
IIS Logging 5.0
--*/
#ifndef _LOGSCRIPT_
#define _LOGSCRIPT_
typedef struct _CUSTOM_FIELD_ENTRY { CHAR szHeader[32]; PCHAR pchData; } CUSTOM_FIELD_ENTRY, *PCUSTOM_FIELD_ENTRY;
#define MAX_CUSTOM_FIELDS 20
typedef struct _INETLOGLINE { LPSTR pszClientHostName; LPSTR pszClientUserName; LPSTR pszServerAddress; // input ip address for connection
LPSTR pszOperation; // eg: 'get' in FTP
LPSTR pszTarget; // target path/machine name
LPSTR pszParameters; // string containing parameters.
LPSTR pszVersion; // protocol version string.
LPSTR pszHTTPHeader; // Header Information
LPSTR pszBytesSent; // count of bytes sent
LPSTR pszBytesRecvd; // count of bytes recvd
LPSTR pszTimeForProcessing; // time required for processing
LPSTR pszWin32Status; // Win32 error code. 0 for success
LPSTR pszProtocolStatus; // status: whatever service wants.
LPSTR pszPort;
DATE DateTime; // Date & Time
LPSTR pszSiteName; // Service name (not put in https log)
LPSTR pszComputerName; // netbios name of Server
LPSTR pszUserAgent; // User Agent - Browser type
LPSTR pszCookie; LPSTR pszReferer; // Referring URL.
int iCustomFieldsCount; CUSTOM_FIELD_ENTRY CustomFields[MAX_CUSTOM_FIELDS]; // custom fields. Includes UserAgent, Referer & Cookie
} *LPINET_LOGLINE, INET_LOGLINE;
class CLogScript : public IDispatchImpl<ILogScripting, &IID_ILogScripting, &LIBID_IISLog> // The Log Scripting Interface
{ public: CLogScript(); protected: virtual ~CLogScript(); virtual HRESULT ReadFileLogRecord( IN FILE *fpLogFile, IN LPINET_LOGLINE pInetLogLine, IN PCHAR pszLogLine, IN DWORD dwLogLineSize ) = 0;
virtual HRESULT WriteFileLogRecord( IN FILE *fpLogFile, IN ILogScripting *pILogScripting, IN bool fWriteHeader ) = 0;
//
// Support methods
//
inline VOID SetVariantToBstr (VARIANT * pVar, LPSTR pCh); inline VOID SetVariantToLong (VARIANT * pVar, LPSTR pCh); BSTR GetBstrFromVariant (VARIANT * pVar); DWORD GetLongFromVariant (VARIANT * pVar, CHAR * pBuffer);
private:
VOID LockCS() { EnterCriticalSection( &m_csLock ); } VOID UnlockCS() { LeaveCriticalSection( &m_csLock ); }
VOID ResetInetLogLine(INET_LOGLINE& InetLogLine); CRITICAL_SECTION m_csLock; FILE *m_pInputLogFile; STR m_strInputLogFileName; INET_LOGLINE ReadInetLogLine;
FILE *m_pOutputLogFile; STR m_strOutputLogFileName; PCHAR m_pszLogLine; DWORD m_dwLogLineSize;
BSTR m_szEmpty;
public:
//
// ILogScripting: Copied from the header file generated by MIDL.
//
virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE OpenLogFile( /* [in] */ BSTR szLogFileName, /* [defaultvalue][optional][in] */ IOMode Mode = ForReading, /* [defaultvalue][optional][in] */ BSTR szServiceName = L"", /* [defaultvalue][optional][in] */ long iServerInstance = 0, /* [defaultvalue][optional][in] */ BSTR szOutputLogFileFormat = L""); virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CloseLogFiles( /* [defaultvalue][optional][in] */ IOMode Mode = AllOpenFiles); virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ReadFilter( /* [defaultvalue][optional][in] */ DATE startDateTime = 0, /* [defaultvalue][optional][in] */ DATE endDateTime = 1000000); virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ReadLogRecord( void); virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AtEndOfLog( /* [retval][ref][out] */ VARIANT_BOOL __RPC_FAR *pfEndOfRead); virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE WriteLogRecord( /* [in] */ ILogScripting __RPC_FAR *pILogScripting); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_DateTime( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarDateTime); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_ServiceName( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarServiceName); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_ServerName( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarServerName); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_ClientIP( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarClientIP); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_UserName( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarUserName); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_ServerIP( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarServerIP); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Method( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarMethod); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_URIStem( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarURIStem); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_URIQuery( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarURIQuery); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_TimeTaken( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarTimeTaken); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_BytesSent( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarBytesSent); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_BytesReceived( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarBytesReceived); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Win32Status( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarWin32Status); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_ProtocolStatus( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarProtocolStatus); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_ServerPort( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarServerPort); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_ProtocolVersion( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarProtocolVersion); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_UserAgent( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarUserAgent); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Cookie( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarCookie); virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Referer( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarReferer);
virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_CustomFields( /* [retval][ref][out] */ VARIANT __RPC_FAR *pvarCustomFieldsArray);
};
#endif // _LOGSCRIPT_
|