Changeset 3840760
- Timestamp:
- 11/28/05 10:15:22 (17 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:
- 08594b8
- Parents:
- 14d8a63
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/capture/capture.c
r05e83dc r3840760 98 98 struct sigaction sigact; 99 99 dag_record_t *erfptr = 0; 100 struct libtrace_packet_t packet;100 struct libtrace_packet_t *packet = trace_packet_create(); 101 101 102 102 struct itimerval itv; -
examples/count/tracestats.c
r4dd7363 r3840760 68 68 void run_trace(char *uri) 69 69 { 70 struct libtrace_packet_t packet;70 struct libtrace_packet_t *packet = trace_packet_create(); 71 71 int i; 72 72 uint64_t count = 0; -
examples/erfsplit/erfsplit.c
r7e9d51c r3840760 75 75 time_t ts = 0; 76 76 uint64_t number = 0; 77 struct libtrace_packet_t packet;77 struct libtrace_packet_t *packet = trace_packet_create(); 78 78 parse_cmdline(argc,argv); 79 79 -
examples/event/rate-tracetime.c
r264f4469 r3840760 100 100 int psize = 0; 101 101 struct libtrace_ip *ipptr = 0; 102 struct libtrace_packet_t packet;102 struct libtrace_packet_t *packet = trace_packet_create(); 103 103 uint32_t last_second = 0; 104 104 double ts = 0.0; -
examples/event/rate.c
re81d1af r3840760 105 105 struct sigaction sigact; 106 106 struct libtrace_ip *ipptr = 0; 107 struct libtrace_packet_t packet;107 struct libtrace_packet_t *packet = trace_packet_create(); 108 108 109 109 struct itimerval itv; -
examples/munge/munge.c
r1974620 r3840760 177 177 struct libtrace_filter_t *filter = NULL; 178 178 struct libtrace_t *trace = 0; 179 struct libtrace_packet_t packet;179 struct libtrace_packet_t *packet = trace_packet_create(); 180 180 struct libtrace_out_t *writer = 0; 181 181 bool enc_source = false; -
examples/pcap2erf/pcap2erf.c
rb535184 r3840760 72 72 73 73 struct pcap_pkthdr *header; 74 struct libtrace_packet_t packet;74 struct libtrace_packet_t *packet = trace_packet_create(); 75 75 unsigned long seconds, subseconds; 76 76 unsigned short rlen, lctr, wlen, offset, pad; -
examples/protocol/protocol.c
r5ed52b8 r3840760 98 98 99 99 struct libtrace_ip *ipptr = 0; 100 struct libtrace_packet_t packet;100 struct libtrace_packet_t *packet = trace_packet_create(); 101 101 102 102 int psize; -
examples/rate/rate-dir.c
r2cc187b r3840760 117 117 int direction = 0; 118 118 struct libtrace_ip *ipptr = 0; 119 struct libtrace_packet_t packet;119 struct libtrace_packet_t *packet = trace_packet_create(); 120 120 121 121 uint32_t last_second = 0; -
examples/rate/rate.c
r0675ea1 r3840760 95 95 int psize = 0; 96 96 struct libtrace_ip *ipptr = 0; 97 struct libtrace_packet_t packet;97 struct libtrace_packet_t *packet = trace_packet_create(); 98 98 99 99 uint32_t last_second = 0; -
examples/rxtest/rxtest.c
r85c7de8 r3840760 53 53 int main(int argc, char **argv) { 54 54 55 struct libtrace_packet_t packet;55 struct libtrace_packet_t *packet = trace_packet_create(); 56 56 dag_record_t *erfptr; 57 57 -
examples/sample/sample.c
rde67322 r3840760 64 64 int psize = 0; 65 65 struct libtrace_ip *ipptr = 0; 66 struct libtrace_packet_t packet;66 struct libtrace_packet_t *packet = trace_packet_create(); 67 67 struct libtrace_filter_t *filter = 0; 68 68 -
examples/tracedump/tracedump.c
rf20b30e r3840760 35 35 int main(int argc, char *argv[]) { 36 36 37 struct libtrace_packet_t packet;37 struct libtrace_packet_t *packet = trace_packet_create(); 38 38 struct libtrace_t *trace; 39 39 -
examples/tracemark/tracemark.c
redca0b8 r3840760 58 58 void run_trace(char *uri) 59 59 { 60 struct libtrace_packet_t packet;60 struct libtrace_packet_t *packet = trace_packet_create(); 61 61 uint64_t count = 0; 62 62 uint64_t bytes = 0; -
lib/format_wag.c
r14d8a63 r3840760 323 323 packet->status.message = 0; 324 324 packet->header = packet->buffer; 325 packet->payload = packet->buffer + pcap_get_framing_length(packet);325 packet->payload = packet->buffer + trace_get_framing_length(packet); 326 326 packet->size = numbytes; 327 327 return numbytes; -
libpacketdump/libpacketdump.cc
re3b0188 r3840760 64 64 65 65 printf("%s",ctime(&sec)); 66 decode_next(link,packet->size -(link-packet->buffer),"link",trace_get_link_type(packet));66 decode_next(link,packet->size - trace_get_framing_length(packet),"link",trace_get_link_type(packet)); 67 67 } 68 68 -
tools/traceanon/traceanon.c
rca52edd r3840760 100 100 char *key = NULL; 101 101 struct libtrace_t *trace = 0; 102 struct libtrace_packet_t packet;102 struct libtrace_packet_t *packet = trace_packet_create(); 103 103 struct libtrace_out_t *writer = 0; 104 104 bool enc_source = false; … … 178 178 struct libtrace_ip *ipptr; 179 179 int psize; 180 if ((psize = trace_read_packet(trace, &packet)) <= 0) {180 if ((psize = trace_read_packet(trace, packet)) <= 0) { 181 181 break; 182 182 } 183 183 184 ipptr = trace_get_ip( &packet);184 ipptr = trace_get_ip(packet); 185 185 186 186 if (ipptr && (enc_source || enc_dest)) … … 189 189 /* TODO: Encrypt IP's in ARP packets */ 190 190 191 trace_write_packet(writer, &packet);191 trace_write_packet(writer,packet); 192 192 } 193 193 return 0; -
tools/tracedump/tracedump.cc
r0c9681f r3840760 20 20 { 21 21 struct libtrace_t *trace = NULL; 22 struct libtrace_packet_t packet;22 struct libtrace_packet_t *packet = trace_packet_create(); 23 23 struct libtrace_filter_t *filter=NULL; 24 24 uint64_t count=0; … … 65 65 } 66 66 67 while(trace_read_packet(trace, &packet)> 0 ){68 if (filter && !trace_bpf_filter(filter, &packet))67 while(trace_read_packet(trace,packet)> 0 ){ 68 if (filter && !trace_bpf_filter(filter,packet)) 69 69 continue; 70 70 71 trace_dump_packet( &packet);71 trace_dump_packet(packet); 72 72 if(count) { 73 73 numpackets++; -
tools/tracemerge/tracemerge.c
rb297e50 r3840760 19 19 struct libtrace_out_t *output; 20 20 struct libtrace_t **input; 21 struct libtrace_packet_t * packet;21 struct libtrace_packet_t **packet; 22 22 bool *live; 23 23 bool set_interface=false; … … 57 57 58 58 input=calloc((argc-optind),sizeof(struct libtrace_t *)); 59 packet=calloc((argc-optind),sizeof(struct libtrace_packet_t ));59 packet=calloc((argc-optind),sizeof(struct libtrace_packet_t *)); 60 60 live=calloc((argc-optind),sizeof(bool)); 61 61 for(i=0;i<argc-optind;++i) { 62 62 struct libtrace_t *f; 63 struct libtrace_packet_t p;63 struct libtrace_packet_t *p; 64 64 f=trace_create(argv[i+optind]); 65 p=trace_packet_create(); 65 66 input[i]=f; 67 packet[i]=p; 66 68 if (!input[i]) { 67 69 fprintf(stderr,"Could not read %s\n",argv[i+optind]); 68 70 return 1; 69 71 } 70 trace_read_packet(f, &p);72 trace_read_packet(f,p); 71 73 } 72 74 … … 76 78 for(i=0;i<argc-2;++i) { 77 79 if (!live[i] && input[i]) { 78 int ret=trace_read_packet(input[i], &packet[i]);80 int ret=trace_read_packet(input[i],packet[i]); 79 81 if (ret<0) { 80 82 /* Error */ … … 93 95 if (live[i] && 94 96 (oldest==-1 || 95 oldest_ts<trace_get_erf_timestamp( &packet[i]))) {97 oldest_ts<trace_get_erf_timestamp(packet[i]))) { 96 98 oldest=i; 97 oldest_ts=trace_get_erf_timestamp( &packet[i]);99 oldest_ts=trace_get_erf_timestamp(packet[i]); 98 100 } 99 101 } … … 104 106 105 107 if (set_interface) 106 trace_set_direction( &packet[oldest],oldest);107 trace_write_packet(output, &packet[oldest]);108 trace_set_direction(packet[oldest],oldest); 109 trace_write_packet(output,packet[oldest]); 108 110 live[oldest]=false; 109 111 -
tools/tracereport/tracereport.c
re3b0188 r3840760 61 61 void run_trace(char *uri) 62 62 { 63 struct libtrace_packet_t packet;63 struct libtrace_packet_t *packet = trace_packet_create(); 64 64 65 65 fprintf(stderr,"%s:\n",uri); … … 69 69 for (;;) { 70 70 int psize; 71 if ((psize = trace_read_packet(trace, &packet)) <1) {71 if ((psize = trace_read_packet(trace, packet)) <1) { 72 72 break; 73 73 } 74 74 75 error_per_packet( &packet);76 port_per_packet( &packet);77 protocol_per_packet( &packet);78 tos_per_packet( &packet);79 ttl_per_packet( &packet);80 flow_per_packet( &packet);81 dir_per_packet( &packet);75 error_per_packet(packet); 76 port_per_packet(packet); 77 protocol_per_packet(packet); 78 tos_per_packet(packet); 79 ttl_per_packet(packet); 80 flow_per_packet(packet); 81 dir_per_packet(packet); 82 82 83 83 } -
tools/tracertstats/tracertstats.c
re3b0188 r3840760 91 91 void run_trace(char *uri) 92 92 { 93 struct libtrace_packet_t packet;93 struct libtrace_packet_t *packet = trace_packet_create(); 94 94 int i; 95 95 uint64_t count = 0; … … 116 116 for (;;) { 117 117 int psize; 118 if ((psize = trace_read_packet(trace, &packet)) <1) {118 if ((psize = trace_read_packet(trace, packet)) <1) { 119 119 break; 120 120 } 121 ts = trace_get_seconds( &packet);121 ts = trace_get_seconds(packet); 122 122 123 123 for(i=0;i<filter_count;++i) { 124 if(trace_bpf_filter(filters[i].filter, &packet)) {124 if(trace_bpf_filter(filters[i].filter,packet)) { 125 125 ++filters[i].count; 126 filters[i].bytes+=trace_get_wire_length( &packet);126 filters[i].bytes+=trace_get_wire_length(packet); 127 127 } 128 128 } 129 129 130 130 ++count; 131 bytes+=trace_get_wire_length( &packet);131 bytes+=trace_get_wire_length(packet); 132 132 133 133 if (packet_interval!=UINT64_MAX -
tools/tracesplit/tracesplit.c
re3b0188 r3840760 44 44 struct libtrace_out_t *output = NULL; 45 45 struct libtrace_t *input; 46 struct libtrace_packet_t *packet = trace_packet_create(); 46 47 uint64_t count=UINT64_MAX; 47 48 uint64_t bytes=UINT64_MAX; … … 106 107 107 108 while(1) { 108 struct libtrace_packet_t packet; 109 if (trace_read_packet(input,&packet)<1) { 109 if (trace_read_packet(input,packet)<1) { 110 110 break; 111 111 } 112 112 113 113 114 if (filter && !trace_bpf_filter(filter, &packet)) {114 if (filter && !trace_bpf_filter(filter,packet)) { 115 115 continue; 116 116 } 117 117 118 if (trace_get_seconds( &packet)<starttime) {118 if (trace_get_seconds(packet)<starttime) { 119 119 continue; 120 120 } 121 121 122 if (trace_get_seconds( &packet)>endtime) {122 if (trace_get_seconds(packet)>endtime) { 123 123 break; 124 124 } 125 125 126 126 if (firsttime==0) { 127 firsttime=trace_get_seconds( &packet);127 firsttime=trace_get_seconds(packet); 128 128 } 129 129 130 if (output && trace_get_seconds( &packet)>firsttime+interval) {130 if (output && trace_get_seconds(packet)>firsttime+interval) { 131 131 trace_output_destroy(output); 132 132 output=NULL; … … 140 140 } 141 141 142 totbytes+=trace_get_capture_length( &packet);142 totbytes+=trace_get_capture_length(packet); 143 143 if (output && totbytes-totbyteslast>=bytes) { 144 144 trace_output_destroy(output); … … 167 167 } 168 168 169 trace_write_packet(output, &packet);169 trace_write_packet(output,packet); 170 170 } 171 171 -
tools/tracestats/tracestats.c
r130a0e4 r3840760 68 68 void run_trace(char *uri) 69 69 { 70 struct libtrace_packet_t packet;70 struct libtrace_packet_t *packet = trace_packet_create(); 71 71 int i; 72 72 uint64_t count = 0; … … 79 79 for (;;) { 80 80 int psize; 81 if ((psize = trace_read_packet(trace, &packet)) <1) {81 if ((psize = trace_read_packet(trace, packet)) <1) { 82 82 break; 83 83 } 84 84 85 85 for(i=0;i<filter_count;++i) { 86 if(trace_bpf_filter(filters[i].filter, &packet)) {86 if(trace_bpf_filter(filters[i].filter,packet)) { 87 87 ++filters[i].count; 88 filters[i].bytes+=trace_get_wire_length( &packet);88 filters[i].bytes+=trace_get_wire_length(packet); 89 89 } 90 90 } 91 91 92 92 ++count; 93 bytes+=trace_get_wire_length( &packet);93 bytes+=trace_get_wire_length(packet); 94 94 } 95 95
Note: See TracChangeset
for help on using the changeset viewer.