home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / netds / dlc / dlcdebug.h < prev    next >
C/C++ Source or Header  |  1997-10-05  |  5KB  |  162 lines

  1. /*++
  2.  
  3. Copyright (c) 1991-1997  Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     dlcdebug.h
  8.  
  9. Abstract:
  10.  
  11.     Contains debugging prototypes and manifests for ACSLAN
  12.  
  13. Author:
  14.  
  15.     Richard L Firth (rfirth) 28-May-1992
  16.  
  17. Revision History:
  18.  
  19. --*/
  20.  
  21. #define ARRAY_ELEMENTS(a)   (sizeof(a)/sizeof((a)[0]))
  22. #define LAST_ELEMENT(a)     (ARRAY_ELEMENTS(a)-1)
  23.  
  24. #if DBG
  25.  
  26. #define PRIVATE
  27.  
  28. #define ACSLAN_DEBUG_ENV_VAR    "ACSLAN_DEBUG_FLAGS"
  29. #define ACSLAN_DUMP_FILE_VAR    "ACSLAN_DUMP_FILE"
  30. #define ACSLAN_DUMP_FILTER_VAR  "ACSLAN_DUMP_FILTER"
  31.  
  32. #define DEBUG_DUMP_INPUT_CCB    0x00000001L // dump CCB input to AcsLan
  33. #define DEBUG_DUMP_OUTPUT_CCB   0x00000002L // dump CCB output from AcsLan
  34. #define DEBUG_DUMP_TX_INFO      0x00000004L // dump transmit buffers
  35. #define DEBUG_DUMP_RX_INFO      0x00000008L // dump receive buffers
  36. #define DEBUG_DUMP_TX_DATA      0x00000010L // dump data buffer in TRANSMIT commands
  37. #define DEBUG_DUMP_RX_DATA      0x00000020L // dump received data frames
  38. #define DEBUG_DUMP_DATA_CHAIN   0x00000040L // dump entire chain of received data buffers
  39. #define DEBUG_DUMP_FRAME_CHAIN  0x00000080L // dump entire chain of received frames
  40. #define DEBUG_DUMP_TX_ASCII     0x00000100L // dump transmitted data as hex & ASCII
  41. #define DEBUG_DUMP_RX_ASCII     0x00000200L // dump received data as hex & ASCII
  42. #define DEBUG_DUMP_ASYNC_CCBS   0x00000400L // dump READ async. completed CCBs
  43. #define DEBUG_RETURN_CODE       0x01000000L // dump return code from AcsLan/NtAcsLan
  44. #define DEBUG_DUMP_NTACSLAN     0x02000000L // dump CCBs for NtAcsLan, not AcsLan
  45. #define DEBUG_DUMP_ACSLAN       0x04000000L // dump CCBs for AcsLan, not NtAcsLan
  46. #define DEBUG_DUMP_TIME         0x08000000L // dump relative time between commands
  47. #define DEBUG_DLL_INFO          0x10000000L // dump info about DLL attach/detach
  48. #define DEBUG_BREAKPOINT        0x20000000L // break at conditional breakpoints
  49. #define DEBUG_TO_FILE           0x40000000L // dump info to file
  50. #define DEBUG_TO_TERMINAL       0x80000000L // dump info to console
  51.  
  52. #define IF_DEBUG(c)             if (AcslanDebugFlags & DEBUG_##c)
  53. #define PUT(x)                  AcslanDebugPrint x
  54. #define DUMPCCB                 DumpCcb
  55.  
  56. //
  57. // misc.
  58. //
  59.  
  60. #define DEFAULT_FIELD_WIDTH     16          // amount of description before a number
  61.  
  62. //
  63. // DumpData options
  64. //
  65.  
  66. #define DD_DEFAULT_OPTIONS      0x00000000  // use defaults
  67. #define DD_NO_ADDRESS           0x00000001  // don't display address of data
  68. #define DD_LINE_BEFORE          0x00000002  // linefeed before first dumped line
  69. #define DD_LINE_AFTER           0x00000004  // linefeed after last dumped line
  70. #define DD_INDENT_ALL           0x00000008  // indent all lines
  71. #define DD_NO_ASCII             0x00000010  // don't dump ASCII respresentation
  72. #define DD_UPPER_CASE           0x00000020  // upper-case hex dump (F4 instead of f4)
  73. #define DD_DOT_DOT_SPACE        0x00000040  // fill unused hex space with '..'
  74.  
  75. //
  76. // Filters for individual CCB commands: 4 flags max, because each command is
  77. // represented by a single ASCII character
  78. //
  79.  
  80. #define CF_DUMP_CCB_IN          0x00000001  // dump CCB on input
  81. #define CF_DUMP_CCB_OUT         0x00000002  // dump CCB on output
  82. #define CF_DUMP_PARMS_IN        0x00000004  // dump parameter table on input
  83. #define CF_DUMP_PARMS_OUT       0x00000008  // dump parameter table on output
  84.  
  85. //
  86. // global data
  87. //
  88.  
  89. #ifndef ACSLAN_DEBUG_FLAGS
  90. #define ACSLAN_DEBUG_FLAGS      (DEBUG_DUMP_INPUT_CCB \
  91.                                  | DEBUG_DUMP_OUTPUT_CCB \
  92.                                  | DEBUG_DUMP_TX_INFO \
  93.                                  | DEBUG_DUMP_RX_INFO \
  94.                                  | DEBUG_DUMP_TX_DATA \
  95.                                  | DEBUG_DUMP_RX_DATA \
  96.                                  | DEBUG_DUMP_DATA_CHAIN \
  97.                                  | DEBUG_DUMP_FRAME_CHAIN \
  98.                                  | DEBUG_DUMP_TX_ASCII \
  99.                                  | DEBUG_DUMP_RX_ASCII \
  100.                                  | DEBUG_DUMP_ASYNC_CCBS \
  101.                                  | DEBUG_RETURN_CODE \
  102.                                  | DEBUG_DUMP_NTACSLAN \
  103.                                  | DEBUG_DUMP_ACSLAN \
  104.                                  | DEBUG_DUMP_TIME \
  105.                                  | DEBUG_TO_TERMINAL \
  106.                                  )
  107. #endif
  108.  
  109. extern DWORD AcslanDebugFlags;
  110. extern FILE* hDumpFile;
  111.  
  112. //
  113. // prototypes
  114. //
  115.  
  116. VOID
  117. GetAcslanDebugFlags(
  118.     VOID
  119.     );
  120.  
  121. VOID
  122. SetAcslanDebugFlags(
  123.     IN DWORD Flags
  124.     );
  125.  
  126. VOID
  127. AcslanDebugPrint(
  128.     IN LPSTR Format,
  129.     IN ...
  130.     );
  131.  
  132. VOID
  133. DumpCcb(
  134.     IN PLLC_CCB Ccb,
  135.     IN BOOL DumpAll,
  136.     IN BOOL CcbIsInput
  137.     );
  138.  
  139. VOID
  140. DumpData(
  141.     IN LPSTR Title,
  142.     IN PBYTE Address,
  143.     IN DWORD Length,
  144.     IN DWORD Options,
  145.     IN DWORD Indent
  146.     );
  147.  
  148. LPSTR
  149. MapCcbRetcode(
  150.     IN BYTE Retcode
  151.     );
  152.  
  153. #else
  154.  
  155. #define PRIVATE                 static
  156.  
  157. #define IF_DEBUG(c)             if (0)
  158. #define PUT(x)
  159. #define DUMPCCB                 (void)
  160.  
  161. #endif
  162.