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.

368 lines
12 KiB

  1. // server.h : Declaration of the CNntpVirtualServer
  2. /////////////////////////////////////////////////////////////////////////////
  3. // Dependencies:
  4. #include "metafact.h"
  5. #include "binding.h"
  6. #include "vroots.h"
  7. #include "ipaccess.h"
  8. /////////////////////////////////////////////////////////////////////////////
  9. // nntpadm
  10. class CNntpVirtualServer :
  11. public CComDualImpl<INntpVirtualServer, &IID_INntpVirtualServer, &LIBID_NNTPADMLib>,
  12. public ISupportErrorInfo,
  13. public CComObjectRoot,
  14. public CComCoClass<CNntpVirtualServer,&CLSID_CNntpVirtualServer>
  15. {
  16. public:
  17. CNntpVirtualServer();
  18. virtual ~CNntpVirtualServer ();
  19. BEGIN_COM_MAP(CNntpVirtualServer)
  20. COM_INTERFACE_ENTRY(IDispatch)
  21. COM_INTERFACE_ENTRY(INntpVirtualServer)
  22. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  23. END_COM_MAP()
  24. //DECLARE_NOT_AGGREGATABLE(CNntpVirtualServer)
  25. // Remove the comment from the line above if you don't want your object to
  26. // support aggregation. The default is to support it
  27. DECLARE_REGISTRY(CNntpVirtualServer, _T("Nntpadm.VirtualServer.1"), _T("Nntpadm.VirtualServer"), IDS_NNTPADMINSERVICE_DESC, THREADFLAGS_BOTH)
  28. // ISupportsErrorInfo
  29. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  30. // INntpVirtualServer
  31. public:
  32. //////////////////////////////////////////////////////////////////////
  33. // Properties:
  34. //////////////////////////////////////////////////////////////////////
  35. // Which service to configure:
  36. STDMETHODIMP get_Server ( BSTR * pstrServer );
  37. STDMETHODIMP put_Server ( BSTR strServer );
  38. STDMETHODIMP get_ServiceInstance ( long * plServiceInstance );
  39. STDMETHODIMP put_ServiceInstance ( long lServiceInstance );
  40. // Other admin interfaces for virtual server:
  41. STDMETHODIMP get_FeedsAdmin ( IDispatch ** ppIDispatch );
  42. STDMETHODIMP get_GroupsAdmin ( IDispatch ** ppIDispatch );
  43. STDMETHODIMP get_SessionsAdmin ( IDispatch ** ppIDispatch );
  44. STDMETHODIMP get_ExpirationAdmin ( IDispatch ** ppIDispatch );
  45. STDMETHODIMP get_RebuildAdmin ( IDispatch ** ppIDispatch );
  46. STDMETHODIMP get_VirtualRoots ( INntpVirtualRoots ** ppVirtualRoots );
  47. STDMETHODIMP get_VirtualRootsDispatch ( IDispatch ** ppVirtualRoots );
  48. STDMETHODIMP get_TcpAccess ( ITcpAccess ** ppTcpAccess );
  49. /*
  50. STDMETHODIMP get_HomeDirectory ( INntpVirtualRoot ** ppVirtualRoot );
  51. STDMETHODIMP put_HomeDirectory ( INntpVirtualRoot * pVirtualRoot );
  52. */
  53. // Overridable server properties:
  54. STDMETHODIMP get_ArticleTimeLimit ( long * plArticleTimeLimit );
  55. STDMETHODIMP put_ArticleTimeLimit ( long lArticleTimeLimit );
  56. STDMETHODIMP get_HistoryExpiration ( long * plHistoryExpiration );
  57. STDMETHODIMP put_HistoryExpiration ( long lHistoryExpiration );
  58. STDMETHODIMP get_HonorClientMsgIDs ( BOOL * pfHonorClientMsgIDs );
  59. STDMETHODIMP put_HonorClientMsgIDs ( BOOL fHonorClientMsgIDs );
  60. STDMETHODIMP get_SmtpServer ( BSTR * pstrSmtpServer );
  61. STDMETHODIMP put_SmtpServer ( BSTR strSmtpServer );
  62. STDMETHODIMP get_AdminEmail ( BSTR * pstrAdminEmail );
  63. STDMETHODIMP put_AdminEmail ( BSTR strAdminEmail );
  64. STDMETHODIMP get_AllowClientPosts ( BOOL * pfAllowClientPosts );
  65. STDMETHODIMP put_AllowClientPosts ( BOOL fAllowClientPosts );
  66. STDMETHODIMP get_AllowFeedPosts ( BOOL * pfAllowFeedPosts );
  67. STDMETHODIMP put_AllowFeedPosts ( BOOL fAllowFeedPosts );
  68. STDMETHODIMP get_ClientPostHardLimit ( long * plClientPostHardLimit );
  69. STDMETHODIMP put_ClientPostHardLimit ( long lClientPostHardLimit );
  70. STDMETHODIMP get_ClientPostSoftLimit ( long * plClientPostSoftLimit );
  71. STDMETHODIMP put_ClientPostSoftLimit ( long lClientPostSoftLimit );
  72. STDMETHODIMP get_FeedPostHardLimit ( long * plFeedPostHardLimit );
  73. STDMETHODIMP put_FeedPostHardLimit ( long lFeedPostHardLimit );
  74. STDMETHODIMP get_FeedPostSoftLimit ( long * plFeedPostSoftLimit );
  75. STDMETHODIMP put_FeedPostSoftLimit ( long lFeedPostSoftLimit );
  76. STDMETHODIMP get_AllowControlMsgs ( BOOL * pfAllowControlMsgs );
  77. STDMETHODIMP put_AllowControlMsgs ( BOOL fAllowControlMsgs );
  78. STDMETHODIMP get_DefaultModeratorDomain ( BSTR * pstrDefaultModeratorDomain );
  79. STDMETHODIMP put_DefaultModeratorDomain ( BSTR strDefaultModeratorDomain );
  80. STDMETHODIMP get_CommandLogMask ( long * plCommandLogMask );
  81. STDMETHODIMP put_CommandLogMask ( long lCommandLogMask );
  82. STDMETHODIMP get_DisableNewnews ( BOOL * pfDisableNewnews );
  83. STDMETHODIMP put_DisableNewnews ( BOOL fDisableNewnews );
  84. STDMETHODIMP get_ExpireRunFrequency ( long * plExpireRunFrequency );
  85. STDMETHODIMP put_ExpireRunFrequency ( long lExpireRunFrequency );
  86. STDMETHODIMP get_ShutdownLatency ( long * plShutdownLatency );
  87. STDMETHODIMP put_ShutdownLatency ( long lShutdownLatency );
  88. STDMETHODIMP get_EnableLogging ( BOOL * pfEnableLogging );
  89. STDMETHODIMP put_EnableLogging ( BOOL fEnableLogging );
  90. // Service Properties:
  91. STDMETHODIMP get_Organization ( BSTR * pstrOrganization );
  92. STDMETHODIMP put_Organization ( BSTR strOrganization );
  93. STDMETHODIMP get_UucpName ( BSTR * pstrUucpName );
  94. STDMETHODIMP put_UucpName ( BSTR strUucpName );
  95. STDMETHODIMP get_GroupHelpFile ( BSTR * pstrGroupHelpFile );
  96. STDMETHODIMP put_GroupHelpFile ( BSTR strGroupHelpFile );
  97. STDMETHODIMP get_GroupListFile ( BSTR * pstrGroupListFile );
  98. STDMETHODIMP put_GroupListFile ( BSTR strGroupListFile );
  99. STDMETHODIMP get_GroupVarListFile ( BSTR *pstrGroupVarListFile );
  100. STDMETHODIMP put_GroupVarListFile ( BSTR strGroupVarListFile );
  101. STDMETHODIMP get_ArticleTableFile ( BSTR * pstrArticleTableFile );
  102. STDMETHODIMP put_ArticleTableFile ( BSTR strArticleTableFile );
  103. STDMETHODIMP get_HistoryTableFile ( BSTR * pstrHistoryTableFile );
  104. STDMETHODIMP put_HistoryTableFile ( BSTR strHistoryTableFile );
  105. STDMETHODIMP get_ModeratorFile ( BSTR * pstrModeratorFile );
  106. STDMETHODIMP put_ModeratorFile ( BSTR strModeratorFile );
  107. STDMETHODIMP get_XOverTableFile ( BSTR * pstrXOverTableFile );
  108. STDMETHODIMP put_XOverTableFile ( BSTR strXOverTableFile );
  109. STDMETHODIMP get_AutoStart ( BOOL * pfAutoStart );
  110. STDMETHODIMP put_AutoStart ( BOOL fAutoStart );
  111. STDMETHODIMP get_Comment ( BSTR * pstrComment );
  112. STDMETHODIMP put_Comment ( BSTR strComment );
  113. STDMETHODIMP get_Bindings ( INntpServerBindings ** ppBindings );
  114. STDMETHODIMP get_BindingsDispatch ( IDispatch ** ppDispatch );
  115. STDMETHODIMP get_SecurePort ( long * pdwSecurePort );
  116. STDMETHODIMP put_SecurePort ( long dwSecurePort );
  117. STDMETHODIMP get_MaxConnections ( long * pdwMaxConnections );
  118. STDMETHODIMP put_MaxConnections ( long dwMaxConnections );
  119. STDMETHODIMP get_ConnectionTimeout ( long * pdwConnectionTimeout );
  120. STDMETHODIMP put_ConnectionTimeout ( long dwConnectionTimeout );
  121. STDMETHODIMP get_AnonymousUserName ( BSTR * pstrAnonymousUserName );
  122. STDMETHODIMP put_AnonymousUserName ( BSTR strAnonymousUserName );
  123. STDMETHODIMP get_AnonymousUserPass ( BSTR * pstrAnonymousUserPass );
  124. STDMETHODIMP put_AnonymousUserPass ( BSTR strAnonymousUserPass );
  125. STDMETHODIMP get_AutoSyncPassword ( BOOL * pfAutoSyncPassword );
  126. STDMETHODIMP put_AutoSyncPassword ( BOOL fAutoSyncPassword );
  127. STDMETHODIMP get_PickupDirectory ( BSTR * pstrPickupDirectory );
  128. STDMETHODIMP put_PickupDirectory ( BSTR strPickupDirectory );
  129. STDMETHODIMP get_FailedPickupDirectory ( BSTR * pstrFailedPickupDirectory );
  130. STDMETHODIMP put_FailedPickupDirectory ( BSTR strFailedPickupDirectory );
  131. STDMETHODIMP get_AuthAnonymous ( BOOL * pfAuthAnonymous );
  132. STDMETHODIMP put_AuthAnonymous ( BOOL fAuthAnonymous );
  133. STDMETHODIMP get_AuthBasic ( BOOL * pfAuthBasic );
  134. STDMETHODIMP put_AuthBasic ( BOOL fAuthBasic );
  135. STDMETHODIMP get_AuthMCISBasic ( BOOL * pfAuthMCISBasic );
  136. STDMETHODIMP put_AuthMCISBasic ( BOOL fAuthMCISBasic );
  137. STDMETHODIMP get_AuthNT ( BOOL * pfAuthNT );
  138. STDMETHODIMP put_AuthNT ( BOOL fAuthNT );
  139. STDMETHODIMP get_SSLNegotiateCert ( BOOL * pfSSLNegotiateCert );
  140. STDMETHODIMP put_SSLNegotiateCert ( BOOL fSSLNegotiateCert );
  141. STDMETHODIMP get_SSLRequireCert ( BOOL * pfSSLRequireCert );
  142. STDMETHODIMP put_SSLRequireCert ( BOOL fSSLRequireCert );
  143. STDMETHODIMP get_SSLMapCert ( BOOL * pfSSLMapCert );
  144. STDMETHODIMP put_SSLMapCert ( BOOL fSSLMapCert );
  145. /*
  146. STDMETHODIMP get_AuthenticationProviders ( SAFEARRAY ** ppsastrProviders );
  147. STDMETHODIMP put_AuthenticationProviders ( SAFEARRAY * psastrProviders );
  148. STDMETHODIMP get_AuthenticationProvidersVariant ( SAFEARRAY ** ppsastrProviders );
  149. STDMETHODIMP put_AuthenticationProvidersVariant ( SAFEARRAY * psastrProviders );
  150. */
  151. /*
  152. STDMETHODIMP get_NewsgroupsVariant ( SAFEARRAY ** ppsastrNewsgroups );
  153. STDMETHODIMP put_NewsgroupsVariant ( SAFEARRAY * psastrNewsgroups );
  154. */
  155. STDMETHODIMP get_Administrators ( SAFEARRAY ** ppsastrAdmins );
  156. STDMETHODIMP put_Administrators ( SAFEARRAY * psastrAdmins );
  157. STDMETHODIMP get_AdministratorsVariant ( SAFEARRAY ** ppsastrAdmins );
  158. STDMETHODIMP put_AdministratorsVariant ( SAFEARRAY * psastrAdmins );
  159. STDMETHODIMP get_ClusterEnabled ( BOOL *pfClusterEnabled );
  160. STDMETHODIMP put_ClusterEnabled ( BOOL fClusterEnabled );
  161. //
  162. // Service State Properties:
  163. //
  164. STDMETHODIMP get_State ( NNTP_SERVER_STATE * pState );
  165. STDMETHODIMP get_Win32ErrorCode ( long * plWin32ErrorCode );
  166. /*
  167. STDMETHODIMP get_EncryptionCapabilitiesMask ( long * plEncryptionCapabilitiesMask );
  168. STDMETHODIMP put_EncryptionCapabilitiesMask ( long lEncryptionCapabilitiesMask );
  169. STDMETHODIMP get_DisplayName ( BSTR * pstrDisplayName );
  170. STDMETHODIMP put_DisplayName ( BSTR strDisplayName );
  171. STDMETHODIMP get_ErrorControl ( BOOL * pfErrorControl );
  172. STDMETHODIMP put_ErrorControl ( BOOL fErrorControl );
  173. STDMETHODIMP get_CleanBoot ( BOOL * pfCleanBoot );
  174. STDMETHODIMP put_CleanBoot ( BOOL fCleanBoot );
  175. */
  176. //////////////////////////////////////////////////////////////////////
  177. // Methods:
  178. //////////////////////////////////////////////////////////////////////
  179. STDMETHODIMP Get ( );
  180. STDMETHODIMP Set ( BOOL fFailIfChanged);
  181. STDMETHODIMP Start ( );
  182. STDMETHODIMP Pause ( );
  183. STDMETHODIMP Continue ( );
  184. STDMETHODIMP Stop ( );
  185. //////////////////////////////////////////////////////////////////////
  186. // Data:
  187. //////////////////////////////////////////////////////////////////////
  188. private:
  189. // Properties:
  190. CComBSTR m_strServer;
  191. DWORD m_dwServiceInstance;
  192. DWORD m_dwArticleTimeLimit;
  193. DWORD m_dwHistoryExpiration;
  194. BOOL m_fHonorClientMsgIDs;
  195. CComBSTR m_strSmtpServer;
  196. CComBSTR m_strAdminEmail;
  197. BOOL m_fAllowClientPosts;
  198. BOOL m_fAllowFeedPosts;
  199. BOOL m_fAllowControlMsgs;
  200. CComBSTR m_strDefaultModeratorDomain;
  201. DWORD m_dwCommandLogMask;
  202. BOOL m_fDisableNewnews;
  203. DWORD m_dwExpireRunFrequency;
  204. DWORD m_dwShutdownLatency;
  205. DWORD m_dwClientPostHardLimit;
  206. DWORD m_dwClientPostSoftLimit;
  207. DWORD m_dwFeedPostHardLimit;
  208. DWORD m_dwFeedPostSoftLimit;
  209. BOOL m_fEnableLogging;
  210. CComBSTR m_strGroupHelpFile;
  211. CComBSTR m_strGroupListFile;
  212. CComBSTR m_strGroupVarListFile;
  213. CComBSTR m_strArticleTableFile;
  214. CComBSTR m_strHistoryTableFile;
  215. CComBSTR m_strModeratorFile;
  216. CComBSTR m_strXOverTableFile;
  217. CComBSTR m_strUucpName;
  218. CComBSTR m_strOrganization;
  219. BOOL m_fAutoStart;
  220. CComBSTR m_strComment;
  221. DWORD m_dwSecurePort;
  222. DWORD m_dwMaxConnections;
  223. DWORD m_dwConnectionTimeout;
  224. CComBSTR m_strAnonymousUserName;
  225. CComBSTR m_strAnonymousUserPass;
  226. BOOL m_fAutoSyncPassword;
  227. CComBSTR m_strPickupDirectory;
  228. CComBSTR m_strFailedPickupDirectory;
  229. DWORD m_bvAuthorization;
  230. DWORD m_bvSslAccess;
  231. BOOL m_fClusterEnabled;
  232. // CMultiSz m_mszProviders;
  233. SAFEARRAY * m_psaAdmins;
  234. // Service State:
  235. NNTP_SERVER_STATE m_State;
  236. DWORD m_dwWin32ErrorCode;
  237. // Tcp restrictions:
  238. CComPtr<ITcpAccess> m_pIpAccess;
  239. CTcpAccess * m_pPrivateIpAccess;
  240. // Bindings:
  241. CComPtr<INntpServerBindings> m_pBindings;
  242. CNntpServerBindings * m_pPrivateBindings;
  243. /*
  244. CComPtr<INntpVirtualRoot> m_pHomeDirectory;
  245. CNntpVirtualRoot * m_pPrivateHomeDirectory;
  246. */
  247. // Unused so far:
  248. DWORD m_dwEncryptionCapabilities;
  249. CComBSTR m_strDisplayName;
  250. BOOL m_fErrorControl;
  251. BOOL m_fCleanBoot;
  252. // Status:
  253. BOOL m_fGotProperties;
  254. DWORD m_bvChangedFields;
  255. DWORD m_bvChangedFields2;
  256. FILETIME m_ftLastChanged;
  257. // Metabase:
  258. CMetabaseFactory m_mbFactory;
  259. HRESULT GetPropertiesFromMetabase ( IMSAdminBase * pMetabase);
  260. HRESULT SendPropertiesToMetabase ( BOOL fFailIfChanged, IMSAdminBase * pMetabase);
  261. // State:
  262. HRESULT ControlService (
  263. IMSAdminBase * pMetabase,
  264. DWORD ControlCode,
  265. DWORD dwDesiredState,
  266. DWORD dwPendingState
  267. );
  268. HRESULT WriteStateCommand ( IMSAdminBase * pMetabase, DWORD dwCommand );
  269. HRESULT CheckServiceState ( IMSAdminBase * pMetabase, DWORD * pdwState );
  270. NNTP_SERVER_STATE TranslateServerState ( DWORD dwState );
  271. // Validation:
  272. BOOL ValidateStrings ( ) const;
  273. BOOL ValidateProperties ( ) const;
  274. void CorrectProperties ( );
  275. };