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.

390 lines
11 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: h245deb.c $
  14. * $Revision: 1.5 $
  15. * $Modtime: 14 Oct 1996 13:25:50 $
  16. * $Log: S:/STURGEON/SRC/H245/SRC/VCS/h245deb.c_v $
  17. *
  18. * Rev 1.5 14 Oct 1996 14:01:32 EHOWARDX
  19. * Unicode changes.
  20. *
  21. * Rev 1.4 14 Oct 1996 12:08:08 EHOWARDX
  22. * Backed out Mike's changes.
  23. *
  24. * Rev 1.3 01 Oct 1996 11:05:54 MANDREWS
  25. * Removed ISR_ trace statements for operation under Windows NT.
  26. *
  27. * Rev 1.2 01 Jul 1996 16:13:34 EHOWARDX
  28. * Changed to use wvsprintf to stop bounds checker from complaining
  29. * about too many arguements.
  30. *
  31. * Rev 1.1 28 May 1996 14:25:46 EHOWARDX
  32. * Tel Aviv update.
  33. *
  34. * Rev 1.0 09 May 1996 21:06:20 EHOWARDX
  35. * Initial revision.
  36. *
  37. * Rev 1.12.1.3 09 May 1996 19:40:10 EHOWARDX
  38. * Changed trace to append linefeeds so trace string need not include them.
  39. *
  40. * Rev 1.13 29 Apr 1996 12:54:48 EHOWARDX
  41. * Added timestamps and instance-specific short name.
  42. *
  43. * Rev 1.12.1.2 25 Apr 1996 20:05:08 EHOWARDX
  44. * Changed mapping between H.245 trace level and ISRDBG32 trace level.
  45. *
  46. * Rev 1.12.1.1 15 Apr 1996 15:16:16 unknown
  47. * Updated.
  48. *
  49. * Rev 1.12.1.0 02 Apr 1996 15:34:02 EHOWARDX
  50. * Changed to use ISRDBG32 if not _IA_SPOX_.
  51. *
  52. * Rev 1.12 01 Apr 1996 08:47:30 cjutzi
  53. *
  54. * - fixed NDEBUG build problem
  55. *
  56. * Rev 1.11 18 Mar 1996 14:59:00 cjutzi
  57. *
  58. * - fixed and verified ring zero tracking..
  59. *
  60. * Rev 1.10 18 Mar 1996 13:40:32 cjutzi
  61. * - fixed spox trace
  62. *
  63. * Rev 1.9 15 Mar 1996 16:07:44 DABROWN1
  64. *
  65. * SYS_printf format changes
  66. *
  67. * Rev 1.8 13 Mar 1996 14:09:08 cjutzi
  68. *
  69. * - added ASSERT Printout to the trace when it occurs..
  70. *
  71. * Rev 1.7 13 Mar 1996 09:46:00 dabrown1
  72. *
  73. * modified Sys__printf to SYS_printf for Ring0
  74. *
  75. * Rev 1.6 11 Mar 1996 14:27:46 cjutzi
  76. *
  77. * - addes sys_printf for SPOX
  78. * - removed oildebug et.al..
  79. *
  80. * Rev 1.5 06 Mar 1996 12:10:40 cjutzi
  81. * - put ifndef SPOX around check_pdu, and dump_pdu..
  82. *
  83. * Rev 1.4 05 Mar 1996 16:49:46 cjutzi
  84. * - removed check_pdu from dump_pdu
  85. *
  86. * Rev 1.3 29 Feb 1996 08:22:04 cjutzi
  87. * - added pdu check constraints.. and (start but not complete.. )
  88. * pdu tracing.. (tbd when Init includes print function )
  89. *
  90. * Rev 1.2 21 Feb 1996 12:14:20 EHOWARDX
  91. *
  92. * Changed TraceLevel to DWORD.
  93. *
  94. * Rev 1.1 15 Feb 1996 14:42:20 cjutzi
  95. * - fixed the inst/Trace stuff..
  96. *
  97. * Rev 1.0 13 Feb 1996 15:00:42 DABROWN1
  98. * Initial revision.
  99. *
  100. * Rev 1.4 09 Feb 1996 15:45:08 cjutzi
  101. * - added h245trace
  102. * - added h245Assert
  103. * $Ident$
  104. *
  105. *****************************************************************************/
  106. #undef UNICODE
  107. #ifndef STRICT
  108. #define STRICT
  109. #endif
  110. #include "precomp.h"
  111. #include "h245asn1.h"
  112. #include "isrg.h"
  113. #include "h245com.h"
  114. DWORD TraceLevel = 9;
  115. #ifdef _DEBUG
  116. /*****************************************************************************
  117. *
  118. * TYPE: Global System
  119. *
  120. * PROCEDURE: H245TRACE
  121. *
  122. * DESCRIPTION:
  123. *
  124. * Trace function for H245
  125. *
  126. * INPUT:
  127. * inst - dwInst
  128. * level - qualify trace level
  129. * format - printf/sprintf string format 1-N parameters
  130. *
  131. * Trace Level Definitions:
  132. *
  133. * 0 - no trace on at all
  134. * 1 - only errors
  135. * 2 - PDU tracking
  136. * 3 - PDU and SendReceive packet tracing
  137. * 4 - Main API Module level tracing
  138. * 5 - Inter Module level tracing #1
  139. * 6 - Inter Module level tracing #2
  140. * 7 - <Undefined>
  141. * 8 - <Undefined>
  142. * 9 - <Undefined>
  143. * 10- and above.. free for all, you call .. i'll haul
  144. *
  145. * RETURN:
  146. * N/A
  147. *
  148. *****************************************************************************/
  149. #if !defined(NDEBUG)
  150. void H245TRACE (DWORD dwInst, DWORD dwLevel, LPSTR pszFormat, ...)
  151. {
  152. char szBuffer[256];
  153. #ifdef _IA_SPOX_
  154. /* Use SPOX printf */
  155. va_list pParams;
  156. if (dwLevel <= TraceLevel)
  157. {
  158. va_start( pParams, pszFormat );
  159. SYS_vsprintf(szBuffer, pszFormat, pParams);
  160. switch (dwLevel)
  161. {
  162. case 0:
  163. SYS_printf("[ H245-%1d: MESSAGE ] %s\n",dwInst,szBuffer);
  164. break;
  165. case 1:
  166. SYS_printf("[ H245-%1d: ERROR ] %s\n",dwInst,szBuffer);
  167. break;
  168. default:
  169. SYS_printf("[ H245-%1d: MSG-%02d ] %s\n",dwInst,dwLevel,szBuffer);
  170. }
  171. #else
  172. va_list pParams;
  173. BYTE byLevel;
  174. static WORD wIsrInst = 0xFFFF;
  175. char szName[] = "H.245-1";
  176. /* Use ISRDBG32 output */
  177. if (dwLevel <= TraceLevel)
  178. {
  179. switch (dwLevel)
  180. {
  181. case 0:
  182. byLevel = kISRNotify;
  183. break;
  184. case 1:
  185. byLevel = kISRCritical;
  186. break;
  187. default:
  188. byLevel = kISRTrace;
  189. } // switch
  190. if (wIsrInst == 0xFFFF)
  191. {
  192. UINT hMod;
  193. ptISRModule pMod;
  194. for (hMod = 0; hMod < kMaxModules; ++hMod)
  195. {
  196. pMod = ISR_GetModule(hMod);
  197. if (pMod)
  198. {
  199. if (memcmp(szName, pMod->zSName, sizeof(szName)) == 0)
  200. {
  201. szName[6] += 1;
  202. }
  203. }
  204. }
  205. ISR_RegisterModule(&wIsrInst, szName, szName);
  206. }
  207. wsprintf(szBuffer, "%9d:", GetTickCount());
  208. va_start( pParams, pszFormat );
  209. wvsprintf(&szBuffer[10], pszFormat, pParams);
  210. ISR_HookDbgStr((UINT)dwInst, wIsrInst, byLevel, szBuffer, 0);
  211. }
  212. #endif
  213. } // H245TRACE()
  214. #endif // && !defined(NDEBUG)
  215. /*****************************************************************************
  216. *
  217. * TYPE: Global System
  218. *
  219. * PROCEDURE: H245Assert
  220. *
  221. * DESCRIPTION:
  222. *
  223. * H245Assert that will only pop up a dialog box, does not
  224. * stop system with fault.
  225. *
  226. * FOR WINDOWS ONLY (Ring3 development) at this point
  227. *
  228. *
  229. * RETURN:
  230. *
  231. *****************************************************************************/
  232. void H245Panic (LPSTR file, int line)
  233. {
  234. #if !defined(SPOX) && defined(H324)
  235. int i;
  236. char Buffer[256];
  237. for (
  238. i=strlen(file);
  239. ((i) && (file[i] != '\\'));
  240. i--);
  241. wsprintf(Buffer,"file:%s line:%d",&file[i],line);
  242. MessageBox(GetTopWindow(NULL), Buffer, "H245 PANIC", MB_OK);
  243. #endif
  244. H245TRACE(0,1,"<<< PANIC >>> file:%s line:%d",file,line);
  245. }
  246. /*****************************************************************************
  247. *
  248. * TYPE: GLOBAL
  249. *
  250. * PROCEDURE: check_pdu
  251. *
  252. * DESCRIPTION:
  253. *
  254. * RETURN:
  255. *
  256. *****************************************************************************/
  257. int check_pdu (struct InstanceStruct *pInstance, MltmdSystmCntrlMssg *p_pdu)
  258. {
  259. int error = H245_ERROR_OK;
  260. #if 0 // legacy
  261. #ifndef SPOX
  262. if (pInstance->pWorld)
  263. {
  264. error = ossCheckConstraints(pInstance->pWorld, 1,(void *) p_pdu);
  265. switch (error)
  266. {
  267. case 0:
  268. break;
  269. case 14:
  270. H245TRACE(0,1,"<<PDU ERROR>> - User constraint function returned error");
  271. break;
  272. case 15:
  273. H245TRACE(0,1,"<<PDU ERROR>> - Single value constraint violated for a signed integer");
  274. break;
  275. case 16:
  276. H245TRACE(0,1,"<<PDU ERROR>> - Single value constraint violated for an unsigned integer");
  277. break;
  278. case 17:
  279. H245TRACE(0,1,"<<PDU ERROR>> - Single value constraint violated for a floating point number");
  280. break;
  281. case 18:
  282. H245TRACE(0,1,"<<PDU ERROR>> - Single value constraint violated for a string");
  283. break;
  284. case 19:
  285. H245TRACE(0,1,"<<PDU ERROR>> - Single value constraint violated for a complex type");
  286. break;
  287. case 20:
  288. H245TRACE(0,1,"<<PDU ERROR>> - Value range constraint violated for a signed integer");
  289. break;
  290. case 21:
  291. H245TRACE(0,1,"<<PDU ERROR>> - Value range constraint violated for an unsigned integer");
  292. break;
  293. case 22:
  294. H245TRACE(0,1,"<<PDU ERROR>> - Value range constraint violated for a floating point number");
  295. break;
  296. case 23:
  297. H245TRACE(0,1,"<<PDU ERROR>> - Size constraint violated for a string");
  298. break;
  299. case 24:
  300. H245TRACE(0,1,"<<PDU ERROR>> - Size constraint violated for a SET OF/SEQUENCE OF");
  301. break;
  302. case 25:
  303. H245TRACE(0,1,"<<PDU ERROR>> - Permitted alphabet constraint violated");
  304. break;
  305. case 26:
  306. H245TRACE(0,1,"<<PDU ERROR>> - Absence constraint violated");
  307. break;
  308. case 27:
  309. H245TRACE(0,1,"<<PDU ERROR>> - Presence constraint violated");
  310. break;
  311. case 28:
  312. H245TRACE(0,1,"<<PDU ERROR>> - Error in encoding an open type");
  313. break;
  314. case 29:
  315. H245TRACE(0,1,"<<PDU ERROR>> - Table constraint violated");
  316. break;
  317. case 30:
  318. H245TRACE(0,1,"<<PDU ERROR>> - Component relation constraint violated");
  319. break;
  320. case 31:
  321. H245TRACE(0,1,"<<PDU ERROR>> - Value not among the ENUMERATED");
  322. break;
  323. case 36:
  324. H245TRACE(0,1,"<<PDU ERROR>> - Type constraint violated");
  325. break;
  326. case 50:
  327. H245TRACE(0,1,"<<PDU ERROR>> - Unexpected NULL pointer in input");
  328. break;
  329. default:
  330. H245TRACE(0,1,"<<PDU ERROR>> - ***UNKNOWN ***");
  331. break;
  332. } /* switch */
  333. } /* if */
  334. #endif
  335. #endif // 0
  336. return error;
  337. }
  338. #if 0
  339. /*****************************************************************************
  340. *
  341. * TYPE: GLOBAL
  342. *
  343. * PROCEDURE: dump_pdu
  344. *
  345. * DESCRIPTION:
  346. *
  347. * RETURN:
  348. *
  349. *****************************************************************************/
  350. void dump_pdu (struct InstanceStruct *pInstance, MltmdSystmCntrlMssg *p_pdu)
  351. {
  352. #ifndef SPOX
  353. if (pInstance->pWorld)
  354. {
  355. ossPrintPDU (pInstance->pWorld, 1, p_pdu);
  356. }
  357. #endif
  358. }
  359. #endif // NEVER
  360. #endif // _DEBUG