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.

382 lines
13 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. tcpipext.h
  5. Abstract:
  6. This file is a common header file for tcpext.dll
  7. Author:
  8. John Ballard (jballard)
  9. Environment:
  10. User Mode
  11. --*/
  12. #define ITEMSIZE 25
  13. typedef struct
  14. {
  15. ULONG Value;
  16. PCHAR pszDescription;
  17. } ENUM_INFO, *PENUM_INFO, FLAG_INFO, *PFLAG_INFO;
  18. #define EnumString( Value ) { Value, #Value }
  19. extern ENUM_INFO EnumStructureType[];
  20. //#define EOL ( (Item++ & 1) ? "\n":"" )
  21. typedef enum
  22. {
  23. VERBOSITY_ONE_LINER = 0,
  24. VERBOSITY_NORMAL,
  25. VERBOSITY_FULL
  26. } VERBOSITY;
  27. #define PrintStart Item = 0;
  28. extern int _Indent;
  29. extern char IndentBuf[ 80 ];
  30. #define IndentChange( cch ) { IndentBuf[_Indent]=' '; _Indent += ( cch ); IndentBuf[_Indent]='\0';}
  31. #define Indent( cch ) IndentChange( cch )
  32. #define Outdent( cch ) IndentChange( -( cch ) )
  33. #define PrintStartStruct() { PrintStart; dprintf( "%s{\n", IndentBuf ); Indent( 2 ); }
  34. #define PrintStartNamedStruct( _name ) { PrintStart; dprintf( "%s%s {\n", IndentBuf, _name ); Indent( 2 ); }
  35. static PCHAR pchEol = "\n";
  36. static PCHAR pchBlank = "";
  37. static PCHAR * ppchCurrentEol = &pchEol;
  38. static PCHAR * ppchTempEol = &pchEol;
  39. #define PrintJoin() { ppchCurrentEol = &pchBlank; }
  40. #define EOL (( ppchTempEol = ppchCurrentEol ), ( ppchCurrentEol = &pchEol ), ( *ppchTempEol ))
  41. VOID
  42. dprintSymbolPtr
  43. (
  44. PVOID Pointer,
  45. PCHAR EndOfLine
  46. );
  47. VOID
  48. dprint_nchar
  49. (
  50. PCHAR pch,
  51. int cch
  52. );
  53. VOID
  54. dprint_hardware_address
  55. (
  56. PUCHAR Address
  57. );
  58. BOOL
  59. dprint_enum_name
  60. (
  61. ULONG Value,
  62. PENUM_INFO pEnumInfo
  63. );
  64. BOOL
  65. dprint_flag_names
  66. (
  67. ULONG Value,
  68. PFLAG_INFO pFlagInfo
  69. );
  70. BOOL
  71. dprint_masked_value
  72. (
  73. ULONG Value,
  74. ULONG Mask
  75. );
  76. VOID
  77. dprint_addr_list(
  78. ULONG_PTR FirstAddress,
  79. ULONG OffsetToNextPtr
  80. );
  81. VOID
  82. dprint_IP_address
  83. (
  84. IPAddr Address
  85. );
  86. void
  87. dprint_unicode_string( UNICODE_STRING String );
  88. void
  89. dprint_ansi_string( PUCHAR String );
  90. ULONG
  91. GetUlongValue (
  92. PCHAR String
  93. );
  94. /*
  95. #define PrintEnd \
  96. dprintf( "%s", EOL ); \
  97. Item = 0;
  98. */
  99. #define PrintEnd \
  100. Item = 0;
  101. #define PrintEndStruct() { Outdent( 2 ); PrintEnd; dprintf( "%s}\n", IndentBuf ); }
  102. #define PrintFlushLeft() PrintEnd
  103. #define PRINTBOOL(var) ( (var) ? "True" : "False")
  104. #define PrintFieldName(_fieldName) \
  105. if ( strlen(_fieldName) > 35 ) { \
  106. dprintf("%s%-.25s..%s = ",IndentBuf,_fieldName, &(_fieldName[strlen(_fieldName)-8])); \
  107. }else { \
  108. dprintf("%s%-35.35s = ",IndentBuf,_fieldName ); \
  109. }
  110. #define PrintFieldNameAt(_fieldName) \
  111. if ( strlen(_fieldName) > 35 ) { \
  112. dprintf("%s%-.25s..%s @ ",IndentBuf,_fieldName, &(_fieldName[strlen(_fieldName)-8])); \
  113. }else { \
  114. dprintf("%s%-35.35s @ ",IndentBuf,_fieldName ); \
  115. }
  116. #define PrintListTcpFieldName(_fieldName) \
  117. if ( strlen(_fieldName) > 40 ) { \
  118. dprintf("%s%-.30s...%s q_next = ",IndentBuf,_fieldName, &(_fieldName[strlen(_fieldName)-7])); \
  119. }else { \
  120. dprintf("%s%-40.40s q_next = ",IndentBuf,_fieldName ); \
  121. }
  122. #define PrintListFieldName(_fieldName) \
  123. if ( strlen(_fieldName) > 40 ) { \
  124. dprintf("%s%-.30s...%s FLink = ",IndentBuf,_fieldName, &(_fieldName[strlen(_fieldName)-7])); \
  125. }else { \
  126. dprintf("%s%-40.40s FLink = ",IndentBuf,_fieldName ); \
  127. }
  128. #define PrintIndent() dprintf( "%s", IndentBuf );
  129. /* #define PrintFieldName(_fieldName) \
  130. dprintf(" %-25.25s = ",_fieldName );*/
  131. #define PrintRawBool( _bValue ) \
  132. dprintf("%-10s%s", (_obj._bValue) ? "True" : "False", EOL)
  133. #define PrintBool(_field) \
  134. PrintFieldName(#_field) \
  135. dprintf("%-10s%s", (_obj._field) ? "True" : "False", EOL)
  136. #define PrintULong(_field) \
  137. PrintFieldName(#_field) \
  138. dprintf("%-10lu%s", _obj._field, EOL)
  139. #define PrintXULong(_field) \
  140. PrintFieldName(#_field) \
  141. dprintf("0x%08lx%s", _obj._field, EOL)
  142. #define PrintULonglong(_field) \
  143. PrintFieldName(#_field) \
  144. dprintf("%-10I64u%s", _obj._field, EOL)
  145. #define PrintXULonglong(_field) \
  146. PrintFieldName(#_field) \
  147. dprintf("0x%08I64x%s", _obj._field, EOL)
  148. #define PrintUShort(_field) \
  149. PrintFieldName(#_field) \
  150. dprintf("%-10hu%s", _obj._field, EOL)
  151. #define PrintHTONUShort(_field) \
  152. PrintFieldName(#_field) \
  153. dprintf("%-10hu%s", htons(_obj._field), EOL)
  154. #define PrintXUShort(_field) \
  155. PrintFieldName(#_field) \
  156. dprintf("0x%04hx%s", _obj._field, EOL)
  157. #define PrintNChar( _field, count ) \
  158. PrintFieldName(#_field) \
  159. dprint_nchar( ( PCHAR )_obj._field, count ); \
  160. dprintf("%s", EOL)
  161. #define PrintUChar(_field) \
  162. PrintFieldName(#_field) \
  163. dprintf("%-10lu%s", (ULONG) _obj._field, EOL)
  164. #define PrintXUChar(_field) \
  165. PrintFieldName(#_field) \
  166. dprintf("0x%-8lx%s", (ULONG) _obj._field, EOL)
  167. #define PrintPtr(_field) \
  168. PrintFieldName(#_field) \
  169. dprintf("%-10lx%s", _obj._field, EOL)
  170. #define PrintSymbolPtr( _field ) \
  171. PrintFieldName(#_field) \
  172. dprintSymbolPtr( (( PVOID )_obj._field), EOL );
  173. #define AddressOf( _field ) ((( ULONG )_objAddr) + FIELD_OFFSET( _objType, _field ))
  174. #define PrintAddr(_field) \
  175. PrintFieldNameAt(#_field) \
  176. dprintf("%-10lx%s", AddressOf( _field ), EOL)
  177. #define PrintL(_field) \
  178. PrintFieldName(#_field##".Next") \
  179. dprintf("%-10lx%s", _obj._field.Next, EOL )
  180. #define PrintLL(_field) \
  181. PrintEnd; \
  182. PrintListFieldName(#_field ); \
  183. dprintf("%-10lx", _obj._field.Flink ); \
  184. dprintf("Blink = %-10lx", _obj._field.Blink ); \
  185. dprintf("%s\n", ( _obj._field.Flink == _obj._field.Blink ) ? " (Empty)" : "" );
  186. #define PrintLLTcp(_field) \
  187. PrintEnd; \
  188. PrintListTcpFieldName(#_field ); \
  189. dprintf("%-10lx", _obj._field.q_next ); \
  190. dprintf("q_prev = %-10lx", _obj._field.q_prev ); \
  191. dprintf("%s\n", ( _obj._field.q_next == _obj._field.q_prev ) ? " (Empty)" : "" );
  192. #define PrintIrpQ(_field) \
  193. PrintEnd; \
  194. PrintFieldName(#_field##".Head"); \
  195. dprintf("%-10lx", _obj._field.Head ); \
  196. PrintFieldName(#_field##".Tail"); \
  197. dprintf("%-10lx\n", _obj._field.Tail );
  198. #define PrintFlags( _field, _pFlagStruct ) \
  199. PrintEnd; \
  200. PrintFieldName(#_field); \
  201. dprintf("0x%08lx (", (ULONG) _obj._field ); \
  202. dprint_flag_names( (ULONG) _obj._field, _pFlagStruct ); \
  203. dprintf( ")\n" );
  204. #define PrintFlagsMask( _field, _pFlagStruct, _Mask ) \
  205. PrintEnd; \
  206. PrintFieldName(" & " ## #_Mask ); \
  207. dprintf("0x"); \
  208. dprint_masked_value((ULONG) _obj._field, _Mask ); \
  209. dprintf("("); \
  210. dprint_flag_names( (ULONG) _obj._field, _pFlagStruct ); \
  211. dprintf( ")\n" );
  212. #define PrintEnum( _field, _pEnumStruct ) \
  213. PrintEnd; \
  214. PrintFieldName(#_field); \
  215. dprintf("%lu (", (ULONG) _obj._field ); \
  216. dprint_enum_name( (ULONG) _obj._field, _pEnumStruct ); \
  217. dprintf( ")\n" );
  218. #define PrintXEnum( _field, _pEnumStruct ) \
  219. PrintEnd; \
  220. PrintFieldName(#_field); \
  221. dprintf("0x%08lx (", (ULONG) _obj._field ); \
  222. dprint_enum_name( (ULONG) _obj._field, _pEnumStruct ); \
  223. dprintf( ")\n" );
  224. #define PrintXEnumMask( _field, _pEnumStruct, _Mask ) \
  225. PrintEnd; \
  226. PrintFieldName(" & " ## #_Mask ); \
  227. dprintf("0x"); \
  228. dprint_masked_value((ULONG) _obj._field, _Mask ); \
  229. dprintf("("); \
  230. dprint_enum_name((ULONG) _obj._field & _Mask, _pEnumStruct ); \
  231. dprintf( ")\n" );
  232. #define PrintHardwareAddress( _field ) \
  233. PrintFieldName(#_field); \
  234. dprint_hardware_address( _obj._field.Address ); \
  235. dprintf( "%s", EOL );
  236. #define PrintIpxLocalTarget( _field ) \
  237. PrintStartNamedStruct( #_field ); \
  238. PrintFieldName( "NicId" ); \
  239. dprintf("%-10u%s", _obj._field.NicId, EOL); \
  240. PrintFieldName( "MacAddress" ); \
  241. dprint_hardware_address( _obj._field.MacAddress ); \
  242. dprintf( "%s", EOL ); \
  243. PrintEndStruct();
  244. #define PrintIPAddress( _field ) \
  245. PrintFieldName(#_field); \
  246. dprint_IP_address( _obj._field ); \
  247. dprintf( "%s", EOL );
  248. #define PrintLock(_field) \
  249. PrintFieldName(#_field) \
  250. dprintf("( 0x%08lx ) %-10s%s", (_obj._field), (_obj._field) ? "Locked" : "UnLocked", EOL)
  251. #define PrintTDIAddress( _field ) \
  252. PrintFieldName( #_field ); \
  253. dprintf( "{ NetworkAddress = %X, NodeAddress = ", _obj._field.NetworkAddress );\
  254. dprint_hardware_address( _obj._field.NodeAddress );\
  255. dprintf( ", Socket = %d }%s", _obj._field.Socket, EOL );
  256. #define PrintCTETimer( _field ) \
  257. dprintf( "%s", #_field ); \
  258. PrintStartStruct(); \
  259. DumpCTETimer ( ((ULONG)_objAddr) +FIELD_OFFSET( _objType, _field ), VERBOSITY_NORMAL );\
  260. PrintEndStruct();
  261. #define PrintCTEEvent( _field ) \
  262. dprintf( "%s", #_field ); \
  263. PrintStartStruct(); \
  264. DumpCTEEvent ( ((ULONG)_objAddr) +FIELD_OFFSET( _objType, _field ), VERBOSITY_NORMAL );\
  265. PrintEndStruct();
  266. #define PrintKEvent( _field ) \
  267. dprintf( "%s", #_field ); \
  268. PrintStartStruct(); \
  269. DumpKEvent ( ((ULONG)_objAddr) +FIELD_OFFSET( _objType, _field ), VERBOSITY_NORMAL );\
  270. PrintEndStruct();
  271. #define PrintWorkQueueItem( _field ) \
  272. dprintf( "%s", #_field ); \
  273. PrintStartStruct(); \
  274. DumpWorkQueueItem ( ((ULONG)_objAddr) +FIELD_OFFSET( _objType, _field ), VERBOSITY_NORMAL );\
  275. PrintEndStruct();
  276. #define PrintMacAddr( _field, _addr ) \
  277. PrintFieldName( #_field ); \
  278. dprint_hardware_address( _addr );\
  279. dprintf( "%s", EOL);
  280. #define PrintUString( _field ) \
  281. PrintFieldName( #_field ); \
  282. dprint_unicode_string( _obj._field );\
  283. dprintf( "%s", EOL);
  284. extern BOOLEAN ChkTarget;
  285. extern INT Item;
  286. #define CHECK_SIGNATURE( _field, _signature ) \
  287. if ( _obj._field != _signature ) \
  288. { \
  289. dprintf( "Object at %08X doesn't have signature %s at %08X\n", \
  290. _objAddr, \
  291. #_signature, \
  292. (( ULONG )_objAddr) + FIELD_OFFSET( _objType, _field ));\
  293. }