wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_iap_data.cpp
branchRCL_3
changeset 6 e0f767079796
parent 0 c40eb8fe8501
child 16 5fb7af913dfd
--- a/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_iap_data.cpp	Fri Mar 12 15:51:11 2010 +0200
+++ b/wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_iap_data.cpp	Mon Mar 15 12:46:48 2010 +0200
@@ -15,6 +15,9 @@
 *
 */
 
+/*
+* %version: 14.1.1 %
+*/
 
 #include "core_iap_data.h"
 #include "core_tools.h"
@@ -337,3 +340,57 @@
         addr = iap_blacklist_m.next();
         }       
     }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+bool_t core_iap_data_c::is_valid() const
+    {
+    if( iap_data_m.security_mode == core_security_mode_wep )
+        {
+        if( !iap_data_m.wep_key1.key_length &&
+            !iap_data_m.wep_key2.key_length &&
+            !iap_data_m.wep_key3.key_length &&
+            !iap_data_m.wep_key4.key_length )
+            {
+            DEBUG( "core_iap_data_c::is_valid() - security mode is WEP but no keys defined" );
+
+            return false_t;
+            }
+
+        if( ( iap_data_m.default_wep_key > WEP_KEY4 ) ||             
+            ( iap_data_m.default_wep_key == WEP_KEY1 &&
+              !iap_data_m.wep_key1.key_length ) ||
+            ( iap_data_m.default_wep_key == WEP_KEY2 &&
+              !iap_data_m.wep_key2.key_length ) ||
+            ( iap_data_m.default_wep_key == WEP_KEY3 &&
+              !iap_data_m.wep_key3.key_length ) ||
+            ( iap_data_m.default_wep_key == WEP_KEY4 &&
+              !iap_data_m.wep_key4.key_length ) )
+            {
+            DEBUG( "core_iap_data_c::is_valid() - security mode is WEP but default key not defined" );
+
+            return false_t;
+            }
+        }
+
+    if( iap_data_m.wpa_preshared_key_in_use &&
+        !iap_data_m.wpa_preshared_key.key_length )
+        {
+        DEBUG( "core_iap_data_c::is_valid() - security mode is WPA-PSK but key is not defined" );
+
+        return false_t;   
+        }
+    
+    if( iap_data_m.op_mode == core_operating_mode_ibss &&
+        ( iap_data_m.security_mode != core_security_mode_allow_unsecure &&
+          iap_data_m.security_mode != core_security_mode_wep ) )
+        {
+        DEBUG1( "core_iap_data_c::is_valid() - IBSS mode with security mode %u not supported",
+            iap_data_m.security_mode );
+
+        return false_t;        
+        }
+
+    return true_t;
+    }