pub(crate) fn prepare_wifi_security_settings<T: Eq + std::hash::Hash + std::convert::From<&'static str>>(
    credentials: &AccessPointCredentials,
    settings: &mut HashMap<T, VariantMap>,
) -> Result<(), CaptivePortalError> {
    match *credentials {
        AccessPointCredentials::Wep { ref passphrase } => {
            verify_password(&passphrase)?;
            let mut security_settings: VariantMap = HashMap::new();

            add_val(&mut security_settings, "wep-key-type", NM_WEP_KEY_TYPE_PASSPHRASE);
            add_val(&mut security_settings, "wep-key0", passphrase.clone());

            settings.insert("802-11-wireless-security".into(), security_settings);
        },
        AccessPointCredentials::Wpa { ref passphrase } => {
            verify_password(&passphrase)?;
            let mut security_settings: VariantMap = HashMap::new();

            add_str(&mut security_settings, "key-mgmt", "wpa-psk");
            add_val(&mut security_settings, "psk", passphrase.clone());

            settings.insert("802-11-wireless-security".into(), security_settings);
        },
        AccessPointCredentials::Enterprise {
            ref identity,
            ref passphrase,
        } => {
            verify_password(&passphrase)?;
            let mut security_settings: VariantMap = HashMap::new();

            add_str(&mut security_settings, "key-mgmt", "wpa-eap");

            let mut eap: VariantMap = HashMap::new();
            add_val(&mut eap, "eap", vec!["peap".to_string()]);
            add_str(&mut eap, "identity", identity as &str);
            add_str(&mut eap, "password", passphrase as &str);
            add_str(&mut eap, "phase2-auth", "mschapv2");

            settings.insert("802-11-wireless-security".into(), security_settings);
            settings.insert("802-1x".into(), eap);
        },
        AccessPointCredentials::None => {},
    };
    Ok(())
}
/// Adds necessary entries to the given settings map.
/// To be used by wifi device connect and [`add_wifi_connection`].
Adds necessary entries to the given settings map.
To be used by wifi device connect and [`add_wifi_connection`].
Adds necessary entries to the given settings map . To be used by wifi device connect and [ ` add_wifi_connection ` ] .
pub(crate) fn prepare_wifi_security_settings<T: Eq + std::hash::Hash + std::convert::From<&'static str>>(
    credentials: &AccessPointCredentials,
    settings: &mut HashMap<T, VariantMap>,
) -> Result<(), CaptivePortalError> {
    match *credentials {
        AccessPointCredentials::Wep { ref passphrase } => {
            verify_password(&passphrase)?;
            let mut security_settings: VariantMap = HashMap::new();
            add_val(&mut security_settings, "wep-key-type", NM_WEP_KEY_TYPE_PASSPHRASE);
            add_val(&mut security_settings, "wep-key0", passphrase.clone());
            settings.insert("802-11-wireless-security".into(), security_settings);
        },
        AccessPointCredentials::Wpa { ref passphrase } => {
            verify_password(&passphrase)?;
            let mut security_settings: VariantMap = HashMap::new();
            add_str(&mut security_settings, "key-mgmt", "wpa-psk");
            add_val(&mut security_settings, "psk", passphrase.clone());
            settings.insert("802-11-wireless-security".into(), security_settings);
        },
        AccessPointCredentials::Enterprise {
            ref identity,
            ref passphrase,
        } => {
            verify_password(&passphrase)?;
            let mut security_settings: VariantMap = HashMap::new();
            add_str(&mut security_settings, "key-mgmt", "wpa-eap");
            let mut eap: VariantMap = HashMap::new();
            add_val(&mut eap, "eap", vec!["peap".to_string()]);
            add_str(&mut eap, "identity", identity as &str);
            add_str(&mut eap, "password", passphrase as &str);
            add_str(&mut eap, "phase2-auth", "mschapv2");
            settings.insert("802-11-wireless-security".into(), security_settings);
            settings.insert("802-1x".into(), eap);
        },
        AccessPointCredentials::None => {},
    };
    Ok(())
}
pub ( crate ) fn prepare_wifi_security_settings < T : Eq + std :: hash :: Hash + std :: convert :: From < & ' static str > > ( credentials : & AccessPointCredentials , settings : & mut HashMap < T , VariantMap > , ) -> Result < ( ) , CaptivePortalError > { match * credentials { AccessPointCredentials :: Wep { ref passphrase } => { verify_password ( & passphrase ) ? ; let mut security_settings : VariantMap = HashMap :: new ( ) ; add_val ( & mut security_settings , " " , NM_WEP_KEY_TYPE_PASSPHRASE ) ; add_val ( & mut security_settings , " " , passphrase . clone ( ) ) ; settings . insert ( " " . into ( ) , security_settings ) ; } , AccessPointCredentials :: Wpa { ref passphrase } => { verify_password ( & passphrase ) ? ; let mut security_settings : VariantMap = HashMap :: new ( ) ; add_str ( & mut security_settings , " " , " " ) ; add_val ( & mut security_settings , " " , passphrase . clone ( ) ) ; settings . insert ( " " . into ( ) , security_settings ) ; } , AccessPointCredentials :: Enterprise { ref identity , ref passphrase , } => { verify_password ( & passphrase ) ? ; let mut security_settings : VariantMap = HashMap :: new ( ) ; add_str ( & mut security_settings , " " , " " ) ; let mut eap : VariantMap = HashMap :: new ( ) ; add_val ( & mut eap , " " , vec ! [ " " to_string ( ) ] ) ; add_str ( & mut eap , " " , identity as & str ) ; add_str ( & mut eap , " " , passphrase as & str ) ; add_str ( & mut eap , " " , " " ) ; settings . insert ( " " . into ( ) , security_settings ) ; settings . insert ( " " . into ( ) , eap ) ; } , AccessPointCredentials :: None => { } , } ; Ok ( ( ) ) }
Adds necessary entries to the given settings map.
Adds necessary entries to the given settings map .
credentials
&AccessPointCredentials
settings
&mut HashMap<T, VariantMap>
credentials
&AccessPointCredentials
settings
&mut HashMap<T, VariantMap>