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.

178 lines
4.8 KiB

  1. //+------------------------------------------------------------
  2. //
  3. // Copyright (C) 1998, Microsoft Corporation
  4. //
  5. // File: icatdsparam.h
  6. //
  7. // Contents: NT5's implementation of ICategorizerParameters
  8. //
  9. // Classes:
  10. // CICategorizerParametersIMP
  11. // CICategorizerRequestedAttributesIMP
  12. //
  13. // Functions:
  14. //
  15. // History:
  16. // jstamerj 980611 16:16:46: Created.
  17. //
  18. //-------------------------------------------------------------
  19. #include "smtpevent.h"
  20. #include "caterr.h"
  21. #include <rwex.h>
  22. #define SIGNATURE_CICategorizerParametersIMP ((DWORD)'ICPI')
  23. #define SIGNATURE_CICategorizerParametersIMP_Invalid ((DWORD)'XCPI')
  24. #define DSPARAMETERS_DEFAULT_ATTR_ARRAY_SIZE 25
  25. class CICategorizerRequestedAttributesIMP;
  26. CatDebugClass(CICategorizerParametersIMP),
  27. public ICategorizerParametersEx
  28. {
  29. public:
  30. //IUnknown
  31. STDMETHOD (QueryInterface) (REFIID iid, LPVOID *ppv);
  32. STDMETHOD_(ULONG, AddRef) ();
  33. STDMETHOD_(ULONG, Release) ();
  34. public:
  35. //ICategorizerParametersEx
  36. STDMETHOD(GetDSParameterA)(
  37. IN DWORD dwDSParameter,
  38. OUT LPSTR *ppszValue);
  39. STDMETHOD(GetDSParameterW)(
  40. IN DWORD dwDSParameter,
  41. OUT LPWSTR *ppszValue);
  42. STDMETHOD(SetDSParameterA)(
  43. IN DWORD dwDSParameter,
  44. IN LPCSTR pszValue);
  45. STDMETHOD(RequestAttributeA)(
  46. IN LPCSTR pszName);
  47. STDMETHOD(GetAllAttributes)(
  48. OUT LPSTR **prgszAllAttributes)
  49. {
  50. return E_NOTIMPL;
  51. }
  52. STDMETHOD(ReserveICatItemPropIds)(
  53. IN DWORD dwNumPropIdsRequested,
  54. OUT DWORD *pdwBeginningPropId);
  55. STDMETHOD(ReserveICatListResolvePropIds)(
  56. IN DWORD dwNumPropIdsRequested,
  57. OUT DWORD *pdwBeginningPropId);
  58. STDMETHOD(GetCCatConfigInfo)(
  59. OUT PCCATCONFIGINFO *ppCCatConfigInfo);
  60. STDMETHOD(GetRequestedAttributes)(
  61. OUT ICategorizerRequestedAttributes **ppIRequestedAttributes);
  62. STDMETHOD(RegisterCatLdapConfigInterface)(
  63. IN ICategorizerLdapConfig *pICatLdapConfigInfo);
  64. STDMETHOD(GetLdapConfigInterface)(
  65. OUT ICategorizerLdapConfig **ppICatLdapConfigInfo);
  66. private:
  67. CICategorizerParametersIMP(
  68. PCCATCONFIGINFO pCCatConfigInfo,
  69. DWORD dwInitialICatItemProps,
  70. DWORD dwInitialICatListResolveProps,
  71. ISMTPServerEx *pISMTPServerEx);
  72. ~CICategorizerParametersIMP();
  73. VOID SetReadOnly(BOOL fReadOnly) { m_fReadOnly = fReadOnly; }
  74. DWORD GetNumPropIds_ICatItem() { return m_dwCurPropId_ICatItem; }
  75. DWORD GetNumPropIds_ICatListResolve() { return m_dwCurPropId_ICatListResolve; }
  76. ISMTPServerEx * GetISMTPServerEx()
  77. {
  78. return m_pISMTPServerEx;
  79. }
  80. private:
  81. DWORD m_dwSignature;
  82. ULONG m_cRef;
  83. BOOL m_fReadOnly;
  84. CICategorizerRequestedAttributesIMP *m_pCIRequestedAttributes;
  85. DWORD m_dwCurPropId_ICatItem;
  86. DWORD m_dwCurPropId_ICatListResolve;
  87. LPSTR m_rgszDSParameters[PHAT_DSPARAMETER_ENDENUMMESS];
  88. LPWSTR m_rgwszDSParameters[PHAT_DSPARAMETER_ENDENUMMESS];
  89. PCCATCONFIGINFO m_pCCatConfigInfo;
  90. CExShareLock m_sharelock;
  91. ICategorizerLdapConfig *m_pICatLdapConfigInfo;
  92. ISMTPServerEx *m_pISMTPServerEx;
  93. friend class CCategorizer;
  94. };
  95. CatDebugClass(CICategorizerRequestedAttributesIMP),
  96. public ICategorizerRequestedAttributes
  97. {
  98. public:
  99. //IUnknown
  100. STDMETHOD (QueryInterface) (REFIID iid, LPVOID *ppv);
  101. STDMETHOD_(ULONG, AddRef) ()
  102. {
  103. return InterlockedIncrement((PLONG)&m_ulRef);
  104. }
  105. STDMETHOD_(ULONG, Release) ()
  106. {
  107. ULONG ulRet;
  108. ulRet = InterlockedDecrement((PLONG)&m_ulRef);
  109. if(ulRet == 0)
  110. delete this;
  111. return ulRet;
  112. }
  113. public:
  114. //ICategorizerRequestedAttributes
  115. STDMETHOD (GetAllAttributes) (
  116. OUT LPSTR **prgszAllAttributes);
  117. STDMETHOD (GetAllAttributesW) (
  118. OUT LPWSTR **prgszAllAttributes);
  119. private:
  120. CICategorizerRequestedAttributesIMP(ISMTPServerEx *pISMTPServerEx);
  121. ~CICategorizerRequestedAttributesIMP();
  122. HRESULT ReAllocArrayIfNecessary(LONG lNewAttributeCount);
  123. HRESULT AddAttribute(LPCSTR pszAttribute);
  124. HRESULT FindAttribute(LPCSTR pszAttribute);
  125. ULONG GetReferenceCount()
  126. {
  127. return m_ulRef;
  128. }
  129. ISMTPServerEx * GetISMTPServerEx()
  130. {
  131. return m_pISMTPServerEx;
  132. }
  133. private:
  134. #define SIGNATURE_CICATEGORIZERREQUESTEDATTRIBUTESIMP (DWORD)'ICRA'
  135. #define SIGNATURE_CICATEGORIZERREQUESTEDATTRIBUTESIMP_INVALID (DWORD)'XCRA'
  136. DWORD m_dwSignature;
  137. LONG m_ulRef;
  138. LONG m_lAttributeArraySize;
  139. LPSTR *m_rgszAttributeArray;
  140. LPWSTR *m_rgwszAttributeArray;
  141. LONG m_lNumberAttributes;
  142. ISMTPServerEx *m_pISMTPServerEx;
  143. friend class CICategorizerParametersIMP;
  144. };