FreeRDP
data_transfer.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "urbdrc_types.h"
#include "data_transfer.h"

Functions

static void usb_process_get_port_status (IUDEVICE *pdev, BYTE *OutputBuffer)
 
static int func_check_isochronous_fds (IUDEVICE *pdev)
 
static int urbdrc_process_register_request_callback (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, IUDEVMAN *udevman, UINT32 UsbDevice)
 
static int urbdrc_process_cancel_request (BYTE *data, UINT32 data_sizem, IUDEVMAN *udevman, UINT32 UsbDevice)
 
static int urbdrc_process_retract_device_request (BYTE *data, UINT32 data_sizem, IUDEVMAN *udevman, UINT32 UsbDevice)
 
static int urbdrc_process_io_control (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice)
 
static int urbdrc_process_internal_io_control (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice)
 
static int urbdrc_process_query_device_text (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice)
 
static void func_select_all_interface_for_msconfig (IUDEVICE *pdev, MSUSB_CONFIG_DESCRIPTOR *MsConfig)
 
static int urb_select_configuration (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, int transferDir)
 
static int urb_select_interface (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, int transferDir)
 
static int urb_control_transfer (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, int transferDir, int External)
 
static int urb_bulk_or_interrupt_transfer (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, int transferDir)
 
static int urb_isoch_transfer (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, int transferDir)
 
static int urb_control_descriptor_request (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, BYTE func_recipient, int transferDir)
 
static int urb_control_get_status_request (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, BYTE func_recipient, int transferDir)
 
static int urb_control_vendor_or_class_request (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, BYTE func_type, BYTE func_recipient, int transferDir)
 
static int urb_os_feature_descriptor_request (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, int transferDir)
 
static int urb_pipe_request (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, int transferDir, int action)
 
static int urb_get_current_frame_number (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, int transferDir)
 
static int urb_control_get_configuration_request (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, int transferDir)
 
static int urb_control_get_interface_request (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, int transferDir)
 
static int urb_control_feature_request (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, BYTE func_recipient, BYTE command, int transferDir)
 
static int urbdrc_process_transfer_request (URBDRC_CHANNEL_CALLBACK *callback, BYTE *data, UINT32 data_sizem, UINT32 MessageId, IUDEVMAN *udevman, UINT32 UsbDevice, int transferDir)
 
voidurbdrc_process_udev_data_transfer (void *arg)
 

Function Documentation

static int func_check_isochronous_fds ( IUDEVICE *  pdev)
static

Here is the caller graph for this function:

static void func_select_all_interface_for_msconfig ( IUDEVICE *  pdev,
MSUSB_CONFIG_DESCRIPTOR *  MsConfig 
)
static

Here is the caller graph for this function:

static int urb_bulk_or_interrupt_transfer ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
int  transferDir 
)
static

TransferFlags

process URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER

send data

interface

message id

function id

RequestId

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

Padding, MUST be ignored upon receipt

UsbdStatus

HResult

OutputBufferSize

Here is the caller graph for this function:

static int urb_control_descriptor_request ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
BYTE  func_recipient,
int  transferDir 
)
static

process get usb device descriptor

interface

message id

function id

RequestId

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

Padding, MUST be ignored upon receipt

UsbdStatus

HResult

OutputBufferSize

Here is the call graph for this function:

Here is the caller graph for this function:

static int urb_control_feature_request ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
BYTE  func_recipient,
BYTE  command,
int  transferDir 
)
static

interface

message id

RequestId

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

Padding, MUST be ignored upon receipt

UsbdStatus

HResult

OutputBufferSize

Here is the call graph for this function:

Here is the caller graph for this function:

static int urb_control_get_configuration_request ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
int  transferDir 
)
static

interface

message id

RequestId

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

Padding, MUST be ignored upon receipt

UsbdStatus

HResult

OutputBufferSize

Here is the caller graph for this function:

static int urb_control_get_interface_request ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
int  transferDir 
)
static

interface

message id

RequestId

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

Padding, MUST be ignored upon receipt

UsbdStatus

HResult

OutputBufferSize

Here is the caller graph for this function:

static int urb_control_get_status_request ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
BYTE  func_recipient,
int  transferDir 
)
static

Index

send data

interface

message id

function id

RequestId, include NoAck

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

Padding, MUST be ignored upon receipt

UsbdStatus

HResult

OutputBufferSize

Here is the caller graph for this function:

static int urb_control_transfer ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
int  transferDir,
int  External 
)
static

TransferFlags

TransferFlags

SetupPacket 8 bytes

Get Buffer Data

process URB_FUNCTION_CONTROL_TRANSFER

send data

interface

message id

function id

RequestId

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

Padding, MUST be ignored upon receipt

UsbdStatus

HResult

OutputBufferSize

Here is the call graph for this function:

Here is the caller graph for this function:

static int urb_control_vendor_or_class_request ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
BYTE  func_type,
BYTE  func_recipient,
int  transferDir 
)
static

control by vendor command

TransferFlags

ReqTypeReservedBids

Request

value

index

Padding

Get Buffer

vendor or class command

send data

interface

message id

function id

RequestId, include NoAck

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

Padding, MUST be ignored upon receipt

UsbdStatus

HResult

OutputBufferSize

Here is the call graph for this function:

Here is the caller graph for this function:

static int urb_get_current_frame_number ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
int  transferDir 
)
static

Fixme: Need to fill actual frame number!!

interface

message id

RequestId

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

Padding, MUST be ignored upon receipt

UsbdStatus

FrameNumber

HResult

