static void qemu_net_queue_append_iov(NetQueue *queue,

                                      NetClientState *sender,

                                      unsigned flags,

                                      const struct iovec *iov,

                                      int iovcnt,

                                      NetPacketSent *sent_cb)

{

    NetPacket *packet;

    size_t max_len = 0;

    int i;



    if (queue->nq_count >= queue->nq_maxlen && !sent_cb) {

        return; /* drop if queue full and no callback */

    }

    for (i = 0; i < iovcnt; i++) {

        max_len += iov[i].iov_len;

    }



    packet = g_malloc(sizeof(NetPacket) + max_len);

    packet->sender = sender;

    packet->sent_cb = sent_cb;

    packet->flags = flags;

    packet->size = 0;



    for (i = 0; i < iovcnt; i++) {

        size_t len = iov[i].iov_len;



        memcpy(packet->data + packet->size, iov[i].iov_base, len);

        packet->size += len;

    }




    QTAILQ_INSERT_TAIL(&queue->packets, packet, entry);

}
static void qemu_net_queue_append_iov(NetQueue *queue,

                                      NetClientState *sender,

                                      unsigned flags,

                                      const struct iovec *iov,

                                      int iovcnt,

                                      NetPacketSent *sent_cb)

{

    NetPacket *packet;

    size_t max_len = 0;

    int i;



    if (queue->nq_count >= queue->nq_maxlen && !sent_cb) {

        return; 

    }

    for (i = 0; i < iovcnt; i++) {

        max_len += iov[i].iov_len;

    }



    packet = g_malloc(sizeof(NetPacket) + max_len);

    packet->sender = sender;

    packet->sent_cb = sent_cb;

    packet->flags = flags;

    packet->size = 0;



    for (i = 0; i < iovcnt; i++) {

        size_t len = iov[i].iov_len;



        memcpy(packet->data + packet->size, iov[i].iov_base, len);

        packet->size += len;

    }




    QTAILQ_INSERT_TAIL(&queue->packets, packet, entry);

}
static void FUNC_0(NetQueue *VAR_0,

                                      NetClientState *VAR_1,

                                      unsigned VAR_2,

                                      const struct iovec *VAR_3,

                                      int VAR_4,

                                      NetPacketSent *VAR_5)

{

    NetPacket *packet;

    size_t max_len = 0;

    int VAR_6;



    if (VAR_0->nq_count >= VAR_0->nq_maxlen && !VAR_5) {

        return; 

    }

    for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) {

        max_len += VAR_3[VAR_6].iov_len;

    }



    packet = g_malloc(sizeof(NetPacket) + max_len);

    packet->VAR_1 = VAR_1;

    packet->VAR_5 = VAR_5;

    packet->VAR_2 = VAR_2;

    packet->size = 0;



    for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) {

        size_t len = VAR_3[VAR_6].iov_len;



        memcpy(packet->data + packet->size, VAR_3[VAR_6].iov_base, len);

        packet->size += len;

    }




    QTAILQ_INSERT_TAIL(&VAR_0->packets, packet, entry);

}
static void FUNC_0(NetQueue *VAR_0,
NetClientState *VAR_1,
unsigned VAR_2,
const struct iovec *VAR_3,
int VAR_4,
NetPacketSent *VAR_5)
{ NetPacket *packet; size_t max_len = 0; int VAR_6; if (VAR_0->nq_count >= VAR_0->nq_maxlen && !VAR_5) { return; } for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) { max_len += VAR_3[VAR_6].iov_len; } packet = g_malloc(sizeof(NetPacket) + max_len); packet->VAR_1 = VAR_1; packet->VAR_5 = VAR_5; packet->VAR_2 = VAR_2; packet->size = 0; for (VAR_6 = 0; VAR_6 < VAR_4; VAR_6++) { size_t len = VAR_3[VAR_6].iov_len; memcpy(packet->data + packet->size, VAR_3[VAR_6].iov_base, len); packet->size += len; } QTAILQ_INSERT_TAIL(&VAR_0->packets, packet, entry); }