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.

289 lines
8.0 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. lmosrv.hxx
  7. Class declarations for the SERVER_0, SERVER_1, and SERVER_2 classes.
  8. The SERVER_x classes are used to manipulate servers. The classes
  9. are structured as follows:
  10. LOC_LM_OBJ
  11. SERVER_0
  12. SERVER_1
  13. SERVER_2
  14. FILE HISTORY:
  15. ChuckC 07-Dec-1990 Created.
  16. ChuckC 07-Mar-1991 Code review changes (from 2/28,
  17. RustanL, ChuckC, JohnL, JonShu, AnnMc).
  18. KeithMo 01-May-1991 Added QueryDomainRole to SERVER_2
  19. and SERVER_TYPE.
  20. KevinL 12-Aug-1991 Made SERVER_2 provide SERVER_1 funcs.
  21. TerryK 19-Sep-1991 Change {Get,Write}Info to I_{Get,Write}Info.
  22. TerryK 27-Sep-1991 Add SetComment to the server object.
  23. TerryK 30-Sep-1991 Code review change. Attend: JonN
  24. KeithMo TerryK.
  25. KeithMo 02-Oct-1991 Removed QueryDomainRole methods.
  26. TerryK 07-Oct-1991 Type changes for NT.
  27. TerryK 21-Oct-1991 Type changes for NT.
  28. KeithMo 25-Nov-1991 Completely restructured the classes to
  29. provide proper inheritance.
  30. KeithMo 04-Dec-1991 Code review changes (from 12/04,
  31. Beng, EricCh, KeithMo, TerryK).
  32. BruceFo 26-Sep-1995 Added SERVER_2::SetMaxUsers, GetMaxUsers
  33. */
  34. #ifndef _LMOSRV_HXX_
  35. #define _LMOSRV_HXX_
  36. #include "lmobj.hxx"
  37. /*************************************************************************
  38. NAME: SERVER_0
  39. SYNOPSIS: Info-level 0 server class.
  40. INTERFACE: SERVER_0 - Class constructor.
  41. ~SERVER_0 - Class destructor.
  42. PARENT: LOC_LM_OBJ
  43. HISTORY:
  44. ChuckC 07-Dec-1990 Created.
  45. ChuckC 07-Mar-1991 Code review changes (from 2/28,
  46. RustanL, ChuckC, JohnL, JonShu, AnnMc).
  47. TerryK 19-Sep-1991 Change to NEW_LM_OBJ.
  48. KeithMo 25-Nov-1991 Rearranged class structure.
  49. KeithMo 17-Jul-1992 Added QueryDisplayName().
  50. **************************************************************************/
  51. DLL_CLASS SERVER_0 : public LOC_LM_OBJ
  52. {
  53. protected:
  54. //
  55. // This virtual callback is called by NEW_LM_OBJ to
  56. // invoke any necessary NetXxxGetInfo API.
  57. //
  58. virtual APIERR I_GetInfo( VOID );
  59. public:
  60. //
  61. // Usual constructor/destructor goodies.
  62. //
  63. SERVER_0( const TCHAR * pszName = NULL );
  64. ~SERVER_0( VOID );
  65. //
  66. // Provide access to the server's name.
  67. //
  68. const TCHAR * QueryName( VOID ) const
  69. { return LOC_LM_OBJ :: QueryServer(); }
  70. //
  71. // Provide access to the server's display name.
  72. //
  73. APIERR QueryDisplayName( NLS_STR * pnls ) const
  74. { return LOC_LM_OBJ :: QueryDisplayName( pnls ); }
  75. }; // class SERVER_0
  76. /*************************************************************************
  77. NAME: SERVER_1
  78. SYNOPSIS: Info-level 1 server class.
  79. INTERFACE: SERVER_1 - Class constructor.
  80. ~SERVER_1 - Class destructor.
  81. QueryMajorVer - Returns major version.
  82. QueryMinorVer - Returns minor version.
  83. QueryServerType - Returns server type bit vector.
  84. QueryComment - Returns server comment.
  85. SetComment - Sets the server comment.
  86. PARENT: SERVER_0
  87. USES: NLS_STR
  88. HISTORY:
  89. ChuckC 07-Dec-1990 Created.
  90. ChuckC 07-Mar-1991 Code review changes (from 2/28,
  91. RustanL, ChuckC, JohnL, JonShu, AnnMc).
  92. TerryK 19-Sep-1991 Change to NEW_LM_OBJ.
  93. KeithMo 25-Nov-1991 Rearranged class structure.
  94. **************************************************************************/
  95. DLL_CLASS SERVER_1 : public SERVER_0
  96. {
  97. private:
  98. //
  99. // These data members cache the values retrieved
  100. // from the server_info_1 structure.
  101. //
  102. UINT _nMajorVer;
  103. UINT _nMinorVer;
  104. ULONG _lServerType;
  105. NLS_STR _nlsComment;
  106. //
  107. // This worker function is called to initialize the
  108. // server_info_1 structure before the NetServerSetInfo
  109. // API is invoked.
  110. //
  111. APIERR W_Write( VOID );
  112. protected:
  113. //
  114. // These virtual callbacks are called by NEW_LM_OBJ to
  115. // invoke any necessary NetXxx{Get,Set}Info API.
  116. //
  117. virtual APIERR I_GetInfo( VOID );
  118. virtual APIERR I_WriteInfo( VOID );
  119. //
  120. // These protected methods are used by derived subclasses
  121. // to set the cached server_info_1 values.
  122. //
  123. VOID SetMajorMinorVer( UINT nMajorVer, UINT nMinorVer );
  124. VOID SetServerType( ULONG lServerType );
  125. public:
  126. //
  127. // Usual constructor/destructor goodies.
  128. //
  129. SERVER_1( const TCHAR * pszServerName = NULL );
  130. ~SERVER_1( VOID );
  131. //
  132. // These methods query the cached server_info_1 values.
  133. //
  134. UINT QueryMajorVer( VOID ) const;
  135. UINT QueryMinorVer( VOID ) const;
  136. ULONG QueryServerType( VOID ) const;
  137. const TCHAR * QueryComment( VOID ) const;
  138. //
  139. // This method allows client applications to set the
  140. // target server's comment. This is the only server
  141. // attribute which client apps can change.
  142. //
  143. APIERR SetComment( const TCHAR * pszComment );
  144. }; // class SERVER_1
  145. /*************************************************************************
  146. NAME: SERVER_2
  147. SYNOPSIS: Info-level 2 server class.
  148. INTERFACE: SERVER_2 - Class constructor.
  149. ~SERVER_2 - Class destructor.
  150. QuerySecurity - Returns the security type.
  151. PARENT: SERVER_1
  152. CAVEATS: When running under Win32, the protected I_WriteInfo
  153. method must actually make two separate API calls.
  154. This introduces the possibility that the first API
  155. will succeed, while the second API will fail. How
  156. do we deal with this?
  157. HISTORY:
  158. ChuckC 07-Dec-1990 Created.
  159. ChuckC 07-Mar-1991 Code review changes (from 2/28,
  160. RustanL, ChuckC, JohnL, JonShu, AnnMc).
  161. KeithMo 01-May-1991 Added QueryDomainRole method.
  162. KevinL 12-Aug-1991 Added SERVER_1 functionality.
  163. TerryK 19-Sep-1991 Change to NEW_LM_OBJ.
  164. KeithMo 02-Oct-1991 Removed QueryDomainRole method.
  165. KeithMo 25-Nov-1991 Rearranged class structure.
  166. **************************************************************************/
  167. DLL_CLASS SERVER_2 : public SERVER_1
  168. {
  169. private:
  170. //
  171. // These data members cache the values retrieved
  172. // from the server_info_2 structure.
  173. //
  174. UINT _nSecurity;
  175. UINT _nMaxUsers;
  176. //
  177. // This worker function is called to initialize the
  178. // server_info_2 structure before the NetServerSetInfo
  179. // API is invoked.
  180. //
  181. APIERR W_Write( VOID );
  182. protected:
  183. //
  184. // These virtual callbacks are called by NEW_LM_OBJ to
  185. // invoke any necessary NetXxx{Get,Set}Info API.
  186. //
  187. virtual APIERR I_GetInfo( VOID );
  188. virtual APIERR I_WriteInfo( VOID );
  189. //
  190. // These protected methods are used by derived subclasses
  191. // to set the cached server_info_2 values.
  192. //
  193. VOID SetSecurity( UINT nSecurity );
  194. VOID SetMaxUsers( UINT nMaxUsers );
  195. public:
  196. //
  197. // Usual constructor/destructor goodies.
  198. //
  199. SERVER_2( const TCHAR * pszServerName = NULL );
  200. ~SERVER_2( VOID );
  201. //
  202. // These methods query the cached server_info_2 values.
  203. //
  204. UINT QuerySecurity( VOID ) const;
  205. UINT QueryMaxUsers( VOID ) const;
  206. }; // class SERVER_2
  207. #endif // _LMOSRV_HXX_