interface.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define COL_WND_TITLE   COLS
#define ROW_WND_TITLE   2
#define COL_WND_SUM   24
#define ROW_WND_SUM   20
#define COL_WND_PANEL   (COL_WND_TITLE - COL_WND_SUM)
#define ROW_WND_PANEL   ROW_WND_SUM
#define COL_WND_REALTIME   COL_WND_TITLE
#define ROW_WND_REALTIME   (LINES - ROW_WND_TITLE - ROW_WND_SUM)
#define COL_MINI_NEEDED   132
#define ROW_MINI_NEEDED   50

Functions

void InitScreen (UINT8 CheckScreenSize)
void RefreshAllWND (void)
void WriteSummary (void)
void RefreshRealTime_WND (UINT8 GotItOne)
void ClearPanel (void)
void EndCurses (void)


Define Documentation

#define COL_WND_TITLE   COLS

Definition at line 31 of file interface.h.

Referenced by InitScreen().

#define ROW_WND_TITLE   2

Definition at line 32 of file interface.h.

Referenced by InitScreen().

#define COL_WND_SUM   24

Definition at line 34 of file interface.h.

Referenced by InitScreen().

#define ROW_WND_SUM   20

Definition at line 35 of file interface.h.

Referenced by InitScreen().

#define COL_WND_PANEL   (COL_WND_TITLE - COL_WND_SUM)

Definition at line 37 of file interface.h.

Referenced by InitScreen(), and WritePanel().

#define ROW_WND_PANEL   ROW_WND_SUM

Definition at line 38 of file interface.h.

Referenced by InitScreen(), main(), RefreshRealTime_WND(), RefreshRealTime_WND_th(), and WritePanel().

#define COL_WND_REALTIME   COL_WND_TITLE

Definition at line 40 of file interface.h.

Referenced by InitScreen().

#define ROW_WND_REALTIME   (LINES - ROW_WND_TITLE - ROW_WND_SUM)

Definition at line 41 of file interface.h.

Referenced by InitScreen().

#define COL_MINI_NEEDED   132

Definition at line 43 of file interface.h.

Referenced by InitScreen().

#define ROW_MINI_NEEDED   50

Definition at line 44 of file interface.h.

Referenced by InitScreen().


Function Documentation

void InitScreen ( UINT8  CheckScreenSize  ) 

Definition at line 47 of file interface.c.

References COL_MINI_NEEDED, COL_WND_PANEL, COL_WND_REALTIME, COL_WND_SUM, COL_WND_TITLE, FALSE, Panel_WND, RealTime_WND, RefreshAllWND(), ROW_MINI_NEEDED, ROW_WND_PANEL, ROW_WND_REALTIME, ROW_WND_SUM, ROW_WND_TITLE, Sum_WND, Title_WND, TRUE, and WIFISCANNER_VERSION.

Referenced by main().

