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.

160 lines
5.9 KiB

  1. //
  2. // MODULE: TSMapAbstract.h
  3. //
  4. // PURPOSE: Part of launching a Local Troubleshooter from an arbitrary NT5 application
  5. // Data types and abstract classes for mapping from the application's way of naming
  6. // a problem to the Troubleshooter's way.
  7. // Implements the few concrete methods of abstract base class TSMapRuntimeAbstract.
  8. //
  9. // COMPANY: Saltmine Creative, Inc. (206)-633-4743 [email protected]
  10. //
  11. // AUTHOR: Joe Mabel
  12. //
  13. // ORIGINAL DATE: 2-26-98
  14. //
  15. //
  16. // Version Date By Comments
  17. //--------------------------------------------------------------------
  18. // V0.1 - JM Original
  19. ///////////////////////
  20. #ifndef _TSMAPABSTRACT_
  21. #define _TSMAPABSTRACT_ 1
  22. typedef DWORD UID;
  23. const UID uidNil = -1;
  24. // Abstract Base Class providing a minimal set of mapping methods which will be available
  25. // at runtime when launching a troubleshooter.
  26. class TSMapRuntimeAbstract {
  27. public:
  28. TSMapRuntimeAbstract();
  29. virtual ~TSMapRuntimeAbstract() = 0;
  30. private:
  31. // High level mappings to troubleshooting networks.
  32. DWORD FromAppVerProbToTS (
  33. const TCHAR * const szApp, const TCHAR * const szVer,
  34. const TCHAR * const szProb,
  35. TCHAR * const szTSBN, TCHAR * const szNode);
  36. DWORD FromAppVerDevIDToTS (
  37. const TCHAR * const szApp, const TCHAR * const szVer,
  38. const TCHAR * const szDevID, const TCHAR * const szProb,
  39. TCHAR * const szTSBN, TCHAR * const szNode);
  40. DWORD FromAppVerDevClassGUIDToTS (
  41. const TCHAR * const szApp, const TCHAR * const szVer,
  42. const TCHAR * const szDevClassGUID, const TCHAR * const szProb,
  43. TCHAR * const szTSBN, TCHAR * const szNode);
  44. public:
  45. DWORD FromAppVerDevAndClassToTS (
  46. const TCHAR * const szApp, const TCHAR * const szVer,
  47. const TCHAR * const szDevID, const TCHAR * const szDevClassGUID,
  48. const TCHAR * const szProb,
  49. TCHAR * const szTSBN, TCHAR * const szNode);
  50. // current status
  51. DWORD GetStatus() {return m_dwStatus;};
  52. void ClearStatus() {m_dwStatus = 0;};
  53. // other statuses reported back by FromAppVerDevAndClassToTS()
  54. // Call this in a loop until it returns 0;
  55. inline DWORD MoreStatus()
  56. {
  57. if (m_stkStatus.Empty())
  58. return 0;
  59. else
  60. return (m_stkStatus.Pop());
  61. }
  62. protected:
  63. // normally returns 0, but can theoretically return TSL_ERROR_OUT_OF_MEMORY
  64. DWORD AddMoreStatus(DWORD dwStatus);
  65. private:
  66. bool DifferentMappingCouldWork(DWORD dwStatus);
  67. protected:
  68. // "Part 1": call these to set query. Notes here are for the benefit of implementor
  69. // of inherited class. -------------------------
  70. // Any non-zero return of ClearAll is a hard error, means this object cannot be used.
  71. virtual DWORD ClearAll ();
  72. // SetApp may return only
  73. // 0 (OK)
  74. // TSL_ERROR_UNKNOWN_APP.
  75. // hard error specific to the implementation of the concrete class
  76. virtual DWORD SetApp (const TCHAR * const szApp)= 0;
  77. // SetVer may return only
  78. // 0 (OK)
  79. // TSM_STAT_NEED_APP_TO_SET_VER - must have successful call to SetApp before calling SetVer
  80. // TSL_ERROR_UNKNOWN_VER
  81. // hard error specific to the implementation of the concrete class
  82. virtual DWORD SetVer (const TCHAR * const szVer)= 0;
  83. // SetProb may return only
  84. // 0 (OK)
  85. // TSM_STAT_UID_NOT_FOUND. This is not necessarily bad, and results in setting
  86. // problem to uidNil. Calling fn must know if that's acceptable.
  87. // hard error specific to the implementation of the concrete class
  88. virtual DWORD SetProb (const TCHAR * const szProb)= 0;
  89. // SetDevID may return only
  90. // 0 (OK)
  91. // TSM_STAT_UID_NOT_FOUND. This is not necessarily bad, and results in setting
  92. // (P&P) device to uidNil. Calling fn must know if that's acceptable.
  93. // hard error specific to the implementation of the concrete class
  94. virtual DWORD SetDevID (const TCHAR * const szDevID)= 0;
  95. // SetDevClassGUID may return only
  96. // 0 (OK)
  97. // TSM_STAT_UID_NOT_FOUND. This is not necessarily bad, and results in setting
  98. // device class to uidNil. Calling fn must know if that's acceptable.
  99. // hard error specific to the implementation of the concrete class
  100. virtual DWORD SetDevClassGUID (const TCHAR * const szDevClassGUID)= 0;
  101. // "Part 2": Low level mappings to troubleshooting networks ------------
  102. // FromProbToTS may return only
  103. // 0 (OK)
  104. // TSM_STAT_NEED_PROB_TO_SET_TS - Nil problem, so we can't do this mapping.
  105. // TSL_ERROR_NO_NETWORK - Mapping failed
  106. // hard error specific to the implementation of the concrete class
  107. virtual DWORD FromProbToTS (TCHAR * const szTSBN, TCHAR * const szNode )= 0;
  108. // FromDevToTS may return only
  109. // 0 (OK)
  110. // TSM_STAT_NEED_DEV_TO_SET_TS - Nil device, so we can't do this mapping.
  111. // TSL_ERROR_NO_NETWORK - Mapping failed
  112. // hard error specific to the implementation of the concrete class
  113. virtual DWORD FromDevToTS (TCHAR * const szTSBN, TCHAR * const szNode )= 0;
  114. // FromDevClassToTS may return only
  115. // 0 (OK)
  116. // TSM_STAT_NEED_DEVCLASS_TO_SET_TS - Nil device class, so we can't do this mapping.
  117. // TSL_ERROR_NO_NETWORK - Mapping failed
  118. // hard error specific to the implementation of the concrete class
  119. virtual DWORD FromDevClassToTS (TCHAR * const szTSBN, TCHAR * const szNode )= 0;
  120. // other functions -----------------------
  121. // ApplyDefaultVer may return only
  122. // 0 (OK)
  123. // TSM_STAT_NEED_APP_TO_SET_VER - must have successful call to SetApp before calling
  124. // ApplyDefaultVer
  125. // TSM_STAT_NEED_VER_TO_SET_VER - must have successful call to SetVer before calling
  126. // ApplyDefaultVer
  127. // TSL_ERROR_UNKNOWN_VER - the version we are mapping _from_ is undefined. This
  128. // would mean a real coding mess someplace.
  129. // hard error specific to the implementation of the concrete class
  130. virtual DWORD ApplyDefaultVer() = 0;
  131. // HardMappingError returns true on errors considered "hard" by the concrete class.
  132. virtual bool HardMappingError (DWORD dwStatus);
  133. protected:
  134. DWORD m_dwStatus;
  135. RSStack<DWORD> m_stkStatus; // Status and Error codes that happened during mapping.
  136. };
  137. #endif // _TSMAPABSTRACT_