[Olsr-cvs] olsrd-current/lib/dot_draw/src olsrd_dot_draw.c, 1.17, 1.18
Andreas T�nnesen
(spam-protected)
Tue Nov 8 12:24:06 CET 2005
Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28602/dot_draw/src
Modified Files:
olsrd_dot_draw.c
Log Message:
Added patch by Bernd Petrovitsch
Index: olsrd_dot_draw.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_dot_draw.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** olsrd_dot_draw.c 13 Jul 2005 21:43:16 -0000 1.17
--- olsrd_dot_draw.c 8 Nov 2005 11:24:04 -0000 1.18
***************
*** 78,85 ****
! int ipc_socket;
! int ipc_open;
! int ipc_connection;
! int ipc_socket_up;
--- 78,86 ----
! static int ipc_socket;
! static int ipc_open;
! static int ipc_connection;
! static int ipc_socket_up;
!
***************
*** 110,113 ****
--- 111,117 ----
ipc_send(char *, int);
+ static int
+ ipc_send_str(char *);
+
static double
calc_etx(double, double);
***************
*** 152,156 ****
{
char buf[256];
- int len;
char* adr;
double etx=0.0;
--- 156,159 ----
***************
*** 158,163 ****
struct link_entry* link;
adr = olsr_ip_to_string(&main_addr);
! len = sprintf( buf, "\"%s\" -> ", adr );
! ipc_send(buf, len);
adr = olsr_ip_to_string(&neighbor->neighbor_main_addr);
--- 161,166 ----
struct link_entry* link;
adr = olsr_ip_to_string(&main_addr);
! sprintf( buf, "\"%s\" -> ", adr );
! ipc_send_str(buf);
adr = olsr_ip_to_string(&neighbor->neighbor_main_addr);
***************
*** 173,182 ****
}
! len = sprintf( buf, "\"%s\"[label=\"%.2f\", style=%s];\n", adr, etx, style );
! ipc_send(buf, len);
if (neighbor->is_mpr) {
! len = sprintf( buf, "\"%s\"[shape=box];\n", adr );
! ipc_send(buf, len);
}
}
--- 176,185 ----
}
! sprintf( buf, "\"%s\"[label=\"%.2f\", style=%s];\n", adr, etx, style );
! ipc_send_str(buf);
if (neighbor->is_mpr) {
! sprintf( buf, "\"%s\"[shape=box];\n", adr );
! ipc_send_str(buf);
}
}
***************
*** 311,315 ****
/* Print tables to IPC socket */
! ipc_send("digraph topology\n{\n", strlen("digraph topology\n{\n"));
/* Neighbors */
--- 314,318 ----
/* Print tables to IPC socket */
! ipc_send_str("digraph topology\n{\n");
/* Neighbors */
***************
*** 366,370 ****
! ipc_send("}\n\n", strlen("}\n\n"));
res = 1;
--- 369,373 ----
! ipc_send_str("}\n\n");
res = 1;
***************
*** 394,408 ****
{
char buf[256];
- int len;
char* adr;
double etx = calc_etx( dst_entry->link_quality, dst_entry->inverse_link_quality );
adr = olsr_ip_to_string(&entry->T_last_addr);
! len = sprintf( buf, "\"%s\" -> ", adr );
! ipc_send(buf, len);
adr = olsr_ip_to_string(&dst_entry->T_dest_addr);
! len = sprintf( buf, "\"%s\"[label=\"%.2f\"];\n", adr, etx );
! ipc_send(buf, len);
}
--- 397,410 ----
{
char buf[256];
char* adr;
double etx = calc_etx( dst_entry->link_quality, dst_entry->inverse_link_quality );
adr = olsr_ip_to_string(&entry->T_last_addr);
! sprintf( buf, "\"%s\" -> ", adr );
! ipc_send_str(buf);
adr = olsr_ip_to_string(&dst_entry->T_dest_addr);
! sprintf( buf, "\"%s\"[label=\"%.2f\"];\n", adr, etx );
! ipc_send_str(buf);
}
***************
*** 414,434 ****
adr = olsr_ip_to_string(gw);
! ipc_send("\"", 1);
! ipc_send(adr, strlen(adr));
! ipc_send("\" -> \"", strlen("\" -> \""));
adr = olsr_ip_to_string(net);
! ipc_send(adr, strlen(adr));
! ipc_send("/", 1);
adr = olsr_netmask_to_string(mask);
! ipc_send(adr, strlen(adr));
! ipc_send("\"[label=\"HNA\"];\n", strlen("\"[label=\"HNA\"];\n"));
! ipc_send("\"", 1);
adr = olsr_ip_to_string(net);
! ipc_send(adr, strlen(adr));
! ipc_send("/", 1);
adr = olsr_netmask_to_string(mask);
! ipc_send(adr, strlen(adr));
! ipc_send("\"", 1);
! ipc_send("[shape=diamond];\n", strlen("[shape=diamond];\n"));
}
--- 416,444 ----
adr = olsr_ip_to_string(gw);
! ipc_send_str("\"");
! ipc_send_str(adr);
! ipc_send_str("\" -> \"");
adr = olsr_ip_to_string(net);
! ipc_send_str(adr);
! ipc_send_str("/");
adr = olsr_netmask_to_string(mask);
! ipc_send_str(adr);
! ipc_send_str("\"[label=\"HNA\"];\n");
! ipc_send_str("\"");
adr = olsr_ip_to_string(net);
! ipc_send_str(adr);
! ipc_send_str("/");
adr = olsr_netmask_to_string(mask);
! ipc_send_str(adr);
! ipc_send_str("\"");
! ipc_send_str("[shape=diamond];\n");
! }
!
! static int
! ipc_send_str(char *data)
! {
! if(!ipc_open)
! return 0;
! return ipc_send(data, strlen(data));
}
***************
*** 455,461 ****
}
-
- static char netmask[5];
-
static char*
olsr_netmask_to_string(union hna_netmask *mask)
--- 465,468 ----
***************
*** 468,479 ****
in.s_addr = mask->v4;
ret = inet_ntoa(in);
- return ret;
-
}
else
{
/* IPv6 */
sprintf(netmask, "%d", mask->v6);
! return netmask;
}
--- 475,485 ----
in.s_addr = mask->v4;
ret = inet_ntoa(in);
}
else
{
/* IPv6 */
+ static char netmask[5];
sprintf(netmask, "%d", mask->v6);
! ret = netmask;
}
More information about the Olsr-cvs
mailing list