static void usbredir_handle_bulk_data(USBRedirDevice *dev, USBPacket *p,

                                      uint8_t ep)

{

    struct usb_redir_bulk_packet_header bulk_packet;

    size_t size = (p->combined) ? p->combined->iov.size : p->iov.size;



    DPRINTF("bulk-out ep %02X len %zd id %"PRIu64"\n", ep, size, p->id);



    if (usbredir_already_in_flight(dev, p->id)) {

        p->status = USB_RET_ASYNC;

        return;

    }



    bulk_packet.endpoint  = ep;

    bulk_packet.length    = size;

    bulk_packet.stream_id = 0;

    bulk_packet.length_high = size >> 16;

    assert(bulk_packet.length_high == 0 ||

           usbredirparser_peer_has_cap(dev->parser,

                                       usb_redir_cap_32bits_bulk_length));



    if (ep & USB_DIR_IN) {

        usbredirparser_send_bulk_packet(dev->parser, p->id,

                                        &bulk_packet, NULL, 0);

    } else {

        uint8_t buf[size];

        if (p->combined) {

            iov_to_buf(p->combined->iov.iov, p->combined->iov.niov,

                       0, buf, size);

        } else {

            usb_packet_copy(p, buf, size);

        }

        usbredir_log_data(dev, "bulk data out:", buf, size);

        usbredirparser_send_bulk_packet(dev->parser, p->id,

                                        &bulk_packet, buf, size);

    }

    usbredirparser_do_write(dev->parser);

    p->status = USB_RET_ASYNC;

}

static void usbredir_handle_bulk_data(USBRedirDevice *dev, USBPacket *p,

                                      uint8_t ep)

{

    struct usb_redir_bulk_packet_header bulk_packet;

    size_t size = (p->combined) ? p->combined->iov.size : p->iov.size;



    DPRINTF("bulk-out ep %02X len %zd id %"PRIu64"\n", ep, size, p->id);



    if (usbredir_already_in_flight(dev, p->id)) {

        p->status = USB_RET_ASYNC;

        return;

    }



    bulk_packet.endpoint  = ep;

    bulk_packet.length    = size;

    bulk_packet.stream_id = 0;

    bulk_packet.length_high = size >> 16;

    assert(bulk_packet.length_high == 0 ||

           usbredirparser_peer_has_cap(dev->parser,

                                       usb_redir_cap_32bits_bulk_length));



    if (ep & USB_DIR_IN) {

        usbredirparser_send_bulk_packet(dev->parser, p->id,

                                        &bulk_packet, NULL, 0);

    } else {

        uint8_t buf[size];

        if (p->combined) {

            iov_to_buf(p->combined->iov.iov, p->combined->iov.niov,

                       0, buf, size);

        } else {

            usb_packet_copy(p, buf, size);

        }

        usbredir_log_data(dev, "bulk data out:", buf, size);

        usbredirparser_send_bulk_packet(dev->parser, p->id,

                                        &bulk_packet, buf, size);

    }

    usbredirparser_do_write(dev->parser);

    p->status = USB_RET_ASYNC;

}

    DPRINTF("bulk-out ep %02X len %zd id %"PRIu64"\n", ep, size, p->id);
static void FUNC_0(USBRedirDevice *VAR_0, USBPacket *VAR_1,

                                      uint8_t VAR_2)

{

    struct usb_redir_bulk_packet_header VAR_3;

    size_t size = (VAR_1->combined) ? VAR_1->combined->iov.size : VAR_1->iov.size;



    DPRINTF("bulk-out VAR_2 %02X len %zd id %"PRIu64"\n", VAR_2, size, VAR_1->id);



    if (usbredir_already_in_flight(VAR_0, VAR_1->id)) {

        VAR_1->status = USB_RET_ASYNC;

        return;

    }



    VAR_3.endpoint  = VAR_2;

    VAR_3.length    = size;

    VAR_3.stream_id = 0;

    VAR_3.length_high = size >> 16;

    assert(VAR_3.length_high == 0 ||

           usbredirparser_peer_has_cap(VAR_0->parser,

                                       usb_redir_cap_32bits_bulk_length));



    if (VAR_2 & USB_DIR_IN) {

        usbredirparser_send_bulk_packet(VAR_0->parser, VAR_1->id,

                                        &VAR_3, NULL, 0);

    } else {

        uint8_t buf[size];

        if (VAR_1->combined) {

            iov_to_buf(VAR_1->combined->iov.iov, VAR_1->combined->iov.niov,

                       0, buf, size);

        } else {

            usb_packet_copy(VAR_1, buf, size);

        }

        usbredir_log_data(VAR_0, "bulk data out:", buf, size);

        usbredirparser_send_bulk_packet(VAR_0->parser, VAR_1->id,

                                        &VAR_3, buf, size);

    }

    usbredirparser_do_write(VAR_0->parser);

    VAR_1->status = USB_RET_ASYNC;

}

static void FUNC_0(USBRedirDevice *VAR_0, USBPacket *VAR_1,
uint8_t VAR_2)
{ struct usb_redir_bulk_packet_header VAR_3; size_t size = (VAR_1->combined) ? VAR_1->combined->iov.size : VAR_1->iov.size; DPRINTF("bulk-out VAR_2 %02X len %zd id %"PRIu64"\n", VAR_2, size, VAR_1->id); if (usbredir_already_in_flight(VAR_0, VAR_1->id)) { VAR_1->status = USB_RET_ASYNC; return; } VAR_3.endpoint  = VAR_2; VAR_3.length    = size; VAR_3.stream_id = 0; VAR_3.length_high = size >> 16; assert(VAR_3.length_high == 0 ||
usbredirparser_peer_has_cap(VAR_0->parser,
usb_redir_cap_32bits_bulk_length)); if (VAR_2 & USB_DIR_IN) { usbredirparser_send_bulk_packet(VAR_0->parser, VAR_1->id,
&VAR_3, NULL, 0); } else { uint8_t buf[size]; if (VAR_1->combined) { iov_to_buf(VAR_1->combined->iov.iov, VAR_1->combined->iov.niov,
0, buf, size); } else { usb_packet_copy(VAR_1, buf, size); } usbredir_log_data(VAR_0, "bulk data out:", buf, size); usbredirparser_send_bulk_packet(VAR_0->parser, VAR_1->id,
&VAR_3, buf, size); } usbredirparser_do_write(VAR_0->parser); VAR_1->status = USB_RET_ASYNC; }