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.

99 lines
3.1 KiB

  1. /**********************************************************************/
  2. /** Microsoft Passport **/
  3. /** Copyright(c) Microsoft Corporation, 1999 - 2001 **/
  4. /**********************************************************************/
  5. /*
  6. PassportConfiguration.h
  7. handles both nexus config and registry config
  8. FILE HISTORY:
  9. */
  10. // PassportConfiguration.h: interface for the CPassportConfiguration class.
  11. //
  12. //////////////////////////////////////////////////////////////////////
  13. #if !defined(AFX_PASSPORTCONFIGURATION_H__74EB2517_E239_11D2_95E9_00C04F8E7A70__INCLUDED_)
  14. #define AFX_PASSPORTCONFIGURATION_H__74EB2517_E239_11D2_95E9_00C04F8E7A70__INCLUDED_
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif // _MSC_VER > 1000
  18. #include <map>
  19. #include "nexus.h"
  20. #include "RegistryConfig.h"
  21. #include "NexusConfig.h"
  22. #include "PassportLock.hpp"
  23. #define PRCONFIG "PARTNER"
  24. typedef PtStlMap<LPSTR, CRegistryConfig*> REGCONFIGMAP;
  25. bool less<LPSTR>::operator()(const LPSTR& x, const LPSTR& y) const
  26. {
  27. return (_strcmpi(x,y) < 0);
  28. };
  29. class CPassportConfiguration :
  30. public ICCDUpdate, public IConfigurationUpdate
  31. {
  32. public:
  33. CPassportConfiguration();
  34. virtual ~CPassportConfiguration();
  35. // You must call release yourself...
  36. CRegistryConfig* checkoutRegistryConfig(LPSTR szHost = NULL);
  37. CRegistryConfig* checkoutRegistryConfigBySite(LPSTR szSiteName);
  38. CNexusConfig* checkoutNexusConfig();
  39. BOOL isValid();
  40. LPWSTR getFailureString();
  41. void CCDUpdatedA(LPCSTR pszCCDName, IXMLDocument* piStream)
  42. { NexusConfigUpdated(piStream); }
  43. void CCDUpdatedW(LPCWSTR pszCCDName, IXMLDocument* piStream)
  44. { NexusConfigUpdated(piStream); }
  45. void LocalConfigurationUpdated();
  46. BOOL UpdateNow(BOOL forceFetch = TRUE);
  47. // two phase update
  48. BOOL PrepareUpdate(BOOL forceFetch = TRUE);
  49. BOOL CommitUpdate(void);
  50. void Dump(BSTR* pbstrDump);
  51. BOOL HasSites(void);
  52. protected:
  53. void NexusConfigUpdated(IXMLDocument *pi);
  54. BOOL TakeRegistrySnapshot(CRegistryConfig** ppRegConfig,
  55. REGCONFIGMAP** ppConfigMap);
  56. BOOL ApplyRegistrySnapshot(CRegistryConfig* pRegConfig,
  57. REGCONFIGMAP* pConfigMap);
  58. BOOL TakeNexusSnapshot(CNexusConfig** ppNexusConfig, BOOL bForceFetch);
  59. BOOL ApplyNexusSnapshot(CNexusConfig* pNexusConfig);
  60. void getReadLock(PassportLock &l) { l.acquire(); }
  61. void releaseReadLock(PassportLock &l) { l.release(); }
  62. void getWriteLock(PassportLock &l) { l.acquire(); }
  63. void releaseWriteLock(PassportLock &l) { l.release(); }
  64. BOOL IsIPAddress(LPSTR szSiteName);
  65. REGCONFIGMAP *m_ConfigMap, *m_lastConfigMap, *m_ConfigMapPending;
  66. CRegistryConfig *m_rDefault, *m_rlastDefault, *m_rPending;
  67. CNexusConfig *m_n, *m_nlast, *m_nPending;
  68. PassportLock m_lock;
  69. HANDLE m_nUpdate, m_rUpdate;
  70. time_t m_lastAttempt;
  71. bool m_bUpdateInProgress;
  72. };
  73. #endif // !defined(AFX_PASSPORTCONFIGURATION_H__74EB2517_E239_11D2_95E9_00C04F8E7A70__INCLUDED_)