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