Remove obsoleted Qt3-based wpa_gui
This code has not been maintained for years and there is no plan on doing so either in the future. The Qt4-based wpa_gui-qt4 version can be used as a replacement for this older wpa_gui version. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
c4a893c340
commit
67a5206482
16 changed files with 2 additions and 3042 deletions
|
@ -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
|
||||
|
|
3
wpa_supplicant/wpa_gui/.gitignore
vendored
3
wpa_supplicant/wpa_gui/.gitignore
vendored
|
@ -1,3 +0,0 @@
|
|||
.moc
|
||||
.obj
|
||||
.ui
|
|
@ -1,125 +0,0 @@
|
|||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>EventHistory</class>
|
||||
<widget class="QDialog">
|
||||
<property name="name">
|
||||
<cstring>EventHistory</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>533</width>
|
||||
<height>285</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Event history</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QListView">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Timestamp</string>
|
||||
</property>
|
||||
<property name="clickable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Message</string>
|
||||
</property>
|
||||
<property name="clickable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</column>
|
||||
<property name="name">
|
||||
<cstring>eventListView</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>7</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="resizePolicy">
|
||||
<enum>Manual</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>NoSelection</enum>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>LastColumn</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout30</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer3</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>closeButton</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>closeButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>EventHistory</receiver>
|
||||
<slot>close()</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<includes>
|
||||
<include location="local" impldecl="in declaration">wpamsg.h</include>
|
||||
<include location="local" impldecl="in implementation">eventhistory.ui.h</include>
|
||||
</includes>
|
||||
<slots>
|
||||
<slot>addEvents( WpaMsgList msgs )</slot>
|
||||
<slot>addEvent( WpaMsg msg )</slot>
|
||||
</slots>
|
||||
<functions>
|
||||
<function access="private" specifier="non virtual">init()</function>
|
||||
<function access="private" specifier="non virtual">destroy()</function>
|
||||
</functions>
|
||||
<pixmapinproject/>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
|
@ -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);
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
#ifdef CONFIG_NATIVE_WINDOWS
|
||||
#include <winsock.h>
|
||||
#endif /* CONFIG_NATIVE_WINDOWS */
|
||||
#include <qapplication.h>
|
||||
#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;
|
||||
}
|
|
@ -1,475 +0,0 @@
|
|||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>NetworkConfig</class>
|
||||
<widget class="QDialog">
|
||||
<property name="name">
|
||||
<cstring>NetworkConfig</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>380</width>
|
||||
<height>430</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>NetworkConfig</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QPushButton" row="1" column="3">
|
||||
<property name="name">
|
||||
<cstring>cancelButton</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QFrame" row="0" column="0" rowspan="1" colspan="4">
|
||||
<property name="name">
|
||||
<cstring>frame9</cstring>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>Raised</enum>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel0</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SSID</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>ssidEdit</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Network name (Service Set IDentifier)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel1</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Network ID</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>idstrEdit</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Network Identification String</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Authentication</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" row="2" column="1">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Plaintext or static WEP</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>IEEE 802.1X</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>WPA-Personal (PSK)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>WPA-Enterprise (EAP)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>WPA2-Personal (PSK)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>WPA2-Enterprise (EAP)</string>
|
||||
</property>
|
||||
</item>
|
||||
<property name="name">
|
||||
<cstring>authSelect</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel3</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Encryption</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" row="3" column="1">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>WEP</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>TKIP</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CCMP</string>
|
||||
</property>
|
||||
</item>
|
||||
<property name="name">
|
||||
<cstring>encrSelect</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="4" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel4</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PSK</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="4" column="1">
|
||||
<property name="name">
|
||||
<cstring>pskEdit</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>Password</enum>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>WPA/WPA2 pre-shared key or passphrase</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="5" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel5</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>EAP method</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" row="5" column="1">
|
||||
<property name="name">
|
||||
<cstring>eapSelect</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="6" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel6</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Identity</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="6" column="1">
|
||||
<property name="name">
|
||||
<cstring>identityEdit</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Username/Identity for EAP methods</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="7" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel7</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="7" column="1">
|
||||
<property name="name">
|
||||
<cstring>passwordEdit</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>Password</enum>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Password for EAP methods</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="8" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel1_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CA certificate</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="8" column="1">
|
||||
<property name="name">
|
||||
<cstring>cacertEdit</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QButtonGroup" row="9" column="0" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>buttonGroup1</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>WEP keys</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QRadioButton" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>wep0Radio</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>key 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>wep1Radio</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>key 1</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" row="3" column="0">
|
||||
<property name="name">
|
||||
<cstring>wep3Radio</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>key 3</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" row="2" column="0">
|
||||
<property name="name">
|
||||
<cstring>wep2Radio</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>key 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>wep0Edit</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>wep1Edit</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="2" column="1">
|
||||
<property name="name">
|
||||
<cstring>wep2Edit</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="3" column="1">
|
||||
<property name="name">
|
||||
<cstring>wep3Edit</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<spacer row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>spacer5</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>130</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QPushButton" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>addButton</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="1" column="2">
|
||||
<property name="name">
|
||||
<cstring>removeButton</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>authSelect</sender>
|
||||
<signal>activated(int)</signal>
|
||||
<receiver>NetworkConfig</receiver>
|
||||
<slot>authChanged(int)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cancelButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>NetworkConfig</receiver>
|
||||
<slot>close()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>addButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>NetworkConfig</receiver>
|
||||
<slot>addNetwork()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>encrSelect</sender>
|
||||
<signal>activated(const QString&)</signal>
|
||||
<receiver>NetworkConfig</receiver>
|
||||
<slot>encrChanged(const QString&)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>removeButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>NetworkConfig</receiver>
|
||||
<slot>removeNetwork()</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<tabstops>
|
||||
<tabstop>ssidEdit</tabstop>
|
||||
<tabstop>idstrEdit</tabstop>
|
||||
<tabstop>authSelect</tabstop>
|
||||
<tabstop>encrSelect</tabstop>
|
||||
<tabstop>pskEdit</tabstop>
|
||||
<tabstop>eapSelect</tabstop>
|
||||
<tabstop>identityEdit</tabstop>
|
||||
<tabstop>passwordEdit</tabstop>
|
||||
<tabstop>cacertEdit</tabstop>
|
||||
<tabstop>wep0Radio</tabstop>
|
||||
<tabstop>wep1Radio</tabstop>
|
||||
<tabstop>wep2Radio</tabstop>
|
||||
<tabstop>wep3Radio</tabstop>
|
||||
<tabstop>wep0Edit</tabstop>
|
||||
<tabstop>wep1Edit</tabstop>
|
||||
<tabstop>wep2Edit</tabstop>
|
||||
<tabstop>wep3Edit</tabstop>
|
||||
<tabstop>addButton</tabstop>
|
||||
<tabstop>removeButton</tabstop>
|
||||
<tabstop>cancelButton</tabstop>
|
||||
</tabstops>
|
||||
<includes>
|
||||
<include location="global" impldecl="in declaration">qlistview.h</include>
|
||||
<include location="global" impldecl="in implementation">qmessagebox.h</include>
|
||||
<include location="local" impldecl="in implementation">wpagui.h</include>
|
||||
<include location="local" impldecl="in implementation">networkconfig.ui.h</include>
|
||||
</includes>
|
||||
<forwards>
|
||||
<forward>class WpaGui;</forward>
|
||||
</forwards>
|
||||
<variables>
|
||||
<variable access="private">WpaGui *wpagui;</variable>
|
||||
<variable access="private">int edit_network_id;</variable>
|
||||
<variable access="private">bool new_network;</variable>
|
||||
</variables>
|
||||
<slots>
|
||||
<slot>authChanged( int sel )</slot>
|
||||
<slot>addNetwork()</slot>
|
||||
<slot>encrChanged( const QString & sel )</slot>
|
||||
<slot>writeWepKey( int network_id, QLineEdit * edit, int id )</slot>
|
||||
<slot>removeNetwork()</slot>
|
||||
</slots>
|
||||
<functions>
|
||||
<function access="private" specifier="non virtual">init()</function>
|
||||
<function>paramsFromScanResults( QListViewItem * sel )</function>
|
||||
<function>setWpaGui( WpaGui * _wpagui )</function>
|
||||
<function returnType="int">setNetworkParam( int id, const char * field, const char * value, bool quote )</function>
|
||||
<function access="private">wepEnabled( bool enabled )</function>
|
||||
<function>paramsFromConfig( int network_id )</function>
|
||||
<function>newNetwork()</function>
|
||||
<function access="private">getEapCapa()</function>
|
||||
</functions>
|
||||
<pixmapinproject/>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
|
@ -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 <stdlib.h>
|
||||
|
||||
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);
|
||||
}
|
|
@ -1,179 +0,0 @@
|
|||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>ScanResults</class>
|
||||
<widget class="QDialog">
|
||||
<property name="name">
|
||||
<cstring>ScanResults</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>452</width>
|
||||
<height>225</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Scan results</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QListView">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>SSID</string>
|
||||
</property>
|
||||
<property name="clickable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>BSSID</string>
|
||||
</property>
|
||||
<property name="clickable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>frequency</string>
|
||||
</property>
|
||||
<property name="clickable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>signal</string>
|
||||
</property>
|
||||
<property name="clickable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>flags</string>
|
||||
</property>
|
||||
<property name="clickable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</column>
|
||||
<property name="name">
|
||||
<cstring>scanResultsView</cstring>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>Sunken</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout24</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer6</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>scanButton</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Scan</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>closeButton</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>closeButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ScanResults</receiver>
|
||||
<slot>close()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>scanButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>ScanResults</receiver>
|
||||
<slot>scanRequest()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>scanResultsView</sender>
|
||||
<signal>doubleClicked(QListViewItem*)</signal>
|
||||
<receiver>ScanResults</receiver>
|
||||
<slot>bssSelected(QListViewItem*)</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<includes>
|
||||
<include location="local" impldecl="in implementation">common/wpa_ctrl.h</include>
|
||||
<include location="local" impldecl="in implementation">wpagui.h</include>
|
||||
<include location="local" impldecl="in implementation">networkconfig.h</include>
|
||||
<include location="local" impldecl="in implementation">scanresults.ui.h</include>
|
||||
</includes>
|
||||
<forwards>
|
||||
<forward>class WpaGui;</forward>
|
||||
</forwards>
|
||||
<variables>
|
||||
<variable access="private">WpaGui *wpagui;</variable>
|
||||
<variable access="private">QTimer *timer;</variable>
|
||||
</variables>
|
||||
<slots>
|
||||
<slot>setWpaGui( WpaGui * _wpagui )</slot>
|
||||
<slot>updateResults()</slot>
|
||||
<slot>scanRequest()</slot>
|
||||
<slot>getResults()</slot>
|
||||
<slot>bssSelected( QListViewItem * sel )</slot>
|
||||
</slots>
|
||||
<functions>
|
||||
<function access="private" specifier="non virtual">init()</function>
|
||||
<function access="private" specifier="non virtual">destroy()</function>
|
||||
</functions>
|
||||
<pixmapinproject/>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
|
@ -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();
|
||||
}
|
|
@ -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
|
|
@ -1,163 +0,0 @@
|
|||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>UserDataRequest</class>
|
||||
<widget class="QDialog">
|
||||
<property name="name">
|
||||
<cstring>UserDataRequest</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>216</width>
|
||||
<height>103</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Authentication credentials required</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>queryInfo</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout28</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>queryField</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit">
|
||||
<property name="name">
|
||||
<cstring>queryEdit</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout27</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer4</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>buttonOk</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&OK</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>buttonCancel</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Cancel</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonOk</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>UserDataRequest</receiver>
|
||||
<slot>sendReply()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonCancel</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>UserDataRequest</receiver>
|
||||
<slot>reject()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>queryEdit</sender>
|
||||
<signal>returnPressed()</signal>
|
||||
<receiver>UserDataRequest</receiver>
|
||||
<slot>sendReply()</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<includes>
|
||||
<include location="local" impldecl="in implementation">common/wpa_ctrl.h</include>
|
||||
<include location="local" impldecl="in implementation">wpagui.h</include>
|
||||
<include location="local" impldecl="in implementation">userdatarequest.ui.h</include>
|
||||
</includes>
|
||||
<forwards>
|
||||
<forward>class WpaGui;</forward>
|
||||
</forwards>
|
||||
<variables>
|
||||
<variable access="private">WpaGui *wpagui;</variable>
|
||||
<variable access="private">int networkid;</variable>
|
||||
<variable access="private">QString field;</variable>
|
||||
</variables>
|
||||
<slots>
|
||||
<slot>sendReply()</slot>
|
||||
</slots>
|
||||
<functions>
|
||||
<function specifier="non virtual" returnType="int">setParams( WpaGui * _wpagui, const char * reqMsg )</function>
|
||||
</functions>
|
||||
<pixmapinproject/>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
|
@ -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 <stdlib.h>
|
||||
|
||||
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();
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -1,471 +0,0 @@
|
|||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>WpaGui</class>
|
||||
<widget class="QMainWindow">
|
||||
<property name="name">
|
||||
<cstring>WpaGui</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>279</width>
|
||||
<height>308</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>wpa_gui</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>textLabel16</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Adapter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" row="0" column="2" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>adapterSelect</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="0" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>textLabel8</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Network:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" row="1" column="2" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>networkSelect</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QFrame" row="2" column="0" rowspan="1" colspan="4">
|
||||
<property name="name">
|
||||
<cstring>frame3</cstring>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>Raised</enum>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel1</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Status:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Last message:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel3</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Authentication:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel4</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Encryption:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="4" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel5</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SSID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="5" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel6</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>BSSID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="6" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel7</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IP address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>textStatus</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="1" rowspan="1" colspan="3">
|
||||
<property name="name">
|
||||
<cstring>textLastMessage</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="1">
|
||||
<property name="name">
|
||||
<cstring>textAuthentication</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="1">
|
||||
<property name="name">
|
||||
<cstring>textEncryption</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="4" column="1">
|
||||
<property name="name">
|
||||
<cstring>textSsid</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="5" column="1">
|
||||
<property name="name">
|
||||
<cstring>textBssid</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="6" column="1">
|
||||
<property name="name">
|
||||
<cstring>textIpAddress</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<spacer row="3" column="0">
|
||||
<property name="name">
|
||||
<cstring>spacer7</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QPushButton" row="3" column="1">
|
||||
<property name="name">
|
||||
<cstring>connectButton</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="3" column="2">
|
||||
<property name="name">
|
||||
<cstring>disconnectButton</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Disconnect</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="3" column="3">
|
||||
<property name="name">
|
||||
<cstring>scanButton</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Scan</string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<menubar>
|
||||
<property name="name">
|
||||
<cstring>MenuBar</cstring>
|
||||
</property>
|
||||
<item text="&File" name="fileMenu">
|
||||
<separator/>
|
||||
<action name="fileEventHistoryAction"/>
|
||||
<action name="fileAdd_NetworkAction"/>
|
||||
<action name="fileEdit_networkAction"/>
|
||||
<separator/>
|
||||
<action name="fileExitAction"/>
|
||||
</item>
|
||||
<item text="&Help" name="helpMenu">
|
||||
<action name="helpContentsAction"/>
|
||||
<action name="helpIndexAction"/>
|
||||
<separator/>
|
||||
<action name="helpAboutAction"/>
|
||||
</item>
|
||||
</menubar>
|
||||
<toolbars>
|
||||
</toolbars>
|
||||
<actions>
|
||||
<action>
|
||||
<property name="name">
|
||||
<cstring>fileExitAction</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
<property name="menuText">
|
||||
<string>E&xit</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string>Ctrl+Q</string>
|
||||
</property>
|
||||
</action>
|
||||
<action>
|
||||
<property name="name">
|
||||
<cstring>helpContentsAction</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Contents</string>
|
||||
</property>
|
||||
<property name="menuText">
|
||||
<string>&Contents...</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
</action>
|
||||
<action>
|
||||
<property name="name">
|
||||
<cstring>helpIndexAction</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Index</string>
|
||||
</property>
|
||||
<property name="menuText">
|
||||
<string>&Index...</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
</action>
|
||||
<action>
|
||||
<property name="name">
|
||||
<cstring>helpAboutAction</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<property name="menuText">
|
||||
<string>&About</string>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
</action>
|
||||
<action>
|
||||
<property name="name">
|
||||
<cstring>fileEventHistoryAction</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Event History</string>
|
||||
</property>
|
||||
<property name="menuText">
|
||||
<string>Event &History</string>
|
||||
</property>
|
||||
</action>
|
||||
<action>
|
||||
<property name="name">
|
||||
<cstring>fileAdd_NetworkAction</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add Network</string>
|
||||
</property>
|
||||
<property name="menuText">
|
||||
<string>&Add Network</string>
|
||||
</property>
|
||||
</action>
|
||||
<action>
|
||||
<property name="name">
|
||||
<cstring>fileEdit_networkAction</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit Network</string>
|
||||
</property>
|
||||
<property name="menuText">
|
||||
<string>&Edit Network</string>
|
||||
</property>
|
||||
</action>
|
||||
</actions>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>helpIndexAction</sender>
|
||||
<signal>activated()</signal>
|
||||
<receiver>WpaGui</receiver>
|
||||
<slot>helpIndex()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>helpContentsAction</sender>
|
||||
<signal>activated()</signal>
|
||||
<receiver>WpaGui</receiver>
|
||||
<slot>helpContents()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>helpAboutAction</sender>
|
||||
<signal>activated()</signal>
|
||||
<receiver>WpaGui</receiver>
|
||||
<slot>helpAbout()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>fileExitAction</sender>
|
||||
<signal>activated()</signal>
|
||||
<receiver>WpaGui</receiver>
|
||||
<slot>close()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>disconnectButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>WpaGui</receiver>
|
||||
<slot>disconnect()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>scanButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>WpaGui</receiver>
|
||||
<slot>scan()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>connectButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>WpaGui</receiver>
|
||||
<slot>connectB()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>fileEventHistoryAction</sender>
|
||||
<signal>activated()</signal>
|
||||
<receiver>WpaGui</receiver>
|
||||
<slot>eventHistory()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>networkSelect</sender>
|
||||
<signal>activated(const QString&)</signal>
|
||||
<receiver>WpaGui</receiver>
|
||||
<slot>selectNetwork(const QString&)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>fileEdit_networkAction</sender>
|
||||
<signal>activated()</signal>
|
||||
<receiver>WpaGui</receiver>
|
||||
<slot>editNetwork()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>fileAdd_NetworkAction</sender>
|
||||
<signal>activated()</signal>
|
||||
<receiver>WpaGui</receiver>
|
||||
<slot>addNetwork()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>adapterSelect</sender>
|
||||
<signal>activated(const QString&)</signal>
|
||||
<receiver>WpaGui</receiver>
|
||||
<slot>selectAdapter(const QString&)</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<includes>
|
||||
<include location="global" impldecl="in declaration">qtimer.h</include>
|
||||
<include location="global" impldecl="in declaration">qsocketnotifier.h</include>
|
||||
<include location="local" impldecl="in declaration">wpamsg.h</include>
|
||||
<include location="local" impldecl="in declaration">eventhistory.h</include>
|
||||
<include location="local" impldecl="in declaration">scanresults.h</include>
|
||||
<include location="local" impldecl="in implementation">common/wpa_ctrl.h</include>
|
||||
<include location="global" impldecl="in implementation">dirent.h</include>
|
||||
<include location="global" impldecl="in implementation">qmessagebox.h</include>
|
||||
<include location="global" impldecl="in implementation">qapplication.h</include>
|
||||
<include location="local" impldecl="in implementation">userdatarequest.h</include>
|
||||
<include location="local" impldecl="in implementation">networkconfig.h</include>
|
||||
<include location="local" impldecl="in implementation">wpagui.ui.h</include>
|
||||
</includes>
|
||||
<forwards>
|
||||
<forward>class UserDataRequest;</forward>
|
||||
</forwards>
|
||||
<variables>
|
||||
<variable access="private">ScanResults *scanres;</variable>
|
||||
<variable access="private">bool networkMayHaveChanged;</variable>
|
||||
<variable access="private">char *ctrl_iface;</variable>
|
||||
<variable access="private">EventHistory *eh;</variable>
|
||||
<variable access="private">struct wpa_ctrl *ctrl_conn;</variable>
|
||||
<variable access="private">QSocketNotifier *msgNotifier;</variable>
|
||||
<variable access="private">QTimer *timer;</variable>
|
||||
<variable access="private">int pingsToStatusUpdate;</variable>
|
||||
<variable access="private">WpaMsgList msgs;</variable>
|
||||
<variable access="private">char *ctrl_iface_dir;</variable>
|
||||
<variable access="private">struct wpa_ctrl *monitor_conn;</variable>
|
||||
<variable access="private">UserDataRequest *udr;</variable>
|
||||
</variables>
|
||||
<slots>
|
||||
<slot>parse_argv()</slot>
|
||||
<slot>updateStatus()</slot>
|
||||
<slot>updateNetworks()</slot>
|
||||
<slot>helpIndex()</slot>
|
||||
<slot>helpContents()</slot>
|
||||
<slot>helpAbout()</slot>
|
||||
<slot>disconnect()</slot>
|
||||
<slot>scan()</slot>
|
||||
<slot>eventHistory()</slot>
|
||||
<slot>ping()</slot>
|
||||
<slot>processMsg( char * msg )</slot>
|
||||
<slot>processCtrlReq( const char * req )</slot>
|
||||
<slot>receiveMsgs()</slot>
|
||||
<slot>connectB()</slot>
|
||||
<slot>selectNetwork( const QString & sel )</slot>
|
||||
<slot>editNetwork()</slot>
|
||||
<slot>addNetwork()</slot>
|
||||
<slot>selectAdapter( const QString & sel )</slot>
|
||||
</slots>
|
||||
<functions>
|
||||
<function access="private" specifier="non virtual">init()</function>
|
||||
<function access="private" specifier="non virtual">destroy()</function>
|
||||
<function access="private" specifier="non virtual" returnType="int">openCtrlConnection( const char * ifname )</function>
|
||||
<function returnType="int">ctrlRequest( const char * cmd, char * buf, size_t * buflen )</function>
|
||||
<function>triggerUpdate()</function>
|
||||
</functions>
|
||||
<pixmapinproject/>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
|
@ -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 <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
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 <j@w1.fi>\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();
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
#ifndef WPAMSG_H
|
||||
#define WPAMSG_H
|
||||
|
||||
class WpaMsg;
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
#include <QDateTime>
|
||||
#include <QLinkedList>
|
||||
typedef QLinkedList<WpaMsg> WpaMsgList;
|
||||
#else
|
||||
#include <qdatetime.h>
|
||||
typedef QValueList<WpaMsg> 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 */
|
Loading…
Reference in a new issue