Changeset 53de8c0 for examples


Ignore:
Timestamp:
09/06/04 11:43:26 (16 years ago)
Author:
Daniel Lawson <dlawson@…>
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:
3fb49bc
Parents:
36f563c
Message:

2.0.3 testing release

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/sample/sample.c

    rb535184 r53de8c0  
    5959
    6060        char *uri = 0;
     61        char *filterstring = 0;
    6162        int psize = 0;
    62         int status = 0;
    6363        struct libtrace_ip *ipptr = 0;
    6464        struct libtrace_packet_t packet;
     65        struct libtrace_filter_t *filter = 0;
    6566
    6667        if (argc == 2) {
    6768                uri = strdup(argv[1]);
    68         }
     69        } else if (argc == 3) {
     70                uri = strdup(argv[1]);
     71                filterstring = strdup(argv[2]);
     72        }
     73
     74        if (filterstring)
     75                filter = trace_bpf_setfilter(filterstring);
    6976
    7077        // open a trace
     
    7885                        break;
    7986                }
     87
     88                if(filter && !trace_bpf_filter(filter,&packet)) {
     89                        continue;
     90                }
    8091
    8192                printf("TS %f: ",trace_get_seconds(&packet));
Note: See TracChangeset for help on using the changeset viewer.