Changeset c792590


Ignore:
Timestamp:
06/22/04 17:22:54 (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:
c681e86
Parents:
dadc609
Message:

accepts a filter on the cmdline

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/protocol/protocol.c

    r52e95c7 rc792590  
    1515
    1616        char *hostname = "rtclient:chasm.cs.waikato.ac.nz";
     17        char *filterstring = 0;
    1718        struct libtrace_ip *ipptr = 0;
    1819       
     
    2223                hostname = argv[1];
    2324        }
     25        if (argc == 3) {
     26                hostname = argv[1];
     27                filterstring = argv[2];
     28        }
    2429
    2530        // create an rtclient to hostname, on the default port
    2631        trace = create_trace(hostname);
     32        if (filterstring) {
     33                libtrace_bpf_setfilter(trace,filterstring);
     34        }
    2735
    2836        for (;;) {
     
    3139                        break;
    3240                }
     41                if (!libtrace_bpf_filter(trace, buffer, 4096)) {
     42                        continue;
     43                }
    3344                ipptr = get_ip(trace,buffer,4096);
    3445                if (ipptr) {
Note: See TracChangeset for help on using the changeset viewer.