Changeset edb18ce for lib/format_wag.c


Ignore:
Timestamp:
04/21/06 00:42:17 (15 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:
d0906e7
Parents:
671566a
Message:

Rewrote libtrace's IO handling to use shim functions when needing to do
zlib io

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_wag.c

    r671566a redb18ce  
    7272        union {
    7373                int fd;
    74 #if HAVE_ZLIB
    75                 gzFile *file;
    76 #else   
    77                 int file;
    78 #endif
     74                libtrace_io_t *file;
    7975        } input;       
    8076};
     
    8985        union {
    9086                int fd;
    91 #if HAVE_ZLIB
    92                 gzFile *file;
    93 #else
    94                 int file;
    95 #endif
     87                libtrace_io_t *file;
    9688        } output;
    9789};
     
    198190
    199191static int wtf_fin_input(struct libtrace_t *libtrace) {
    200         LIBTRACE_CLOSE(INPUT.file);
     192        libtrace_io_close(INPUT.file);
    201193        free(libtrace->format_data);
    202194        return 0;
     
    204196
    205197static int wtf_fin_output(struct libtrace_out_t *libtrace) {
    206         LIBTRACE_CLOSE(OUTPUT.file);
     198        libtrace_io_close(OUTPUT.file);
    207199        free(libtrace->format_data);
    208200        return 0;
     
    306298        buffer2 = buffer = packet->buffer;
    307299       
    308         if ((numbytes = LIBTRACE_READ(INPUT.file, buffer, sizeof(struct frame_t))) == -1) {
     300        if ((numbytes = libtrace_io_read(INPUT.file, buffer, sizeof(struct frame_t))) == -1) {
    309301                trace_set_err(libtrace,errno,
    310302                                "read(%s,frame_t)",packet->trace->uridata);
     
    328320
    329321       
    330         if ((numbytes=LIBTRACE_READ(INPUT.file, buffer2, size)) != size) {
     322        if ((numbytes=libtrace_io_read(INPUT.file, buffer2, size)) != size) {
    331323                trace_set_err(libtrace,
    332324                                errno,"read(%s,buffer)",packet->trace->uridata);
     
    352344         * technically correct to read from the header and payload pointers
    353345         */
    354         if ((numbytes = LIBTRACE_WRITE(OUTPUT.file, packet->header,
     346        if ((numbytes = libtrace_io_write(OUTPUT.file, packet->header,
    355347                                trace_get_framing_length(packet))) == -1) {
    356348                trace_set_err_out(libtrace,errno,
     
    358350                return -1;
    359351        }
    360         if ((numbytes = LIBTRACE_WRITE(OUTPUT.file, packet->payload,
     352        if ((numbytes = libtrace_io_write(OUTPUT.file, packet->payload,
    361353                                trace_get_capture_length(packet)) == -1)) {
    362354                trace_set_err_out(libtrace,
Note: See TracChangeset for help on using the changeset viewer.