Changeset bd4bec9
- Timestamp:
- 04/27/07 14:11:34 (15 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:
- f3576f5
- Parents:
- e991529
- Location:
- tools/tracereport
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/tracereport/dir_report.c
re991529 rbd4bec9 20 20 { 21 21 int i; 22 FILE *out = fopen("dir. out", "w");22 FILE *out = fopen("dir.rpt", "w"); 23 23 if (!out) { 24 24 perror("fopen"); -
tools/tracereport/ecn_report.c
rb5dc60d rbd4bec9 29 29 int i,j; 30 30 31 FILE *out = fopen("ecn. out", "w");31 FILE *out = fopen("ecn.rpt", "w"); 32 32 if (!out) { 33 33 perror("fopen"); -
tools/tracereport/error_report.c
re991529 rbd4bec9 39 39 void error_report(void) 40 40 { 41 FILE *out = fopen("error. out", "w");41 FILE *out = fopen("error.rpt", "w"); 42 42 if (!out) { 43 43 perror("fopen"); -
tools/tracereport/flow_report.c
re991529 rbd4bec9 48 48 void flow_report(void) 49 49 { 50 FILE *out = fopen("flows. out", "w");50 FILE *out = fopen("flows.rpt", "w"); 51 51 if (!out) { 52 52 perror("fopen"); -
tools/tracereport/locality_report.c
rb25f4b0 rbd4bec9 138 138 uint64_t total_packets = 0; 139 139 140 FILE *out = fopen("locality. out", "w");140 FILE *out = fopen("locality.rpt", "w"); 141 141 if (!out) { 142 142 perror("fopen"); -
tools/tracereport/nlp_report.c
rb5dc60d rbd4bec9 24 24 int i,j; 25 25 26 FILE *out = fopen("nlp. out", "w");26 FILE *out = fopen("nlp.rpt", "w"); 27 27 if (!out) { 28 28 perror("fopen"); -
tools/tracereport/protocol_report.c
rb5dc60d rbd4bec9 26 26 } 27 27 28 void protocol_suppress()29 {30 int i;31 printf("%-20s","Direction:");32 for(i=0;i<3;i++){33 if(!suppress[i]){34 switch(i){35 case 0:36 printf("\t%24s", "Outbound ");37 break;38 case 1:39 printf("\t%24s", "Inbound ");40 break;41 case 2:42 printf("\t%24s", "Undefined ");43 break;44 default:45 break;46 }47 }48 }49 printf("\n");50 printf("%-20s","Protocol");51 for(i=0;i<3;i++){52 if(!suppress[i]){53 printf("\t%12s\t%12s", "bytes","packets");54 }55 }56 printf("\n");57 }58 59 28 void protocol_report(void) 60 29 { 61 30 int i,j; 62 printf("# Protocol breakdown:\n"); 63 protocol_suppress(); 31 FILE *out = fopen("protocol.rpt", "w"); 32 if (!out) { 33 perror("fopen"); 34 return; 35 } 36 fprintf(out, "%-16s\t%10s\t%16s %16s\n", 37 "PROTOCOL", 38 "DIRECTION", 39 "BYTES", 40 "PACKETS"); 41 64 42 setprotoent(1); 65 43 for(i=0;i<256;++i) { … … 70 48 prot = getprotobynumber(i); 71 49 if (prot) { 72 printf("%20s",prot->p_name); 73 for(j=0;j<3;j++){ 74 if (prot_stat[j][i].count==0){ 75 if(!suppress[j]) 76 printf("\t%24s"," "); 77 continue; 78 } 79 printf("\t%12" PRIu64 "\t%12" PRIu64, 80 prot_stat[j][i].bytes, 81 prot_stat[j][i].count); 82 } 50 fprintf(out, "%16s",prot->p_name); 83 51 } 84 52 else { 85 printf("%20i:",i); 86 for(j=0;j<3;j++){ 87 if (prot_stat[j][i].count==0){ 88 if(!suppress[j]) 89 printf("\t%24s"," "); 90 continue; 91 } 92 printf("\t%12" PRIu64 "\t%12" PRIu64, 93 prot_stat[j][i].bytes, 94 prot_stat[j][i].count); 53 fprintf(out, "%16i:",i); 54 } 55 for (j=0; j < 3; j++) { 56 if (j != 0) { 57 fprintf(out, "%16s", " "); 95 58 } 96 } 97 printf("\n"); 59 switch (j) { 60 case 0: 61 fprintf(out, "\t%10s", "Outbound"); 62 break; 63 case 1: 64 fprintf(out, "\t%10s", "Inbound"); 65 break; 66 case 2: 67 fprintf(out, "\t%10s", "Unknown"); 68 break; 69 } 70 71 fprintf(out, "\t%16llu %16llu\n", 72 prot_stat[j][i].bytes, 73 prot_stat[j][i].count); 74 } 98 75 } 76 99 77 setprotoent(0); 78 fclose(out); 100 79 } -
tools/tracereport/synopt_report.c
ra1b899f rbd4bec9 160 160 { 161 161 162 FILE *out = fopen("tcpopt_syn. out", "w");162 FILE *out = fopen("tcpopt_syn.rpt", "w"); 163 163 if (!out) { 164 164 perror("fopen"); -
tools/tracereport/tcpopt_report.c
r013d3692 rbd4bec9 46 46 int i,j; 47 47 48 FILE *out = fopen("tcpopt. out", "w");48 FILE *out = fopen("tcpopt.rpt", "w"); 49 49 if (!out) { 50 50 perror("fopen"); -
tools/tracereport/tcpsegment_report.c
rb5dc60d rbd4bec9 12 12 { 13 13 struct libtrace_tcp *tcp = trace_get_tcp(packet); 14 libtrace_ip_t *ip = trace_get_ip(packet); 14 15 libtrace_direction_t dir = trace_get_direction(packet); 15 int payload, tcplen, ss; 16 int ss; 17 uint16_t ip_len ; 16 18 17 19 if (!tcp) … … 21 23 dir = TRACE_DIR_OTHER; 22 24 23 payload = trace_get_wire_length(packet) - trace_get_capture_length(packet); 24 tcplen = tcp->doff * 4; 25 ss = payload + tcplen; 25 ip_len = ntohs(ip->ip_len); 26 ss = ip_len - (ip->ip_hl * 4); 26 27 27 28 tcpseg_stat[dir][ss].count++; … … 64 65 { 65 66 int i,j; 66 printf("# TCP Segment Size breakdown:\n"); 67 tcpseg_suppress(); 67 FILE *out = fopen("tcpseg.rpt", "w"); 68 if (!out) { 69 perror("fopen"); 70 return; 71 } 72 fprintf(out, "%-16s\t%10s\t%16s %16s\n", 73 "SEGMENT SIZE", 74 "DIRECTION", 75 "BYTES", 76 "PACKETS"); 77 68 78 for(i=0;i<2048;++i) { 69 79 if (tcpseg_stat[0][i].count==0 && 70 80 tcpseg_stat[1][i].count==0 && tcpseg_stat[2][i].count==0) 71 81 continue; 72 printf("%20i:",i);82 fprintf(out, "%16i:",i); 73 83 for(j=0;j<3;j++){ 74 if (tcpseg_stat[j][i].count==0){ 75 if(!suppress[j]) 76 printf("\t%24s"," "); 77 continue; 84 if (j != 0) { 85 fprintf(out, "%16s", " "); 78 86 } 79 printf("\t%12" PRIu64 "\t%12" PRIu64, 87 switch (j) { 88 case 0: 89 fprintf(out, "\t%10s", "Outbound"); 90 break; 91 case 1: 92 fprintf(out, "\t%10s", "Inbound"); 93 break; 94 case 2: 95 fprintf(out, "\t%10s", "Unknown"); 96 break; 97 } 98 fprintf(out, "\t%16llu %16llu\n", 80 99 tcpseg_stat[j][i].bytes, 81 tcpseg_stat[j][i].count); 100 tcpseg_stat[j][i].count); 82 101 } 83 printf("\n");84 102 } 103 fclose(out); 85 104 } -
tools/tracereport/tos_report.c
rb5dc60d rbd4bec9 25 25 } 26 26 27 void tos_suppress()28 {29 int i;30 printf("%-20s","Direction:");31 for(i=0;i<3;i++){32 if(!suppress[i]){33 switch(i){34 case 0:35 printf("\t%24s", "Outbound ");36 break;37 case 1:38 printf("\t%24s", "Inbound ");39 break;40 case 2:41 printf("\t%24s", "Undefined ");42 break;43 default:44 break;45 }46 }47 }48 printf("\n");49 printf("%-20s","ToS");50 for(i=0;i<3;i++){51 if(!suppress[i]){52 printf("\t%12s\t%12s", "bytes","packets");53 }54 }55 printf("\n");56 }57 27 58 28 void tos_report(void) 59 29 { 60 30 int i,j; 61 printf("# TOS breakdown:\n"); 62 tos_suppress(); 31 FILE *out = fopen("tos.rpt", "w"); 32 if (!out) { 33 perror("fopen"); 34 return; 35 } 36 37 fprintf(out, "%-12s\t%10s\t%16s %16s\n", 38 "TOS", 39 "DIRECTION", 40 "BYTES", 41 "PACKETS"); 42 43 63 44 for(i=0;i<256;++i) { 64 45 if (tos_stat[0][i].count==0 && 65 46 tos_stat[1][i].count==0 && tos_stat[2][i].count==0) 66 47 continue; 67 printf("%20i:",i);48 fprintf(out, "%12i:",i); 68 49 for(j=0;j<3;j++){ 69 if (tos_stat[j][i].count==0){ 70 if(!suppress[j]) 71 printf("\t%24s"," "); 72 continue; 50 if (j != 0) { 51 fprintf(out, "%12s", " "); 73 52 } 74 printf("\t%12" PRIu64 "\t%12" PRIu64, 53 switch(j) { 54 case 0: 55 fprintf(out, "\t%10s", "Outbound"); 56 break; 57 case 1: 58 fprintf(out, "\t%10s", "Inbound"); 59 break; 60 case 2: 61 fprintf(out, "\t%10s", "Unknown"); 62 break; 63 } 64 fprintf(out, "\t%16llu %16llu\n", 75 65 tos_stat[j][i].bytes, 76 66 tos_stat[j][i].count); 77 67 } 78 printf("\n");79 68 } 69 fclose(out); 80 70 } -
tools/tracereport/ttl_report.c
re991529 rbd4bec9 32 32 { 33 33 int i,j; 34 out = fopen("ttl. out", "w");34 out = fopen("ttl.rpt", "w"); 35 35 if (!out) { 36 36 perror("fopen");
Note: See TracChangeset
for help on using the changeset viewer.