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.

471 lines
14 KiB

  1. /******************************************************************************
  2. *
  3. * INTEL Corporation Proprietary Information
  4. * Copyright (c) 1994, 1995, 1996 Intel Corporation.
  5. *
  6. * This listing is supplied under the terms of a license agreement
  7. * with INTEL Corporation and may not be used, copied, nor disclosed
  8. * except in accordance with the terms of that agreement.
  9. *
  10. *****************************************************************************/
  11. /******************************************************************************
  12. *
  13. * $Workfile: h245init.c $
  14. * $Revision: 1.2 $
  15. * $Modtime: 29 May 1996 13:12:46 $
  16. * $Log: S:/STURGEON/SRC/H245/SRC/VCS/h245init.c_v $
  17. *
  18. * Rev 1.2 29 May 1996 15:20:18 EHOWARDX
  19. * Change to use HRESULT.
  20. *
  21. * Rev 1.1 28 May 1996 14:25:40 EHOWARDX
  22. * Tel Aviv update.
  23. *
  24. * Rev 1.0 09 May 1996 21:06:22 EHOWARDX
  25. * Initial revision.
  26. *
  27. * Rev 1.16 09 May 1996 19:35:34 EHOWARDX
  28. * Added new locking logic and changed timer.
  29. *
  30. * Rev 1.15 09 Apr 1996 15:53:36 dabrown1
  31. *
  32. * Added srflush.x for queue flush bitmap
  33. *
  34. * Rev 1.14 05 Apr 1996 10:56:58 dabrown1
  35. * Asynchronous/Synchronous shutdown support
  36. *
  37. * Rev 1.13 04 Apr 1996 18:17:06 dabrown1
  38. *
  39. * - changed parameter for DeInitTimer..
  40. *
  41. * Rev 1.12 02 Apr 1996 15:00:12 dabrown1
  42. *
  43. * SendRcv EndSession asynchronous support
  44. *
  45. * Rev 1.11 18 Mar 1996 12:36:28 cjutzi
  46. * - added timer init and de-init
  47. *
  48. * Rev 1.10 13 Mar 1996 15:08:26 helgebax
  49. * added Fsm_shutdown(Instance) to clear FSM context
  50. *
  51. * Rev 1.9 06 Mar 1996 13:10:42 DABROWN1
  52. * Flush send receive transmit buffers at system shutdown
  53. *
  54. * Rev 1.8 28 Feb 1996 17:23:38 EHOWARDX
  55. * Added #include "fsmexpor.h" for Fsm_init prototype.
  56. *
  57. * Rev 1.7 27 Feb 1996 13:41:56 DABROWN1
  58. * removed mal/h223 initialization code
  59. *
  60. * Rev 1.6 26 Feb 1996 11:17:36 cjutzi
  61. * - moved api_deinit.. to EndSystemClose
  62. *
  63. * Rev 1.5 21 Feb 1996 13:23:12 DABROWN1
  64. *
  65. * check return codes for SR and FSM on initialization
  66. *
  67. * Rev 1.4 13 Feb 1996 14:48:50 DABROWN1
  68. *
  69. * Removed SPOX only include files from mainline path
  70. *
  71. * Rev 1.3 09 Feb 1996 16:00:22 cjutzi
  72. *
  73. * - cleaned up the startup...
  74. * - added the mal and h223 startup to the configuration as was
  75. * determined to be correct.. (still some issues with handles)
  76. * $Ident$
  77. *
  78. *****************************************************************************/
  79. #ifndef STRICT
  80. #define STRICT
  81. #endif
  82. #include "precomp.h"
  83. /***********************/
  84. /* H245 INCLUDES */
  85. /***********************/
  86. #include "h245api.h"
  87. #include "h245com.h"
  88. #include "sr_api.h"
  89. //#include "h223api.h"
  90. #include "fsmexpor.h"
  91. #include "h245sys.x"
  92. #if defined(H324)
  93. /*****************************************************************************
  94. *
  95. * Type: LOCAL
  96. *
  97. * PROCEDURE: setup_from_H245_ini - setup using conmgr.ini file
  98. *
  99. * DESCRIPTION:
  100. *
  101. *****************************************************************************/
  102. static
  103. void setup_from_H245_ini (int *p_dbg_lvl)
  104. {
  105. char *p_ini = "h245.ini";
  106. char *p_H245 ="H245";
  107. p_ini = "h245.ini";
  108. p_H245 = "H245";
  109. #ifdef OIL
  110. OIL_GetPrivateProfileInt(p_H245, "TraceLvl", 0, p_ini, p_dbg_lvl);
  111. #else
  112. *p_dbg_lvl = GetPrivateProfileInt (p_H245, "TraceLvl", 0, p_ini);
  113. #endif
  114. }
  115. #endif // (H324)
  116. /*****************************************************************************
  117. *
  118. * Type: GLOBAL
  119. *
  120. * PROCEDURE: StartSystemInitilize - Initialize Sub Systems
  121. *
  122. * DESCRIPTION:
  123. *
  124. * This is called on entry to the H245_Init API Call
  125. *
  126. *
  127. * This procedure initializes all the subsystems in H245. Errors
  128. * must be mapped to an appropriate H245_ERROR_xxx allowing the
  129. * initialization error to be propogated to through the API to the
  130. * H245 Client. As your subsystem initializes, if errors occur
  131. * you are responsable for doing the mapping from your subsystem to
  132. * the appropriate H245_ERROR_xxx. If there is no appropriate error
  133. * please contact the programmer in charge of the API indicating
  134. * your new error return value so that h245api.h can be updated,
  135. * as well as the new error documented in the API/EPS..
  136. *
  137. *
  138. * returns - H245_ERROR_OK if no error has occured..
  139. * returns - H245_ERROR_xxxx indicating error
  140. *
  141. *****************************************************************************/
  142. DWORD StartSystemInit (struct InstanceStruct *pInstance)
  143. {
  144. HRESULT lError;
  145. /* Timer Initialization */
  146. // H245InitTimer(pInstance);
  147. /* API Subsystem Initialization */
  148. lError = api_init(pInstance);
  149. if (lError != H245_ERROR_OK)
  150. return lError;
  151. /* Send Receive Subsystem Initialization */
  152. lError = sendRcvInit(pInstance);
  153. if (lError != H245_ERROR_OK)
  154. return lError;
  155. /* State Machine Subsystem Initialization */
  156. return Fsm_init(pInstance);
  157. }
  158. /*****************************************************************************
  159. *
  160. * Type: GLOBAL
  161. *
  162. * PROCEDURE: EndSystemInitilize - Initialize Sub Systems
  163. *
  164. * DESCRIPTION:
  165. *
  166. * This is called on exit from H245 System Initialization
  167. *
  168. *
  169. * This procedure initializes all the subsystems in H245. Errors
  170. * must be mapped to an appropriate H245_ERROR_xxx allowing the
  171. * initialization error to be propogated to through the API to the
  172. * H245 Client. As your subsystem initializes, if errors occur
  173. * you are responsable for doing the mapping from your subsystem to
  174. * the appropriate H245_ERROR_xxx. If there is no appropriate error
  175. * please contact the programmer in charge of the API indicating
  176. * your new error return value so that h245api.h can be updated,
  177. * as well as the new error documented in the API/EPS..
  178. *
  179. *
  180. * returns - H245_ERROR_OK if no error has occured..
  181. * returns - H245_ERROR_xxxx indicating error
  182. *
  183. *****************************************************************************/
  184. DWORD EndSystemInit (struct InstanceStruct *pInstance)
  185. {
  186. /* API Subsystem Initialization */
  187. // -- TBD
  188. /* Send Receive Subsystem Initialization */
  189. // -- TBD
  190. /* State Machine Subsystem Initialization */
  191. // -- TBD
  192. return H245_ERROR_OK;
  193. }
  194. /*****************************************************************************
  195. *
  196. * Type: GLOBAL
  197. *
  198. * PROCEDURE: StartSessionClose
  199. *
  200. * DESCRIPTION:
  201. *
  202. * This procedure is called when H245_Shutdown occurs
  203. *
  204. * Errors must be mapped to an appropriate H245_ERROR_xxx allowing the
  205. * initialization error to be propogated to through the API to the
  206. * H245 Client. As your subsystem initializes, if errors occur
  207. * you are responsable for doing the mapping from your subsystem to
  208. * the appropriate H245_ERROR_xxx. If there is no appropriate error
  209. * please contact the programmer in charge of the API indicating
  210. * your new error return value so that h245api.h can be updated,
  211. * as well as the new error documented in the API/EPS..
  212. *
  213. *
  214. * returns - H245_ERROR_OK if no error has occured..
  215. * returns - H245_ERROR_xxxx indicating error
  216. *
  217. *****************************************************************************/
  218. DWORD StartSystemClose (struct InstanceStruct *pInstance)
  219. {
  220. /* API Subsystem Shutdown Initiation */
  221. // TBD
  222. /* Send Receive Shutdown Initiation */
  223. // TBD
  224. /* State Machine Shutdown Initiation */
  225. Fsm_shutdown(pInstance);
  226. return (H245_ERROR_OK);
  227. }
  228. /*****************************************************************************
  229. *
  230. * Type: GLOBAL
  231. *
  232. * PROCEDURE: StartSessionClose
  233. *
  234. * DESCRIPTION:
  235. *
  236. * This procedure is called when H245_Shutdown completes asynchroniously.
  237. *
  238. * Errors must be mapped to an appropriate H245_ERROR_xxx allowing the
  239. * initialization error to be propogated to through the API to the
  240. * H245 Client. As your subsystem initializes, if errors occur
  241. * you are responsable for doing the mapping from your subsystem to
  242. * the appropriate H245_ERROR_xxx. If there is no appropriate error
  243. * please contact the programmer in charge of the API indicating
  244. * your new error return value so that h245api.h can be updated,
  245. * as well as the new error documented in the API/EPS..
  246. *
  247. *
  248. * returns - H245_ERROR_OK if no error has occured..
  249. * returns - H245_ERROR_xxxx indicating error
  250. *
  251. *****************************************************************************/
  252. DWORD EndSystemClose (struct InstanceStruct *pInstance)
  253. {
  254. /* Send Receive Shutdown Completion */
  255. sendRcvShutdown(pInstance);
  256. /* API Subsystem Shutdown Completion */
  257. api_deinit(pInstance);
  258. /* State Machine Shutdown Completion */
  259. // -- TBD
  260. /* Timer Shutdown */
  261. // H245DeInitTimer(pInstance);
  262. return (H245_ERROR_OK);
  263. }
  264. /*****************************************************************************
  265. *
  266. * Type: GLOBAL
  267. *
  268. * PROCEDURE: StartSessionInit
  269. *
  270. * DESCRIPTION:
  271. *
  272. * This procedure is called when an H245_BeginConnection is called.
  273. *
  274. * Errors must be mapped to an appropriate H245_ERROR_xxx allowing the
  275. * initialization error to be propogated to through the API to the
  276. * H245 Client. As your subsystem initializes, if errors occur
  277. * you are responsable for doing the mapping from your subsystem to
  278. * the appropriate H245_ERROR_xxx. If there is no appropriate error
  279. * please contact the programmer in charge of the API indicating
  280. * your new error return value so that h245api.h can be updated,
  281. * as well as the new error documented in the API/EPS..
  282. *
  283. *
  284. * returns - H245_ERROR_OK if no error has occured..
  285. * returns - H245_ERROR_xxxx indicating error
  286. *
  287. *****************************************************************************/
  288. DWORD StartSessionInit (struct InstanceStruct *pInstance)
  289. {
  290. /* API Subsystem Initialization */
  291. /* Send Receive Initialization */
  292. /* State Machine Initialization */
  293. return H245_ERROR_OK;
  294. }
  295. /*****************************************************************************
  296. *
  297. * Type: GLOBAL
  298. *
  299. * PROCEDURE: EndSessionInit
  300. *
  301. * DESCRIPTION:
  302. *
  303. * This procedure is called when an H245_BeginConnection call is
  304. * completed.. Asynchroniously.
  305. *
  306. * Errors must be mapped to an appropriate H245_ERROR_xxx allowing the
  307. * initialization error to be propogated to through the API to the
  308. * H245 Client. As your subsystem initializes, if errors occur
  309. * you are responsable for doing the mapping from your subsystem to
  310. * the appropriate H245_ERROR_xxx. If there is no appropriate error
  311. * please contact the programmer in charge of the API indicating
  312. * your new error return value so that h245api.h can be updated,
  313. * as well as the new error documented in the API/EPS..
  314. *
  315. *
  316. * returns - H245_ERROR_OK if no error has occured..
  317. * returns - H245_ERROR_xxxx indicating error
  318. *
  319. *****************************************************************************/
  320. DWORD EndSessionInit (struct InstanceStruct *pInstance)
  321. {
  322. /* API Subsystem Initialization */
  323. /* Send Receive Initialization */
  324. /* Master Slave Initialization */
  325. return H245_ERROR_OK;
  326. }
  327. /*****************************************************************************
  328. *
  329. * Type: GLOBAL
  330. *
  331. * PROCEDURE: StartSessionClose
  332. *
  333. * DESCRIPTION:
  334. *
  335. * This procedure is called when H245_EndConnection occurs
  336. *
  337. * Errors must be mapped to an appropriate H245_ERROR_xxx allowing the
  338. * initialization error to be propogated to through the API to the
  339. * H245 Client. As your subsystem initializes, if errors occur
  340. * you are responsable for doing the mapping from your subsystem to
  341. * the appropriate H245_ERROR_xxx. If there is no appropriate error
  342. * please contact the programmer in charge of the API indicating
  343. * your new error return value so that h245api.h can be updated,
  344. * as well as the new error documented in the API/EPS..
  345. *
  346. *
  347. * returns - H245_ERROR_OK if no error has occured..
  348. * returns - H245_ERROR_xxxx indicating error
  349. *
  350. *****************************************************************************/
  351. DWORD StartSessionClose (struct InstanceStruct *pInstance)
  352. {
  353. /* API Subsystem Session Close */
  354. /* Send Receive Session Close */
  355. /* Dequeue any buffers posted in the data link transmit queue */
  356. if (H245_ERROR_OK != sendRcvFlushPDUs(
  357. pInstance,
  358. DATALINK_TRANSMIT,
  359. TRUE))
  360. {
  361. H245TRACE(pInstance->dwInst, 1, "Flush Buffer Failure");
  362. }
  363. /* State Machine Session Close */
  364. return H245_ERROR_OK;
  365. }
  366. /*****************************************************************************
  367. *
  368. * Type: GLOBAL
  369. *
  370. * PROCEDURE: EndSessionClose
  371. *
  372. * DESCRIPTION:
  373. *
  374. * This procedure is called when H245_EndConnection completes
  375. * asynchroniously.
  376. *
  377. * Errors must be mapped to an appropriate H245_ERROR_xxx allowing the
  378. * initialization error to be propogated to through the API to the
  379. * H245 Client. As your subsystem initializes, if errors occur
  380. * you are responsable for doing the mapping from your subsystem to
  381. * the appropriate H245_ERROR_xxx. If there is no appropriate error
  382. * please contact the programmer in charge of the API indicating
  383. * your new error return value so that h245api.h can be updated,
  384. * as well as the new error documented in the API/EPS..
  385. *
  386. *
  387. * returns - H245_ERROR_OK if no error has occured..
  388. * returns - H245_ERROR_xxxx indicating error
  389. *
  390. *****************************************************************************/
  391. DWORD EndSessionClose (struct InstanceStruct *pInstance)
  392. {
  393. /* API Subsystem Session Close */
  394. /* Send Receive Session Close */
  395. /* State Machine Session Close */
  396. return H245_ERROR_OK;
  397. }