1 /* 2 * RNDIS Definitions for Remote NDIS 3 * 4 * Authors: Benedikt Spranger, Pengutronix 5 * Robert Schwebel, Pengutronix 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * version 2, as published by the Free Software Foundation. 10 * 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 18 #include <linux/rndis.h> 19 #include "u_ether.h" 20 #include "ndis.h" 21 22 #define RNDIS_MAXIMUM_FRAME_SIZE 1518 23 #define RNDIS_MAX_TOTAL_SIZE 1558 24 25 typedef struct rndis_init_msg_type 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; 151 } __attribute__ ((packed)); 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; 181 u8 used; 182 u16 saved_filter; 183 enum rndis_state state; 184 u32 medium; 185 u32 speed; 186 u32 media_state; 187 188 const u8 *host_mac; 189 u16 *filter; 190 struct net_device *dev; 191 192 u32 vendorID; 193 const char *vendorDescr; 194 void (*resp_avail)(void *v); 195 void *v; 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); 201 int rndis_register(void (*resp_avail)(void *v), void *v); 202 void rndis_deregister (int configNr); 203 int rndis_set_param_dev (u8 configNr, struct net_device *dev, 204 u16 *cdc_filter); 205 int rndis_set_param_vendor (u8 configNr, u32 vendorID, 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); 209 int rndis_rm_hdr(struct gether *port, struct sk_buff *skb, 210 struct sk_buff_head *list); 211 u8 *rndis_get_next_response (int configNr, u32 *length); 212 void rndis_free_response (int configNr, u8 *buf); 213 214 void rndis_uninit (int configNr); 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 220 #endif /* _LINUX_RNDIS_H */ 221