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.

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