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.

288 lines
9.9 KiB

  1. /*++
  2. Module Name:
  3. pssframe.c
  4. Abstract:
  5. This module logs the content of DISs and DCSs into PSS log file.
  6. Author:
  7. Jonathan Barner (t-jonb) Mar, 2001
  8. Revision History:
  9. --*/
  10. #include "prep.h"
  11. #include "psslog.h"
  12. #define FILE_ID FILE_ID_PSSFRAME
  13. /*++
  14. Routine Description:
  15. Logs DIS details to PSS log, using the supplied info.
  16. Arguments:
  17. pTG
  18. lpszModulations, bFineRes, b2D, lpszPageWidth, lpszPageLength, lpszMinLineTime - info to log
  19. Return Value:
  20. None
  21. --*/
  22. void LogDISDetails(PThrdGlbl pTG,
  23. LPSTR lpszModulations,
  24. BOOL bFineRes,
  25. BOOL b2D,
  26. LPSTR lpszPageWidth,
  27. LPSTR lpszPageLength,
  28. LPSTR lpszMinLineTime)
  29. {
  30. PSSLogEntry(PSS_MSG, 1, "- Supported Modulations: %s", lpszModulations);
  31. PSSLogEntry(PSS_MSG, 1, "- Ability to use fine resolution: %s", bFineRes ? _T("Yes") : _T("No"));
  32. PSSLogEntry(PSS_MSG, 1, "- Ability to use 2D coding: %s", b2D ? _T("Yes") : _T("No"));
  33. PSSLogEntry(PSS_MSG, 1, "- Supported Page Width: %s", lpszPageWidth);
  34. PSSLogEntry(PSS_MSG, 1, "- Supported Page Length: %s", lpszPageLength);
  35. PSSLogEntry(PSS_MSG, 1, "- Minimum scan line time: %s", lpszMinLineTime);
  36. }
  37. /*++
  38. Routine Description:
  39. Logs DCS details to PSS log, using the supplied info.
  40. Arguments:
  41. pTG
  42. lpszModulations, bFineRes, b2D, lpszPageWidth, lpszPageLength, lpszLineTime - info to log
  43. Return Value:
  44. None
  45. --*/
  46. void LogDCSDetails(PThrdGlbl pTG,
  47. LPSTR lpszModulation,
  48. BOOL bFineRes,
  49. BOOL b2D,
  50. DWORD dwPageWidth,
  51. LPSTR lpszPageLength,
  52. LPSTR lpszLineTime)
  53. {
  54. PSSLogEntry(PSS_MSG, 1, "- Session Modulation is: %s", lpszModulation);
  55. PSSLogEntry(PSS_MSG, 1, "- Use fine resolution: %s", bFineRes ? _T("Yes") : _T("No"));
  56. PSSLogEntry(PSS_MSG, 1, "- Use 2D coding: %s", b2D ? _T("Yes") : _T("No"));
  57. PSSLogEntry(PSS_MSG, 1, "- Page width is %d", dwPageWidth);
  58. PSSLogEntry(PSS_MSG, 1, "- Page length is %s", lpszPageLength);
  59. PSSLogEntry(PSS_MSG, 1, "- Scan line time: %s", lpszLineTime);
  60. }
  61. // This table applies to both DIS and DCS, in both class1 and class2
  62. LPSTR ppszMinLineTime[8] = { // Bits 21-23 (leftmost is 23)
  63. _T("20"), // 000
  64. _T("5"), // 001
  65. _T("10"), // 010
  66. _T("20/10"), // 011
  67. _T("40"), // 100
  68. _T("40/20"), // 101
  69. _T("10/5"), // 110
  70. _T("0") // 111
  71. };
  72. // *************************** CLASS 1 ****************************
  73. /*++
  74. Routine Description:
  75. Logs DIS details to PSS log, using the supplied NPDIS.
  76. Arguments:
  77. pTG
  78. npdis - DIS to log
  79. Return Value:
  80. None
  81. --*/
  82. void LogClass1DISDetails(PThrdGlbl pTG, NPDIS npdis)
  83. {
  84. static LPSTR ppszCapsDesc[16] = { // Bits 11-14 (leftmost is 14)
  85. _T("V.27 ter fallback"), // 0000
  86. _T("V.29"), // 0001
  87. _T("V.27 ter"), // 0010
  88. _T("V.27 ter, V.29"), // 0011
  89. _T(""), // 0100
  90. _T(""), // 0101
  91. _T(""), // 0110
  92. _T("V.27 ter, V.29, V.33"), // 0111
  93. _T(""), // 1000
  94. _T(""), // 1001
  95. _T(""), // 1010
  96. _T("V.27 ter, V.29, V.33, V.17"), // 1011
  97. _T(""), // 1100
  98. _T(""), // 1101
  99. _T(""), // 1110
  100. _T("") // 1111
  101. };
  102. static LPSTR ppszWidthDesc[4] = { // Bits 17-18 (leftmost is 18)
  103. _T("1728"), // 00
  104. _T("1728, 2048"), // 01
  105. _T("1728, 2048, 2432"), // 10
  106. _T("invalid (interpreted as 1728, 2048, 2432)") //11
  107. };
  108. static LPSTR ppszLengthDesc[4] = { // Bits 19-20 (leftmost is 20)
  109. _T("A4"), // 00
  110. _T("A4 and B4"), // 01
  111. _T("Unlimited"), // 10
  112. _T("invalid") // 11
  113. };
  114. if (npdis == NULL)
  115. {
  116. _ASSERT(FALSE);
  117. return;
  118. }
  119. LogDISDetails(pTG,
  120. ppszCapsDesc[npdis->Baud],
  121. (npdis->ResFine_200 == 1),
  122. (npdis->MR_2D == 1),
  123. ppszWidthDesc[npdis->PageWidth],
  124. ppszLengthDesc[npdis->PageLength],
  125. ppszMinLineTime[npdis->MinScanCode]);
  126. }
  127. /*++
  128. Routine Description:
  129. Logs DCS details to PSS log, using the supplied NPDIS.
  130. Arguments:
  131. pTG
  132. npdis - DCS to log
  133. Return Value:
  134. None
  135. --*/
  136. void LogClass1DCSDetails(PThrdGlbl pTG, NPDIS npdis)
  137. {
  138. static LPSTR ppszDesc[16] = { // Bits 11-14 (leftmost is 14)
  139. _T("2400 bps V.27 ter"), // 0000
  140. _T("9600 bps V.29"), // 0001
  141. _T("4800 bps V.27 ter"), // 0010
  142. _T("7200 bps V.29"), // 0011
  143. _T("14400 bps V.33"), // 0100
  144. _T(""), // 0101
  145. _T("12000 bps V.33"), // 0110
  146. _T(""), // 0111
  147. _T("14400 bps V.17"), // 1000
  148. _T("9600 bps V.17"), // 1001
  149. _T("12000 bps V.17"), // 1010
  150. _T("7200 bps V.17"), // 1011
  151. _T(""), // 1100
  152. _T(""), // 1101
  153. _T(""), // 1110
  154. _T("") // 1111
  155. };
  156. static DWORD dwWidthDesc[4] = {
  157. 1728, // 00
  158. 2048, // 01
  159. 2432, // 10
  160. 2432 // 11
  161. };
  162. static LPSTR lpszLengthDesc[4] = {
  163. _T("A4"), // 00
  164. _T("B4"), // 01
  165. _T("Unlimited"), // 10
  166. _T("invalid") // 11
  167. };
  168. if (npdis == NULL)
  169. {
  170. _ASSERT(FALSE);
  171. return;
  172. }
  173. LogDCSDetails(pTG,
  174. ppszDesc[npdis->Baud],
  175. (npdis->ResFine_200 == 1),
  176. (npdis->MR_2D == 1),
  177. dwWidthDesc[npdis->PageWidth],
  178. lpszLengthDesc[npdis->PageLength],
  179. ppszMinLineTime[npdis->MinScanCode]);
  180. }
  181. // *************************** CLASS 2 ****************************
  182. #define GET_BOUNDED_ARRAY_ELEMENT(_array_, _val_, _maxval_, _default_) \
  183. (((_val_)>=0 && (_val_)<(_maxval_)) ? _array_[(_val_)] : (_default_))
  184. // These tables belongs to both DIS and DCS
  185. LPSTR ppszCapsDesc[6] = {
  186. _T("2400 bps V.27 ter"), // 0
  187. _T("4800 bps V.27 ter"), // 1
  188. _T("7200 bps V.29 or V.17"), // 2
  189. _T("9600 bps V.29 or V.17"), // 3
  190. _T("12000 bps V.17"), // 4
  191. _T("14400 bps V.17"), // 5
  192. };
  193. LPSTR ppszLengthDesc[3] = {
  194. _T("A4"), // 0
  195. _T("B4"), // 1
  196. _T("Unlimited"), // 2
  197. };
  198. LPSTR szInvalid = _T("Invalid");
  199. /*++
  200. Routine Description:
  201. Logs DIS details to PSS log, using the supplied PCB.
  202. Arguments:
  203. pTG
  204. lpPcb - DIS to log
  205. Return Value:
  206. None
  207. --*/
  208. void LogClass2DISDetails(PThrdGlbl pTG, LPPCB lpPcb)
  209. {
  210. static LPSTR ppszWidthDesc[5] = {
  211. _T("1728"), // 0
  212. _T("1728, 2048"), // 1
  213. _T("1728, 2048, 2432"), // 2
  214. _T("1216"), // 3
  215. _T("864"), // 4
  216. };
  217. if (lpPcb == NULL)
  218. {
  219. _ASSERT(FALSE);
  220. return;
  221. }
  222. LogDISDetails(pTG,
  223. GET_BOUNDED_ARRAY_ELEMENT(ppszCapsDesc, lpPcb->Baud, 6, szInvalid),
  224. lpPcb->Resolution & AWRES_mm080_038,
  225. lpPcb->Encoding & MR_DATA,
  226. GET_BOUNDED_ARRAY_ELEMENT(ppszWidthDesc, lpPcb->PageWidth, 5, szInvalid),
  227. GET_BOUNDED_ARRAY_ELEMENT(ppszLengthDesc, lpPcb->PageLength, 3, szInvalid),
  228. GET_BOUNDED_ARRAY_ELEMENT(ppszMinLineTime, lpPcb->MinScan, 8, szInvalid) );
  229. }
  230. /*++
  231. Routine Description:
  232. Logs DCS details to PSS log, using the supplied PCB.
  233. Arguments:
  234. pTG
  235. lpPcb - DCS to log
  236. Return Value:
  237. None
  238. --*/
  239. void LogClass2DCSDetails(PThrdGlbl pTG, LPPCB lpPcb)
  240. {
  241. static DWORD dwWidthDesc[5] = {
  242. 1728, // 0
  243. 2048, // 1
  244. 2432, // 2
  245. 1216, // 3
  246. 864 // 4
  247. };
  248. if (lpPcb == NULL)
  249. {
  250. _ASSERT(FALSE);
  251. return;
  252. }
  253. LogDCSDetails(pTG,
  254. GET_BOUNDED_ARRAY_ELEMENT(ppszCapsDesc, lpPcb->Baud, 6, szInvalid),
  255. !(lpPcb->Resolution & AWRES_mm080_038),
  256. lpPcb->Encoding & MR_DATA,
  257. GET_BOUNDED_ARRAY_ELEMENT(dwWidthDesc, lpPcb->PageWidth, 5, 0),
  258. GET_BOUNDED_ARRAY_ELEMENT(ppszLengthDesc, lpPcb->PageLength, 3, szInvalid),
  259. GET_BOUNDED_ARRAY_ELEMENT(ppszMinLineTime, lpPcb->MinScan, 8, szInvalid) );
  260. }