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.

144 lines
3.2 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name :
  4. lcmgr.h
  5. Abstract:
  6. Link checker manager class declaration. This class provides the
  7. interfaces for creating and customizing the worker thread (link
  8. checking thread).
  9. NOTE: You should only have a aingle instance of CLinkCheckerMgr.
  10. Author:
  11. Michael Cheuk (mcheuk)
  12. Project:
  13. Link Checker
  14. Revision History:
  15. --*/
  16. #ifndef _LCMGR_H_
  17. #define _LCMGR_H_
  18. #include "link.h"
  19. #include "linkload.h"
  20. #include "linkpars.h"
  21. #include "linklkup.h"
  22. #include "errlog.h"
  23. #include "useropt.h"
  24. #include "inetapi.h"
  25. //------------------------------------------------------------------
  26. // Forward declaration
  27. //
  28. class CLinkCheckerSingleton;
  29. class CProgressLog;
  30. class CLinkCheckerMgr;
  31. //------------------------------------------------------------------
  32. // Global fucntion for retrieve the link checker manager
  33. //
  34. CLinkCheckerMgr& GetLinkCheckerMgr();
  35. //------------------------------------------------------------------
  36. // Link checker manager
  37. //
  38. class CLinkCheckerMgr
  39. {
  40. // Public interfaces
  41. public:
  42. // Constructor
  43. CLinkCheckerMgr();
  44. // Destructor
  45. ~CLinkCheckerMgr();
  46. // Load wininet.dll. This must be called before initialize()
  47. BOOL LoadWininet();
  48. // Initialize the link checker manager. The link checker manager
  49. // will initialize the link loader, link parser, ...etc
  50. BOOL Initialize(
  51. CProgressLog* pProgressLog
  52. );
  53. // Get the CUserOptions object
  54. CUserOptions& GetUserOptions()
  55. {
  56. return m_UserOptions;
  57. }
  58. // Begin the link checking thread
  59. BOOL BeginWorkerThread();
  60. // Signal the worker thread to terminate
  61. void SignalWorkerThreadToTerminate();
  62. // Is worker thread running ?
  63. BOOL IsWorkerThreadRunning()
  64. {
  65. return (m_lWorkerThreadRunning == 0);
  66. }
  67. // Static functions for changing '\' to '/' in string
  68. static void ChangeBackSlash(LPTSTR lpsz);
  69. static void ChangeBackSlash(CString& str);
  70. // Protected interfaces
  71. protected:
  72. // Worker thread entry point
  73. static UINT WorkerThreadForwarder(
  74. LPVOID pParam
  75. );
  76. // Actual worker thread function (non-static)
  77. UINT WorkerThread(
  78. LPVOID pParam
  79. );
  80. // Is thread terminating ?
  81. BOOL IsThreadTerminating()
  82. {
  83. return (m_lTerminatingThread == 0);
  84. }
  85. // Check this URL. This is the core of link checking.
  86. void CheckThisURL(LPCTSTR lpszURL);
  87. // Protected members
  88. protected:
  89. CWininet m_Wininet; // wininet.dll wrapper
  90. BOOL m_fWininetLoaded; // is wininet.dll loaded?
  91. BOOL m_fInitialized; // is link checker manager initialized?
  92. long m_lWorkerThreadRunning; // is worker thread running? (TRUE = 0, FALSE = -1)
  93. long m_lTerminatingThread; // is worker thread terminating? (TRUE = 0, FALSE = -1)
  94. HANDLE m_hWorkerThread; // handle to the worker thread
  95. CLinkLoader m_Loader; // link loader
  96. CLinkParser m_Parser; // link parser
  97. CLinkLookUpTable m_Lookup; // link look up table
  98. CErrorLog m_ErrLog; // error log
  99. CUserOptions m_UserOptions; // user options
  100. CProgressLog* m_pProgressLog; // progress log pointer
  101. }; // class CLinkCheckerMgr
  102. #endif // _LCMGR_H_