static ssize_t dump_receive(VLANClientState *vc, const uint8_t *buf, size_t size)

{

    DumpState *s = vc->opaque;

    struct pcap_sf_pkthdr hdr;

    int64_t ts;

    int caplen;



    /* Early return in case of previous error. */

    if (s->fd < 0) {

        return size;

    }



    ts = muldiv64(qemu_get_clock(vm_clock), 1000000, get_ticks_per_sec());

    caplen = size > s->pcap_caplen ? s->pcap_caplen : size;



    hdr.ts.tv_sec = ts / 1000000;

    hdr.ts.tv_usec = ts % 1000000;

    hdr.caplen = caplen;

    hdr.len = size;

    if (write(s->fd, &hdr, sizeof(hdr)) != sizeof(hdr) ||

        write(s->fd, buf, caplen) != caplen) {

        qemu_log("-net dump write error - stop dump\n");

        close(s->fd);

        s->fd = -1;

    }



    return size;

}

static ssize_t dump_receive(VLANClientState *vc, const uint8_t *buf, size_t size)

{

    DumpState *s = vc->opaque;

    struct pcap_sf_pkthdr hdr;

    int64_t ts;

    int caplen;



    

    if (s->fd < 0) {

        return size;

    }



    ts = muldiv64(qemu_get_clock(vm_clock), 1000000, get_ticks_per_sec());

    caplen = size > s->pcap_caplen ? s->pcap_caplen : size;



    hdr.ts.tv_sec = ts / 1000000;

    hdr.ts.tv_usec = ts % 1000000;

    hdr.caplen = caplen;

    hdr.len = size;

    if (write(s->fd, &hdr, sizeof(hdr)) != sizeof(hdr) ||

        write(s->fd, buf, caplen) != caplen) {

        qemu_log("-net dump write error - stop dump\n");

        close(s->fd);

        s->fd = -1;

    }



    return size;

}

static ssize_t dump_receive(VLANClientState *vc, const uint8_t *buf, size_t size)     DumpState *s = vc->opaque;     DumpState *s = vc->opaque;     if (s->fd < 0) {         close(s->fd);
static ssize_t FUNC_0(VLANClientState *vc, const uint8_t *buf, size_t size)

{

    DumpState *s = vc->opaque;

    struct pcap_sf_pkthdr VAR_0;

    int64_t ts;

    int VAR_1;



    

    if (s->fd < 0) {

        return size;

    }



    ts = muldiv64(qemu_get_clock(vm_clock), 1000000, get_ticks_per_sec());

    VAR_1 = size > s->pcap_caplen ? s->pcap_caplen : size;



    VAR_0.ts.tv_sec = ts / 1000000;

    VAR_0.ts.tv_usec = ts % 1000000;

    VAR_0.VAR_1 = VAR_1;

    VAR_0.len = size;

    if (write(s->fd, &VAR_0, sizeof(VAR_0)) != sizeof(VAR_0) ||

        write(s->fd, buf, VAR_1) != VAR_1) {

        qemu_log("-net dump write error - stop dump\n");

        close(s->fd);

        s->fd = -1;

    }



    return size;

}

static ssize_t FUNC_0(VLANClientState *vc, const uint8_t *buf, size_t size)
{ DumpState *s = vc->opaque; struct pcap_sf_pkthdr VAR_0; int64_t ts; int VAR_1; if (s->fd < 0) { return size; } ts = muldiv64(qemu_get_clock(vm_clock), 1000000, get_ticks_per_sec()); VAR_1 = size > s->pcap_caplen ? s->pcap_caplen : size; VAR_0.ts.tv_sec = ts / 1000000; VAR_0.ts.tv_usec = ts % 1000000; VAR_0.VAR_1 = VAR_1; VAR_0.len = size; if (write(s->fd, &VAR_0, sizeof(VAR_0)) != sizeof(VAR_0) ||
write(s->fd, buf, VAR_1) != VAR_1) { qemu_log("-net dump write error - stop dump\n"); close(s->fd); s->fd = -1; } return size; }