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.

289 lines
9.6 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. dhcpcapi.h
  5. Abstract:
  6. This file contains function proto types for the DHCP CONFIG API
  7. functions.
  8. Author:
  9. Madan Appiah (madana) Dec-22-1993
  10. Environment:
  11. User Mode - Win32
  12. Revision History:
  13. --*/
  14. #ifndef _DHCPCAPI_
  15. #define _DHCPCAPI_
  16. #include <time.h>
  17. HANDLE
  18. APIENTRY
  19. DhcpOpenGlobalEvent(
  20. VOID
  21. );
  22. typedef enum _SERVICE_ENABLE {
  23. IgnoreFlag,
  24. DhcpEnable,
  25. DhcpDisable
  26. } SERVICE_ENABLE, *LPSERVICE_ENABLE;
  27. DWORD
  28. APIENTRY
  29. DhcpAcquireParameters(
  30. LPWSTR AdapterName
  31. );
  32. DWORD
  33. APIENTRY
  34. DhcpFallbackRefreshParams(
  35. LPWSTR AdapterName
  36. );
  37. DWORD
  38. APIENTRY
  39. DhcpReleaseParameters(
  40. LPWSTR AdapterName
  41. );
  42. DWORD
  43. APIENTRY
  44. DhcpEnableDynamicConfig(
  45. LPWSTR AdapterName
  46. );
  47. DWORD
  48. APIENTRY
  49. DhcpDisableDynamicConfig(
  50. LPWSTR AdapterName
  51. );
  52. DWORD
  53. APIENTRY
  54. DhcpNotifyConfigChange(
  55. LPWSTR ServerName,
  56. LPWSTR AdapterName,
  57. BOOL IsNewIpAddress,
  58. DWORD IpIndex,
  59. DWORD IpAddress,
  60. DWORD SubnetMask,
  61. SERVICE_ENABLE DhcpServiceEnabled
  62. );
  63. #define NOTIFY_FLG_DO_DNS 0x01
  64. #define NOTIFY_FLG_RESET_IPADDR 0x02
  65. DWORD
  66. APIENTRY
  67. DhcpNotifyConfigChangeEx(
  68. IN LPWSTR ServerName,
  69. IN LPWSTR AdapterName,
  70. IN BOOL IsNewIpAddress,
  71. IN DWORD IpIndex,
  72. IN DWORD IpAddress,
  73. IN DWORD SubnetMask,
  74. IN SERVICE_ENABLE DhcpServiceEnabled,
  75. IN ULONG Flags
  76. );
  77. //
  78. // IP address lease apis for RAS .
  79. //
  80. typedef struct _DHCP_CLIENT_UID {
  81. LPBYTE ClientUID;
  82. DWORD ClientUIDLength;
  83. } DHCP_CLIENT_UID, *LPDHCP_CLIENT_UID;
  84. typedef struct _DHCP_LEASE_INFO {
  85. DHCP_CLIENT_UID ClientUID;
  86. DWORD IpAddress;
  87. DWORD SubnetMask;
  88. DWORD DhcpServerAddress;
  89. DWORD Lease;
  90. time_t LeaseObtained;
  91. time_t T1Time;
  92. time_t T2Time;
  93. time_t LeaseExpires;
  94. } DHCP_LEASE_INFO, *LPDHCP_LEASE_INFO;
  95. typedef struct _DHCP_OPTION_DATA {
  96. DWORD OptionID;
  97. DWORD OptionLen;
  98. LPBYTE Option;
  99. } DHCP_OPTION_DATA, *LPDHCP_OPTION_DATA;
  100. typedef struct _DHCP_OPTION_INFO {
  101. DWORD NumOptions;
  102. LPDHCP_OPTION_DATA OptionDataArray;
  103. } DHCP_OPTION_INFO, *LPDHCP_OPTION_INFO;
  104. typedef struct _DHCP_OPTION_LIST {
  105. DWORD NumOptions;
  106. LPWORD OptionIDArray;
  107. } DHCP_OPTION_LIST, *LPDHCP_OPTION_LIST;
  108. DWORD
  109. DhcpLeaseIpAddress(
  110. DWORD AdapterIpAddress,
  111. LPDHCP_CLIENT_UID ClientUID,
  112. DWORD DesiredIpAddress,
  113. LPDHCP_OPTION_LIST OptionList,
  114. LPDHCP_LEASE_INFO *LeaseInfo,
  115. LPDHCP_OPTION_INFO *OptionInfo
  116. );
  117. DWORD
  118. DhcpRenewIpAddressLease(
  119. DWORD AdapterIpAddress,
  120. LPDHCP_LEASE_INFO ClientLeaseInfo,
  121. LPDHCP_OPTION_LIST OptionList,
  122. LPDHCP_OPTION_INFO *OptionInfo
  123. );
  124. DWORD
  125. DhcpReleaseIpAddressLease(
  126. DWORD AdapterIpAddress,
  127. LPDHCP_LEASE_INFO ClientLeaseInfo
  128. );
  129. //DOC
  130. //DOC The following are the APIs needed for dhcp-class id UI.
  131. //DOC
  132. enum /* anonymous */ {
  133. DHCP_CLASS_INFO_VERSION_0 // first cut structure version
  134. };
  135. typedef struct _DHCP_CLASS_INFO {
  136. DWORD Version; // MUST BE DHCP_CLASS_INFO_VERSION_0
  137. LPWSTR ClassName; // Name of the Class.
  138. LPWSTR ClassDescr; // Description about the class
  139. LPBYTE ClassData; // byte stream on the wire data.
  140. DWORD ClassDataLen; // # of bytes in the ClassData (must be > 0)
  141. } DHCP_CLASS_INFO, *PDHCP_CLASS_INFO, *LPDHCP_CLASS_INFO;
  142. typedef
  143. DWORD
  144. (WINAPI *LPDHCPENUMCLASSES)(
  145. IN DWORD Flags,
  146. IN LPWSTR AdapterName,
  147. IN OUT DWORD *Size,
  148. IN OUT DHCP_CLASS_INFO *ClassesArray
  149. );
  150. //DOC DhcpEnumClasses enumerates the list of classes available on the system for configuration.
  151. //DOC This is predominantly going to be used by the NetUI. (in which case the ClassData part of the
  152. //DOC DHCP_CLASS_INFO structure is essentially useless).
  153. //DOC Note that Flags is used for future use.
  154. //DOC The AdapterName can currently be only GUIDs but may soon be EXTENDED to be IpAddress strings or
  155. //DOC h-w addresses or any other user friendly means of denoting the Adapter. Note that if the Adapter
  156. //DOC Name is NULL (not the empty string L""), then it refers to either ALL adapters.
  157. //DOC The Size parameter is an input/output parameter. The input value is the # of bytes of allocated
  158. //DOC space in the ClassesArray buffer. On return, the meaning of this value depends on the return value.
  159. //DOC If the function returns ERROR_SUCCESS, then, this parameter would return the # of elements in the
  160. //DOC array ClassesArray. If the function returns ERROR_MORE_DATA, then, this parameter refers to the
  161. //DOC # of bytes space that is actually REQUIRED to hold the information.
  162. //DOC In all other cases, the values in Size and ClassesArray dont mean anything.
  163. //DOC
  164. //DOC Return Values:
  165. //DOC ERROR_DEVICE_DOES_NOT_EXIST The AdapterName is illegal in the given context
  166. //DOC ERROR_INVALID_PARAMETER
  167. //DOC ERROR_MORE_DATA
  168. //DOC ERROR_FILE_NOT_FOUND The DHCP Client is not running and could not be started up.
  169. //DOC ERROR_NOT_ENOUGH_MEMORY This is NOT the same as ERROR_MORE_DATA
  170. //DOC Win32 errors
  171. //DOC
  172. //DOC Remarks:
  173. //DOC To notify DHCP that some class has changed, please use the DhcpHandlePnPEvent API.
  174. DWORD
  175. WINAPI
  176. DhcpEnumClasses( // enumerate the list of classes available
  177. IN DWORD Flags, // currently must be zero
  178. IN LPWSTR AdapterName, // currently must be AdapterGUID (cannot be NULL yet)
  179. IN OUT DWORD *Size, // input # of bytes available in BUFFER, output # of elements in array
  180. IN OUT DHCP_CLASS_INFO *ClassesArray // pre-allocated buffer
  181. );
  182. enum /* anonymous */ { // who are the recognized callers of this API
  183. DHCP_CALLER_OTHER = 0, // un-specified user, not one of below
  184. DHCP_CALLER_TCPUI, // the TcpIp UI
  185. DHCP_CALLER_RAS, // the RAS Api
  186. DHCP_CALLER_API, // some one else via DHCP API
  187. };
  188. enum /* anonymous */ { // supported structure versions..
  189. DHCP_PNP_CHANGE_VERSION_0 = 0 // first cut version structure
  190. };
  191. typedef struct _DHCP_PNP_CHANGE {
  192. DWORD Version; // MUST BE DHCP_PNP_CHANGE_VERSION_0
  193. BOOL DnsListChanged;// DNS Server list changed
  194. BOOL DomainChanged; // Domain Name changed
  195. BOOL HostNameChanged; // the DNS Host name changed..
  196. BOOL ClassIdChanged;// ClassId changed
  197. BOOL MaskChanged; // SubnetMask changed; CURRENTLY NOT USED
  198. BOOL GateWayChanged;// DefaultGateWay changed; CURRENTLY NOT USED
  199. BOOL RouteChanged; // some STATIC route changed; CURRENTLY NOT USED
  200. BOOL OptsChanged; // some options changed. CURRENTLY NOT USED
  201. BOOL OptDefsChanged;// some option definitions changed. CURRENTLY NOT USED
  202. BOOL DnsOptionsChanged; // some DNS specific options have changed.
  203. } DHCP_PNP_CHANGE, *PDHCP_PNP_CHANGE, *LPDHCP_PNP_CHANGE;
  204. typedef // this typedef SHOULD match the following declaration.
  205. DWORD
  206. (WINAPI FAR *LPDHCPHANDLEPNPEVENT)(
  207. IN DWORD Flags,
  208. IN DWORD Caller,
  209. IN LPWSTR AdapterName,
  210. IN LPDHCP_PNP_CHANGE Changes,
  211. IN LPVOID Reserved
  212. );
  213. //DOC DhcpHandlePnpEvent can be called as an API by any process (excepting that executing within the
  214. //DOC DHCP process itself) when any of the registry based configuration has changed and DHCP client has to
  215. //DOC re-read the registry. The Flags parameter is for future expansion.
  216. //DOC The AdapterName can currently be only GUIDs but may soon be EXTENDED to be IpAddress strings or
  217. //DOC h-w addresses or any other user friendly means of denoting the Adapter. Note that if the Adapter
  218. //DOC Name is NULL (not the empty string L""), then it refers to either GLOBAL parameters or ALL adapters
  219. //DOC depending on which BOOL has been set. (this may not get done for BETA2).
  220. //DOC The Changes structure gives the information on what changed.
  221. //DOC Currently, only a few of the defined BOOLs would be supported (for BETA2 NT5).
  222. //DOC
  223. //DOC Return Values:
  224. //DOC ERROR_DEVICE_DOES_NOT_EXIST The AdapterName is illegal in the given context
  225. //DOC ERROR_INVALID_PARAMETER
  226. //DOC ERROR_CALL_NOT_SUPPORTED The particular parameter that has changed is not completely pnp yet.
  227. //DOC Win32 errors
  228. DWORD
  229. WINAPI
  230. DhcpHandlePnPEvent(
  231. IN DWORD Flags, // MUST BE ZERO
  232. IN DWORD Caller, // currently must be DHCP_CALLER_TCPUI
  233. IN LPWSTR AdapterName, // currently must be the adapter GUID or NULL if global
  234. IN LPDHCP_PNP_CHANGE Changes, // specify what changed
  235. IN LPVOID Reserved // reserved for future use..
  236. );
  237. //================================================================================
  238. // end of file
  239. //================================================================================
  240. #endif