3 Copyright (C) Dean Camera, 2009.
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
33 * Header file for RNDISCommands.c.
36 #ifndef _RNDIS_COMMANDS_H_
37 #define _RNDIS_COMMANDS_H_
44 #include <LUFA/Drivers/USB/USB.h>
46 #include "RNDISConstants.h"
49 /** Type define for a RNDIS message header, sent before RNDIS messages */
52 uint32_t MessageType
; /**< RNDIS message type, a REMOTE_NDIS_*_MSG constant */
53 uint32_t MessageLength
; /**< Total length of the RNDIS message, in bytes */
54 } RNDIS_Message_Header_t
;
56 /** Type define for a RNDIS packet message, used to encapsulate Ethernet packets sent to and from the adapter */
60 uint32_t MessageLength
;
63 uint32_t OOBDataOffset
;
64 uint32_t OOBDataLength
;
65 uint32_t NumOOBDataElements
;
66 uint32_t PerPacketInfoOffset
;
67 uint32_t PerPacketInfoLength
;
70 } RNDIS_Packet_Message_t
;
72 /** Type define for a RNDIS Initialize command message */
76 uint32_t MessageLength
;
79 uint32_t MajorVersion
;
80 uint32_t MinorVersion
;
81 uint32_t MaxTransferSize
;
82 } RNDIS_Initialize_Message_t
;
84 /** Type define for a RNDIS Initialize complete response message */
88 uint32_t MessageLength
;
92 uint32_t MajorVersion
;
93 uint32_t MinorVersion
;
96 uint32_t MaxPacketsPerTransfer
;
97 uint32_t MaxTransferSize
;
98 uint32_t PacketAlignmentFactor
;
99 uint32_t AFListOffset
;
101 } RNDIS_Initialize_Complete_t
;
103 /** Type define for a RNDIS Keepalive command message */
106 uint32_t MessageType
;
107 uint32_t MessageLength
;
109 } RNDIS_KeepAlive_Message_t
;
111 /** Type define for a RNDIS Keepalive complete message */
114 uint32_t MessageType
;
115 uint32_t MessageLength
;
118 } RNDIS_KeepAlive_Complete_t
;
120 /** Type define for a RNDIS Reset complete message */
123 uint32_t MessageType
;
124 uint32_t MessageLength
;
127 uint32_t AddressingReset
;
128 } RNDIS_Reset_Complete_t
;
130 /** Type define for a RNDIS Set command message */
133 uint32_t MessageType
;
134 uint32_t MessageLength
;
138 uint32_t InformationBufferLength
;
139 uint32_t InformationBufferOffset
;
140 uint32_t DeviceVcHandle
;
141 } RNDIS_Set_Message_t
;
143 /** Type define for a RNDIS Set complete response message */
146 uint32_t MessageType
;
147 uint32_t MessageLength
;
150 } RNDIS_Set_Complete_t
;
152 /** Type define for a RNDIS Query command message */
155 uint32_t MessageType
;
156 uint32_t MessageLength
;
160 uint32_t InformationBufferLength
;
161 uint32_t InformationBufferOffset
;
162 uint32_t DeviceVcHandle
;
163 } RNDIS_Query_Message_t
;
165 /** Type define for a RNDIS Query complete response message */
168 uint32_t MessageType
;
169 uint32_t MessageLength
;
173 uint32_t InformationBufferLength
;
174 uint32_t InformationBufferOffset
;
175 } RNDIS_Query_Complete_t
;
178 /** RNDIS request to issue a host-to-device NDIS command */
179 #define REQ_SendEncapsulatedCommand 0x00
181 /** RNDIS request to issue a device-to-host NDIS response */
182 #define REQ_GetEncapsulatedResponse 0x01
184 /** Implemented RNDIS Version Major */
185 #define REMOTE_NDIS_VERSION_MAJOR 0x01
187 /** Implemented RNDIS Version Minor */
188 #define REMOTE_NDIS_VERSION_MINOR 0x00
190 /** Pipe number for the RNDIS data IN pipe */
191 #define RNDIS_DATAPIPE_IN 1
193 /** Pipe number for the RNDIS data OUT pipe */
194 #define RNDIS_DATAPIPE_OUT 2
196 /** Pipe number for the RNDIS notification pipe */
197 #define RNDIS_NOTIFICATIONPIPE 3
199 /** Additional error code for RNDIS functions when a device returns a logical command failure */
200 #define RNDIS_COMMAND_FAILED 0xC0
202 /* Function Prototypes: */
203 uint8_t RNDIS_SendEncapsulatedCommand(void* Buffer
, uint16_t Length
);
204 uint8_t RNDIS_GetEncapsulatedResponse(void* Buffer
, uint16_t Length
);
206 uint8_t RNDIS_SendKeepAlive(void);
207 uint8_t RNDIS_InitializeDevice(uint16_t HostMaxPacketSize
, uint16_t* DeviceMaxPacketSize
);
208 uint8_t RNDIS_SetRNDISProperty(uint32_t Oid
, void* Buffer
, uint16_t Length
);
209 uint8_t RNDIS_QueryRNDISProperty(uint32_t Oid
, void* Buffer
, uint16_t MaxLength
);
210 uint8_t RNDIS_GetPacketLength(uint16_t* PacketLength
);