Commit 747077f4 authored by Bruno Randolf's avatar Bruno Randolf

colorize packet types (MGMT, CTL, DATA)

parent ac797b7f
......@@ -24,6 +24,7 @@
#include "display.h"
#include "main.h"
#include "util.h"
#include "ieee80211.h"
#define CHECKED(_x) (conf.filter_pkt & (_x)) ? '*' : ' '
#define CHECK_ETHER(_mac) MAC_NOT_EMPTY(_mac) ? '*' : ' '
......@@ -41,6 +42,7 @@ update_filter_win(WINDOW *win)
mvwprintw(win, 2, 2, "Show these Packet Types");
l = 4;
wattron(win, get_packet_type_color(IEEE80211_FTYPE_MGMT));
wattron(win, A_BOLD);
mvwprintw(win, l++, 2, "m: [%c] MANAGEMENT FRAMES", CHECKED(PKT_TYPE_MGMT));
wattroff(win, A_BOLD);
......@@ -49,12 +51,14 @@ update_filter_win(WINDOW *win)
mvwprintw(win, l++, 2, "a: [%c] Association", CHECKED(PKT_TYPE_ASSOC));
mvwprintw(win, l++, 2, "u: [%c] Authentication", CHECKED(PKT_TYPE_AUTH));
l++;
wattron(win, get_packet_type_color(IEEE80211_FTYPE_CTL));
wattron(win, A_BOLD);
mvwprintw(win, l++, 2, "c: [%c] CONTROL FRAMES", CHECKED(PKT_TYPE_CTRL));
wattroff(win, A_BOLD);
mvwprintw(win, l++, 2, "r: [%c] CTS/RTS", CHECKED(PKT_TYPE_CTS | PKT_TYPE_RTS));
mvwprintw(win, l++, 2, "k: [%c] ACK", CHECKED(PKT_TYPE_ACK));
l++;
wattron(win, get_packet_type_color(IEEE80211_FTYPE_DATA));
wattron(win, A_BOLD);
mvwprintw(win, l++, 2, "d: [%c] DATA FRAMES", CHECKED(PKT_TYPE_DATA));
wattroff(win, A_BOLD);
......@@ -68,6 +72,7 @@ update_filter_win(WINDOW *win)
mvwprintw(win, l++, 2, "B: [%c] BATMAN", CHECKED(PKT_TYPE_BATMAN));
l = 4;
wattron(win, WHITE);
wattron(win, A_BOLD);
mvwprintw(win, l++, MAC_COL, "BSSID");
wattroff(win, A_BOLD);
......
......@@ -100,7 +100,7 @@ update_history_win(WINDOW *win)
mvwvline(win, noi, col, '=', SIGN_POS-noi);
}
wattron(win, CYAN);
wattron(win, get_packet_type_color(hist.type[i]));
mvwprintw(win, TYPE_POS, col, "%c", \
get_packet_type_char(hist.type[i]));
......
......@@ -353,9 +353,9 @@ update_dump_win(struct packet_info* p)
return;
}
wattron(dump_win, CYAN);
wattron(dump_win, get_packet_type_color(p->wlan_type));
if (p->olsr_type > 0 && p->pkt_types & PKT_TYPE_OLSR)
if (p->pkt_types & PKT_TYPE_IP)
wattron(dump_win, A_BOLD);
wprintw(dump_win, "\n%03d/%03d ", p->phy_signal, p->phy_noise);
......
......@@ -114,6 +114,7 @@ update_statistics_win(WINDOW *win)
mvwhline(win, line++, 2, '-', COLS - 4);
for (i = 0; i < MAX_FSTYPE; i++) {
if (stats.packets_per_type[i] > 0) {
wattron(win, get_packet_type_color(i));
wattron(win, A_BOLD);
mvwprintw(win, line, 2, "%s", get_packet_type_name(i));
wattroff(win, A_BOLD);
......
......@@ -26,6 +26,7 @@
#include "display.h"
#include "main.h"
#include "ieee80211.h"
WINDOW *conf_win = NULL;
......@@ -101,6 +102,18 @@ print_centered(WINDOW* win, int line, int cols, const char *fmt, ...)
}
int
get_packet_type_color(int type)
{
switch (type & IEEE80211_FCTL_FTYPE) {
case IEEE80211_FTYPE_DATA: return BLUE;
case IEEE80211_FTYPE_CTL: return WHITE;
case IEEE80211_FTYPE_MGMT: return CYAN;
}
return YELLOW;
}
/******************* STATUS *******************/
static void
......
......@@ -46,6 +46,9 @@ get_per_second(unsigned int bytes, unsigned int duration, int *bps, int *dps);
void __attribute__ ((format (printf, 4, 5)))
print_centered(WINDOW* win, int line, int cols, const char *fmt, ...);
int
get_packet_type_color(int type);
void
update_display(struct packet_info* pkg, struct node_info* node);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment