Added pause functionality.

This commit is contained in:
pdw
2002-10-10 17:18:40 +00:00
parent 164fd7ef9f
commit 6ba321dd8e
5 changed files with 14 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ Minor fix to rate display
Minor fix to netmask handling (specifying /32 was broken) Minor fix to netmask handling (specifying /32 was broken)
Updated RPM spec file Updated RPM spec file
Iain Lea <iain@bricbrac.de> Iain Lea <iain@bricbrac.de>
Added pause functionality (P)
0.7 02/10/02 0.7 02/10/02

View File

@@ -27,7 +27,7 @@ MANDIR = man
#MANDIR = share/man # FHS-ish #MANDIR = share/man # FHS-ish
# You shouldn't need to change anything below this point. # You shouldn't need to change anything below this point.
VERSION = 0.8pre1 VERSION = 0.8pre2
CFLAGS += -g -Wall "-DIFTOP_VERSION=\"$(VERSION)\"" CFLAGS += -g -Wall "-DIFTOP_VERSION=\"$(VERSION)\""
LDFLAGS += -g LDFLAGS += -g
LDLIBS += -lpcap -lpthread -lcurses -lm LDLIBS += -lpcap -lpthread -lcurses -lm

View File

@@ -69,6 +69,7 @@ static void set_defaults() {
options.showports = OPTION_PORTS_OFF; options.showports = OPTION_PORTS_OFF;
options.aggregate_src = 0; options.aggregate_src = 0;
options.aggregate_dest = 0; options.aggregate_dest = 0;
options.paused = 0;
} }
static void die(char *msg) { static void die(char *msg) {
@@ -137,7 +138,8 @@ static void usage(FILE *fp) {
" -n net/mask show traffic flows in/out of network\n" " -n net/mask show traffic flows in/out of network\n"
" -P show ports as well as hosts\n" " -P show ports as well as hosts\n"
"\n" "\n"
"iftop, version " IFTOP_VERSION " copyright (c) 2002 Paul Warren <pdw@ex-parrot.com>\n" "iftop, version " IFTOP_VERSION "\n"
"copyright (c) 2002 Paul Warren <pdw@ex-parrot.com> and contributors\n"
); );
} }

View File

@@ -40,6 +40,7 @@ typedef struct {
option_port_t showports; option_port_t showports;
int aggregate_src; int aggregate_src;
int aggregate_dest; int aggregate_dest;
int paused;
} options_t; } options_t;

9
ui.c
View File

@@ -194,6 +194,10 @@ void analyse_data() {
hash_node_type* n = NULL; hash_node_type* n = NULL;
int i; int i;
if(options.paused == 0) {
return;
}
memset(&totals, 0, sizeof totals); memset(&totals, 0, sizeof totals);
screen_data_clear(); screen_data_clear();
@@ -491,7 +495,7 @@ void ui_loop() {
tick(1); tick(1);
break; break;
case 'b': case 'b':
options.showbars = !options.showbars; options.showbars = !options.showbars;
tick(1); tick(1);
break; break;
@@ -540,6 +544,9 @@ void ui_loop() {
: OPTION_PORTS_OFF; : OPTION_PORTS_OFF;
// Don't tick here, otherwise we get a bogus display // Don't tick here, otherwise we get a bogus display
break; break;
case 'P':
options.paused = !options.paused;
break;
} }
tick(0); tick(0);
} }