xref: /reactos/sdk/include/ddk/ndiswan.h (revision c2c66aff)
1 /*
2  * ndiswan.h
3  *
4  * Definitions for NDIS WAN miniport drivers
5  *
6  * This file is part of the w32api package.
7  *
8  * Contributors:
9  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10  *
11  * THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  * This source code is offered for use in the public domain. You may
14  * use, modify or distribute it freely.
15  *
16  * This code is distributed in the hope that it will be useful but
17  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  * DISCLAIMED. This includes but is not limited to warranties of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  */
22 
23 #pragma once
24 
25 #ifndef _NDIS_WAN_
26 #define _NDIS_WAN_
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #define NDIS_USE_WAN_WRAPPER            0x00000001
33 
34 #define NDIS_STATUS_TAPI_INDICATION     ((NDIS_STATUS)0x40010080L)
35 
36 /* NDIS_WAN_INFO.FramingBits constants */
37 #define RAS_FRAMING                     0x00000001
38 #define RAS_COMPRESSION                 0x00000002
39 
40 #define ARAP_V1_FRAMING                 0x00000004
41 #define ARAP_V2_FRAMING                 0x00000008
42 #define ARAP_FRAMING                    (ARAP_V1_FRAMING | ARAP_V2_FRAMING)
43 
44 #define PPP_MULTILINK_FRAMING           0x00000010
45 #define PPP_SHORT_SEQUENCE_HDR_FORMAT   0x00000020
46 #define PPP_MC_MULTILINK_FRAMING        0x00000040
47 
48 #define PPP_FRAMING                     0x00000100
49 #define PPP_COMPRESS_ADDRESS_CONTROL    0x00000200
50 #define PPP_COMPRESS_PROTOCOL_FIELD     0x00000400
51 #define PPP_ACCM_SUPPORTED              0x00000800
52 
53 #define SLIP_FRAMING                    0x00001000
54 #define SLIP_VJ_COMPRESSION             0x00002000
55 #define SLIP_VJ_AUTODETECT              0x00004000
56 
57 #define MEDIA_NRZ_ENCODING              0x00010000
58 #define MEDIA_NRZI_ENCODING             0x00020000
59 #define MEDIA_NLPID                     0x00040000
60 
61 #define RFC_1356_FRAMING                0x00100000
62 #define RFC_1483_FRAMING                0x00200000
63 #define RFC_1490_FRAMING                0x00400000
64 #define LLC_ENCAPSULATION               0x00800000
65 
66 #define SHIVA_FRAMING                   0x01000000
67 #define NBF_PRESERVE_MAC_ADDRESS        0x01000000
68 
69 #define PASS_THROUGH_MODE               0x10000000
70 #define RAW_PASS_THROUGH_MODE           0x20000000
71 
72 #define TAPI_PROVIDER                   0x80000000
73 
74 #define BRIDGING_FLAG_LANFCS            0x00000001
75 #define BRIDGING_FLAG_LANID             0x00000002
76 #define BRIDGING_FLAG_PADDING           0x00000004
77 
78 #define BRIDGING_TINYGRAM               0x00000001
79 #define BRIDGING_LANID                  0x00000002
80 #define BRIDGING_NO_SPANNING_TREE       0x00000004
81 #define BRIDGING_8021D_SPANNING_TREE    0x00000008
82 #define BRIDGING_8021G_SPANNING_TREE    0x00000010
83 #define BRIDGING_SOURCE_ROUTING         0x00000020
84 #define BRIDGING_DEC_LANBRIDGE          0x00000040
85 
86 #define BRIDGING_TYPE_RESERVED          0x00000001
87 #define BRIDGING_TYPE_8023_CANON        0x00000002
88 #define BRIDGING_TYPE_8024_NO_CANON     0x00000004
89 #define BRIDGING_TYPE_8025_NO_CANON     0x00000008
90 #define BRIDGING_TYPE_FDDI_NO_CANON     0x00000010
91 #define BRIDGING_TYPE_8024_CANON        0x00000400
92 #define BRIDGING_TYPE_8025_CANON        0x00000800
93 #define BRIDGING_TYPE_FDDI_CANON        0x00001000
94 
95 /* NDIS_WAN_COMPRESS_INFO.MSCompType constants */
96 #define NDISWAN_COMPRESSION             0x00000001
97 #define NDISWAN_ENCRYPTION              0x00000010
98 #define NDISWAN_40_ENCRYPTION           0x00000020
99 #define NDISWAN_128_ENCRYPTION          0x00000040
100 #define NDISWAN_56_ENCRYPTION           0x00000080
101 #define NDISWAN_HISTORY_LESS            0x01000000
102 
103 /* NDIS_WAN_COMPRESS_INFO.CompType constants */
104 #define COMPTYPE_OUI                    0
105 #define COMPTYPE_NT31RAS                254
106 #define COMPTYPE_NONE                   255
107 
108 #define WAN_ERROR_CRC                   ((ULONG)0x00000001)
109 #define WAN_ERROR_FRAMING               ((ULONG)0x00000002)
110 #define WAN_ERROR_HARDWAREOVERRUN       ((ULONG)0x00000004)
111 #define WAN_ERROR_BUFFEROVERRUN         ((ULONG)0x00000008)
112 #define WAN_ERROR_TIMEOUT               ((ULONG)0x00000010)
113 #define WAN_ERROR_ALIGNMENT             ((ULONG)0x00000020)
114 
115 #define NdisMWanInitializeWrapper(NdisWrapperHandle, \
116                                   SystemSpecific1,   \
117                                   SystemSpecific2,   \
118                                   SystemSpecific3)   \
119 {                                                     \
120   NdisMInitializeWrapper(NdisWrapperHandle,           \
121                          SystemSpecific1,             \
122                          SystemSpecific2,             \
123                          SystemSpecific3);            \
124 }
125 
126 typedef struct _NDIS_WAN_INFO {
127   _Out_ ULONG MaxFrameSize;
128   _Out_ ULONG MaxTransmit;
129   _Out_ ULONG HeaderPadding;
130   _Out_ ULONG TailPadding;
131   _Out_ ULONG Endpoints;
132   _Out_ UINT MemoryFlags;
133   _Out_ NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress;
134   _Out_ ULONG FramingBits;
135   _Out_ ULONG DesiredACCM;
136 } NDIS_WAN_INFO, *PNDIS_WAN_INFO;
137 
138 typedef struct _NDIS_WAN_GET_LINK_INFO {
139   _In_ NDIS_HANDLE NdisLinkHandle;
140   _Out_ ULONG MaxSendFrameSize;
141   _Out_ ULONG MaxRecvFrameSize;
142   _Out_ ULONG HeaderPadding;
143   _Out_ ULONG TailPadding;
144   _Out_ ULONG SendFramingBits;
145   _Out_ ULONG RecvFramingBits;
146   _Out_ ULONG SendCompressionBits;
147   _Out_ ULONG RecvCompressionBits;
148   _Out_ ULONG SendACCM;
149   _Out_ ULONG RecvACCM;
150 } NDIS_WAN_GET_LINK_INFO, *PNDIS_WAN_GET_LINK_INFO;
151 
152 typedef struct _NDIS_WAN_SET_LINK_INFO {
153   _In_ NDIS_HANDLE NdisLinkHandle;
154   _In_ ULONG MaxSendFrameSize;
155   _In_ ULONG MaxRecvFrameSize;
156   _In_ ULONG HeaderPadding;
157   _In_ ULONG TailPadding;
158   _In_ ULONG SendFramingBits;
159   _In_ ULONG RecvFramingBits;
160   _In_ ULONG SendCompressionBits;
161   _In_ ULONG RecvCompressionBits;
162   _In_ ULONG SendACCM;
163   _In_ ULONG RecvACCM;
164 } NDIS_WAN_SET_LINK_INFO, *PNDIS_WAN_SET_LINK_INFO;
165 
166 typedef struct _NDIS_WAN_GET_BRIDGE_INFO {
167   _In_ NDIS_HANDLE NdisLinkHandle;
168   _Out_ USHORT LanSegmentNumber;
169   _Out_ UCHAR BridgeNumber;
170   _Out_ UCHAR BridgingOptions;
171   _Out_ ULONG BridgingCapabilities;
172   _Out_ UCHAR BridgingType;
173   _Out_ UCHAR MacBytes[6];
174 } NDIS_WAN_GET_BRIDGE_INFO, *PNDIS_WAN_GET_BRIDGE_INFO;
175 
176 typedef struct _NDIS_WAN_SET_BRIDGE_INFO {
177   _In_ NDIS_HANDLE NdisLinkHandle;
178   _In_ USHORT LanSegmentNumber;
179   _In_ UCHAR BridgeNumber;
180   _In_ UCHAR BridgingOptions;
181   _In_ ULONG BridgingCapabilities;
182   _In_ UCHAR BridgingType;
183   _In_ UCHAR MacBytes[6];
184 } NDIS_WAN_SET_BRIDGE_INFO, *PNDIS_WAN_SET_BRIDGE_INFO;
185 
186 typedef struct _NDIS_WAN_COMPRESS_INFO {
187   UCHAR SessionKey[8];
188   ULONG MSCompType;
189   UCHAR CompType;
190   USHORT CompLength;
191   _ANONYMOUS_UNION union {
192     struct {
193       UCHAR CompOUI[3];
194       UCHAR CompSubType;
195       UCHAR CompValues[32];
196     } Proprietary;
197     struct {
198       UCHAR CompValues[32];
199     } Public;
200   } DUMMYUNIONNAME;
201 } NDIS_WAN_COMPRESS_INFO, *PNDIS_WAN_COMPRESS_INFO;
202 
203 typedef struct _NDIS_WAN_GET_COMP_INFO {
204   _In_ NDIS_HANDLE NdisLinkHandle;
205   _Out_ NDIS_WAN_COMPRESS_INFO SendCapabilities;
206   _Out_ NDIS_WAN_COMPRESS_INFO RecvCapabilities;
207 } NDIS_WAN_GET_COMP_INFO, *PNDIS_WAN_GET_COMP_INFO;
208 
209 typedef struct _NDIS_WAN_SET_COMP_INFO {
210   _In_ NDIS_HANDLE NdisLinkHandle;
211   _In_ NDIS_WAN_COMPRESS_INFO SendCapabilities;
212   _In_ NDIS_WAN_COMPRESS_INFO RecvCapabilities;
213 } NDIS_WAN_SET_COMP_INFO, *PNDIS_WAN_SET_COMP_INFO;
214 
215 /*
216  * NOTE: As some people may notice, this structure contains three misspelled
217  * fields (the "Tunnel*Recieve*" fields). Their names come from the Windows
218  * Driver Development Kit and thus, blame Microsoft if they do not know how
219  * to write proper English or if they do not re-read what they are writing !!
220  */
221 typedef struct _NDIS_WAN_GET_STATS_INFO {
222   _In_ NDIS_HANDLE NdisLinkHandle;
223   _Out_ ULONG BytesSent;
224   _Out_ ULONG BytesRcvd;
225   _Out_ ULONG FramesSent;
226   _Out_ ULONG FramesRcvd;
227   _Out_ ULONG CRCErrors;
228   _Out_ ULONG TimeoutErrors;
229   _Out_ ULONG AlignmentErrors;
230   _Out_ ULONG SerialOverrunErrors;
231   _Out_ ULONG FramingErrors;
232   _Out_ ULONG BufferOverrunErrors;
233   _Out_ ULONG BytesTransmittedUncompressed;
234   _Out_ ULONG BytesReceivedUncompressed;
235   _Out_ ULONG BytesTransmittedCompressed;
236   _Out_ ULONG BytesReceivedCompressed;
237   _Out_ ULONG TunnelPacketsRecieved;
238   _Out_ ULONG TunnelRecievePacketsPending;
239   _Out_ ULONG TunnelPacketsIndicatedUp;
240   _Out_ ULONG TunnelRecievePacketsRejected;
241   _Out_ ULONG TunnelPacketsSent;
242   _Out_ ULONG TunnelPacketsSentComplete;
243   _Out_ ULONG TunnelTransmitPacketsPending;
244   _Out_ ULONG TunnelPacketsTransmitError;
245   _Out_ ULONG TunnelPacketsSentError;
246   _Out_ ULONG TunnelTransmitPacketsRejected;
247   _Out_ ULONG TunnelAcksSent;
248   _Out_ ULONG TunnelAcksSentComplete;
249   _Out_ ULONG TunnelGeneric1;
250   _Out_ ULONG TunnelGeneric2;
251   _Out_ ULONG TunnelGeneric3;
252 } NDIS_WAN_GET_STATS_INFO, *PNDIS_WAN_GET_STATS_INFO;
253 
254 typedef struct _NDIS_MAC_LINE_UP {
255   _In_ ULONG LinkSpeed;
256   _In_ NDIS_WAN_QUALITY Quality;
257   _In_ USHORT SendWindow;
258   _In_ NDIS_HANDLE ConnectionWrapperID;
259   _In_ NDIS_HANDLE NdisLinkHandle;
260   _Out_ NDIS_HANDLE NdisLinkContext;
261 } NDIS_MAC_LINE_UP, *PNDIS_MAC_LINE_UP;
262 
263 typedef struct _NDIS_MAC_LINE_DOWN {
264   _In_ NDIS_HANDLE NdisLinkContext;
265 } NDIS_MAC_LINE_DOWN, *PNDIS_MAC_LINE_DOWN;
266 
267 typedef struct _NDIS_MAC_FRAGMENT {
268   _In_ NDIS_HANDLE NdisLinkContext;
269   _In_ ULONG Errors;
270 } NDIS_MAC_FRAGMENT, *PNDIS_MAC_FRAGMENT;
271 
272 typedef struct _NDIS_WAN_CO_INFO {
273   _Out_ ULONG MaxFrameSize;
274   _Out_ ULONG MaxSendWindow;
275   _Out_ ULONG FramingBits;
276   _Out_ ULONG DesiredACCM;
277 } NDIS_WAN_CO_INFO, *PNDIS_WAN_CO_INFO;
278 
279 typedef struct _NDIS_WAN_CO_GET_LINK_INFO {
280   _Out_ ULONG MaxSendFrameSize;
281   _Out_ ULONG MaxRecvFrameSize;
282   _Out_ ULONG SendFramingBits;
283   _Out_ ULONG RecvFramingBits;
284   _Out_ ULONG SendCompressionBits;
285   _Out_ ULONG RecvCompressionBits;
286   _Out_ ULONG SendACCM;
287   _Out_ ULONG RecvACCM;
288 } NDIS_WAN_CO_GET_LINK_INFO, *PNDIS_WAN_CO_GET_LINK_INFO;
289 
290 typedef struct _NDIS_WAN_CO_SET_LINK_INFO {
291   _In_ ULONG MaxSendFrameSize;
292   _In_ ULONG MaxRecvFrameSize;
293   _In_ ULONG SendFramingBits;
294   _In_ ULONG RecvFramingBits;
295   _In_ ULONG SendCompressionBits;
296   _In_ ULONG RecvCompressionBits;
297   _In_ ULONG SendACCM;
298   _In_ ULONG RecvACCM;
299 } NDIS_WAN_CO_SET_LINK_INFO, *PNDIS_WAN_CO_SET_LINK_INFO;
300 
301 typedef struct _NDIS_WAN_CO_GET_COMP_INFO {
302   _Out_ NDIS_WAN_COMPRESS_INFO SendCapabilities;
303   _Out_ NDIS_WAN_COMPRESS_INFO RecvCapabilities;
304 } NDIS_WAN_CO_GET_COMP_INFO, *PNDIS_WAN_CO_GET_COMP_INFO;
305 
306 typedef struct _NDIS_WAN_CO_SET_COMP_INFO {
307   _In_ NDIS_WAN_COMPRESS_INFO SendCapabilities;
308   _In_ NDIS_WAN_COMPRESS_INFO RecvCapabilities;
309 } NDIS_WAN_CO_SET_COMP_INFO, *PNDIS_WAN_CO_SET_COMP_INFO;
310 
311 /*
312  * NOTE: As some people may notice, this structure contains three misspelled
313  * fields (the "Tunnel*Recieve*" fields). Their names come from the Windows
314  * Driver Development Kit and thus, blame Microsoft if they do not know how
315  * to write proper English or if they do not re-read what they are writing !!
316  */
317 typedef struct _NDIS_WAN_CO_GET_STATS_INFO {
318   _Out_ ULONG BytesSent;
319   _Out_ ULONG BytesRcvd;
320   _Out_ ULONG FramesSent;
321   _Out_ ULONG FramesRcvd;
322   _Out_ ULONG CRCErrors;
323   _Out_ ULONG TimeoutErrors;
324   _Out_ ULONG AlignmentErrors;
325   _Out_ ULONG SerialOverrunErrors;
326   _Out_ ULONG FramingErrors;
327   _Out_ ULONG BufferOverrunErrors;
328   _Out_ ULONG BytesTransmittedUncompressed;
329   _Out_ ULONG BytesReceivedUncompressed;
330   _Out_ ULONG BytesTransmittedCompressed;
331   _Out_ ULONG BytesReceivedCompressed;
332   _Out_ ULONG TunnelPacketsRecieved;
333   _Out_ ULONG TunnelRecievePacketsPending;
334   _Out_ ULONG TunnelPacketsIndicatedUp;
335   _Out_ ULONG TunnelRecievePacketsRejected;
336   _Out_ ULONG TunnelPacketsSent;
337   _Out_ ULONG TunnelPacketsSentComplete;
338   _Out_ ULONG TunnelTransmitPacketsPending;
339   _Out_ ULONG TunnelPacketsTransmitError;
340   _Out_ ULONG TunnelPacketsSentError;
341   _Out_ ULONG TunnelTransmitPacketsRejected;
342   _Out_ ULONG TunnelAcksSent;
343   _Out_ ULONG TunnelAcksSentComplete;
344   _Out_ ULONG TunnelGeneric1;
345   _Out_ ULONG TunnelGeneric2;
346   _Out_ ULONG TunnelGeneric3;
347 } NDIS_WAN_CO_GET_STATS_INFO, *PNDIS_WAN_CO_GET_STATS_INFO;
348 
349 typedef struct _NDIS_WAN_CO_FRAGMENT {
350   _In_ ULONG Errors;
351 } NDIS_WAN_CO_FRAGMENT, *PNDIS_WAN_CO_FRAGMENT;
352 
353 typedef struct _WAN_CO_LINKPARAMS {
354   ULONG TransmitSpeed;
355   ULONG ReceiveSpeed;
356   ULONG SendWindow;
357 } WAN_CO_LINKPARAMS, *PWAN_CO_LINKPARAMS;
358 
359 typedef struct _WAN_CO_MTULINKPARAMS {
360   ULONG Version;
361   ULONG TransmitSpeed;
362   ULONG ReceiveSpeed;
363   ULONG SendWindow;
364   ULONG MTU;
365 } WAN_CO_MTULINKPARAMS, *PWAN_CO_MTULINKPARAMS;
366 
367 #ifdef __cplusplus
368 }
369 #endif
370 
371 #endif /* _NDIS_WAN_ */
372 
373