Source code of Windows XP (NT5)
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.

338 lines
11 KiB

  1. // expire.h : Declaration of the CSmtpAdminService
  2. #include "resource.h" // main symbols
  3. /////////////////////////////////////////////////////////////////////////////
  4. // Dependencies
  5. /////////////////////////////////////////////////////////////////////////////
  6. #include "metafact.h"
  7. #include "cmultisz.h"
  8. struct IMSAdminBase;
  9. /////////////////////////////////////////////////////////////////////////////
  10. // smtpadm
  11. class CSmtpAdminService :
  12. public CComDualImpl<ISmtpAdminService, &IID_ISmtpAdminService, &LIBID_SMTPADMLib>,
  13. public ISupportErrorInfo,
  14. public CComObjectRoot,
  15. public CComCoClass<CSmtpAdminService,&CLSID_CSmtpAdminService>
  16. {
  17. public:
  18. CSmtpAdminService();
  19. virtual ~CSmtpAdminService ();
  20. BEGIN_COM_MAP(CSmtpAdminService)
  21. COM_INTERFACE_ENTRY(IDispatch)
  22. COM_INTERFACE_ENTRY(ISmtpAdminService)
  23. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  24. END_COM_MAP()
  25. //DECLARE_NOT_AGGREGATABLE(CSmtpAdminService)
  26. // Remove the comment from the line above if you don't want your object to
  27. // support aggregation. The default is to support it
  28. DECLARE_REGISTRY(CSmtpAdminService, _T("Smtpadm.Service.1"), _T("Smtpadm.Service"), IDS_SMTPADMIN_SERVICE_DESC, THREADFLAGS_BOTH)
  29. // ISupportsErrorInfo
  30. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  31. // ISmtpAdminService
  32. public:
  33. //////////////////////////////////////////////////////////////////////
  34. // Properties:
  35. //////////////////////////////////////////////////////////////////////
  36. // Which Server to configure:
  37. STDMETHODIMP get_Server ( BSTR * pstrServer );
  38. STDMETHODIMP put_Server ( BSTR strServer );
  39. // No instance for the server interface
  40. // Server Properties:
  41. STDMETHODIMP get_ServerBindings ( SAFEARRAY ** ppsastrServerBindings );
  42. STDMETHODIMP put_ServerBindings ( SAFEARRAY * pstrServerBindings );
  43. STDMETHODIMP get_ServerBindingsVariant ( SAFEARRAY ** ppsastrServerBindings );
  44. STDMETHODIMP put_ServerBindingsVariant ( SAFEARRAY * pstrServerBindings );
  45. STDMETHODIMP get_SecureBindings ( SAFEARRAY ** ppsastrSecureBindings );
  46. STDMETHODIMP put_SecureBindings ( SAFEARRAY * pstrSecureBindings );
  47. STDMETHODIMP get_SecureBindingsVariant ( SAFEARRAY ** ppsastrSecureBindings );
  48. STDMETHODIMP put_SecureBindingsVariant ( SAFEARRAY * pstrSecureBindings );
  49. STDMETHODIMP get_Port ( long * lPort );
  50. STDMETHODIMP put_Port ( long lPort );
  51. STDMETHODIMP get_SSLPort ( long * lSSLPort );
  52. STDMETHODIMP put_SSLPort ( long lSSLPort );
  53. STDMETHODIMP get_OutboundPort ( long * lOutboundPort );
  54. STDMETHODIMP put_OutboundPort ( long lOutboundPort );
  55. STDMETHODIMP get_HopCount ( long * lHopCount );
  56. STDMETHODIMP put_HopCount ( long lHopCount );
  57. STDMETHODIMP get_SmartHost ( BSTR * pstrSmartHost );
  58. STDMETHODIMP put_SmartHost ( BSTR strSmartHost );
  59. STDMETHODIMP get_EnableDNSLookup ( BOOL * pfEnableDNSLookup );
  60. STDMETHODIMP put_EnableDNSLookup ( BOOL fEnableDNSLookup );
  61. STDMETHODIMP get_PostmasterEmail ( BSTR * pstrPostmasterEmail );
  62. STDMETHODIMP put_PostmasterEmail ( BSTR strPostmasterEmail );
  63. STDMETHODIMP get_PostmasterName ( BSTR * pstrPostmasterName );
  64. STDMETHODIMP put_PostmasterName ( BSTR strPostmasterName );
  65. STDMETHODIMP get_DefaultDomain ( BSTR * pstrDefaultDomainName );
  66. STDMETHODIMP put_DefaultDomain ( BSTR strDefaultDomainName );
  67. STDMETHODIMP get_FQDN ( BSTR * pstrFQDN );
  68. STDMETHODIMP put_FQDN ( BSTR strFQDN );
  69. STDMETHODIMP get_DropDir ( BSTR * pstrDropDir );
  70. STDMETHODIMP put_DropDir ( BSTR strDropDir );
  71. STDMETHODIMP get_BadMailDir ( BSTR * pstrBadMailDir );
  72. STDMETHODIMP put_BadMailDir ( BSTR strBadMailDir );
  73. STDMETHODIMP get_PickupDir ( BSTR * pstrPickupDir );
  74. STDMETHODIMP put_PickupDir ( BSTR strPickupDir );
  75. STDMETHODIMP get_QueueDir ( BSTR * pstrQueueDir );
  76. STDMETHODIMP put_QueueDir ( BSTR strQueueDir );
  77. STDMETHODIMP get_MaxInConnection ( long * lMaxInConnection );
  78. STDMETHODIMP put_MaxInConnection ( long lMaxInConnection );
  79. STDMETHODIMP get_MaxOutConnection ( long * lMaxOutConnection );
  80. STDMETHODIMP put_MaxOutConnection ( long lMaxOutConnection );
  81. STDMETHODIMP get_InConnectionTimeout ( long * lInConnectionTimeout );
  82. STDMETHODIMP put_InConnectionTimeout ( long lInConnectionTimeout );
  83. STDMETHODIMP get_OutConnectionTimeout( long * lOutConnectionTimeout );
  84. STDMETHODIMP put_OutConnectionTimeout( long lOutConnectionTimeout );
  85. STDMETHODIMP get_MaxMessageSize ( long * lMaxMessageSize );
  86. STDMETHODIMP put_MaxMessageSize ( long lMaxMessageSize );
  87. STDMETHODIMP get_MaxSessionSize ( long * lMaxSessionSize );
  88. STDMETHODIMP put_MaxSessionSize ( long lMaxSessionSize );
  89. STDMETHODIMP get_MaxMessageRecipients ( long * lMaxMessageRecipients );
  90. STDMETHODIMP put_MaxMessageRecipients ( long lMaxMessageRecipients );
  91. STDMETHODIMP get_LocalRetries ( long * lLocalRetries );
  92. STDMETHODIMP put_LocalRetries ( long lLocalRetries );
  93. STDMETHODIMP get_LocalRetryTime ( long * lLocalRetryTime );
  94. STDMETHODIMP put_LocalRetryTime ( long lLocalRetryTime );
  95. STDMETHODIMP get_RemoteRetries ( long * lRemoteRetries );
  96. STDMETHODIMP put_RemoteRetries ( long lRemoteRetries );
  97. STDMETHODIMP get_RemoteRetryTime ( long * lRemoteRetryTime );
  98. STDMETHODIMP put_RemoteRetryTime ( long lRemoteRetryTime );
  99. STDMETHODIMP get_ETRNDays ( long * lETRNDays );
  100. STDMETHODIMP put_ETRNDays ( long lETRNDays );
  101. STDMETHODIMP get_SendDNRToPostmaster ( BOOL * pfSendDNRToPostmaster );
  102. STDMETHODIMP put_SendDNRToPostmaster ( BOOL fSendDNRToPostmaster );
  103. STDMETHODIMP get_SendBadmailToPostmaster ( BOOL * pfSendBadmailToPostmaster);
  104. STDMETHODIMP put_SendBadmailToPostmaster ( BOOL fSendBadmailToPostmaster );
  105. STDMETHODIMP get_RoutingDLL ( BSTR * pstrRoutingDLL );
  106. STDMETHODIMP put_RoutingDLL ( BSTR strRoutingDLL );
  107. STDMETHODIMP get_RoutingSources ( SAFEARRAY ** ppsastrRoutingSources );
  108. STDMETHODIMP put_RoutingSources ( SAFEARRAY * pstrRoutingSources );
  109. STDMETHODIMP get_RoutingSourcesVariant ( SAFEARRAY ** ppsastrRoutingSources );
  110. STDMETHODIMP put_RoutingSourcesVariant ( SAFEARRAY * pstrRoutingSources );
  111. STDMETHODIMP get_LocalDomains ( SAFEARRAY ** ppsastrLocalDomains );
  112. STDMETHODIMP put_LocalDomains ( SAFEARRAY * pstrLocalDomains );
  113. STDMETHODIMP get_DomainRouting ( SAFEARRAY ** ppsastrDomainRouting );
  114. STDMETHODIMP put_DomainRouting ( SAFEARRAY * pstrDomainRouting );
  115. STDMETHODIMP get_DomainRoutingVariant ( SAFEARRAY ** ppsastrDomainRouting );
  116. STDMETHODIMP put_DomainRoutingVariant ( SAFEARRAY * pstrDomainRouting );
  117. STDMETHODIMP get_MasqueradeDomain ( BSTR * pstrMasqueradeDomain );
  118. STDMETHODIMP put_MasqueradeDomain ( BSTR strMasqueradeDomain );
  119. STDMETHODIMP get_SendNdrTo ( BSTR * pstrAddr );
  120. STDMETHODIMP put_SendNdrTo ( BSTR strAddr );
  121. STDMETHODIMP get_SendBadTo ( BSTR * pstrAddr );
  122. STDMETHODIMP put_SendBadTo ( BSTR strAddr );
  123. STDMETHODIMP get_RemoteSecurePort ( long * plRemoteSecurePort );
  124. STDMETHODIMP put_RemoteSecurePort ( long lRemoteSecurePort );
  125. STDMETHODIMP get_ShouldDeliver ( BOOL * pfShouldDeliver );
  126. STDMETHODIMP put_ShouldDeliver ( BOOL fShouldDeliver );
  127. STDMETHODIMP get_AlwaysUseSsl ( BOOL * pfAlwaysUseSsl );
  128. STDMETHODIMP put_AlwaysUseSsl ( BOOL fAlwaysUseSsl );
  129. STDMETHODIMP get_LimitRemoteConnections ( BOOL * pfLimitRemoteConnections );
  130. STDMETHODIMP put_LimitRemoteConnections ( BOOL fLimitRemoteConnections );
  131. STDMETHODIMP get_MaxOutConnPerDomain ( long * plMaxOutConnPerDomain );
  132. STDMETHODIMP put_MaxOutConnPerDomain ( long lMaxOutConnPerDomain );
  133. STDMETHODIMP get_AllowVerify ( BOOL * pfAllowVerify );
  134. STDMETHODIMP put_AllowVerify ( BOOL fAllowVerify );
  135. STDMETHODIMP get_AllowExpand ( BOOL * pfAllowExpand );
  136. STDMETHODIMP put_AllowExpand ( BOOL fAllowExpand );
  137. STDMETHODIMP get_SmartHostType ( long * plSmartHostType );
  138. STDMETHODIMP put_SmartHostType ( long lSmartHostType );
  139. STDMETHODIMP get_BatchMessages ( BOOL * pfBatchMessages );
  140. STDMETHODIMP put_BatchMessages ( BOOL fBatchMessages );
  141. STDMETHODIMP get_BatchMessageLimit ( long * plBatchMessageLimit );
  142. STDMETHODIMP put_BatchMessageLimit ( long lBatchMessageLimit );
  143. STDMETHODIMP get_DoMasquerade ( BOOL * pfDoMasquerade );
  144. STDMETHODIMP put_DoMasquerade ( BOOL fDoMasquerade );
  145. STDMETHODIMP get_Administrators ( SAFEARRAY ** ppsastrAdmins );
  146. STDMETHODIMP put_Administrators ( SAFEARRAY * psastrAdmins );
  147. STDMETHODIMP get_AdministratorsVariant ( SAFEARRAY ** ppsastrAdmins );
  148. STDMETHODIMP put_AdministratorsVariant ( SAFEARRAY * psastrAdmins );
  149. STDMETHODIMP get_LogFileDirectory ( BSTR * pstrLogFileDirectory );
  150. STDMETHODIMP put_LogFileDirectory ( BSTR strLogFileDirectory );
  151. STDMETHODIMP get_LogFilePeriod ( long * lLogFilePeriod );
  152. STDMETHODIMP put_LogFilePeriod ( long lLogFilePeriod );
  153. STDMETHODIMP get_LogFileTruncateSize ( long * lLogFileTruncateSize );
  154. STDMETHODIMP put_LogFileTruncateSize ( long lLogFileTruncateSize );
  155. STDMETHODIMP get_LogMethod ( long * lLogMethod );
  156. STDMETHODIMP put_LogMethod ( long lLogMethod );
  157. STDMETHODIMP get_LogType ( long * lLogType );
  158. STDMETHODIMP put_LogType ( long lLogType );
  159. //////////////////////////////////////////////////////////////////////
  160. // Methods:
  161. //////////////////////////////////////////////////////////////////////
  162. STDMETHODIMP Get ( );
  163. STDMETHODIMP Set ( BOOL fFailIfChanged );
  164. //////////////////////////////////////////////////////////////////////
  165. // Data:
  166. //////////////////////////////////////////////////////////////////////
  167. private:
  168. CComBSTR m_strServer;
  169. long m_lPort; // obselete, use server bindings
  170. CMultiSz m_mszServerBindings; // MultiString
  171. CMultiSz m_mszSecureBindings; // MultiString
  172. long m_lSSLPort;
  173. long m_lOutboundPort;
  174. long m_lRemoteSecurePort;
  175. CComBSTR m_strSmartHost;
  176. BOOL m_fEnableDNSLookup;
  177. CComBSTR m_strPostmasterEmail;
  178. CComBSTR m_strPostmasterName;
  179. CComBSTR m_strFQDN;
  180. CComBSTR m_strDefaultDomain;
  181. CComBSTR m_strDropDir;
  182. CComBSTR m_strBadMailDir;
  183. CComBSTR m_strPickupDir;
  184. CComBSTR m_strQueueDir;
  185. long m_lHopCount;
  186. long m_lMaxInConnection;
  187. long m_lMaxOutConnection;
  188. long m_lInConnectionTimeout;
  189. long m_lOutConnectionTimeout;
  190. long m_lMaxMessageSize;
  191. long m_lMaxSessionSize;
  192. long m_lMaxMessageRecipients;
  193. long m_lLocalRetries;
  194. long m_lLocalRetryTime;
  195. long m_lRemoteRetries;
  196. long m_lRemoteRetryTime;
  197. long m_lETRNDays;
  198. BOOL m_fSendDNRToPostmaster;
  199. BOOL m_fSendBadmailToPostmaster;
  200. CComBSTR m_strRoutingDLL;
  201. CMultiSz m_mszRoutingSources; // MultiString
  202. CMultiSz m_mszLocalDomains; // MultiString
  203. CMultiSz m_mszDomainRouting; // MultiString
  204. BOOL m_fDoMasquerade;
  205. CComBSTR m_strMasqueradeDomain;
  206. CComBSTR m_strNdrAddr;
  207. CComBSTR m_strBadAddr;
  208. BOOL m_fShouldDeliver;
  209. BOOL m_fAlwaysUseSsl;
  210. BOOL m_fLimitRemoteConnections;
  211. long m_lMaxOutConnPerDomain;
  212. BOOL m_fAllowVerify;
  213. BOOL m_fAllowExpand;
  214. long m_lSmartHostType;
  215. BOOL m_fBtachMsgs;
  216. long m_lBatchMsgLimit;
  217. SAFEARRAY * m_psaAdmins;
  218. CComBSTR m_strLogFileDirectory;
  219. long m_lLogFilePeriod;
  220. long m_lLogFileTruncateSize;
  221. long m_lLogMethod;
  222. long m_lLogType;
  223. // Status:
  224. BOOL m_fGotProperties;
  225. DWORD m_bvChangedFields;
  226. FILETIME m_ftLastChanged;
  227. // Metabase:
  228. CMetabaseFactory m_mbFactory;
  229. HRESULT GetPropertiesFromMetabase ( IMSAdminBase * pMetabase );
  230. HRESULT SendPropertiesToMetabase ( BOOL fFailIfChanged, IMSAdminBase * pMetabase );
  231. // Validation:
  232. BOOL ValidateStrings ( ) const;
  233. BOOL ValidateProperties ( ) const;
  234. void CorrectProperties ( );
  235. };