net: Split RNDIS protocol structs/macros out of dev/usb/net/if_urndisreg.h
So that Hyper-V can leverage them instead of rolling its own definition. Discussed with: hps Reviewed by: hps MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7592
This commit is contained in:
parent
924ee01008
commit
9f5b1251a4
@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/rndis.h>
|
||||
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usbdi.h>
|
||||
@ -79,17 +80,17 @@ static uether_fn_t urndis_setmulti;
|
||||
static uether_fn_t urndis_setpromisc;
|
||||
|
||||
static uint32_t urndis_ctrl_query(struct urndis_softc *sc, uint32_t oid,
|
||||
struct urndis_query_req *msg, uint16_t len,
|
||||
struct rndis_query_req *msg, uint16_t len,
|
||||
const void **rbuf, uint16_t *rbufsz);
|
||||
static uint32_t urndis_ctrl_set(struct urndis_softc *sc, uint32_t oid,
|
||||
struct urndis_set_req *msg, uint16_t len);
|
||||
struct rndis_set_req *msg, uint16_t len);
|
||||
static uint32_t urndis_ctrl_handle_init(struct urndis_softc *sc,
|
||||
const struct urndis_comp_hdr *hdr);
|
||||
const struct rndis_comp_hdr *hdr);
|
||||
static uint32_t urndis_ctrl_handle_query(struct urndis_softc *sc,
|
||||
const struct urndis_comp_hdr *hdr, const void **buf,
|
||||
const struct rndis_comp_hdr *hdr, const void **buf,
|
||||
uint16_t *bufsz);
|
||||
static uint32_t urndis_ctrl_handle_reset(struct urndis_softc *sc,
|
||||
const struct urndis_comp_hdr *hdr);
|
||||
const struct rndis_comp_hdr *hdr);
|
||||
static uint32_t urndis_ctrl_init(struct urndis_softc *sc);
|
||||
static uint32_t urndis_ctrl_halt(struct urndis_softc *sc);
|
||||
|
||||
@ -212,8 +213,8 @@ urndis_attach(device_t dev)
|
||||
{
|
||||
static struct {
|
||||
union {
|
||||
struct urndis_query_req query;
|
||||
struct urndis_set_req set;
|
||||
struct rndis_query_req query;
|
||||
struct rndis_set_req set;
|
||||
} hdr;
|
||||
union {
|
||||
uint8_t eaddr[ETHER_ADDR_LEN];
|
||||
@ -453,10 +454,10 @@ urndis_ctrl_send(struct urndis_softc *sc, void *buf, uint16_t len)
|
||||
return (err);
|
||||
}
|
||||
|
||||
static struct urndis_comp_hdr *
|
||||
static struct rndis_comp_hdr *
|
||||
urndis_ctrl_recv(struct urndis_softc *sc)
|
||||
{
|
||||
struct urndis_comp_hdr *hdr;
|
||||
struct rndis_comp_hdr *hdr;
|
||||
usb_error_t err;
|
||||
|
||||
err = urndis_ctrl_msg(sc, UT_READ_CLASS_INTERFACE,
|
||||
@ -466,7 +467,7 @@ urndis_ctrl_recv(struct urndis_softc *sc)
|
||||
if (err != USB_ERR_NORMAL_COMPLETION)
|
||||
return (NULL);
|
||||
|
||||
hdr = (struct urndis_comp_hdr *)sc->sc_response_buf;
|
||||
hdr = (struct rndis_comp_hdr *)sc->sc_response_buf;
|
||||
|
||||
DPRINTF("type 0x%x len %u\n", le32toh(hdr->rm_type),
|
||||
le32toh(hdr->rm_len));
|
||||
@ -480,7 +481,7 @@ urndis_ctrl_recv(struct urndis_softc *sc)
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
urndis_ctrl_handle(struct urndis_softc *sc, struct urndis_comp_hdr *hdr,
|
||||
urndis_ctrl_handle(struct urndis_softc *sc, struct rndis_comp_hdr *hdr,
|
||||
const void **buf, uint16_t *bufsz)
|
||||
{
|
||||
uint32_t rval;
|
||||
@ -521,11 +522,11 @@ urndis_ctrl_handle(struct urndis_softc *sc, struct urndis_comp_hdr *hdr,
|
||||
|
||||
static uint32_t
|
||||
urndis_ctrl_handle_init(struct urndis_softc *sc,
|
||||
const struct urndis_comp_hdr *hdr)
|
||||
const struct rndis_comp_hdr *hdr)
|
||||
{
|
||||
const struct urndis_init_comp *msg;
|
||||
const struct rndis_init_comp *msg;
|
||||
|
||||
msg = (const struct urndis_init_comp *)hdr;
|
||||
msg = (const struct rndis_init_comp *)hdr;
|
||||
|
||||
DPRINTF("len %u rid %u status 0x%x "
|
||||
"ver_major %u ver_minor %u devflags 0x%x medium 0x%x pktmaxcnt %u "
|
||||
@ -564,12 +565,12 @@ urndis_ctrl_handle_init(struct urndis_softc *sc,
|
||||
|
||||
static uint32_t
|
||||
urndis_ctrl_handle_query(struct urndis_softc *sc,
|
||||
const struct urndis_comp_hdr *hdr, const void **buf, uint16_t *bufsz)
|
||||
const struct rndis_comp_hdr *hdr, const void **buf, uint16_t *bufsz)
|
||||
{
|
||||
const struct urndis_query_comp *msg;
|
||||
const struct rndis_query_comp *msg;
|
||||
uint64_t limit;
|
||||
|
||||
msg = (const struct urndis_query_comp *)hdr;
|
||||
msg = (const struct rndis_query_comp *)hdr;
|
||||
|
||||
DPRINTF("len %u rid %u status 0x%x "
|
||||
"buflen %u bufoff %u\n",
|
||||
@ -609,12 +610,12 @@ urndis_ctrl_handle_query(struct urndis_softc *sc,
|
||||
|
||||
static uint32_t
|
||||
urndis_ctrl_handle_reset(struct urndis_softc *sc,
|
||||
const struct urndis_comp_hdr *hdr)
|
||||
const struct rndis_comp_hdr *hdr)
|
||||
{
|
||||
const struct urndis_reset_comp *msg;
|
||||
const struct rndis_reset_comp *msg;
|
||||
uint32_t rval;
|
||||
|
||||
msg = (const struct urndis_reset_comp *)hdr;
|
||||
msg = (const struct rndis_reset_comp *)hdr;
|
||||
|
||||
rval = le32toh(msg->rm_status);
|
||||
|
||||
@ -630,7 +631,7 @@ urndis_ctrl_handle_reset(struct urndis_softc *sc,
|
||||
}
|
||||
if (msg->rm_adrreset != 0) {
|
||||
struct {
|
||||
struct urndis_set_req hdr;
|
||||
struct rndis_set_req hdr;
|
||||
uint32_t filter;
|
||||
} msg_filter;
|
||||
|
||||
@ -650,8 +651,8 @@ urndis_ctrl_handle_reset(struct urndis_softc *sc,
|
||||
static uint32_t
|
||||
urndis_ctrl_init(struct urndis_softc *sc)
|
||||
{
|
||||
struct urndis_init_req msg;
|
||||
struct urndis_comp_hdr *hdr;
|
||||
struct rndis_init_req msg;
|
||||
struct rndis_comp_hdr *hdr;
|
||||
uint32_t rval;
|
||||
|
||||
msg.rm_type = htole32(REMOTE_NDIS_INITIALIZE_MSG);
|
||||
@ -688,7 +689,7 @@ urndis_ctrl_init(struct urndis_softc *sc)
|
||||
static uint32_t
|
||||
urndis_ctrl_halt(struct urndis_softc *sc)
|
||||
{
|
||||
struct urndis_halt_req msg;
|
||||
struct rndis_halt_req msg;
|
||||
uint32_t rval;
|
||||
|
||||
msg.rm_type = htole32(REMOTE_NDIS_HALT_MSG);
|
||||
@ -714,10 +715,10 @@ urndis_ctrl_halt(struct urndis_softc *sc)
|
||||
*/
|
||||
static uint32_t
|
||||
urndis_ctrl_query(struct urndis_softc *sc, uint32_t oid,
|
||||
struct urndis_query_req *msg, uint16_t len, const void **rbuf,
|
||||
struct rndis_query_req *msg, uint16_t len, const void **rbuf,
|
||||
uint16_t *rbufsz)
|
||||
{
|
||||
struct urndis_comp_hdr *hdr;
|
||||
struct rndis_comp_hdr *hdr;
|
||||
uint32_t datalen, rval;
|
||||
|
||||
msg->rm_type = htole32(REMOTE_NDIS_QUERY_MSG);
|
||||
@ -761,9 +762,9 @@ urndis_ctrl_query(struct urndis_softc *sc, uint32_t oid,
|
||||
|
||||
static uint32_t
|
||||
urndis_ctrl_set(struct urndis_softc *sc, uint32_t oid,
|
||||
struct urndis_set_req *msg, uint16_t len)
|
||||
struct rndis_set_req *msg, uint16_t len)
|
||||
{
|
||||
struct urndis_comp_hdr *hdr;
|
||||
struct rndis_comp_hdr *hdr;
|
||||
uint32_t datalen, rval;
|
||||
|
||||
msg->rm_type = htole32(REMOTE_NDIS_SET_MSG);
|
||||
@ -813,7 +814,7 @@ urndis_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
struct urndis_softc *sc = usbd_xfer_softc(xfer);
|
||||
struct usb_page_cache *pc = usbd_xfer_get_frame(xfer, 0);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
struct urndis_packet_msg msg;
|
||||
struct rndis_packet_msg msg;
|
||||
struct mbuf *m;
|
||||
int actlen;
|
||||
int aframes;
|
||||
@ -873,11 +874,11 @@ urndis_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
"datalen %u\n", msg.rm_datalen, actlen);
|
||||
goto tr_setup;
|
||||
} else if ((msg.rm_dataoffset + msg.rm_datalen +
|
||||
(uint32_t)__offsetof(struct urndis_packet_msg,
|
||||
(uint32_t)__offsetof(struct rndis_packet_msg,
|
||||
rm_dataoffset)) > (uint32_t)actlen) {
|
||||
DPRINTF("invalid dataoffset %u larger than %u\n",
|
||||
msg.rm_dataoffset + msg.rm_datalen +
|
||||
(uint32_t)__offsetof(struct urndis_packet_msg,
|
||||
(uint32_t)__offsetof(struct rndis_packet_msg,
|
||||
rm_dataoffset), actlen);
|
||||
goto tr_setup;
|
||||
} else if (msg.rm_datalen < (uint32_t)sizeof(struct ether_header)) {
|
||||
@ -903,7 +904,7 @@ urndis_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
m_adj(m, ETHER_ALIGN);
|
||||
|
||||
usbd_copy_out(pc, offset + msg.rm_dataoffset +
|
||||
__offsetof(struct urndis_packet_msg,
|
||||
__offsetof(struct rndis_packet_msg,
|
||||
rm_dataoffset), m->m_data, msg.rm_datalen);
|
||||
|
||||
/* enqueue */
|
||||
@ -939,7 +940,7 @@ urndis_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
static void
|
||||
urndis_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
|
||||
{
|
||||
struct urndis_packet_msg msg;
|
||||
struct rndis_packet_msg msg;
|
||||
struct urndis_softc *sc = usbd_xfer_softc(xfer);
|
||||
struct ifnet *ifp = uether_getifp(&sc->sc_ue);
|
||||
struct mbuf *m;
|
||||
|
@ -55,242 +55,4 @@ struct urndis_softc {
|
||||
#define URNDIS_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
|
||||
#define URNDIS_LOCK_ASSERT(sc, what) mtx_assert(&(sc)->sc_mtx, (what))
|
||||
|
||||
#define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005L
|
||||
#define RNDIS_STATUS_FAILURE 0xC0000001L
|
||||
#define RNDIS_STATUS_INVALID_DATA 0xC0010015L
|
||||
#define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BL
|
||||
#define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CL
|
||||
#define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BBL
|
||||
#define RNDIS_STATUS_PENDING STATUS_PENDING /* XXX */
|
||||
#define RNDIS_STATUS_RESOURCES 0xC000009AL
|
||||
#define RNDIS_STATUS_SUCCESS 0x00000000L
|
||||
|
||||
#define OID_GEN_SUPPORTED_LIST 0x00010101
|
||||
#define OID_GEN_HARDWARE_STATUS 0x00010102
|
||||
#define OID_GEN_MEDIA_SUPPORTED 0x00010103
|
||||
#define OID_GEN_MEDIA_IN_USE 0x00010104
|
||||
#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
|
||||
#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
|
||||
#define OID_GEN_LINK_SPEED 0x00010107
|
||||
#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
|
||||
#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
|
||||
#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
|
||||
#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
|
||||
#define OID_GEN_VENDOR_ID 0x0001010C
|
||||
#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D
|
||||
#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
|
||||
#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
|
||||
#define OID_GEN_DRIVER_VERSION 0x00010110
|
||||
#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
|
||||
#define OID_GEN_PROTOCOL_OPTIONS 0x00010112
|
||||
#define OID_GEN_MAC_OPTIONS 0x00010113
|
||||
#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
|
||||
#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
|
||||
#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
|
||||
#define OID_GEN_SUPPORTED_GUIDS 0x00010117
|
||||
#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
|
||||
#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
|
||||
#define OID_GEN_MACHINE_NAME 0x0001021A
|
||||
#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
|
||||
#define OID_GEN_VLAN_ID 0x0001021C
|
||||
|
||||
#define OID_802_3_PERMANENT_ADDRESS 0x01010101
|
||||
#define OID_802_3_CURRENT_ADDRESS 0x01010102
|
||||
#define OID_802_3_MULTICAST_LIST 0x01010103
|
||||
#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
|
||||
#define OID_802_3_MAC_OPTIONS 0x01010105
|
||||
#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
|
||||
#define OID_802_3_XMIT_ONE_COLLISION 0x01020102
|
||||
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
|
||||
#define OID_802_3_XMIT_DEFERRED 0x01020201
|
||||
#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
|
||||
#define OID_802_3_RCV_OVERRUN 0x01020203
|
||||
#define OID_802_3_XMIT_UNDERRUN 0x01020204
|
||||
#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
|
||||
#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
|
||||
#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
|
||||
|
||||
#define RNDIS_MEDIUM_802_3 0x00000000
|
||||
|
||||
/* Device flags */
|
||||
#define RNDIS_DF_CONNECTIONLESS 0x00000001
|
||||
#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002
|
||||
|
||||
/*
|
||||
* RNDIS data message
|
||||
*/
|
||||
#define REMOTE_NDIS_PACKET_MSG 0x00000001
|
||||
|
||||
struct urndis_packet_msg {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_dataoffset;
|
||||
uint32_t rm_datalen;
|
||||
uint32_t rm_oobdataoffset;
|
||||
uint32_t rm_oobdatalen;
|
||||
uint32_t rm_oobdataelements;
|
||||
uint32_t rm_pktinfooffset;
|
||||
uint32_t rm_pktinfolen;
|
||||
uint32_t rm_vchandle;
|
||||
uint32_t rm_reserved;
|
||||
};
|
||||
|
||||
/*
|
||||
* RNDIS control messages
|
||||
*/
|
||||
struct urndis_comp_hdr {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_status;
|
||||
};
|
||||
|
||||
/* Initialize the device. */
|
||||
#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002
|
||||
#define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002
|
||||
|
||||
struct urndis_init_req {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_ver_major;
|
||||
uint32_t rm_ver_minor;
|
||||
uint32_t rm_max_xfersz;
|
||||
};
|
||||
|
||||
struct urndis_init_comp {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_status;
|
||||
uint32_t rm_ver_major;
|
||||
uint32_t rm_ver_minor;
|
||||
uint32_t rm_devflags;
|
||||
uint32_t rm_medium;
|
||||
uint32_t rm_pktmaxcnt;
|
||||
uint32_t rm_pktmaxsz;
|
||||
uint32_t rm_align;
|
||||
uint32_t rm_aflistoffset;
|
||||
uint32_t rm_aflistsz;
|
||||
};
|
||||
|
||||
/* Halt the device. No response sent. */
|
||||
#define REMOTE_NDIS_HALT_MSG 0x00000003
|
||||
|
||||
struct urndis_halt_req {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
};
|
||||
|
||||
/* Send a query object. */
|
||||
#define REMOTE_NDIS_QUERY_MSG 0x00000004
|
||||
#define REMOTE_NDIS_QUERY_CMPLT 0x80000004
|
||||
|
||||
struct urndis_query_req {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_oid;
|
||||
uint32_t rm_infobuflen;
|
||||
uint32_t rm_infobufoffset;
|
||||
uint32_t rm_devicevchdl;
|
||||
};
|
||||
|
||||
struct urndis_query_comp {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_status;
|
||||
uint32_t rm_infobuflen;
|
||||
uint32_t rm_infobufoffset;
|
||||
};
|
||||
|
||||
/* Send a set object request. */
|
||||
#define REMOTE_NDIS_SET_MSG 0x00000005
|
||||
#define REMOTE_NDIS_SET_CMPLT 0x80000005
|
||||
|
||||
struct urndis_set_req {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_oid;
|
||||
uint32_t rm_infobuflen;
|
||||
uint32_t rm_infobufoffset;
|
||||
uint32_t rm_devicevchdl;
|
||||
};
|
||||
|
||||
struct urndis_set_comp {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_status;
|
||||
};
|
||||
|
||||
#define REMOTE_NDIS_SET_PARAM_NUMERIC 0x00000000
|
||||
#define REMOTE_NDIS_SET_PARAM_STRING 0x00000002
|
||||
|
||||
struct urndis_set_parameter {
|
||||
uint32_t rm_nameoffset;
|
||||
uint32_t rm_namelen;
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_valueoffset;
|
||||
uint32_t rm_valuelen;
|
||||
};
|
||||
|
||||
/* Perform a soft reset on the device. */
|
||||
#define REMOTE_NDIS_RESET_MSG 0x00000006
|
||||
#define REMOTE_NDIS_RESET_CMPLT 0x80000006
|
||||
|
||||
struct urndis_reset_req {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
};
|
||||
|
||||
struct urndis_reset_comp {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_status;
|
||||
uint32_t rm_adrreset;
|
||||
};
|
||||
|
||||
/* 802.3 link-state or undefined message error. */
|
||||
#define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007
|
||||
|
||||
/* Keepalive messsage. May be sent by device. */
|
||||
#define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008
|
||||
#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008
|
||||
|
||||
struct urndis_keepalive_req {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
};
|
||||
|
||||
struct urndis_keepalive_comp {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_status;
|
||||
};
|
||||
|
||||
/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
|
||||
#define RNDIS_PACKET_TYPE_DIRECTED 0x00000001
|
||||
#define RNDIS_PACKET_TYPE_MULTICAST 0x00000002
|
||||
#define RNDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
|
||||
#define RNDIS_PACKET_TYPE_BROADCAST 0x00000008
|
||||
#define RNDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
|
||||
#define RNDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
|
||||
#define RNDIS_PACKET_TYPE_SMT 0x00000040
|
||||
#define RNDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
|
||||
#define RNDIS_PACKET_TYPE_GROUP 0x00001000
|
||||
#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
|
||||
#define RNDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
|
||||
#define RNDIS_PACKET_TYPE_MAC_FRAME 0x00008000
|
||||
|
||||
/* RNDIS offsets */
|
||||
#define RNDIS_HEADER_OFFSET 8 /* bytes */
|
||||
#define RNDIS_DATA_OFFSET ((uint32_t)(sizeof(struct urndis_packet_msg) - RNDIS_HEADER_OFFSET))
|
||||
|
||||
#endif /* _IF_URNDISREG_H_ */
|
||||
|
265
sys/net/rndis.h
Normal file
265
sys/net/rndis.h
Normal file
@ -0,0 +1,265 @@
|
||||
/* $FreeBSD$ */
|
||||
/* $OpenBSD: if_urndisreg.h,v 1.19 2013/11/21 14:08:05 mpi Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010 Jonathan Armani <armani@openbsd.org>
|
||||
* Copyright (c) 2010 Fabien Romano <fabien@openbsd.org>
|
||||
* Copyright (c) 2010 Michael Knudsen <mk@openbsd.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _NET_RNDIS_H_
|
||||
#define _NET_RNDIS_H_
|
||||
|
||||
#define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005L
|
||||
#define RNDIS_STATUS_FAILURE 0xC0000001L
|
||||
#define RNDIS_STATUS_INVALID_DATA 0xC0010015L
|
||||
#define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BL
|
||||
#define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CL
|
||||
#define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BBL
|
||||
#define RNDIS_STATUS_PENDING STATUS_PENDING /* XXX */
|
||||
#define RNDIS_STATUS_RESOURCES 0xC000009AL
|
||||
#define RNDIS_STATUS_SUCCESS 0x00000000L
|
||||
|
||||
#define OID_GEN_SUPPORTED_LIST 0x00010101
|
||||
#define OID_GEN_HARDWARE_STATUS 0x00010102
|
||||
#define OID_GEN_MEDIA_SUPPORTED 0x00010103
|
||||
#define OID_GEN_MEDIA_IN_USE 0x00010104
|
||||
#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
|
||||
#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
|
||||
#define OID_GEN_LINK_SPEED 0x00010107
|
||||
#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
|
||||
#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
|
||||
#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
|
||||
#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
|
||||
#define OID_GEN_VENDOR_ID 0x0001010C
|
||||
#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D
|
||||
#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
|
||||
#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
|
||||
#define OID_GEN_DRIVER_VERSION 0x00010110
|
||||
#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
|
||||
#define OID_GEN_PROTOCOL_OPTIONS 0x00010112
|
||||
#define OID_GEN_MAC_OPTIONS 0x00010113
|
||||
#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
|
||||
#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
|
||||
#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
|
||||
#define OID_GEN_SUPPORTED_GUIDS 0x00010117
|
||||
#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
|
||||
#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
|
||||
#define OID_GEN_MACHINE_NAME 0x0001021A
|
||||
#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
|
||||
#define OID_GEN_VLAN_ID 0x0001021C
|
||||
|
||||
#define OID_802_3_PERMANENT_ADDRESS 0x01010101
|
||||
#define OID_802_3_CURRENT_ADDRESS 0x01010102
|
||||
#define OID_802_3_MULTICAST_LIST 0x01010103
|
||||
#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
|
||||
#define OID_802_3_MAC_OPTIONS 0x01010105
|
||||
#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
|
||||
#define OID_802_3_XMIT_ONE_COLLISION 0x01020102
|
||||
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
|
||||
#define OID_802_3_XMIT_DEFERRED 0x01020201
|
||||
#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
|
||||
#define OID_802_3_RCV_OVERRUN 0x01020203
|
||||
#define OID_802_3_XMIT_UNDERRUN 0x01020204
|
||||
#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
|
||||
#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
|
||||
#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
|
||||
|
||||
#define RNDIS_MEDIUM_802_3 0x00000000
|
||||
|
||||
/* Device flags */
|
||||
#define RNDIS_DF_CONNECTIONLESS 0x00000001
|
||||
#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002
|
||||
|
||||
/*
|
||||
* RNDIS data message
|
||||
*/
|
||||
#define REMOTE_NDIS_PACKET_MSG 0x00000001
|
||||
|
||||
struct rndis_packet_msg {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_dataoffset;
|
||||
uint32_t rm_datalen;
|
||||
uint32_t rm_oobdataoffset;
|
||||
uint32_t rm_oobdatalen;
|
||||
uint32_t rm_oobdataelements;
|
||||
uint32_t rm_pktinfooffset;
|
||||
uint32_t rm_pktinfolen;
|
||||
uint32_t rm_vchandle;
|
||||
uint32_t rm_reserved;
|
||||
};
|
||||
|
||||
/*
|
||||
* RNDIS control messages
|
||||
*/
|
||||
struct rndis_comp_hdr {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_status;
|
||||
};
|
||||
|
||||
/* Initialize the device. */
|
||||
#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002
|
||||
#define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002
|
||||
|
||||
struct rndis_init_req {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_ver_major;
|
||||
uint32_t rm_ver_minor;
|
||||
uint32_t rm_max_xfersz;
|
||||
};
|
||||
|
||||
struct rndis_init_comp {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_status;
|
||||
uint32_t rm_ver_major;
|
||||
uint32_t rm_ver_minor;
|
||||
uint32_t rm_devflags;
|
||||
uint32_t rm_medium;
|
||||
uint32_t rm_pktmaxcnt;
|
||||
uint32_t rm_pktmaxsz;
|
||||
uint32_t rm_align;
|
||||
uint32_t rm_aflistoffset;
|
||||
uint32_t rm_aflistsz;
|
||||
};
|
||||
|
||||
/* Halt the device. No response sent. */
|
||||
#define REMOTE_NDIS_HALT_MSG 0x00000003
|
||||
|
||||
struct rndis_halt_req {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
};
|
||||
|
||||
/* Send a query object. */
|
||||
#define REMOTE_NDIS_QUERY_MSG 0x00000004
|
||||
#define REMOTE_NDIS_QUERY_CMPLT 0x80000004
|
||||
|
||||
struct rndis_query_req {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_oid;
|
||||
uint32_t rm_infobuflen;
|
||||
uint32_t rm_infobufoffset;
|
||||
uint32_t rm_devicevchdl;
|
||||
};
|
||||
|
||||
struct rndis_query_comp {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_status;
|
||||
uint32_t rm_infobuflen;
|
||||
uint32_t rm_infobufoffset;
|
||||
};
|
||||
|
||||
/* Send a set object request. */
|
||||
#define REMOTE_NDIS_SET_MSG 0x00000005
|
||||
#define REMOTE_NDIS_SET_CMPLT 0x80000005
|
||||
|
||||
struct rndis_set_req {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_oid;
|
||||
uint32_t rm_infobuflen;
|
||||
uint32_t rm_infobufoffset;
|
||||
uint32_t rm_devicevchdl;
|
||||
};
|
||||
|
||||
struct rndis_set_comp {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_status;
|
||||
};
|
||||
|
||||
#define REMOTE_NDIS_SET_PARAM_NUMERIC 0x00000000
|
||||
#define REMOTE_NDIS_SET_PARAM_STRING 0x00000002
|
||||
|
||||
struct rndis_set_parameter {
|
||||
uint32_t rm_nameoffset;
|
||||
uint32_t rm_namelen;
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_valueoffset;
|
||||
uint32_t rm_valuelen;
|
||||
};
|
||||
|
||||
/* Perform a soft reset on the device. */
|
||||
#define REMOTE_NDIS_RESET_MSG 0x00000006
|
||||
#define REMOTE_NDIS_RESET_CMPLT 0x80000006
|
||||
|
||||
struct rndis_reset_req {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
};
|
||||
|
||||
struct rndis_reset_comp {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_status;
|
||||
uint32_t rm_adrreset;
|
||||
};
|
||||
|
||||
/* 802.3 link-state or undefined message error. */
|
||||
#define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007
|
||||
|
||||
/* Keepalive messsage. May be sent by device. */
|
||||
#define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008
|
||||
#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008
|
||||
|
||||
struct rndis_keepalive_req {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
};
|
||||
|
||||
struct rndis_keepalive_comp {
|
||||
uint32_t rm_type;
|
||||
uint32_t rm_len;
|
||||
uint32_t rm_rid;
|
||||
uint32_t rm_status;
|
||||
};
|
||||
|
||||
/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
|
||||
#define RNDIS_PACKET_TYPE_DIRECTED 0x00000001
|
||||
#define RNDIS_PACKET_TYPE_MULTICAST 0x00000002
|
||||
#define RNDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
|
||||
#define RNDIS_PACKET_TYPE_BROADCAST 0x00000008
|
||||
#define RNDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
|
||||
#define RNDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
|
||||
#define RNDIS_PACKET_TYPE_SMT 0x00000040
|
||||
#define RNDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
|
||||
#define RNDIS_PACKET_TYPE_GROUP 0x00001000
|
||||
#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
|
||||
#define RNDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
|
||||
#define RNDIS_PACKET_TYPE_MAC_FRAME 0x00008000
|
||||
|
||||
/* RNDIS offsets */
|
||||
#define RNDIS_HEADER_OFFSET 8 /* bytes */
|
||||
#define RNDIS_DATA_OFFSET \
|
||||
((uint32_t)(sizeof(struct rndis_packet_msg) - RNDIS_HEADER_OFFSET))
|
||||
|
||||
#endif /* !_NET_RNDIS_H_ */
|
Loading…
Reference in New Issue
Block a user