/*
tincctl.c -- Controlling a running tincd
- Copyright (C) 2007-2009 Guus Sliepen <guus@tinc-vpn.org>
+ Copyright (C) 2007-2011 Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "control_common.h"
#include "rsagen.h"
#include "utils.h"
+#include "tincctl.h"
+#include "top.h"
/* The name this program was run with. */
char *program_name = NULL;
" retry Retry all outgoing connections\n"
" reload Partial reload of configuration\n"
" disconnect NODE Close meta connection with NODE\n"
+#ifdef HAVE_CURSES
+ " top Show real-time statistics\n"
+#endif
"\n");
printf("Report bugs to tinc@tinc-vpn.org.\n");
}
}
}
-static bool recvline(int fd, char *line, size_t len) {
+bool recvline(int fd, char *line, size_t len) {
static char buffer[4096];
static size_t blen = 0;
char *newline = NULL;
return true;
}
-static bool sendline(int fd, char *format, ...) {
+bool sendline(int fd, char *format, ...) {
static char buffer[4096];
char *p = buffer;
size_t blen = 0;
return 0;
}
+#ifdef HAVE_CURSES
+ if(!strcasecmp(argv[optind], "top")) {
+ top(fd);
+ return 0;
+ }
+#endif
+
fprintf(stderr, "Unknown command `%s'.\n", argv[optind]);
usage(true);