usblib-solaris.h revision c58f1213e628a545081c70e26c6b67a841cff880
/** @file
* USBLib - Library for wrapping up the VBoxUSB functionality, Solaris flavor.
* (DEV,HDrv,Main)
*/
/*
* Copyright (C) 2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef ___VBox_usblib_solaris_h
#define ___VBox_usblib_solaris_h
#include <VBox/usbfilter.h>
/** @defgroup grp_USBLib_solaris Solaris Specifics
* @addtogroup grp_USBLib
* @{ */
/** @name VBoxUSB specific IOCtls.
* VBoxUSB uses them for resetting USB devices requests from userland.
* USBProxyService/Device makes use of them to communicate with VBoxUSB.
* @{ */
/** Ring-3 request wrapper for big requests.
*
* This is necessary because the ioctl number scheme on many Unixy OSes (esp. Solaris)
* only allows a relatively small size to be encoded into the request. So, for big
* request this generic form is used instead. */
typedef struct VBOXUSBREQ
{
/** Magic value (VBOXUSB(MON)_MAGIC). */
/** The size of the data buffer (In & Out). */
/** Result code of the request filled by driver. */
/** The user address of the data buffer. */
} VBOXUSBREQ;
/** Pointer to a request wrapper for solaris. */
typedef VBOXUSBREQ *PVBOXUSBREQ;
/** Pointer to a const request wrapper for solaris. */
typedef const VBOXUSBREQ *PCVBOXUSBREQ;
#pragma pack(1)
typedef struct
{
/* Pointer to the Filter. */
/* Where to store the added Filter (Id). */
typedef struct
{
/* Pointer to Filter (Id) to be removed. */
typedef struct
{
/** Whether to re-attach the driver. */
bool fReattach;
/* Physical path of the USB device. */
char szDevicePath[1];
typedef struct
{
/* Where to store the instance. */
int *pInstance;
/* Physical path of the USB device. */
char szDevicePath[1];
typedef struct
{
/** Where to store the instance. */
int Instance;
/* Where to store the client path. */
char szClientPath[MAXPATHLEN];
/** Device identifier (VendorId:ProductId:Release:StaticPath) */
/** Callback from monitor specifying client consumer (VM) credentials */
DECLR0CALLBACKMEMBER(int, pfnSetConsumerCredentials,(RTPROCESS Process, int Instance, void *pvReserved));
/** Isoc packet descriptor (Must mirror exactly Solaris USBA's usb_isoc_pkt_descr_t) */
typedef struct
{
/** VBoxUSB IOCtls */
typedef struct
{
void *pvUrbR3; /* Pointer to userland URB (untouched by kernel driver) */
bool fShortOk; /* Whether receiving less data than requested is acceptable. */
void *pvData; /* Pointer to the data */
typedef struct
{
typedef struct
{
typedef struct
{
typedef enum
{
typedef struct
{
typedef struct
{
typedef struct
{
#pragma pack()
/** The VBOXUSBREQ::u32Magic value for VBoxUSBMon. */
#define VBOXUSBMON_MAGIC 0xba5eba11
/** The VBOXUSBREQ::u32Magic value for VBoxUSB.*/
#define VBOXUSB_MAGIC 0x601fba11
/** The USBLib entry point for userland. */
#define VBOXUSB_DEVICE_NAME "/dev/vboxusbmon"
/** The USBMonitor Major version. */
#define VBOXUSBMON_VERSION_MAJOR 2
/** The USBMonitor Minor version. */
#define VBOXUSBMON_VERSION_MINOR 1
/** The USB Major version. */
#define VBOXUSB_VERSION_MAJOR 1
/** The USB Minor version. */
#define VBOXUSB_VERSION_MINOR 1
#ifdef RT_ARCH_AMD64
# define VBOXUSB_IOCTL_FLAG 128
#elif defined(RT_ARCH_X86)
# define VBOXUSB_IOCTL_FLAG 0
#else
# error "dunno which arch this is!"
#endif
/** USB driver name*/
#define VBOXUSB_DRIVER_NAME "vboxusb"
/* No automatic buffering, size limited to 255 bytes => use VBOXUSBREQ for everything. */
#define VBOXUSB_IOCTL_CODE(Function, Size) _IOWRN('V', (Function) | VBOXUSB_IOCTL_FLAG, sizeof(VBOXUSBREQ))
#define VBOXUSBMON_IOCTL_DEVICE_INSTANCE VBOXUSB_IOCTL_CODE(4, (sizeof(VBOXUSBREQ_DEVICE_INSTANCE)))
/* VBoxUSB ioctls */
#define VBOXUSB_IOCTL_CLEAR_EP VBOXUSB_IOCTL_CODE(22, (sizeof(VBOXUSBREQ_CLEAR_EP))) /* 1072146794 */
#define VBOXUSB_IOCTL_SET_CONFIG VBOXUSB_IOCTL_CODE(23, (sizeof(VBOXUSBREQ_SET_CONFIG))) /* 1072146793 */
#define VBOXUSB_IOCTL_SET_INTERFACE VBOXUSB_IOCTL_CODE(24, (sizeof(VBOXUSBREQ_SET_INTERFACE))) /* 1072146792 */
#define VBOXUSB_IOCTL_CLOSE_DEVICE VBOXUSB_IOCTL_CODE(25, (sizeof(VBOXUSBREQ_CLOSE_DEVICE))) /* 1072146791 0xc0185699 */
#define VBOXUSB_IOCTL_ABORT_PIPE VBOXUSB_IOCTL_CODE(26, (sizeof(VBOXUSBREQ_ABORT_PIPE))) /* 1072146790 */
#define VBOXUSB_IOCTL_GET_CONFIG VBOXUSB_IOCTL_CODE(27, (sizeof(VBOXUSBREQ_GET_CONFIG))) /* 1072146789 */
#define VBOXUSB_IOCTL_GET_VERSION VBOXUSB_IOCTL_CODE(28, (sizeof(VBOXUSBREQ_GET_VERSION))) /* 1072146788 */
/** @} */
/* USBLibHelper data for resetting the device. */
typedef struct VBOXUSBHELPERDATA_RESET
{
/** Path of the USB device. */
const char *pszDevicePath;
/** Re-enumerate or not. */
bool fHardReset;
typedef const VBOXUSBHELPERDATA_RESET *PCVBOXUSBHELPERDATA_RESET;
/* USBLibHelper data for device hijacking. */
typedef struct VBOXUSBHELPERDATA_ALIAS
{
/** Vendor ID. */
/** Product ID. */
/** Revision, integer part. */
/** Path of the USB device. */
const char *pszDevicePath;
typedef const VBOXUSBHELPERDATA_ALIAS *PCVBOXUSBHELPERDATA_ALIAS;
/*USBLIB_DECL(int) USBLibConfigureDevice(PUSBDEVICE pDevice);*/
/** @} */
#endif