Esempio n. 1
0
void errbox(char *message, char *prompt, int *response)
{
    WINDOW *win;
    PANEL *panel;

    win = newwin(4, 70, (LINES - 4) / 2, (COLS - 70) / 2);
    panel = new_panel(win);

    wattrset(win, ERRBOXATTR);
    colorwin(win);
    box(win, ACS_VLINE, ACS_HLINE);
    wmove(win, 2, 2);
    wprintw(win, "%s", prompt);
    wattrset(win, ERRTXTATTR);
    wmove(win, 1, 2);
    wprintw(win, "%s", message);
    update_panels();
    doupdate();

    do {
	*response = wgetch(win);
	if (*response == 12)
	    refresh_screen();
    } while (*response == 12);

    del_panel(panel);
    delwin(win);
    update_panels();
    doupdate();
}
Esempio n. 2
0
/**
 * print_tcp_stat_screen()
 * -------------------
 * displays the main background screen
 **/
void print_tcp_stat_screen(WINDOW ** statwin, PANEL ** statpanel, int card, char *iface)
{
  if (GUI_DEBUG) fprintf(stderr,"making overall window\n");
  /** make the overall wireless traffic monitor box window **/
  *statwin = newwin(LINES - 2, COLS, 1, 0);
  *statpanel = new_panel(*statwin);
  stdwinset(*statwin);
  wtimeout(*statwin, -1);
  wattrset(*statwin, BOXATTR);
  colorwin(*statwin);
  box(*statwin, ACS_VLINE, ACS_HLINE);
  wmove(*statwin, 0, 1);
  if (card == AIRONET)
    wprintw(*statwin, " TCP Performance Analysis: listening using Cisco Aironet (%s) ", iface);
  else if (card == PRISMII)
    wprintw(*statwin, " TCP Performance Analysis: listening using PrismII-compatible (%s) ", iface);
  else if (card == HOSTAP)
    wprintw(*statwin, " TCP Performance Analysis: listening using HostAP driver (%s) ", iface);
  else if (card == HERMES)
    wprintw(*statwin, " TCP Performance Analysis: listening using Hermes-compatible (%s) ", iface);
  else if (card == WLANNG)
    wprintw(*statwin, " TCP Performance Analysis: listening using Wlan-ng driver (%s) ", iface);
  wattrset(*statwin, STDATTR);
  update_panels();
  doupdate();
}
Esempio n. 3
0
void showmenu(struct MENU *menu)
{
    struct ITEM *itemptr;	/* points to each item in turn */
    int ctr = 1;		/* counts each item */

	wbkgd(menu->menuwin, BOXATTR);
#if 0
    wattrset(menu->menuwin, BOXATTR);	/* set to bg+/b */
    colorwin(menu->menuwin);	/* color window */
#endif
    box(menu->menuwin, ACS_VLINE, ACS_HLINE);	/* draw border */

    itemptr = menu->itemlist;	/* point to start */

    wattrset(menu->menuwin, STDATTR);
	if (strlen(menu->desc) > 0)
		mvwprintw(menu->menuwin, 0, 2, " %s ", menu->desc);

    do {			/* display items */
	wmove(menu->menuwin, ctr, 1);
	showitem(menu, itemptr, NOTSELECTED);	/* show items, initially unselected */
	ctr++;
	itemptr = itemptr->next;
    } while (ctr <= menu->itemcount);

    update_panels();
    doupdate();
}
Esempio n. 4
0
/**
 * print_tcp_activity_overview_labels()
 * --------------------------------
 * displays the Activity Overview window, and prints the labels
 * associated with it.
 **/
