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.

177 lines
5.0 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. hdrext.h
  5. Abstract:
  6. This file contains all declarations
  7. used in handling NBF / DLC Headers.
  8. Author:
  9. Chaitanya Kodeboyina
  10. Environment:
  11. User Mode
  12. --*/
  13. #ifndef __HDREXT_H
  14. #define __HDREXT_H
  15. //
  16. // Macros
  17. //
  18. #ifndef FIELD_OFFSET
  19. #define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field))
  20. #endif//FIELD_OFFSET
  21. //
  22. // Helper Prototypes
  23. //
  24. UINT ReadNbfPktHdr(PNBF_HDR pPktHdr, ULONG proxyPtr);
  25. UINT PrintNbfPktHdr(PNBF_HDR pPktHdr, ULONG proxyPtr, ULONG printDetail);
  26. UINT FreeNbfPktHdr(PNBF_HDR pPktHdr);
  27. //
  28. // Constants
  29. //
  30. #ifdef OFFSET
  31. #undef OFFSET
  32. #endif
  33. #define OFFSET(field) FIELD_OFFSET(NBF_HDR_GENERIC, field)
  34. //
  35. // A Generic View of any NBF Header
  36. //
  37. StructAccessInfo NbfGenPktHdrInfo =
  38. {
  39. "Nbf Generic Packet Header",
  40. {
  41. { "Length", OFFSET(Length), sizeof(USHORT), NULL, LOW },
  42. { "Signature", OFFSET(Signature), 2*sizeof(UCHAR), NULL, LOW },
  43. { "Command", OFFSET(Command), sizeof(UCHAR), NULL, NOR },
  44. { "Data1", OFFSET(Data1), sizeof(UCHAR), NULL, LOW },
  45. { "Data2", OFFSET(Data2), sizeof(USHORT), NULL, LOW },
  46. { "TransmitCorrelator",
  47. OFFSET(TransmitCorrelator),
  48. sizeof(USHORT), NULL, LOW },
  49. { "ResponseCorrelator",
  50. OFFSET(ResponseCorrelator),
  51. sizeof(USHORT), NULL, LOW },
  52. { "", 0, 0, NULL, LOW },
  53. 0
  54. }
  55. };
  56. //
  57. // NBF Header for a Connection-oriented data xfer
  58. //
  59. #ifdef OFFSET
  60. #undef OFFSET
  61. #endif
  62. #define OFFSET(field) FIELD_OFFSET(NBF_HDR_CONNECTION, field)
  63. StructAccessInfo NbfConnectionHdrInfo =
  64. {
  65. "Nbf CO Packet Header",
  66. {
  67. { "Length", OFFSET(Length), sizeof(USHORT), NULL, LOW },
  68. { "Signature", OFFSET(Signature), sizeof(USHORT), NULL, LOW },
  69. { "Command", OFFSET(Command), sizeof(UCHAR), NULL, NOR },
  70. { "Data1", OFFSET(Data1), sizeof(UCHAR), NULL, LOW },
  71. { "Data2Low", OFFSET(Data2Low), sizeof(UCHAR), NULL, LOW },
  72. { "Data2High", OFFSET(Data2High), sizeof(UCHAR), NULL, LOW },
  73. { "TransmitCorrelator",
  74. OFFSET(TransmitCorrelator),
  75. sizeof(USHORT), NULL, LOW },
  76. { "ResponseCorrelator",
  77. OFFSET(ResponseCorrelator),
  78. sizeof(USHORT), NULL, LOW },
  79. { "DestinationSessionNumber",
  80. OFFSET(DestinationSessionNumber),
  81. sizeof(UCHAR), NULL, LOW },
  82. { "SourceSessionNumber",
  83. OFFSET(SourceSessionNumber),
  84. sizeof(UCHAR), NULL, LOW },
  85. { "", 0, 0, NULL, LOW },
  86. 0
  87. }
  88. };
  89. //
  90. // NBF Header for a Connection-less data xfer
  91. //
  92. #ifdef OFFSET
  93. #undef OFFSET
  94. #endif
  95. #define OFFSET(field) FIELD_OFFSET(NBF_HDR_CONNECTIONLESS, field)
  96. StructAccessInfo NbfConnectionLessHdrInfo =
  97. {
  98. "Nbf CL Packet Header",
  99. {
  100. { "Length", OFFSET(Length), sizeof(USHORT), NULL, LOW },
  101. { "Signature", OFFSET(Signature), sizeof(USHORT), NULL, LOW },
  102. { "Command", OFFSET(Command), sizeof(UCHAR), NULL, NOR },
  103. { "Data1", OFFSET(Data1), sizeof(UCHAR), NULL, LOW },
  104. { "Data2Low", OFFSET(Data2Low), sizeof(UCHAR), NULL, LOW },
  105. { "Data2High", OFFSET(Data2High), sizeof(UCHAR), NULL, LOW },
  106. { "TransmitCorrelator",
  107. OFFSET(TransmitCorrelator),
  108. sizeof(USHORT), NULL, LOW },
  109. { "ResponseCorrelator",
  110. OFFSET(ResponseCorrelator),
  111. sizeof(USHORT), NULL, LOW },
  112. { "DestinationName",
  113. OFFSET(DestinationName),
  114. NETBIOS_NAME_LENGTH * sizeof(UCHAR), NULL, LOW },
  115. { "SourceName",
  116. OFFSET(SourceName),
  117. NETBIOS_NAME_LENGTH * sizeof(UCHAR), NULL, LOW },
  118. { "", 0, 0, NULL, LOW },
  119. 0
  120. }
  121. };
  122. #endif // __HDREXT_H