00048 {
00049   initscr();
00050   cbreak();
00051   noecho();
00052   nonl();
00053   intrflush(stdscr, FALSE);
00054   keypad(stdscr, TRUE);
00055 
00056   if ((CheckScreenSize)
00057       && ((LINES < ROW_MINI_NEEDED) || (COLS < COL_MINI_NEEDED))) {
00058     endwin();
00059     fprintf(stderr,
00060             "\nSorry, This program requires a screen size of at least %d columns by %d lines\n",
00061             COL_MINI_NEEDED, ROW_MINI_NEEDED);
00062     fprintf(stderr, "Please resize your window\n\n");
00063     exit(1);
00064   }
00065 
00066   Title_WND = subwin(stdscr, ROW_WND_TITLE, COL_WND_TITLE, 0, 0);
00067   Panel_WND =
00068       subwin(stdscr, ROW_WND_PANEL, COL_WND_PANEL, ROW_WND_TITLE, 0);
00069   Sum_WND =
00070       subwin(stdscr, ROW_WND_SUM, COL_WND_SUM, ROW_WND_TITLE,
00071              COL_WND_PANEL);
00072   RealTime_WND =
00073       subwin(stdscr, ROW_WND_REALTIME, COL_WND_REALTIME,
00074              (ROW_WND_TITLE + ROW_WND_PANEL), 0);
00075 
00076   scrollok(RealTime_WND, TRUE);
00077   scrollok(Panel_WND, TRUE);
00078   //nodelay (RealTime_WND, TRUE);
00079   //werase(Sum_WND);
00080 
00081   box(Sum_WND, '|', '-');
00082   mvwprintw(Sum_WND, 0, 3, " Summary ");
00083   mvwprintw(Sum_WND, 1, 2, "AP     :");
00084   mvwprintw(Sum_WND, 2, 2, "STA    :");
00085   mvwprintw(Sum_WND, 3, 2, "BEACON :");
00086   mvwprintw(Sum_WND, 4, 2, "SSID   :");
00087   mvwprintw(Sum_WND, 5, 2, "Channel:");
00088   mvwprintw(Sum_WND, 6, 2, "Invalid:");
00089   mvwprintw(Sum_WND, 7, 2, "Crypted:");
00090   mvwprintw(Sum_WND, 8, 2, "Weak   :");
00091   mvwprintw(Sum_WND, 9, 2, "Last IV:");
00092   mvwprintw(Sum_WND, 10, 2, "Packets:");
00093 
00094   mvwprintw(Sum_WND, 12, 2, "Scan 000 - ABCDS");
00095   mvwprintw(Sum_WND, 13, 2, "|_____________  _|");
00096   mvwprintw(Sum_WND, 14, 3, "0000000001111  1");
00097   mvwprintw(Sum_WND, 15, 3, "1234567890123  4");
00098   mvwprintw(Sum_WND, 17, 3, "IDS is OFF");
00099 
00100   box(Panel_WND, '|', '-');
00101 
00102   wprintw(Title_WND,
00103           "WifiScanner v%s (c) 2002-2008 Hervé Schauer Consultants (%s)\n",
00104           WIFISCANNER_VERSION, WIFISCANNER_BUG);
00105   RefreshAllWND();
00106 }

void RefreshAllWND ( void   ) 

Definition at line 108 of file interface.c.

References Panel_WND, RealTime_WND, screen_mutex, Sum_WND, and Title_WND.

Referenced by fatal(), and InitScreen().

00109 {
00110 #ifdef WITH_THREAD
00111   pthread_mutex_lock(&screen_mutex);
00112 #endif
00113   wrefresh(Sum_WND);
00114   wrefresh(Panel_WND);
00115   wrefresh(RealTime_WND);
00116   wrefresh(Title_WND);
00117   refresh();
00118 #ifdef WITH_THREAD
00119   pthread_mutex_unlock(&screen_mutex);
00120 #endif
00121 }

void WriteSummary ( void   ) 

Definition at line 124 of file interface.c.

References Statistics_t::AP, Statistics_t::Beacon, Statistics_t::Channel, Statistics_t::CryptedPackets, DISPLAY_ACK_BIT, DISPLAY_BEACON_BIT, DISPLAY_CONTROL_BIT, DISPLAY_DATA_BIT, DISPLAY_PROBE_BIT, DISPLAY_STATION_BIT, ConfigStruct::DoNotDisplay, DoSummary(), Statistics_t::INVLD, IS_BIT_SET, Statistics_t::IV, Statistics_t::Packets, screen_mutex, Statistics_t::SSID, Statistics_t::STA, Sum_WND, and Statistics_t::WeakIV.

Referenced by main().

