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