static void bufp_alloc(USBRedirDevice *dev, uint8_t *data, uint16_t len,

    uint8_t status, uint8_t ep, void *free_on_destroy)

{

    struct buf_packet *bufp;



    if (!dev->endpoint[EP2I(ep)].bufpq_dropping_packets &&

        dev->endpoint[EP2I(ep)].bufpq_size >

            2 * dev->endpoint[EP2I(ep)].bufpq_target_size) {

        DPRINTF("bufpq overflow, dropping packets ep %02X\n", ep);

        dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 1;

    }

    /* Since we're interupting the stream anyways, drop enough packets to get

       back to our target buffer size */

    if (dev->endpoint[EP2I(ep)].bufpq_dropping_packets) {

        if (dev->endpoint[EP2I(ep)].bufpq_size >

                dev->endpoint[EP2I(ep)].bufpq_target_size) {

            free(data);

            return;

        }

        dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 0;

    }



    bufp = g_new(struct buf_packet, 1);

    bufp->data   = data;

    bufp->len    = len;

    bufp->offset = 0;

    bufp->status = status;

    bufp->free_on_destroy = free_on_destroy;

    QTAILQ_INSERT_TAIL(&dev->endpoint[EP2I(ep)].bufpq, bufp, next);

    dev->endpoint[EP2I(ep)].bufpq_size++;

}

static void bufp_alloc(USBRedirDevice *dev, uint8_t *data, uint16_t len,

    uint8_t status, uint8_t ep, void *free_on_destroy)

{

    struct buf_packet *bufp;



    if (!dev->endpoint[EP2I(ep)].bufpq_dropping_packets &&

        dev->endpoint[EP2I(ep)].bufpq_size >

            2 * dev->endpoint[EP2I(ep)].bufpq_target_size) {

        DPRINTF("bufpq overflow, dropping packets ep %02X\n", ep);

        dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 1;

    }

    



    if (dev->endpoint[EP2I(ep)].bufpq_dropping_packets) {

        if (dev->endpoint[EP2I(ep)].bufpq_size >

                dev->endpoint[EP2I(ep)].bufpq_target_size) {

            free(data);

            return;

        }

        dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 0;

    }



    bufp = g_new(struct buf_packet, 1);

    bufp->data   = data;

    bufp->len    = len;

    bufp->offset = 0;

    bufp->status = status;

    bufp->free_on_destroy = free_on_destroy;

    QTAILQ_INSERT_TAIL(&dev->endpoint[EP2I(ep)].bufpq, bufp, next);

    dev->endpoint[EP2I(ep)].bufpq_size++;

}

static void bufp_alloc(USBRedirDevice *dev, uint8_t *data, uint16_t len,
static void FUNC_0(USBRedirDevice *VAR_0, uint8_t *VAR_1, uint16_t VAR_2,

    uint8_t VAR_3, uint8_t VAR_4, void *VAR_5)

{

    struct buf_packet *VAR_6;



    if (!VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets &&

        VAR_0->endpoint[EP2I(VAR_4)].bufpq_size >

            2 * VAR_0->endpoint[EP2I(VAR_4)].bufpq_target_size) {

        DPRINTF("bufpq overflow, dropping packets VAR_4 %02X\n", VAR_4);

        VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets = 1;

    }

    



    if (VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets) {

        if (VAR_0->endpoint[EP2I(VAR_4)].bufpq_size >

                VAR_0->endpoint[EP2I(VAR_4)].bufpq_target_size) {

            free(VAR_1);

            return;

        }

        VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets = 0;

    }



    VAR_6 = g_new(struct buf_packet, 1);

    VAR_6->VAR_1   = VAR_1;

    VAR_6->VAR_2    = VAR_2;

    VAR_6->offset = 0;

    VAR_6->VAR_3 = VAR_3;

    VAR_6->VAR_5 = VAR_5;

    QTAILQ_INSERT_TAIL(&VAR_0->endpoint[EP2I(VAR_4)].bufpq, VAR_6, next);

    VAR_0->endpoint[EP2I(VAR_4)].bufpq_size++;

}

static void FUNC_0(USBRedirDevice *VAR_0, uint8_t *VAR_1, uint16_t VAR_2,
uint8_t VAR_3, uint8_t VAR_4, void *VAR_5)
{ struct buf_packet *VAR_6; if (!VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets &&
VAR_0->endpoint[EP2I(VAR_4)].bufpq_size >
2 * VAR_0->endpoint[EP2I(VAR_4)].bufpq_target_size) { DPRINTF("bufpq overflow, dropping packets VAR_4 %02X\n", VAR_4); VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets = 1; } if (VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets) { if (VAR_0->endpoint[EP2I(VAR_4)].bufpq_size >
VAR_0->endpoint[EP2I(VAR_4)].bufpq_target_size) { free(VAR_1); return; } VAR_0->endpoint[EP2I(VAR_4)].bufpq_dropping_packets = 0; } VAR_6 = g_new(struct buf_packet, 1); VAR_6->VAR_1   = VAR_1; VAR_6->VAR_2    = VAR_2; VAR_6->offset = 0; VAR_6->VAR_3 = VAR_3; VAR_6->VAR_5 = VAR_5; QTAILQ_INSERT_TAIL(&VAR_0->endpoint[EP2I(VAR_4)].bufpq, VAR_6, next); VAR_0->endpoint[EP2I(VAR_4)].bufpq_size++; }