Changeset 1146
- Timestamp:
- 02/22/07 10:39:30 (6 years ago)
- File:
-
- 1 edited
-
trunk/tools/tracereport/tcpopt_report.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/tracereport/tcpopt_report.c
r1144 r1146 7 7 8 8 static stat_t tcpopt_stat[4][256] = {{{0,0}}}; 9 /* Suppressing things seems a little pointless to me */ 9 10 static bool suppress[4] = {true,true,true,true}; 10 11 11 12 void tcpopt_per_packet(struct libtrace_packet_t *packet) 12 13 { 13 unsigned char *p=trace_get_link(packet);14 14 struct libtrace_tcp *tcp = trace_get_tcp(packet); 15 unsigned char *opt_ptr; 16 libtrace_direction_t dir = trace_get_direction(packet); 17 int tcp_payload, len; 18 unsigned char type, optlen, *data; 15 19 16 20 if(!tcp) 17 21 return; 18 22 19 int dir = trace_get_direction(packet); 20 if(dir < 0 || dir > 1) 21 dir = 2; 23 if (dir != TRACE_DIR_INCOMING && dir != TRACE_DIR_OUTGOING) 24 dir = TRACE_DIR_OTHER; 22 25 23 int len = trace_get_capture_length(packet) - 54;26 len = tcp->doff * 4 - sizeof(libtrace_tcp_t); 24 27 if(len == 0) 25 28 return; 26 29 27 int tcp_bytes = trace_get_wire_length(packet) - trace_get_capture_length(packet); 28 int i = tcp->doff*4 - sizeof *tcp; 30 tcp_payload = trace_get_wire_length(packet) - trace_get_capture_length(packet); 29 31 30 if(len > i) 31 len = i; 32 opt_ptr = (unsigned char *)tcp + sizeof (libtrace_tcp_t); 32 33 33 unsigned char type,optlen,*data;34 p += 54; //hax 14 mac header, 20 ip header, 20tcp header35 36 while(trace_get_next_option(&p,&len,&type,&optlen,&data)){34 while(trace_get_next_option(&opt_ptr,&len,&type,&optlen,&data)){ 35 /* I don't think we need to count NO-OPs */ 36 if (type == 1) 37 continue; 37 38 tcpopt_stat[dir][type].count++; 38 tcpopt_stat[dir][type].bytes+= tcp_ bytes;39 tcpopt_stat[dir][type].bytes+= tcp_payload; 39 40 } 40 41
Note: See TracChangeset
for help on using the changeset viewer.
