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.

753 lines
32 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. wanioctl.h
  5. Abstract:
  6. This is the main file for the NdisWan Driver for the Remote Access
  7. Service. This driver conforms to the NDIS 3.0 interface.
  8. Author:
  9. Thomas J. Dimitri (TommyD) 08-May-1992
  10. Environment:
  11. Kernel Mode - Or whatever is the equivalent on OS/2 and DOS.
  12. Revision History:
  13. --*/
  14. // All AsyncMac errors start with this base number
  15. #define ASYBASE 700
  16. // The Mac has not bound to an upper protocol, or the
  17. // previous binding to AsyncMac has been destroyed.
  18. #define ASYNC_ERROR_NO_ADAPTER ASYBASE+0
  19. // A port was attempted to be open that was not CLOSED yet.
  20. #define ASYNC_ERROR_ALREADY_OPEN ASYBASE+1
  21. // All the ports (allocated) are used up or there is
  22. // no binding to the AsyncMac at all (and thus no ports).
  23. // The number of ports allocated comes from the registry.
  24. #define ASYNC_ERROR_NO_PORT_AVAILABLE ASYBASE+2
  25. // In the open IOCtl to the AsyncParameter the Adapter
  26. // parameter passed was invalid.
  27. #define ASYNC_ERROR_BAD_ADAPTER_PARAM ASYBASE+3
  28. // During a close or compress request, the port
  29. // specified did not exist.
  30. #define ASYNC_ERROR_PORT_NOT_FOUND ASYBASE+4
  31. // A request came in for the port which could not
  32. // be handled because the port was in a bad state.
  33. // i.e. you can't a close a port if its state is OPENING
  34. #define ASYNC_ERROR_PORT_BAD_STATE ASYBASE+5
  35. // A call to ASYMAC_COMPRESS was bad with bad
  36. // parameters. That is, parameters that were not
  37. // supported. The fields will not be set to the bad params.
  38. #define ASYNC_ERROR_BAD_COMPRESSION_INFO ASYBASE+6
  39. //-------------- NDISWAN SPECIFIC RETURN CODES --------------------
  40. // A request for information came in for an endpoint handle
  41. // which does not exist (out of range)
  42. #define NDISWAN_ERROR_BAD_ENDPOINT ASYBASE+40
  43. // A request for information came in for a protocol handle
  44. // which does not exist (out of range)
  45. #define NDISWAN_ERROR_BAD_PROTOCOL ASYBASE+41
  46. // A request for a route which already existed came in
  47. #define NDISWAN_ERROR_ALREADY_ROUTED ASYBASE+42
  48. // A request for a route exceeded the routing tables capabilities
  49. #define NDISWAN_ERROR_TOO_MANY_ROUTES ASYBASE+43
  50. // Send packet has wrong packet size
  51. #define NDISWAN_ERROR_BAD_PACKET_SIZE ASYBASE+44
  52. // BindAddress has an address already used as an endpoint (duplicate address)
  53. #define NDISWAN_ERROR_BAD_ADDRESS ASYBASE+45
  54. // Endpoint has an address already bound to it
  55. #define NDISWAN_ERROR_ALREADY_BOUND ASYBASE+46
  56. // Endpoint was routed without being bound to a remote address
  57. #define NDISWAN_ERROR_NOT_BOUND_YET ASYBASE+47
  58. // Here we define the DevIOCtl code for the ndiswan
  59. //
  60. // IOCTLs for user-mode requests.
  61. //
  62. // Token-ring and Ethernet address lengths
  63. #define IEEE_ADDRESS_LENGTH 6
  64. // The max packet size information should be picked in a call!!!
  65. // Maximum size of packet that can be sent/rcvd via NDISWAN_SENDPKT/RECVPKT
  66. #define PACKET_SIZE 1500
  67. // Two 6 byte addreses plus the type/length field (used in RECVPKT)
  68. // Native addressing schemes may have a different header size!!!
  69. #define HEADER_SIZE 14
  70. // When unrouting an endpoint (hNdisHandle) specify the PROTOCOL_UNROUTE
  71. #define PROTOCOL_UNROUTE 0xFFFF
  72. // we need to get this device defined in sdk\inc\devioctl.h
  73. // for now, I will use 30, since no one is using it yet!
  74. // Beware that the NDIS Wrapper uses IOCTLs based on
  75. // FILE_DEVICE_PHYSICAL_NETCARD
  76. //#define FILE_DEVICE_NDIS 0x30
  77. // below is the standard method for defining IOCTLs for your
  78. // device given that your device is unique.
  79. // we need to get this device defined in sdk\inc\devioctl.h
  80. // for now, I will use 30, since no one is using it yet!
  81. // Beware that the NDIS Wrapper uses IOCTLs based on
  82. // FILE_DEVICE_PHYSICAL_NETCARD
  83. #define FILE_DEVICE_RAS 0x30
  84. // below is the standard method for defining IOCTLs for your
  85. // device given that your device is unique.
  86. #define _RAS_CONTROL_CODE(request,method) \
  87. ((FILE_DEVICE_RAS)<<16 | (request<<2) | method)
  88. #define IOCTL_ASYMAC_OPEN _RAS_CONTROL_CODE(10, METHOD_BUFFERED )
  89. #define IOCTL_ASYMAC_CLOSE _RAS_CONTROL_CODE(11, METHOD_BUFFERED )
  90. //#define IOCTL_ASYMAC_COMPRESS _RAS_CONTROL_CODE(12, METHOD_BUFFERED )
  91. //#define IOCTL_ASYMAC_ENUM _RAS_CONTROL_CODE(13, METHOD_BUFFERED )
  92. //#define IOCTL_ASYMAC_GETSTATS _RAS_CONTROL_CODE(14, METHOD_BUFFERED )
  93. #define IOCTL_ASYMAC_TRACE _RAS_CONTROL_CODE(15, METHOD_BUFFERED )
  94. #define IOCTL_NDISWAN_ENUM _RAS_CONTROL_CODE(6, METHOD_BUFFERED )
  95. #define IOCTL_NDISWAN_ROUTE _RAS_CONTROL_CODE(7, METHOD_BUFFERED )
  96. #define IOCTL_NDISWAN_GETSTATS _RAS_CONTROL_CODE(8, METHOD_BUFFERED )
  97. #define IOCTL_NDISWAN_PROTENUM _RAS_CONTROL_CODE(9, METHOD_BUFFERED )
  98. #define IOCTL_NDISWAN_SENDPKT _RAS_CONTROL_CODE(10, METHOD_BUFFERED )
  99. #define IOCTL_NDISWAN_RECVPKT _RAS_CONTROL_CODE(11, METHOD_BUFFERED )
  100. #define IOCTL_NDISWAN_FLUSH _RAS_CONTROL_CODE(12, METHOD_BUFFERED )
  101. #define IOCTL_NDISWAN_TRACE _RAS_CONTROL_CODE(13, METHOD_BUFFERED )
  102. #define IOCTL_NDISWAN_INFO _RAS_CONTROL_CODE(24, METHOD_BUFFERED )
  103. #define IOCTL_NDISWAN_SET_LINK_INFO _RAS_CONTROL_CODE(25, METHOD_BUFFERED )
  104. #define IOCTL_NDISWAN_GET_LINK_INFO _RAS_CONTROL_CODE(26, METHOD_BUFFERED )
  105. #define IOCTL_NDISWAN_SET_BRIDGE_INFO _RAS_CONTROL_CODE(27, METHOD_BUFFERED )
  106. #define IOCTL_NDISWAN_GET_BRIDGE_INFO _RAS_CONTROL_CODE(28, METHOD_BUFFERED )
  107. #define IOCTL_NDISWAN_SET_COMP_INFO _RAS_CONTROL_CODE(29, METHOD_BUFFERED )
  108. #define IOCTL_NDISWAN_GET_COMP_INFO _RAS_CONTROL_CODE(30, METHOD_BUFFERED )
  109. #define IOCTL_NDISWAN_SET_VJ_INFO _RAS_CONTROL_CODE(31, METHOD_BUFFERED )
  110. #define IOCTL_NDISWAN_GET_VJ_INFO _RAS_CONTROL_CODE(32, METHOD_BUFFERED )
  111. #define IOCTL_NDISWAN_SET_CIPX_INFO _RAS_CONTROL_CODE(33, METHOD_BUFFERED )
  112. #define IOCTL_NDISWAN_GET_CIPX_INFO _RAS_CONTROL_CODE(34, METHOD_BUFFERED )
  113. #define IOCTL_NDISWAN_SET_MULTILINK_INFO _RAS_CONTROL_CODE(35, METHOD_BUFFERED )
  114. #define IOCTL_NDISWAN_GET_MULTILINK_INFO _RAS_CONTROL_CODE(36, METHOD_BUFFERED )
  115. #define IOCTL_ASYMAC_DCDCHANGE _RAS_CONTROL_CODE(40, METHOD_BUFFERED )
  116. //#define IOCTL_ASYMAC_STARTFRAMING _RAS_CONTROL_CODE(41, METHOD_BUFFERED )
  117. #define IOCTL_NDISWAN_LINEUP _RAS_CONTROL_CODE(42, METHOD_BUFFERED )
  118. #define IOCTL_NDISWAN_ENUM_ACTIVE_BUNDLES _RAS_CONTROL_CODE(45, METHOD_BUFFERED )
  119. // Currently a global array of pointers is used
  120. // which must be predefined to some constant.
  121. // The current restriction seems to be 256
  122. #define MAX_ENDPOINTS 256
  123. #define MAX_PROTOCOL_BINDINGS 256
  124. #define MAX_MAC_BINDINGS 48
  125. #define MAC_NAME_SIZE 32
  126. // Here we define the WanEnumBuffer structure
  127. //------------------------------------------------------------------------
  128. //------------------------------- ENDPOINTS ------------------------------
  129. //------------------------------------------------------------------------
  130. // We assume that the most number of protocols a client will run
  131. // is three for now... that is a client can run TCP/IP, IPX, NBF at
  132. // the same time, but not a fourth protocol.
  133. #define MAX_ROUTES_PER_ENDPOINT 3
  134. // The bytes transmitted, bytes received, frames received, frame transmitted
  135. // are monitored for frame and bytes going to the output device or
  136. // coming from the output device. If software compression used, it
  137. // is on top of this layer.
  138. typedef struct GENERIC_STATS GENERIC_STATS, *PGENERIC_STATS;
  139. struct GENERIC_STATS {
  140. ULONG BytesTransmitted; // Generic info
  141. ULONG BytesReceived; // Generic info
  142. ULONG FramesTransmitted; // Generic info
  143. ULONG FramesReceived; // Generic info
  144. };
  145. // o CRC errors are when the 16bit V.41 CRC check fails
  146. // o TimeoutErrors occur when inter-character delays within
  147. // a frame are exceeded
  148. // o AlignmentErrors occur when the SYN byte or ETX bytes which
  149. // mark the beginning and end of frames are not found.
  150. // o The other errors are standard UART errors returned by the serial driver
  151. typedef struct SERIAL_STATS SERIAL_STATS, *PSERIAL_STATS;
  152. struct SERIAL_STATS {
  153. ULONG CRCErrors; // Serial-like info only
  154. ULONG TimeoutErrors; // Serial-like info only
  155. ULONG AlignmentErrors; // Serial-like info only
  156. ULONG SerialOverrunErrors; // Serial-like info only
  157. ULONG FramingErrors; // Serial-like info only
  158. ULONG BufferOverrunErrors; // Serial-like info only
  159. };
  160. typedef struct WAN_STATS WAN_STATS, *PWAN_STATS;
  161. struct WAN_STATS {
  162. ULONG BytesSent;
  163. ULONG BytesRcvd;
  164. ULONG FramesSent;
  165. ULONG FramesRcvd;
  166. ULONG CRCErrors; // Serial-like info only
  167. ULONG TimeoutErrors; // Serial-like info only
  168. ULONG AlignmentErrors; // Serial-like info only
  169. ULONG SerialOverrunErrors; // Serial-like info only
  170. ULONG FramingErrors; // Serial-like info only
  171. ULONG BufferOverrunErrors; // Serial-like info only
  172. ULONG BytesTransmittedUncompressed; // Compression info only
  173. ULONG BytesReceivedUncompressed; // Compression info only
  174. ULONG BytesTransmittedCompressed; // Compression info only
  175. ULONG BytesReceivedCompressed; // Compression info only
  176. };
  177. typedef struct ROUTE_INFO ROUTE_INFO, *PROUTE_INFO;
  178. struct ROUTE_INFO {
  179. USHORT ProtocolType; // <1500 (NetBEUI), IP, IPX, AppleTalk
  180. NDIS_HANDLE ProtocolRoutedTo; // Handle of protocol to send/recv frames
  181. };
  182. //
  183. // The structure passed up on a WAN_LINE_UP indication
  184. //
  185. typedef struct _ASYNC_LINE_UP {
  186. ULONG LinkSpeed; // 100 bps units
  187. ULONG MaximumTotalSize; // suggested max for send packets
  188. NDIS_WAN_QUALITY Quality;
  189. USHORT SendWindow; // suggested by the MAC
  190. UCHAR RemoteAddress[6]; // check for in SRC field when rcv
  191. UCHAR LocalAddress[6]; // use SRC field when sending
  192. USHORT Endpoint; // can we get rid of this!!
  193. USHORT ProtocolType; // protocol type
  194. ULONG BufferLength; // length of protocol specific buffer
  195. UCHAR Buffer[1]; // protocol specific buffer
  196. } ASYNC_LINE_UP, *PASYNC_LINE_UP;
  197. typedef struct _NDISMAC_LINE_UP {
  198. IN ULONG LinkSpeed;
  199. IN NDIS_WAN_QUALITY Quality;
  200. IN USHORT SendWindow;
  201. IN NDIS_HANDLE ConnectionWrapperID; // TAPI Cookie
  202. IN NDIS_HANDLE NdisLinkHandle;
  203. OUT NDIS_HANDLE NdisLinkContext;
  204. } NDISMAC_LINE_UP, *PNDISMAC_LINE_UP;
  205. typedef struct NDISWAN_INFO NDISWAN_INFO, *PNDISWAN_INFO;
  206. struct NDISWAN_INFO {
  207. ULONG MaxFrameSize;
  208. ULONG MaxTransmit;
  209. ULONG HeaderPadding;
  210. ULONG TailPadding;
  211. ULONG Endpoints;
  212. UINT MemoryFlags;
  213. NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress;
  214. ULONG FramingBits;
  215. ULONG DesiredACCM;
  216. ULONG MaxReconstructedFrameSize;
  217. };
  218. //------------------------------------------------------------------------
  219. //----------------------------- PROTOCOL INFO ----------------------------
  220. //------------------------------------------------------------------------
  221. // There is a PROTOCOL_INFO struct per NDIS protocol binding to NdisWan.
  222. // NOTE: Most protocols will bind multiple times to the NdisWan.
  223. #define PROTOCOL_NBF 0x80D5
  224. #define PROTOCOL_IP 0x0800
  225. #define PROTOCOL_ARP 0x0806
  226. #define PROTOCOL_IPX 0x8137
  227. #define PROTOCOL_APPLETALK 0x80F3
  228. #define PROTOCOL_XNS 0x0807
  229. typedef struct PROTOCOL_INFO PROTOCOL_INFO, *PPROTOCOL_INFO;
  230. struct PROTOCOL_INFO {
  231. NDIS_HANDLE hProtocolHandle; // Order at which protocol bound to NdisWan
  232. ULONG NumOfRoutes; // Num of routes this endpoint has
  233. NDIS_MEDIUM MediumType; // NdisMedium802_5, NdisMediumAsync
  234. USHORT ProtocolType; // EtherType of NBF, IP, IPX, AppleTalk..
  235. USHORT AdapterNameLength; // Up to 16...
  236. WCHAR AdapterName[MAC_NAME_SIZE];
  237. // First 16 chars of MAC name
  238. // like "NdisWan01"
  239. // Used to figure out LANA..
  240. NDIS_HANDLE MacBindingHandle;
  241. NDIS_HANDLE MacAdapterContext; // needed by NdisMan or me?
  242. NDIS_HANDLE NdisBindingContext; // needed by NdisMan or me?
  243. };
  244. typedef struct PROTOCOL_ENUM_BUFFER PROTOCOL_ENUM_BUFFER, *PPROTOCOL_ENUM_BUFFER;
  245. struct PROTOCOL_ENUM_BUFFER {
  246. ULONG NumOfProtocols; // One for each NDIS Upper Binding
  247. // Not for each DIFFERENT Protocol
  248. PROTOCOL_INFO ProtocolInfo[];
  249. };
  250. typedef struct _ENUM_ACTIVE_BUNDLES ENUM_ACTIVE_BUNDLES, *PENUM_ACTIVE_BUNDLES;
  251. struct _ENUM_ACTIVE_BUNDLES {
  252. ULONG NumberOfActiveBundles;
  253. };
  254. //------------------------------------------------------------------------
  255. //------------------------ ASYMAC IOCTL STRUCTS --------------------------
  256. //------------------------------------------------------------------------
  257. // this structure is passed in as the input buffer when opening a port
  258. typedef struct ASYMAC_OPEN ASYMAC_OPEN, *PASYMAC_OPEN;
  259. struct ASYMAC_OPEN {
  260. OUT NDIS_HANDLE hNdisEndpoint; // unique for each endpoint assigned
  261. IN ULONG LinkSpeed; // RAW link speed in bits per sec
  262. IN USHORT QualOfConnect; // NdisAsyncRaw, NdisAsyncErrorControl, ...
  263. IN HANDLE FileHandle; // the Win32 or Nt File Handle
  264. };
  265. // this structure is passed in as the input buffer when closing a port
  266. typedef struct ASYMAC_CLOSE ASYMAC_CLOSE, *PASYMAC_CLOSE;
  267. struct ASYMAC_CLOSE {
  268. NDIS_HANDLE hNdisEndpoint; // unique for each endpoint assigned
  269. PVOID MacAdapter; // Which binding to AsyMac to use -- if set
  270. // to NULL, will default to last binding
  271. };
  272. typedef struct ASYMAC_DCDCHANGE ASYMAC_DCDCHANGE, *PASYMAC_DCDCHANGE;
  273. struct ASYMAC_DCDCHANGE {
  274. NDIS_HANDLE hNdisEndpoint; // unique for each endpoint assigned
  275. PVOID MacAdapter; // Which binding to AsyMac to use -- if set
  276. // to NULL, will default to last binding
  277. };
  278. // this structure is used to read/set configurable 'feature' options
  279. // during authentication this structure is passed and an
  280. // agreement is made which features to support
  281. typedef struct ASYMAC_FEATURES ASYMAC_FEATURES, *PASYMAC_FEATURES;
  282. struct ASYMAC_FEATURES {
  283. ULONG SendFeatureBits; // A bit field of compression/features sendable
  284. ULONG RecvFeatureBits; // A bit field of compression/features receivable
  285. ULONG MaxSendFrameSize; // Maximum frame size that can be sent
  286. // must be less than or equal default
  287. ULONG MaxRecvFrameSize; // Maximum frame size that can be rcvd
  288. // must be less than or equal default
  289. ULONG LinkSpeed; // New RAW link speed in bits/sec
  290. // Ignored if 0
  291. };
  292. // TransmittedUncompressed are the number of bytes that the compressor
  293. // saw BEFORE attempting to compress the data (top end)
  294. // TransmitCompressed is the bottom end of the compressor which
  295. // is equal to the amount of bytes the compressor spat out (after compression)
  296. // This only counts bytes that went THROUGH the compression mechanism
  297. // Small frames and multi-cast frames (typically) do not get compressed.
  298. typedef struct COMPRESSION_STATS COMPRESSION_STATS, *PCOMPRESSION_STATS;
  299. struct COMPRESSION_STATS {
  300. ULONG BytesTransmittedUncompressed; // Compression info only
  301. ULONG BytesReceivedUncompressed; // Compression info only
  302. ULONG BytesTransmittedCompressed; // Compression info only
  303. ULONG BytesReceivedCompressed; // Compression info only
  304. };
  305. //------------------------------------------------------------------------
  306. //------------------------ NDISWAN IOCTL STRUCTS --------------------------
  307. //------------------------------------------------------------------------
  308. // Define for PACKET_FLAGS
  309. #define PACKET_IS_DIRECT 0x01
  310. #define PACKET_IS_BROADCAST 0x02
  311. #define PACKET_IS_MULTICAST 0x04
  312. // Define for FLUSH_FLAGS
  313. #define FLUSH_RECVPKT 0x01
  314. #define FLUSH_SENDPKT 0x02
  315. // The packet just contains data (no IEEE addresses or anything)
  316. // Should it?? Get rid of PACKET_FLAGS??
  317. typedef struct PACKET PACKET, *PPACKET;
  318. struct PACKET {
  319. UCHAR PacketData[1];
  320. };
  321. // When unrouting an endpoint (hNdisHandle) specify the PROTOCOL_UNROUTE
  322. #define PROTOCOL_UNROUTE 0xFFFF
  323. // This structure is passed in as the input buffer when routing
  324. typedef struct NDISWAN_ROUTE NDISWAN_ROUTE, *PNDISWAN_ROUTE;
  325. struct NDISWAN_ROUTE {
  326. NDIS_HANDLE hNdisEndpoint; // The NdisMan/NdisWan/AsyMac endpoint
  327. NDIS_HANDLE hProtocolHandle; // The upper unique protocol (up to 3)
  328. ASYNC_LINE_UP AsyncLineUp; // Include the protocol specific field
  329. };
  330. // This structure is passed in AND out as the input buffer AND
  331. // the output buffer when receiving and sending a frame.
  332. typedef struct NDISWAN_PKT NDISWAN_PKT, *PNDISWAN_PKT;
  333. struct NDISWAN_PKT { // Event is singalled via IOCtl mechanisms
  334. NDIS_HANDLE hNdisEndpoint; // The NdisMan/NdisWan/AsyMac endpoint
  335. USHORT PacketFlags; // Broadcast, Multicast, Directed..
  336. USHORT PacketSize; // Size of packet below (including the header)
  337. USHORT HeaderSize; // Size of header inside packet
  338. PACKET Packet; // Not a pointer -- entire packet struct
  339. // We cannot use a PTR because it
  340. // cannot be probed easily...
  341. // Packet looks like - header data + sent data
  342. // HeaderSize of 0 is valid for sends
  343. };
  344. typedef struct NDISWAN_FLUSH NDISWAN_FLUSH, *PNDISWAN_FLUSH;
  345. struct NDISWAN_FLUSH { // Event is singalled via IOCtl mechanisms
  346. NDIS_HANDLE hNdisEndpoint; // The NdisMan/NdisWan/AsyMac endpoint
  347. USHORT FlushFlags; // Recv | Xmit flush (or both)
  348. };
  349. // This structure is passed in AND out as the input buffer AND
  350. // the output buffer when get stats on an endpoint
  351. typedef struct NDISWAN_GETSTATS NDISWAN_GETSTATS, *PNDISWAN_GETSTATS;
  352. struct NDISWAN_GETSTATS {
  353. NDIS_HANDLE hNdisEndpoint; // The NdisMan/NdisWan/AsyMac endpoint
  354. WAN_STATS WanStats; // Not a PTR. Entire statistics
  355. // structure
  356. };
  357. typedef struct NDISWAN_SET_LINK_INFO NDISWAN_SET_LINK_INFO, *PNDISWAN_SET_LINK_INFO;
  358. struct NDISWAN_SET_LINK_INFO {
  359. NDIS_HANDLE hNdisEndpoint; // The NdisMan/NdisWan endpoint
  360. ULONG MaxSendFrameSize;
  361. ULONG MaxRecvFrameSize;
  362. ULONG HeaderPadding;
  363. ULONG TailPadding;
  364. ULONG SendFramingBits;
  365. ULONG RecvFramingBits;
  366. ULONG SendCompressionBits;
  367. ULONG RecvCompressionBits;
  368. ULONG SendACCM;
  369. ULONG RecvACCM;
  370. ULONG MaxRSendFrameSize;
  371. ULONG MaxRRecvFrameSize;
  372. };
  373. typedef struct NDISWAN_GET_LINK_INFO NDISWAN_GET_LINK_INFO, *PNDISWAN_GET_LINK_INFO;
  374. struct NDISWAN_GET_LINK_INFO {
  375. NDIS_HANDLE hNdisEndpoint; // The NdisMan/NdisWan endpoint
  376. ULONG MaxSendFrameSize;
  377. ULONG MaxRecvFrameSize;
  378. ULONG HeaderPadding;
  379. ULONG TailPadding;
  380. ULONG SendFramingBits;
  381. ULONG RecvFramingBits;
  382. ULONG SendCompressionBits;
  383. ULONG RecvCompressionBits;
  384. ULONG SendACCM;
  385. ULONG RecvACCM;
  386. ULONG MaxRSendFrameSize;
  387. ULONG MaxRRecvFrameSize;
  388. };
  389. typedef struct NDISWAN_SET_BRIDGE_INFO NDISWAN_SET_BRIDGE_INFO, *PNDISWAN_SET_BRIDGE_INFO;
  390. struct NDISWAN_SET_BRIDGE_INFO {
  391. NDIS_HANDLE hNdisEndpoint; // The NdisMan/NdisWan endpoint
  392. USHORT LanSegmentNumber;
  393. UCHAR BridgeNumber;
  394. UCHAR BridgingOptions;
  395. ULONG BridgingCapabilities;
  396. UCHAR BridgingType;
  397. UCHAR MacBytes[6];
  398. };
  399. typedef struct NDISWAN_GET_BRIDGE_INFO NDISWAN_GET_BRIDGE_INFO, *PNDISWAN_GET_BRIDGE_INFO;
  400. struct NDISWAN_GET_BRIDGE_INFO {
  401. NDIS_HANDLE hNdisEndpoint; // The NdisMan/NdisWan endpoint
  402. USHORT LanSegmentNumber;
  403. UCHAR BridgeNumber;
  404. UCHAR BridgingOptions;
  405. ULONG BridgingCapabilities;
  406. UCHAR BridgingType;
  407. UCHAR MacBytes[6];
  408. };
  409. //
  410. // Define bit field for MSCompType
  411. //
  412. #define NDISWAN_COMPRESSION 0x00000001
  413. #define NDISWAN_ENCRYPTION 0x00000010
  414. #define NT31RAS_COMPRESSION 254
  415. typedef struct COMPRESS_INFO COMPRESS_INFO, *PCOMPRESS_INFO;
  416. struct COMPRESS_INFO {
  417. UCHAR SessionKey[8]; // May be used for encryption, non-zero
  418. // if supported.
  419. ULONG MSCompType; // Bit field. 0=No compression.
  420. //
  421. // Info below is received from MAC
  422. //
  423. UCHAR CompType; // 0=OUI, 1-254 = Public, 255=Not supported
  424. USHORT CompLength; // Length of CompValues.
  425. union {
  426. struct {
  427. UCHAR CompOUI[3];
  428. UCHAR CompSubType;
  429. UCHAR CompValues[32];
  430. } Proprietary;
  431. struct {
  432. UCHAR CompValues[32];
  433. } Public;
  434. };
  435. };
  436. typedef struct NDISWAN_SET_COMP_INFO NDISWAN_SET_COMP_INFO, *PNDISWAN_SET_COMP_INFO;
  437. struct NDISWAN_SET_COMP_INFO {
  438. NDIS_HANDLE hNdisEndpoint; // The RasMan/NdisWan endpoint
  439. COMPRESS_INFO SendCapabilities;
  440. COMPRESS_INFO RecvCapabilities;
  441. };
  442. typedef struct NDISWAN_GET_COMP_INFO NDISWAN_GET_COMP_INFO, *PNDISWAN_GET_COMP_INFO;
  443. struct NDISWAN_GET_COMP_INFO {
  444. NDIS_HANDLE hNdisEndpoint; // The RasMan/NdisWan endpoint
  445. COMPRESS_INFO SendCapabilities;
  446. COMPRESS_INFO RecvCapabilities;
  447. };
  448. typedef struct VJ_INFO VJ_INFO, *PVJ_INFO;
  449. struct VJ_INFO {
  450. USHORT IPCompressionProtocol; // 002d for VJ - 0000 indicates NONE!
  451. UCHAR MaxSlotID; // How many slots to allocate
  452. UCHAR CompSlotID; // 1 = Slot ID was negotiated
  453. };
  454. typedef struct NDISWAN_SET_VJ_INFO NDISWAN_SET_VJ_INFO, *PNDISWAN_SET_VJ_INFO;
  455. struct NDISWAN_SET_VJ_INFO {
  456. NDIS_HANDLE hNdisEndpoint; // The RasMan/NdisWan endpoint
  457. VJ_INFO SendCapabilities;
  458. VJ_INFO RecvCapabilities;
  459. };
  460. typedef struct NDISWAN_GET_VJ_INFO NDISWAN_GET_VJ_INFO, *PNDISWAN_GET_VJ_INFO;
  461. struct NDISWAN_GET_VJ_INFO {
  462. NDIS_HANDLE hNdisEndpoint; // The RasMan/NdisWan endpoint
  463. VJ_INFO SendCapabilities;
  464. VJ_INFO RecvCapabilities;
  465. };
  466. typedef struct CIPX_INFO CIPX_INFO, *PCIPX_INFO;
  467. struct CIPX_INFO {
  468. USHORT IPXCompressionProtocol; // Telebit/Shiva - 0000 indicates NONE!
  469. };
  470. typedef struct NDISWAN_SET_CIPX_INFO NDISWAN_SET_CIPX_INFO, *PNDISWAN_SET_CIPX_INFO;
  471. struct NDISWAN_SET_CIPX_INFO {
  472. NDIS_HANDLE hNdisEndpoint; // The RasMan/NdisWan endpoint
  473. CIPX_INFO SendCapabilities;
  474. CIPX_INFO RecvCapabilities;
  475. };
  476. typedef struct NDISWAN_GET_CIPX_INFO NDISWAN_GET_CIPX_INFO, *PNDISWAN_GET_CIPX_INFO;
  477. struct NDISWAN_GET_CIPX_INFO {
  478. NDIS_HANDLE hNdisEndpoint; // The RasMan/NdisWan endpoint
  479. CIPX_INFO SendCapabilities;
  480. CIPX_INFO RecvCapabilities;
  481. };
  482. typedef struct NDISWAN_SET_MULTILINK_INFO NDISWAN_SET_MULTILINK_INFO, *PNDISWAN_SET_MULTILINK_INFO;
  483. struct NDISWAN_SET_MULTILINK_INFO {
  484. NDIS_HANDLE hNdisEndpoint; // The RasMan/NdisWan endpoint
  485. NDIS_HANDLE EndpointToBundle; // Endpoint to bundle it to.
  486. };
  487. typedef struct NDISWAN_GET_MULTILINK_INFO NDISWAN_GET_MULTILINK_INFO, *PNDISWAN_GET_MULTILINK_INFO;
  488. struct NDISWAN_GET_MULTILINK_INFO{
  489. NDIS_HANDLE hNdisEndpoint; // The RasMan/NdisWan endpoint
  490. ULONG NumOfEndpoints; // How many endpoints are bundled to this
  491. NDIS_HANDLE Endpoints[0]; // List of 0..n endpoints bundled
  492. };
  493. // A WAN_ENDPOINT is an interface to the WanHardware.
  494. // There will be a collection of WAN_ENDPOINT for each NDIS_ENDPOINT
  495. //
  496. // !!!! NOTE !!!!
  497. // LinkSpeed, QualityOfService, and RouteInfo are meaningless
  498. // unless the route is active (i.e. NumberOfRoutes > 0)
  499. //
  500. // The WanEndpointLink has to be the first entry in the structure
  501. typedef struct WAN_ENDPOINT WAN_ENDPOINT, *PWAN_ENDPOINT;
  502. struct WAN_ENDPOINT {
  503. LIST_ENTRY WanEndpointLink; // used to attach wanendpoints to an ndisendpoint
  504. NDIS_SPIN_LOCK Lock; // lock for this wanendpoint
  505. ULONG State; // state of the endpoint
  506. ULONG NotInUse; // set to false when active with a line up
  507. PVOID AllocatedMemory; // pointer to and size of memory allocated
  508. ULONG MemoryLength; // for this endpoints packets and buffers
  509. LIST_ENTRY DataDescPool; // Data descriptors for wan packets
  510. ULONG DataDescCount; // Number of data descriptors in pool
  511. LIST_ENTRY WanPacketPool; // WanPackets
  512. ULONG WanPacketCount; // Number of WanPackets in pool
  513. NDIS_HANDLE hWanEndpoint; // The NdisWan endpoint
  514. PVOID pNdisEndpoint; // Back ptr to ndisendpoint attached to
  515. PVOID pDeviceContext; // Back ptr to DeviceContext
  516. NDIS_HANDLE NdisBindingHandle; // Assigned by NDIS during NdisOpenAdapter
  517. NDISMAC_LINE_UP MacLineUp; // The MAC's LINE UP
  518. ULONG ulBandwidth; // Percentage of total connection bandwidth
  519. NDISWAN_INFO NdisWanInfo; // Info about the adapter
  520. USHORT MacNameLength; // Up to 32...
  521. WCHAR MacName[MAC_NAME_SIZE]; // First 32 chars of MAC name
  522. // like "\Device\AsyncMac01"
  523. NDIS_MEDIUM MediumType; // NdisMedium802_3, NdisMedium802_5, Wan
  524. NDIS_WAN_MEDIUM_SUBTYPE
  525. WanMediumSubType; // Serial, ISDN, X.25 - for WAN only
  526. NDIS_WAN_HEADER_FORMAT
  527. WanHeaderFormat; // Native or ethernet emulation
  528. WAN_STATS WanStats; // Generic statistics kept here
  529. UCHAR OutstandingFrames; // count of outstanding frames on this endpoint
  530. LIST_ENTRY ReadQueue; // Holds read frame Irps
  531. NDISWAN_SET_LINK_INFO LinkInfo;
  532. };
  533. typedef struct WAN_ENUM_BUFFER WAN_ENUM_BUFFER, *PWAN_ENUM_BUFFER;
  534. struct WAN_ENUM_BUFFER {
  535. ULONG NumOfEndpoints; // Looked up in registry -- key "Endpoints"
  536. WAN_ENDPOINT WanEndpoint[]; // One struct for each endpoint is allocated
  537. };
  538. //------------------------------------------------------------------------
  539. //------------------------ FRAMING INFORMATION ---------------------------
  540. //------------------------------------------------------------------------
  541. #if 0 //ndef _NDIS_WAN
  542. //
  543. // NDIS WAN Framing bits
  544. //
  545. #define OLD_RAS_FRAMING 0x00000001
  546. #define RAS_COMPRESSION 0x00000002
  547. #define PPP_MULTILINK_FRAMING 0x00000010
  548. #define PPP_SHORT_SEQUENCE_HDR_FORMAT 0x00000020
  549. #define PPP_FRAMING 0x00000100
  550. #define PPP_COMPRESS_ADDRESS_CONTROL 0x00000200
  551. #define PPP_COMPRESS_PROTOCOL_FIELD 0x00000400
  552. #define PPP_ACCM_SUPPORTED 0x00000800
  553. #define SLIP_FRAMING 0x00001000
  554. #define SLIP_VJ_COMPRESSION 0x00002000
  555. #define SLIP_VJ_AUTODETECT 0x00004000
  556. #define MEDIA_NRZ_ENCODING 0x00010000
  557. #define MEDIA_NRZI_ENCODING 0x00020000
  558. #define MEDIA_NLPID 0x00040000
  559. #define RFC_1356_FRAMING 0x00100000
  560. #define RFC_1483_FRAMING 0x00200000
  561. #define RFC_1490_FRAMING 0x00400000
  562. #define SHIVA_FRAMING 0x01000000
  563. #endif // _NDIS_WAN
  564. //------------------------------------------------------------------------
  565. //--------------------- OLD RAS COMPRESSION INFORMATION ------------------
  566. //------------------------------------------------------------------------
  567. // The defines below are for the compression bitmap field.
  568. // No bits are set if compression is not available at all
  569. #define COMPRESSION_NOT_AVAILABLE 0x00000000
  570. // This bit is set if the mac can do version 1 compressed frames
  571. #define COMPRESSION_VERSION1_8K 0x00000001
  572. #define COMPRESSION_VERSION1_16K 0x00000002
  573. #define COMPRESSION_VERSION1_32K 0x00000004
  574. #define COMPRESSION_VERSION1_64K 0x00000008
  575. // And this to turn off any compression feature bit
  576. #define COMPRESSION_OFF_BIT_MASK (~( COMPRESSION_VERSION1_8K | \
  577. COMPRESSION_VERSION1_16K | \
  578. COMPRESSION_VERSION1_32K | \
  579. COMPRESSION_VERSION1_64K ))
  580. // We need to find a place to put the following supported featurettes...
  581. #define XON_XOFF_SUPPORTED 0x00000010
  582. #define COMPRESS_BROADCAST_FRAMES 0x00000080
  583. #define UNKNOWN_FRAMING 0x00010000
  584. #define NO_FRAMING 0x00020000