From: Bernd Petrovitsch Date: Sun, 22 Apr 2007 19:54:31 +0000 (+0000) Subject: * committed txtinfo patch by Jo-Philipp Wich X-Git-Tag: OLSRD_0_5_1~59 X-Git-Url: http://olsr.org/git/?p=olsrd.git;a=commitdiff_plain;h=29ec867fd5352ffe818262aef058f75e8cd028ac * committed txtinfo patch by Jo-Philipp Wich --- diff --git a/lib/txtinfo/src/olsrd_txtinfo.c b/lib/txtinfo/src/olsrd_txtinfo.c index 98540e7a..e9f73d78 100644 --- a/lib/txtinfo/src/olsrd_txtinfo.c +++ b/lib/txtinfo/src/olsrd_txtinfo.c @@ -40,7 +40,7 @@ * to the project. For more information see the website or contact * the copyright holders. * - * $Id: olsrd_txtinfo.c,v 1.3 2007/04/20 13:46:04 bernd67 Exp $ + * $Id: olsrd_txtinfo.c,v 1.4 2007/04/22 19:54:31 bernd67 Exp $ */ /* @@ -113,6 +113,9 @@ ipc_print_topology(void); static void ipc_print_hna(void); +static void +ipc_print_mid(void); + #define TXT_IPC_BUFSIZE 256 static int ipc_sendf(const char* format, ...) __attribute__((format(printf, 1, 2))); @@ -485,6 +488,46 @@ ipc_print_hna(void) } +static void +ipc_print_mid(void) +{ + olsr_u8_t index; + unsigned short is_first; + struct mid_entry *entry; + struct mid_address *alias; + + ipc_sendf("Table: MID\nIP\tAliases\n"); + + /* MID */ + for( index = 0; index < HASHSIZE; index++ ) + { + entry = mid_set[index].next; + + while( entry != &mid_set[index] ) + { + ipc_sendf( olsr_ip_to_string( &entry->main_addr ) ); + alias = entry->aliases; + is_first = 1; + + while( alias ) + { + ipc_sendf( "%s%s", + ( is_first ? "\t" : ";" ), + olsr_ip_to_string( &alias->alias ) + ); + + alias = alias->next_alias; + is_first = 0; + } + + entry = entry->next; + ipc_sendf("\n"); + } + } + + ipc_sendf("\n"); +} + static void send_info(int neighonly) @@ -505,6 +548,9 @@ send_info(int neighonly) /* hna */ if (!neighonly) ipc_print_hna(); + /* mid */ + if (!neighonly) ipc_print_mid(); + /* routes */ if (!neighonly) ipc_print_routes(); }