FreeRDP
data_transfer.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/sysinfo.h>
#include <urbdrc_helpers.h>
#include "urbdrc_types.h"
#include "data_transfer.h"

Functions

static void usb_process_get_port_status (IUDEVICE *pdev, wStream *out)
 
static UINT urb_write_completion (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, BOOL noAck, wStream *out, UINT32 InterfaceId, UINT32 MessageId, UINT32 RequestId, UINT32 usbd_status, UINT32 OutputBufferSize)
 
static wStreamurb_create_iocompletion (UINT32 InterfaceField, UINT32 MessageId, UINT32 RequestId, UINT32 OutputBufferSize)
 
static UINT urbdrc_process_register_request_callback (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, IUDEVMAN *udevman)
 
static UINT urbdrc_process_cancel_request (IUDEVICE *pdev, wStream *s, IUDEVMAN *udevman)
 
static UINT urbdrc_process_retract_device_request (IUDEVICE *pdev, wStream *s, IUDEVMAN *udevman)
 
static UINT urbdrc_process_io_control (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 MessageId, IUDEVMAN *udevman)
 
static UINT urbdrc_process_internal_io_control (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 MessageId, IUDEVMAN *udevman)
 
static UINT urbdrc_process_query_device_text (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 MessageId, IUDEVMAN *udevman)
 
static void func_select_all_interface_for_msconfig (IUDEVICE *pdev, MSUSB_CONFIG_DESCRIPTOR *MsConfig)
 
static UINT urb_select_configuration (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, int transferDir)
 
static UINT urb_select_interface (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, int transferDir)
 
static UINT urb_control_transfer (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, int transferDir, int External)
 
static void urb_bulk_transfer_cb (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *out, UINT32 InterfaceId, BOOL noAck, UINT32 MessageId, UINT32 RequestId, UINT32 NumberOfPackets, UINT32 status, UINT32 StartFrame, UINT32 ErrorCount, UINT32 OutputBufferSize)
 
static UINT urb_bulk_or_interrupt_transfer (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, int transferDir)
 
static void urb_isoch_transfer_cb (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *out, UINT32 InterfaceId, BOOL noAck, UINT32 MessageId, UINT32 RequestId, UINT32 NumberOfPackets, UINT32 status, UINT32 StartFrame, UINT32 ErrorCount, UINT32 OutputBufferSize)
 
static UINT urb_isoch_transfer (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, int transferDir)
 
static UINT urb_control_descriptor_request (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, BYTE func_recipient, int transferDir)
 
static UINT urb_control_get_status_request (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, BYTE func_recipient, int transferDir)
 
static UINT urb_control_vendor_or_class_request (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, BYTE func_type, BYTE func_recipient, int transferDir)
 
static UINT urb_os_feature_descriptor_request (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, int transferDir)
 
static UINT urb_pipe_request (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, int transferDir, int action)
 
static UINT urb_get_current_frame_number (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, int transferDir)
 
static UINT urb_control_get_configuration_request (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, int transferDir)
 
static UINT urb_control_get_interface_request (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, int transferDir)
 
static UINT urb_control_feature_request (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 RequestField, UINT32 MessageId, IUDEVMAN *udevman, BYTE func_recipient, BYTE command, int transferDir)
 
static UINT urbdrc_process_transfer_request (IUDEVICE *pdev, GENERIC_CHANNEL_CALLBACK *callback, wStream *s, UINT32 MessageId, IUDEVMAN *udevman, int transferDir)
 
UINT urbdrc_process_udev_data_transfer (GENERIC_CHANNEL_CALLBACK *callback, URBDRC_PLUGIN *urbdrc, IUDEVMAN *udevman, wStream *data)
 

Function Documentation

◆ func_select_all_interface_for_msconfig()

static void func_select_all_interface_for_msconfig ( IUDEVICE *  pdev,
MSUSB_CONFIG_DESCRIPTOR MsConfig 
)
static
Here is the caller graph for this function:

◆ urb_bulk_or_interrupt_transfer()

static UINT urb_bulk_or_interrupt_transfer ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
int  transferDir 
)
static

TransferFlags

process TS_URB_BULK_OR_INTERRUPT_TRANSFER

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_bulk_transfer_cb()

static void urb_bulk_transfer_cb ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream out,
UINT32  InterfaceId,
BOOL  noAck,
UINT32  MessageId,
UINT32  RequestId,
UINT32  NumberOfPackets,
UINT32  status,
UINT32  StartFrame,
UINT32  ErrorCount,
UINT32  OutputBufferSize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_control_descriptor_request()

static UINT urb_control_descriptor_request ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
BYTE  func_recipient,
int  transferDir 
)
static

process get usb device descriptor

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_control_feature_request()

static UINT urb_control_feature_request ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
BYTE  func_recipient,
BYTE  command,
int  transferDir 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_control_get_configuration_request()

static UINT urb_control_get_configuration_request ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
int  transferDir 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_control_get_interface_request()

