Changeset b5dc60d
- Timestamp:
- 02/22/07 15:45:46 (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:
- 051618c
- Parents:
- 4eec8dc
- Location:
- tools/tracereport
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/tracereport/ecn_report.c
r4eec8dc rb5dc60d 36 36 37 37 /* Put some headings up for human-readability */ 38 fprintf(out, "%-12s\t% 8s\t%12s\t%12s\n",38 fprintf(out, "%-12s\t%10s\t%16s %16s\n", 39 39 "ECN", 40 40 "DIRECTION", … … 67 67 switch (j) { 68 68 case 0: 69 fprintf(out, "\t% 8s", "Outbound");69 fprintf(out, "\t%10s", "Outbound"); 70 70 break; 71 71 case 1: 72 fprintf(out, "\t% 8s", "Inbound");72 fprintf(out, "\t%10s", "Inbound"); 73 73 break; 74 74 case 2: 75 fprintf(out, "\t% 8s", "Unknown");75 fprintf(out, "\t%10s", "Unknown"); 76 76 break; 77 77 } 78 fprintf(out, "\t%1 2llu %12llu\n",78 fprintf(out, "\t%16llu %16llu\n", 79 79 ecn_stat[j][i].bytes, 80 80 ecn_stat[j][i].count); -
tools/tracereport/nlp_report.c
r4eec8dc rb5dc60d 31 31 32 32 /* Put some headings up for human-readability */ 33 fprintf(out, "%-12s\t% 8s\t%12s\t%12s\n",33 fprintf(out, "%-12s\t%10s\t%16s %16s\n", 34 34 "NETWORK LAYER", 35 35 "DIRECTION", … … 69 69 switch (j) { 70 70 case 0: 71 fprintf(out, "\t% 8s", "Outbound");71 fprintf(out, "\t%10s", "Outbound"); 72 72 break; 73 73 case 1: 74 fprintf(out, "\t% 8s", "Inbound");74 fprintf(out, "\t%10s", "Inbound"); 75 75 break; 76 76 case 2: 77 fprintf(out, "\t% 8s", "Unknown");77 fprintf(out, "\t%10s", "Unknown"); 78 78 break; 79 79 } 80 80 81 fprintf(out, "\t%1 2llu %12llu\n",81 fprintf(out, "\t%16llu %16llu\n", 82 82 nlp_stat[j][i].bytes, 83 83 nlp_stat[j][i].count); -
tools/tracereport/port_report.c
r09be643 rb5dc60d 9 9 #include "contain.h" 10 10 11 stat_t ports[ 4][256][65536]={{{{0,0}}}};11 stat_t ports[3][256][65536]={{{{0,0}}}}; 12 12 char protn[256]={0}; 13 static bool suppress[ 4] = {true,true,true,true};13 static bool suppress[3] = {true,true,true}; 14 14 15 15 void port_per_packet(struct libtrace_packet_t *packet) … … 17 17 uint8_t proto; 18 18 int port; 19 int dir = trace_get_direction(packet); 20 if(dir < 0 || dir > 1) 21 dir = 2; 19 libtrace_direction_t dir = trace_get_direction(packet); 20 22 21 if(trace_get_transport(packet,&proto,NULL)==NULL) 23 22 return; 24 23 24 if (dir != TRACE_DIR_INCOMING && dir != TRACE_DIR_OUTGOING) 25 dir = TRACE_DIR_OTHER; 26 25 27 port = trace_get_server_port(proto, 26 28 trace_get_source_port(packet), … … 39 41 int i; 40 42 printf("%-20s","Direction:"); 41 for(i=0;i< 4;i++){43 for(i=0;i<3;i++){ 42 44 if(!suppress[i]){ 43 45 switch(i){ … … 58 60 printf("\n"); 59 61 printf("%-20s","Port"); 60 for(i=0;i< 4;i++){62 for(i=0;i<3;i++){ 61 63 if(!suppress[i]){ 62 64 printf("\t%12s\t%12s", "bytes","packets"); … … 73 75 if(ent){ 74 76 printf("%20s:",ent->s_name); 75 for(k=0;k< 4;k++){77 for(k=0;k<3;k++){ 76 78 if (ports[k][i][j].count==0){ 77 79 if(!suppress[k]) … … 87 89 else{ 88 90 printf("%20i:",j); 89 for(k=0;k< 4;k++){91 for(k=0;k<3;k++){ 90 92 if (ports[k][i][j].count==0){ 91 93 if(!suppress[k]) … … 109 111 ent?"(":"",ent?ent->p_name:"",ent?")":""); 110 112 for(j=0;j<65536;++j) { 111 for(k=0;k< 4;k++){113 for(k=0;k<3;k++){ 112 114 if (ports[k][i][j].count) { 113 115 port_port(i,ent?ent->p_name:"",j); -
tools/tracereport/protocol_report.c
r09be643 rb5dc60d 7 7 #include "report.h" 8 8 9 static stat_t prot_stat[ 4][256] = {{{0,0}}} ;10 static bool suppress[ 4] = {true,true,true,true};9 static stat_t prot_stat[3][256] = {{{0,0}}} ; 10 static bool suppress[3] = {true,true,true}; 11 11 12 12 void protocol_per_packet(struct libtrace_packet_t *packet) 13 13 { 14 14 uint8_t proto; 15 int dir = trace_get_direction(packet); 16 if(dir < 0 || dir > 1) 17 dir = 2; 15 libtrace_direction_t dir = trace_get_direction(packet); 16 18 17 if (trace_get_transport(packet,&proto,NULL)==NULL) 19 18 return; 20 19 20 if (dir != TRACE_DIR_INCOMING && dir != TRACE_DIR_OUTGOING) 21 dir = TRACE_DIR_OTHER; 22 21 23 prot_stat[dir][proto].count++; 22 24 prot_stat[dir][proto].bytes+=trace_get_wire_length(packet); … … 28 30 int i; 29 31 printf("%-20s","Direction:"); 30 for(i=0;i< 4;i++){32 for(i=0;i<3;i++){ 31 33 if(!suppress[i]){ 32 34 switch(i){ … … 47 49 printf("\n"); 48 50 printf("%-20s","Protocol"); 49 for(i=0;i< 4;i++){51 for(i=0;i<3;i++){ 50 52 if(!suppress[i]){ 51 53 printf("\t%12s\t%12s", "bytes","packets"); … … 69 71 if (prot) { 70 72 printf("%20s",prot->p_name); 71 for(j=0;j< 4;j++){73 for(j=0;j<3;j++){ 72 74 if (prot_stat[j][i].count==0){ 73 75 if(!suppress[j]) … … 82 84 else { 83 85 printf("%20i:",i); 84 for(j=0;j< 4;j++){86 for(j=0;j<3;j++){ 85 87 if (prot_stat[j][i].count==0){ 86 88 if(!suppress[j]) -
tools/tracereport/tcpsegment_report.c
r09be643 rb5dc60d 6 6 #include "tracereport.h" 7 7 8 static stat_t tcpseg_stat[ 4][2048] = {{{0,0}}} ;9 static bool suppress[ 4] = {true,true,true,true};8 static stat_t tcpseg_stat[3][2048] = {{{0,0}}} ; 9 static bool suppress[3] = {true,true,true}; 10 10 11 11 void tcpseg_per_packet(struct libtrace_packet_t *packet) 12 12 { 13 13 struct libtrace_tcp *tcp = trace_get_tcp(packet); 14 libtrace_direction_t dir = trace_get_direction(packet); 15 int payload, tcplen, ss; 16 14 17 if (!tcp) 15 18 return; 16 int dir = trace_get_direction(packet); 17 if (dir < 0 || dir > 1)18 dir = 2;19 20 if (dir != TRACE_DIR_INCOMING && dir != TRACE_DIR_OUTGOING) 21 dir = TRACE_DIR_OTHER; 19 22 20 int a = trace_get_wire_length(packet); 21 a -= 34; 23 payload = trace_get_wire_length(packet) - trace_get_capture_length(packet); 24 tcplen = tcp->doff * 4; 25 ss = payload + tcplen; 22 26 23 tcpseg_stat[dir][ a].count++;24 tcpseg_stat[dir][ a].bytes+=trace_get_wire_length(packet);27 tcpseg_stat[dir][ss].count++; 28 tcpseg_stat[dir][ss].bytes+=trace_get_wire_length(packet); 25 29 suppress[dir] = false; 26 30 } … … 30 34 int i; 31 35 printf("%-20s","Direction:"); 32 for(i=0;i< 4;i++){36 for(i=0;i<3;i++){ 33 37 if(!suppress[i]){ 34 38 switch(i){ … … 49 53 printf("\n"); 50 54 printf("%-20s","TCP SS"); 51 for(i=0;i< 4;i++){55 for(i=0;i<3;i++){ 52 56 if(!suppress[i]){ 53 57 printf("\t%12s\t%12s", "bytes","packets"); … … 67 71 continue; 68 72 printf("%20i:",i); 69 for(j=0;j< 4;j++){73 for(j=0;j<3;j++){ 70 74 if (tcpseg_stat[j][i].count==0){ 71 75 if(!suppress[j]) -
tools/tracereport/tos_report.c
r09be643 rb5dc60d 6 6 #include "tracereport.h" 7 7 8 static stat_t tos_stat[ 4][256] = {{{0,0}}} ;9 static bool suppress[ 4] = {true,true,true,true};8 static stat_t tos_stat[3][256] = {{{0,0}}} ; 9 static bool suppress[3] = {true,true,true}; 10 10 11 11 void tos_per_packet(struct libtrace_packet_t *packet) 12 12 { 13 13 struct libtrace_ip *ip = trace_get_ip(packet); 14 libtrace_direction_t dir = trace_get_direction(packet); 15 14 16 if (!ip) 15 17 return; 16 int dir = trace_get_direction(packet); 17 if(dir < 0 || dir > 1) 18 dir = 2; 18 19 if (dir != TRACE_DIR_INCOMING && dir != TRACE_DIR_OUTGOING) 20 dir = TRACE_DIR_OTHER; 21 19 22 tos_stat[dir][ip->ip_tos].count++; 20 23 tos_stat[dir][ip->ip_tos].bytes+=trace_get_wire_length(packet); … … 26 29 int i; 27 30 printf("%-20s","Direction:"); 28 for(i=0;i< 4;i++){31 for(i=0;i<3;i++){ 29 32 if(!suppress[i]){ 30 33 switch(i){ … … 45 48 printf("\n"); 46 49 printf("%-20s","ToS"); 47 for(i=0;i< 4;i++){50 for(i=0;i<3;i++){ 48 51 if(!suppress[i]){ 49 52 printf("\t%12s\t%12s", "bytes","packets"); … … 63 66 continue; 64 67 printf("%20i:",i); 65 for(j=0;j< 4;j++){68 for(j=0;j<3;j++){ 66 69 if (tos_stat[j][i].count==0){ 67 70 if(!suppress[j]) -
tools/tracereport/tracereport.c
r4eec8dc rb5dc60d 104 104 if (reports_required & REPORT_TYPE_ECN) 105 105 ecn_per_packet(packet); 106 /* 107 if (reports_required & REPORT_TYPE_TCPSEQ) 106 if (reports_required & REPORT_TYPE_TCPSEG) 108 107 tcpseg_per_packet(packet); 109 */110 108 } 111 109 trace_destroy(trace); … … 242 240 if (reports_required & REPORT_TYPE_ECN) 243 241 ecn_report(); 244 /*245 242 if (reports_required & REPORT_TYPE_TCPSEG) 246 243 tcpseg_report(); 247 */248 244 return 0; 249 245 } -
tools/tracereport/ttl_report.c
r09be643 rb5dc60d 6 6 #include "tracereport.h" 7 7 8 static stat_t ttl_stat[ 4][256] = {{{0,0}}} ;9 static bool suppress[ 4] = {true,true,true,true};8 static stat_t ttl_stat[3][256] = {{{0,0}}} ; 9 static bool suppress[3] = {true,true,true}; 10 10 11 11 void ttl_per_packet(struct libtrace_packet_t *packet) 12 12 { 13 13 struct libtrace_ip *ip = trace_get_ip(packet); 14 libtrace_direction_t dir = trace_get_direction(packet); 15 14 16 if (!ip) 15 17 return; 16 int dir = trace_get_direction(packet); 17 if(dir < 0 || dir > 1) 18 dir = 2; 18 19 if (dir != TRACE_DIR_INCOMING && dir != TRACE_DIR_OUTGOING) 20 dir = TRACE_DIR_OTHER; 21 19 22 ttl_stat[dir][ip->ip_ttl].count++; 20 23 ttl_stat[dir][ip->ip_ttl].bytes+=trace_get_wire_length(packet); … … 26 29 int i; 27 30 printf("%-20s","Direction:"); 28 for(i=0;i< 4;i++){31 for(i=0;i<3;i++){ 29 32 if(!suppress[i]){ 30 33 switch(i){ … … 45 48 printf("\n"); 46 49 printf("%-20s","TTL"); 47 for(i=0;i< 4;i++){50 for(i=0;i<3;i++){ 48 51 if(!suppress[i]){ 49 52 printf("\t%12s\t%12s", "bytes","packets"); … … 63 66 continue; 64 67 printf("%20i:",i); 65 for(j=0;j< 4;j++){68 for(j=0;j<3;j++){ 66 69 if (ttl_stat[j][i].count==0){ 67 70 if(!suppress[j])
Note: See TracChangeset
for help on using the changeset viewer.