void print_tcp_activity_overview_labels(WINDOW ** scanwin, PANEL ** scanpanel, int highlight)
{
  *scanwin = newwin(LINES - 5, 30, 3, 1);
  *scanpanel = new_panel(*scanwin);
  wattrset(*scanwin, BOXATTR);
  colorwin(*scanwin);
  box(*scanwin, ACS_VLINE, ACS_HLINE);
  mvwprintw(*scanwin, 0, 2, " Activity Overview ");

  wattrset(*scanwin, ACTIVEATTR);
  mvwprintw(*scanwin, 2, 2, "Access Point Information");
  wattrset(*scanwin, STDATTR);
  mvwprintw(*scanwin, 4, 3, "SSID:             ");
  mvwprintw(*scanwin, 5, 3, "BSSID: ");
  mvwprintw(*scanwin, 6, 3, "WEP: ");
  mvwprintw(*scanwin, 7, 3, "Channel:");
  mvwprintw(*scanwin, 8, 3, "Total # Nodes:");

  wattrset(*scanwin, BOXATTR);
  wmove(*scanwin, 10, 6);
  whline(*scanwin, ACS_HLINE, 15);
  
  wattrset(*scanwin, ACTIVEATTR);
  mvwprintw(*scanwin, 12, 2, "Selected Wireless Node");
  wattrset(*scanwin, STDATTR);
  mvwprintw(*scanwin, 14, 3, "MAC: ");
  mvwprintw(*scanwin, 15, 3, "IP Addr: ");

  wattrset(*scanwin, BOXATTR);
  mvwprintw(*scanwin, 17, 2, "TCP Related-Info");
  wattrset(*scanwin, STDATTR);  
  mvwprintw(*scanwin, 19, 3, "Total # Conns: ");
  mvwprintw(*scanwin, 20, 3, "Total pkts:    ");
  mvwprintw(*scanwin, 21, 3, "Total bytes: ");
  mvwprintw(*scanwin, 22, 3, "Existing pkts: ");
  mvwprintw(*scanwin, 23, 3, "Existing bytes: ");
  mvwprintw(*scanwin, 24, 3, "Retran pkts: ");
  mvwprintw(*scanwin, 25, 3, "Retran bytes: ");

  mvwprintw(*scanwin, 27, 3, "Waste (%%): ");

  wattrset(*scanwin, ACTIVEATTR);
  mvwprintw(*scanwin, 30, 2, "Data Setting");
  wattrset(*scanwin, STDATTR);
  mvwprintw(*scanwin, 32, 3, "Current View: ");
  
  wattrset(*scanwin, BOXATTR);
  wmove(*scanwin, 34, 6);
  whline(*scanwin, ACS_HLINE, 15);
 
  mvwprintw(*scanwin, 35, 3, "Press 'V' to view other");
  mvwprintw(*scanwin, 36, 3, "types of data");

  wattrset(*scanwin, STDATTR);
  mvwprintw(*scanwin, LINES - 7, 2, "Elapsed: "); 
  
  update_panels();
  doupdate();
}
Esempio n. 5
0
void print_tcp_breakdown_labels(WINDOW ** breakwin, PANEL ** breakpanel, int view)
{
  *breakwin = newwin(LINES / 2 - 2, COLS - 32, 3, 31);
  *breakpanel = new_panel(*breakwin);
  wattrset(*breakwin, BOXATTR);
  colorwin(*breakwin);
  box(*breakwin, ACS_VLINE, ACS_HLINE);
  mvwprintw(*breakwin, 0, 2, " TCP Performance Breakdown for Selected Node");

  wattrset(*breakwin, BOXATTR);
  mvwprintw(*breakwin, 3, 3, "Connections:");
  mvwprintw(*breakwin, 2, 24, "Service");
  mvwprintw(*breakwin, 3, 24, "   Port");

  wattrset(*breakwin, STDATTR);
  switch (view)
    {
    case CONNECTIONS:
      mvwprintw(*breakwin, 2, 37, "-Connections-");
      mvwprintw(*breakwin, 3, 34, "Total|Open|Closed");
      mvwprintw(*breakwin, 2, 54, "Reset");
      mvwprintw(*breakwin, 3, 54, "Count");
      mvwprintw(*breakwin, 2, 61, "  Total");
      mvwprintw(*breakwin, 3, 61, "Packets");
      mvwprintw(*breakwin, 2, 72, "Total");
      mvwprintw(*breakwin, 3, 72, "Bytes");
      wattrset(*breakwin, BOXATTR);
      mvwprintw(*breakwin, 3, 80, "STATUS");    
      break;
    case STATISTICS:
      mvwprintw(*breakwin, 2, 36, " -Incoming-");
      mvwprintw(*breakwin, 3, 35, "Count | Bytes");
      mvwprintw(*breakwin, 2, 53, " -Outgoing-");
      mvwprintw(*breakwin, 3, 52, "Count | Bytes");
      mvwprintw(*breakwin, 2, 69, " -Retransmit-");
      mvwprintw(*breakwin, 3, 69, "Count | Bytes");
      break;
    case PERF_LATENCY:
      mvwprintw(*breakwin, 2, 35, "  Incoming (ms)");
      mvwprintw(*breakwin, 3, 35, "Observed|Actual");
      mvwprintw(*breakwin, 2, 53, "  Outgoing (ms)");
      mvwprintw(*breakwin, 3, 53, "Observed|Actual");
      mvwprintw(*breakwin, 2, 72, "Round-trip");
      mvwprintw(*breakwin, 3, 72, " time (ms)");
      break;
    case PERF_BANDWIDTH:
      mvwprintw(*breakwin, 2, 35, "Incoming (Kbps)");
      mvwprintw(*breakwin, 3, 35, "Current|Highest");
      mvwprintw(*breakwin, 2, 52, "Outgoing (Kbps)");
      mvwprintw(*breakwin, 3, 52, "Current|Highest");
      mvwprintw(*breakwin, 2, 72, "Total (Kbps)");
      mvwprintw(*breakwin, 3, 69, "Current|Highest");
      break;
    }

  update_panels();
  doupdate();
}
Esempio n. 6
0
void initfields(struct FIELDLIST *list, int leny, int lenx, int begy, int begx)
{
    list->list = NULL;
    list->fieldwin = newwin(leny, lenx, begy, begx);
    list->fieldpanel = new_panel(list->fieldwin);
    stdwinset(list->fieldwin);
    wtimeout(list->fieldwin, -1);
    wattrset(list->fieldwin, STDATTR);
    colorwin(list->fieldwin);
    update_panels();
    doupdate();
}
Esempio n. 7
0
void print_tcp_nodelist_labels(WINDOW ** win, PANEL ** panel)
{
  *win = newwin(LINES / 2 - 3, COLS - 32, LINES / 2 + 1, 31);
  *panel = new_panel(*win);
  wattrset(*win, BOXATTR);
  colorwin(*win);
  box(*win, ACS_VLINE, ACS_HLINE);
  mvwprintw(*win, 0, 2, " Available Wireless Nodes ");

  wattrset(*win, BOXATTR);
  mvwprintw(*win, 2, 4, "ID");
  mvwprintw(*win, 2, 10, "MAC Address");
  mvwprintw(*win, 2, 30, "IP Address");
  mvwprintw(*win, 2, 48, "TCP Conns");
  mvwprintw(*win, 2, 60, "Avg. Signal Strength");

  update_panels();
  doupdate();
}
Esempio n. 8
0
void operatemenu(struct MENU *menu, int *position, int *aborted)
{
    struct ITEM *itemptr;
    int row = *position;
    int exitloop = 0;
    int ch;
    char *keyptr;

    menukeyhelp();
    *aborted = 0;
    menumoveto(menu, &itemptr, row);

    menu->descwin = newwin(1, COLS, LINES - 2, 0);
    menu->descpanel = new_panel(menu->descwin);

    do {
	wmove(menu->menuwin, row, 1);
	showitem(menu, itemptr, SELECTED);

	/*
	 * Print item description
	 */

	wattrset(menu->descwin, DESCATTR);
	colorwin(menu->descwin);
	wmove(menu->descwin, 0, 0);
	wprintw(menu->descwin, " %s", itemptr->desc);
	update_panels();
	doupdate();

	wmove(menu->menuwin, row, 2);
	ch = wgetch(menu->menuwin);
	wmove(menu->menuwin, row, 1);
	showitem(menu, itemptr, NOTSELECTED);

	switch (ch) {
	case KEY_UP:
	    if (row == 1)
		row = menu->itemcount;
	    else
		row--;

	    itemptr = itemptr->prev;

	    if (itemptr->itemtype == SEPARATOR) {
		row--;
		itemptr = itemptr->prev;
	    }
	    break;
	case KEY_DOWN:
	    if (row == menu->itemcount)
		row = 1;
	    else
		row++;

	    itemptr = itemptr->next;
	    if (itemptr->itemtype == SEPARATOR) {
		row++;
		itemptr = itemptr->next;
	    }
	    break;
	case 12:
	    refresh_screen();
	    break;
	case 13:
	    exitloop = 1;
	    break;
	    /* case 27: exitloop = 1;*aborted = 1;row=menu->itemcount;break; */
	case '^':
	    break;		/* ignore caret key */
	default:
	    keyptr = strchr(menu->shortcuts, toupper(ch));
	    if ((keyptr != NULL)
		&& keyptr - menu->shortcuts < menu->itemcount) {
		row = keyptr - menu->shortcuts + 1;
		exitloop = 1;
	    }
	}
    } while (!(exitloop));

    *position = row;		/* position of executed option is in *position */
    del_panel(menu->descpanel);
    delwin(menu->descwin);
    update_panels();
    doupdate();
}
Esempio n. 9
0
void start_ids_mon(char *iface)
{
  WINDOW *statwin;
  PANEL *statpanel;

  WINDOW *overallwin;
  PANEL *overallpanel;

  WINDOW *helpwin;
  PANEL *helppanel;

  /** stat display information **/
  int stat_page = 0;
  
  int ch;
  int exitloop;
  int paused = 0;

  ids_t *ids_info = NULL;

  MAX_STAT_ROW = LINES * 0.6 - 2;

  overallwin = newwin(LINES -2, COLS, 1, 0);
  overallpanel = new_panel(overallwin);
  stdwinset(overallwin);
  wtimeout(overallwin, -1);
  wattrset(overallwin, BOXATTR);
  colorwin(overallwin);
  box(overallwin, ACS_VLINE, ACS_HLINE);
  
  /** make the ids list based on mac addresses **/
  statwin = newwin(LINES * 0.6, COLS, 1, 0);
  statpanel = new_panel(statwin);
  stdwinset(statwin);
  wtimeout(statwin, -1);
  wattrset(statwin, BOXATTR);
  colorwin(statwin);
  box(statwin, ACS_VLINE, ACS_HLINE);
  wmove(statwin, 0, 1);
  wprintw(statwin, " IDS Statistics for %s ", iface);
  print_ids_labels(statwin);
  print_ids_details(statwin, NULL, 0);

  /** make ids help window **/
  helpwin = newwin(LINES * 0.4 - 1, COLS, LINES * 0.6 + 1, 0);
  helppanel = new_panel(helpwin);
  wattrset(helpwin, BOXATTR);
  colorwin(helpwin);
  box(helpwin, ACS_VLINE, ACS_HLINE);
  print_help_win(helpwin);
  
  /** make the bottom key binding panel **/
  move(LINES - 1, 1);
  scrollkeyhelp();
  stdexitkeyhelp();

  update_panels();
  doupdate();
  
  leaveok(statwin, TRUE);
  
  exitloop = 1;

  /**
   * Data-gathering loop
   */
  while(!exitloop){
    ch = ERR;
    if (check_for_keystroke() != ERR)
      ch = wgetch(statwin);
    if (ch != ERR) {
      switch (ch)
	{
	case KEY_UP:
	  if (stat_page > 0){
	    stat_page --;
	    colorwin(statwin);
	  }
	  break;
	case KEY_DOWN:
	  if (((stat_page +1) * MAX_STAT_ROW) < ids_info->node_count){
	    stat_page ++;
	    colorwin(statwin);
	  } 
	  break;
	case KEY_PPAGE:
	case '-':
	  //scroll_nodewin(nodewin, SCROLLDOWN);
	  //	    pageethwin(nodewin, SCROLLDOWN);
	  break;
	case KEY_NPAGE:
	case ' ':
	  //scroll_nodewin(nodewin, SCROLLUP);
	  //	    pageethwin(nodewin, SCROLLUP);
	  break;
	case 'p':
	case 'P':
	  switch (paused)
	    {
	    case 0:
	      paused = 1;
	      break;
	    case 1:
	      paused = 0;
	      break;
	    }    
	  //	  markactive(curwin, nodeborder, paused);
	  update_panels();
	  doupdate();
	  break;
	case 12:
	case 'l':
	case 'L':
	  refresh_screen();
	  break;
	    
	case 'Q':
	case 'q':
	case 'X':
	case 'x':
	case 24:
	case 27:
	  exitloop = 1;
	  break;
	default:
	  break;
	}
    }
    if (!paused){
      // blah do stuff
      print_ids_details(statwin, ids_info, stat_page);
    }
  } // end loop
  del_panel(statpanel);
  delwin(statwin);

  del_panel(helppanel);
  delwin(helpwin);

  del_panel(overallpanel);
  delwin(overallwin);
  
  update_panels();
  doupdate();
}