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.

401 lines
6.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. #include <madcapcl.h>
  17. #undef DhcpAllocateMemory
  18. #undef DhcpFreeMemory
  19. //
  20. // network.c
  21. //
  22. DHCP_IP_ADDRESS
  23. DhcpDefaultSubnetMask(
  24. DHCP_IP_ADDRESS IpAddress
  25. );
  26. //
  27. // dhcp.c
  28. //
  29. PVOID
  30. DhcpAllocateMemory(
  31. DWORD Size
  32. );
  33. VOID
  34. DhcpFreeMemory(
  35. PVOID Memory
  36. );
  37. #if DBG
  38. #ifndef DEBUG_ALLOC
  39. #define DEBUG_ALLOC 0x02000000
  40. #endif
  41. PVOID _inline
  42. DhcpAllocateMemoryEx(
  43. DWORD Size,
  44. DWORD LineNo,
  45. LPSTR FileName
  46. ) {
  47. LPVOID Ptr = DhcpAllocateMemory(Size);
  48. DhcpPrint((DEBUG_ALLOC, "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((DEBUG_ALLOC, "Free %010x %04x %04d %s\n", Ptr, 0, LineNo, FileName));
  59. }
  60. #define DhcpAllocateMemory(Sz) DhcpAllocateMemoryEx(Sz, __LINE__, __FILE__)
  61. #define DhcpFreeMemory(Ptr) DhcpFreeMemoryEx(Ptr, __LINE__, __FILE__)
  62. #endif
  63. LPOPTION
  64. DhcpAppendOption(
  65. LPOPTION Option,
  66. BYTE OptionType,
  67. PVOID OptionValue,
  68. ULONG OptionLength,
  69. LPBYTE OptionEnd
  70. );
  71. WIDE_OPTION UNALIGNED *
  72. AppendWideOption(
  73. WIDE_OPTION UNALIGNED *Option,
  74. WORD OptionType,
  75. PVOID OptionValue,
  76. WORD OptionLength,
  77. LPBYTE OptionEnd
  78. );
  79. WIDE_OPTION UNALIGNED *
  80. AppendMadcapAddressList(
  81. WIDE_OPTION UNALIGNED *Option,
  82. DWORD UNALIGNED *AddrList,
  83. WORD AddrCount,
  84. LPBYTE OptionEnd
  85. );
  86. DWORD
  87. ExpandMadcapAddressList(
  88. PBYTE AddrRangeList,
  89. WORD AddrRangeListSize,
  90. DWORD UNALIGNED *ExpandList,
  91. WORD *ExpandListSize
  92. );
  93. LPOPTION
  94. DhcpAppendClientIDOption(
  95. LPOPTION Option,
  96. BYTE ClientHWType,
  97. LPBYTE ClientHWAddr,
  98. BYTE ClientHWAddrLength,
  99. LPBYTE OptionEnd
  100. );
  101. LPBYTE
  102. DhcpAppendMagicCookie(
  103. LPBYTE Option,
  104. LPBYTE OptionEnd
  105. );
  106. LPOPTION
  107. DhcpAppendEnterpriseName(
  108. LPOPTION Option,
  109. PCHAR DSEnterpriseName,
  110. LPBYTE OptionEnd
  111. );
  112. DATE_TIME
  113. DhcpCalculateTime(
  114. DWORD RelativeTime
  115. );
  116. DATE_TIME
  117. DhcpGetDateTime(
  118. VOID
  119. );
  120. DWORD
  121. DhcpReportEventW(
  122. LPWSTR Source,
  123. DWORD EventID,
  124. DWORD EventType,
  125. DWORD NumStrings,
  126. DWORD DataLength,
  127. LPWSTR *Strings,
  128. LPVOID Data
  129. );
  130. DWORD
  131. DhcpReportEventA(
  132. LPWSTR Source,
  133. DWORD EventID,
  134. DWORD EventType,
  135. DWORD NumStrings,
  136. DWORD DataLength,
  137. LPSTR *Strings,
  138. LPVOID Data
  139. );
  140. DWORD
  141. DhcpLogUnknownOption(
  142. LPWSTR Source,
  143. DWORD EventID,
  144. LPOPTION Option
  145. );
  146. VOID
  147. DhcpCancelWaitableTimer(
  148. HANDLE TimerHandle
  149. );
  150. DWORD
  151. DhcpStartWaitableTimer(
  152. HANDLE TimerHandle,
  153. DWORD SleepTime);
  154. //
  155. // convert.c
  156. //
  157. LPWSTR
  158. DhcpOemToUnicodeN(
  159. IN LPSTR Ansi,
  160. IN OUT LPWSTR Unicode,
  161. IN USHORT cChars
  162. );
  163. LPWSTR
  164. DhcpOemToUnicode(
  165. IN LPSTR Ansi,
  166. IN OUT LPWSTR Unicode
  167. );
  168. LPSTR
  169. DhcpUnicodeToOem(
  170. IN LPWSTR Unicode,
  171. IN LPSTR Ansi
  172. );
  173. ULONG
  174. DhcpUnicodeToOemSize(
  175. IN LPWSTR Unicode
  176. );
  177. DWORD
  178. ConvertUTF8ToUnicode(
  179. LPBYTE UTF8String,
  180. DWORD UTF8Length,
  181. LPWSTR UnicodeString,
  182. DWORD UnicodeLength
  183. );
  184. DWORD
  185. ConvertUnicodeToUTF8(
  186. LPWSTR UnicodeString,
  187. DWORD UnicodeLength,
  188. LPBYTE UTF8String,
  189. DWORD UTF8Length
  190. );
  191. #if 0
  192. VOID
  193. DhcpIpAddressToString(
  194. LPWSTR Buffer,
  195. DWORD HexNumber
  196. );
  197. VOID
  198. DhcpStringToIpAddress(
  199. LPSTR Buffer,
  200. LPDHCP_IP_ADDRESS IpAddress,
  201. BOOL NetOrder
  202. );
  203. #endif
  204. VOID
  205. DhcpHexToString(
  206. LPWSTR Buffer,
  207. LPBYTE HexNumber,
  208. DWORD Length
  209. );
  210. VOID
  211. DhcpHexToAscii(
  212. LPSTR Buffer,
  213. LPBYTE HexNumber,
  214. DWORD Length
  215. );
  216. VOID
  217. DhcpDecimalToString(
  218. LPWSTR Buffer,
  219. BYTE Number
  220. );
  221. DWORD
  222. DhcpDottedStringToIpAddress(
  223. LPSTR String
  224. );
  225. LPSTR
  226. DhcpIpAddressToDottedString(
  227. DWORD IpAddress
  228. );
  229. DWORD
  230. DhcpStringToHwAddress(
  231. LPSTR AddressBuffer,
  232. LPSTR AddressString
  233. );
  234. #if 0
  235. DHCP_IP_ADDRESS
  236. DhcpHostOrder(
  237. DHCP_IP_ADDRESS NetworkOrderAddress
  238. );
  239. DHCP_IP_ADDRESS
  240. DhcpNetworkOrder(
  241. DHCP_IP_ADDRESS NetworkOrderAddress
  242. );
  243. #endif
  244. LPWSTR
  245. DhcpRegIpAddressToKey(
  246. DHCP_IP_ADDRESS IpAddress,
  247. LPWSTR KeyBuffer
  248. );
  249. DWORD
  250. DhcpRegKeyToIpAddress(
  251. LPWSTR Key
  252. );
  253. LPWSTR
  254. DhcpRegOptionIdToKey(
  255. DHCP_OPTION_ID OptionId,
  256. LPWSTR KeyBuffer
  257. );
  258. DHCP_OPTION_ID
  259. DhcpRegKeyToOptionId(
  260. LPWSTR Key
  261. );
  262. #if DBG
  263. VOID
  264. DhcpDumpMessage(
  265. DWORD DhcpDebugFlag,
  266. LPDHCP_MESSAGE DhcpMessage,
  267. ULONG MessageSize
  268. );
  269. VOID
  270. MadcapDumpMessage(
  271. DWORD DhcpDebugFlag,
  272. LPMADCAP_MESSAGE MadcapMessage,
  273. ULONG MessageSize
  274. );
  275. VOID
  276. DhcpAssertFailed(
  277. LPSTR FailedAssertion,
  278. LPSTR FileName,
  279. DWORD LineNumber,
  280. LPSTR Message
  281. );
  282. #define DhcpAssert(Predicate) \
  283. { \
  284. if (!(Predicate)) \
  285. DhcpAssertFailed( #Predicate, __FILE__, __LINE__, NULL ); \
  286. }
  287. #define DhcpVerify(Predicate) \
  288. { \
  289. if (!(Predicate)) \
  290. DhcpAssertFailed( #Predicate, __FILE__, __LINE__, NULL ); \
  291. }
  292. #else
  293. #define DhcpAssert(_x_)
  294. #define DhcpDumpMessage(_x_, _y_, _z_)
  295. #define MadcapDumpMessage(_x_, _y_, _z_)
  296. #define DhcpVerify(_x_) (_x_)
  297. #endif // not DBG
  298. VOID
  299. DhcpNTToNTPTime(
  300. LPDATE_TIME AbsNTTime,
  301. DWORD Offset,
  302. PULONG NTPTimeStamp
  303. );
  304. VOID
  305. DhcpNTPToNTTime(
  306. PULONG NTPTimeStamp,
  307. DWORD Offset,
  308. DATE_TIME *NTTime
  309. );
  310. #endif DHCPLIB_H_INCLUDED
  311. //------------------------------------------------------------------------
  312. // End of file
  313. //------------------------------------------------------------------------