2 * RNDIS Definitions for Remote NDIS
4 * Version: $Id: rndis.h,v 1.15 2004/03/25 21:33:46 robert Exp $
6 * Authors: Benedikt Spranger, Pengutronix
7 * Robert Schwebel, Pengutronix
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2, as published by the Free Software Foundation.
13 * This software was originally developed in conformance with
14 * Microsoft's Remote NDIS Specification License Agreement.
17 #ifndef _LINUX_RNDIS_H
18 #define _LINUX_RNDIS_H
22 #define RNDIS_MAXIMUM_FRAME_SIZE 1518
23 #define RNDIS_MAX_TOTAL_SIZE 1558
25 /* Remote NDIS Versions */
26 #define RNDIS_MAJOR_VERSION 1
27 #define RNDIS_MINOR_VERSION 0
30 #define RNDIS_STATUS_SUCCESS 0x00000000U /* Success */
31 #define RNDIS_STATUS_FAILURE 0xC0000001U /* Unspecified error */
32 #define RNDIS_STATUS_INVALID_DATA 0xC0010015U /* Invalid data */
33 #define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BBU /* Unsupported request */
34 #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BU /* Device connected */
35 #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CU /* Device disconnected */
36 /* For all not specified status messages:
37 * RNDIS_STATUS_Xxx -> NDIS_STATUS_Xxx
40 /* Message Set for Connectionless (802.3) Devices */
41 #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002U /* Initialize device */
42 #define REMOTE_NDIS_HALT_MSG 0x00000003U
43 #define REMOTE_NDIS_QUERY_MSG 0x00000004U
44 #define REMOTE_NDIS_SET_MSG 0x00000005U
45 #define REMOTE_NDIS_RESET_MSG 0x00000006U
46 #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007U
47 #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008U
49 /* Message completion */
50 #define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002U
51 #define REMOTE_NDIS_QUERY_CMPLT 0x80000004U
52 #define REMOTE_NDIS_SET_CMPLT 0x80000005U
53 #define REMOTE_NDIS_RESET_CMPLT 0x80000006U
54 #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008U
57 #define RNDIS_DF_CONNECTIONLESS 0x00000001U
58 #define RNDIS_DF_CONNECTION_ORIENTED 0x00000002U
60 #define RNDIS_MEDIUM_802_3 0x00000000U
63 static const u32 oid_supported_list [] =
65 /* mandatory general */
66 /* the general stuff */
67 OID_GEN_SUPPORTED_LIST,
68 OID_GEN_HARDWARE_STATUS,
69 OID_GEN_MEDIA_SUPPORTED,
71 OID_GEN_MAXIMUM_FRAME_SIZE,
73 OID_GEN_TRANSMIT_BUFFER_SPACE,
74 OID_GEN_TRANSMIT_BLOCK_SIZE,
75 OID_GEN_RECEIVE_BLOCK_SIZE,
77 OID_GEN_VENDOR_DESCRIPTION,
78 OID_GEN_VENDOR_DRIVER_VERSION,
79 OID_GEN_CURRENT_PACKET_FILTER,
80 OID_GEN_MAXIMUM_TOTAL_SIZE,
82 OID_GEN_MEDIA_CONNECT_STATUS,
83 OID_GEN_PHYSICAL_MEDIUM,
84 OID_GEN_RNDIS_CONFIG_PARAMETER,
86 /* the statistical stuff */
91 OID_GEN_RCV_NO_BUFFER,
92 OID_GEN_DIRECTED_BYTES_XMIT,
93 OID_GEN_DIRECTED_FRAMES_XMIT,
94 OID_GEN_MULTICAST_BYTES_XMIT,
95 OID_GEN_MULTICAST_FRAMES_XMIT,
96 OID_GEN_BROADCAST_BYTES_XMIT,
97 OID_GEN_BROADCAST_FRAMES_XMIT,
98 OID_GEN_DIRECTED_BYTES_RCV,
99 OID_GEN_DIRECTED_FRAMES_RCV,
100 OID_GEN_MULTICAST_BYTES_RCV,
101 OID_GEN_MULTICAST_FRAMES_RCV,
102 OID_GEN_BROADCAST_BYTES_RCV,
103 OID_GEN_BROADCAST_FRAMES_RCV,
104 OID_GEN_RCV_CRC_ERROR,
105 OID_GEN_TRANSMIT_QUEUE_LENGTH,
107 /* mandatory 802.3 */
108 /* the general stuff */
109 OID_802_3_PERMANENT_ADDRESS,
110 OID_802_3_CURRENT_ADDRESS,
111 OID_802_3_MULTICAST_LIST,
112 OID_802_3_MAC_OPTIONS,
113 OID_802_3_MAXIMUM_LIST_SIZE,
115 /* the statistical stuff */
116 OID_802_3_RCV_ERROR_ALIGNMENT,
117 OID_802_3_XMIT_ONE_COLLISION,
118 OID_802_3_XMIT_MORE_COLLISIONS
122 typedef struct rndis_init_msg_type
130 } rndis_init_msg_type;
132 typedef struct rndis_init_cmplt_type
142 u32 MaxPacketsPerTransfer;
144 u32 PacketAlignmentFactor;
147 } rndis_init_cmplt_type;
149 typedef struct rndis_halt_msg_type
154 } rndis_halt_msg_type;
156 typedef struct rndis_query_msg_type
162 u32 InformationBufferLength;
163 u32 InformationBufferOffset;
165 } rndis_query_msg_type;
167 typedef struct rndis_query_cmplt_type
173 u32 InformationBufferLength;
174 u32 InformationBufferOffset;
175 } rndis_query_cmplt_type;
177 typedef struct rndis_set_msg_type
183 u32 InformationBufferLength;
184 u32 InformationBufferOffset;
186 } rndis_set_msg_type;
188 typedef struct rndis_set_cmplt_type
194 } rndis_set_cmplt_type;
196 typedef struct rndis_reset_msg_type
201 } rndis_reset_msg_type;
203 typedef struct rndis_reset_cmplt_type
209 } rndis_reset_cmplt_type;
211 typedef struct rndis_indicate_status_msg_type
216 u32 StatusBufferLength;
217 u32 StatusBufferOffset;
218 } rndis_indicate_status_msg_type;
220 typedef struct rndis_keepalive_msg_type
225 } rndis_keepalive_msg_type;
227 typedef struct rndis_keepalive_cmplt_type
233 } rndis_keepalive_cmplt_type;
235 struct rndis_packet_msg_type
243 u32 NumOOBDataElements;
244 u32 PerPacketInfoOffset;
245 u32 PerPacketInfoLength;
250 struct rndis_config_parameter
252 u32 ParameterNameOffset;
253 u32 ParameterNameLength;
255 u32 ParameterValueOffset;
256 u32 ParameterValueLength;
259 /* implementation specific */
264 RNDIS_DATA_INITIALIZED,
267 typedef struct rndis_resp_t
269 struct list_head list;
275 typedef struct rndis_params
279 enum rndis_state state;
285 struct net_device *dev;
286 struct net_device_stats *stats;
288 const char *vendorDescr;
289 int (*ack) (struct net_device *);
290 struct list_head resp_queue;
293 /* RNDIS Message parser and other useless functions */
294 int rndis_msg_parser (u8 configNr, u8 *buf);
295 int rndis_register (int (*rndis_control_ack) (struct net_device *));
296 void rndis_deregister (int configNr);
297 int rndis_set_param_dev (u8 configNr, struct net_device *dev,
298 struct net_device_stats *stats);
299 int rndis_set_param_vendor (u8 configNr, u32 vendorID,
300 const char *vendorDescr);
301 int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed);
302 void rndis_add_hdr (struct sk_buff *skb);
303 int rndis_rm_hdr (u8 *buf, u32 *length);
304 u8 *rndis_get_next_response (int configNr, u32 *length);
305 void rndis_free_response (int configNr, u8 *buf);
307 int rndis_signal_connect (int configNr);
308 int rndis_signal_disconnect (int configNr);
309 int rndis_state (int configNr);
310 extern void rndis_set_host_mac (int configNr, const u8 *addr);
312 int __init rndis_init (void);
313 void rndis_exit (void);
315 #endif /* _LINUX_RNDIS_H */