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.

482 lines
9.3 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. proto.h
  5. Abstract:
  6. This module contains the function prototypes for the DHCP client.
  7. Author:
  8. Manny Weiser (mannyw) 21-Oct-1992
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. Madan Appiah (madana) 21-Oct-1993
  13. --*/
  14. #ifndef _PROTO_
  15. #define _PROTO_
  16. //
  17. // OS independant functions
  18. //
  19. DWORD
  20. DhcpInitialize(
  21. LPDWORD SleepTime
  22. );
  23. DWORD
  24. ObtainInitialParameters(
  25. PDHCP_CONTEXT DhcpContext,
  26. PDHCP_OPTIONS DhcpOptions,
  27. BOOL *fAutoConfigure
  28. );
  29. DWORD
  30. RenewLease(
  31. PDHCP_CONTEXT DhcpContext,
  32. PDHCP_OPTIONS DhcpOptions
  33. );
  34. DWORD
  35. CalculateTimeToSleep(
  36. PDHCP_CONTEXT DhcpContext
  37. );
  38. DWORD
  39. ReObtainInitialParameters(
  40. PDHCP_CONTEXT DhcpContext,
  41. LPDWORD Sleep
  42. );
  43. BOOL
  44. DhcpIsInitState(
  45. DHCP_CONTEXT *pContext
  46. );
  47. DWORD
  48. ReRenewParameters(
  49. PDHCP_CONTEXT DhcpContext,
  50. LPDWORD Sleep
  51. );
  52. DWORD
  53. ReleaseIpAddress(
  54. PDHCP_CONTEXT DhcpContext
  55. );
  56. DWORD // status
  57. SendInformAndGetReplies( // send an inform packet and collect replies
  58. IN PDHCP_CONTEXT DhcpContext, // the context to send out of
  59. IN DWORD nInformsToSend,// how many informs to send?
  60. IN DWORD MaxAcksToWait // how many acks to wait for
  61. );
  62. DWORD
  63. InitializeDhcpSocket(
  64. SOCKET *Socket,
  65. DHCP_IP_ADDRESS IpAddress,
  66. BOOL IsApiCall // is it related to an API generated context?
  67. );
  68. DWORD
  69. HandleIPAutoconfigurationAddressConflict(
  70. DHCP_CONTEXT *pContext
  71. );
  72. DHCP_IP_ADDRESS // Ip address o/p after hashing
  73. GrandHashing(
  74. IN LPBYTE HwAddress, // Hardware addres of the card
  75. IN DWORD HwLen, // Hardware length
  76. IN OUT LPDWORD Seed, // In: orig value, Out: final value
  77. IN DHCP_IP_ADDRESS Mask, // Subnet mask to generate ip addr in
  78. IN DHCP_IP_ADDRESS Subnet // Subnet address to generate ip addr in
  79. );
  80. DWORD
  81. DhcpPerformIPAutoconfiguration(
  82. DHCP_CONTEXT *pContext
  83. );
  84. ULONG
  85. DhcpDynDnsGetDynDNSOption(
  86. IN OUT BYTE *OptBuf,
  87. IN OUT ULONG *OptBufSize,
  88. IN HKEY hAdapterKey,
  89. IN LPCWSTR AdapterName,
  90. IN BOOL fEnabled,
  91. IN LPCSTR DhcpDomainOption,
  92. IN ULONG DhcpDomainOptionSize
  93. );
  94. ULONG
  95. DhcpDynDnsDeregisterAdapter(
  96. IN HKEY hAdapterKey,
  97. IN LPCWSTR AdapterName,
  98. IN BOOL fRAS,
  99. IN BOOL fDynDnsEnabled
  100. );
  101. ULONG
  102. DhcpDynDnsRegisterDhcpOrRasAdapter(
  103. IN HKEY hAdapterKey,
  104. IN LPCWSTR AdapterName,
  105. IN BOOL fDynDnsEnabled,
  106. IN BOOL fRAS,
  107. IN ULONG IpAddress,
  108. IN LPBYTE DomOpt OPTIONAL,
  109. IN ULONG DomOptSize,
  110. IN LPBYTE DnsListOpt OPTIONAL,
  111. IN ULONG DnsListOptSize,
  112. IN LPBYTE DnsFQDNOpt,
  113. IN ULONG DnsFQDNOptSize
  114. );
  115. ULONG *
  116. DhcpCreateListFromStringAndFree(
  117. IN LPWSTR Str,
  118. IN LPWSTR Separation,
  119. OUT LPDWORD nAddresses
  120. );
  121. ULONG
  122. DhcpDynDnsRegisterStaticAdapter(
  123. IN HKEY hAdapterKey,
  124. IN LPCWSTR AdapterName,
  125. IN BOOL fRAS,
  126. IN BOOL fDynDnsEnabled
  127. );
  128. DWORD
  129. NotifyDnsCache(
  130. VOID
  131. );
  132. DWORD
  133. CalculateExpDelay(
  134. DWORD dwDelay,
  135. DWORD dwFuzz
  136. );
  137. //
  138. // OS specific functions
  139. //
  140. DWORD
  141. SystemInitialize(
  142. VOID
  143. );
  144. VOID
  145. ScheduleWakeUp(
  146. PDHCP_CONTEXT DhcpContext,
  147. DWORD TimeToSleep
  148. );
  149. DWORD
  150. SetDhcpConfigurationForNIC(
  151. PDHCP_CONTEXT DhcpContext,
  152. PDHCP_OPTIONS DhcpOptions,
  153. DHCP_IP_ADDRESS IpAddress,
  154. DHCP_IP_ADDRESS ServerIpAddress,
  155. DWORD PrevLeaseObtainedTime,
  156. BOOL ObtainedNewAddress
  157. );
  158. DWORD
  159. SetAutoConfigurationForNIC(
  160. PDHCP_CONTEXT DhcpContext,
  161. DHCP_IP_ADDRESS Address,
  162. DHCP_IP_ADDRESS Mask
  163. );
  164. DWORD
  165. SendDhcpMessage(
  166. PDHCP_CONTEXT DhcpContext,
  167. DWORD MessageLength,
  168. LPDWORD TransactionId
  169. );
  170. DWORD
  171. SendDhcpDecline(
  172. PDHCP_CONTEXT DhcpContext,
  173. DWORD dwTransactionId,
  174. DWORD dwServerIPAddress,
  175. DWORD dwDeclinedIPAddress
  176. );
  177. DWORD
  178. GetSpecifiedDhcpMessage(
  179. PDHCP_CONTEXT DhcpContext,
  180. PDWORD BufferLength,
  181. DWORD TransactionId,
  182. DWORD TimeToWait
  183. );
  184. DWORD
  185. OpenDhcpSocket(
  186. PDHCP_CONTEXT DhcpContext
  187. );
  188. DWORD
  189. CloseDhcpSocket(
  190. PDHCP_CONTEXT DhcpContext
  191. );
  192. DWORD
  193. InitializeInterface(
  194. PDHCP_CONTEXT DhcpContext
  195. );
  196. DWORD
  197. UninitializeInterface(
  198. PDHCP_CONTEXT DhcpContext
  199. );
  200. VOID
  201. DhcpLogEvent(
  202. PDHCP_CONTEXT DhcpContext,
  203. DWORD EventNumber,
  204. DWORD ErrorCode
  205. );
  206. BOOL
  207. NdisWanAdapter(
  208. PDHCP_CONTEXT DhcpContext
  209. );
  210. POPTION
  211. AppendOptionParamsRequestList(
  212. #if defined(__DHCP_CLIENT_OPTIONS_API_ENABLED__)
  213. PDHCP_CONTEXT DhcpContext,
  214. #endif
  215. POPTION Option,
  216. LPBYTE OptionEnd
  217. );
  218. DWORD
  219. InitEnvSpecificDhcpOptions(
  220. PDHCP_CONTEXT DhcpContext
  221. );
  222. DWORD
  223. ExtractEnvSpecificDhcpOption(
  224. PDHCP_CONTEXT DhcpContext,
  225. DHCP_OPTION_ID OptionId,
  226. LPBYTE OptionData,
  227. DWORD OptionDataLength
  228. );
  229. DWORD
  230. SetEnvSpecificDhcpOptions(
  231. PDHCP_CONTEXT DhcpContext
  232. );
  233. DWORD
  234. DisplayUserMessage(
  235. PDHCP_CONTEXT DhcpContext,
  236. DWORD MessageId,
  237. DHCP_IP_ADDRESS IpAddress
  238. );
  239. DWORD
  240. UpdateStatus(
  241. VOID
  242. );
  243. #ifdef VXD
  244. VOID // declspec(import) hoses vxd so work
  245. DhcpSleep( DWORD dwMilliseconds ) ; // around it
  246. #else
  247. #define DhcpSleep Sleep
  248. #endif
  249. DWORD
  250. IPSetInterface(
  251. DWORD IpInterfaceContext
  252. );
  253. DWORD
  254. IPResetInterface(
  255. DWORD IpInterfaceContext
  256. );
  257. DWORD SetIPAddressAndArp(
  258. PVOID pvLocalInformation,
  259. DWORD dwAddress,
  260. DWORD dwSubnetMask
  261. );
  262. DWORD BringUpInterface(
  263. PVOID pvLocalInformation
  264. );
  265. DWORD
  266. OpenDriver(
  267. HANDLE *Handle,
  268. LPWSTR DriverName
  269. );
  270. DWORD
  271. DhcpRegReadMachineType(void);
  272. #ifdef NEWNT
  273. DWORD
  274. DhcpRegPingingEnabled(PDHCP_CONTEXT);
  275. LPSTR
  276. DhcpGetDomainName(
  277. LPWSTR AdapterName,
  278. LPSTR Buf, DWORD Size);
  279. #endif
  280. #ifdef VXD
  281. VOID
  282. CleanupDhcpOptions(
  283. PDHCP_CONTEXT DhcpContext
  284. );
  285. #endif
  286. DWORD
  287. DhcpRegOkToUseInform(
  288. LPWSTR AdapterName
  289. );
  290. DWORD
  291. DhcpRegAutonetRetries(
  292. IN PDHCP_CONTEXT DhcpContext
  293. );
  294. // Media sense related common functions
  295. DWORD
  296. ProcessMediaConnectEvent(
  297. PDHCP_CONTEXT dhcpContext,
  298. IP_STATUS mediaStatus
  299. );
  300. DWORD // win32 status
  301. DhcpDestroyContext( // destroy this context and free relevant stuff
  302. IN PDHCP_CONTEXT DhcpContext // the context to destroy and free
  303. );
  304. //
  305. // dhcp/vxd common function with different implementations
  306. //
  307. LPWSTR // Adapter name string
  308. DhcpAdapterName( // get the adapter name string stored in the context
  309. IN PDHCP_CONTEXT DhcpContext
  310. );
  311. //
  312. // registry
  313. //
  314. DWORD // win32
  315. DhcpRegRecurseDelete( // delete the key, recursing downwards
  316. IN HKEY Key, // root at this key and
  317. IN LPWSTR KeyName // delete the key given by this keyname (and all its children)
  318. );
  319. BOOL // obtained a static address?
  320. DhcpRegDomainName( // get the static domain name if any
  321. IN PDHCP_CONTEXT DhcpContext, // adapter to get static domain for..
  322. IN OUT LPBYTE DomainNameBuf, // buffer to fill with static domain name
  323. IN ULONG BufSize // size of above buffer in bytes..
  324. );
  325. // protocol.c
  326. DWORD // status
  327. SendDhcpDiscover( // send a discover packet
  328. IN PDHCP_CONTEXT DhcpContext, // on this context
  329. IN OUT DWORD *pdwXid // use this Xid (if zero, fill something and return it)
  330. );
  331. DWORD // Time in seconds
  332. DhcpCalculateWaitTime( // how much time to wait
  333. IN DWORD RoundNum, // which round is this
  334. OUT DWORD *WaitMilliSecs // if needed the # in milli seconds
  335. );
  336. DWORD // status
  337. SendDhcpRequest( // send a dhcp request packet
  338. IN PDHCP_CONTEXT DhcpContext, // the context to send the packet on
  339. IN PDWORD pdwXid, // what is hte Xid to use?
  340. IN DWORD RequestedAddr, // what address do we want?
  341. IN DWORD SelectedServer,// is there a prefernce for a server?
  342. IN BOOL UseCiAddr // should CIADDR be set with desired address?
  343. );
  344. DWORD
  345. SendDhcpRelease(
  346. PDHCP_CONTEXT DhcpContext
  347. );
  348. typedef enum {
  349. DHCP_GATEWAY_UNREACHABLE = 0,
  350. DHCP_GATEWAY_REACHABLE,
  351. DHCP_GATEWAY_REQUEST_CANCELLED
  352. } DHCP_GATEWAY_STATUS;
  353. DHCP_GATEWAY_STATUS
  354. RefreshNotNeeded(
  355. IN PDHCP_CONTEXT DhcpContext
  356. );
  357. //
  358. // ioctl.c
  359. //
  360. DWORD
  361. IPDelNonPrimaryAddresses(
  362. LPWSTR AdapterName
  363. );
  364. DWORD
  365. GetIpInterfaceContext(
  366. LPWSTR AdapterName,
  367. DWORD IpIndex,
  368. LPDWORD IpInterfaceContext
  369. );
  370. //
  371. // dhcp.c
  372. //
  373. DWORD
  374. LockDhcpContext(
  375. PDHCP_CONTEXT DhcpContext,
  376. BOOL bCancelOngoingRequest
  377. );
  378. BOOL
  379. UnlockDhcpContext(
  380. PDHCP_CONTEXT DhcpContext
  381. );
  382. #endif // _PROTO_