static void show_basic(CnetEvent ev, CnetTimer timer, CnetData data) { NL_TABLE *tp; int t; CNET_clear(); printf("\n%14s %14s %14s %14s\n", "destination","ackexpected","nextpackettosend", "packetexpected"); for(t=0, tp=table ; t<table_size ; ++t, ++tp) printf("%14d %14d %14d %14d\n", (int)tp->destaddr, tp->ackexpected, tp->nextpackettosend, tp->packetexpected); }
static void show_table(CnetEvent ev, CnetTimer timer, CnetData data) { int t, n; CNET_clear(); printf("\n%14s %14s %14s %14s %14s\n", "destination","packets-ack'ed","min-hops","minhop-link", "round-trip-time"); for(t=0 ; t<table_size ; ++t) if((n = table[t].ackexpected) > 0) { CnetInt64 avtime; int64_I2L(avtime, n); int64_DIV(avtime, table[t].totaltime, avtime); printf("%14d %14d %14ld %14ld %14s\n", (int)table[t].address, table[t].ackexpected, table[t].minhops, table[t].minhop_link, int64_L2A(avtime,0)); } }
static EVENT_HANDLER( show_NL_table) { CNET_clear(); printf("\n%12s %12s %12s %12s", "destination", "ackexpected", "nextpkttosend", "pktexpected"); if (given_stats) printf(" %8s %8s", "minhops", "bestlink"); printf("\n"); for (int t = 0; t < NL_table_size; ++t) if (NL_table[t].address != nodeinfo.address) { printf("%12d %12d %12d %12d", (int) NL_table[t].address, NL_table[t].ackexpected, NL_table[t].nextpackettosend, NL_table[t].packetexpected); if (NL_table[t].minhop_link != 0) printf(" %8d %8d", NL_table[t].minhops, NL_table[t].minhop_link); printf("\n"); //if(NL_table[t].lastpacket){ //printf("last packet sent = %d\n", NL_table[t].lastpacket->seqno); //} } }
static EVENT_HANDLER(show_NL_table) { CNET_clear(); printf("Node #%3d table\n",nodeinfo.nodenumber); printf("%8s %8s %8s\n","Dest","Cost","Next Link"); int i, j; for (i = 0; i < (NNODES+1); i++) { printf("%8d",i); for (j = 0; j < 2; j++) { printf("%8d", NL_routingtable[j][i]); } printf("\n"); } printf("Full table from: \n"); for (i = 0; i < (NNODES+1); i++) { for (j = 0; j < (NNODES+1); j++) { printf("%9d", NL_fullroutingtable[i][j]); } printf("\n"); } }
static void show_detailed(CnetEvent ev, CnetTimer timer, CnetData data) { NL_TABLE *tp; int t; CNET_clear(); printf("\n%14s %14s %14s %14s %14s\n", "destination","packets-ack'ed","min-hops","minhop-link", "round-trip-time"); for(t=0, tp=table ; t<table_size ; ++t, ++tp) if(tp->ackexpected > 0) { CnetInt64 avtime; printf("%14d %14d %14d", (int)tp->destaddr, tp->ackexpected, tp->minhops); if(tp->minhop_link == ALL_LINKS) printf(" %14s", "ALL-LINKS"); else printf(" %14d", tp->minhop_link); int64_I2L(avtime, tp->ackexpected); int64_DIV(avtime, tp->totaltime, avtime); printf(" %14s\n", int64_L2A(avtime,0)); } }