Changeset 084d95a for lib/trace.c


Ignore:
Timestamp:
09/05/05 14:44:41 (15 years ago)
Author:
Shane Alcock <salcock@…>
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:
de8c420b
Parents:
03cbfec
Message:

Fixed another reference to sizeof(dag_record_t) and added support for dummy traces

trace_create_dead and trace_destroy_dead

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    rb5cd711 r084d95a  
    308308}
    309309
     310struct libtrace_t * trace_create_dead (char *uri) {
     311        struct libtrace_t *libtrace = malloc(sizeof(struct libtrace_t));
     312        char *scan = calloc(sizeof(char),URI_PROTO_LINE);
     313        char *uridata;
     314        int i;
     315       
     316        trace_err.err_num = E_NOERROR;
     317
     318        if((uridata = strchr(uri,':')) == NULL) {
     319                strncpy(scan, uri, strlen(uri));
     320        } else {
     321                strncpy(scan,uri, (uridata - uri));
     322        }
     323       
     324        libtrace->format = 0;   
     325       
     326        for (i = 0; i < nformats; i++) {
     327                if (strlen(scan) == strlen(format_list[i]->name) &&
     328                                !strncasecmp(scan,
     329                                        format_list[i]->name,
     330                                        strlen(scan))) {
     331                                libtrace->format=format_list[i];
     332                                break;
     333                                }
     334        }
     335        if (libtrace->format == 0) {
     336                trace_err.err_num = E_BAD_FORMAT;
     337                trace_err.problem = scan;
     338                return 0;
     339        }
     340
     341        return libtrace;
     342
     343}
     344       
    310345/** Creates a libtrace_out_t structure and the socket / file through which output will be directed.
    311346 *
     
    421456}
    422457
     458
     459void trace_destroy_dead(struct libtrace_t *libtrace) {
     460        assert(libtrace);
     461        free(libtrace);
     462}
    423463/** Close an output trace file, freeing up any resources it may have been using
    424464 *
Note: See TracChangeset for help on using the changeset viewer.