Changed src/host aggregation behaviour to be more like port option. Now

possible to aggregate both src and dest to allow port only display.
This commit is contained in:
pdw
2002-10-10 16:22:56 +00:00
parent 0359367dfc
commit 164fd7ef9f
3 changed files with 12 additions and 16 deletions

View File

@@ -67,7 +67,8 @@ static void set_defaults() {
options.promiscuous = 0; options.promiscuous = 0;
options.showbars = 1; options.showbars = 1;
options.showports = OPTION_PORTS_OFF; options.showports = OPTION_PORTS_OFF;
options.aggregate = OPTION_AGGREGATE_OFF; options.aggregate_src = 0;
options.aggregate_dest = 0;
} }
static void die(char *msg) { static void die(char *msg) {

View File

@@ -38,7 +38,8 @@ typedef struct {
int promiscuous; int promiscuous;
int showbars; int showbars;
option_port_t showports; option_port_t showports;
option_aggregate_t aggregate; int aggregate_src;
int aggregate_dest;
} options_t; } options_t;

22
ui.c
View File

@@ -209,12 +209,12 @@ void analyse_data() {
ap = *(addr_pair*)n->key; ap = *(addr_pair*)n->key;
/* Aggregate hosts, if required */ /* Aggregate hosts, if required */
if(options.aggregate == OPTION_AGGREGATE_SRC) { if(options.aggregate_src) {
ap.dst.s_addr = 0;
}
else if(options.aggregate == OPTION_AGGREGATE_DEST) {
ap.src.s_addr = 0; ap.src.s_addr = 0;
} }
if(options.aggregate_dest) {
ap.dst.s_addr = 0;
}
/* Aggregate ports, if required */ /* Aggregate ports, if required */
if(options.showports == OPTION_PORTS_DEST || options.showports == OPTION_PORTS_OFF) { if(options.showports == OPTION_PORTS_DEST || options.showports == OPTION_PORTS_OFF) {
@@ -362,13 +362,13 @@ void ui_print() {
attron(A_REVERSE); attron(A_REVERSE);
addstr(" s "); addstr(" s ");
attroff(A_REVERSE); attroff(A_REVERSE);
addstr(options.aggregate == OPTION_AGGREGATE_SRC ? " aggregate off " addstr(options.aggregate_src ? " aggregate off "
: " aggregate src "); : " aggregate src ");
attron(A_REVERSE); attron(A_REVERSE);
addstr(" d "); addstr(" d ");
attroff(A_REVERSE); attroff(A_REVERSE);
addstr(options.aggregate == OPTION_AGGREGATE_DEST ? " aggregate off " addstr(options.aggregate_dest ? " aggregate off "
: " aggregate dest "); : " aggregate dest ");
draw_bar_scale(&y); draw_bar_scale(&y);
@@ -497,17 +497,11 @@ void ui_loop() {
break; break;
case 's': case 's':
options.aggregate = options.aggregate_src = !options.aggregate_src;
(options.aggregate == OPTION_AGGREGATE_SRC)
? OPTION_AGGREGATE_OFF
: OPTION_AGGREGATE_SRC;
break; break;
case 'd': case 'd':
options.aggregate = options.aggregate_dest = !options.aggregate_dest;
(options.aggregate == OPTION_AGGREGATE_DEST)
? OPTION_AGGREGATE_OFF
: OPTION_AGGREGATE_DEST;
break; break;
case 'S': case 'S':
/* Show source ports */ /* Show source ports */