Changeset b535184 for examples/rate


Ignore:
Timestamp:
08/05/04 16:14:07 (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:
2137b49
Parents:
9729a8d
Message:

updated examples to use 1.1.0 api

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/rate/rate.c

    re9f521e rb535184  
    9696int main(int argc, char *argv[]) {
    9797
    98         char *hostname = 0;
     98        char *uri = 0;
    9999        int psize = 0;
    100         int status = 0;
    101100        struct sigaction sigact;
    102101        struct libtrace_ip *ipptr = 0;
     102        struct libtrace_packet_t packet;
    103103
    104104        struct itimerval itv;
     
    119119
    120120        if (argc == 2) {
    121                 hostname = strdup(argv[1]);
     121                uri = strdup(argv[1]);
    122122        }
    123123
    124         // create an trace to hostname, on the default port
    125         trace = create_trace(hostname);
     124        // create an trace to uri
     125        trace = trace_create(uri);
    126126
    127127
    128128        for (;;) {
    129                 if ((psize = libtrace_read_packet(trace, buffer,SCANSIZE, &status)) == -1) {
     129                if ((psize = trace_read_packet(trace,&packet)) == -1) {
    130130                        // terminate
    131131                        break;
     
    137137                //erfptr = (dag_record_t *)buffer;
    138138                //ipptr = (struct ip *)erfptr->rec.eth.pload;
    139                 if((ipptr = get_ip(trace,buffer,SCANSIZE)) == 0) {
     139                if((ipptr = trace_get_ip(&packet)) == 0) {
    140140                        continue;
    141141                }
     
    151151        }
    152152
    153         destroy_trace(trace);
     153        trace_destroy(trace);
    154154        return 0;
    155155}
Note: See TracChangeset for help on using the changeset viewer.