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.

282 lines
8.0 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. dldef.h
  5. Abstract:
  6. This module defines all internal constants in data link driver.
  7. Author:
  8. Antti Saarenheimo (o-anttis) 25-MAY-1991
  9. Revision History:
  10. --*/
  11. #define DEBUG_VERSION 1
  12. //
  13. // Marks for FSM compiler
  14. //
  15. #define FSM_DATA
  16. #define FSM_PREDICATE_CASES
  17. #define FSM_ACTION_CASES
  18. #define FSM_CONST
  19. #define MAX_NDIS_PACKETS 5 // 5 for XID/TEST and 5 for others
  20. #define LLC_OPEN_TIMEOUT 1200 // 60 seconds (enough for tr open?)
  21. #define DEFAULT_TR_ACCESS 0x50
  22. #define NON_MAC_FRAME 0x40
  23. //
  24. // 2nd source routing control bit
  25. //
  26. #define SRC_ROUTING_LF_MASK 0x70
  27. #define MAX_TR_LAN_HEADER_SIZE 32
  28. #define LLC_MAX_LAN_HEADER 32
  29. #define MAX_TR_SRC_ROUTING_INFO 18
  30. //
  31. // the next status values are used internally by DLCAPI driver:
  32. //
  33. #define CONFIRM_CONNECT 0x0008
  34. #define CONFIRM_DISCONNECT 0x0004
  35. #define CONFIRM_CONNECT_FAILED 0x0002
  36. //
  37. // The following structures define I-frame, U-frame, and S-frame DLC headers.
  38. //
  39. #define LLC_SSAP_RESPONSE 0x0001 // if (ssap & LLC_SSAP_RESP),it's a response.
  40. #define LLC_DSAP_GROUP 0x0001 // Dsap lowest bit set when group sap
  41. #define LLC_SSAP_GLOBAL 0x00ff // the global SAP.
  42. #define LLC_SSAP_NULL 0x0000 // the null SAP.
  43. #define LLC_SSAP_MASK 0x00fe // mask to wipe out the response bit.
  44. #define LLC_DSAP_MASK 0x00fe // mask to wipe out the group SAP bit.
  45. #define LLC_RR 0x01 // command code for RR.
  46. #define LLC_RNR 0x05 // command code for RNR.
  47. #define LLC_REJ 0x09 // command code for REJ.
  48. #define LLC_SABME 0x6f // command code for SABME.
  49. #define LLC_DISC 0x43 // command code for DISC.
  50. #define LLC_UA 0x63 // command code for UA.
  51. #define LLC_DM 0x0f // command code for DM.
  52. #define LLC_FRMR 0x87 // command code for FRMR.
  53. #define LLC_UI 0x03 // command code for UI.
  54. #define LLC_XID 0xaf // command code for XID.
  55. #define LLC_TEST 0xe3 // command code for TEST.
  56. #define IEEE_802_XID_ID 0x81 // IEEE 802.2 XID identifier
  57. #define LLC_CLASS_II 3 // we support LLC Class II
  58. #define LLC_S_U_TYPE_MASK 3
  59. #define LLC_U_TYPE 3
  60. #define LLC_U_TYPE_BIT 2
  61. #define LLC_S_TYPE 1
  62. #define LLC_NOT_I_FRAME 0x01
  63. #define LLC_U_INDICATOR 0x03 // (cmd & LLC_U_IND) == LLC_U_IND --> U-frame.
  64. #define LLC_U_POLL_FINAL 0x10 // (cmd & LLC_U_PF) -> poll/final set.
  65. #define LLC_I_S_POLL_FINAL 1
  66. //
  67. // You may use 2048 or 1024 if you want to make link more aggressively to
  68. // increment the transmit window when there has been a I-c1 retransmission
  69. // after a T1 timeout.
  70. //
  71. #define LLC_MAX_T1_TO_I_RATIO 4096
  72. //
  73. // Link station flags
  74. //
  75. #define DLC_WAITING_RESPONSE_TO_POLL 0x01
  76. #define DLC_FIRST_POLL 0x02
  77. #define DLC_ACTIVE_REMOTE_CONNECT_REQUEST 0x04
  78. #define DLC_SEND_DISABLED 0x10
  79. #define DLC_FINAL_RESPONSE_PENDING_IN_NDIS 0x20
  80. #define DLC_LOCAL_BUSY_BUFFER 0x40
  81. #define DLC_LOCAL_BUSY_USER 0x80
  82. //
  83. // Test file for FSM compiler!!!!
  84. //
  85. #ifdef FSM_CONST
  86. enum eLanLlcInput {
  87. DISC0 = 0,
  88. DISC1 = 1,
  89. DM0 = 2,
  90. DM1 = 3,
  91. FRMR0 = 4,
  92. FRMR1 = 5,
  93. SABME0 = 6,
  94. SABME1 = 7,
  95. UA0 = 8,
  96. UA1 = 9,
  97. IS_I_r0 = 10,
  98. IS_I_r1 = 11,
  99. IS_I_c0 = 12,
  100. IS_I_c1 = 13,
  101. OS_I_r0 = 14,
  102. OS_I_r1 = 15,
  103. OS_I_c0 = 16,
  104. OS_I_c1 = 17,
  105. REJ_r0 = 18,
  106. REJ_r1 = 19,
  107. REJ_c0 = 20,
  108. REJ_c1 = 21,
  109. RNR_r0 = 22,
  110. RNR_r1 = 23,
  111. RNR_c0 = 24,
  112. RNR_c1 = 25,
  113. RR_r0 = 26,
  114. RR_r1 = 27,
  115. RR_c0 = 28,
  116. RR_c1 = 29,
  117. LPDU_INVALID_r0 = 30,
  118. LPDU_INVALID_r1 = 31,
  119. LPDU_INVALID_c0 = 32,
  120. LPDU_INVALID_c1 = 33,
  121. ACTIVATE_LS = 34,
  122. DEACTIVATE_LS = 35,
  123. ENTER_LCL_Busy = 36,
  124. EXIT_LCL_Busy = 37,
  125. SEND_I_POLL = 38,
  126. SET_ABME = 39,
  127. SET_ADM = 40,
  128. Ti_Expired = 41,
  129. T1_Expired = 42,
  130. T2_Expired = 43
  131. };
  132. enum eLanLlcState {
  133. LINK_CLOSED = 0,
  134. DISCONNECTED = 1,
  135. LINK_OPENING = 2,
  136. DISCONNECTING = 3,
  137. FRMR_SENT = 4,
  138. LINK_OPENED = 5,
  139. LOCAL_BUSY = 6,
  140. REJECTION = 7,
  141. CHECKPOINTING = 8,
  142. CHKP_LOCAL_BUSY = 9,
  143. CHKP_REJECT = 10,
  144. RESETTING = 11,
  145. REMOTE_BUSY = 12,
  146. LOCAL_REMOTE_BUSY = 13,
  147. REJECT_LOCAL_BUSY = 14,
  148. REJECT_REMOTE_BUSY = 15,
  149. CHKP_REJECT_LOCAL_BUSY = 16,
  150. CHKP_CLEARING = 17,
  151. CHKP_REJECT_CLEARING = 18,
  152. REJECT_LOCAL_REMOTE_BUSY = 19,
  153. FRMR_RECEIVED = 20
  154. };
  155. #endif
  156. #define MAX_LLC_LINK_STATE 21 // KEEP THIS IN SYNC WITH PREV ENUM!!!!
  157. #define DLC_DSAP_OFFSET 0
  158. #define DLC_SSAP_OFFSET 1
  159. #define DLC_COMMAND_OFFSET 2
  160. #define DLC_XID_INFO_ID 3
  161. #define DLC_XID_INFO_TYPE 4
  162. #define DLC_XID_INFO_WIN_SIZE 5
  163. #define MAX_XID_TEST_RESPONSES 20
  164. enum _LLC_FRAME_XLATE_MODES {
  165. LLC_SEND_UNSPECIFIED = -1,
  166. LLC_SEND_802_5_TO_802_3,
  167. LLC_SEND_802_5_TO_DIX,
  168. LLC_SEND_802_5_TO_802_5,
  169. LLC_SEND_802_5_TO_FDDI,
  170. LLC_SEND_DIX_TO_DIX,
  171. LLC_SEND_802_3_TO_802_3,
  172. LLC_SEND_802_3_TO_DIX,
  173. LLC_SEND_802_3_TO_802_5,
  174. LLC_SEND_UNMODIFIED,
  175. LLC_SEND_FDDI_TO_FDDI,
  176. LLC_SEND_FDDI_TO_802_5,
  177. LLC_SEND_FDDI_TO_802_3
  178. };
  179. #define DLC_TOKEN_RESPONSE 0
  180. #define DLC_TOKEN_COMMAND 2
  181. //*********************************************************************
  182. // **** Objects in _DLC_CMD_TOKENs enumeration and in auchLlcCommands
  183. // **** table bust MUST ABSOLUTELY BE IN THE SAME ORDER, !!!!!!!!
  184. // **** THEY ARE USED TO COMPRESS ********
  185. // **** THE SEND INITIALIZATION ********
  186. //
  187. enum _DLC_CMD_TOKENS {
  188. DLC_REJ_TOKEN = 4,
  189. DLC_RNR_TOKEN = 8,
  190. DLC_RR_TOKEN = 12,
  191. DLC_DISC_TOKEN = 16 | DLC_TOKEN_COMMAND,
  192. DLC_DM_TOKEN = 20,
  193. DLC_FRMR_TOKEN = 24,
  194. DLC_SABME_TOKEN = 28 | DLC_TOKEN_COMMAND,
  195. DLC_UA_TOKEN = 32
  196. };
  197. enum _LLC_PACKET_TYPES {
  198. LLC_PACKET_8022 = 0,
  199. LLC_PACKET_MAC,
  200. LLC_PACKET_DIX,
  201. LLC_PACKET_OTHER_DESTINATION,
  202. LLC_PACKET_MAX
  203. };
  204. #define MAX_DIX_TABLE 13 // good odd number!
  205. enum _LlcSendCompletionTypes {
  206. LLC_XID_RESPONSE, // 802.2 XID response packet
  207. LLC_U_COMMAND_RESPONSE, // link command response
  208. LLC_MIN_MDL_PACKET, // all packets above this have MDL
  209. LLC_DIX_DUPLICATE, // used to duplicate TEST and XID packets
  210. LLC_TEST_RESPONSE, // Test response (buffer in non Paged Pool)
  211. LLC_MAX_RESPONSE_PACKET,// all packets above this are indicated to user
  212. LLC_TYPE_1_PACKET,
  213. LLC_TYPE_2_PACKET,
  214. //
  215. // We use extra status bits to indicate, when I- packet has been both
  216. // completed by NDIS and acknowledged the other side of link connection.
  217. // An I packet can be queued to the completion queue by
  218. // the second guy (either state machine or SendCompletion handler)
  219. // only when the first guy has set completed its work.
  220. // An I packet could be acknowledged by the other side before
  221. // its completion is indicated by NDIS. Dlc Driver deallocates
  222. // the packet immediately, when Llc driver completes the acknowledged
  223. // packet => possible data corruption (if packet is reused before
  224. // NDIS has completed it). This is probably not possible in a
  225. // single processor NT- system, but very possible in multiprocessor
  226. // NT or systems without a single level DPC queue (like OS/2 and DOS).
  227. //
  228. LLC_I_PACKET_COMPLETE = 0x10,
  229. LLC_I_PACKET_UNACKNOWLEDGED = 0x20,
  230. LLC_I_PACKET_PENDING_NDIS = 0x40,
  231. LLC_I_PACKET = 0x70, // when we are sending it
  232. LLC_I_PACKET_WAITING_NDIS = 0x80
  233. };
  234. #define LLC_MAX_MULTICAST_ADDRESS 32