Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target...
[deliverable/linux.git] / drivers / usb / gadget / rndis.h
CommitLineData
7e27f18c 1/*
1da177e4 2 * RNDIS Definitions for Remote NDIS
7e27f18c 3 *
1da177e4 4 * Authors: Benedikt Spranger, Pengutronix
7e27f18c
DB
5 * Robert Schwebel, Pengutronix
6 *
7 * This program is free software; you can redistribute it and/or
1da177e4 8 * modify it under the terms of the GNU General Public License
7e27f18c
DB
9 * version 2, as published by the Free Software Foundation.
10 *
1da177e4
LT
11 * This software was originally developed in conformance with
12 * Microsoft's Remote NDIS Specification License Agreement.
13 */
14
15#ifndef _LINUX_RNDIS_H
16#define _LINUX_RNDIS_H
17
7591157e 18#include <linux/rndis.h>
1da177e4
LT
19#include "ndis.h"
20
21#define RNDIS_MAXIMUM_FRAME_SIZE 1518
22#define RNDIS_MAX_TOTAL_SIZE 1558
23
7e27f18c 24typedef struct rndis_init_msg_type
1da177e4
LT
25{
26 __le32 MessageType;
27 __le32 MessageLength;
28 __le32 RequestID;
29 __le32 MajorVersion;
30 __le32 MinorVersion;
31 __le32 MaxTransferSize;
32} rndis_init_msg_type;
33
34typedef struct rndis_init_cmplt_type
35{
36 __le32 MessageType;
37 __le32 MessageLength;
38 __le32 RequestID;
39 __le32 Status;
40 __le32 MajorVersion;
41 __le32 MinorVersion;
42 __le32 DeviceFlags;
43 __le32 Medium;
44 __le32 MaxPacketsPerTransfer;
45 __le32 MaxTransferSize;
46 __le32 PacketAlignmentFactor;
47 __le32 AFListOffset;
48 __le32 AFListSize;
49} rndis_init_cmplt_type;
50
51typedef struct rndis_halt_msg_type
52{
53 __le32 MessageType;
54 __le32 MessageLength;
55 __le32 RequestID;
56} rndis_halt_msg_type;
57
58typedef struct rndis_query_msg_type
59{
60 __le32 MessageType;
61 __le32 MessageLength;
62 __le32 RequestID;
63 __le32 OID;
64 __le32 InformationBufferLength;
65 __le32 InformationBufferOffset;
66 __le32 DeviceVcHandle;
67} rndis_query_msg_type;
68
69typedef struct rndis_query_cmplt_type
70{
71 __le32 MessageType;
72 __le32 MessageLength;
73 __le32 RequestID;
74 __le32 Status;
75 __le32 InformationBufferLength;
76 __le32 InformationBufferOffset;
77} rndis_query_cmplt_type;
78
79typedef struct rndis_set_msg_type
80{
81 __le32 MessageType;
82 __le32 MessageLength;
83 __le32 RequestID;
84 __le32 OID;
85 __le32 InformationBufferLength;
86 __le32 InformationBufferOffset;
87 __le32 DeviceVcHandle;
88} rndis_set_msg_type;
89
90typedef struct rndis_set_cmplt_type
91{
92 __le32 MessageType;
93 __le32 MessageLength;
94 __le32 RequestID;
95 __le32 Status;
96} rndis_set_cmplt_type;
97
98typedef struct rndis_reset_msg_type
99{
100 __le32 MessageType;
101 __le32 MessageLength;
102 __le32 Reserved;
103} rndis_reset_msg_type;
104
105typedef struct rndis_reset_cmplt_type
106{
107 __le32 MessageType;
108 __le32 MessageLength;
109 __le32 Status;
110 __le32 AddressingReset;
111} rndis_reset_cmplt_type;
112
113typedef struct rndis_indicate_status_msg_type
114{
115 __le32 MessageType;
116 __le32 MessageLength;
117 __le32 Status;
118 __le32 StatusBufferLength;
119 __le32 StatusBufferOffset;
120} rndis_indicate_status_msg_type;
121
122typedef struct rndis_keepalive_msg_type
123{
124 __le32 MessageType;
125 __le32 MessageLength;
126 __le32 RequestID;
127} rndis_keepalive_msg_type;
128
129typedef struct rndis_keepalive_cmplt_type
130{
131 __le32 MessageType;
132 __le32 MessageLength;
133 __le32 RequestID;
134 __le32 Status;
135} rndis_keepalive_cmplt_type;
136
137struct rndis_packet_msg_type
138{
139 __le32 MessageType;
140 __le32 MessageLength;
141 __le32 DataOffset;
142 __le32 DataLength;
143 __le32 OOBDataOffset;
144 __le32 OOBDataLength;
145 __le32 NumOOBDataElements;
146 __le32 PerPacketInfoOffset;
147 __le32 PerPacketInfoLength;
148 __le32 VcHandle;
149 __le32 Reserved;
178398dc 150} __attribute__ ((packed));
1da177e4
LT
151
152struct rndis_config_parameter
153{
154 __le32 ParameterNameOffset;
155 __le32 ParameterNameLength;
156 __le32 ParameterType;
157 __le32 ParameterValueOffset;
158 __le32 ParameterValueLength;
159};
160
161/* implementation specific */
162enum rndis_state
163{
164 RNDIS_UNINITIALIZED,
165 RNDIS_INITIALIZED,
166 RNDIS_DATA_INITIALIZED,
167};
168
169typedef struct rndis_resp_t
170{
171 struct list_head list;
172 u8 *buf;
173 u32 length;
174 int send;
175} rndis_resp_t;
176
177typedef struct rndis_params
178{
179 u8 confignr;
340600ab
DB
180 u8 used;
181 u16 saved_filter;
1da177e4 182 enum rndis_state state;
1da177e4
LT
183 u32 medium;
184 u32 speed;
185 u32 media_state;
340600ab 186
1da177e4 187 const u8 *host_mac;
340600ab 188 u16 *filter;
7e27f18c 189 struct net_device *dev;
340600ab 190
1da177e4
LT
191 u32 vendorID;
192 const char *vendorDescr;
15b2d2b5
DB
193 void (*resp_avail)(void *v);
194 void *v;
1da177e4
LT
195 struct list_head resp_queue;
196} rndis_params;
197
198/* RNDIS Message parser and other useless functions */
199int rndis_msg_parser (u8 configNr, u8 *buf);
15b2d2b5 200int rndis_register(void (*resp_avail)(void *v), void *v);
1da177e4
LT
201void rndis_deregister (int configNr);
202int rndis_set_param_dev (u8 configNr, struct net_device *dev,
340600ab 203 u16 *cdc_filter);
7e27f18c 204int rndis_set_param_vendor (u8 configNr, u32 vendorID,
1da177e4
LT
205 const char *vendorDescr);
206int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed);
207void rndis_add_hdr (struct sk_buff *skb);
9b39e9dd
BN
208int rndis_rm_hdr(struct gether *port, struct sk_buff *skb,
209 struct sk_buff_head *list);
1da177e4
LT
210u8 *rndis_get_next_response (int configNr, u32 *length);
211void rndis_free_response (int configNr, u8 *buf);
212
340600ab 213void rndis_uninit (int configNr);
1da177e4
LT
214int rndis_signal_connect (int configNr);
215int rndis_signal_disconnect (int configNr);
216int rndis_state (int configNr);
217extern void rndis_set_host_mac (int configNr, const u8 *addr);
218
793f03aa 219int rndis_init(void);
1da177e4
LT
220void rndis_exit (void);
221
222#endif /* _LINUX_RNDIS_H */
This page took 0.771591 seconds and 5 git commands to generate.