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.

172 lines
4.7 KiB

  1. // binding.h : Declaration of the CNntpServerBinding & CNntpServerBindings classes.
  2. //
  3. // Dependencies:
  4. //
  5. class CMultiSz;
  6. //
  7. // A simple binding class:
  8. //
  9. class CBinding
  10. {
  11. public:
  12. CBinding () :
  13. m_dwTcpPort ( 0 ),
  14. m_dwSslPort ( 0 )
  15. { }
  16. CComBSTR m_strIpAddress;
  17. long m_dwTcpPort;
  18. long m_dwSslPort;
  19. HRESULT SetProperties ( BSTR strIpAddress, long dwTcpPort, long dwSslPort );
  20. inline HRESULT SetProperties ( const CBinding & binding )
  21. {
  22. return SetProperties (
  23. binding.m_strIpAddress,
  24. binding.m_dwTcpPort,
  25. binding.m_dwSslPort
  26. );
  27. }
  28. private:
  29. // Don't call this:
  30. const CBinding & operator= ( const CBinding & );
  31. };
  32. /////////////////////////////////////////////////////////////////////////////
  33. // The Binding Object
  34. class CNntpServerBinding :
  35. public CComDualImpl<INntpServerBinding, &IID_INntpServerBinding, &LIBID_NNTPADMLib>,
  36. public ISupportErrorInfo,
  37. public CComObjectRoot
  38. {
  39. friend class CNntpServerBindings;
  40. friend class CNntpVirtualServer;
  41. public:
  42. CNntpServerBinding();
  43. virtual ~CNntpServerBinding ();
  44. BEGIN_COM_MAP(CNntpServerBinding)
  45. COM_INTERFACE_ENTRY(IDispatch)
  46. COM_INTERFACE_ENTRY(INntpServerBinding)
  47. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  48. END_COM_MAP()
  49. //DECLARE_NOT_AGGREGATABLE(CNntpServerBinding)
  50. // Remove the comment from the line above if you don't want your object to
  51. // support aggregation. The default is to support it
  52. // ISupportsErrorInfo
  53. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  54. // INntpServerBinding
  55. public:
  56. //////////////////////////////////////////////////////////////////////
  57. // Properties:
  58. //////////////////////////////////////////////////////////////////////
  59. STDMETHODIMP get_IpAddress ( BSTR * pstrIpAddress );
  60. STDMETHODIMP put_IpAddress ( BSTR strIpAddress );
  61. STDMETHODIMP get_TcpPort ( long * pdwTcpPort );
  62. STDMETHODIMP put_TcpPort ( long dwTcpPort );
  63. STDMETHODIMP get_SslPort ( long * plSslPort );
  64. STDMETHODIMP put_SslPort ( long lSslPort );
  65. //////////////////////////////////////////////////////////////////////
  66. // Data:
  67. //////////////////////////////////////////////////////////////////////
  68. private:
  69. inline HRESULT SetProperties ( const CBinding & binding )
  70. {
  71. return m_binding.SetProperties ( binding );
  72. }
  73. // Property variables:
  74. CBinding m_binding;
  75. };
  76. /////////////////////////////////////////////////////////////////////////////
  77. // The Bindings Object
  78. class CNntpServerBindings :
  79. public CComDualImpl<INntpServerBindings, &IID_INntpServerBindings, &LIBID_NNTPADMLib>,
  80. public ISupportErrorInfo,
  81. public CComObjectRoot
  82. {
  83. friend class CNntpServerBinding;
  84. friend class CNntpVirtualServer;
  85. public:
  86. CNntpServerBindings();
  87. virtual ~CNntpServerBindings ();
  88. BEGIN_COM_MAP(CNntpServerBindings)
  89. COM_INTERFACE_ENTRY(IDispatch)
  90. COM_INTERFACE_ENTRY(INntpServerBindings)
  91. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  92. END_COM_MAP()
  93. //DECLARE_NOT_AGGREGATABLE(CNntpServerBindings)
  94. // Remove the comment from the line above if you don't want your object to
  95. // support aggregation. The default is to support it
  96. // ISupportsErrorInfo
  97. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  98. // INntpServerBindings
  99. public:
  100. //////////////////////////////////////////////////////////////////////
  101. // Properties:
  102. //////////////////////////////////////////////////////////////////////
  103. STDMETHODIMP get_Count ( long * pdwCount );
  104. //////////////////////////////////////////////////////////////////////
  105. // Methods:
  106. //////////////////////////////////////////////////////////////////////
  107. STDMETHODIMP Item ( long index, INntpServerBinding ** ppBinding );
  108. STDMETHODIMP ItemDispatch ( long index, IDispatch ** ppBinding );
  109. STDMETHODIMP Add ( BSTR strIpAddress, long dwTcpPort, long dwSslPort );
  110. STDMETHODIMP ChangeBinding ( long index, INntpServerBinding * pBinding );
  111. STDMETHODIMP ChangeBindingDispatch ( long index, IDispatch * pBinding );
  112. STDMETHODIMP Remove ( long index );
  113. STDMETHODIMP Clear ( );
  114. //////////////////////////////////////////////////////////////////////
  115. // Data:
  116. //////////////////////////////////////////////////////////////////////
  117. private:
  118. // Property variables:
  119. long m_dwCount;
  120. CBinding * m_rgBindings;
  121. };
  122. //////////////////////////////////////////////////////////////////////
  123. //
  124. // Useful routines to go from INntpServerBindings to
  125. // Metabase data types.
  126. //
  127. //////////////////////////////////////////////////////////////////////
  128. HRESULT
  129. MDBindingsToIBindings (
  130. CMultiSz * pmszBindings,
  131. BOOL fTcpBindings,
  132. INntpServerBindings * pBindings
  133. );
  134. HRESULT IBindingsToMDBindings (
  135. INntpServerBindings * pBindings,
  136. BOOL fTcpBindings,
  137. CMultiSz * pmszBindings
  138. );