diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index 0eec94c37..3641a58d6 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -1476,11 +1476,8 @@ WINALL=wpa_supplicant.exe wpa_cli.exe wpa_passphrase.exe win_if_list.exe
windows-bin: $(WINALL)
$(STRIP) $(WINALL)
-wpa_gui/Makefile:
- qmake -o wpa_gui/Makefile wpa_gui/wpa_gui.pro
-
-wpa_gui: wpa_gui/Makefile
- $(MAKE) -C wpa_gui
+wpa_gui:
+ @echo "wpa_gui has been removed - see wpa_gui-qt4 for replacement"
wpa_gui-qt4/Makefile:
qmake -o wpa_gui-qt4/Makefile wpa_gui-qt4/wpa_gui.pro
diff --git a/wpa_supplicant/wpa_gui/.gitignore b/wpa_supplicant/wpa_gui/.gitignore
deleted file mode 100644
index 4df64a9ba..000000000
--- a/wpa_supplicant/wpa_gui/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-.moc
-.obj
-.ui
diff --git a/wpa_supplicant/wpa_gui/eventhistory.ui b/wpa_supplicant/wpa_gui/eventhistory.ui
deleted file mode 100644
index 3735fb70e..000000000
--- a/wpa_supplicant/wpa_gui/eventhistory.ui
+++ /dev/null
@@ -1,125 +0,0 @@
-
-EventHistory
-
-
- EventHistory
-
-
-
- 0
- 0
- 533
- 285
-
-
-
- Event history
-
-
-
- unnamed
-
-
-
-
- Timestamp
-
-
- true
-
-
- true
-
-
-
-
- Message
-
-
- true
-
-
- true
-
-
-
- eventListView
-
-
-
- 7
- 7
- 0
- 0
-
-
-
- Manual
-
-
- NoSelection
-
-
- LastColumn
-
-
-
-
- layout30
-
-
-
- unnamed
-
-
-
- spacer3
-
-
- Horizontal
-
-
- Expanding
-
-
-
- 20
- 20
-
-
-
-
-
- closeButton
-
-
- Close
-
-
-
-
-
-
-
-
- closeButton
- clicked()
- EventHistory
- close()
-
-
-
- wpamsg.h
- eventhistory.ui.h
-
-
- addEvents( WpaMsgList msgs )
- addEvent( WpaMsg msg )
-
-
- init()
- destroy()
-
-
-
-
diff --git a/wpa_supplicant/wpa_gui/eventhistory.ui.h b/wpa_supplicant/wpa_gui/eventhistory.ui.h
deleted file mode 100644
index cb2caab2e..000000000
--- a/wpa_supplicant/wpa_gui/eventhistory.ui.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-** ui.h extension file, included from the uic-generated form implementation.
-**
-** If you want to add, delete, or rename functions or slots, use
-** Qt Designer to update this file, preserving your code.
-**
-** You should not define a constructor or destructor in this file.
-** Instead, write your code in functions called init() and destroy().
-** These will automatically be called by the form's constructor and
-** destructor.
-*****************************************************************************/
-
-void EventHistory::init()
-{
-}
-
-
-void EventHistory::destroy()
-{
-}
-
-
-void EventHistory::addEvents(WpaMsgList msgs)
-{
- WpaMsgList::iterator it;
- for (it = msgs.begin(); it != msgs.end(); it++) {
- addEvent(*it);
- }
-}
-
-
-void EventHistory::addEvent(WpaMsg msg)
-{
- Q3ListViewItem *item;
- item = new Q3ListViewItem(eventListView,
- msg.getTimestamp().toString("yyyy-MM-dd hh:mm:ss.zzz"),
- msg.getMsg());
- if (item == NULL)
- return;
- eventListView->setSelected(item, false);
-}
diff --git a/wpa_supplicant/wpa_gui/main.cpp b/wpa_supplicant/wpa_gui/main.cpp
deleted file mode 100644
index a78473a8c..000000000
--- a/wpa_supplicant/wpa_gui/main.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifdef CONFIG_NATIVE_WINDOWS
-#include
-#endif /* CONFIG_NATIVE_WINDOWS */
-#include
-#include "wpagui.h"
-
-int main( int argc, char ** argv )
-{
- QApplication a( argc, argv );
- WpaGui w;
- int ret;
-
-#ifdef CONFIG_NATIVE_WINDOWS
- WSADATA wsaData;
- if (WSAStartup(MAKEWORD(2, 0), &wsaData)) {
- printf("Could not find a usable WinSock.dll\n");
- return -1;
- }
-#endif /* CONFIG_NATIVE_WINDOWS */
-
- w.show();
- a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
- ret = a.exec();
-
-#ifdef CONFIG_NATIVE_WINDOWS
- WSACleanup();
-#endif /* CONFIG_NATIVE_WINDOWS */
-
- return ret;
-}
diff --git a/wpa_supplicant/wpa_gui/networkconfig.ui b/wpa_supplicant/wpa_gui/networkconfig.ui
deleted file mode 100644
index 019ecf7e2..000000000
--- a/wpa_supplicant/wpa_gui/networkconfig.ui
+++ /dev/null
@@ -1,475 +0,0 @@
-
-NetworkConfig
-
-
- NetworkConfig
-
-
-
- 0
- 0
- 380
- 430
-
-
-
- NetworkConfig
-
-
-
- unnamed
-
-
-
- cancelButton
-
-
- Cancel
-
-
-
-
- frame9
-
-
- StyledPanel
-
-
- Raised
-
-
-
- unnamed
-
-
-
- textLabel0
-
-
- SSID
-
-
-
-
- ssidEdit
-
-
-
-
-
- Network name (Service Set IDentifier)
-
-
-
-
- textLabel1
-
-
- Network ID
-
-
-
-
- idstrEdit
-
-
-
-
-
- Network Identification String
-
-
-
-
- textLabel2
-
-
- Authentication
-
-
-
- -
-
- Plaintext or static WEP
-
-
- -
-
- IEEE 802.1X
-
-
- -
-
- WPA-Personal (PSK)
-
-
- -
-
- WPA-Enterprise (EAP)
-
-
- -
-
- WPA2-Personal (PSK)
-
-
- -
-
- WPA2-Enterprise (EAP)
-
-
-
- authSelect
-
-
-
-
- textLabel3
-
-
- Encryption
-
-
-
- -
-
- None
-
-
- -
-
- WEP
-
-
- -
-
- TKIP
-
-
- -
-
- CCMP
-
-
-
- encrSelect
-
-
-
-
- textLabel4
-
-
- PSK
-
-
-
-
- pskEdit
-
-
- false
-
-
- Password
-
-
- WPA/WPA2 pre-shared key or passphrase
-
-
-
-
-
-
-
- textLabel5
-
-
- EAP method
-
-
-
-
- eapSelect
-
-
- false
-
-
-
-
- textLabel6
-
-
- Identity
-
-
-
-
- identityEdit
-
-
- false
-
-
- Username/Identity for EAP methods
-
-
-
-
- textLabel7
-
-
- Password
-
-
-
-
- passwordEdit
-
-
- false
-
-
- Password
-
-
- Password for EAP methods
-
-
-
-
- textLabel1_2
-
-
- CA certificate
-
-
-
-
- cacertEdit
-
-
- false
-
-
-
-
- buttonGroup1
-
-
- true
-
-
- WEP keys
-
-
-
- unnamed
-
-
-
- wep0Radio
-
-
- false
-
-
- key 0
-
-
-
-
- wep1Radio
-
-
- false
-
-
- key 1
-
-
-
-
- wep3Radio
-
-
- false
-
-
- key 3
-
-
-
-
- wep2Radio
-
-
- false
-
-
- key 2
-
-
-
-
- wep0Edit
-
-
- false
-
-
-
-
- wep1Edit
-
-
- false
-
-
-
-
- wep2Edit
-
-
- false
-
-
-
-
- wep3Edit
-
-
- false
-
-
-
-
-
-
-
-
- spacer5
-
-
- Horizontal
-
-
- Expanding
-
-
-
- 130
- 20
-
-
-
-
-
- addButton
-
-
- Add
-
-
-
-
- removeButton
-
-
- false
-
-
- Remove
-
-
-
-
-
-
- authSelect
- activated(int)
- NetworkConfig
- authChanged(int)
-
-
- cancelButton
- clicked()
- NetworkConfig
- close()
-
-
- addButton
- clicked()
- NetworkConfig
- addNetwork()
-
-
- encrSelect
- activated(const QString&)
- NetworkConfig
- encrChanged(const QString&)
-
-
- removeButton
- clicked()
- NetworkConfig
- removeNetwork()
-
-
-
- ssidEdit
- idstrEdit
- authSelect
- encrSelect
- pskEdit
- eapSelect
- identityEdit
- passwordEdit
- cacertEdit
- wep0Radio
- wep1Radio
- wep2Radio
- wep3Radio
- wep0Edit
- wep1Edit
- wep2Edit
- wep3Edit
- addButton
- removeButton
- cancelButton
-
-
- qlistview.h
- qmessagebox.h
- wpagui.h
- networkconfig.ui.h
-
-
- class WpaGui;
-
-
- WpaGui *wpagui;
- int edit_network_id;
- bool new_network;
-
-
- authChanged( int sel )
- addNetwork()
- encrChanged( const QString & sel )
- writeWepKey( int network_id, QLineEdit * edit, int id )
- removeNetwork()
-
-
- init()
- paramsFromScanResults( QListViewItem * sel )
- setWpaGui( WpaGui * _wpagui )
- setNetworkParam( int id, const char * field, const char * value, bool quote )
- wepEnabled( bool enabled )
- paramsFromConfig( int network_id )
- newNetwork()
- getEapCapa()
-
-
-
-
diff --git a/wpa_supplicant/wpa_gui/networkconfig.ui.h b/wpa_supplicant/wpa_gui/networkconfig.ui.h
deleted file mode 100644
index 501d5d265..000000000
--- a/wpa_supplicant/wpa_gui/networkconfig.ui.h
+++ /dev/null
@@ -1,552 +0,0 @@
-/****************************************************************************
-** ui.h extension file, included from the uic-generated form implementation.
-**
-** If you want to add, delete, or rename functions or slots, use
-** Qt Designer to update this file, preserving your code.
-**
-** You should not define a constructor or destructor in this file.
-** Instead, write your code in functions called init() and destroy().
-** These will automatically be called by the form's constructor and
-** destructor.
-*****************************************************************************/
-
-#include
-
-enum {
- AUTH_NONE = 0,
- AUTH_IEEE8021X = 1,
- AUTH_WPA_PSK = 2,
- AUTH_WPA_EAP = 3,
- AUTH_WPA2_PSK = 4,
- AUTH_WPA2_EAP = 5
-};
-
-#define WPA_GUI_KEY_DATA "[key is configured]"
-
-void NetworkConfig::init()
-{
- wpagui = NULL;
- new_network = false;
-}
-
-void NetworkConfig::paramsFromScanResults(Q3ListViewItem *sel)
-{
- new_network = true;
-
- /* SSID BSSID frequency signal flags */
- setCaption(sel->text(0));
- ssidEdit->setText(sel->text(0));
-
- QString flags = sel->text(4);
- int auth, encr = 0;
- if (flags.find("[WPA2-EAP") >= 0)
- auth = AUTH_WPA2_EAP;
- else if (flags.find("[WPA-EAP") >= 0)
- auth = AUTH_WPA_EAP;
- else if (flags.find("[WPA2-PSK") >= 0)
- auth = AUTH_WPA2_PSK;
- else if (flags.find("[WPA-PSK") >= 0)
- auth = AUTH_WPA_PSK;
- else
- auth = AUTH_NONE;
-
- if (flags.find("-CCMP") >= 0)
- encr = 1;
- else if (flags.find("-TKIP") >= 0)
- encr = 0;
- else if (flags.find("WEP") >= 0)
- encr = 1;
- else
- encr = 0;
-
- authSelect->setCurrentItem(auth);
- authChanged(auth);
- encrSelect->setCurrentItem(encr);
-
- getEapCapa();
-}
-
-
-void NetworkConfig::authChanged(int sel)
-{
- pskEdit->setEnabled(sel == AUTH_WPA_PSK || sel == AUTH_WPA2_PSK);
- bool eap = sel == AUTH_IEEE8021X || sel == AUTH_WPA_EAP ||
- sel == AUTH_WPA2_EAP;
- eapSelect->setEnabled(eap);
- identityEdit->setEnabled(eap);
- passwordEdit->setEnabled(eap);
- cacertEdit->setEnabled(eap);
-
- while (encrSelect->count())
- encrSelect->removeItem(0);
-
- if (sel == AUTH_NONE || sel == AUTH_IEEE8021X) {
- encrSelect->insertItem("None");
- encrSelect->insertItem("WEP");
- encrSelect->setCurrentItem(sel == AUTH_NONE ? 0 : 1);
- } else {
- encrSelect->insertItem("TKIP");
- encrSelect->insertItem("CCMP");
- encrSelect->setCurrentItem((sel == AUTH_WPA2_PSK ||
- sel == AUTH_WPA2_EAP) ? 1 : 0);
- }
-
- wepEnabled(sel == AUTH_IEEE8021X);
-}
-
-
-void NetworkConfig::addNetwork()
-{
- char reply[10], cmd[256];
- size_t reply_len;
- int id;
- int psklen = pskEdit->text().length();
- int auth = authSelect->currentItem();
-
- if (auth == AUTH_WPA_PSK || auth == AUTH_WPA2_PSK) {
- if (psklen < 8 || psklen > 64) {
- QMessageBox::warning(this, "wpa_gui", "WPA-PSK requires a passphrase "
- "of 8 to 63 characters\n"
- "or 64 hex digit PSK");
- return;
- }
- }
-
- if (wpagui == NULL)
- return;
-
- memset(reply, 0, sizeof(reply));
- reply_len = sizeof(reply) - 1;
-
- if (new_network) {
- wpagui->ctrlRequest("ADD_NETWORK", reply, &reply_len);
- if (reply[0] == 'F') {
- QMessageBox::warning(this, "wpa_gui", "Failed to add network to wpa_supplicant\n"
- "configuration.");
- return;
- }
- id = atoi(reply);
- } else {
- id = edit_network_id;
- }
-
- setNetworkParam(id, "ssid", ssidEdit->text().ascii(), true);
-
- if (idstrEdit->isEnabled())
- setNetworkParam(id, "id_str", idstrEdit->text().ascii(), true);
-
- const char *key_mgmt = NULL, *proto = NULL, *pairwise = NULL;
- switch (auth) {
- case AUTH_NONE:
- key_mgmt = "NONE";
- break;
- case AUTH_IEEE8021X:
- key_mgmt = "IEEE8021X";
- break;
- case AUTH_WPA_PSK:
- key_mgmt = "WPA-PSK";
- proto = "WPA";
- break;
- case AUTH_WPA_EAP:
- key_mgmt = "WPA-EAP";
- proto = "WPA";
- break;
- case AUTH_WPA2_PSK:
- key_mgmt = "WPA-PSK";
- proto = "WPA2";
- break;
- case AUTH_WPA2_EAP:
- key_mgmt = "WPA-EAP";
- proto = "WPA2";
- break;
- }
-
- if (auth == AUTH_WPA_PSK || auth == AUTH_WPA_EAP ||
- auth == AUTH_WPA2_PSK || auth == AUTH_WPA2_EAP) {
- int encr = encrSelect->currentItem();
- if (encr == 0)
- pairwise = "TKIP";
- else
- pairwise = "CCMP";
- }
-
- if (proto)
- setNetworkParam(id, "proto", proto, false);
- if (key_mgmt)
- setNetworkParam(id, "key_mgmt", key_mgmt, false);
- if (pairwise) {
- setNetworkParam(id, "pairwise", pairwise, false);
- setNetworkParam(id, "group", "TKIP CCMP WEP104 WEP40", false);
- }
- if (pskEdit->isEnabled() &&
- strcmp(pskEdit->text().ascii(), WPA_GUI_KEY_DATA) != 0)
- setNetworkParam(id, "psk", pskEdit->text().ascii(), psklen != 64);
- if (eapSelect->isEnabled())
- setNetworkParam(id, "eap", eapSelect->currentText().ascii(), false);
- if (identityEdit->isEnabled())
- setNetworkParam(id, "identity", identityEdit->text().ascii(), true);
- if (passwordEdit->isEnabled() &&
- strcmp(passwordEdit->text().ascii(), WPA_GUI_KEY_DATA) != 0)
- setNetworkParam(id, "password", passwordEdit->text().ascii(), true);
- if (cacertEdit->isEnabled())
- setNetworkParam(id, "ca_cert", cacertEdit->text().ascii(), true);
- writeWepKey(id, wep0Edit, 0);
- writeWepKey(id, wep1Edit, 1);
- writeWepKey(id, wep2Edit, 2);
- writeWepKey(id, wep3Edit, 3);
-
- if (wep0Radio->isEnabled() && wep0Radio->isChecked())
- setNetworkParam(id, "wep_tx_keyidx", "0", false);
- else if (wep1Radio->isEnabled() && wep1Radio->isChecked())
- setNetworkParam(id, "wep_tx_keyidx", "1", false);
- else if (wep2Radio->isEnabled() && wep2Radio->isChecked())
- setNetworkParam(id, "wep_tx_keyidx", "2", false);
- else if (wep3Radio->isEnabled() && wep3Radio->isChecked())
- setNetworkParam(id, "wep_tx_keyidx", "3", false);
-
- snprintf(cmd, sizeof(cmd), "ENABLE_NETWORK %d", id);
- reply_len = sizeof(reply);
- wpagui->ctrlRequest(cmd, reply, &reply_len);
- if (strncmp(reply, "OK", 2) != 0) {
- QMessageBox::warning(this, "wpa_gui", "Failed to enable network in wpa_supplicant\n"
- "configuration.");
- /* Network was added, so continue anyway */
- }
- wpagui->triggerUpdate();
- wpagui->ctrlRequest("SAVE_CONFIG", reply, &reply_len);
-
- close();
-}
-
-
-void NetworkConfig::setWpaGui( WpaGui *_wpagui )
-{
- wpagui = _wpagui;
-}
-
-
-int NetworkConfig::setNetworkParam(int id, const char *field, const char *value, bool quote)
-{
- char reply[10], cmd[256];
- size_t reply_len;
- snprintf(cmd, sizeof(cmd), "SET_NETWORK %d %s %s%s%s",
- id, field, quote ? "\"" : "", value, quote ? "\"" : "");
- reply_len = sizeof(reply);
- wpagui->ctrlRequest(cmd, reply, &reply_len);
- return strncmp(reply, "OK", 2) == 0 ? 0 : -1;
-}
-
-
-void NetworkConfig::encrChanged( const QString &sel )
-{
- wepEnabled(sel.find("WEP") == 0);
-}
-
-
-void NetworkConfig::wepEnabled( bool enabled )
-{
- wep0Edit->setEnabled(enabled);
- wep1Edit->setEnabled(enabled);
- wep2Edit->setEnabled(enabled);
- wep3Edit->setEnabled(enabled);
- wep0Radio->setEnabled(enabled);
- wep1Radio->setEnabled(enabled);
- wep2Radio->setEnabled(enabled);
- wep3Radio->setEnabled(enabled);
-}
-
-
-void NetworkConfig::writeWepKey( int network_id, QLineEdit *edit, int id )
-{
- char buf[10];
- bool hex;
- const char *txt, *pos;
- size_t len;
-
- if (!edit->isEnabled() || edit->text().isEmpty())
- return;
-
- /*
- * Assume hex key if only hex characters are present and length matches
- * with 40, 104, or 128-bit key
- */
- txt = edit->text().ascii();
- if (strcmp(txt, WPA_GUI_KEY_DATA) == 0)
- return;
- len = strlen(txt);
- if (len == 0)
- return;
- pos = txt;
- hex = true;
- while (*pos) {
- if (!((*pos >= '0' && *pos <= '9') || (*pos >= 'a' && *pos <= 'f') ||
- (*pos >= 'A' && *pos <= 'F'))) {
- hex = false;
- break;
- }
- pos++;
- }
- if (hex && len != 10 && len != 26 && len != 32)
- hex = false;
- snprintf(buf, sizeof(buf), "wep_key%d", id);
- setNetworkParam(network_id, buf, txt, !hex);
-}
-
-
-static int key_value_isset(const char *reply, size_t reply_len)
-{
- return reply_len > 0 && (reply_len < 4 || memcmp(reply, "FAIL", 4) != 0);
-}
-
-
-void NetworkConfig::paramsFromConfig( int network_id )
-{
- int i, res;
-
- edit_network_id = network_id;
- getEapCapa();
-
- char reply[1024], cmd[256], *pos;
- size_t reply_len;
-
- snprintf(cmd, sizeof(cmd), "GET_NETWORK %d ssid", network_id);
- reply_len = sizeof(reply) - 1;
- if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 2 &&
- reply[0] == '"') {
- reply[reply_len] = '\0';
- pos = strchr(reply + 1, '"');
- if (pos)
- *pos = '\0';
- ssidEdit->setText(reply + 1);
- }
-
- snprintf(cmd, sizeof(cmd), "GET_NETWORK %d id_str", network_id);
- reply_len = sizeof(reply) - 1;
- if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 2 &&
- reply[0] == '"') {
- reply[reply_len] = '\0';
- pos = strchr(reply + 1, '"');
- if (pos)
- *pos = '\0';
- idstrEdit->setText(reply + 1);
- }
-
- snprintf(cmd, sizeof(cmd), "GET_NETWORK %d proto", network_id);
- reply_len = sizeof(reply) - 1;
- int wpa = 0;
- if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) {
- reply[reply_len] = '\0';
- if (strstr(reply, "RSN") || strstr(reply, "WPA2"))
- wpa = 2;
- else if (strstr(reply, "WPA"))
- wpa = 1;
- }
-
- int auth = AUTH_NONE, encr = 0;
- snprintf(cmd, sizeof(cmd), "GET_NETWORK %d key_mgmt", network_id);
- reply_len = sizeof(reply) - 1;
- if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) {
- reply[reply_len] = '\0';
- if (strstr(reply, "WPA-EAP"))
- auth = wpa & 2 ? AUTH_WPA2_EAP : AUTH_WPA_EAP;
- else if (strstr(reply, "WPA-PSK"))
- auth = wpa & 2 ? AUTH_WPA2_PSK : AUTH_WPA_PSK;
- else if (strstr(reply, "IEEE8021X")) {
- auth = AUTH_IEEE8021X;
- encr = 1;
- }
- }
-
- snprintf(cmd, sizeof(cmd), "GET_NETWORK %d pairwise", network_id);
- reply_len = sizeof(reply) - 1;
- if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) {
- reply[reply_len] = '\0';
- if (strstr(reply, "CCMP") && auth != AUTH_NONE)
- encr = 1;
- else if (strstr(reply, "TKIP"))
- encr = 0;
- else if (strstr(reply, "WEP"))
- encr = 1;
- else
- encr = 0;
- }
-
- snprintf(cmd, sizeof(cmd), "GET_NETWORK %d psk", network_id);
- reply_len = sizeof(reply) - 1;
- res = wpagui->ctrlRequest(cmd, reply, &reply_len);
- if (res >= 0 && reply_len >= 2 && reply[0] == '"') {
- reply[reply_len] = '\0';
- pos = strchr(reply + 1, '"');
- if (pos)
- *pos = '\0';
- pskEdit->setText(reply + 1);
- } else if (res >= 0 && key_value_isset(reply, reply_len)) {
- pskEdit->setText(WPA_GUI_KEY_DATA);
- }
-
- snprintf(cmd, sizeof(cmd), "GET_NETWORK %d identity", network_id);
- reply_len = sizeof(reply) - 1;
- if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 2 &&
- reply[0] == '"') {
- reply[reply_len] = '\0';
- pos = strchr(reply + 1, '"');
- if (pos)
- *pos = '\0';
- identityEdit->setText(reply + 1);
- }
-
- snprintf(cmd, sizeof(cmd), "GET_NETWORK %d password", network_id);
- reply_len = sizeof(reply) - 1;
- res = wpagui->ctrlRequest(cmd, reply, &reply_len);
- if (res >= 0 && reply_len >= 2 &&
- reply[0] == '"') {
- reply[reply_len] = '\0';
- pos = strchr(reply + 1, '"');
- if (pos)
- *pos = '\0';
- passwordEdit->setText(reply + 1);
- } else if (res >= 0 && key_value_isset(reply, reply_len)) {
- passwordEdit->setText(WPA_GUI_KEY_DATA);
- }
-
- snprintf(cmd, sizeof(cmd), "GET_NETWORK %d ca_cert", network_id);
- reply_len = sizeof(reply) - 1;
- if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 2 &&
- reply[0] == '"') {
- reply[reply_len] = '\0';
- pos = strchr(reply + 1, '"');
- if (pos)
- *pos = '\0';
- cacertEdit->setText(reply + 1);
- }
-
- snprintf(cmd, sizeof(cmd), "GET_NETWORK %d eap", network_id);
- reply_len = sizeof(reply) - 1;
- if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 1) {
- reply[reply_len] = '\0';
- for (i = 0; i < eapSelect->count(); i++) {
- if (eapSelect->text(i).compare(reply) == 0) {
- eapSelect->setCurrentItem(i);
- break;
- }
- }
- }
-
- for (i = 0; i < 4; i++) {
- QLineEdit *wepEdit;
- switch (i) {
- default:
- case 0:
- wepEdit = wep0Edit;
- break;
- case 1:
- wepEdit = wep1Edit;
- break;
- case 2:
- wepEdit = wep2Edit;
- break;
- case 3:
- wepEdit = wep3Edit;
- break;
- }
- snprintf(cmd, sizeof(cmd), "GET_NETWORK %d wep_key%d", network_id, i);
- reply_len = sizeof(reply) - 1;
- res = wpagui->ctrlRequest(cmd, reply, &reply_len);
- if (res >= 0 && reply_len >= 2 && reply[0] == '"') {
- reply[reply_len] = '\0';
- pos = strchr(reply + 1, '"');
- if (pos)
- *pos = '\0';
- if (auth == AUTH_NONE || auth == AUTH_IEEE8021X)
- encr = 1;
-
- wepEdit->setText(reply + 1);
- } else if (res >= 0 && key_value_isset(reply, reply_len)) {
- if (auth == AUTH_NONE || auth == AUTH_IEEE8021X)
- encr = 1;
- wepEdit->setText(WPA_GUI_KEY_DATA);
- }
- }
-
- snprintf(cmd, sizeof(cmd), "GET_NETWORK %d wep_tx_keyidx", network_id);
- reply_len = sizeof(reply) - 1;
- if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 1) {
- reply[reply_len] = '\0';
- switch (atoi(reply)) {
- case 0:
- wep0Radio->setChecked(true);
- break;
- case 1:
- wep1Radio->setChecked(true);
- break;
- case 2:
- wep2Radio->setChecked(true);
- break;
- case 3:
- wep3Radio->setChecked(true);
- break;
- }
- }
-
- authSelect->setCurrentItem(auth);
- authChanged(auth);
- encrSelect->setCurrentItem(encr);
- if (auth == AUTH_NONE || auth == AUTH_IEEE8021X)
- wepEnabled(encr == 1);
-
- removeButton->setEnabled(true);
- addButton->setText("Save");
-}
-
-
-void NetworkConfig::removeNetwork()
-{
- char reply[10], cmd[256];
- size_t reply_len;
-
- if (QMessageBox::information(this, "wpa_gui",
- "This will permanently remove the network\n"
- "from the configuration. Do you really want\n"
- "to remove this network?", "Yes", "No") != 0)
- return;
-
- snprintf(cmd, sizeof(cmd), "REMOVE_NETWORK %d", edit_network_id);
- reply_len = sizeof(reply);
- wpagui->ctrlRequest(cmd, reply, &reply_len);
- if (strncmp(reply, "OK", 2) != 0) {
- QMessageBox::warning(this, "wpa_gui",
- "Failed to remove network from wpa_supplicant\n"
- "configuration.");
- } else {
- wpagui->triggerUpdate();
- wpagui->ctrlRequest("SAVE_CONFIG", reply, &reply_len);
- }
-
- close();
-}
-
-
-void NetworkConfig::newNetwork()
-{
- new_network = true;
- getEapCapa();
-}
-
-
-void NetworkConfig::getEapCapa()
-{
- char reply[256];
- size_t reply_len;
-
- if (wpagui == NULL)
- return;
-
- reply_len = sizeof(reply) - 1;
- if (wpagui->ctrlRequest("GET_CAPABILITY eap", reply, &reply_len) < 0)
- return;
- reply[reply_len] = '\0';
-
- QString res(reply);
- QStringList types = QStringList::split(QChar(' '), res);
- eapSelect->insertStringList(types);
-}
diff --git a/wpa_supplicant/wpa_gui/scanresults.ui b/wpa_supplicant/wpa_gui/scanresults.ui
deleted file mode 100644
index dea305b4f..000000000
--- a/wpa_supplicant/wpa_gui/scanresults.ui
+++ /dev/null
@@ -1,179 +0,0 @@
-
-ScanResults
-
-
- ScanResults
-
-
-
- 0
- 0
- 452
- 225
-
-
-
- Scan results
-
-
-
- unnamed
-
-
-
-
- SSID
-
-
- true
-
-
- true
-
-
-
-
- BSSID
-
-
- true
-
-
- true
-
-
-
-
- frequency
-
-
- true
-
-
- true
-
-
-
-
- signal
-
-
- true
-
-
- true
-
-
-
-
- flags
-
-
- true
-
-
- true
-
-
-
- scanResultsView
-
-
- StyledPanel
-
-
- Sunken
-
-
-
-
- layout24
-
-
-
- unnamed
-
-
-
- spacer6
-
-
- Horizontal
-
-
- Expanding
-
-
-
- 50
- 20
-
-
-
-
-
- scanButton
-
-
- Scan
-
-
-
-
- closeButton
-
-
- Close
-
-
-
-
-
-
-
-
- closeButton
- clicked()
- ScanResults
- close()
-
-
- scanButton
- clicked()
- ScanResults
- scanRequest()
-
-
- scanResultsView
- doubleClicked(QListViewItem*)
- ScanResults
- bssSelected(QListViewItem*)
-
-
-
- common/wpa_ctrl.h
- wpagui.h
- networkconfig.h
- scanresults.ui.h
-
-
- class WpaGui;
-
-
- WpaGui *wpagui;
- QTimer *timer;
-
-
- setWpaGui( WpaGui * _wpagui )
- updateResults()
- scanRequest()
- getResults()
- bssSelected( QListViewItem * sel )
-
-
- init()
- destroy()
-
-
-
-
diff --git a/wpa_supplicant/wpa_gui/scanresults.ui.h b/wpa_supplicant/wpa_gui/scanresults.ui.h
deleted file mode 100644
index 530d2e6a4..000000000
--- a/wpa_supplicant/wpa_gui/scanresults.ui.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-** ui.h extension file, included from the uic-generated form implementation.
-**
-** If you want to add, delete, or rename functions or slots, use
-** Qt Designer to update this file, preserving your code.
-**
-** You should not define a constructor or destructor in this file.
-** Instead, write your code in functions called init() and destroy().
-** These will automatically be called by the form's constructor and
-** destructor.
-*****************************************************************************/
-
-void ScanResults::init()
-{
- wpagui = NULL;
-}
-
-
-void ScanResults::destroy()
-{
- delete timer;
-}
-
-
-void ScanResults::setWpaGui(WpaGui *_wpagui)
-{
- wpagui = _wpagui;
- updateResults();
-
- timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), SLOT(getResults()));
- timer->start(10000, FALSE);
-}
-
-
-void ScanResults::updateResults()
-{
- char reply[8192];
- size_t reply_len;
-
- if (wpagui == NULL)
- return;
-
- reply_len = sizeof(reply) - 1;
- if (wpagui->ctrlRequest("SCAN_RESULTS", reply, &reply_len) < 0)
- return;
- reply[reply_len] = '\0';
-
- scanResultsView->clear();
-
- QString res(reply);
- QStringList lines = QStringList::split(QChar('\n'), res);
- bool first = true;
- for (QStringList::Iterator it = lines.begin(); it != lines.end(); it++) {
- if (first) {
- first = false;
- continue;
- }
-
- QStringList cols = QStringList::split(QChar('\t'), *it, true);
- QString ssid, bssid, freq, signal, flags;
- bssid = cols.count() > 0 ? cols[0] : "";
- freq = cols.count() > 1 ? cols[1] : "";
- signal = cols.count() > 2 ? cols[2] : "";
- flags = cols.count() > 3 ? cols[3] : "";
- ssid = cols.count() > 4 ? cols[4] : "";
- new Q3ListViewItem(scanResultsView, ssid, bssid, freq, signal, flags);
- }
-}
-
-
-void ScanResults::scanRequest()
-{
- char reply[10];
- size_t reply_len = sizeof(reply);
-
- if (wpagui == NULL)
- return;
-
- wpagui->ctrlRequest("SCAN", reply, &reply_len);
-}
-
-
-void ScanResults::getResults()
-{
- updateResults();
-}
-
-
-
-
-void ScanResults::bssSelected( Q3ListViewItem * sel )
-{
- NetworkConfig *nc = new NetworkConfig();
- if (nc == NULL)
- return;
- nc->setWpaGui(wpagui);
- nc->paramsFromScanResults(sel);
- nc->show();
- nc->exec();
-}
diff --git a/wpa_supplicant/wpa_gui/setup-mingw-cross-compiling b/wpa_supplicant/wpa_gui/setup-mingw-cross-compiling
deleted file mode 100755
index e173b0013..000000000
--- a/wpa_supplicant/wpa_gui/setup-mingw-cross-compiling
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-# qmake seems to be forcing include and lib paths from the original build
-# and I have no idea how to change these. For now, just override the
-# directories in the Makefile.Release file after qmake run.
-
-qmake -spec /q/jm/qt4-win/4.0.0/mkspecs/win32-g++ wpa_gui.pro -o Makefile
-cat Makefile.Release |
- sed s%qt4/lib%qt4-win/4.0.0/lib%g |
- sed s%qt4/include%qt4-win/4.0.0/include%g > tmp.Makefile.Release &&
-mv -f tmp.Makefile.Release Makefile.Release
diff --git a/wpa_supplicant/wpa_gui/userdatarequest.ui b/wpa_supplicant/wpa_gui/userdatarequest.ui
deleted file mode 100644
index 6106b1e8b..000000000
--- a/wpa_supplicant/wpa_gui/userdatarequest.ui
+++ /dev/null
@@ -1,163 +0,0 @@
-
-UserDataRequest
-
-
- UserDataRequest
-
-
-
- 0
- 0
- 216
- 103
-
-
-
- Authentication credentials required
-
-
- true
-
-
-
- unnamed
-
-
-
- queryInfo
-
-
-
-
-
-
-
- layout28
-
-
-
- unnamed
-
-
-
- queryField
-
-
-
-
-
-
-
- queryEdit
-
-
- true
-
-
- Password
-
-
-
-
-
-
- layout27
-
-
-
- unnamed
-
-
-
- spacer4
-
-
- Horizontal
-
-
- Expanding
-
-
-
- 20
- 20
-
-
-
-
-
- buttonOk
-
-
- &OK
-
-
-
-
-
- true
-
-
- true
-
-
-
-
- buttonCancel
-
-
- &Cancel
-
-
-
-
-
- true
-
-
-
-
-
-
-
-
- buttonOk
- clicked()
- UserDataRequest
- sendReply()
-
-
- buttonCancel
- clicked()
- UserDataRequest
- reject()
-
-
- queryEdit
- returnPressed()
- UserDataRequest
- sendReply()
-
-
-
- common/wpa_ctrl.h
- wpagui.h
- userdatarequest.ui.h
-
-
- class WpaGui;
-
-
- WpaGui *wpagui;
- int networkid;
- QString field;
-
-
- sendReply()
-
-
- setParams( WpaGui * _wpagui, const char * reqMsg )
-
-
-
-
diff --git a/wpa_supplicant/wpa_gui/userdatarequest.ui.h b/wpa_supplicant/wpa_gui/userdatarequest.ui.h
deleted file mode 100644
index 66d4478d2..000000000
--- a/wpa_supplicant/wpa_gui/userdatarequest.ui.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-** ui.h extension file, included from the uic-generated form implementation.
-**
-** If you want to add, delete, or rename functions or slots, use
-** Qt Designer to update this file, preserving your code.
-**
-** You should not define a constructor or destructor in this file.
-** Instead, write your code in functions called init() and destroy().
-** These will automatically be called by the form's constructor and
-** destructor.
-*****************************************************************************/
-
-#include
-
-int UserDataRequest::setParams(WpaGui *_wpagui, const char *reqMsg)
-{
- char *tmp, *pos, *pos2;
- wpagui = _wpagui;
- tmp = strdup(reqMsg);
- if (tmp == NULL)
- return -1;
- pos = strchr(tmp, '-');
- if (pos == NULL) {
- free(tmp);
- return -1;
- }
- *pos++ = '\0';
- field = tmp;
- pos2 = strchr(pos, ':');
- if (pos2 == NULL) {
- free(tmp);
- return -1;
- }
- *pos2++ = '\0';
-
- networkid = atoi(pos);
- queryInfo->setText(pos2);
- if (strcmp(tmp, "PASSWORD") == 0) {
- queryField->setText("Password: ");
- queryEdit->setEchoMode(QLineEdit::Password);
- } else if (strcmp(tmp, "NEW_PASSWORD") == 0) {
- queryField->setText("New password: ");
- queryEdit->setEchoMode(QLineEdit::Password);
- } else if (strcmp(tmp, "IDENTITY") == 0)
- queryField->setText("Identity: ");
- else if (strcmp(tmp, "PASSPHRASE") == 0) {
- queryField->setText("Private key passphrase: ");
- queryEdit->setEchoMode(QLineEdit::Password);
- } else
- queryField->setText(field + ":");
- free(tmp);
-
- return 0;
-}
-
-
-void UserDataRequest::sendReply()
-{
- char reply[10];
- size_t reply_len = sizeof(reply);
-
- if (wpagui == NULL) {
- reject();
- return;
- }
-
- QString cmd = QString(WPA_CTRL_RSP) + field + '-' +
- QString::number(networkid) + ':' +
- queryEdit->text();
- wpagui->ctrlRequest(cmd.ascii(), reply, &reply_len);
- accept();
-}
diff --git a/wpa_supplicant/wpa_gui/wpa_gui.pro b/wpa_supplicant/wpa_gui/wpa_gui.pro
deleted file mode 100644
index a42a4ac84..000000000
--- a/wpa_supplicant/wpa_gui/wpa_gui.pro
+++ /dev/null
@@ -1,50 +0,0 @@
-TEMPLATE = app
-LANGUAGE = C++
-
-CONFIG += qt warn_on release
-
-DEFINES += CONFIG_CTRL_IFACE
-
-win32 {
- LIBS += -lws2_32 -static
- DEFINES += CONFIG_NATIVE_WINDOWS CONFIG_CTRL_IFACE_NAMED_PIPE
- SOURCES += ../../src/utils/os_win32.c
-} else:win32-g++ {
- # cross compilation to win32
- LIBS += -lws2_32 -static
- DEFINES += CONFIG_NATIVE_WINDOWS CONFIG_CTRL_IFACE_NAMED_PIPE
- SOURCES += ../../src/utils/os_win32.c
-} else {
- DEFINES += CONFIG_CTRL_IFACE_UNIX
- SOURCES += ../../src/utils/os_unix.c
-}
-
-INCLUDEPATH += . .. ../../src ../../src/utils
-
-HEADERS += wpamsg.h
-
-SOURCES += main.cpp \
- ../../src/common/wpa_ctrl.c
-
-FORMS = wpagui.ui \
- eventhistory.ui \
- scanresults.ui \
- userdatarequest.ui \
- networkconfig.ui
-
-
-unix {
- UI_DIR = .ui
- MOC_DIR = .moc
- OBJECTS_DIR = .obj
-}
-
-qtver = $$[QT_VERSION]
-isEmpty( qtver ) {
- message(Compiling for Qt 3.x)
- DEFINES += Q3ListViewItem=QListViewItem
-} else {
- message(Compiling for Qt $$qtver)
- QT += qt3support
- CONFIG += uic3
-}
diff --git a/wpa_supplicant/wpa_gui/wpagui.ui b/wpa_supplicant/wpa_gui/wpagui.ui
deleted file mode 100644
index b49d96b1e..000000000
--- a/wpa_supplicant/wpa_gui/wpagui.ui
+++ /dev/null
@@ -1,471 +0,0 @@
-
-WpaGui
-
-
- WpaGui
-
-
-
- 0
- 0
- 279
- 308
-
-
-
- wpa_gui
-
-
-
- unnamed
-
-
-
- textLabel16
-
-
- Adapter:
-
-
-
-
- adapterSelect
-
-
-
-
- textLabel8
-
-
- Network:
-
-
-
-
- networkSelect
-
-
-
-
- frame3
-
-
- StyledPanel
-
-
- Raised
-
-
-
- unnamed
-
-
-
- textLabel1
-
-
- Status:
-
-
-
-
- textLabel2
-
-
- Last message:
-
-
-
-
- textLabel3
-
-
- Authentication:
-
-
-
-
- textLabel4
-
-
- Encryption:
-
-
-
-
- textLabel5
-
-
- SSID:
-
-
-
-
- textLabel6
-
-
- BSSID:
-
-
-
-
- textLabel7
-
-
- IP address:
-
-
-
-
- textStatus
-
-
-
-
-
-
-
- textLastMessage
-
-
-
-
-
-
-
- textAuthentication
-
-
-
-
-
-
-
- textEncryption
-
-
-
-
-
-
-
- textSsid
-
-
-
-
-
-
-
- textBssid
-
-
-
-
-
-
-
- textIpAddress
-
-
-
-
-
-
-
-
-
- spacer7
-
-
- Horizontal
-
-
- Expanding
-
-
-
- 16
- 16
-
-
-
-
-
- connectButton
-
-
- Connect
-
-
-
-
- disconnectButton
-
-
- Disconnect
-
-
-
-
- scanButton
-
-
- Scan
-
-
-
-
-
-
- MenuBar
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
- fileExitAction
-
-
- Exit
-
-
- E&xit
-
-
- Ctrl+Q
-
-
-
-
- helpContentsAction
-
-
- false
-
-
- Contents
-
-
- &Contents...
-
-
-
-
-
-
-
- helpIndexAction
-
-
- false
-
-
- Index
-
-
- &Index...
-
-
-
-
-
-
-
- helpAboutAction
-
-
- About
-
-
- &About
-
-
-
-
-
-
-
- fileEventHistoryAction
-
-
- Event History
-
-
- Event &History
-
-
-
-
- fileAdd_NetworkAction
-
-
- Add Network
-
-
- &Add Network
-
-
-
-
- fileEdit_networkAction
-
-
- Edit Network
-
-
- &Edit Network
-
-
-
-
-
- helpIndexAction
- activated()
- WpaGui
- helpIndex()
-
-
- helpContentsAction
- activated()
- WpaGui
- helpContents()
-
-
- helpAboutAction
- activated()
- WpaGui
- helpAbout()
-
-
- fileExitAction
- activated()
- WpaGui
- close()
-
-
- disconnectButton
- clicked()
- WpaGui
- disconnect()
-
-
- scanButton
- clicked()
- WpaGui
- scan()
-
-
- connectButton
- clicked()
- WpaGui
- connectB()
-
-
- fileEventHistoryAction
- activated()
- WpaGui
- eventHistory()
-
-
- networkSelect
- activated(const QString&)
- WpaGui
- selectNetwork(const QString&)
-
-
- fileEdit_networkAction
- activated()
- WpaGui
- editNetwork()
-
-
- fileAdd_NetworkAction
- activated()
- WpaGui
- addNetwork()
-
-
- adapterSelect
- activated(const QString&)
- WpaGui
- selectAdapter(const QString&)
-
-
-
- qtimer.h
- qsocketnotifier.h
- wpamsg.h
- eventhistory.h
- scanresults.h
- common/wpa_ctrl.h
- dirent.h
- qmessagebox.h
- qapplication.h
- userdatarequest.h
- networkconfig.h
- wpagui.ui.h
-
-
- class UserDataRequest;
-
-
- ScanResults *scanres;
- bool networkMayHaveChanged;
- char *ctrl_iface;
- EventHistory *eh;
- struct wpa_ctrl *ctrl_conn;
- QSocketNotifier *msgNotifier;
- QTimer *timer;
- int pingsToStatusUpdate;
- WpaMsgList msgs;
- char *ctrl_iface_dir;
- struct wpa_ctrl *monitor_conn;
- UserDataRequest *udr;
-
-
- parse_argv()
- updateStatus()
- updateNetworks()
- helpIndex()
- helpContents()
- helpAbout()
- disconnect()
- scan()
- eventHistory()
- ping()
- processMsg( char * msg )
- processCtrlReq( const char * req )
- receiveMsgs()
- connectB()
- selectNetwork( const QString & sel )
- editNetwork()
- addNetwork()
- selectAdapter( const QString & sel )
-
-
- init()
- destroy()
- openCtrlConnection( const char * ifname )
- ctrlRequest( const char * cmd, char * buf, size_t * buflen )
- triggerUpdate()
-
-
-
-
diff --git a/wpa_supplicant/wpa_gui/wpagui.ui.h b/wpa_supplicant/wpa_gui/wpagui.ui.h
deleted file mode 100644
index 678ff1be3..000000000
--- a/wpa_supplicant/wpa_gui/wpagui.ui.h
+++ /dev/null
@@ -1,730 +0,0 @@
-/****************************************************************************
-** ui.h extension file, included from the uic-generated form implementation.
-**
-** If you want to add, delete, or rename functions or slots, use
-** Qt Designer to update this file, preserving your code.
-**
-** You should not define a constructor or destructor in this file.
-** Instead, write your code in functions called init() and destroy().
-** These will automatically be called by the form's constructor and
-** destructor.
-*****************************************************************************/
-
-
-#ifdef __MINGW32__
-/* Need to get getopt() */
-#include
-#endif
-
-#include
-
-void WpaGui::init()
-{
- eh = NULL;
- scanres = NULL;
- udr = NULL;
- ctrl_iface = NULL;
- ctrl_conn = NULL;
- monitor_conn = NULL;
- msgNotifier = NULL;
- ctrl_iface_dir = strdup("/var/run/wpa_supplicant");
-
- parse_argv();
-
- textStatus->setText("connecting to wpa_supplicant");
- timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), SLOT(ping()));
- timer->start(1000, FALSE);
-
- if (openCtrlConnection(ctrl_iface) < 0) {
- printf("Failed to open control connection to wpa_supplicant.\n");
- }
-
- updateStatus();
- networkMayHaveChanged = true;
- updateNetworks();
-}
-
-
-void WpaGui::destroy()
-{
- delete msgNotifier;
-
- if (monitor_conn) {
- wpa_ctrl_detach(monitor_conn);
- wpa_ctrl_close(monitor_conn);
- monitor_conn = NULL;
- }
- if (ctrl_conn) {
- wpa_ctrl_close(ctrl_conn);
- ctrl_conn = NULL;
- }
-
- if (eh) {
- eh->close();
- delete eh;
- eh = NULL;
- }
-
- if (scanres) {
- scanres->close();
- delete scanres;
- scanres = NULL;
- }
-
- if (udr) {
- udr->close();
- delete udr;
- udr = NULL;
- }
-
- free(ctrl_iface);
- ctrl_iface = NULL;
-
- free(ctrl_iface_dir);
- ctrl_iface_dir = NULL;
-}
-
-
-void WpaGui::parse_argv()
-{
- int c;
- for (;;) {
- c = getopt(qApp->argc(), qApp->argv(), "i:p:");
- if (c < 0)
- break;
- switch (c) {
- case 'i':
- free(ctrl_iface);
- ctrl_iface = strdup(optarg);
- break;
- case 'p':
- free(ctrl_iface_dir);
- ctrl_iface_dir = strdup(optarg);
- break;
- }
- }
-}
-
-
-int WpaGui::openCtrlConnection(const char *ifname)
-{
- char *cfile;
- int flen;
- char buf[2048], *pos, *pos2;
- size_t len;
-
- if (ifname) {
- if (ifname != ctrl_iface) {
- free(ctrl_iface);
- ctrl_iface = strdup(ifname);
- }
- } else {
-#ifdef CONFIG_CTRL_IFACE_UDP
- free(ctrl_iface);
- ctrl_iface = strdup("udp");
-#endif /* CONFIG_CTRL_IFACE_UDP */
-#ifdef CONFIG_CTRL_IFACE_UNIX
- struct dirent *dent;
- DIR *dir = opendir(ctrl_iface_dir);
- free(ctrl_iface);
- ctrl_iface = NULL;
- if (dir) {
- while ((dent = readdir(dir))) {
-#ifdef _DIRENT_HAVE_D_TYPE
- /* Skip the file if it is not a socket.
- * Also accept DT_UNKNOWN (0) in case
- * the C library or underlying file
- * system does not support d_type. */
- if (dent->d_type != DT_SOCK &&
- dent->d_type != DT_UNKNOWN)
- continue;
-#endif /* _DIRENT_HAVE_D_TYPE */
-
- if (strcmp(dent->d_name, ".") == 0 ||
- strcmp(dent->d_name, "..") == 0)
- continue;
- printf("Selected interface '%s'\n", dent->d_name);
- ctrl_iface = strdup(dent->d_name);
- break;
- }
- closedir(dir);
- }
-#endif /* CONFIG_CTRL_IFACE_UNIX */
-#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE
- struct wpa_ctrl *ctrl;
- int ret;
-
- free(ctrl_iface);
- ctrl_iface = NULL;
-
- ctrl = wpa_ctrl_open(NULL);
- if (ctrl) {
- len = sizeof(buf) - 1;
- ret = wpa_ctrl_request(ctrl, "INTERFACES", 10, buf, &len, NULL);
- if (ret >= 0) {
- buf[len] = '\0';
- pos = strchr(buf, '\n');
- if (pos)
- *pos = '\0';
- ctrl_iface = strdup(buf);
- }
- wpa_ctrl_close(ctrl);
- }
-#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
- }
-
- if (ctrl_iface == NULL)
- return -1;
-
-#ifdef CONFIG_CTRL_IFACE_UNIX
- flen = strlen(ctrl_iface_dir) + strlen(ctrl_iface) + 2;
- cfile = (char *) malloc(flen);
- if (cfile == NULL)
- return -1;
- snprintf(cfile, flen, "%s/%s", ctrl_iface_dir, ctrl_iface);
-#else /* CONFIG_CTRL_IFACE_UNIX */
- flen = strlen(ctrl_iface) + 1;
- cfile = (char *) malloc(flen);
- if (cfile == NULL)
- return -1;
- snprintf(cfile, flen, "%s", ctrl_iface);
-#endif /* CONFIG_CTRL_IFACE_UNIX */
-
- if (ctrl_conn) {
- wpa_ctrl_close(ctrl_conn);
- ctrl_conn = NULL;
- }
-
- if (monitor_conn) {
- delete msgNotifier;
- msgNotifier = NULL;
- wpa_ctrl_detach(monitor_conn);
- wpa_ctrl_close(monitor_conn);
- monitor_conn = NULL;
- }
-
- printf("Trying to connect to '%s'\n", cfile);
- ctrl_conn = wpa_ctrl_open(cfile);
- if (ctrl_conn == NULL) {
- free(cfile);
- return -1;
- }
- monitor_conn = wpa_ctrl_open(cfile);
- free(cfile);
- if (monitor_conn == NULL) {
- wpa_ctrl_close(ctrl_conn);
- return -1;
- }
- if (wpa_ctrl_attach(monitor_conn)) {
- printf("Failed to attach to wpa_supplicant\n");
- wpa_ctrl_close(monitor_conn);
- monitor_conn = NULL;
- wpa_ctrl_close(ctrl_conn);
- ctrl_conn = NULL;
- return -1;
- }
-
-#if defined(CONFIG_CTRL_IFACE_UNIX) || defined(CONFIG_CTRL_IFACE_UDP)
- msgNotifier = new QSocketNotifier(wpa_ctrl_get_fd(monitor_conn),
- QSocketNotifier::Read, this);
- connect(msgNotifier, SIGNAL(activated(int)), SLOT(receiveMsgs()));
-#endif
-
- adapterSelect->clear();
- adapterSelect->insertItem(ctrl_iface);
- adapterSelect->setCurrentItem(0);
-
- len = sizeof(buf) - 1;
- if (wpa_ctrl_request(ctrl_conn, "INTERFACES", 10, buf, &len, NULL) >= 0) {
- buf[len] = '\0';
- pos = buf;
- while (*pos) {
- pos2 = strchr(pos, '\n');
- if (pos2)
- *pos2 = '\0';
- if (strcmp(pos, ctrl_iface) != 0)
- adapterSelect->insertItem(pos);
- if (pos2)
- pos = pos2 + 1;
- else
- break;
- }
- }
-
- return 0;
-}
-
-
-static void wpa_gui_msg_cb(char *msg, size_t)
-{
- /* This should not happen anymore since two control connections are used. */
- printf("missed message: %s\n", msg);
-}
-
-
-int WpaGui::ctrlRequest(const char *cmd, char *buf, size_t *buflen)
-{
- int ret;
-
- if (ctrl_conn == NULL)
- return -3;
- ret = wpa_ctrl_request(ctrl_conn, cmd, strlen(cmd), buf, buflen,
- wpa_gui_msg_cb);
- if (ret == -2) {
- printf("'%s' command timed out.\n", cmd);
- } else if (ret < 0) {
- printf("'%s' command failed.\n", cmd);
- }
-
- return ret;
-}
-
-
-void WpaGui::updateStatus()
-{
- char buf[2048], *start, *end, *pos;
- size_t len;
-
- pingsToStatusUpdate = 10;
-
- len = sizeof(buf) - 1;
- if (ctrl_conn == NULL || ctrlRequest("STATUS", buf, &len) < 0) {
- textStatus->setText("Could not get status from wpa_supplicant");
- textAuthentication->clear();
- textEncryption->clear();
- textSsid->clear();
- textBssid->clear();
- textIpAddress->clear();
- return;
- }
-
- buf[len] = '\0';
-
- bool auth_updated = false, ssid_updated = false;
- bool bssid_updated = false, ipaddr_updated = false;
- bool status_updated = false;
- char *pairwise_cipher = NULL, *group_cipher = NULL;
-
- start = buf;
- while (*start) {
- bool last = false;
- end = strchr(start, '\n');
- if (end == NULL) {
- last = true;
- end = start;
- while (end[0] && end[1])
- end++;
- }
- *end = '\0';
-
- pos = strchr(start, '=');
- if (pos) {
- *pos++ = '\0';
- if (strcmp(start, "bssid") == 0) {
- bssid_updated = true;
- textBssid->setText(pos);
- } else if (strcmp(start, "ssid") == 0) {
- ssid_updated = true;
- textSsid->setText(pos);
- } else if (strcmp(start, "ip_address") == 0) {
- ipaddr_updated = true;
- textIpAddress->setText(pos);
- } else if (strcmp(start, "wpa_state") == 0) {
- status_updated = true;
- textStatus->setText(pos);
- } else if (strcmp(start, "key_mgmt") == 0) {
- auth_updated = true;
- textAuthentication->setText(pos);
- /* TODO: could add EAP status to this */
- } else if (strcmp(start, "pairwise_cipher") == 0) {
- pairwise_cipher = pos;
- } else if (strcmp(start, "group_cipher") == 0) {
- group_cipher = pos;
- }
- }
-
- if (last)
- break;
- start = end + 1;
- }
-
- if (pairwise_cipher || group_cipher) {
- QString encr;
- if (pairwise_cipher && group_cipher &&
- strcmp(pairwise_cipher, group_cipher) != 0) {
- encr.append(pairwise_cipher);
- encr.append(" + ");
- encr.append(group_cipher);
- } else if (pairwise_cipher) {
- encr.append(pairwise_cipher);
- } else {
- encr.append(group_cipher);
- encr.append(" [group key only]");
- }
- textEncryption->setText(encr);
- } else
- textEncryption->clear();
-
- if (!status_updated)
- textStatus->clear();
- if (!auth_updated)
- textAuthentication->clear();
- if (!ssid_updated)
- textSsid->clear();
- if (!bssid_updated)
- textBssid->clear();
- if (!ipaddr_updated)
- textIpAddress->clear();
-}
-
-
-void WpaGui::updateNetworks()
-{
- char buf[2048], *start, *end, *id, *ssid, *bssid, *flags;
- size_t len;
- int first_active = -1;
- bool selected = false;
-
- if (!networkMayHaveChanged)
- return;
-
- networkSelect->clear();
-
- if (ctrl_conn == NULL)
- return;
-
- len = sizeof(buf) - 1;
- if (ctrlRequest("LIST_NETWORKS", buf, &len) < 0)
- return;
-
- buf[len] = '\0';
- start = strchr(buf, '\n');
- if (start == NULL)
- return;
- start++;
-
- while (*start) {
- bool last = false;
- end = strchr(start, '\n');
- if (end == NULL) {
- last = true;
- end = start;
- while (end[0] && end[1])
- end++;
- }
- *end = '\0';
-
- id = start;
- ssid = strchr(id, '\t');
- if (ssid == NULL)
- break;
- *ssid++ = '\0';
- bssid = strchr(ssid, '\t');
- if (bssid == NULL)
- break;
- *bssid++ = '\0';
- flags = strchr(bssid, '\t');
- if (flags == NULL)
- break;
- *flags++ = '\0';
-
- QString network(id);
- network.append(": ");
- network.append(ssid);
- networkSelect->insertItem(network);
-
- if (strstr(flags, "[CURRENT]")) {
- networkSelect->setCurrentItem(networkSelect->count() - 1);
- selected = true;
- } else if (first_active < 0 && strstr(flags, "[DISABLED]") == NULL)
- first_active = networkSelect->count() - 1;
-
- if (last)
- break;
- start = end + 1;
- }
-
- if (!selected && first_active >= 0)
- networkSelect->setCurrentItem(first_active);
-
- networkMayHaveChanged = false;
-}
-
-
-void WpaGui::helpIndex()
-{
- printf("helpIndex\n");
-}
-
-
-void WpaGui::helpContents()
-{
- printf("helpContents\n");
-}
-
-
-void WpaGui::helpAbout()
-{
- QMessageBox::about(this, "wpa_gui for wpa_supplicant",
- "Copyright (c) 2003-2008,\n"
- "Jouni Malinen \n"
- "and contributors.\n"
- "\n"
- "This program is free software. You can\n"
- "distribute it and/or modify it under the terms of\n"
- "the GNU General Public License version 2.\n"
- "\n"
- "Alternatively, this software may be distributed\n"
- "under the terms of the BSD license.\n"
- "\n"
- "This product includes software developed\n"
- "by the OpenSSL Project for use in the\n"
- "OpenSSL Toolkit (http://www.openssl.org/)\n");
-}
-
-
-void WpaGui::disconnect()
-{
- char reply[10];
- size_t reply_len = sizeof(reply);
- ctrlRequest("DISCONNECT", reply, &reply_len);
-}
-
-
-void WpaGui::scan()
-{
- if (scanres) {
- scanres->close();
- delete scanres;
- }
-
- scanres = new ScanResults();
- if (scanres == NULL)
- return;
- scanres->setWpaGui(this);
- scanres->show();
- scanres->exec();
-}
-
-
-void WpaGui::eventHistory()
-{
- if (eh) {
- eh->close();
- delete eh;
- }
-
- eh = new EventHistory();
- if (eh == NULL)
- return;
- eh->addEvents(msgs);
- eh->show();
- eh->exec();
-}
-
-
-void WpaGui::ping()
-{
- char buf[10];
- size_t len;
-
-#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE
- /*
- * QSocketNotifier cannot be used with Windows named pipes, so use a timer
- * to check for received messages for now. This could be optimized be doing
- * something specific to named pipes or Windows events, but it is not clear
- * what would be the best way of doing that in Qt.
- */
- receiveMsgs();
-#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
-
- if (scanres && !scanres->isVisible()) {
- delete scanres;
- scanres = NULL;
- }
-
- if (eh && !eh->isVisible()) {
- delete eh;
- eh = NULL;
- }
-
- if (udr && !udr->isVisible()) {
- delete udr;
- udr = NULL;
- }
-
- len = sizeof(buf) - 1;
- if (ctrlRequest("PING", buf, &len) < 0) {
- printf("PING failed - trying to reconnect\n");
- if (openCtrlConnection(ctrl_iface) >= 0) {
- printf("Reconnected successfully\n");
- pingsToStatusUpdate = 0;
- }
- }
-
- pingsToStatusUpdate--;
- if (pingsToStatusUpdate <= 0) {
- updateStatus();
- updateNetworks();
- }
-}
-
-
-static int str_match(const char *a, const char *b)
-{
- return strncmp(a, b, strlen(b)) == 0;
-}
-
-
-void WpaGui::processMsg(char *msg)
-{
- char *pos = msg, *pos2;
- int priority = 2;
-
- if (*pos == '<') {
- /* skip priority */
- pos++;
- priority = atoi(pos);
- pos = strchr(pos, '>');
- if (pos)
- pos++;
- else
- pos = msg;
- }
-
- WpaMsg wm(pos, priority);
- if (eh)
- eh->addEvent(wm);
- msgs.append(wm);
- while (msgs.count() > 100)
- msgs.pop_front();
-
- /* Update last message with truncated version of the event */
- if (strncmp(pos, "CTRL-", 5) == 0) {
- pos2 = strchr(pos, str_match(pos, WPA_CTRL_REQ) ? ':' : ' ');
- if (pos2)
- pos2++;
- else
- pos2 = pos;
- } else
- pos2 = pos;
- QString lastmsg = pos2;
- lastmsg.truncate(40);
- textLastMessage->setText(lastmsg);
-
- pingsToStatusUpdate = 0;
- networkMayHaveChanged = true;
-
- if (str_match(pos, WPA_CTRL_REQ))
- processCtrlReq(pos + strlen(WPA_CTRL_REQ));
-}
-
-
-void WpaGui::processCtrlReq(const char *req)
-{
- if (udr) {
- udr->close();
- delete udr;
- }
- udr = new UserDataRequest();
- if (udr == NULL)
- return;
- if (udr->setParams(this, req) < 0) {
- delete udr;
- udr = NULL;
- return;
- }
- udr->show();
- udr->exec();
-}
-
-
-void WpaGui::receiveMsgs()
-{
- char buf[256];
- size_t len;
-
- while (monitor_conn && wpa_ctrl_pending(monitor_conn) > 0) {
- len = sizeof(buf) - 1;
- if (wpa_ctrl_recv(monitor_conn, buf, &len) == 0) {
- buf[len] = '\0';
- processMsg(buf);
- }
- }
-}
-
-
-void WpaGui::connectB()
-{
- char reply[10];
- size_t reply_len = sizeof(reply);
- ctrlRequest("REASSOCIATE", reply, &reply_len);
-}
-
-
-void WpaGui::selectNetwork( const QString &sel )
-{
- QString cmd(sel);
- char reply[10];
- size_t reply_len = sizeof(reply);
-
- int pos = cmd.find(':');
- if (pos < 0) {
- printf("Invalid selectNetwork '%s'\n", cmd.ascii());
- return;
- }
- cmd.truncate(pos);
- cmd.prepend("SELECT_NETWORK ");
- ctrlRequest(cmd.ascii(), reply, &reply_len);
-}
-
-
-void WpaGui::editNetwork()
-{
- QString sel(networkSelect->currentText());
- int pos = sel.find(':');
- if (pos < 0) {
- printf("Invalid selectNetwork '%s'\n", sel.ascii());
- return;
- }
- sel.truncate(pos);
-
- NetworkConfig *nc = new NetworkConfig();
- if (nc == NULL)
- return;
- nc->setWpaGui(this);
-
- nc->paramsFromConfig(sel.toInt());
- nc->show();
- nc->exec();
-}
-
-
-void WpaGui::triggerUpdate()
-{
- updateStatus();
- networkMayHaveChanged = true;
- updateNetworks();
-}
-
-
-void WpaGui::addNetwork()
-{
- NetworkConfig *nc = new NetworkConfig();
- if (nc == NULL)
- return;
- nc->setWpaGui(this);
- nc->newNetwork();
- nc->show();
- nc->exec();
-}
-
-
-void WpaGui::selectAdapter( const QString & sel )
-{
- if (openCtrlConnection(sel.ascii()) < 0)
- printf("Failed to open control connection to wpa_supplicant.\n");
- updateStatus();
- updateNetworks();
-}
diff --git a/wpa_supplicant/wpa_gui/wpamsg.h b/wpa_supplicant/wpa_gui/wpamsg.h
deleted file mode 100644
index f3fce0697..000000000
--- a/wpa_supplicant/wpa_gui/wpamsg.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef WPAMSG_H
-#define WPAMSG_H
-
-class WpaMsg;
-
-#if QT_VERSION >= 0x040000
-#include
-#include
-typedef QLinkedList WpaMsgList;
-#else
-#include
-typedef QValueList WpaMsgList;
-#endif
-
-class WpaMsg {
-public:
- WpaMsg() {}
- WpaMsg(const QString &_msg, int _priority = 2)
- : msg(_msg), priority(_priority)
- {
- timestamp = QDateTime::currentDateTime();
- }
-
- QString getMsg() const { return msg; }
- int getPriority() const { return priority; }
- QDateTime getTimestamp() const { return timestamp; }
-
-private:
- QString msg;
- int priority;
- QDateTime timestamp;
-};
-
-#endif /* WPAMSG_H */