1 /* $FreeBSD$ */ 2 /* $OpenBSD: if_urndisreg.h,v 1.19 2013/11/21 14:08:05 mpi Exp $ */ 3 4 /* 5 * Copyright (c) 2010 Jonathan Armani <armani@openbsd.org> 6 * Copyright (c) 2010 Fabien Romano <fabien@openbsd.org> 7 * Copyright (c) 2010 Michael Knudsen <mk@openbsd.org> 8 * All rights reserved. 9 * 10 * Permission to use, copy, modify, and distribute this software for any 11 * purpose with or without fee is hereby granted, provided that the above 12 * copyright notice and this permission notice appear in all copies. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 15 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 16 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 17 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 18 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 19 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 20 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 21 */ 22 23 #ifndef _NET_RNDIS_H_ 24 #define _NET_RNDIS_H_ 25 26 #define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005L 27 #define RNDIS_STATUS_FAILURE 0xC0000001L 28 #define RNDIS_STATUS_INVALID_DATA 0xC0010015L 29 #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BL 30 #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CL 31 #define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BBL 32 #define RNDIS_STATUS_PENDING STATUS_PENDING /* XXX */ 33 #define RNDIS_STATUS_RESOURCES 0xC000009AL 34 #define RNDIS_STATUS_SUCCESS 0x00000000L 35 36 #define OID_GEN_SUPPORTED_LIST 0x00010101 37 #define OID_GEN_HARDWARE_STATUS 0x00010102 38 #define OID_GEN_MEDIA_SUPPORTED 0x00010103 39 #define OID_GEN_MEDIA_IN_USE 0x00010104 40 #define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 41 #define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 42 #define OID_GEN_LINK_SPEED 0x00010107 43 #define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 44 #define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 45 #define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A 46 #define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B 47 #define OID_GEN_VENDOR_ID 0x0001010C 48 #define OID_GEN_VENDOR_DESCRIPTION 0x0001010D 49 #define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E 50 #define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F 51 #define OID_GEN_DRIVER_VERSION 0x00010110 52 #define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 53 #define OID_GEN_PROTOCOL_OPTIONS 0x00010112 54 #define OID_GEN_MAC_OPTIONS 0x00010113 55 #define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 56 #define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 57 #define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 58 #define OID_GEN_SUPPORTED_GUIDS 0x00010117 59 #define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118 60 #define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119 61 #define OID_GEN_MACHINE_NAME 0x0001021A 62 #define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B 63 #define OID_GEN_VLAN_ID 0x0001021C 64 65 #define OID_802_3_PERMANENT_ADDRESS 0x01010101 66 #define OID_802_3_CURRENT_ADDRESS 0x01010102 67 #define OID_802_3_MULTICAST_LIST 0x01010103 68 #define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 69 #define OID_802_3_MAC_OPTIONS 0x01010105 70 #define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 71 #define OID_802_3_XMIT_ONE_COLLISION 0x01020102 72 #define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 73 #define OID_802_3_XMIT_DEFERRED 0x01020201 74 #define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 75 #define OID_802_3_RCV_OVERRUN 0x01020203 76 #define OID_802_3_XMIT_UNDERRUN 0x01020204 77 #define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 78 #define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 79 #define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 80 81 #define RNDIS_MEDIUM_802_3 0x00000000 82 83 /* Device flags */ 84 #define RNDIS_DF_CONNECTIONLESS 0x00000001 85 #define RNDIS_DF_CONNECTION_ORIENTED 0x00000002 86 87 /* 88 * RNDIS data message 89 */ 90 #define REMOTE_NDIS_PACKET_MSG 0x00000001 91 92 struct rndis_packet_msg { 93 uint32_t rm_type; 94 uint32_t rm_len; 95 uint32_t rm_dataoffset; 96 uint32_t rm_datalen; 97 uint32_t rm_oobdataoffset; 98 uint32_t rm_oobdatalen; 99 uint32_t rm_oobdataelements; 100 uint32_t rm_pktinfooffset; 101 uint32_t rm_pktinfolen; 102 uint32_t rm_vchandle; 103 uint32_t rm_reserved; 104 }; 105 106 /* 107 * RNDIS control messages 108 */ 109 struct rndis_comp_hdr { 110 uint32_t rm_type; 111 uint32_t rm_len; 112 uint32_t rm_rid; 113 uint32_t rm_status; 114 }; 115 116 /* Initialize the device. */ 117 #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002 118 #define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002 119 120 struct rndis_init_req { 121 uint32_t rm_type; 122 uint32_t rm_len; 123 uint32_t rm_rid; 124 uint32_t rm_ver_major; 125 uint32_t rm_ver_minor; 126 uint32_t rm_max_xfersz; 127 }; 128 129 struct rndis_init_comp { 130 uint32_t rm_type; 131 uint32_t rm_len; 132 uint32_t rm_rid; 133 uint32_t rm_status; 134 uint32_t rm_ver_major; 135 uint32_t rm_ver_minor; 136 uint32_t rm_devflags; 137 uint32_t rm_medium; 138 uint32_t rm_pktmaxcnt; 139 uint32_t rm_pktmaxsz; 140 uint32_t rm_align; 141 uint32_t rm_aflistoffset; 142 uint32_t rm_aflistsz; 143 }; 144 145 /* Halt the device. No response sent. */ 146 #define REMOTE_NDIS_HALT_MSG 0x00000003 147 148 struct rndis_halt_req { 149 uint32_t rm_type; 150 uint32_t rm_len; 151 uint32_t rm_rid; 152 }; 153 154 /* Send a query object. */ 155 #define REMOTE_NDIS_QUERY_MSG 0x00000004 156 #define REMOTE_NDIS_QUERY_CMPLT 0x80000004 157 158 struct rndis_query_req { 159 uint32_t rm_type; 160 uint32_t rm_len; 161 uint32_t rm_rid; 162 uint32_t rm_oid; 163 uint32_t rm_infobuflen; 164 uint32_t rm_infobufoffset; 165 uint32_t rm_devicevchdl; 166 }; 167 168 struct rndis_query_comp { 169 uint32_t rm_type; 170 uint32_t rm_len; 171 uint32_t rm_rid; 172 uint32_t rm_status; 173 uint32_t rm_infobuflen; 174 uint32_t rm_infobufoffset; 175 }; 176 177 /* Send a set object request. */ 178 #define REMOTE_NDIS_SET_MSG 0x00000005 179 #define REMOTE_NDIS_SET_CMPLT 0x80000005 180 181 struct rndis_set_req { 182 uint32_t rm_type; 183 uint32_t rm_len; 184 uint32_t rm_rid; 185 uint32_t rm_oid; 186 uint32_t rm_infobuflen; 187 uint32_t rm_infobufoffset; 188 uint32_t rm_devicevchdl; 189 }; 190 191 struct rndis_set_comp { 192 uint32_t rm_type; 193 uint32_t rm_len; 194 uint32_t rm_rid; 195 uint32_t rm_status; 196 }; 197 198 #define REMOTE_NDIS_SET_PARAM_NUMERIC 0x00000000 199 #define REMOTE_NDIS_SET_PARAM_STRING 0x00000002 200 201 struct rndis_set_parameter { 202 uint32_t rm_nameoffset; 203 uint32_t rm_namelen; 204 uint32_t rm_type; 205 uint32_t rm_valueoffset; 206 uint32_t rm_valuelen; 207 }; 208 209 /* Perform a soft reset on the device. */ 210 #define REMOTE_NDIS_RESET_MSG 0x00000006 211 #define REMOTE_NDIS_RESET_CMPLT 0x80000006 212 213 struct rndis_reset_req { 214 uint32_t rm_type; 215 uint32_t rm_len; 216 uint32_t rm_rid; 217 }; 218 219 struct rndis_reset_comp { 220 uint32_t rm_type; 221 uint32_t rm_len; 222 uint32_t rm_status; 223 uint32_t rm_adrreset; 224 }; 225 226 /* 802.3 link-state or undefined message error. */ 227 #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007 228 229 /* Keepalive messsage. May be sent by device. */ 230 #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008 231 #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008 232 233 struct rndis_keepalive_req { 234 uint32_t rm_type; 235 uint32_t rm_len; 236 uint32_t rm_rid; 237 }; 238 239 struct rndis_keepalive_comp { 240 uint32_t rm_type; 241 uint32_t rm_len; 242 uint32_t rm_rid; 243 uint32_t rm_status; 244 }; 245 246 /* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ 247 #define RNDIS_PACKET_TYPE_DIRECTED 0x00000001 248 #define RNDIS_PACKET_TYPE_MULTICAST 0x00000002 249 #define RNDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 250 #define RNDIS_PACKET_TYPE_BROADCAST 0x00000008 251 #define RNDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 252 #define RNDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 253 #define RNDIS_PACKET_TYPE_SMT 0x00000040 254 #define RNDIS_PACKET_TYPE_ALL_LOCAL 0x00000080 255 #define RNDIS_PACKET_TYPE_GROUP 0x00001000 256 #define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000 257 #define RNDIS_PACKET_TYPE_FUNCTIONAL 0x00004000 258 #define RNDIS_PACKET_TYPE_MAC_FRAME 0x00008000 259 260 /* RNDIS offsets */ 261 #define RNDIS_HEADER_OFFSET 8 /* bytes */ 262 #define RNDIS_DATA_OFFSET \ 263 ((uint32_t)(sizeof(struct rndis_packet_msg) - RNDIS_HEADER_OFFSET)) 264 265 #endif /* !_NET_RNDIS_H_ */ 266