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.

260 lines
8.5 KiB

  1. // feeds.h : Declaration of the CNntpAdminFeeds
  2. /////////////////////////////////////////////////////////////////////////////
  3. // Dependencies:
  4. #include "feedinfo.h"
  5. /////////////////////////////////////////////////////////////////////////////
  6. // CNntpOneWayFeed:
  7. class CNntpOneWayFeed:
  8. public CComDualImpl<INntpOneWayFeed, &IID_INntpOneWayFeed, &LIBID_NNTPADMLib>,
  9. public ISupportErrorInfo,
  10. public CComObjectRoot,
  11. public CComCoClass<CNntpOneWayFeed,&CLSID_CNntpOneWayFeed>
  12. {
  13. friend class CFeed;
  14. public:
  15. CNntpOneWayFeed();
  16. virtual ~CNntpOneWayFeed ();
  17. BEGIN_COM_MAP(CNntpOneWayFeed)
  18. COM_INTERFACE_ENTRY(IDispatch)
  19. COM_INTERFACE_ENTRY(INntpOneWayFeed)
  20. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  21. END_COM_MAP()
  22. //DECLARE_NOT_AGGREGATABLE(CNntpOneWayFeed)
  23. // Remove the comment from the line above if you don't want your object to
  24. // support aggregation. The default is to support it
  25. DECLARE_REGISTRY(CNntpOneWayFeed, _T("Nntpadm.OneWayFeed.1"), _T("Nntpadm.OneWayFeed"), IDS_NNTPONEWAYFEED_DESC, THREADFLAGS_BOTH)
  26. // ISupportsErrorInfo
  27. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  28. // INntpOneWayFeed
  29. public:
  30. STDMETHODIMP get_FeedId ( long * plFeedId );
  31. STDMETHODIMP get_RemoteServer ( BSTR * pstrRemoteServer );
  32. STDMETHODIMP get_FeedAction ( NNTP_FEED_ACTION * pfeedaction );
  33. STDMETHODIMP put_FeedAction ( NNTP_FEED_ACTION feedaction );
  34. STDMETHODIMP get_UucpName ( BSTR * pstrUucpName );
  35. STDMETHODIMP put_UucpName ( BSTR strUucpName );
  36. STDMETHODIMP get_PullNewsDate ( DATE * pdatePullNews );
  37. STDMETHODIMP put_PullNewsDate ( DATE datePullNews );
  38. STDMETHODIMP get_FeedInterval ( long * plFeedInterval );
  39. STDMETHODIMP put_FeedInterval ( long lFeedInterval );
  40. STDMETHODIMP get_AutoCreate ( BOOL * pfAutoCreate );
  41. STDMETHODIMP put_AutoCreate ( BOOL fAutoCreate );
  42. STDMETHODIMP get_Enabled ( BOOL * pfEnabled );
  43. STDMETHODIMP put_Enabled ( BOOL fEnabled );
  44. STDMETHODIMP get_MaxConnectionAttempts ( long * plMaxConnectionAttempts );
  45. STDMETHODIMP put_MaxConnectionAttempts ( long lMaxConnectionAttempts );
  46. STDMETHODIMP get_SecurityType ( long * plSecurityType );
  47. STDMETHODIMP put_SecurityType ( long lSecurityType );
  48. STDMETHODIMP get_AuthenticationType ( long * plAuthenticationType );
  49. STDMETHODIMP put_AuthenticationType ( long lAuthenticationType );
  50. STDMETHODIMP get_AccountName ( BSTR * pstrAccountName );
  51. STDMETHODIMP put_AccountName ( BSTR strAccountName );
  52. STDMETHODIMP get_Password ( BSTR * pstrPassword );
  53. STDMETHODIMP put_Password ( BSTR strPassword );
  54. STDMETHODIMP get_AllowControlMessages ( BOOL * pfAllowControlMessages );
  55. STDMETHODIMP put_AllowControlMessages ( BOOL fAllowControlMessages );
  56. STDMETHODIMP get_OutgoingPort ( long * plOutgoingPort );
  57. STDMETHODIMP put_OutgoingPort ( long lOutgoingPort );
  58. STDMETHODIMP get_Newsgroups ( SAFEARRAY ** ppsastrNewsgroups );
  59. STDMETHODIMP put_Newsgroups ( SAFEARRAY * psastrNewsgroups );
  60. STDMETHODIMP get_NewsgroupsVariant ( SAFEARRAY ** ppsastrNewsgroups );
  61. STDMETHODIMP put_NewsgroupsVariant ( SAFEARRAY * psastrNewsgroups );
  62. STDMETHODIMP get_Distributions ( SAFEARRAY ** ppsastrDistributions );
  63. STDMETHODIMP put_Distributions ( SAFEARRAY * psastrDistributions );
  64. STDMETHODIMP get_TempDirectory ( BSTR * pstrTempDirectory );
  65. STDMETHODIMP put_TempDirectory ( BSTR strTempDirectory );
  66. STDMETHODIMP Default ( );
  67. private:
  68. //
  69. // Each one-way feed corresponds to an NNTP_FEED_INFO struct.
  70. //
  71. CFeed m_feed;
  72. };
  73. /////////////////////////////////////////////////////////////////////////////
  74. // CNntpFeed:
  75. class CNntpFeed:
  76. public CComDualImpl<INntpFeed, &IID_INntpFeed, &LIBID_NNTPADMLib>,
  77. public ISupportErrorInfo,
  78. public CComObjectRoot,
  79. public CComCoClass<CNntpFeed,&CLSID_CNntpFeed>
  80. {
  81. friend class CFeedPair;
  82. public:
  83. CNntpFeed();
  84. virtual ~CNntpFeed ();
  85. BEGIN_COM_MAP(CNntpFeed)
  86. COM_INTERFACE_ENTRY(IDispatch)
  87. COM_INTERFACE_ENTRY(INntpFeed)
  88. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  89. END_COM_MAP()
  90. //DECLARE_NOT_AGGREGATABLE(CNntpFeed)
  91. // Remove the comment from the line above if you don't want your object to
  92. // support aggregation. The default is to support it
  93. DECLARE_REGISTRY(CNntpFeed, _T("Nntpadm.Feed.1"), _T("Nntpadm.Feed"), IDS_NNTPFEED_DESC, THREADFLAGS_BOTH)
  94. // ISupportsErrorInfo
  95. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  96. // INntpFeed
  97. public:
  98. STDMETHODIMP get_RemoteServer ( BSTR * pstrServerName );
  99. STDMETHODIMP put_RemoteServer ( BSTR strServerName );
  100. STDMETHODIMP get_FeedType ( NNTP_FEED_SERVER_TYPE * pfeedtype );
  101. STDMETHODIMP put_FeedType ( NNTP_FEED_SERVER_TYPE feedtype );
  102. STDMETHODIMP get_HasInbound ( BOOL * pfHasInbound );
  103. STDMETHODIMP get_HasOutbound ( BOOL * pfHasOutbound );
  104. STDMETHODIMP get_InboundFeed ( INntpOneWayFeed ** ppOneWayFeed );
  105. STDMETHODIMP put_InboundFeed ( INntpOneWayFeed * pOneWayFeed );
  106. STDMETHODIMP get_OutboundFeed ( INntpOneWayFeed ** ppOneWayFeed );
  107. STDMETHODIMP put_OutboundFeed ( INntpOneWayFeed * pOneWayFeed );
  108. STDMETHODIMP get_InboundFeedDispatch ( IDispatch ** ppOneWayFeed );
  109. STDMETHODIMP put_InboundFeedDispatch ( IDispatch * pOneWayFeed );
  110. STDMETHODIMP get_OutboundFeedDispatch ( IDispatch ** ppOneWayFeed );
  111. STDMETHODIMP put_OutboundFeedDispatch ( IDispatch * pOneWayFeed );
  112. private:
  113. HRESULT FromFeedPair ( CFeedPair * pFeedPair );
  114. private:
  115. CComBSTR m_strRemoteServer;
  116. NNTP_FEED_SERVER_TYPE m_type;
  117. CComPtr<INntpOneWayFeed> m_pInbound;
  118. CComPtr<INntpOneWayFeed> m_pOutbound;
  119. };
  120. /////////////////////////////////////////////////////////////////////////////
  121. // CNntpAdminFeeds:
  122. class CNntpAdminFeeds :
  123. public INntpAdminFeeds,
  124. public IPrivateUnknown,
  125. public IPrivateDispatch,
  126. public IADsExtension,
  127. public INonDelegatingUnknown,
  128. public ISupportErrorInfo,
  129. public CComObjectRoot,
  130. public CComCoClass<CNntpAdminFeeds,&CLSID_CNntpAdminFeeds>
  131. {
  132. public:
  133. CNntpAdminFeeds();
  134. virtual ~CNntpAdminFeeds ();
  135. BEGIN_COM_MAP(CNntpAdminFeeds)
  136. COM_INTERFACE_ENTRY(IDispatch)
  137. COM_INTERFACE_ENTRY(IADs)
  138. COM_INTERFACE_ENTRY(INntpAdminFeeds)
  139. COM_INTERFACE_ENTRY(IADsExtension)
  140. COM_INTERFACE_ENTRY(IPrivateUnknown)
  141. COM_INTERFACE_ENTRY(IPrivateDispatch)
  142. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  143. END_COM_MAP()
  144. //DECLARE_NOT_AGGREGATABLE(CNntpAdminFeeds)
  145. // Remove the comment from the line above if you don't want your object to
  146. // support aggregation. The default is to support it
  147. DECLARE_REGISTRY(CNntpAdminFeeds, _T("Nntpadm.Feeds.1"), _T("Nntpadm.Feeds"), IDS_NNTPADMINFEEDS_DESC, THREADFLAGS_BOTH)
  148. // ISupportsErrorInfo
  149. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  150. //
  151. // This declares methods for the following:
  152. // IADsExtension
  153. // IUnknown
  154. // IDispatch
  155. // IPrivateUnknown
  156. // IPrivateDispatch
  157. //
  158. #define THIS_LIBID LIBID_NNTPADMLib
  159. #define THIS_IID IID_INntpAdminFeeds
  160. #include "adsimp.inl"
  161. #undef THIS_LIBID
  162. #undef THIS_IID
  163. // INntpAdminFeeds
  164. public:
  165. //
  166. // IADs methods:
  167. //
  168. DECLARE_IADS_METHODS()
  169. // Which service to configure:
  170. STDMETHODIMP get_Server ( BSTR * pstrServer );
  171. STDMETHODIMP put_Server ( BSTR strServer );
  172. STDMETHODIMP get_ServiceInstance ( long * plServiceInstance );
  173. STDMETHODIMP put_ServiceInstance ( long lServiceInstance );
  174. // Enumeration Properties:
  175. STDMETHODIMP get_Count ( long * plCount );
  176. //////////////////////////////////////////////////////////////////////
  177. // Methods:
  178. //////////////////////////////////////////////////////////////////////
  179. STDMETHODIMP Enumerate ( );
  180. STDMETHODIMP Item ( long lIndex, INntpFeed ** ppFeed );
  181. STDMETHODIMP ItemDispatch( long lIndex, IDispatch ** ppFeed );
  182. STDMETHODIMP FindID ( long lID, long * plIndex );
  183. STDMETHODIMP Add ( INntpFeed * pFeed );
  184. STDMETHODIMP AddDispatch ( IDispatch * pFeed );
  185. STDMETHODIMP Set ( long lIndex, INntpFeed * pFeed );
  186. STDMETHODIMP SetDispatch ( long lIndex, IDispatch * pFeed );
  187. STDMETHODIMP Remove ( long lIndex );
  188. //////////////////////////////////////////////////////////////////////
  189. // Data:
  190. //////////////////////////////////////////////////////////////////////
  191. private:
  192. CIADsImpl m_iadsImpl;
  193. BOOL m_fEnumerated;
  194. CFeedPairList m_listFeeds;
  195. //////////////////////////////////////////////////////////////////////
  196. // Private Methods:
  197. //////////////////////////////////////////////////////////////////////
  198. HRESULT ReturnFeedPair ( CFeedPair * pFeedPair, INntpFeed * pFeed );
  199. long IndexFromID ( long dwFeedId );
  200. long FindFeedPair ( long dwFeedId );
  201. };