summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/wlan/wextensions.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/wlan/wextensions.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/wlan/wextensions.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp
index 8a9db66..64d8752 100644
--- a/noncore/settings/networksettings/wlan/wextensions.cpp
+++ b/noncore/settings/networksettings/wlan/wextensions.cpp
@@ -48,52 +48,55 @@ WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), i
48/** 48/**
49 * @return QString the station name of the access point. 49 * @return QString the station name of the access point.
50 */ 50 */
51QString WExtensions::station(){ 51QString WExtensions::station(){
52 if(!hasWirelessExtensions) 52 if(!hasWirelessExtensions)
53 return QString(); 53 return QString();
54 const char* buffer[200]; 54 const char* buffer[200];
55 iwr.u.data.pointer = (caddr_t) buffer; 55 iwr.u.data.pointer = (caddr_t) buffer;
56 iwr.u.data.length = IW_ESSID_MAX_SIZE; 56 iwr.u.data.length = IW_ESSID_MAX_SIZE;
57 iwr.u.data.flags = 0; 57 iwr.u.data.flags = 0;
58 if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){ 58 if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){
59 buffer[(unsigned int) iwr.u.data.length-1] = '\0'; 59 buffer[(unsigned int) iwr.u.data.length-1] = '\0';
60 return (const char*) buffer; 60 return (const char*) buffer;
61 } 61 }
62 return QString::null; 62 return QString::null;
63} 63}
64 64
65/** 65/**
66 * @return QString the essid of the host 802.11 access point. 66 * @return QString the essid of the host 802.11 access point.
67 */ 67 */
68QString WExtensions::essid(){ 68QString WExtensions::essid(){
69 if(!hasWirelessExtensions) 69 if(!hasWirelessExtensions)
70 return QString(); 70 return QString();
71 const char* buffer[200]; 71 const char* buffer[200];
72 memset(buffer,0x00,200);
72 iwr.u.data.pointer = (caddr_t) buffer; 73 iwr.u.data.pointer = (caddr_t) buffer;
73 iwr.u.data.length = IW_ESSID_MAX_SIZE; 74 iwr.u.data.length = IW_ESSID_MAX_SIZE;
74 iwr.u.data.flags = 0; 75 iwr.u.data.flags = 0;
75 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){ 76 if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){
77 if (iwr.u.essid.length > IW_ESSID_MAX_SIZE)
78 iwr.u.essid.length = IW_ESSID_MAX_SIZE;
76 buffer[(unsigned int) iwr.u.essid.length] = '\0'; 79 buffer[(unsigned int) iwr.u.essid.length] = '\0';
77 return (const char*) buffer; 80 return (const char*) buffer;
78 } 81 }
79 return QString::null; 82 return QString::null;
80} 83}
81 84
82/** 85/**
83 * @return QString the mode of interface 86 * @return QString the mode of interface
84 */ 87 */
85QString WExtensions::mode(){ 88QString WExtensions::mode(){
86 if(!hasWirelessExtensions) 89 if(!hasWirelessExtensions)
87 return QString(); 90 return QString();
88 if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) ) 91 if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) )
89 return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed"); 92 return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed");
90 return QString(); 93 return QString();
91} 94}
92 95
93/** 96/**
94 * Get the frequency that the interface is running at. 97 * Get the frequency that the interface is running at.
95 * @return int the frequency that the interfacae is running at. 98 * @return int the frequency that the interfacae is running at.
96 */ 99 */
97double WExtensions::frequency(){ 100double WExtensions::frequency(){
98 if(!hasWirelessExtensions) 101 if(!hasWirelessExtensions)
99 return 0; 102 return 0;