00125 {
00126   char DisplayBit[8];
00127 
00128   DoSummary();
00129 
00130 #ifdef WITH_THREAD
00131   pthread_mutex_lock(&screen_mutex);
00132 #endif
00133 
00134   mvwprintw(Sum_WND, 1, 11, "%d", Stats.AP);
00135   mvwprintw(Sum_WND, 2, 11, "%d", Stats.STA);
00136   mvwprintw(Sum_WND, 3, 11, "%d", Stats.Beacon);
00137   mvwprintw(Sum_WND, 4, 11, "%d", Stats.SSID);
00138   mvwprintw(Sum_WND, 5, 11, "%d", Stats.Channel);
00139   mvwprintw(Sum_WND, 6, 11, "%d", Stats.INVLD);
00140   mvwprintw(Sum_WND, 7, 11, "%d", Stats.CryptedPackets);
00141   mvwprintw(Sum_WND, 8, 11, "%d", Stats.WeakIV);
00142 //  mvwprintw (Sum_WND, 9, 11, "%02X:%02X:%02X:%02X", Stats.IV[3], Stats.IV[2],
00143 //           Stats.IV[1], Stats.IV[0]);
00144   mvwprintw(Sum_WND, 9, 11, "%02X:%02X:%02X[%1X]", Stats.IV[2],
00145             Stats.IV[1], Stats.IV[0], (Stats.IV[3] & 0x03));
00146   mvwprintw(Sum_WND, 10, 11, "%d", Stats.Packets);
00147 
00148   if (IS_BIT_SET(config.DoNotDisplay, DISPLAY_ACK_BIT))
00149     DisplayBit[0] = 'A';
00150   else
00151     DisplayBit[0] = 'a';
00152 
00153   if (IS_BIT_SET(config.DoNotDisplay, DISPLAY_BEACON_BIT))
00154     DisplayBit[1] = 'B';
00155   else
00156     DisplayBit[1] = 'b';
00157 
00158   if (IS_BIT_SET(config.DoNotDisplay, DISPLAY_CONTROL_BIT))
00159     DisplayBit[2] = 'C';
00160   else
00161     DisplayBit[2] = 'c';
00162 
00163   if (IS_BIT_SET(config.DoNotDisplay, DISPLAY_DATA_BIT))
00164     DisplayBit[3] = 'D';
00165   else
00166     DisplayBit[3] = 'd';
00167 
00168   if (IS_BIT_SET(config.DoNotDisplay, DISPLAY_PROBE_BIT))
00169     DisplayBit[4] = 'P';
00170   else
00171     DisplayBit[4] = 'p';
00172 
00173   if (IS_BIT_SET(config.DoNotDisplay, DISPLAY_STATION_BIT))
00174     DisplayBit[5] = 'S';
00175   else
00176     DisplayBit[5] = 's';
00177 
00178   DisplayBit[6] = 0;
00179 
00180   mvwprintw(Sum_WND, 12, 13, "%s", DisplayBit);
00181 
00182   wrefresh(Sum_WND);
00183 #ifdef WITH_THREAD
00184   pthread_mutex_unlock(&screen_mutex);
00185 #endif
00186 }

void RefreshRealTime_WND ( UINT8  GotItOne  ) 

Definition at line 222 of file interface.c.

References ConfigStruct::DebugLevel, FALSE, Panel_WND, RealTime_WND, ROW_WND_PANEL, and TRUE.

Referenced by main().

00223 {
00224 #ifdef WITH_THREAD
00225   // Nothing to do here !
00226 /*
00227   if ((config.DebugLevel >= 2) && ()) {
00228     pthread_mutex_lock(&screen_mutex);
00229     wrefresh(RealTime_WND);
00230     pthread_mutex_unlock(&screen_mutex);
00231   }
00232  */
00233 #else
00235   static time_t now, last_time = 0;
00236   struct tm *ascii_now;         // The timestamp in ASCII (human readable)
00237   struct timeb binary_now;
00238   static UINT8 NeedToRefresh = FALSE;
00239 
00240   time(&now);
00241 
00242   if (GotItOne)
00243     NeedToRefresh = TRUE;
00244 
00245   if (((now != last_time) && (NeedToRefresh))
00246       || (config.DebugLevel >= 2)) {
00247     ftime(&binary_now);
00248     last_time = now;
00249     ascii_now = localtime(&binary_now.time);
00250     ascii_now = localtime(&now);
00251     mvwprintw(Panel_WND, ROW_WND_PANEL - 1, 3,
00252               "Last Updt %02d:%02d:%02d ", ascii_now->tm_hour,
00253               ascii_now->tm_min, ascii_now->tm_sec);
00254 
00255     wrefresh(RealTime_WND);
00256     NeedToRefresh = FALSE;
00257   }
00258 #endif
00259 }

void ClearPanel ( void   ) 

Definition at line 746 of file analyse.c.

References Panel_WND, and screen_mutex.

Referenced by parse_keystring().

00747 {
00748 #ifdef WITH_THREAD
00749   pthread_mutex_lock(&screen_mutex);
00750 #endif
00751   wclear(Panel_WND);
00752   box(Panel_WND, '|', '-');
00753   wrefresh(Panel_WND);
00754 #ifdef WITH_THREAD
00755   pthread_mutex_unlock(&screen_mutex);
00756 #endif
00757 }

void EndCurses ( void   ) 

Definition at line 262 of file interface.c.

References CursesIsInUse, and FALSE.

Referenced by fatal(), and main().

00263 {
00264   CursesIsInUse = FALSE;
00265   endwin();
00266 }


Generated on Fri Jul 25 17:11:05 2008 for WifiScanner by  doxygen 1.5.5