static UINT urb_control_get_interface_request ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
int  transferDir 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_control_get_status_request()

static UINT urb_control_get_status_request ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
BYTE  func_recipient,
int  transferDir 
)
static

Index

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_control_transfer()

static UINT urb_control_transfer ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
int  transferDir,
int  External 
)
static

TransferFlags

TransferFlags

SetupPacket 8 bytes

Get Buffer Data

process TS_URB_CONTROL_TRANSFER

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_control_vendor_or_class_request()

static UINT urb_control_vendor_or_class_request ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
BYTE  func_type,
BYTE  func_recipient,
int  transferDir 
)
static

TransferFlags

ReqTypeReservedBids

Request

value

index

Padding

Get Buffer

vendor or class command

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_create_iocompletion()

static wStream* urb_create_iocompletion ( UINT32  InterfaceField,
UINT32  MessageId,
UINT32  RequestId,
UINT32  OutputBufferSize 
)
static

interface

message id

function id

RequestId

HResult

Information

OutputBufferSize

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_get_current_frame_number()

static UINT urb_get_current_frame_number ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
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 call graph for this function:
Here is the caller graph for this function:

◆ urb_isoch_transfer()

static UINT urb_isoch_transfer ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
int  transferDir 
)
static

TransferFlags

StartFrame

NumberOfPackets

ErrorCount

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_isoch_transfer_cb()

static void urb_isoch_transfer_cb ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream out,
UINT32  InterfaceId,
BOOL  noAck,
UINT32  MessageId,
UINT32  RequestId,
UINT32  NumberOfPackets,
UINT32  status,
UINT32  StartFrame,
UINT32  ErrorCount,
UINT32  OutputBufferSize 
)
static

interface

message id

function id

function id

RequestId

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

UsbdStatus

StartFrame

NumberOfPackets

ErrorCount

NumberOfPackets

ErrorCount

HResult

OutputBufferSize

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_os_feature_descriptor_request()

static UINT urb_os_feature_descriptor_request ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
int  transferDir 
)
static

Recipient

InterfaceNumber

Ms_PageIndex

Ms_featureDescIndex

get ms string

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_pipe_request()

static UINT urb_pipe_request ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
int  transferDir,
int  action 
)
static

PipeHandle

send data

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urb_select_configuration()

static UINT urb_select_configuration ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
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:

◆ urb_select_interface()

static UINT urb_select_interface ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  RequestField,
UINT32  MessageId,
IUDEVMAN *  udevman,
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:

◆ urb_write_completion()

static UINT urb_write_completion ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
BOOL  noAck,
wStream out,
UINT32  InterfaceId,
UINT32  MessageId,
UINT32  RequestId,
UINT32  usbd_status,
UINT32  OutputBufferSize 
)
static

interface

message id

RequestId

CbTsUrbResult

TsUrbResult TS_URB_RESULT_HEADER

Size

UsbdStatus

HResult

OutputBufferSize

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urbdrc_process_cancel_request()

static UINT urbdrc_process_cancel_request ( IUDEVICE *  pdev,
wStream s,
IUDEVMAN *  udevman 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ urbdrc_process_internal_io_control()

static UINT urbdrc_process_internal_io_control ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  MessageId,
IUDEVMAN *  udevman 
)
static

Fixme: Currently this is a FALSE bustime...

OutputBuffer

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urbdrc_process_io_control()

static UINT urbdrc_process_io_control ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  MessageId,
IUDEVMAN *  udevman 
)
static

0x00220003

0x00220007

0x00220013

0x0022001F

0x00220027

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urbdrc_process_query_device_text()

static UINT urbdrc_process_query_device_text ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  MessageId,
IUDEVMAN *  udevman 
)
static

interface

message id

cchDeviceDescription in WCHAR

HResult

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urbdrc_process_register_request_callback()

static UINT urbdrc_process_register_request_callback ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
IUDEVMAN *  udevman 
)
static

must be 1

RequestCompletion: unique Request Completion interface for the client to use

Unregister the device

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urbdrc_process_retract_device_request()

static UINT urbdrc_process_retract_device_request ( IUDEVICE *  pdev,
wStream s,
IUDEVMAN *  udevman 
)
static

Reason

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urbdrc_process_transfer_request()

static UINT urbdrc_process_transfer_request ( IUDEVICE *  pdev,
GENERIC_CHANNEL_CALLBACK callback,
wStream s,
UINT32  MessageId,
IUDEVMAN *  udevman,
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

0x0031

0x0032

Here is the call graph for this function:
Here is the caller graph for this function:

◆ urbdrc_process_udev_data_transfer()

UINT urbdrc_process_udev_data_transfer ( GENERIC_CHANNEL_CALLBACK callback,
URBDRC_PLUGIN urbdrc,
IUDEVMAN *  udevman,
wStream data 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ usb_process_get_port_status()

static void usb_process_get_port_status ( IUDEVICE *  pdev,
wStream out 
)
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 call graph for this function:
Here is the caller graph for this function: