Exemple #1
0
static void print_link_attr(int always, LINKATTR *cmp, LINKATTR *la, int curly)
{
    char *m;

    if(memcmp((char *)cmp, (char *)la, sizeof(LINKATTR)) == 0)
	return;
    if(always)		m = "";
    else if(curly)	m = "\t";
    else		m = "    ";

    if(curly)
	fputs("{\n",topfp);
    if(always || (la->bandwidth != DEFAULT && 
		  la->bandwidth != cmp->bandwidth))
	fprintf(topfp,"%sbandwidth\t\t= %dbps\n", m,la->bandwidth);
    if(always || (la->costperbyte != DEFAULT && 
		  la->costperbyte != cmp->costperbyte))
	fprintf(topfp,"%scostperbyte\t\t= %d\n",m,la->costperbyte);
    if(always || (la->costperframe != DEFAULT && 
		  la->costperframe != cmp->costperframe))
	fprintf(topfp,"%scostperframe\t\t= %d\n",m,la->costperframe);
    if(always || (la->probframecorrupt != DEFAULT && 
		  la->probframecorrupt != cmp->probframecorrupt))
	fprintf(topfp,"%sprobframecorrupt\t= %d\n",
					m,la->probframecorrupt);
    if(always || (la->probframeloss != DEFAULT && 
		  la->probframeloss != cmp->probframeloss))
	fprintf(topfp,"%sprobframeloss\t\t= %d\n",m,la->probframeloss);
    if(always || (la->transmitbufsize != DEFAULT && 
		  la->transmitbufsize != cmp->transmitbufsize))
	fprintf(topfp,"%stransmitbufsize\t\t= %dbytes\n",
					m,la->transmitbufsize);

    if(always || (int64_NE(la->propagationdelay, DEFAULT64) && 
		  int64_NE(la->propagationdelay, cmp->propagationdelay)))
	fprintf(topfp,"%spropagationdelay\t= %susec\n",
				    m,int64_L2A(la->propagationdelay,0));

    if(always || (int64_NE(la->linkmtbf, DEFAULT64) && 
		  int64_NE(la->linkmtbf, cmp->linkmtbf)))
	fprintf(topfp,"%slinkmtbf\t\t= %susec\n", m,int64_L2A(la->linkmtbf,0));
    if(always || (int64_NE(la->linkmttr, DEFAULT64) && 
		  int64_NE(la->linkmttr, cmp->linkmttr)))
	fprintf(topfp,"%slinkmttr\t\t= %susec\n", m,int64_L2A(la->linkmttr,0));
    if(curly)
	fputs("    }",topfp);
}
Exemple #2
0
static void print_node_attr(int always, NODEATTR *na, char *m)
{
    if(always || strcmp(na->compile,DEFAULTNODE.compile) != 0)
	fprintf(topfp,"%scompile\t\t\t= \"%s\"\n",m,na->compile);
    if(always || strcmp(na->reboot_func,DEFAULTNODE.reboot_func) != 0)
	fprintf(topfp,"%srebootfunc\t\t= \"%s\"\n",m,na->reboot_func);

    if(always || na->minmessagesize != DEFAULT)
	fprintf(topfp,"%sminmessagesize\t\t= %dbytes\n",
						m,na->minmessagesize);
    if(always || na->maxmessagesize != DEFAULT)
	fprintf(topfp,"%smaxmessagesize\t\t= %dbytes\n",
						m,na->maxmessagesize);

    if(always || int64_NE(na->messagerate, DEFAULT64))
       fprintf(topfp,"%smessagerate\t\t= %susec\n",
						m,int64_L2A(na->messagerate,0));

    if(always || int64_NE(na->nodemtbf, DEFAULT64))
	fprintf(topfp,"%snodemtbf\t\t= %susec\n", m,int64_L2A(na->nodemtbf,0));

    if(always || int64_NE(na->nodemttr, DEFAULT64))
	fprintf(topfp,"%snodemttr\t\t= %susec\n", m,int64_L2A(na->nodemttr,0));
}
Exemple #3
0
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));
        }
}
Exemple #4
0
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));
	}
}