Source code of Windows XP (NT5)
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.

168 lines
6.5 KiB

  1. //////////////////////// Protocol Dump APIs ////////////////////////////
  2. #ifdef PDUMP // Protocol Dump
  3. //macros defined to access fields of the protocol dump
  4. #define GETPROTDUMPFRAME(lpprotdump,i) \
  5. ((LPFR)(((LPBYTE)(lpprotdump->b)) + lpprotdump->uFrameOff[i])) \
  6. #define ISSENDFRAME(lpfr) \
  7. ((lpfr->ifr & 0x80))
  8. #define GETFCF(lpfr,lpszBuf) \
  9. (wsprintf(lpszBuf, \
  10. (LPSTR)(rgszFrName[lpfr->ifr & 0x7F])))
  11. #define GETFIF(lpfr,lpszBuf) \
  12. { \
  13. int j; \
  14. *lpszBuf = '\0'; \
  15. for(j=0;j<lpfr->cb;j++) \
  16. lpszBuf += wsprintf(lpszBuf,"%02x",(WORD)lpfr->fif[j]); \
  17. }
  18. ///////// Sample Code for walking & printing Protocol Dump ////////
  19. //
  20. // void PrintDump(LPPROTDUMP lpprotdump)
  21. // {
  22. // int i, j;
  23. //
  24. // RETAILMSG((SZMOD "-*-*-*-*-*-*-*-* Print Protocol Dump -*-*-*-*-*-*-*-*-\r\n"));
  25. //
  26. // for(i=0; i<(int)lpprotdump->uNumFrames; i++)
  27. // {
  28. // LPFR lpfr = (LPFR) (((LPBYTE)(lpprotdump->b)) + lpprotdump->uFrameOff[i]);
  29. // IFR ifr = (lpfr->ifr & 0x7F);
  30. // BOOL fSend = (lpfr->ifr & 0x80);
  31. //
  32. // BG_CHK(ifr <= ifrMAX);
  33. // RETAILMSG((SZMOD "%s: %s [ ",
  34. // (LPSTR)(fSend ? "Sent" : "Recvd"),
  35. // (LPSTR)(rgszFrName[ifr]) ));
  36. //
  37. // for(j=0; j<lpfr->cb; j++)
  38. // RETAILMSG(("%02x ", (WORD)lpfr->fif[j]));
  39. //
  40. // RETAILMSG(("]\r\n"));
  41. // }
  42. //
  43. // RETAILMSG((SZMOD "-*-*-*-*-*-*-*-* End Protocol Dump -*-*-*-*-*-*-*-*-\r\n"));
  44. // }
  45. //
  46. ///////////////////////////////////////////////////////////////////
  47. #ifdef DEFINE_FRNAME_ARRAY
  48. #define ifrMAX 48
  49. LPSTR rgszFrName[ifrMAX] = {
  50. #define ifrNULL 0
  51. "???",
  52. #define ifrDIS 1
  53. "DIS",
  54. #define ifrCSI 2
  55. "CSI",
  56. #define ifrNSF 3
  57. "NSF",
  58. #define ifrDTC 4
  59. "DTC",
  60. #define ifrCIG 5
  61. "CIG",
  62. #define ifrNSC 6
  63. "NSC",
  64. #define ifrDCS 7
  65. "DCS",
  66. #define ifrTSI 8
  67. "TSI",
  68. #define ifrNSS 9
  69. "NSS",
  70. #define ifrCFR 10
  71. "CFR",
  72. #define ifrFTT 11
  73. "FTT",
  74. #define ifrMPS 12
  75. "MPS",
  76. #define ifrEOM 13
  77. "EOM",
  78. #define ifrEOP 14
  79. "EOP",
  80. #define ifrPWD 15
  81. "PWD",
  82. #define ifrSEP 16
  83. "SEP",
  84. #define ifrSUB 17
  85. "SUB",
  86. #define ifrMCF 18
  87. "MCF",
  88. #define ifrRTP 19
  89. "RTP",
  90. #define ifrRTN 20
  91. "RTN",
  92. #define ifrPIP 21
  93. "PIP",
  94. #define ifrPIN 22
  95. "PIN",
  96. #define ifrDCN 23
  97. "DCN",
  98. #define ifrCRP 24
  99. "CRP",
  100. #define ifrPRI_MPS 25
  101. "PRI_MPS",
  102. #define ifrPRI_EOM 26
  103. "PRI_EOM",
  104. #define ifrPRI_EOP 27
  105. "PRI_EOP",
  106. #define ifrCTC 28
  107. "CTC",
  108. #define ifrCTR 29
  109. "CTR",
  110. #define ifrRR 30
  111. "RR" ,
  112. #define ifrPPR 31
  113. "PPR",
  114. #define ifrRNR 32
  115. "RNR",
  116. #define ifrERR 33
  117. "ERR",
  118. #define ifrPPS_NULL 34
  119. "PPS-NULL",
  120. #define ifrPPS_MPS 35
  121. "PPS-MPS",
  122. #define ifrPPS_EOM 36
  123. "PPS-EOM",
  124. #define ifrPPS_EOP 37
  125. "PPS-EOP",
  126. #define ifrPPS_PRI_MPS 38
  127. "PPS-PRI-MPS",
  128. #define ifrPPS_PRI_EOM 39
  129. "PPS-PRI-EOM",
  130. #define ifrPPS_PRI_EOP 40
  131. "PPS-PRI-EOP",
  132. #define ifrEOR_NULL 41
  133. "EOR-NULL",
  134. #define ifrEOR_MPS 42
  135. "EOR-MPS",
  136. #define ifrEOR_EOM 43
  137. "EOR-EOM",
  138. #define ifrEOR_EOP 44
  139. "EOR-EOP",
  140. #define ifrEOR_PRI_MPS 45
  141. "EOR-PRI-MPS",
  142. #define ifrEOR_PRI_EOM 46
  143. "EOR-PRI-EOM",
  144. #define ifrEOR_PRI_EOP 47
  145. "EOR-PRI-EOP"
  146. #define ifrMAX 48
  147. };
  148. #endif //DEFINE_FRNAME_ARRAY
  149. #endif //PDUMP