Commit ebf6f6f5 authored by Kevin Bracey's avatar Kevin Bracey
Browse files

Changed to output graphs in Graphlet format, rather than GraphEd.

GraphEd is obsolete - Graphlet is its replacement.
parent c5293750
...@@ -22,7 +22,7 @@ RM= remove ...@@ -22,7 +22,7 @@ RM= remove
WFLAGS= fr~c~v WFLAGS= fr~c~v
WIPE= -wipe WIPE= -wipe
CFLAGS= -Wp -I$(INCLUDES) -c ${THROWBACK} -depend !Depend CFLAGS= -Wp -I$(INCLUDES) -DGRAPHLET -c ${THROWBACK} -depend !Depend
OBJS= o.${TARGET} o.igmp o.inet o.kern OBJS= o.${TARGET} o.igmp o.inet o.kern
......
...@@ -721,6 +721,8 @@ void print_map(node) ...@@ -721,6 +721,8 @@ void print_map(node)
printf("/disabled"); printf("/disabled");
if (flags & DVMRP_NF_DOWN) if (flags & DVMRP_NF_DOWN)
printf("/down"); printf("/down");
if (flags & DVMRP_NF_LEAF)
printf("/leaf");
} }
printf("]\n"); printf("]\n");
count++; count++;
...@@ -767,7 +769,18 @@ void graph_edges(node) ...@@ -767,7 +769,18 @@ void graph_edges(node)
if (node) { if (node) {
graph_edges(node->left); graph_edges(node->left);
if (node->tries >= 0) { if (node->tries >= 0) {
#ifdef GRAPHLET
printf(" node [\n"
" id %d\n"
" graphics [\n"
" x %d0.0\n"
" y %d0.0\n"
" ]\n"
" label \"%s%s\"\n"
" ]\n",
#else
printf(" %d {$ NP %d0 %d0 $} \"%s%s\" \n", printf(" %d {$ NP %d0 %d0 $} \"%s%s\" \n",
#endif
(int) node->addr, (int) node->addr,
node->addr & 0xFF, (node->addr >> 8) & 0xFF, node->addr & 0xFF, (node->addr >> 8) & 0xFF,
graph_name(node->addr, name, sizeof(name)), graph_name(node->addr, name, sizeof(name)),
...@@ -783,8 +796,17 @@ void graph_edges(node) ...@@ -783,8 +796,17 @@ void graph_edges(node)
if (node != nb_node && if (node != nb_node &&
(!(nb2 = find_neighbor(node->addr, nb_node)) (!(nb2 = find_neighbor(node->addr, nb_node))
|| node->addr < nb_node->addr)) { || node->addr < nb_node->addr)) {
#ifdef GRAPHLET
printf(" edge [\n"
" source %d\n"
" target %d\n"
" label \"%d/%d",
node->addr, nb_node->addr,
nb->metric, nb->threshold);
#else
printf(" %d \"%d/%d", printf(" %d \"%d/%d",
nb_node->addr, nb->metric, nb->threshold); nb_node->addr, nb->metric, nb->threshold);
#endif
if (nb2 && (nb2->metric != nb->metric if (nb2 && (nb2->metric != nb->metric
|| nb2->threshold != nb->threshold)) || nb2->threshold != nb->threshold))
printf(",%d/%d", nb2->metric, nb2->threshold); printf(",%d/%d", nb2->metric, nb2->threshold);
...@@ -793,10 +815,17 @@ void graph_edges(node) ...@@ -793,10 +815,17 @@ void graph_edges(node)
nb->flags & DVMRP_NF_SRCRT ? "" : nb->flags & DVMRP_NF_SRCRT ? "" :
nb->flags & DVMRP_NF_TUNNEL ? "E" : "P", nb->flags & DVMRP_NF_TUNNEL ? "E" : "P",
nb->flags & DVMRP_NF_DOWN ? "D" : ""); nb->flags & DVMRP_NF_DOWN ? "D" : "");
#ifdef GRAPHLET
printf("\"\n"
" ]\n");
#else
printf("\"\n"); printf("\"\n");
#endif
} }
} }
#ifndef GRAPHLET
printf(" ;\n"); printf(" ;\n");
#endif
} }
graph_edges(node->right); graph_edges(node->right);
} }
...@@ -832,10 +861,20 @@ void graph_map() ...@@ -832,10 +861,20 @@ void graph_map()
nowstr[24] = '\0'; /* Kill the newline at the end */ nowstr[24] = '\0'; /* Kill the newline at the end */
elide_aliases(routers); elide_aliases(routers);
#ifdef GRAPHLET
printf("graph [\n"
" label \"Multicast Router Connectivity: %s\"\n",
nowstr);
#else
printf("GRAPH \"Multicast Router Connectivity: %s\" = UNDIRECTED\n", printf("GRAPH \"Multicast Router Connectivity: %s\" = UNDIRECTED\n",
nowstr); nowstr);
#endif
graph_edges(routers); graph_edges(routers);
#ifdef GRAPHLET
printf("]\n");
#else
printf("END\n"); printf("END\n");
#endif
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment