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.

1714 lines
55 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. dhcpapi.h
  5. Abstract:
  6. This file contains the DHCP APIs proto-type and description. Also
  7. contains the data structures used by the DHCP APIs.
  8. Author:
  9. Madan Appiah (madana) 12-Aug-1993
  10. Environment:
  11. User Mode - Win32 - MIDL
  12. Revision History:
  13. Cheng Yang (t-cheny) 18-Jun-1996 superscope
  14. --*/
  15. #ifndef _DHCPAPI_
  16. #define _DHCPAPI_
  17. #if defined(MIDL_PASS)
  18. #define LPWSTR [string] wchar_t *
  19. #endif
  20. //
  21. // DHCP data structures.
  22. //
  23. #ifndef _DHCP_
  24. //
  25. // the follwing typedef's are defined in dhcp.h also.
  26. //
  27. typedef DWORD DHCP_IP_ADDRESS, *PDHCP_IP_ADDRESS, *LPDHCP_IP_ADDRESS;
  28. typedef DWORD DHCP_OPTION_ID;
  29. typedef struct _DATE_TIME {
  30. DWORD dwLowDateTime;
  31. DWORD dwHighDateTime;
  32. } DATE_TIME, *LPDATE_TIME;
  33. #define DHCP_DATE_TIME_ZERO_HIGH 0
  34. #define DHCP_DATE_TIME_ZERO_LOW 0
  35. #define DHCP_DATE_TIME_INFINIT_HIGH 0x7FFFFFFF
  36. #define DHCP_DATE_TIME_INFINIT_LOW 0xFFFFFFFF
  37. #endif
  38. #ifndef DHCP_ENCODE_SEED
  39. #define DHCP_ENCODE_SEED ((UCHAR)0xA5)
  40. #endif
  41. #ifdef __cplusplus
  42. #define DHCP_CONST const
  43. #else
  44. #define DHCP_CONST
  45. #endif // __cplusplus
  46. #if (_MSC_VER >= 800)
  47. #define DHCP_API_FUNCTION __stdcall
  48. #else
  49. #define DHCP_API_FUNCTION
  50. #endif
  51. //
  52. // RPC security.
  53. //
  54. #define DHCP_SERVER_SECURITY L"DhcpServerApp"
  55. #define DHCP_SERVER_SECURITY_AUTH_ID 10
  56. #define DHCP_NAMED_PIPE L"\\PIPE\\DHCPSERVER"
  57. #define DHCP_SERVER_BIND_PORT L""
  58. #define DHCP_LPC_EP L"DHCPSERVERLPC"
  59. #define DHCP_SERVER_USE_RPC_OVER_TCPIP 0x1
  60. #define DHCP_SERVER_USE_RPC_OVER_NP 0x2
  61. #define DHCP_SERVER_USE_RPC_OVER_LPC 0x4
  62. #define DHCP_SERVER_USE_RPC_OVER_ALL (\
  63. DHCP_SERVER_USE_RPC_OVER_TCPIP | \
  64. DHCP_SERVER_USE_RPC_OVER_NP | \
  65. DHCP_SERVER_USE_RPC_OVER_LPC)
  66. #ifndef HARDWARE_TYPE_10MB_EITHERNET
  67. #define HARDWARE_TYPE_10MB_EITHERNET (1)
  68. #endif
  69. #define DHCP_RAS_CLASS_TXT "RRAS.Microsoft"
  70. #define DHCP_BOOTP_CLASS_TXT "BOOTP.Microsoft"
  71. #define DHCP_MSFT50_CLASS_TXT "MSFT 5.0"
  72. #define DHCP_MSFT98_CLASS_TXT "MSFT 98"
  73. #define DHCP_MSFT_CLASS_TXT "MSFT"
  74. typedef DWORD DHCP_IP_MASK;
  75. typedef DWORD DHCP_RESUME_HANDLE;
  76. typedef struct _DHCP_IP_RANGE {
  77. DHCP_IP_ADDRESS StartAddress;
  78. DHCP_IP_ADDRESS EndAddress;
  79. } DHCP_IP_RANGE, *LPDHCP_IP_RANGE;
  80. typedef struct _DHCP_BINARY_DATA {
  81. DWORD DataLength;
  82. #if defined(MIDL_PASS)
  83. [size_is(DataLength)]
  84. #endif // MIDL_PASS
  85. BYTE *Data;
  86. } DHCP_BINARY_DATA, *LPDHCP_BINARY_DATA;
  87. typedef DHCP_BINARY_DATA DHCP_CLIENT_UID;
  88. typedef struct _DHCP_HOST_INFO {
  89. DHCP_IP_ADDRESS IpAddress; // minimum information always available
  90. LPWSTR NetBiosName; // optional information
  91. LPWSTR HostName; // optional information
  92. } DHCP_HOST_INFO, *LPDHCP_HOST_INFO;
  93. //
  94. // Flag type that is used to delete DHCP objects.
  95. //
  96. typedef enum _DHCP_FORCE_FLAG {
  97. DhcpFullForce,
  98. DhcpNoForce
  99. } DHCP_FORCE_FLAG, *LPDHCP_FORCE_FLAG;
  100. //
  101. // DWORD_DWORD - subtitute for LARGE_INTEGER
  102. //
  103. typedef struct _DWORD_DWORD {
  104. DWORD DWord1;
  105. DWORD DWord2;
  106. } DWORD_DWORD, *LPDWORD_DWORD;
  107. //
  108. // Subnet State.
  109. //
  110. // Currently a Subnet scope can be Enabled or Disabled.
  111. //
  112. // If the state is Enabled State,
  113. // The server distributes address to the client, extends leases and
  114. // accepts releases.
  115. //
  116. // If the state is Disabled State,
  117. // The server does not distribute address to any new client, and does
  118. // extent (and sends NACK) old leases, but the servers accepts lease
  119. // releases.
  120. //
  121. // The idea behind this subnet state is, when the admin wants to stop
  122. // serving a subnet, he moves the state from Enbaled to Disabled so
  123. // that the clients from the subnets smoothly move to another servers
  124. // serving that subnet. When all or most of the clients move to
  125. // another server, the admin can delete the subnet without any force
  126. // if no client left in that subnet, otherwise the admin should use
  127. // full force to delete the subnet.
  128. //
  129. typedef enum _DHCP_SUBNET_STATE {
  130. DhcpSubnetEnabled = 0,
  131. DhcpSubnetDisabled,
  132. DhcpSubnetEnabledSwitched,
  133. DhcpSubnetDisabledSwitched,
  134. DhcpSubnetInvalidState
  135. } DHCP_SUBNET_STATE, *LPDHCP_SUBNET_STATE;
  136. //
  137. // Subnet related data structures.
  138. //
  139. typedef struct _DHCP_SUBNET_INFO {
  140. DHCP_IP_ADDRESS SubnetAddress;
  141. DHCP_IP_MASK SubnetMask;
  142. LPWSTR SubnetName;
  143. LPWSTR SubnetComment;
  144. DHCP_HOST_INFO PrimaryHost;
  145. DHCP_SUBNET_STATE SubnetState;
  146. } DHCP_SUBNET_INFO, *LPDHCP_SUBNET_INFO;
  147. typedef struct _DHCP_IP_ARRAY {
  148. DWORD NumElements;
  149. #if defined(MIDL_PASS)
  150. [size_is(NumElements)]
  151. #endif // MIDL_PASS
  152. LPDHCP_IP_ADDRESS Elements; //array
  153. } DHCP_IP_ARRAY, *LPDHCP_IP_ARRAY;
  154. typedef struct _DHCP_IP_CLUSTER {
  155. DHCP_IP_ADDRESS ClusterAddress; // First IP address of the cluster.
  156. DWORD ClusterMask; // Cluster usage mask, 0xFFFFFFFF
  157. // indicates the cluster is fully used.
  158. } DHCP_IP_CLUSTER, *LPDHCP_IP_CLUSTER;
  159. typedef struct _DHCP_IP_RESERVATION {
  160. DHCP_IP_ADDRESS ReservedIpAddress;
  161. DHCP_CLIENT_UID *ReservedForClient;
  162. } DHCP_IP_RESERVATION, *LPDHCP_IP_RESERVATION;
  163. typedef enum _DHCP_SUBNET_ELEMENT_TYPE_V5 {
  164. //
  165. // If you don't care about what you wan't to get..
  166. // NB: These six lines should not be changed!
  167. //
  168. DhcpIpRanges,
  169. DhcpSecondaryHosts,
  170. DhcpReservedIps,
  171. DhcpExcludedIpRanges,
  172. DhcpIpUsedClusters, // read only
  173. //
  174. // These are for IP ranges for DHCP ONLY
  175. //
  176. DhcpIpRangesDhcpOnly,
  177. //
  178. // These are ranges that are BOTH DHCP & Dynamic BOOTP
  179. //
  180. DhcpIpRangesDhcpBootp,
  181. //
  182. // These are ranges that are ONLY BOOTP
  183. //
  184. DhcpIpRangesBootpOnly,
  185. } DHCP_SUBNET_ELEMENT_TYPE, *LPDHCP_SUBNET_ELEMENT_TYPE;
  186. #define ELEMENT_MASK(E) ((((E) <= DhcpIpRangesBootpOnly) && (DhcpIpRangesDhcpOnly <= (E)))?(0):(E))
  187. typedef struct _DHCP_SUBNET_ELEMENT_DATA {
  188. DHCP_SUBNET_ELEMENT_TYPE ElementType;
  189. #if defined(MIDL_PASS)
  190. [switch_is(ELEMENT_MASK(ElementType)), switch_type(DHCP_SUBNET_ELEMENT_TYPE)]
  191. union _DHCP_SUBNET_ELEMENT_UNION {
  192. [case(DhcpIpRanges)] DHCP_IP_RANGE *IpRange;
  193. [case(DhcpSecondaryHosts)] DHCP_HOST_INFO *SecondaryHost;
  194. [case(DhcpReservedIps)] DHCP_IP_RESERVATION *ReservedIp;
  195. [case(DhcpExcludedIpRanges)] DHCP_IP_RANGE *ExcludeIpRange;
  196. [case(DhcpIpUsedClusters)] DHCP_IP_CLUSTER *IpUsedCluster;
  197. [default] ;
  198. } Element;
  199. #else
  200. union _DHCP_SUBNET_ELEMENT_UNION {
  201. DHCP_IP_RANGE *IpRange;
  202. DHCP_HOST_INFO *SecondaryHost;
  203. DHCP_IP_RESERVATION *ReservedIp;
  204. DHCP_IP_RANGE *ExcludeIpRange;
  205. DHCP_IP_CLUSTER *IpUsedCluster;
  206. } Element;
  207. #endif // MIDL_PASS
  208. } DHCP_SUBNET_ELEMENT_DATA, *LPDHCP_SUBNET_ELEMENT_DATA;
  209. #if !defined(MIDL_PASS)
  210. typedef union _DHCP_SUBNET_ELEMENT_UNION
  211. DHCP_SUBNET_ELEMENT_UNION, *LPDHCP_SUBNET_ELEMENT_UNION;
  212. #endif
  213. typedef struct _DHCP_SUBNET_ELEMENT_INFO_ARRAY {
  214. DWORD NumElements;
  215. #if defined(MIDL_PASS)
  216. [size_is(NumElements)]
  217. #endif // MIDL_PASS
  218. LPDHCP_SUBNET_ELEMENT_DATA Elements; //array
  219. } DHCP_SUBNET_ELEMENT_INFO_ARRAY, *LPDHCP_SUBNET_ELEMENT_INFO_ARRAY;
  220. //
  221. // DHCP Options related data structures.
  222. //
  223. typedef enum _DHCP_OPTION_DATA_TYPE {
  224. DhcpByteOption,
  225. DhcpWordOption,
  226. DhcpDWordOption,
  227. DhcpDWordDWordOption,
  228. DhcpIpAddressOption,
  229. DhcpStringDataOption,
  230. DhcpBinaryDataOption,
  231. DhcpEncapsulatedDataOption
  232. } DHCP_OPTION_DATA_TYPE, *LPDHCP_OPTION_DATA_TYPE;
  233. typedef struct _DHCP_OPTION_DATA_ELEMENT {
  234. DHCP_OPTION_DATA_TYPE OptionType;
  235. #if defined(MIDL_PASS)
  236. [switch_is(OptionType), switch_type(DHCP_OPTION_DATA_TYPE)]
  237. union _DHCP_OPTION_ELEMENT_UNION {
  238. [case(DhcpByteOption)] BYTE ByteOption;
  239. [case(DhcpWordOption)] WORD WordOption;
  240. [case(DhcpDWordOption)] DWORD DWordOption;
  241. [case(DhcpDWordDWordOption)] DWORD_DWORD DWordDWordOption;
  242. [case(DhcpIpAddressOption)] DHCP_IP_ADDRESS IpAddressOption;
  243. [case(DhcpStringDataOption)] LPWSTR StringDataOption;
  244. [case(DhcpBinaryDataOption)] DHCP_BINARY_DATA BinaryDataOption;
  245. [case(DhcpEncapsulatedDataOption)] DHCP_BINARY_DATA EncapsulatedDataOption;
  246. [default] ;
  247. } Element;
  248. #else
  249. union _DHCP_OPTION_ELEMENT_UNION {
  250. BYTE ByteOption;
  251. WORD WordOption;
  252. DWORD DWordOption;
  253. DWORD_DWORD DWordDWordOption;
  254. DHCP_IP_ADDRESS IpAddressOption;
  255. LPWSTR StringDataOption;
  256. DHCP_BINARY_DATA BinaryDataOption;
  257. DHCP_BINARY_DATA EncapsulatedDataOption;
  258. // for vendor specific information option.
  259. } Element;
  260. #endif // MIDL_PASS
  261. } DHCP_OPTION_DATA_ELEMENT, *LPDHCP_OPTION_DATA_ELEMENT;
  262. #if !defined(MIDL_PASS)
  263. typedef union _DHCP_OPTION_ELEMENT_UNION
  264. DHCP_OPTION_ELEMENT_UNION, *LPDHCP_OPTION_ELEMENT_UNION;
  265. #endif
  266. typedef struct _DHCP_OPTION_DATA {
  267. DWORD NumElements; // number of option elements in the pointed array
  268. #if defined(MIDL_PASS)
  269. [size_is(NumElements)]
  270. #endif // MIDL_PASS
  271. LPDHCP_OPTION_DATA_ELEMENT Elements; //array
  272. } DHCP_OPTION_DATA, *LPDHCP_OPTION_DATA;
  273. typedef enum _DHCP_OPTION_TYPE {
  274. DhcpUnaryElementTypeOption,
  275. DhcpArrayTypeOption
  276. } DHCP_OPTION_TYPE, *LPDHCP_OPTION_TYPE;
  277. typedef struct _DHCP_OPTION {
  278. DHCP_OPTION_ID OptionID;
  279. LPWSTR OptionName;
  280. LPWSTR OptionComment;
  281. DHCP_OPTION_DATA DefaultValue;
  282. DHCP_OPTION_TYPE OptionType;
  283. } DHCP_OPTION, *LPDHCP_OPTION;
  284. typedef struct _DHCP_OPTION_ARRAY {
  285. DWORD NumElements; // number of options in the pointed array
  286. #if defined(MIDL_PASS)
  287. [size_is(NumElements)]
  288. #endif // MIDL_PASS
  289. LPDHCP_OPTION Options; // array
  290. } DHCP_OPTION_ARRAY, *LPDHCP_OPTION_ARRAY;
  291. typedef struct _DHCP_OPTION_VALUE {
  292. DHCP_OPTION_ID OptionID;
  293. DHCP_OPTION_DATA Value;
  294. } DHCP_OPTION_VALUE, *LPDHCP_OPTION_VALUE;
  295. typedef struct _DHCP_OPTION_VALUE_ARRAY {
  296. DWORD NumElements; // number of options in the pointed array
  297. #if defined(MIDL_PASS)
  298. [size_is(NumElements)]
  299. #endif // MIDL_PASS
  300. LPDHCP_OPTION_VALUE Values; // array
  301. } DHCP_OPTION_VALUE_ARRAY, *LPDHCP_OPTION_VALUE_ARRAY;
  302. typedef enum _DHCP_OPTION_SCOPE_TYPE {
  303. DhcpDefaultOptions,
  304. DhcpGlobalOptions,
  305. DhcpSubnetOptions,
  306. DhcpReservedOptions,
  307. DhcpMScopeOptions
  308. } DHCP_OPTION_SCOPE_TYPE, *LPDHCP_OPTION_SCOPE_TYPE;
  309. typedef struct _DHCP_RESERVED_SCOPE {
  310. DHCP_IP_ADDRESS ReservedIpAddress;
  311. DHCP_IP_ADDRESS ReservedIpSubnetAddress;
  312. } DHCP_RESERVED_SCOPE, *LPDHCP_RESERVED_SCOPE;
  313. typedef struct _DHCP_OPTION_SCOPE_INFO {
  314. DHCP_OPTION_SCOPE_TYPE ScopeType;
  315. #if defined(MIDL_PASS)
  316. [switch_is(ScopeType), switch_type(DHCP_OPTION_SCOPE_TYPE)]
  317. union _DHCP_OPTION_SCOPE_UNION {
  318. [case(DhcpDefaultOptions)] ; // PVOID DefaultScopeInfo;
  319. [case(DhcpGlobalOptions)] ; // PVOID GlobalScopeInfo;
  320. [case(DhcpSubnetOptions)] DHCP_IP_ADDRESS SubnetScopeInfo;
  321. [case(DhcpReservedOptions)] DHCP_RESERVED_SCOPE ReservedScopeInfo;
  322. [case(DhcpMScopeOptions)] LPWSTR MScopeInfo;
  323. [default] ;
  324. } ScopeInfo;
  325. #else
  326. union _DHCP_OPTION_SCOPE_UNION {
  327. PVOID DefaultScopeInfo; // must be NULL
  328. PVOID GlobalScopeInfo; // must be NULL
  329. DHCP_IP_ADDRESS SubnetScopeInfo;
  330. DHCP_RESERVED_SCOPE ReservedScopeInfo;
  331. LPWSTR MScopeInfo;
  332. } ScopeInfo;
  333. #endif // MIDL_PASS
  334. } DHCP_OPTION_SCOPE_INFO, *LPDHCP_OPTION_SCOPE_INFO;
  335. #if !defined(MIDL_PASS)
  336. typedef union _DHCP_OPTION_SCOPE_UNION
  337. DHCP_OPTION_SCOPE_UNION, *LPDHCP_OPTION_SCOPE_UNION;
  338. #endif
  339. typedef struct _DHCP_OPTION_LIST {
  340. DWORD NumOptions;
  341. #if defined(MIDL_PASS)
  342. [size_is(NumOptions)]
  343. #endif // MIDL_PASS
  344. DHCP_OPTION_VALUE *Options; // array
  345. } DHCP_OPTION_LIST, *LPDHCP_OPTION_LIST;
  346. //
  347. // DHCP Client information data structures
  348. //
  349. typedef struct _DHCP_CLIENT_INFO {
  350. DHCP_IP_ADDRESS ClientIpAddress; // currently assigned IP address.
  351. DHCP_IP_MASK SubnetMask;
  352. DHCP_CLIENT_UID ClientHardwareAddress;
  353. LPWSTR ClientName; // optional.
  354. LPWSTR ClientComment;
  355. DATE_TIME ClientLeaseExpires; // UTC time in FILE_TIME format.
  356. DHCP_HOST_INFO OwnerHost; // host that distributed this IP address.
  357. } DHCP_CLIENT_INFO, *LPDHCP_CLIENT_INFO;
  358. typedef struct _DHCP_CLIENT_INFO_ARRAY {
  359. DWORD NumElements;
  360. #if defined(MIDL_PASS)
  361. [size_is(NumElements)]
  362. #endif // MIDL_PASS
  363. LPDHCP_CLIENT_INFO *Clients; // array of pointers
  364. } DHCP_CLIENT_INFO_ARRAY, *LPDHCP_CLIENT_INFO_ARRAY;
  365. typedef enum _DHCP_CLIENT_SEARCH_TYPE {
  366. DhcpClientIpAddress,
  367. DhcpClientHardwareAddress,
  368. DhcpClientName
  369. } DHCP_SEARCH_INFO_TYPE, *LPDHCP_SEARCH_INFO_TYPE;
  370. typedef struct _DHCP_CLIENT_SEARCH_INFO {
  371. DHCP_SEARCH_INFO_TYPE SearchType;
  372. #if defined(MIDL_PASS)
  373. [switch_is(SearchType), switch_type(DHCP_SEARCH_INFO_TYPE)]
  374. union _DHCP_CLIENT_SEARCH_UNION {
  375. [case(DhcpClientIpAddress)] DHCP_IP_ADDRESS ClientIpAddress;
  376. [case(DhcpClientHardwareAddress)] DHCP_CLIENT_UID ClientHardwareAddress;
  377. [case(DhcpClientName)] LPWSTR ClientName;
  378. [default] ;
  379. } SearchInfo;
  380. #else
  381. union _DHCP_CLIENT_SEARCH_UNION {
  382. DHCP_IP_ADDRESS ClientIpAddress;
  383. DHCP_CLIENT_UID ClientHardwareAddress;
  384. LPWSTR ClientName;
  385. } SearchInfo;
  386. #endif // MIDL_PASS
  387. } DHCP_SEARCH_INFO, *LPDHCP_SEARCH_INFO;
  388. #if !defined(MIDL_PASS)
  389. typedef union _DHCP_CLIENT_SEARCH_UNION
  390. DHCP_CLIENT_SEARCH_UNION, *LPDHCP_CLIENT_SEARCH_UNION;
  391. #endif // MIDL_PASS
  392. //
  393. // Mib Info structures.
  394. //
  395. typedef struct _SCOPE_MIB_INFO {
  396. DHCP_IP_ADDRESS Subnet;
  397. DWORD NumAddressesInuse;
  398. DWORD NumAddressesFree;
  399. DWORD NumPendingOffers;
  400. } SCOPE_MIB_INFO, *LPSCOPE_MIB_INFO;
  401. typedef struct _DHCP_MIB_INFO {
  402. DWORD Discovers;
  403. DWORD Offers;
  404. DWORD Requests;
  405. DWORD Acks;
  406. DWORD Naks;
  407. DWORD Declines;
  408. DWORD Releases;
  409. DATE_TIME ServerStartTime;
  410. DWORD Scopes;
  411. #if defined(MIDL_PASS)
  412. [size_is(Scopes)]
  413. #endif // MIDL_PASS
  414. LPSCOPE_MIB_INFO ScopeInfo; // array.
  415. } DHCP_MIB_INFO, *LPDHCP_MIB_INFO;
  416. #define Set_APIProtocolSupport 0x00000001
  417. #define Set_DatabaseName 0x00000002
  418. #define Set_DatabasePath 0x00000004
  419. #define Set_BackupPath 0x00000008
  420. #define Set_BackupInterval 0x00000010
  421. #define Set_DatabaseLoggingFlag 0x00000020
  422. #define Set_RestoreFlag 0x00000040
  423. #define Set_DatabaseCleanupInterval 0x00000080
  424. #define Set_DebugFlag 0x00000100
  425. #define Set_PingRetries 0x00000200
  426. #define Set_BootFileTable 0x00000400
  427. #define Set_AuditLogState 0x00000800
  428. typedef struct _DHCP_SERVER_CONFIG_INFO {
  429. DWORD APIProtocolSupport; // bit map of the protocols supported.
  430. LPWSTR DatabaseName; // JET database name.
  431. LPWSTR DatabasePath; // JET database path.
  432. LPWSTR BackupPath; // Backup path.
  433. DWORD BackupInterval; // Backup interval in mins.
  434. DWORD DatabaseLoggingFlag; // Boolean database logging flag.
  435. DWORD RestoreFlag; // Boolean database restore flag.
  436. DWORD DatabaseCleanupInterval; // Database Cleanup Interval in mins.
  437. DWORD DebugFlag; // Bit map of server debug flags.
  438. } DHCP_SERVER_CONFIG_INFO, *LPDHCP_SERVER_CONFIG_INFO;
  439. typedef enum _DHCP_SCAN_FLAG {
  440. DhcpRegistryFix,
  441. DhcpDatabaseFix
  442. } DHCP_SCAN_FLAG, *LPDHCP_SCAN_FLAG;
  443. typedef struct _DHCP_SCAN_ITEM {
  444. DHCP_IP_ADDRESS IpAddress;
  445. DHCP_SCAN_FLAG ScanFlag;
  446. } DHCP_SCAN_ITEM, *LPDHCP_SCAN_ITEM;
  447. typedef struct _DHCP_SCAN_LIST {
  448. DWORD NumScanItems;
  449. #if defined(MIDL_PASS)
  450. [size_is(NumScanItems)]
  451. #endif // MIDL_PASS
  452. DHCP_SCAN_ITEM *ScanItems; // array
  453. } DHCP_SCAN_LIST, *LPDHCP_SCAN_LIST;
  454. typedef struct _DHCP_CLASS_INFO {
  455. LPWSTR ClassName;
  456. LPWSTR ClassComment;
  457. DWORD ClassDataLength;
  458. BOOL IsVendor;
  459. DWORD Flags;
  460. #if defined(MIDL_PASS)
  461. [size_is(ClassDataLength)]
  462. #endif // MIDL_PASS
  463. LPBYTE ClassData;
  464. } DHCP_CLASS_INFO, *LPDHCP_CLASS_INFO;
  465. typedef struct _DHCP_CLASS_INFO_ARRAY {
  466. DWORD NumElements;
  467. #if defined(MIDL_PASS)
  468. [size_is(NumElements)]
  469. #endif //MIDL_PASS
  470. LPDHCP_CLASS_INFO Classes;
  471. } DHCP_CLASS_INFO_ARRAY, *LPDHCP_CLASS_INFO_ARRAY;
  472. //
  473. // API proto types
  474. //
  475. //
  476. // Subnet APIs
  477. //
  478. #ifndef DHCPAPI_NO_PROTOTYPES
  479. DWORD DHCP_API_FUNCTION
  480. DhcpCreateSubnet(
  481. DHCP_CONST WCHAR *ServerIpAddress,
  482. DHCP_IP_ADDRESS SubnetAddress,
  483. DHCP_CONST DHCP_SUBNET_INFO * SubnetInfo
  484. );
  485. DWORD DHCP_API_FUNCTION
  486. DhcpSetSubnetInfo(
  487. DHCP_CONST WCHAR *ServerIpAddress,
  488. DHCP_IP_ADDRESS SubnetAddress,
  489. DHCP_CONST DHCP_SUBNET_INFO * SubnetInfo
  490. );
  491. DWORD DHCP_API_FUNCTION
  492. DhcpGetSubnetInfo(
  493. DHCP_CONST WCHAR *ServerIpAddress,
  494. DHCP_IP_ADDRESS SubnetAddress,
  495. LPDHCP_SUBNET_INFO * SubnetInfo
  496. );
  497. DWORD DHCP_API_FUNCTION
  498. DhcpEnumSubnets(
  499. DHCP_CONST WCHAR *ServerIpAddress,
  500. DHCP_RESUME_HANDLE *ResumeHandle,
  501. DWORD PreferredMaximum,
  502. LPDHCP_IP_ARRAY *EnumInfo,
  503. DWORD *ElementsRead,
  504. DWORD *ElementsTotal
  505. );
  506. DWORD DHCP_API_FUNCTION
  507. DhcpAddSubnetElement(
  508. DHCP_CONST WCHAR *ServerIpAddress,
  509. DHCP_IP_ADDRESS SubnetAddress,
  510. DHCP_CONST DHCP_SUBNET_ELEMENT_DATA * AddElementInfo
  511. );
  512. DWORD DHCP_API_FUNCTION
  513. DhcpEnumSubnetElements(
  514. DHCP_CONST WCHAR *ServerIpAddress,
  515. DHCP_IP_ADDRESS SubnetAddress,
  516. DHCP_SUBNET_ELEMENT_TYPE EnumElementType,
  517. DHCP_RESUME_HANDLE *ResumeHandle,
  518. DWORD PreferredMaximum,
  519. LPDHCP_SUBNET_ELEMENT_INFO_ARRAY *EnumElementInfo,
  520. DWORD *ElementsRead,
  521. DWORD *ElementsTotal
  522. );
  523. DWORD DHCP_API_FUNCTION
  524. DhcpRemoveSubnetElement(
  525. DHCP_CONST WCHAR *ServerIpAddress,
  526. DHCP_IP_ADDRESS SubnetAddress,
  527. DHCP_CONST DHCP_SUBNET_ELEMENT_DATA * RemoveElementInfo,
  528. DHCP_FORCE_FLAG ForceFlag
  529. );
  530. DWORD DHCP_API_FUNCTION
  531. DhcpDeleteSubnet(
  532. DHCP_CONST WCHAR *ServerIpAddress,
  533. DHCP_IP_ADDRESS SubnetAddress,
  534. DHCP_FORCE_FLAG ForceFlag
  535. );
  536. //
  537. // Option APIs
  538. //
  539. DWORD DHCP_API_FUNCTION
  540. DhcpCreateOption(
  541. DHCP_CONST WCHAR *ServerIpAddress,
  542. DHCP_OPTION_ID OptionID,
  543. DHCP_CONST DHCP_OPTION * OptionInfo
  544. );
  545. DWORD DHCP_API_FUNCTION
  546. DhcpSetOptionInfo(
  547. DHCP_CONST WCHAR *ServerIpAddress,
  548. DHCP_OPTION_ID OptionID,
  549. DHCP_CONST DHCP_OPTION * OptionInfo
  550. );
  551. DWORD DHCP_API_FUNCTION
  552. DhcpGetOptionInfo(
  553. DHCP_CONST WCHAR *ServerIpAddress,
  554. DHCP_OPTION_ID OptionID,
  555. LPDHCP_OPTION *OptionInfo
  556. );
  557. DWORD DHCP_API_FUNCTION
  558. DhcpEnumOptions(
  559. DHCP_CONST WCHAR *ServerIpAddress,
  560. DHCP_RESUME_HANDLE *ResumeHandle,
  561. DWORD PreferredMaximum,
  562. LPDHCP_OPTION_ARRAY *Options,
  563. DWORD *OptionsRead,
  564. DWORD *OptionsTotal
  565. );
  566. DWORD DHCP_API_FUNCTION
  567. DhcpRemoveOption(
  568. DHCP_CONST WCHAR *ServerIpAddress,
  569. DHCP_OPTION_ID OptionID
  570. );
  571. DWORD DHCP_API_FUNCTION
  572. DhcpSetOptionValue(
  573. DHCP_CONST WCHAR *ServerIpAddress,
  574. DHCP_OPTION_ID OptionID,
  575. DHCP_CONST DHCP_OPTION_SCOPE_INFO * ScopeInfo,
  576. DHCP_CONST DHCP_OPTION_DATA * OptionValue
  577. );
  578. DWORD DHCP_API_FUNCTION
  579. DhcpSetOptionValues(
  580. DHCP_CONST WCHAR *ServerIpAddress,
  581. DHCP_CONST DHCP_OPTION_SCOPE_INFO * ScopeInfo,
  582. DHCP_CONST DHCP_OPTION_VALUE_ARRAY * OptionValues
  583. );
  584. DWORD DHCP_API_FUNCTION
  585. DhcpGetOptionValue(
  586. DHCP_CONST WCHAR *ServerIpAddress,
  587. DHCP_OPTION_ID OptionID,
  588. DHCP_CONST DHCP_OPTION_SCOPE_INFO *ScopeInfo,
  589. LPDHCP_OPTION_VALUE *OptionValue
  590. );
  591. DWORD DHCP_API_FUNCTION
  592. DhcpEnumOptionValues(
  593. DHCP_CONST WCHAR *ServerIpAddress,
  594. DHCP_CONST DHCP_OPTION_SCOPE_INFO *ScopeInfo,
  595. DHCP_RESUME_HANDLE *ResumeHandle,
  596. DWORD PreferredMaximum,
  597. LPDHCP_OPTION_VALUE_ARRAY *OptionValues,
  598. DWORD *OptionsRead,
  599. DWORD *OptionsTotal
  600. );
  601. DWORD DHCP_API_FUNCTION
  602. DhcpRemoveOptionValue(
  603. DHCP_CONST WCHAR *ServerIpAddress,
  604. DHCP_OPTION_ID OptionID,
  605. DHCP_CONST DHCP_OPTION_SCOPE_INFO * ScopeInfo
  606. );
  607. //
  608. // Client APIs
  609. //
  610. DWORD DHCP_API_FUNCTION
  611. DhcpCreateClientInfo(
  612. DHCP_CONST WCHAR *ServerIpAddress,
  613. DHCP_CONST DHCP_CLIENT_INFO *ClientInfo
  614. );
  615. DWORD DHCP_API_FUNCTION
  616. DhcpSetClientInfo(
  617. DHCP_CONST WCHAR *ServerIpAddress,
  618. DHCP_CONST DHCP_CLIENT_INFO *ClientInfo
  619. );
  620. DWORD DHCP_API_FUNCTION
  621. DhcpGetClientInfo(
  622. DHCP_CONST WCHAR *ServerIpAddress,
  623. DHCP_CONST DHCP_SEARCH_INFO *SearchInfo,
  624. LPDHCP_CLIENT_INFO *ClientInfo
  625. );
  626. DWORD DHCP_API_FUNCTION
  627. DhcpDeleteClientInfo(
  628. DHCP_CONST WCHAR *ServerIpAddress,
  629. DHCP_CONST DHCP_SEARCH_INFO *ClientInfo
  630. );
  631. DWORD DHCP_API_FUNCTION
  632. DhcpEnumSubnetClients(
  633. DHCP_CONST WCHAR *ServerIpAddress,
  634. DHCP_IP_ADDRESS SubnetAddress,
  635. DHCP_RESUME_HANDLE *ResumeHandle,
  636. DWORD PreferredMaximum,
  637. LPDHCP_CLIENT_INFO_ARRAY *ClientInfo,
  638. DWORD *ClientsRead,
  639. DWORD *ClientsTotal
  640. );
  641. DWORD DHCP_API_FUNCTION
  642. DhcpGetClientOptions(
  643. DHCP_CONST WCHAR *ServerIpAddress,
  644. DHCP_IP_ADDRESS ClientIpAddress,
  645. DHCP_IP_MASK ClientSubnetMask,
  646. LPDHCP_OPTION_LIST *ClientOptions
  647. );
  648. DWORD DHCP_API_FUNCTION
  649. DhcpGetMibInfo(
  650. DHCP_CONST WCHAR *ServerIpAddress,
  651. LPDHCP_MIB_INFO *MibInfo
  652. );
  653. DWORD DHCP_API_FUNCTION
  654. DhcpServerSetConfig(
  655. DHCP_CONST WCHAR *ServerIpAddress,
  656. DWORD FieldsToSet,
  657. LPDHCP_SERVER_CONFIG_INFO ConfigInfo
  658. );
  659. DWORD DHCP_API_FUNCTION
  660. DhcpServerGetConfig(
  661. DHCP_CONST WCHAR *ServerIpAddress,
  662. LPDHCP_SERVER_CONFIG_INFO *ConfigInfo
  663. );
  664. DWORD DHCP_API_FUNCTION
  665. DhcpScanDatabase(
  666. DHCP_CONST WCHAR *ServerIpAddress,
  667. DHCP_IP_ADDRESS SubnetAddress,
  668. DWORD FixFlag,
  669. LPDHCP_SCAN_LIST *ScanList
  670. );
  671. VOID DHCP_API_FUNCTION
  672. DhcpRpcFreeMemory(
  673. PVOID BufferPointer
  674. );
  675. DWORD DHCP_API_FUNCTION
  676. DhcpGetVersion(
  677. LPWSTR ServerIpAddress,
  678. LPDWORD MajorVersion,
  679. LPDWORD MinorVersion
  680. );
  681. #endif DHCPAPI_NO_PROTOTYPES
  682. //
  683. // new structures for NT4SP1
  684. //
  685. typedef struct _DHCP_IP_RESERVATION_V4 {
  686. DHCP_IP_ADDRESS ReservedIpAddress;
  687. DHCP_CLIENT_UID *ReservedForClient;
  688. BYTE bAllowedClientTypes;
  689. } DHCP_IP_RESERVATION_V4, *LPDHCP_IP_RESERVATION_V4;
  690. typedef struct _DHCP_SUBNET_ELEMENT_DATA_V4 {
  691. DHCP_SUBNET_ELEMENT_TYPE ElementType;
  692. #if defined(MIDL_PASS)
  693. [switch_is(ELEMENT_MASK(ElementType)), switch_type(DHCP_SUBNET_ELEMENT_TYPE)]
  694. union _DHCP_SUBNET_ELEMENT_UNION_V4 {
  695. [case(DhcpIpRanges)] DHCP_IP_RANGE *IpRange;
  696. [case(DhcpSecondaryHosts)] DHCP_HOST_INFO *SecondaryHost;
  697. [case(DhcpReservedIps)] DHCP_IP_RESERVATION_V4 *ReservedIp;
  698. [case(DhcpExcludedIpRanges)] DHCP_IP_RANGE *ExcludeIpRange;
  699. [case(DhcpIpUsedClusters)] DHCP_IP_CLUSTER *IpUsedCluster;
  700. [default] ;
  701. } Element;
  702. #else
  703. union _DHCP_SUBNET_ELEMENT_UNION_V4 {
  704. DHCP_IP_RANGE *IpRange;
  705. DHCP_HOST_INFO *SecondaryHost;
  706. DHCP_IP_RESERVATION_V4 *ReservedIp;
  707. DHCP_IP_RANGE *ExcludeIpRange;
  708. DHCP_IP_CLUSTER *IpUsedCluster;
  709. } Element;
  710. #endif // MIDL_PASS
  711. } DHCP_SUBNET_ELEMENT_DATA_V4, *LPDHCP_SUBNET_ELEMENT_DATA_V4;
  712. #if !defined(MIDL_PASS)
  713. typedef union _DHCP_SUBNET_ELEMENT_UNION_V4
  714. DHCP_SUBNET_ELEMENT_UNION_V4, *LPDHCP_SUBNET_ELEMENT_UNION_V4;
  715. #endif
  716. typedef struct _DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4 {
  717. DWORD NumElements;
  718. #if defined(MIDL_PASS)
  719. [size_is(NumElements)]
  720. #endif // MIDL_PASS
  721. LPDHCP_SUBNET_ELEMENT_DATA_V4 Elements; //array
  722. } DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4, *LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V4;
  723. // DHCP_CLIENT_INFO:bClientType
  724. #define CLIENT_TYPE_UNSPECIFIED 0x0 // for backward compatibility
  725. #define CLIENT_TYPE_DHCP 0x1
  726. #define CLIENT_TYPE_BOOTP 0x2
  727. #define CLIENT_TYPE_BOTH ( CLIENT_TYPE_DHCP | CLIENT_TYPE_BOOTP )
  728. #define CLIENT_TYPE_RESERVATION_FLAG 0x4
  729. #define CLIENT_TYPE_NONE 0x64
  730. #define BOOT_FILE_STRING_DELIMITER ','
  731. #define BOOT_FILE_STRING_DELIMITER_W L','
  732. typedef struct _DHCP_CLIENT_INFO_V4 {
  733. DHCP_IP_ADDRESS ClientIpAddress; // currently assigned IP address.
  734. DHCP_IP_MASK SubnetMask;
  735. DHCP_CLIENT_UID ClientHardwareAddress;
  736. LPWSTR ClientName; // optional.
  737. LPWSTR ClientComment;
  738. DATE_TIME ClientLeaseExpires; // UTC time in FILE_TIME format.
  739. DHCP_HOST_INFO OwnerHost; // host that distributed this IP address.
  740. //
  741. // new fields for NT4SP1
  742. //
  743. BYTE bClientType; // CLIENT_TYPE_DHCP | CLIENT_TYPE_BOOTP |
  744. // CLIENT_TYPE_NONE
  745. } DHCP_CLIENT_INFO_V4, *LPDHCP_CLIENT_INFO_V4;
  746. typedef struct _DHCP_CLIENT_INFO_ARRAY_V4 {
  747. DWORD NumElements;
  748. #if defined(MIDL_PASS)
  749. [size_is(NumElements)]
  750. #endif // MIDL_PASS
  751. LPDHCP_CLIENT_INFO_V4 *Clients; // array of pointers
  752. } DHCP_CLIENT_INFO_ARRAY_V4, *LPDHCP_CLIENT_INFO_ARRAY_V4;
  753. typedef struct _DHCP_SERVER_CONFIG_INFO_V4 {
  754. DWORD APIProtocolSupport; // bit map of the protocols supported.
  755. LPWSTR DatabaseName; // JET database name.
  756. LPWSTR DatabasePath; // JET database path.
  757. LPWSTR BackupPath; // Backup path.
  758. DWORD BackupInterval; // Backup interval in mins.
  759. DWORD DatabaseLoggingFlag; // Boolean database logging flag.
  760. DWORD RestoreFlag; // Boolean database restore flag.
  761. DWORD DatabaseCleanupInterval; // Database Cleanup Interval in mins.
  762. DWORD DebugFlag; // Bit map of server debug flags.
  763. // new fields for NT4 SP1
  764. DWORD dwPingRetries; // valid range: 0-5 inclusive
  765. DWORD cbBootTableString;
  766. #if defined( MIDL_PASS )
  767. [ size_is( cbBootTableString ) ]
  768. #endif
  769. WCHAR *wszBootTableString;
  770. BOOL fAuditLog; // TRUE to enable audit log
  771. } DHCP_SERVER_CONFIG_INFO_V4, *LPDHCP_SERVER_CONFIG_INFO_V4;
  772. //
  773. // superscope info structure (added by t-cheny)
  774. //
  775. typedef struct _DHCP_SUPER_SCOPE_TABLE_ENTRY {
  776. DHCP_IP_ADDRESS SubnetAddress; // subnet address
  777. DWORD SuperScopeNumber; // super scope group number
  778. DWORD NextInSuperScope; // index of the next subnet in the superscope
  779. LPWSTR SuperScopeName; // super scope name
  780. // NULL indicates no superscope membership.
  781. } DHCP_SUPER_SCOPE_TABLE_ENTRY, *LPDHCP_SUPER_SCOPE_TABLE_ENTRY;
  782. typedef struct _DHCP_SUPER_SCOPE_TABLE
  783. {
  784. DWORD cEntries;
  785. #if defined( MIDL_PASS )
  786. [ size_is( cEntries ) ]
  787. #endif;
  788. DHCP_SUPER_SCOPE_TABLE_ENTRY *pEntries;
  789. } DHCP_SUPER_SCOPE_TABLE, *LPDHCP_SUPER_SCOPE_TABLE;
  790. //
  791. // NT4SP1 RPC interface
  792. //
  793. #ifndef DHCPAPI_NO_PROTOTYPES
  794. DWORD DHCP_API_FUNCTION
  795. DhcpAddSubnetElementV4(
  796. DHCP_CONST WCHAR *ServerIpAddress,
  797. DHCP_IP_ADDRESS SubnetAddress,
  798. DHCP_CONST DHCP_SUBNET_ELEMENT_DATA_V4 * AddElementInfo
  799. );
  800. DWORD DHCP_API_FUNCTION
  801. DhcpEnumSubnetElementsV4(
  802. DHCP_CONST WCHAR *ServerIpAddress,
  803. DHCP_IP_ADDRESS SubnetAddress,
  804. DHCP_SUBNET_ELEMENT_TYPE EnumElementType,
  805. DHCP_RESUME_HANDLE *ResumeHandle,
  806. DWORD PreferredMaximum,
  807. LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V4 *EnumElementInfo,
  808. DWORD *ElementsRead,
  809. DWORD *ElementsTotal
  810. );
  811. DWORD DHCP_API_FUNCTION
  812. DhcpRemoveSubnetElementV4(
  813. DHCP_CONST WCHAR *ServerIpAddress,
  814. DHCP_IP_ADDRESS SubnetAddress,
  815. DHCP_CONST DHCP_SUBNET_ELEMENT_DATA_V4 * RemoveElementInfo,
  816. DHCP_FORCE_FLAG ForceFlag
  817. );
  818. DWORD DHCP_API_FUNCTION
  819. DhcpCreateClientInfoV4(
  820. DHCP_CONST WCHAR *ServerIpAddress,
  821. DHCP_CONST DHCP_CLIENT_INFO_V4 *ClientInfo
  822. );
  823. DWORD DHCP_API_FUNCTION
  824. DhcpSetClientInfoV4(
  825. DHCP_CONST WCHAR *ServerIpAddress,
  826. DHCP_CONST DHCP_CLIENT_INFO_V4 *ClientInfo
  827. );
  828. DWORD DHCP_API_FUNCTION
  829. DhcpGetClientInfoV4(
  830. DHCP_CONST WCHAR *ServerIpAddress,
  831. DHCP_CONST DHCP_SEARCH_INFO *SearchInfo,
  832. LPDHCP_CLIENT_INFO_V4 *ClientInfo
  833. );
  834. DWORD DHCP_API_FUNCTION
  835. DhcpEnumSubnetClientsV4(
  836. DHCP_CONST WCHAR *ServerIpAddress,
  837. DHCP_IP_ADDRESS SubnetAddress,
  838. DHCP_RESUME_HANDLE *ResumeHandle,
  839. DWORD PreferredMaximum,
  840. LPDHCP_CLIENT_INFO_ARRAY_V4 *ClientInfo,
  841. DWORD *ClientsRead,
  842. DWORD *ClientsTotal
  843. );
  844. DWORD DHCP_API_FUNCTION
  845. DhcpServerSetConfigV4(
  846. DHCP_CONST WCHAR *ServerIpAddress,
  847. DWORD FieldsToSet,
  848. LPDHCP_SERVER_CONFIG_INFO_V4 ConfigInfo
  849. );
  850. DWORD DHCP_API_FUNCTION
  851. DhcpServerGetConfigV4(
  852. DHCP_CONST WCHAR *ServerIpAddress,
  853. LPDHCP_SERVER_CONFIG_INFO_V4 *ConfigInfo
  854. );
  855. DWORD
  856. DhcpSetSuperScopeV4(
  857. DHCP_CONST WCHAR *ServerIpAddress,
  858. DHCP_CONST DHCP_IP_ADDRESS SubnetAddress,
  859. DHCP_CONST LPWSTR SuperScopeName,
  860. DHCP_CONST BOOL ChangeExisting
  861. );
  862. DWORD
  863. DhcpDeleteSuperScopeV4(
  864. DHCP_CONST WCHAR *ServerIpAddress,
  865. DHCP_CONST LPWSTR SuperScopeName
  866. );
  867. DWORD
  868. DhcpGetSuperScopeInfoV4(
  869. DHCP_CONST WCHAR *ServerIpAddress,
  870. LPDHCP_SUPER_SCOPE_TABLE *SuperScopeTable
  871. );
  872. #endif DHCPAPI_NO_PROTOTYPES
  873. typedef struct _DHCP_CLIENT_INFO_V5 {
  874. DHCP_IP_ADDRESS ClientIpAddress; // currently assigned IP address.
  875. DHCP_IP_MASK SubnetMask;
  876. DHCP_CLIENT_UID ClientHardwareAddress;
  877. LPWSTR ClientName; // optional.
  878. LPWSTR ClientComment;
  879. DATE_TIME ClientLeaseExpires; // UTC time in FILE_TIME format.
  880. DHCP_HOST_INFO OwnerHost; // host that distributed this IP address.
  881. //
  882. // new fields for NT4SP1
  883. //
  884. BYTE bClientType; // CLIENT_TYPE_DHCP | CLIENT_TYPE_BOOTP |
  885. // CLIENT_TYPE_NONE
  886. // new field for NT5.0
  887. BYTE AddressState; // OFFERED, DOOMED ...etc as given below
  888. } DHCP_CLIENT_INFO_V5, *LPDHCP_CLIENT_INFO_V5;
  889. // the following are four valid states for the record. Note that only the last two
  890. // bits must be used to find out the state... the higher bits are used as bit flags to
  891. // indicate DNS stuff.
  892. #define V5_ADDRESS_STATE_OFFERED 0x0
  893. #define V5_ADDRESS_STATE_ACTIVE 0x1
  894. #define V5_ADDRESS_STATE_DECLINED 0x2
  895. #define V5_ADDRESS_STATE_DOOM 0x3
  896. // DELETED => DNS DeRegistration pending
  897. // UNREGISTERED => DNS Registration pending
  898. // BOTH_REC => Both [Name->Ip] AND [Ip->Name] DNS registration would be done by server.
  899. #define V5_ADDRESS_BIT_DELETED 0x80
  900. #define V5_ADDRESS_BIT_UNREGISTERED 0x40
  901. #define V5_ADDRESS_BIT_BOTH_REC 0x20
  902. // Here are the flags that could be set/unset to affect DNS behaviour (option 81)
  903. // If FLAG_ENABLED is not set, then this client is ignored for DNS updates or cleanups
  904. // If update DOWNLEVEL is set, then DOWNLEVEL clients would have both A & Ptr records updated.
  905. // If Cleanup expired is set, then the client's records would be cleaned up on delete.
  906. // If UPDATE_BOTH_ALWAYS is set, all clients are treated like down level clients with both records updated.
  907. //
  908. // Some common cases:
  909. // If you want updates to occur as requested by client, clear UPDATE_ALWAYS
  910. // If you want updates to be only Ip->Name, clear FLAG_UPDATE_BOTH_ALWAYS
  911. // If you want down level clients to be handled, set UPDATE_DOWNLEVEL
  912. // If you want de-registrations on lease expiry, set CLEANUP_EXPIRED
  913. // If you want any DNS activity at all, set ENABLED
  914. #define DNS_FLAG_ENABLED 0x01
  915. #define DNS_FLAG_UPDATE_DOWNLEVEL 0x02
  916. #define DNS_FLAG_CLEANUP_EXPIRED 0x04
  917. #define DNS_FLAG_UPDATE_BOTH_ALWAYS 0x10
  918. typedef struct _DHCP_CLIENT_INFO_ARRAY_V5 {
  919. DWORD NumElements;
  920. #if defined(MIDL_PASS)
  921. [size_is(NumElements)]
  922. #endif // MIDL_PASS
  923. LPDHCP_CLIENT_INFO_V5 *Clients; // array of pointers
  924. } DHCP_CLIENT_INFO_ARRAY_V5, *LPDHCP_CLIENT_INFO_ARRAY_V5;
  925. #ifndef DHCPAPI_NO_PROTOTYPES
  926. // Newer NT50 Version of the function..
  927. DWORD DHCP_API_FUNCTION
  928. DhcpEnumSubnetClientsV5(
  929. DHCP_CONST WCHAR *ServerIpAddress,
  930. DHCP_IP_ADDRESS SubnetAddress,
  931. DHCP_RESUME_HANDLE *ResumeHandle,
  932. DWORD PreferredMaximum,
  933. LPDHCP_CLIENT_INFO_ARRAY_V5 *ClientInfo,
  934. DWORD *ClientsRead,
  935. DWORD *ClientsTotal
  936. );
  937. //================================================================================
  938. // here is the NT 5.0 Beta2 stuff -- ClassId and Vendor specific stuff
  939. //================================================================================
  940. DWORD // ERROR_DHCP_OPTION_EXITS if option is already there
  941. DhcpCreateOptionV5( // create a new option (must not exist)
  942. IN LPWSTR ServerIpAddress,
  943. IN DWORD Flags,
  944. IN DHCP_OPTION_ID OptionId, // must be between 0-255 or 256-511 (for vendor stuff)
  945. IN LPWSTR ClassName,
  946. IN LPWSTR VendorName,
  947. IN LPDHCP_OPTION OptionInfo
  948. ) ;
  949. DWORD // ERROR_DHCP_OPTION_NOT_PRESENT if option does not exist
  950. DhcpSetOptionInfoV5( // Modify existing option's fields
  951. IN LPWSTR ServerIpAddress,
  952. IN DWORD Flags,
  953. IN DHCP_OPTION_ID OptionID,
  954. IN LPWSTR ClassName,
  955. IN LPWSTR VendorName,
  956. IN LPDHCP_OPTION OptionInfo
  957. ) ;
  958. DWORD // ERROR_DHCP_OPTION_NOT_PRESENT
  959. DhcpGetOptionInfoV5( // retrieve the information from off the mem structures
  960. IN LPWSTR ServerIpAddress,
  961. IN DWORD Flags,
  962. IN DHCP_OPTION_ID OptionID,
  963. IN LPWSTR ClassName,
  964. IN LPWSTR VendorName,
  965. OUT LPDHCP_OPTION *OptionInfo // allocate memory using MIDL functions
  966. ) ;
  967. DWORD // ERROR_DHCP_OPTION_NOT_PRESENT if option does not exist
  968. DhcpEnumOptionsV5( // enumerate the options defined
  969. IN LPWSTR ServerIpAddress,
  970. IN DWORD Flags,
  971. IN LPWSTR ClassName,
  972. IN LPWSTR VendorName,
  973. IN OUT DHCP_RESUME_HANDLE *ResumeHandle, // must be zero intially and then never touched
  974. IN DWORD PreferredMaximum, // max # of bytes of info to pass along
  975. OUT LPDHCP_OPTION_ARRAY *Options, // fill this option array
  976. OUT DWORD *OptionsRead, // fill in the # of options read
  977. OUT DWORD *OptionsTotal // fill in the total # here
  978. ) ;
  979. DWORD // ERROR_DHCP_OPTION_NOT_PRESENT if option not existent
  980. DhcpRemoveOptionV5( // remove the option definition from the registry
  981. IN LPWSTR ServerIpAddress,
  982. IN DWORD Flags,
  983. IN DHCP_OPTION_ID OptionID,
  984. IN LPWSTR ClassName,
  985. IN LPWSTR VendorName
  986. ) ;
  987. DWORD // OPTION_NOT_PRESENT if option is not defined
  988. DhcpSetOptionValueV5( // replace or add a new option value
  989. IN LPWSTR ServerIpAddress,
  990. IN DWORD Flags,
  991. IN DHCP_OPTION_ID OptionId,
  992. IN LPWSTR ClassName,
  993. IN LPWSTR VendorName,
  994. IN LPDHCP_OPTION_SCOPE_INFO ScopeInfo,
  995. IN LPDHCP_OPTION_DATA OptionValue
  996. ) ;
  997. DWORD // not atomic!!!!
  998. DhcpSetOptionValuesV5( // set a bunch of options
  999. IN LPWSTR ServerIpAddress,
  1000. IN DWORD Flags,
  1001. IN LPWSTR ClassName,
  1002. IN LPWSTR VendorName,
  1003. IN LPDHCP_OPTION_SCOPE_INFO ScopeInfo,
  1004. IN LPDHCP_OPTION_VALUE_ARRAY OptionValues
  1005. ) ;
  1006. DWORD
  1007. DhcpGetOptionValueV5( // fetch the required option at required level
  1008. IN LPWSTR ServerIpAddress,
  1009. IN DWORD Flags,
  1010. IN DHCP_OPTION_ID OptionID,
  1011. IN LPWSTR ClassName,
  1012. IN LPWSTR VendorName,
  1013. IN LPDHCP_OPTION_SCOPE_INFO ScopeInfo,
  1014. OUT LPDHCP_OPTION_VALUE *OptionValue // allocate memory using MIDL_user_allocate
  1015. ) ;
  1016. DWORD
  1017. DhcpEnumOptionValuesV5(
  1018. IN LPWSTR ServerIpAddress,
  1019. IN DWORD Flags,
  1020. IN LPWSTR ClassName,
  1021. IN LPWSTR VendorName,
  1022. IN LPDHCP_OPTION_SCOPE_INFO ScopeInfo,
  1023. IN DHCP_RESUME_HANDLE *ResumeHandle,
  1024. IN DWORD PreferredMaximum,
  1025. OUT LPDHCP_OPTION_VALUE_ARRAY *OptionValues,
  1026. OUT DWORD *OptionsRead,
  1027. OUT DWORD *OptionsTotal
  1028. ) ;
  1029. DWORD
  1030. DhcpRemoveOptionValueV5(
  1031. IN LPWSTR ServerIpAddress,
  1032. IN DWORD Flags,
  1033. IN DHCP_OPTION_ID OptionID,
  1034. IN LPWSTR ClassName,
  1035. IN LPWSTR VendorName,
  1036. IN LPDHCP_OPTION_SCOPE_INFO ScopeInfo
  1037. ) ;
  1038. DWORD
  1039. DhcpCreateClass(
  1040. IN LPWSTR ServerIpAddress,
  1041. IN DWORD ReservedMustBeZero,
  1042. IN LPDHCP_CLASS_INFO ClassInfo
  1043. ) ;
  1044. DWORD
  1045. DhcpModifyClass(
  1046. IN LPWSTR ServerIpAddress,
  1047. IN DWORD ReservedMustBeZero,
  1048. IN LPDHCP_CLASS_INFO ClassInfo
  1049. ) ;
  1050. DWORD
  1051. DhcpDeleteClass(
  1052. IN LPWSTR ServerIpAddress,
  1053. IN DWORD ReservedMustBeZero,
  1054. IN LPWSTR ClassName
  1055. ) ;
  1056. DWORD
  1057. DhcpGetClassInfo(
  1058. IN LPWSTR ServerIpAddress,
  1059. IN DWORD ReservedMustBeZero,
  1060. IN LPDHCP_CLASS_INFO PartialClassInfo,
  1061. OUT LPDHCP_CLASS_INFO *FilledClassInfo
  1062. ) ;
  1063. DWORD
  1064. DhcpEnumClasses(
  1065. IN LPWSTR ServerIpAddress,
  1066. IN DWORD ReservedMustBeZero,
  1067. IN OUT DHCP_RESUME_HANDLE *ResumeHandle,
  1068. IN DWORD PreferredMaximum,
  1069. OUT LPDHCP_CLASS_INFO_ARRAY *ClassInfoArray,
  1070. OUT DWORD *nRead,
  1071. OUT DWORD *nTotal
  1072. ) ;
  1073. #endif DHCPAPI_NO_PROTOTYPES
  1074. #define DHCP_OPT_ENUM_IGNORE_VENDOR 0x01
  1075. #define DHCP_OPT_ENUM_USE_CLASSNAME 0x02
  1076. typedef struct _DHCP_ALL_OPTIONS {
  1077. DWORD Flags; // must be zero -- not used..
  1078. LPDHCP_OPTION_ARRAY NonVendorOptions;
  1079. DWORD NumVendorOptions;
  1080. #if defined(MIDL_PASS)
  1081. [size_is(NumVendorOptions)]
  1082. #endif
  1083. struct /* anonymous */ {
  1084. DHCP_OPTION Option;
  1085. LPWSTR VendorName;
  1086. LPWSTR ClassName; // currently unused.
  1087. } *VendorOptions;
  1088. } DHCP_ALL_OPTIONS, *LPDHCP_ALL_OPTIONS;
  1089. typedef struct _DHCP_ALL_OPTION_VALUES {
  1090. DWORD Flags; // must be zero -- not used
  1091. DWORD NumElements; // the # of elements in array of Options below..
  1092. #if defined(MIDL_PASS)
  1093. [size_is(NumElements)]
  1094. #endif MIDL_PASS
  1095. struct /* anonymous */ {
  1096. LPWSTR ClassName; // for each user class (NULL if none exists)
  1097. LPWSTR VendorName; // for each vendor class (NULL if none exists)
  1098. BOOL IsVendor; // is this set of options vendor specific?
  1099. LPDHCP_OPTION_VALUE_ARRAY OptionsArray; // list of options for the above pair: (vendor,user)
  1100. } *Options; // for each vendor/user class pair, one element in this array..
  1101. } DHCP_ALL_OPTION_VALUES, *LPDHCP_ALL_OPTION_VALUES;
  1102. #ifndef DHCPAPI_NO_PROTOTYPES
  1103. // NT 50 Beta2 extended options api
  1104. DWORD
  1105. DhcpGetAllOptions(
  1106. IN LPWSTR ServerIpAddress,
  1107. IN DWORD Flags,
  1108. OUT LPDHCP_ALL_OPTIONS *OptionStruct // fill the fields of this structure
  1109. ) ;
  1110. DWORD
  1111. DhcpGetAllOptionValues(
  1112. IN LPWSTR ServerIpAddress,
  1113. IN DWORD Flags,
  1114. IN LPDHCP_OPTION_SCOPE_INFO ScopeInfo,
  1115. OUT LPDHCP_ALL_OPTION_VALUES *Values
  1116. ) ;
  1117. #endif DHCPAPI_NO_PROTOTYPES
  1118. #ifndef _ST_SRVR_H_
  1119. #define _ST_SRVR_H_
  1120. typedef struct _DHCPDS_SERVER {
  1121. DWORD Version; // version of this structure -- currently zero
  1122. LPWSTR ServerName; // [DNS?] unique name for server
  1123. DWORD ServerAddress; // ip address of server
  1124. DWORD Flags; // additional info -- state
  1125. DWORD State; // not used ...
  1126. LPWSTR DsLocation; // ADsPath to server object
  1127. DWORD DsLocType; // path relative? absolute? diff srvr?
  1128. } DHCPDS_SERVER, *LPDHCPDS_SERVER, *PDHCPDS_SERVER;
  1129. typedef struct _DHCPDS_SERVERS {
  1130. DWORD Flags; // not used currently.
  1131. DWORD NumElements; // # of elements in array
  1132. LPDHCPDS_SERVER Servers; // array of server info
  1133. } DHCPDS_SERVERS, *LPDHCPDS_SERVERS, *PDHCPDS_SERVERS;
  1134. typedef DHCPDS_SERVER DHCP_SERVER_INFO;
  1135. typedef PDHCPDS_SERVER PDHCP_SERVER_INFO;
  1136. typedef LPDHCPDS_SERVER LPDHCP_SERVER_INFO;
  1137. typedef DHCPDS_SERVERS DHCP_SERVER_INFO_ARRAY;
  1138. typedef PDHCPDS_SERVERS PDHCP_SERVER_INFO_ARRAY;
  1139. typedef LPDHCPDS_SERVERS LPDHCP_SERVER_INFO_ARRAY;
  1140. #endif _ST_SRVR_H_
  1141. //DOC DhcpDsInit must be called exactly once per process.. this initializes the
  1142. //DOC memory and other structures for this process. This initializes some DS
  1143. //DOC object handles (memory), and hence is slow as this has to read from DS.
  1144. DWORD
  1145. DhcpDsInit(
  1146. VOID
  1147. );
  1148. //DOC DhcpDsCleanup undoes the effect of any DhcpDsInit. This function should be
  1149. //DOC called exactly once for each process, and only at termination. Note that
  1150. //DOC it is safe to call this function even if DhcpDsInit does not succeed.
  1151. VOID
  1152. DhcpDsCleanup(
  1153. VOID
  1154. );
  1155. #define DHCP_FLAGS_DONT_ACCESS_DS 0x01
  1156. #define DHCP_FLAGS_DONT_DO_RPC 0x02
  1157. #define DHCP_FLAGS_OPTION_IS_VENDOR 0x03
  1158. //DOC DhcpSetThreadOptions currently allows only one option to be set. This is the
  1159. //DOC flag DHCP_FLAGS_DONT_ACCESS_DS. This affects only the current executing thread.
  1160. //DOC When this function is executed, all calls made further DONT access the registry,
  1161. //DOC excepting the DhcpEnumServers, DhcpAddServer and DhcpDeleteServer calls.
  1162. DWORD
  1163. DhcpSetThreadOptions( // set options for current thread
  1164. IN DWORD Flags, // options, currently 0 or DHCP_FLAGS_DONT_ACCESS_DS
  1165. IN LPVOID Reserved // must be NULL, reserved for future
  1166. );
  1167. //DOC DhcpGetThreadOptions retrieves the current thread options as set by DhcpSetThreadOptions.
  1168. //DOC If none were set, the return value is zero.
  1169. DWORD
  1170. DhcpGetThreadOptions( // get current thread options
  1171. OUT LPDWORD pFlags, // this DWORD is filled with current optiosn..
  1172. IN OUT LPVOID Reserved // must be NULL, reserved for future
  1173. );
  1174. #ifndef DHCPAPI_NO_PROTOTYPES
  1175. //DOC DhcpEnumServers enumerates the list of servers found in the DS. If the DS
  1176. //DOC is not accessible, it returns an error. The only currently used parameter
  1177. //DOC is the out parameter Servers. This is a SLOW call.
  1178. DWORD
  1179. DhcpEnumServers(
  1180. IN DWORD Flags, // must be zero
  1181. IN LPVOID IdInfo, // must be NULL
  1182. OUT LPDHCP_SERVER_INFO_ARRAY *Servers, // output servers list
  1183. IN LPVOID CallbackFn, // must be NULL
  1184. IN LPVOID CallbackData // must be NULL
  1185. );
  1186. //DOC DhcpAddServer tries to add a new server to the existing list of servers in
  1187. //DOC the DS. The function returns error if the Server already exists in the DS.
  1188. //DOC The function tries to upload the server configuration to the DS..
  1189. //DOC This is a SLOW call. Currently, the DsLocation and DsLocType are not valid
  1190. //DOC fields in the NewServer and they'd be ignored. Version must be zero.
  1191. DWORD
  1192. DhcpAddServer(
  1193. IN DWORD Flags, // must be zero
  1194. IN LPVOID IdInfo, // must be NULL
  1195. IN LPDHCP_SERVER_INFO NewServer, // input server information
  1196. IN LPVOID CallbackFn, // must be NULL
  1197. IN LPVOID CallbackData // must be NULL
  1198. );
  1199. //DOC DhcpDeleteServer tries to delete the server from DS. It is an error if the
  1200. //DOC server does not already exist. This also deletes any objects related to
  1201. //DOC this server in the DS (like subnet, reservations etc.).
  1202. DWORD
  1203. DhcpDeleteServer(
  1204. IN DWORD Flags, // must be zero
  1205. IN LPVOID IdInfo, // must be NULL
  1206. IN LPDHCP_SERVER_INFO NewServer, // input server information
  1207. IN LPVOID CallbackFn, // must be NULL
  1208. IN LPVOID CallbackData // must be NULL
  1209. );
  1210. #endif // DHCPAPI_NO_PROTOTYPES
  1211. #define DHCP_ATTRIB_BOOL_IS_ROGUE 0x01
  1212. #define DHCP_ATTRIB_BOOL_IS_DYNBOOTP 0x02
  1213. #define DHCP_ATTRIB_BOOL_IS_PART_OF_DSDC 0x03
  1214. #define DHCP_ATTRIB_BOOL_IS_BINDING_AWARE 0x04
  1215. #define DHCP_ATTRIB_BOOL_IS_ADMIN 0x05
  1216. #define DHCP_ATTRIB_ULONG_RESTORE_STATUS 0x06
  1217. #define DHCP_ATTRIB_TYPE_BOOL 0x01
  1218. #define DHCP_ATTRIB_TYPE_ULONG 0x02
  1219. typedef ULONG DHCP_ATTRIB_ID, *PDHCP_ATTRIB_ID, *LPDHCP_ATTRIB_ID;
  1220. typedef struct _DHCP_ATTRIB {
  1221. DHCP_ATTRIB_ID DhcpAttribId; // one of the DHCP_ATTRIB_*
  1222. ULONG DhcpAttribType;// type of attrib
  1223. #if defined(MIDL_PASS)
  1224. [switch_is(DhcpAttribType), switch_type(ULONG)]
  1225. union {
  1226. [case(DHCP_ATTRIB_TYPE_BOOL)] BOOL DhcpAttribBool;
  1227. [case(DHCP_ATTRIB_TYPE_ULONG)] ULONG DhcpAttribUlong;
  1228. };
  1229. #else MIDL_PASS
  1230. union { // predefined values..
  1231. BOOL DhcpAttribBool;
  1232. ULONG DhcpAttribUlong;
  1233. };
  1234. #endif MIDL_PASS
  1235. } DHCP_ATTRIB, *PDHCP_ATTRIB, *LPDHCP_ATTRIB;
  1236. typedef struct _DHCP_ATTRIB_ARRAY {
  1237. ULONG NumElements;
  1238. #if defined(MIDL_PASS)
  1239. [size_is(NumElements)]
  1240. #endif MIDL_PASS
  1241. LPDHCP_ATTRIB DhcpAttribs;
  1242. } DHCP_ATTRIB_ARRAY, *PDHCP_ATTRIB_ARRAY, *LPDHCP_ATTRIB_ARRAY;
  1243. DWORD // Status code
  1244. DhcpServerQueryAttribute( // get a server status
  1245. IN LPWSTR ServerIpAddr, // String form of server IP
  1246. IN ULONG dwReserved, // reserved for future
  1247. IN DHCP_ATTRIB_ID DhcpAttribId, // the attrib being queried
  1248. OUT LPDHCP_ATTRIB *pDhcpAttrib // fill in this field
  1249. );
  1250. DWORD // Status code
  1251. DhcpServerQueryAttributes( // query multiple attributes
  1252. IN LPWSTR ServerIpAddr, // String form of server IP
  1253. IN ULONG dwReserved, // reserved for future
  1254. IN ULONG dwAttribCount, // # of attribs being queried
  1255. IN DHCP_ATTRIB_ID pDhcpAttribs[],// array of attribs
  1256. OUT LPDHCP_ATTRIB_ARRAY *pDhcpAttribArr // Ptr is filled w/ array
  1257. );
  1258. DWORD // Status code
  1259. DhcpServerRedoAuthorization( // retry the rogue server stuff
  1260. IN LPWSTR ServerIpAddr, // String form of server IP
  1261. IN ULONG dwReserved // reserved for future
  1262. );
  1263. DWORD
  1264. DhcpAuditLogSetParams( // set some auditlogging params
  1265. IN LPWSTR ServerIpAddress,
  1266. IN DWORD Flags, // currently must be zero
  1267. IN LPWSTR AuditLogDir, // directory to log files in..
  1268. IN DWORD DiskCheckInterval, // how often to check disk space?
  1269. IN DWORD MaxLogFilesSize, // how big can all logs files be..
  1270. IN DWORD MinSpaceOnDisk // mininum amt of free disk space
  1271. );
  1272. DWORD
  1273. DhcpAuditLogGetParams( // get the auditlogging params
  1274. IN LPWSTR ServerIpAddress,
  1275. IN DWORD Flags, // must be zero
  1276. OUT LPWSTR *AuditLogDir, // same meaning as in AuditLogSetParams
  1277. OUT DWORD *DiskCheckInterval, // ditto
  1278. OUT DWORD *MaxLogFilesSize, // ditto
  1279. OUT DWORD *MinSpaceOnDisk // ditto
  1280. );
  1281. typedef struct _DHCP_BOOTP_IP_RANGE {
  1282. DHCP_IP_ADDRESS StartAddress;
  1283. DHCP_IP_ADDRESS EndAddress;
  1284. ULONG BootpAllocated;
  1285. ULONG MaxBootpAllowed;
  1286. } DHCP_BOOTP_IP_RANGE, *LPDHCP_BOOT_IP_RANGE;
  1287. typedef struct _DHCP_SUBNET_ELEMENT_DATA_V5 {
  1288. DHCP_SUBNET_ELEMENT_TYPE ElementType;
  1289. #if defined(MIDL_PASS)
  1290. [switch_is(ELEMENT_MASK(ElementType)), switch_type(DHCP_SUBNET_ELEMENT_TYPE)]
  1291. union _DHCP_SUBNET_ELEMENT_UNION_V5 {
  1292. [case(DhcpIpRanges)] DHCP_BOOTP_IP_RANGE *IpRange;
  1293. [case(DhcpSecondaryHosts)] DHCP_HOST_INFO *SecondaryHost;
  1294. [case(DhcpReservedIps)] DHCP_IP_RESERVATION_V4 *ReservedIp;
  1295. [case(DhcpExcludedIpRanges)] DHCP_IP_RANGE *ExcludeIpRange;
  1296. [case(DhcpIpUsedClusters)] DHCP_IP_CLUSTER *IpUsedCluster;
  1297. [default] ;
  1298. } Element;
  1299. #else
  1300. union _DHCP_SUBNET_ELEMENT_UNION_V5 {
  1301. DHCP_BOOTP_IP_RANGE *IpRange;
  1302. DHCP_HOST_INFO *SecondaryHost;
  1303. DHCP_IP_RESERVATION_V4 *ReservedIp;
  1304. DHCP_IP_RANGE *ExcludeIpRange;
  1305. DHCP_IP_CLUSTER *IpUsedCluster;
  1306. } Element;
  1307. #endif // MIDL_PASS
  1308. } DHCP_SUBNET_ELEMENT_DATA_V5, *LPDHCP_SUBNET_ELEMENT_DATA_V5;
  1309. typedef struct _DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5 {
  1310. DWORD NumElements;
  1311. #if defined(MIDL_PASS)
  1312. [size_is(NumElements)]
  1313. #endif // MIDL_PASS
  1314. LPDHCP_SUBNET_ELEMENT_DATA_V5 Elements; //array
  1315. } DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5, *LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V5;
  1316. #ifndef DHCPAPI_NO_PROTOTYPES
  1317. DWORD DHCP_API_FUNCTION
  1318. DhcpAddSubnetElementV5(
  1319. DHCP_CONST WCHAR *ServerIpAddress,
  1320. DHCP_IP_ADDRESS SubnetAddress,
  1321. DHCP_CONST DHCP_SUBNET_ELEMENT_DATA_V5 * AddElementInfo
  1322. );
  1323. DWORD DHCP_API_FUNCTION
  1324. DhcpEnumSubnetElementsV5(
  1325. DHCP_CONST WCHAR *ServerIpAddress,
  1326. DHCP_IP_ADDRESS SubnetAddress,
  1327. DHCP_SUBNET_ELEMENT_TYPE EnumElementType,
  1328. DHCP_RESUME_HANDLE *ResumeHandle,
  1329. DWORD PreferredMaximum,
  1330. LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V5 *EnumElementInfo,
  1331. DWORD *ElementsRead,
  1332. DWORD *ElementsTotal
  1333. );
  1334. DWORD DHCP_API_FUNCTION
  1335. DhcpRemoveSubnetElementV5(
  1336. DHCP_CONST WCHAR *ServerIpAddress,
  1337. DHCP_IP_ADDRESS SubnetAddress,
  1338. DHCP_CONST DHCP_SUBNET_ELEMENT_DATA_V5 * RemoveElementInfo,
  1339. DHCP_FORCE_FLAG ForceFlag
  1340. );
  1341. #endif // DHCPAPI_NO_PROTOTYPES
  1342. #define DHCPCTR_SHARED_MEM_NAME L"Global\\DHCPCTRS_SHMEM"
  1343. #pragma pack(4)
  1344. typedef struct _DHCP_PERF_STATS { // performance statistics
  1345. //
  1346. // DO NOT CHANGE THIS ORDER -- THIS AFFECTS THE PERF COUNTER DEFINITION
  1347. // ORDER IN DHCPDATA.C (under PERF directory)
  1348. //
  1349. ULONG dwNumPacketsReceived;
  1350. ULONG dwNumPacketsDuplicate;
  1351. ULONG dwNumPacketsExpired;
  1352. ULONG dwNumMilliSecondsProcessed;
  1353. ULONG dwNumPacketsInActiveQueue;
  1354. ULONG dwNumPacketsInPingQueue;
  1355. ULONG dwNumDiscoversReceived;
  1356. ULONG dwNumOffersSent;
  1357. ULONG dwNumRequestsReceived;
  1358. ULONG dwNumInformsReceived;
  1359. ULONG dwNumAcksSent;
  1360. ULONG dwNumNacksSent;
  1361. ULONG dwNumDeclinesReceived;
  1362. ULONG dwNumReleasesReceived;
  1363. //
  1364. // This is not a counter value.. but there just to aid calculation of packet
  1365. // processing time/ # of packets processed.
  1366. //
  1367. ULONG dwNumPacketsProcessed;
  1368. } DHCP_PERF_STATS, *LPDHCP_PERF_STATS;
  1369. #pragma pack()
  1370. typedef VOID (WINAPI *DHCP_CLEAR_DS_ROUTINE) (VOID);
  1371. VOID
  1372. WINAPI
  1373. DhcpDsClearHostServerEntries(
  1374. VOID
  1375. );
  1376. typedef VOID (WINAPI *DHCP_MARKUPG_ROUTINE) (VOID);
  1377. VOID
  1378. WINAPI
  1379. DhcpMarkUpgrade(
  1380. VOID
  1381. );
  1382. #define DHCP_ENDPOINT_FLAG_CANT_MODIFY 0x01
  1383. typedef struct _DHCP_BIND_ELEMENT {
  1384. ULONG Flags;
  1385. BOOL fBoundToDHCPServer;
  1386. DHCP_IP_ADDRESS AdapterPrimaryAddress;
  1387. DHCP_IP_ADDRESS AdapterSubnetAddress;
  1388. LPWSTR IfDescription;
  1389. ULONG IfIdSize;
  1390. #if defined (MIDL_PASS)
  1391. [size_is(IfIdSize)]
  1392. #endif // MIDL_PASS
  1393. LPBYTE IfId;
  1394. } DHCP_BIND_ELEMENT, *LPDHCP_BIND_ELEMENT;
  1395. typedef struct _DHCP_BIND_ELEMENT_ARRAY {
  1396. DWORD NumElements;
  1397. #if defined (MIDL_PASS)
  1398. [size_is(NumElements)]
  1399. #endif // MIDL_PASS
  1400. LPDHCP_BIND_ELEMENT Elements; //array
  1401. } DHCP_BIND_ELEMENT_ARRAY, *LPDHCP_BIND_ELEMENT_ARRAY;
  1402. #ifndef DHCPAPI_NO_PROTOTYPES
  1403. DWORD DHCP_API_FUNCTION
  1404. DhcpGetServerBindingInfo(
  1405. DHCP_CONST WCHAR *ServerIpAddress,
  1406. ULONG Flags,
  1407. LPDHCP_BIND_ELEMENT_ARRAY *BindElementsInfo
  1408. );
  1409. DWORD DHCP_API_FUNCTION
  1410. DhcpSetServerBindingInfo(
  1411. DHCP_CONST WCHAR *ServerIpAddress,
  1412. ULONG Flags,
  1413. LPDHCP_BIND_ELEMENT_ARRAY BindElementInfo
  1414. );
  1415. #endif // DHCPAPI_NO_PROTOTYPES
  1416. DWORD
  1417. DhcpServerQueryDnsRegCredentials(
  1418. IN LPWSTR ServerIpAddress,
  1419. IN ULONG UnameSize, //in BYTES
  1420. OUT LPWSTR Uname,
  1421. IN ULONG DomainSize, // in BYTES
  1422. OUT LPWSTR Domain
  1423. );
  1424. DWORD
  1425. DhcpServerSetDnsRegCredentials(
  1426. IN LPWSTR ServerIpAddress,
  1427. IN LPWSTR Uname,
  1428. IN LPWSTR Domain,
  1429. IN LPWSTR Passwd
  1430. );
  1431. DWORD
  1432. DhcpServerBackupDatabase(
  1433. IN LPWSTR ServerIpAddress,
  1434. IN LPWSTR Path
  1435. );
  1436. DWORD
  1437. DhcpServerRestoreDatabase(
  1438. IN LPWSTR ServerIpAddress,
  1439. IN LPWSTR Path
  1440. );
  1441. #endif // _DHCPAPI_