mikroSDK Reference Manual
rndis_protocol.h
Go to the documentation of this file.
1
11/* Copyright (c) 2008 Colin O'Flynn
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15
16 * Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
18 * Redistributions in binary form must reproduce the above copyright
19 notice, this list of conditions and the following disclaimer in
20 the documentation and/or other materials provided with the
21 distribution.
22 * Neither the name of the copyright holders nor the names of
23 contributors may be used to endorse or promote products derived
24 from this software without specific prior written permission.
25
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 POSSIBILITY OF SUCH DAMAGE.
37*/
38
39#ifndef _RNDIS_H
40#define _RNDIS_H
41
47#include <stdint.h>
48
49#define RNDIS_MAJOR_VERSION 1
50#define RNDIS_MINOR_VERSION 0
51
52#define RNDIS_STATUS_SUCCESS 0X00000000
53#define RNDIS_STATUS_FAILURE 0XC0000001
54#define RNDIS_STATUS_INVALID_DATA 0XC0010015
55#define RNDIS_STATUS_NOT_SUPPORTED 0XC00000BB
56#define RNDIS_STATUS_MEDIA_CONNECT 0X4001000B
57#define RNDIS_STATUS_MEDIA_DISCONNECT 0X4001000C
58
59
60/* Message set for Connectionless (802.3) Devices */
61#define REMOTE_NDIS_PACKET_MSG 0x00000001
62#define REMOTE_NDIS_INITIALIZE_MSG 0X00000002
63#define REMOTE_NDIS_HALT_MSG 0X00000003
64#define REMOTE_NDIS_QUERY_MSG 0X00000004
65#define REMOTE_NDIS_SET_MSG 0X00000005
66#define REMOTE_NDIS_RESET_MSG 0X00000006
67#define REMOTE_NDIS_INDICATE_STATUS_MSG 0X00000007
68#define REMOTE_NDIS_KEEPALIVE_MSG 0X00000008
69#define REMOTE_NDIS_INITIALIZE_CMPLT 0X80000002
70#define REMOTE_NDIS_QUERY_CMPLT 0X80000004
71#define REMOTE_NDIS_SET_CMPLT 0X80000005
72#define REMOTE_NDIS_RESET_CMPLT 0X80000006
73#define REMOTE_NDIS_KEEPALIVE_CMPLT 0X80000008
74
75typedef uint32_t rndis_MessageType_t;
76typedef uint32_t rndis_MessageLength_t;
77typedef uint32_t rndis_RequestId_t;
78typedef uint32_t rndis_MajorVersion_t;
79typedef uint32_t rndis_MinorVersion_t;
80typedef uint32_t rndis_MaxTransferSize_t;
81typedef uint32_t rndis_Status_t;
82
83
84/* Device Flags */
85#define RNDIS_DF_CONNECTIONLESS 0x00000001
86#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002
87typedef uint32_t rndis_DeviceFlags_t;
88
89/* Mediums */
90#define RNDIS_MEDIUM_802_3 0x00000000
91typedef uint32_t rndis_Medium_t;
92
93
94typedef uint32_t rndis_MaxPacketsPerTransfer_t;
95typedef uint32_t rndis_PacketAlignmentFactor_t;
96typedef uint32_t rndis_AfListOffset_t;
97typedef uint32_t rndis_AfListSize_t;
98
99/*** Remote NDIS Generic Message type ***/
100typedef struct{
101 rndis_MessageType_t MessageType;
102 rndis_MessageLength_t MessageLength;
104
105
106/*** Remote NDIS Initialize Message ***/
107typedef struct{
108 rndis_MessageType_t MessageType;
109 rndis_MessageLength_t MessageLength;
110 rndis_RequestId_t RequestId;
111 rndis_MajorVersion_t MajorVersion;
112 rndis_MinorVersion_t MinorVersion;
113 rndis_MaxTransferSize_t MaxTransferSize;
115
116/* Response: */
117typedef struct{
118 rndis_MessageType_t MessageType;
119 rndis_MessageLength_t MessageLength;
120 rndis_RequestId_t RequestId;
121 rndis_Status_t Status;
122 rndis_MajorVersion_t MajorVersion;
123 rndis_MinorVersion_t MinorVersion;
124 rndis_DeviceFlags_t DeviceFlags;
125 rndis_Medium_t Medium;
126 rndis_MaxPacketsPerTransfer_t MaxPacketsPerTransfer;
127 rndis_MaxTransferSize_t MaxTransferSize;
128 rndis_PacketAlignmentFactor_t PacketAlignmentFactor;
129 rndis_AfListOffset_t AfListOffset;
130 rndis_AfListSize_t AfListSize;
132
133
134/*** Remote NDIS Halt Message ***/
135typedef struct{
136 rndis_MessageType_t MessageType;
137 rndis_MessageLength_t MessageLength;
138 rndis_RequestId_t RequestId;
140
141typedef uint32_t rndis_Oid_t;
142typedef uint32_t rndis_InformationBufferLength_t;
143typedef uint32_t rndis_InformationBufferOffset_t;
144typedef uint32_t rndis_DeviceVcHandle_t;
145
146/*** Remote NDIS Query Message ***/
147typedef struct{
148 rndis_MessageType_t MessageType;
149 rndis_MessageLength_t MessageLength;
150 rndis_RequestId_t RequestId;
151 rndis_Oid_t Oid;
152 rndis_InformationBufferLength_t InformationBufferLength;
153 rndis_InformationBufferOffset_t InformationBufferOffset;
154 rndis_DeviceVcHandle_t DeviceVcHandle;
156
157/* Response: */
158
159typedef struct{
160 rndis_MessageType_t MessageType;
161 rndis_MessageLength_t MessageLength;
162 rndis_RequestId_t RequestId;
163 rndis_Status_t Status;
164 rndis_InformationBufferLength_t InformationBufferLength;
165 rndis_InformationBufferOffset_t InformationBufferOffset;
167
168/*** Remote NDIS Set Message ***/
169typedef struct{
170 rndis_MessageType_t MessageType;
171 rndis_MessageLength_t MessageLength;
172 rndis_RequestId_t RequestId;
173 rndis_Oid_t Oid;
174 rndis_InformationBufferLength_t InformationBufferLength;
175 rndis_InformationBufferOffset_t InformationBufferOffset;
176 rndis_DeviceVcHandle_t DeviceVcHandle;
178
179/* Response */
180typedef struct{
181 rndis_MessageType_t MessageType;
182 rndis_MessageLength_t MessageLength;
183 rndis_RequestId_t RequestId;
184 rndis_Status_t Status;
186
187/* Information buffer layout for OID_GEN_RNDIS_CONFIG_PARAMETER */
188typedef uint32_t rndis_ParameterNameOffset_t;
189typedef uint32_t rndis_ParameterNameLength_t;
190typedef uint32_t rndis_ParameterType_t;
191typedef uint32_t rndis_ParameterValueOffset_t;
192typedef uint32_t rndis_ParameterValueLength_t;
193
194#define PARAMETER_TYPE_STRING 2
195#define PARAMETER_TYPE_NUMERICAL 0
196
197typedef struct{
198 rndis_ParameterNameOffset_t ParameterNameOffset;
199 rndis_ParameterNameLength_t ParameterNameLength;
200 rndis_ParameterType_t ParameterType;
201 rndis_ParameterValueOffset_t ParameterValueOffset;
202 rndis_ParameterValueLength_t ParameterValueLength;
204
205typedef uint32_t rndis_Reserved_t;
206
207/*** Remote NDIS Soft Reset Message ***/
208typedef struct{
209 rndis_MessageType_t MessageType;
210 rndis_MessageLength_t MessageLength;
211 rndis_Reserved_t Reserved;
213
214typedef uint32_t rndis_AddressingReset_t;
215
216/* Response: */
217typedef struct{
218 rndis_MessageType_t MessageType;
219 rndis_MessageLength_t MessageLength;
220 rndis_Status_t Status;
221 rndis_AddressingReset_t AddressingReset;
223
224/*** Remote NDIS Indicate Status Message ***/
225typedef struct{
226 rndis_MessageType_t MessageType;
227 rndis_MessageLength_t MessageLength;
228 rndis_Status_t Status;
229 rndis_Status_t StatusBufferLength;
230 rndis_Status_t StatusBufferOffset;
232
233typedef uint32_t rndis_DiagStatus_t;
234typedef uint32_t rndis_ErrorOffset_t;
235
236typedef struct {
237 rndis_DiagStatus_t DiagStatus;
238 rndis_ErrorOffset_t ErrorOffset;
240
241/*** Remote NDIS Keepalive Message */
242typedef struct{
243 rndis_MessageType_t MessageType;
244 rndis_MessageLength_t MessageLength;
245 rndis_RequestId_t RequestId;
247
248/* Response: */
249typedef struct{
250 rndis_MessageType_t MessageType;
251 rndis_MessageLength_t MessageLength;
252 rndis_RequestId_t RequestId;
253 rndis_Status_t Status;
255
256/*** Remote NDIS Data Packet ***/
257
258typedef uint32_t rndis_DataOffset_t;
259typedef uint32_t rndis_DataLength_t;
260typedef uint32_t rndis_OOBDataOffset_t;
261typedef uint32_t rndis_OOBDataLength_t;
262typedef uint32_t rndis_NumOOBDataElements_t;
263typedef uint32_t rndis_PerPacketInfoOffset_t;
264typedef uint32_t rndis_PerPacketInfoLength_t;
265
266typedef struct{
267 rndis_MessageType_t MessageType;
268 rndis_MessageLength_t MessageLength;
269 rndis_DataOffset_t DataOffset;
270 rndis_DataLength_t DataLength;
271 rndis_OOBDataOffset_t OOBDataOffset;
272 rndis_OOBDataLength_t OOBDataLength;
273 rndis_NumOOBDataElements_t NumOOBDataElements;
274 rndis_PerPacketInfoOffset_t PerPacketInfoOffset;
275 rndis_PerPacketInfoLength_t PerPacketInfoLength;
276 rndis_DeviceVcHandle_t DeviceVcHandle;
277 rndis_Reserved_t Reserved;
279
280typedef uint32_t rndis_ClassInformationOffset_t;
281typedef uint32_t rndis_Size_t;
282typedef uint32_t rndis_Type_t;
283
284typedef struct{
285 rndis_Size_t Size;
286 rndis_Type_t Type;
287 rndis_ClassInformationOffset_t ClassInformationType;
289
290#include "ndis.h"
291
292typedef enum rnids_state_e {
293 rndis_uninitialized,
294 rndis_initialized,
295 rndis_data_initialized
296 } rndis_state_t;
297
298typedef struct {
299 uint32_t txok;
300 uint32_t rxok;
301 uint32_t txbad;
302 uint32_t rxbad;
304
305#endif /* _RNDIS_H */
306
This file contains the possible external configuration of the USB.
Definition rndis_protocol.h:284
Definition rndis_protocol.h:197
Definition rndis_protocol.h:266
Definition rndis_protocol.h:236
Definition rndis_protocol.h:100
Definition rndis_protocol.h:135
Definition rndis_protocol.h:225
Definition rndis_protocol.h:117
Definition rndis_protocol.h:107
Definition rndis_protocol.h:249
Definition rndis_protocol.h:242
Definition rndis_protocol.h:159
Definition rndis_protocol.h:147
Definition rndis_protocol.h:217
Definition rndis_protocol.h:208
Definition rndis_protocol.h:180
Definition rndis_protocol.h:169
Definition rndis_protocol.h:298