OutputBufferSize

Here is the caller graph for this function:

static int urb_isoch_transfer ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
int  transferDir 
)
static

TransferFlags

StartFrame

NumberOfPackets

ErrorCount

send data memory alloc

Get Buffer Data

interface

message id

function id

RequestId

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

Padding, MUST be ignored upon receipt

UsbdStatus

StartFrame

NumberOfPackets

ErrorCount

NumberOfPackets

ErrorCount

HResult

OutputBufferSize

Here is the caller graph for this function:

static int urb_os_feature_descriptor_request ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
int  transferDir 
)
static

Recipient

InterfaceNumber

Ms_PageIndex

Ms_featureDescIndex

get ms string

send data

interface

message id

function id

RequestId

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

Padding, MUST be ignored upon receipt

UsbdStatus

HResult

OutputBufferSize

Here is the call graph for this function:

Here is the caller graph for this function:

static int urb_pipe_request ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
int  transferDir,
int  action 
)
static

PipeHandle

send data

interface

message id

RequestId

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

Padding, MUST be ignored upon receipt

UsbdStatus

HResult

OutputBufferSize

Here is the caller graph for this function:

static int urb_select_configuration ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
int  transferDir 
)
static

if ConfigurationDescriptorIsValid is zero, then just do nothing.

interface

message id

function id

RequestId

CbTsUrbResult

TS_URB_RESULT_HEADER Size

Padding, MUST be ignored upon receipt

UsbdStatus

TS_URB_SELECT_CONFIGURATION_RESULT

ConfigurationHandle

NumInterfaces

HResult

OutputBufferSize

Here is the call graph for this function:

Here is the caller graph for this function:

static int urb_select_interface ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
int  transferDir 
)
static

interface

message id

function id

RequestId

CbTsUrbResult

TS_URB_RESULT_HEADER

Size

Padding, MUST be ignored upon receipt

UsbdStatus

TS_URB_SELECT_INTERFACE_RESULT

HResult

OutputBufferSize

Here is the call graph for this function:

Here is the caller graph for this function:

static int urbdrc_process_cancel_request ( BYTE data,
UINT32  data_sizem,
IUDEVMAN *  udevman,
UINT32  UsbDevice 
)
static

RequestId

Here is the caller graph for this function:

static int urbdrc_process_internal_io_control ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice 
)
static

Fixme: Currently this is a FALSE bustime...

interface

message id

function id

RequestId

HResult

Information

OutputBufferSize

OutputBuffer

Here is the caller graph for this function:

static int urbdrc_process_io_control ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice 
)
static

process

0x00220003

0x00220007

0x00220013

0x0022001F

0x00220027

interface

message id

function id

RequestId

HResult

Information

OutputBufferSize

OutputBuffer

Here is the call graph for this function:

Here is the caller graph for this function:

static int urbdrc_process_query_device_text ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice 
)
static

interface

message id

cchDeviceDescription

cchDeviceDescription

HResult

Here is the call graph for this function:

Here is the caller graph for this function:

static int urbdrc_process_register_request_callback ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
IUDEVMAN *  udevman,
UINT32  UsbDevice 
)
static

must be 1

RequestCompletion: unique Request Completion interface for the client to use

Unregister the device

The wrong driver may also receive this message, So we need some time(default 3s) to check the driver or delete it

Here is the caller graph for this function:

static int urbdrc_process_retract_device_request ( BYTE data,
UINT32  data_sizem,
IUDEVMAN *  udevman,
UINT32  UsbDevice 
)
static

Reason

Here is the caller graph for this function:

static int urbdrc_process_transfer_request ( URBDRC_CHANNEL_CALLBACK *  callback,
BYTE data,
UINT32  data_sizem,
UINT32  MessageId,
IUDEVMAN *  udevman,
UINT32  UsbDevice,
int  transferDir 
)
static

CbTsUrb

size

0x0000

0x0001

0x0002

0x0003

This URB function is obsolete in Windows 2000 and later operating systems and is not supported by Microsoft.

0x0004

This URB function is obsolete in Windows 2000 and later operating systems and is not supported by Microsoft.

0x0005

This URB function is obsolete in Windows 2000 and later operating systems and is not supported by Microsoft.

0x0006

This URB function is obsolete in Windows 2000 and later operating systems and is not supported by Microsoft.

0x0007

0x0008

0x0009

0x000A

0x000B

0x000C

0x000D

0x000E

0x000F

0x0010

0x0011

0x0012

0x0013

0x0014

0x0015

0x0016

0x0017

0x0018

0x0019

0x001A

0x001B

0x001C

0x001D

0x001E

0x001F

0x0020

0x0021

0x0022

0x0023

0x0024

0x0025

0x0026

0x0027

0x0028

0x0029

0x002A

0x002B

0x002C

0x002D

0x002E

0x002F

USB 2.0 calls start at 0x0030

0x0030

function not support

0x0031

0x0032

Here is the call graph for this function:

Here is the caller graph for this function:

void* urbdrc_process_udev_data_transfer ( void arg)

Here is the call graph for this function:

Here is the caller graph for this function:

static void usb_process_get_port_status ( IUDEVICE *  pdev,
BYTE OutputBuffer 
)
static

FreeRDP: A Remote Desktop Protocol Implementation RemoteFX USB Redirection

Copyright 2012 Atrust corp. Copyright 2012 Alfred Liu alfre.nosp@m.d.li.nosp@m.u@atr.nosp@m.usco.nosp@m.rp.co.nosp@m.m

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Here is the caller graph for this function: