Skip to content

Commit

Permalink
txtinfo plugin: query /version URL to have olsrd version printed out
Browse files Browse the repository at this point in the history
  • Loading branch information
Saverio Proto authored and zioproto committed May 24, 2012
1 parent d14c696 commit 6013658
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/txtinfo/src/olsrd_txtinfo.c
Expand Up @@ -126,6 +126,7 @@ static void ipc_print_interface(struct autobuf *);
#define SIW_INTERFACE 0x0080
#define SIW_CONFIG 0x0100
#define SIW_2HOP 0x0200
#define SIW_VERSION 0x0400

/* ALL = neigh link route hna mid topo */
#define SIW_ALL 0x003F
Expand Down Expand Up @@ -317,6 +318,7 @@ ipc_action(int fd, void *data __attribute__ ((unused)), unsigned int flags __att
}
if (0 != strstr(requ, "/gat")) send_what |= SIW_GATEWAY;
if (0 != strstr(requ, "/con")) send_what |= SIW_CONFIG;
if (0 != strstr(requ, "/version")) send_what |= SIW_VERSION;
if (0 != strstr(requ, "/int")) send_what |= SIW_INTERFACE;
if (0 != strstr(requ, "/2ho")) send_what |= SIW_2HOP;
}
Expand Down Expand Up @@ -614,6 +616,11 @@ ipc_print_config(struct autobuf *abuf)
olsrd_write_cnf_autobuf(abuf, olsr_cnf);
}

static void
ipc_print_version(struct autobuf *abuf)
{
abuf_appendf(abuf, "Version: %s (built on %s on %s)\n", olsrd_version, build_date, build_host);
}
static void
ipc_print_interface(struct autobuf *abuf)
{
Expand Down Expand Up @@ -725,6 +732,8 @@ send_info(unsigned int send_what, int the_socket)
if ((send_what & SIW_GATEWAY) == SIW_GATEWAY) ipc_print_gateway(&abuf);
/* config */
if ((send_what & SIW_CONFIG) == SIW_CONFIG) ipc_print_config(&abuf);
/* version */
if ((send_what & SIW_VERSION) == SIW_VERSION) ipc_print_version(&abuf);
/* interface */
if ((send_what & SIW_INTERFACE) == SIW_INTERFACE) ipc_print_interface(&abuf);
/* 2hop neighbour list */
Expand Down

0 comments on commit 6013658

Please sign in to comment.