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.

345 lines
5.2 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. dhcplib.h
  5. Abstract:
  6. This file contains proto type definitions for the dhcp lib
  7. functions.
  8. Author:
  9. Madan Appiah (madana) 12-Aug-1993
  10. Environment:
  11. User Mode - Win32 - MIDL
  12. Revision History:
  13. --*/
  14. #ifndef DHCPLIB_H_INCLUDED
  15. #define DHCPLIB_H_INCLUDED
  16. #define DhcpAllocateMemory(x) ALLOCATE_MEMORY(LPTR,(x))
  17. #define DhcpFreeMemory(x) FREE_MEMORY(x)
  18. //
  19. // network.c
  20. //
  21. DHCP_IP_ADDRESS
  22. DhcpDefaultSubnetMask(
  23. DHCP_IP_ADDRESS IpAddress
  24. );
  25. //
  26. // dhcp.c
  27. //
  28. /*PVOID
  29. DhcpAllocateMemory(
  30. DWORD Size
  31. );
  32. VOID
  33. DhcpFreeMemory(
  34. PVOID Memory
  35. );*/
  36. #if DBG
  37. #ifndef DEBUG_ALLOC
  38. #define DEBUG_ALLOC 0x02000000
  39. #endif
  40. /*
  41. PVOID _inline
  42. DhcpAllocateMemoryEx(
  43. DWORD Size,
  44. DWORD LineNo,
  45. LPSTR FileName
  46. ) {
  47. LPVOID Ptr = DhcpAllocateMemory(Size);
  48. DhcpPrint(("Allocate %010x %04x %04d %s\n", Ptr, Size, LineNo, FileName));
  49. return Ptr;
  50. }
  51. VOID _inline
  52. DhcpFreeMemoryEx(
  53. LPVOID Ptr,
  54. DWORD LineNo,
  55. LPSTR FileName
  56. ) {
  57. DhcpFreeMemory(Ptr);
  58. DhcpPrint("Free %010x %04x %04d %s\n", Ptr, 0, LineNo, FileName));
  59. }
  60. */
  61. //#define DhcpAllocateMemory(Sz) DhcpAllocateMemoryEx(Sz, __LINE__, __FILE__)
  62. //#define DhcpFreeMemory(Ptr) DhcpFreeMemoryEx(Ptr, __LINE__, __FILE__)
  63. #endif
  64. LPOPTION
  65. DhcpAppendOption(
  66. LPOPTION Option,
  67. BYTE OptionType,
  68. PVOID OptionValue,
  69. ULONG OptionLength,
  70. LPBYTE OptionEnd
  71. );
  72. LPOPTION
  73. DhcpAppendClientIDOption(
  74. LPOPTION Option,
  75. BYTE ClientHWType,
  76. LPBYTE ClientHWAddr,
  77. BYTE ClientHWAddrLength,
  78. LPBYTE OptionEnd
  79. );
  80. LPBYTE
  81. DhcpAppendMagicCookie(
  82. LPBYTE Option,
  83. LPBYTE OptionEnd
  84. );
  85. LPOPTION
  86. DhcpAppendEnterpriseName(
  87. LPOPTION Option,
  88. PCHAR DSEnterpriseName,
  89. LPBYTE OptionEnd
  90. );
  91. DATE_TIME
  92. DhcpCalculateTime(
  93. DWORD RelativeTime
  94. );
  95. DATE_TIME
  96. DhcpGetDateTime(
  97. VOID
  98. );
  99. DWORD
  100. DhcpReportEventW(
  101. LPWSTR Source,
  102. DWORD EventID,
  103. DWORD EventType,
  104. DWORD NumStrings,
  105. DWORD DataLength,
  106. LPWSTR *Strings,
  107. LPVOID Data
  108. );
  109. DWORD
  110. DhcpReportEventA(
  111. LPWSTR Source,
  112. DWORD EventID,
  113. DWORD EventType,
  114. DWORD NumStrings,
  115. DWORD DataLength,
  116. LPSTR *Strings,
  117. LPVOID Data
  118. );
  119. DWORD
  120. DhcpLogUnknownOption(
  121. LPWSTR Source,
  122. DWORD EventID,
  123. LPOPTION Option
  124. );
  125. VOID
  126. DhcpCancelWaitableTimer(
  127. HANDLE TimerHandle
  128. );
  129. DWORD
  130. DhcpStartWaitableTimer(
  131. HANDLE TimerHandle,
  132. DWORD SleepTime);
  133. //
  134. // convert.c
  135. //
  136. LPWSTR
  137. DhcpOemToUnicodeN(
  138. IN LPSTR Ansi,
  139. IN OUT LPWSTR Unicode,
  140. IN USHORT cChars
  141. );
  142. LPWSTR
  143. DhcpOemToUnicode(
  144. IN LPSTR Ansi,
  145. IN OUT LPWSTR Unicode
  146. );
  147. LPSTR
  148. DhcpUnicodeToOem(
  149. IN LPWSTR Unicode,
  150. IN LPSTR Ansi
  151. );
  152. #if 0
  153. VOID
  154. DhcpIpAddressToString(
  155. LPWSTR Buffer,
  156. DWORD HexNumber
  157. );
  158. VOID
  159. DhcpStringToIpAddress(
  160. LPSTR Buffer,
  161. LPDHCP_IP_ADDRESS IpAddress,
  162. BOOL NetOrder
  163. );
  164. #endif
  165. VOID
  166. DhcpHexToString(
  167. LPWSTR Buffer,
  168. LPBYTE HexNumber,
  169. DWORD Length
  170. );
  171. VOID
  172. DhcpHexToAscii(
  173. LPSTR Buffer,
  174. LPBYTE HexNumber,
  175. DWORD Length
  176. );
  177. VOID
  178. DhcpDecimalToString(
  179. LPWSTR Buffer,
  180. BYTE Number
  181. );
  182. DWORD
  183. DhcpDottedStringToIpAddress(
  184. LPSTR String
  185. );
  186. LPSTR
  187. DhcpIpAddressToDottedString(
  188. DWORD IpAddress
  189. );
  190. DWORD
  191. DhcpStringToHwAddress(
  192. LPSTR AddressBuffer,
  193. LPSTR AddressString
  194. );
  195. #if 0
  196. DHCP_IP_ADDRESS
  197. DhcpHostOrder(
  198. DHCP_IP_ADDRESS NetworkOrderAddress
  199. );
  200. DHCP_IP_ADDRESS
  201. DhcpNetworkOrder(
  202. DHCP_IP_ADDRESS NetworkOrderAddress
  203. );
  204. #endif
  205. LPWSTR
  206. DhcpRegIpAddressToKey(
  207. DHCP_IP_ADDRESS IpAddress,
  208. LPWSTR KeyBuffer
  209. );
  210. DWORD
  211. DhcpRegKeyToIpAddress(
  212. LPWSTR Key
  213. );
  214. LPWSTR
  215. DhcpRegOptionIdToKey(
  216. DHCP_OPTION_ID OptionId,
  217. LPWSTR KeyBuffer
  218. );
  219. DHCP_OPTION_ID
  220. DhcpRegKeyToOptionId(
  221. LPWSTR Key
  222. );
  223. #if 0 //DBG
  224. VOID
  225. DhcpDumpMessage(
  226. DWORD DhcpDebugFlag,
  227. LPDHCP_MESSAGE DhcpMessage
  228. );
  229. VOID
  230. DhcpAssertFailed(
  231. LPSTR FailedAssertion,
  232. LPSTR FileName,
  233. DWORD LineNumber,
  234. LPSTR Message
  235. );
  236. #define DhcpAssert(Predicate) \
  237. { \
  238. if (!(Predicate)) \
  239. DhcpAssertFailed( #Predicate, __FILE__, __LINE__, NULL ); \
  240. }
  241. #define DhcpVerify(Predicate) \
  242. { \
  243. if (!(Predicate)) \
  244. DhcpAssertFailed( #Predicate, __FILE__, __LINE__, NULL ); \
  245. }
  246. #else
  247. #define DhcpAssert(_x_)
  248. #define DhcpDumpMessage(_x_, _y_)
  249. #define DhcpVerify(_x_) (_x_)
  250. #endif // not DBG
  251. VOID
  252. DhcpNTToNTPTime(
  253. LPDATE_TIME AbsNTTime,
  254. DWORD Offset,
  255. PULONG NTPTimeStamp
  256. );
  257. VOID
  258. DhcpNTPToNTTime(
  259. PULONG NTPTimeStamp,
  260. DWORD Offset,
  261. DATE_TIME *NTTime
  262. );
  263. #endif DHCPLIB_H_INCLUDED
  264. //------------------------------------------------------------------------
  265. // End of file
  266. //------------------------------------------------------------------------