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 : logscripting.h
Abstract: LogScripting.cpp : Declaration of the CLogScripting Automation compatible logging interface
Author:
Saurab Nog ( saurabn ) 01-Feb-1998
Project:
IIS Logging 5.0
--*/
#ifndef _LOGSCRIPTING_
#define _LOGSCRIPTING_
#include "resource.h" // main symbols
#pragma warning (disable: 4786 4788)
#include <algorithm>
#include <queue>
#include <deque>
#include <functional>
#define INVALID_PLUGIN -1
/////////////////////////////////////////////////////////////////////////////
// CLogScripting
class ATL_NO_VTABLE CLogScripting : public CComObjectRootEx<CComSingleThreadModel>, public CComCoClass<CLogScripting, &CLSID_LogScripting>, public IDispatchImpl<ILogScripting, &IID_ILogScripting, &LIBID_IISLog> { public: CLogScripting(); HRESULT FinalConstruct(); void FinalRelease();
DECLARE_REGISTRY_RESOURCEID(IDR_LOGSCRIPTING) DECLARE_PROTECT_FINAL_CONSTRUCT() DECLARE_GET_CONTROLLING_UNKNOWN()
BEGIN_COM_MAP(CLogScripting) COM_INTERFACE_ENTRY(ILogScripting) COM_INTERFACE_ENTRY(IDispatch) END_COM_MAP()
private: struct FileListEntry { WCHAR wcsFileName[MAX_PATH+1]; FILETIME ftCreationTime;
void Copy(const WIN32_FIND_DATAW& x) { wcscpy( wcsFileName, x.cFileName); memcpy( &ftCreationTime, &x.ftCreationTime, sizeof(FILETIME)); } };
typedef struct FileListEntry *PFileListEntry;
struct FileTimeCompare { //
// We need ascending order. So bigger TimeStamp is smaller
//
bool operator()(const PFileListEntry x, const PFileListEntry y) const { return ( CompareFileTime(&(x->ftCreationTime), &(y->ftCreationTime)) != -1); } };
typedef std::priority_queue<PFileListEntry, std::vector<PFileListEntry>, FileTimeCompare> FileQ;
private:
//
// Metabase pointer
//
IMSAdminBase* m_pMBCom;
//
// Plugin information
//
typedef struct { ILogScripting * pILogScripting; CLSID clsid; WCHAR wcsFriendlyName[256]; } PLUGIN_INFO, *PPLUGIN_INFO;
int m_iNumPlugins, m_iReadPlugin, m_iWritePlugin; PPLUGIN_INFO m_pPluginInfo;
//
// File Path Information
//
bool m_fDirectory; HANDLE m_hDirSearchHandle; WCHAR m_wcsReadFileName[MAX_PATH+1], m_wcsReadDirectoryName[MAX_PATH+1];
//
// Log Time Information
//
DATE m_StartDateTime; DATE m_EndDateTime;
//
// Flag to indicate end of Records
//
bool m_fEndOfReadRecords;
//
// Directory listing
//
FileQ m_fQueue;
//
// Private member functions
//
int ParseLogFile(); bool GetNextFileName();
int CreateAllPlugins(); bool GetListOfAvailablePlugins();
HRESULT InternalReadLogRecord();
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 //_LOGSCRIPTING_
|