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.

398 lines
5.6 KiB

  1. /********************************************************************/
  2. /** Copyright(c) 1989 Microsoft Corporation. **/
  3. /********************************************************************/
  4. //***
  5. //
  6. // Filename: util.h
  7. //
  8. // Description: Contains prototype of utility funtions and procedures
  9. //
  10. // History:
  11. // Oct 31,1993. NarenG Created original version.
  12. //
  13. #ifndef _UTIL_
  14. #define _UTIL_
  15. #include "lcp.h"
  16. DWORD
  17. AllocateAndInitBcb(
  18. PCB * pPcb
  19. );
  20. VOID
  21. NotifyCaller(
  22. IN PCB * pPcb,
  23. IN DWORD PppEvent,
  24. IN PVOID pData
  25. );
  26. VOID
  27. NotifyCallerOfFailureOnPort(
  28. IN HPORT hPort,
  29. IN BOOL fServer,
  30. IN DWORD dwRetCode
  31. );
  32. VOID
  33. NotifyCallerOfFailure(
  34. IN PCB * pPcb,
  35. IN DWORD dwRetCode
  36. );
  37. VOID
  38. InitRestartCounters(
  39. IN PCB * pPcb,
  40. IN CPCB * pCpCb
  41. );
  42. VOID
  43. HostToWireFormat16(
  44. IN WORD wHostFormat,
  45. IN OUT PBYTE pWireFormat
  46. );
  47. WORD
  48. WireToHostFormat16(
  49. IN PBYTE pWireFormat
  50. );
  51. VOID
  52. HostToWireFormat32(
  53. IN DWORD dwHostFormat,
  54. IN OUT PBYTE pWireFormat
  55. );
  56. DWORD
  57. WireToHostFormat32(
  58. IN PBYTE pWireFormat
  59. );
  60. DWORD
  61. HashPortToBucket(
  62. IN HPORT hPort
  63. );
  64. VOID
  65. InsertWorkItemInQ(
  66. IN PCB_WORK_ITEM * pWorkItem
  67. );
  68. VOID
  69. LogPPPEvent(
  70. IN DWORD dwEventId,
  71. IN DWORD dwData
  72. );
  73. DWORD
  74. GetCpIndexFromProtocol(
  75. IN DWORD dwProtocol
  76. );
  77. BOOL
  78. IsLcpOpened(
  79. PCB * pPcb
  80. );
  81. PCB *
  82. GetPCBPointerFromhPort(
  83. IN HPORT hPort
  84. );
  85. BCB *
  86. GetBCBPointerFromhConnection(
  87. IN HCONN hConnection
  88. );
  89. DWORD
  90. NumLinksInBundle(
  91. IN BCB * pBcb
  92. );
  93. PCB *
  94. GetPCBPointerFromBCB(
  95. IN BCB * pBcb
  96. );
  97. DWORD
  98. AreNCPsDone(
  99. IN PCB * pPcb,
  100. IN DWORD CpIndex,
  101. IN OUT PPP_PROJECTION_RESULT * pProjectionResult,
  102. IN OUT BOOL * pfNCPsAreDone
  103. );
  104. BYTE
  105. GetUId(
  106. IN PCB * pPcb,
  107. IN DWORD CpIndex
  108. );
  109. VOID
  110. AlertableWaitForSingleObject(
  111. IN HANDLE hObject
  112. );
  113. BOOL
  114. NotifyIPCPOfNBFCPProjection(
  115. IN PCB * pPcb,
  116. IN DWORD CpIndex
  117. );
  118. DWORD
  119. CalculateRestartTimer(
  120. IN HPORT hPort
  121. );
  122. VOID
  123. CheckCpsForInactivity(
  124. IN PCB * pPcb,
  125. IN DWORD dwEvent
  126. );
  127. CHAR*
  128. DecodePw(
  129. IN CHAR chSeed,
  130. IN OUT CHAR* pszPassword
  131. );
  132. CHAR*
  133. EncodePw(
  134. IN CHAR chSeed,
  135. IN OUT CHAR* pszPassword
  136. );
  137. VOID
  138. GetLocalComputerName(
  139. IN OUT LPSTR szComputerName
  140. );
  141. DWORD
  142. InitEndpointDiscriminator(
  143. IN OUT BYTE EndPointDiscriminator[]
  144. );
  145. VOID
  146. DeallocateAndRemoveBcbFromTable(
  147. IN BCB * pBcb
  148. );
  149. VOID
  150. RemovePcbFromTable(
  151. IN PCB * pPcb
  152. );
  153. BOOL
  154. WillPortBeBundled(
  155. IN PCB * pPcb
  156. );
  157. DWORD
  158. TryToBundleWithAnotherLink(
  159. IN PCB * pPcb
  160. );
  161. VOID
  162. AdjustHTokenImpersonateUser(
  163. IN PCB * pPcb
  164. );
  165. BOOL
  166. FLinkDiscriminatorIsUnique(
  167. IN PCB * pPcb,
  168. OUT DWORD * pdwLinkDisc
  169. );
  170. DWORD
  171. InitializeNCPs(
  172. IN PCB * pPcb,
  173. IN DWORD dwConfigMask
  174. );
  175. CPCB *
  176. GetPointerToCPCB(
  177. IN PCB * pPcb,
  178. IN DWORD CpIndex
  179. );
  180. DWORD
  181. GetNewPortOrBundleId(
  182. VOID
  183. );
  184. NCP_PHASE
  185. QueryBundleNCPState(
  186. IN PCB * pPcb
  187. );
  188. VOID
  189. NotifyCallerOfBundledProjection(
  190. IN PCB * pPcb
  191. );
  192. VOID
  193. StartNegotiatingNCPs(
  194. IN PCB * pPcb
  195. );
  196. VOID
  197. StartAutoDisconnectForPort(
  198. IN PCB * pPcb
  199. );
  200. VOID
  201. StartLCPEchoForPort(
  202. IN PCB * pPcb
  203. );
  204. VOID
  205. NotifyCompletionOnBundledPorts(
  206. IN PCB * pPcb
  207. );
  208. VOID
  209. RemoveNonNumerals(
  210. IN CHAR* szString
  211. );
  212. CHAR*
  213. TextualSidFromPid(
  214. DWORD dwPid
  215. );
  216. DWORD
  217. GetRouterPhoneBook(
  218. CHAR** pszPhonebookPath
  219. );
  220. DWORD
  221. GetCredentialsFromInterface(
  222. PCB * pPcb
  223. );
  224. BOOL
  225. IsCpIndexOfAp(
  226. IN DWORD CpIndex
  227. );
  228. VOID
  229. StopAccounting(
  230. PVOID pContext
  231. );
  232. VOID
  233. InterimAccounting(
  234. PVOID pContext
  235. );
  236. VOID
  237. StartAccounting(
  238. PVOID pContext
  239. );
  240. PBYTE
  241. GetClientInterfaceInfo(
  242. IN PCB * pPcb
  243. );
  244. VOID
  245. LoadParserDll(
  246. IN HKEY hKeyPpp
  247. );
  248. DWORD
  249. PortSendOrDisconnect(
  250. IN PCB * pPcb,
  251. IN DWORD cbPacket
  252. );
  253. VOID
  254. ReceiveViaParser(
  255. IN PCB * pPcb,
  256. IN PPP_PACKET * pPacket,
  257. IN DWORD dwPacketLength
  258. );
  259. DWORD
  260. GetSecondsSince1970(
  261. VOID
  262. );
  263. BOOL
  264. IsPschedRunning(
  265. VOID
  266. );
  267. VOID
  268. PppLog(
  269. IN DWORD DbgLevel,
  270. ...
  271. );
  272. VOID
  273. LogPPPPacket(
  274. IN BOOL fReceived,
  275. IN PCB * pPcb,
  276. IN PPP_PACKET * pPacket,
  277. IN DWORD cbPacket
  278. );
  279. VOID
  280. CreateAccountingAttributes(
  281. IN PCB * pPcb
  282. );
  283. VOID
  284. MakeStartAccountingCall(
  285. IN PCB * pPcb
  286. );
  287. VOID
  288. MakeStopOrInterimAccountingCall(
  289. IN PCB * pPcb,
  290. IN BOOL fInterimAccounting
  291. );
  292. RAS_AUTH_ATTRIBUTE *
  293. GetUserAttributes(
  294. PCB * pPcb
  295. );
  296. #define BYTESPERLINE 16
  297. #ifdef MEM_LEAK_CHECK
  298. #define PPP_MEM_TABLE_SIZE 100
  299. PVOID PppMemTable[PPP_MEM_TABLE_SIZE];
  300. #define LOCAL_ALLOC DebugAlloc
  301. #define LOCAL_FREE DebugFree
  302. #define LOCAL_REALLOC DebugReAlloc
  303. LPVOID
  304. DebugAlloc( DWORD Flags, DWORD dwSize );
  305. BOOL
  306. DebugFree( PVOID pMem );
  307. LPVOID
  308. DebugReAlloc( PVOID pMem, DWORD dwSize );
  309. #else
  310. #define LOCAL_ALLOC(Flags,dwSize) HeapAlloc( PppConfigInfo.hHeap, \
  311. HEAP_ZERO_MEMORY, dwSize )
  312. #define LOCAL_FREE(hMem) HeapFree( PppConfigInfo.hHeap, 0, hMem )
  313. #define LOCAL_REALLOC(hMem,dwSize) HeapReAlloc( PppConfigInfo.hHeap, \
  314. HEAP_ZERO_MEMORY,hMem,dwSize)
  315. #endif
  316. #define PPP_ASSERT RTASSERT
  317. #endif