Changeset c66068d for lib/format_duck.c


Ignore:
Timestamp:
12/03/08 13:24:55 (13 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
f66a2dca
Parents:
7157db8
Message:

Rewrite the libtrace io subsystem to use the new wandio abstraction layer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_duck.c

    rf0fb38f rc66068d  
    3333#include "format_helper.h"
    3434#include "config.h"
     35#include "wandio.h"
    3536#include <stdlib.h>
    3637#include "libtraceio.h"
     
    5051struct duck_format_data_t {
    5152        char *path;
    52         libtrace_io_t *file;
     53        io_t *file;
    5354        int dag_version;
    5455};
     
    5859        int level;
    5960        int fileflag;
    60         libtrace_io_t *file;
     61        iow_t *file;
    6162        int dag_version;       
    6263};
     
    121122
    122123static int duck_fin_input(libtrace_t *libtrace) {
    123         libtrace_io_close(INPUT->file);
     124        wandio_destroy(INPUT->file);
    124125        free(libtrace->format_data);
    125126
     
    128129
    129130static int duck_fin_output(libtrace_out_t *libtrace) {
    130         libtrace_io_close(OUTPUT->file);
     131        wandio_wdestroy(OUTPUT->file);
    131132        free(libtrace->format_data);
    132133        return 0;
     
    180181        if (INPUT->dag_version == 0) {
    181182                /* Read in the duck version from the start of the trace */
    182                 if ((numbytes = libtrace_io_read(INPUT->file, &version,
     183                if ((numbytes = wandio_read(INPUT->file, &version,
    183184                                        sizeof(version))) != sizeof(uint32_t)) {
    184185                        trace_set_err(libtrace, errno,
     
    206207        }
    207208
    208         if ((numbytes = libtrace_io_read(INPUT->file, packet->buffer,
     209        if ((numbytes = wandio_read(INPUT->file, packet->buffer,
    209210                                        (size_t)duck_size)) != (int)duck_size) {
    210211                if (numbytes == -1) {
     
    243244        if (OUTPUT->dag_version == 0) {
    244245        /* Writing the DUCK version will help with reading it back in later! */
    245                 if ((numbytes = libtrace_io_write(OUTPUT->file, &packet->type,
     246                if ((numbytes = wandio_wwrite(OUTPUT->file, &packet->type,
    246247                                sizeof(packet->type))) != sizeof(uint32_t)){
    247248                        trace_set_err_out(libtrace, errno,
     
    252253        }
    253254       
    254         if ((numbytes = libtrace_io_write(OUTPUT->file, packet->payload,
     255        if ((numbytes = wandio_wwrite(OUTPUT->file, packet->payload,
    255256                                        trace_get_capture_length(packet))) !=
    256257                                (int)trace_get_capture_length(packet)) {
Note: See TracChangeset for help on using the changeset viewer.