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:
@@ -67,7 +67,8 @@ static void set_defaults() {
|
||||
options.promiscuous = 0;
|
||||
options.showbars = 1;
|
||||
options.showports = OPTION_PORTS_OFF;
|
||||
options.aggregate = OPTION_AGGREGATE_OFF;
|
||||
options.aggregate_src = 0;
|
||||
options.aggregate_dest = 0;
|
||||
}
|
||||
|
||||
static void die(char *msg) {
|
||||
|
||||
@@ -38,7 +38,8 @@ typedef struct {
|
||||
int promiscuous;
|
||||
int showbars;
|
||||
option_port_t showports;
|
||||
option_aggregate_t aggregate;
|
||||
int aggregate_src;
|
||||
int aggregate_dest;
|
||||
|
||||
} options_t;
|
||||
|
||||
|
||||
22
ui.c
22
ui.c
@@ -209,12 +209,12 @@ void analyse_data() {
|
||||
ap = *(addr_pair*)n->key;
|
||||
|
||||
/* Aggregate hosts, if required */
|
||||
if(options.aggregate == OPTION_AGGREGATE_SRC) {
|
||||
ap.dst.s_addr = 0;
|
||||
}
|
||||
else if(options.aggregate == OPTION_AGGREGATE_DEST) {
|
||||
if(options.aggregate_src) {
|
||||
ap.src.s_addr = 0;
|
||||
}
|
||||
if(options.aggregate_dest) {
|
||||
ap.dst.s_addr = 0;
|
||||
}
|
||||
|
||||
/* Aggregate ports, if required */
|
||||
if(options.showports == OPTION_PORTS_DEST || options.showports == OPTION_PORTS_OFF) {
|
||||
@@ -362,13 +362,13 @@ void ui_print() {
|
||||
attron(A_REVERSE);
|
||||
addstr(" s ");
|
||||
attroff(A_REVERSE);
|
||||
addstr(options.aggregate == OPTION_AGGREGATE_SRC ? " aggregate off "
|
||||
addstr(options.aggregate_src ? " aggregate off "
|
||||
: " aggregate src ");
|
||||
|
||||
attron(A_REVERSE);
|
||||
addstr(" d ");
|
||||
attroff(A_REVERSE);
|
||||
addstr(options.aggregate == OPTION_AGGREGATE_DEST ? " aggregate off "
|
||||
addstr(options.aggregate_dest ? " aggregate off "
|
||||
: " aggregate dest ");
|
||||
|
||||
draw_bar_scale(&y);
|
||||
@@ -497,17 +497,11 @@ void ui_loop() {
|
||||
break;
|
||||
|
||||
case 's':
|
||||
options.aggregate =
|
||||
(options.aggregate == OPTION_AGGREGATE_SRC)
|
||||
? OPTION_AGGREGATE_OFF
|
||||
: OPTION_AGGREGATE_SRC;
|
||||
options.aggregate_src = !options.aggregate_src;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
options.aggregate =
|
||||
(options.aggregate == OPTION_AGGREGATE_DEST)
|
||||
? OPTION_AGGREGATE_OFF
|
||||
: OPTION_AGGREGATE_DEST;
|
||||
options.aggregate_dest = !options.aggregate_dest;
|
||||
break;
|
||||
case 'S':
|
||||
/* Show source ports */
|
||||
|
||||
Reference in New Issue
Block a user