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.

233 lines
5.9 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. arppkt.h
  5. Abstract:
  6. Definitions for ATMARP packets
  7. Revision History:
  8. Who When What
  9. -------- -------- ----------------------------------------------
  10. arvindm 07-29-96 Created
  11. Notes:
  12. --*/
  13. #ifndef _ARP_PKT__H
  14. #define _ARP_PKT__H
  15. //
  16. // Rounded-off size of generic Q.2931 IE header
  17. //
  18. #define ROUND_OFF(_size) (((_size) + 3) & ~0x3)
  19. #define SIZEOF_Q2931_IE ROUND_OFF(sizeof(Q2931_IE))
  20. #define SIZEOF_AAL_PARAMETERS_IE ROUND_OFF(sizeof(AAL_PARAMETERS_IE))
  21. #define SIZEOF_ATM_TRAFFIC_DESCR_IE ROUND_OFF(sizeof(ATM_TRAFFIC_DESCRIPTOR_IE))
  22. #define SIZEOF_ATM_BBC_IE ROUND_OFF(sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE))
  23. #define SIZEOF_ATM_BLLI_IE ROUND_OFF(sizeof(ATM_BLLI_IE))
  24. #define SIZEOF_ATM_QOS_IE ROUND_OFF(sizeof(ATM_QOS_CLASS_IE))
  25. //
  26. // Total space required for Information Elements in an outgoing call.
  27. //
  28. #define ATMARP_MAKE_CALL_IE_SPACE ( \
  29. SIZEOF_Q2931_IE + SIZEOF_AAL_PARAMETERS_IE + \
  30. SIZEOF_Q2931_IE + SIZEOF_ATM_TRAFFIC_DESCR_IE + \
  31. SIZEOF_Q2931_IE + SIZEOF_ATM_BBC_IE + \
  32. SIZEOF_Q2931_IE + SIZEOF_ATM_BLLI_IE + \
  33. SIZEOF_Q2931_IE + SIZEOF_ATM_QOS_IE )
  34. //
  35. // Total space required for Information Elements in an outgoing AddParty.
  36. //
  37. #define ATMARP_ADD_PARTY_IE_SPACE ( \
  38. SIZEOF_Q2931_IE + SIZEOF_AAL_PARAMETERS_IE + \
  39. SIZEOF_Q2931_IE + SIZEOF_ATM_BLLI_IE )
  40. #define AA_IPV4_ADDRESS_LENGTH 4
  41. #define CLASSA_MASK 0x000000ff
  42. #define CLASSB_MASK 0x0000ffff
  43. #define CLASSC_MASK 0x00ffffff
  44. #define CLASSD_MASK 0x000000e0
  45. #define CLASSE_MASK 0xffffffff
  46. //
  47. // Standard values
  48. //
  49. #define AA_PKT_ATM_FORUM_AF 19
  50. #define AA_PKT_PRO_IP ((USHORT)0x800)
  51. //
  52. // Values for the LLC SNAP header
  53. //
  54. #define LLC_SNAP_LLC0 ((UCHAR)0xAA)
  55. #define LLC_SNAP_LLC1 ((UCHAR)0xAA)
  56. #define LLC_SNAP_LLC2 ((UCHAR)0x03)
  57. #define LLC_SNAP_OUI0 ((UCHAR)0x00)
  58. #define LLC_SNAP_OUI1 ((UCHAR)0x00)
  59. #define LLC_SNAP_OUI2 ((UCHAR)0x00)
  60. //
  61. // Values for EtherType
  62. //
  63. #define AA_PKT_ETHERTYPE_IP_NS ((USHORT)0x0008)
  64. #define AA_PKT_ETHERTYPE_IP ((USHORT)0x800)
  65. #define AA_PKT_ETHERTYPE_ARP ((USHORT)0x806)
  66. #include <pshpack1.h>
  67. //
  68. // LLC SNAP Header
  69. //
  70. typedef struct _AA_PKT_LLC_SNAP_HEADER
  71. {
  72. UCHAR LLC[3];
  73. UCHAR OUI[3];
  74. USHORT EtherType;
  75. } AA_PKT_LLC_SNAP_HEADER;
  76. typedef AA_PKT_LLC_SNAP_HEADER UNALIGNED *PAA_PKT_LLC_SNAP_HEADER;
  77. //
  78. // ATMARP Packet Common Header format
  79. //
  80. typedef struct _AA_ARP_PKT_HEADER
  81. {
  82. AA_PKT_LLC_SNAP_HEADER LLCSNAPHeader;
  83. USHORT hrd; // Hardware Type
  84. USHORT pro; // Protocol Type
  85. UCHAR shtl; // Source HW Addr Type+Length
  86. UCHAR sstl; // Source HW SubAddr Type+Length
  87. USHORT op; // Operation Code
  88. UCHAR spln; // Source Protocol Addr Length
  89. UCHAR thtl; // Target HW Addr Type+Length
  90. UCHAR tstl; // Target HW SubAddr Type+Length
  91. UCHAR tpln; // Target Protocol Addr Length
  92. UCHAR Variable[1]; // Start of the variable part
  93. } AA_ARP_PKT_HEADER;
  94. typedef AA_ARP_PKT_HEADER UNALIGNED *PAA_ARP_PKT_HEADER;
  95. #define AA_PKT_LLC_SNAP_HEADER_LENGTH (sizeof(AA_PKT_LLC_SNAP_HEADER))
  96. #define AA_ARP_PKT_HEADER_LENGTH (sizeof(AA_ARP_PKT_HEADER)-1)
  97. #include <poppack.h>
  98. //
  99. // Values for fields in an ARP packet header
  100. //
  101. #define AA_PKT_HRD ((USHORT)0x0013)
  102. #define AA_PKT_PRO ((USHORT)0x0800)
  103. #define AA_PKT_OP_TYPE_ARP_REQUEST ((USHORT)1)
  104. #define AA_PKT_OP_TYPE_ARP_REPLY ((USHORT)2)
  105. #define AA_PKT_OP_TYPE_INARP_REQUEST ((USHORT)8)
  106. #define AA_PKT_OP_TYPE_INARP_REPLY ((USHORT)9)
  107. #define AA_PKT_OP_TYPE_ARP_NAK ((USHORT)10)
  108. #define AA_PKT_ATM_ADDRESS_NSAP ((UCHAR)0x00)
  109. #define AA_PKT_ATM_ADDRESS_E164 ((UCHAR)0x40)
  110. #define AA_PKT_ATM_ADDRESS_BIT ((UCHAR)0x40)
  111. //
  112. // Internal representation of the contents of an
  113. // ARP packet:
  114. //
  115. typedef struct _AA_ARP_PKT_CONTENTS
  116. {
  117. UCHAR SrcAtmNumberTypeLen;
  118. UCHAR SrcAtmSubaddrTypeLen;
  119. UCHAR DstAtmNumberTypeLen;
  120. UCHAR DstAtmSubaddrTypeLen;
  121. UCHAR UNALIGNED * pSrcAtmNumber;
  122. UCHAR UNALIGNED * pSrcAtmSubaddress;
  123. UCHAR UNALIGNED * pDstAtmNumber;
  124. UCHAR UNALIGNED * pDstAtmSubaddress;
  125. UCHAR UNALIGNED * pSrcIPAddress;
  126. UCHAR UNALIGNED * pDstIPAddress;
  127. } AA_ARP_PKT_CONTENTS, *PAA_ARP_PKT_CONTENTS;
  128. /*++
  129. BOOLEAN
  130. AA_PKT_LLC_SNAP_HEADER_OK(
  131. IN PAA_PKT_LLC_SNAP_HEADER pPktHeader
  132. )
  133. Check if a received LLC/SNAP header is valid.
  134. --*/
  135. #define AA_PKT_LLC_SNAP_HEADER_OK(pH) \
  136. (((pH)->LLC[0] == LLC_SNAP_LLC0) && \
  137. ((pH)->LLC[1] == LLC_SNAP_LLC1) && \
  138. ((pH)->LLC[2] == LLC_SNAP_LLC2) && \
  139. ((pH)->OUI[0] == LLC_SNAP_OUI0) && \
  140. ((pH)->OUI[1] == LLC_SNAP_OUI1) && \
  141. ((pH)->OUI[2] == LLC_SNAP_OUI2))
  142. /*++
  143. UCHAR
  144. AA_PKT_ATM_ADDRESS_TO_TYPE_LEN(
  145. IN PATM_ADDRESS pAtmAddress
  146. )
  147. Return a one-byte Type+Length field corresponding to an ATM Address
  148. --*/
  149. #define AA_PKT_ATM_ADDRESS_TO_TYPE_LEN(pAtmAddress) \
  150. ((UCHAR)((pAtmAddress)->NumberOfDigits) | \
  151. (((pAtmAddress)->AddressType == ATM_E164) ? \
  152. AA_PKT_ATM_ADDRESS_E164 : AA_PKT_ATM_ADDRESS_NSAP))
  153. /*++
  154. VOID
  155. AA_PKT_TYPE_LEN_TO_ATM_ADDRESS(
  156. IN UCHAR TypeLen,
  157. IN ATM_ADDRESSTYPE * pAtmAddressType,
  158. IN ULONG * pAtmAddressLength
  159. )
  160. Convert a Type+Length field in an ATMARP packet to Type, Length
  161. values in an ATM_ADDRESS structure
  162. --*/
  163. #define AA_PKT_TYPE_LEN_TO_ATM_ADDRESS(TypeLen, pAtmType, pAtmLen) \
  164. { \
  165. *(pAtmType) = \
  166. ((((TypeLen) & AA_PKT_ATM_ADDRESS_BIT) == \
  167. AA_PKT_ATM_ADDRESS_E164)? ATM_E164: ATM_NSAP); \
  168. *(pAtmLen) = \
  169. (ULONG)((TypeLen) & ~AA_PKT_ATM_ADDRESS_BIT); \
  170. }
  171. //
  172. // ATM Address ESI length, and offset from the beginning.
  173. //
  174. #define AA_ATM_ESI_LEN 6
  175. #define AA_ATM_ESI_OFFSET 13
  176. //
  177. // DHCP constants
  178. //
  179. #define AA_DEST_DHCP_PORT_OFFSET 2
  180. #define AA_DHCP_SERVER_PORT 0x4300
  181. #define AA_DHCP_CLIENT_PORT 0x4400
  182. #define AA_DHCP_MIN_LENGTH 44
  183. #define AA_DHCP_ESI_OFFSET 28
  184. #endif // _ARP_PKT__H