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.

292 lines
8.9 KiB

  1. //========================================================================
  2. // Copyright (C) 1997 Microsoft Corporation
  3. //========================================================================
  4. #ifndef _MM_SERVER_H_
  5. #define _MM_SERVER_H_
  6. #include <dhcp.h>
  7. #include "classdefl.h"
  8. typedef struct _M_SERVER {
  9. DWORD Address;
  10. DWORD State;
  11. DWORD Policy;
  12. ARRAY Subnets;
  13. ARRAY MScopes;
  14. ARRAY_LOCATION Loc; // if RoundRobin on, then we need this to keep track
  15. ARRAY SuperScopes;
  16. M_OPTCLASS Options;
  17. M_OPTCLASSDEFLIST OptDefs;
  18. M_CLASSDEFLIST ClassDefs;
  19. LPWSTR Name;
  20. LPWSTR Comment;
  21. ULONG LastUniqId;
  22. } M_SERVER, *PM_SERVER, *LPM_SERVER;
  23. DWORD
  24. MemServerInit(
  25. OUT PM_SERVER *Server,
  26. IN DWORD Address,
  27. IN DWORD State,
  28. IN DWORD Policy,
  29. IN LPWSTR Name,
  30. IN LPWSTR Comment
  31. ) ;
  32. DWORD
  33. MemServerCleanup(
  34. IN OUT PM_SERVER Server
  35. ) ;
  36. DWORD
  37. MemServerGetUAddressInfo(
  38. IN PM_SERVER Server,
  39. IN DWORD Address,
  40. OUT PM_SUBNET *Subnet, // OPTIONAL
  41. OUT PM_RANGE *Range, // OPTIONAL
  42. OUT PM_EXCL *Excl, // OPTIONAL
  43. OUT PM_RESERVATION *Reservation // OPTIONAL
  44. ) ;
  45. DWORD
  46. MemServerGetMAddressInfo(
  47. IN PM_SERVER Server,
  48. IN DWORD Address,
  49. OUT PM_SUBNET *Subnet, // OPTIONAL
  50. OUT PM_RANGE *Range, // OPTIONAL
  51. OUT PM_EXCL *Excl, // OPTIONAL
  52. OUT PM_RESERVATION *Reservation // OPTIONAL
  53. ) ;
  54. DWORD _inline
  55. MemServerGetAddressInfo(
  56. IN PM_SERVER Server,
  57. IN DWORD Address,
  58. OUT PM_SUBNET *Subnet, // OPTIONAL
  59. OUT PM_RANGE *Range, // OPTIONAL
  60. OUT PM_EXCL *Excl, // OPTIONAL
  61. OUT PM_RESERVATION *Reservation // OPTIONAL
  62. ) {
  63. if (CLASSD_HOST_ADDR( Address )) {
  64. return MemServerGetMAddressInfo(
  65. Server,
  66. Address,
  67. Subnet,
  68. Range,
  69. Excl,
  70. Reservation
  71. );
  72. } else {
  73. return MemServerGetUAddressInfo(
  74. Server,
  75. Address,
  76. Subnet,
  77. Range,
  78. Excl,
  79. Reservation
  80. );
  81. }
  82. } // MemServerGetAddressInfo()
  83. DWORD
  84. MemServerAddSubnet(
  85. IN OUT PM_SERVER Server,
  86. IN PM_SUBNET Subnet, // completely created subnet, must not
  87. IN ULONG UniqId // be in Server's list tho'
  88. ) ;
  89. DWORD
  90. MemServerDelSubnet(
  91. IN OUT PM_SERVER Server,
  92. IN DWORD SubnetAddress,
  93. OUT PM_SUBNET *Subnet
  94. ) ;
  95. DWORD
  96. MemServerFindSubnetByName(
  97. IN PM_SERVER Server,
  98. IN LPWSTR Name,
  99. OUT PM_SUBNET *Subnet
  100. ) ;
  101. #define INVALID_SSCOPE_ID 0xFFFFFFFF
  102. #define INVALID_SSCOPE_NAME NULL
  103. DWORD
  104. MemServerFindSScope( // find matching with EITHER scopeid ir sscopename
  105. IN OUT PM_SERVER Server,
  106. IN DWORD SScopeId, // 0xFFFFFFFF == invalid scope id, dont use for search
  107. IN LPWSTR SScopeName, // NULL == invalid scope name
  108. OUT PM_SSCOPE *SScope
  109. ) ;
  110. DWORD
  111. MemServerAddSScope(
  112. IN OUT PM_SERVER Server,
  113. IN PM_SSCOPE SScope
  114. ) ;
  115. DWORD
  116. MemServerDelSScope(
  117. IN OUT PM_SERVER Server,
  118. IN DWORD SScopeId,
  119. OUT PM_SSCOPE *SScope
  120. ) ;
  121. #define INVALID_MSCOPE_ID 0x0
  122. #define INVALID_MSCOPE_NAME NULL
  123. DWORD
  124. MemServerFindMScope( // search either based on ScopeId or ScopeName
  125. IN PM_SERVER Server,
  126. IN DWORD MScopeId, // Multicast scope id, or 0 if this is not the key to search on
  127. IN LPWSTR Name, // Multicast scope name or NULL if this is not the key to search on
  128. OUT PM_MSCOPE *MScope
  129. ) ;
  130. DWORD
  131. MemServerAddMScope(
  132. IN OUT PM_SERVER Server,
  133. IN OUT PM_MSCOPE MScope,
  134. IN ULONG UniqId
  135. ) ;
  136. DWORD
  137. MemServerDelMScope(
  138. IN OUT PM_SERVER Server,
  139. IN DWORD MScopeId,
  140. IN LPWSTR MScopeName,
  141. OUT PM_MSCOPE *MScope
  142. ) ;
  143. DWORD _inline
  144. MemServerGetClassDef( // look up a class id def on Key=ClassId or Key=ClassIdBytes
  145. IN PM_SERVER Server,
  146. IN DWORD ClassId, // OPTIONAL, 0 if not used
  147. IN LPWSTR Name, // OPTIONAL, NULL if not used
  148. IN DWORD nClassIdBytes, // OPTIONAL, 0 if not used
  149. IN LPBYTE ClassIdBytes, // OPTIONAL, NULL if not used
  150. OUT PM_CLASSDEF *ClassDef
  151. ) {
  152. AssertRet(Server && ClassDef && (0 != ClassId || 0 != nClassIdBytes || Name ), ERROR_INVALID_PARAMETER);
  153. AssertRet( 0 == nClassIdBytes || NULL != ClassIdBytes, ERROR_INVALID_PARAMETER);
  154. AssertRet( 0 != nClassIdBytes || NULL == ClassIdBytes, ERROR_INVALID_PARAMETER);
  155. return MemClassDefListFindOptDef(
  156. &Server->ClassDefs,
  157. ClassId,
  158. Name,
  159. ClassIdBytes,
  160. nClassIdBytes,
  161. ClassDef
  162. );
  163. }
  164. DWORD _inline
  165. MemServerAddClassDef(
  166. IN OUT PM_SERVER Server,
  167. IN DWORD ClassId,
  168. IN BOOL IsVendor,
  169. IN LPWSTR Name,
  170. IN LPWSTR Comment,
  171. IN DWORD nClassIdBytes,
  172. IN LPBYTE ClassIdBytes,
  173. IN ULONG UniqId
  174. )
  175. {
  176. AssertRet(Server, ERROR_INVALID_PARAMETER);
  177. return MemClassDefListAddClassDef(
  178. &Server->ClassDefs,
  179. ClassId,
  180. IsVendor,
  181. 0,
  182. Name,
  183. Comment,
  184. ClassIdBytes,
  185. nClassIdBytes,
  186. UniqId
  187. );
  188. } // MemServerAddClassDef()
  189. DWORD _inline
  190. MemServerDelClassDef(
  191. IN OUT PM_SERVER Server,
  192. IN DWORD ClassId,
  193. IN LPWSTR Name,
  194. IN DWORD nClassIdBytes,
  195. IN LPBYTE ClassIdBytes
  196. ) {
  197. AssertRet(Server, ERROR_INVALID_PARAMETER);
  198. return MemClassDefListDelClassDef(
  199. &Server->ClassDefs,
  200. ClassId,
  201. Name,
  202. ClassIdBytes,
  203. nClassIdBytes
  204. );
  205. }
  206. DWORD
  207. MemServerGetOptDef(
  208. IN OUT PM_SERVER Server,
  209. IN DWORD ClassId, // required, strict search, no defaulting class to zero
  210. IN DWORD VendorId, // required, strict search, no defaulting vendor to zero
  211. IN DWORD OptId, // OPTIONAL - search by this or following param
  212. IN LPWSTR OptName, // OPTIONAL - search by name or above param
  213. OUT PM_OPTDEF *OptDef // if found return the opt def here
  214. ) ;
  215. DWORD
  216. MemServerAddOptDef(
  217. IN OUT PM_SERVER Server,
  218. IN DWORD ClassId,
  219. IN DWORD VendorId,
  220. IN DWORD OptId,
  221. IN LPWSTR OptName,
  222. IN LPWSTR OptComment,
  223. IN DWORD Type,
  224. IN LPBYTE OptVal,
  225. IN DWORD OptValLen,
  226. IN ULONG UniqId
  227. ) ;
  228. DWORD
  229. MemServerDelOptDef(
  230. IN OUT PM_SERVER Server,
  231. IN DWORD ClassId,
  232. IN DWORD VendorId,
  233. IN DWORD OptId
  234. ) ;
  235. #endif _MM_SERVER_H_
  236. //========================================================================
  237. // end of file
  238. //========================================================================