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.

265 lines
8.2 KiB

  1. // Copyright (c) 1997, Microsoft Corporation, all rights reserved
  2. //
  3. // l2tprfc.h
  4. // RAS L2TP WAN mini-port/call-manager driver
  5. // L2TP RFC header
  6. //
  7. // 01/07/97 Steve Cobb
  8. //
  9. // This header contains definitions from the L2TP draft/RFC, currently
  10. // draft-12.
  11. //
  12. #ifndef _L2TPRFC_H_
  13. #define _L2TPRFC_H_
  14. //-----------------------------------------------------------------------------
  15. // Constants
  16. //-----------------------------------------------------------------------------
  17. // The UDP port at which L2TP messages will arrive.
  18. //
  19. #define L2TP_UdpPort 1701
  20. // The IP protocol number on which messages will arrive. (No number has been
  21. // assigned so this is a placeholder for now)
  22. //
  23. #define L2TP_IpProtocol 254
  24. // The standard value for the Hello timer in milliseconds.
  25. //
  26. #define L2TP_HelloMs 60000
  27. // The maximum number of bytes in a frame excluding all L2TP and PPP HDLC-ish
  28. // framing overhead.
  29. //
  30. #define L2TP_MaxFrameSize 1500
  31. // Maximum number of bytes in an L2TP control or payload header.
  32. //
  33. #define L2TP_MaxHeaderSize 14
  34. #define L2TP_MinHeaderSize 6
  35. // The maximum number of bytes in the L2TP payload packet header including
  36. // padding. The 14 represents all possible fields defined in the RFC. The
  37. // "+8" represents allowance for up to 8 bytes of padding to be specified in
  38. // the header. While there is theoretically no limit to the padding, there is
  39. // no discussion in the L2TP forum indicating interest in more than 8 bytes.
  40. //
  41. #define L2TP_MaxPayloadHeader (14 + 8)
  42. // The default packet processing delay in 1/10 second, i.e. 1/2 second.
  43. //
  44. #define L2TP_LnsDefaultPpd 5
  45. // The default control send timeout in milliseconds, i.e. 1 second.
  46. //
  47. #define L2TP_DefaultSendTimeoutMs 1000
  48. // The default control/payload piggybacking acknowledge delay in milliseconds.
  49. //
  50. #define L2TP_MaxAckDelay 500
  51. // The implicit receive window offered control channels where no Receive
  52. // Window AVP is provided.
  53. //
  54. #define L2TP_DefaultReceiveWindow 4
  55. // Highest L2TP protocol version we support.
  56. //
  57. #define L2TP_ProtocolVersion 0x0100
  58. // Default maximum send timeout in milliseconds. The draft only says the cap
  59. // must be no less than 8 seconds, so 10 seconds is selected as reasonable and
  60. // safe.
  61. //
  62. #define L2TP_DefaultMaxSendTimeoutMs 10000
  63. // Default maximum retransmissions before assuming peer is unreachable.
  64. //
  65. #define L2TP_DefaultMaxRetransmits 5
  66. // Size in bytes of the fixed portion of a control message attribute/value
  67. // pair, i.e. the size of an AVP with zero length value.
  68. //
  69. #define L2TP_AvpHeaderSize 6
  70. // L2TP protocol control message types.
  71. //
  72. #define CMT_SCCRQ 1 // Start-Control-Connection-Request
  73. #define CMT_SCCRP 2 // Start-Control-Connection-Reply
  74. #define CMT_SCCCN 3 // Start-Control-Connection-Connected
  75. #define CMT_StopCCN 4 // Stop-Control-Connection-Notify
  76. #define CMT_StopCCRP 5 // Stop-Control-Connection-Reply (obsolete)
  77. #define CMT_Hello 6 // Hello, i.e. keep-alive
  78. #define CMT_OCRQ 7 // Outgoing-Call-Request
  79. #define CMT_OCRP 8 // Outgoing-Call-Reply
  80. #define CMT_OCCN 9 // Outgoing-Call-Connected
  81. #define CMT_ICRQ 10 // Incoming-Call-Request
  82. #define CMT_ICRP 11 // Incoming-Call-Reply
  83. #define CMT_ICCN 12 // Incoming-Call-Connected
  84. #define CMT_CCRQ 13 // Call-Clear-Request (obsolete)
  85. #define CMT_CDN 14 // Call-Disconnect-Notify
  86. #define CMT_WEN 15 // WAN-Error-Notify
  87. #define CMT_SLI 16 // Set-Link-Info
  88. // L2TP Attribute codes.
  89. //
  90. #define ATTR_MsgType 0
  91. #define ATTR_Result 1
  92. #define ATTR_ProtocolVersion 2
  93. #define ATTR_FramingCaps 3
  94. #define ATTR_BearerCaps 4
  95. #define ATTR_TieBreaker 5
  96. #define ATTR_FirmwareRevision 6
  97. #define ATTR_HostName 7
  98. #define ATTR_VendorName 8
  99. #define ATTR_AssignedTunnelId 9
  100. #define ATTR_RWindowSize 10
  101. #define ATTR_Challenge 11
  102. #define ATTR_Q931Cause 12
  103. #define ATTR_ChallengeResponse 13
  104. #define ATTR_AssignedCallId 14
  105. #define ATTR_CallSerialNumber 15
  106. #define ATTR_MinimumBps 16
  107. #define ATTR_MaximumBps 17
  108. #define ATTR_BearerType 18
  109. #define ATTR_FramingType 19
  110. #define ATTR_PacketProcDelay 20
  111. #define ATTR_DialedNumber 21
  112. #define ATTR_DialingNumber 22
  113. #define ATTR_SubAddress 23
  114. #define ATTR_TxConnectSpeed 24
  115. #define ATTR_PhysicalChannelId 25
  116. #define ATTR_InitialLcpConfig 26
  117. #define ATTR_LastSLcpConfig 27
  118. #define ATTR_LastRLcpConfig 28
  119. #define ATTR_ProxyAuthType 29
  120. #define ATTR_ProxyAuthName 30
  121. #define ATTR_ProxyAuthChallenge 31
  122. #define ATTR_ProxyAuthId 32
  123. #define ATTR_ProxyAuthResponse 33
  124. #define ATTR_CallErrors 34
  125. #define ATTR_Accm 35
  126. #define ATTR_RandomVector 36
  127. #define ATTR_PrivateGroupId 37
  128. #define ATTR_RxConnectSpeed 38
  129. #define ATTR_SequencingRequired 39
  130. #define ATTR_MAX 39
  131. // L2TP protocol general error codes.
  132. //
  133. #define GERR_None 0
  134. #define GERR_NoControlConnection 1
  135. #define GERR_BadLength 2
  136. #define GERR_BadValue 3
  137. #define GERR_NoResources 4
  138. #define GERR_BadCallId 5
  139. #define GERR_VendorSpecific 6
  140. #define GERR_TryAnother 7
  141. // Tunnel Result Code AVP values, used in StopCCN message.
  142. //
  143. #define TRESULT_General 1
  144. #define TRESULT_GeneralWithError 2
  145. #define TRESULT_CcExists 3
  146. #define TRESULT_NotAuthorized 4
  147. #define TRESULT_BadProtocolVersion 5
  148. #define TRESULT_Shutdown 6
  149. #define TRESULT_FsmError 7
  150. // Call Result Code values, used in CDN message.
  151. //
  152. #define CRESULT_LostCarrier 1
  153. #define CRESULT_GeneralWithError 2
  154. #define CRESULT_Administrative 3
  155. #define CRESULT_NoFacilitiesTemporary 4
  156. #define CRESULT_NoFacilitiesPermanent 5
  157. #define CRESULT_InvalidDestination 6
  158. #define CRESULT_NoCarrier 7
  159. #define CRESULT_Busy 8
  160. #define CRESULT_NoDialTone 9
  161. #define CRESULT_Timeout 10
  162. #define CRESULT_NoFraming 11
  163. // L2TP header bitmasks for the first 2 bytes of every L2TP message.
  164. //
  165. #define HBM_T 0x8000 // Control packet
  166. #define HBM_L 0x4000 // Length field present
  167. #define HBM_R 0x2000 // Reset Sr
  168. #define HBM_F 0x0800 // Nr/Ns fields present
  169. #define HBM_S 0x0200 // Offset field present
  170. #define HBM_P 0x0100 // Preferential treatment bit
  171. #define HBM_Bits 0xFFFC // All bits, excluding protocol version field
  172. #define HBM_Ver 0x0003 // Protocol version (L2TP or L2F)
  173. #define HBM_Control 0xc800 // Fixed value of bits in control message
  174. // The defined header bits version number field values.
  175. //
  176. #define VER_L2f 0x0000
  177. #define VER_L2tp 0x0002
  178. // AVP header bitmasks for the first 2 bytes of every Attribute Value Pair.
  179. //
  180. #define ABM_M 0x8000 // Mandatory
  181. #define ABM_H 0x4000 // Hidden
  182. #define ABM_Reserved 0x3C00 // Reserved bits, must be 0
  183. #define ABM_OverallLength 0x03FF // AVP's length including value
  184. // Bearer capabilties AVP bitmasks.
  185. //
  186. #define BBM_Analog 0x00000001
  187. #define BBM_Digital 0x00000002
  188. // Framing capabilities/type AVP bitmasks.
  189. //
  190. #define FBM_Sync 0x00000001
  191. #define FBM_Async 0x00000002
  192. // Proxy Authentication types.
  193. //
  194. #define PAT_Text 1
  195. #define PAT_Chap 2
  196. #define PAT_Pap 3
  197. #define PAT_None 4
  198. //-----------------------------------------------------------------------------
  199. // Data types
  200. //-----------------------------------------------------------------------------
  201. // The "Control Connection" state of a single L2TP tunnel.
  202. //
  203. typedef enum
  204. _L2TPCCSTATE
  205. {
  206. CCS_Idle = 0,
  207. CCS_WaitCtlReply,
  208. CCS_WaitCtlConnect,
  209. CCS_Established
  210. }
  211. L2TPCCSTATE;
  212. // The "LNS/LAC Outgoing/Incoming Call" state of a single L2TP VC. Only one
  213. // of the 4 call creation FSMs can be running or Established on a single VC at
  214. // once, so the states are combined in a single table.
  215. //
  216. typedef enum
  217. _L2TPCALLSTATE
  218. {
  219. CS_Idle = 0,
  220. CS_WaitTunnel,
  221. CS_WaitReply,
  222. CS_WaitConnect,
  223. CS_WaitDisconnect,
  224. CS_WaitCsAnswer,
  225. CS_Established
  226. }
  227. L2TPCALLSTATE;
  228. #endif // _L2TPRFC_H_