Changeset b535184 for examples/sample
- Timestamp:
- 08/05/04 16:14:07 (18 years ago)
- 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
- Location:
- examples/sample
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/sample/Makefile
r2c060e3 rb535184 1 1 2 wand_include = /usr/local/wand/include3 wand_libs = /usr/local/wand/lib2 libtrace_include = /usr/local/wand/include 3 libtrace_libs = /usr/local/wand/lib 4 4 5 5 CC=gcc-3.0 6 6 7 INCLUDE = -I../include -I$(wand_include)7 INCLUDE = -I$(libtrace_include) 8 8 CFLAGS = -Wall -Wimplicit -Wformat -pipe -g -O2 9 9 CFLAGS += $(INCLUDE) 10 libdir = -L$( wand_libs)10 libdir = -L$(libtrace_libs) 11 11 LDLIBS = $(libdir) -ltrace 12 12 -
examples/sample/sample.c
re9f521e rb535184 62 62 int status = 0; 63 63 struct libtrace_ip *ipptr = 0; 64 struct libtrace_packet_t packet; 64 65 65 66 if (argc == 2) { … … 68 69 69 70 // open a trace 70 trace = create_trace(uri); 71 trace = trace_create(uri); 72 71 73 72 74 for (;;) { 73 75 unsigned char *x; 74 76 int i; 75 if ((psize = libtrace_read_packet(trace, buffer, SCANSIZE, &status)) <1) {77 if ((psize = trace_read_packet(trace, &packet)) <1) { 76 78 break; 77 79 } 78 80 79 printf("TS %f: ", get_seconds(trace,buffer,SCANSIZE));81 printf("TS %f: ",trace_get_seconds(&packet)); 80 82 81 ipptr = get_ip(trace,buffer,SCANSIZE);83 ipptr = trace_get_ip(&packet); 82 84 if (!ipptr) { 83 85 printf("Non IP\n"); … … 90 92 ipptr->ip_p); 91 93 x=(void*)ipptr; 92 for(i=0;i< get_capture_length(trace,buffer,SCANSIZE);i++) {94 for(i=0;i<trace_get_capture_length(&packet);i++) { 93 95 if (i%4==0 && i!=0) 94 96 printf("\n"); … … 98 100 } 99 101 100 destroy_trace(trace);102 trace_destroy(trace); 101 103 return 0; 102 104 }
Note: See TracChangeset
for help on using the changeset viewer.