nm_rs/auto/setting_wireless_security.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir
3// from gtk-girs (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5
6use crate::{ffi,Setting,SettingSecretFlags,WepKeyType};
7#[cfg(feature = "v1_10")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
9use crate::{SettingWirelessSecurityPmf,SettingWirelessSecurityWpsMethod};
10#[cfg(feature = "v1_12")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
12use crate::{SettingWirelessSecurityFils};
13use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
14use std::{boxed::Box as Box_};
15
16glib::wrapper! {
17 /// Wi-Fi Security Settings
18 ///
19 /// ## Properties
20 ///
21 ///
22 /// #### `auth-alg`
23 /// When WEP is used (ie, key-mgmt = "none" or "ieee8021x") indicate the
24 /// 802.11 authentication algorithm required by the AP here. One of "open"
25 /// for Open System, "shared" for Shared Key, or "leap" for Cisco LEAP. When
26 /// using Cisco LEAP (ie, key-mgmt = "ieee8021x" and auth-alg = "leap") the
27 /// "leap-username" and "leap-password" properties must be specified.
28 ///
29 /// Readable | Writeable
30 ///
31 ///
32 /// #### `fils`
33 /// Indicates whether Fast Initial Link Setup (802.11ai) must be enabled for
34 /// the connection. One of [`SettingWirelessSecurityFils::Default`][crate::SettingWirelessSecurityFils::Default] (use
35 /// global default value), [`SettingWirelessSecurityFils::Disable`][crate::SettingWirelessSecurityFils::Disable]
36 /// (disable FILS), [`SettingWirelessSecurityFils::Optional`][crate::SettingWirelessSecurityFils::Optional] (enable FILS
37 /// if the supplicant and the access point support it) or
38 /// [`SettingWirelessSecurityFils::Required`][crate::SettingWirelessSecurityFils::Required] (enable FILS and fail if not
39 /// supported). When set to [`SettingWirelessSecurityFils::Default`][crate::SettingWirelessSecurityFils::Default] and
40 /// no global default is set, FILS will be optionally enabled.
41 ///
42 /// Readable | Writeable
43 ///
44 ///
45 /// #### `group`
46 /// A list of group/broadcast encryption algorithms which prevents
47 /// connections to Wi-Fi networks that do not utilize one of the algorithms
48 /// in the list. For maximum compatibility leave this property empty. Each
49 /// list element may be one of "wep40", "wep104", "tkip", or "ccmp".
50 ///
51 /// Readable | Writeable
52 ///
53 ///
54 /// #### `key-mgmt`
55 /// Key management used for the connection. One of "none" (WEP or no
56 /// password protection), "ieee8021x" (Dynamic WEP), "owe" (Opportunistic
57 /// Wireless Encryption), "wpa-psk" (WPA2 + WPA3 personal), "sae" (WPA3
58 /// personal only), "wpa-eap" (WPA2 + WPA3 enterprise) or
59 /// "wpa-eap-suite-b-192" (WPA3 enterprise only).
60 ///
61 /// This property must be set for any Wi-Fi connection that uses security.
62 ///
63 /// Readable | Writeable
64 ///
65 ///
66 /// #### `leap-password`
67 /// The login password for legacy LEAP connections (ie, key-mgmt =
68 /// "ieee8021x" and auth-alg = "leap").
69 ///
70 /// Readable | Writeable
71 ///
72 ///
73 /// #### `leap-password-flags`
74 /// Flags indicating how to handle the
75 /// #NMSettingWirelessSecurity:leap-password property.
76 ///
77 /// Readable | Writeable
78 ///
79 ///
80 /// #### `leap-username`
81 /// The login username for legacy LEAP connections (ie, key-mgmt =
82 /// "ieee8021x" and auth-alg = "leap").
83 ///
84 /// Readable | Writeable
85 ///
86 ///
87 /// #### `pairwise`
88 /// A list of pairwise encryption algorithms which prevents connections to
89 /// Wi-Fi networks that do not utilize one of the algorithms in the list.
90 /// For maximum compatibility leave this property empty. Each list element
91 /// may be one of "tkip" or "ccmp".
92 ///
93 /// Readable | Writeable
94 ///
95 ///
96 /// #### `pmf`
97 /// Indicates whether Protected Management Frames (802.11w) must be enabled
98 /// for the connection. One of [`SettingWirelessSecurityPmf::Default`][crate::SettingWirelessSecurityPmf::Default]
99 /// (use global default value), [`SettingWirelessSecurityPmf::Disable`][crate::SettingWirelessSecurityPmf::Disable]
100 /// (disable PMF), [`SettingWirelessSecurityPmf::Optional`][crate::SettingWirelessSecurityPmf::Optional] (enable PMF if
101 /// the supplicant and the access point support it) or
102 /// [`SettingWirelessSecurityPmf::Required`][crate::SettingWirelessSecurityPmf::Required] (enable PMF and fail if not
103 /// supported). When set to [`SettingWirelessSecurityPmf::Default`][crate::SettingWirelessSecurityPmf::Default] and no
104 /// global default is set, PMF will be optionally enabled.
105 ///
106 /// Readable | Writeable
107 ///
108 ///
109 /// #### `proto`
110 /// List of strings specifying the allowed WPA protocol versions to use.
111 /// Each element may be one "wpa" (allow WPA) or "rsn" (allow WPA2/RSN). If
112 /// not specified, both WPA and RSN connections are allowed.
113 ///
114 /// Readable | Writeable
115 ///
116 ///
117 /// #### `psk`
118 /// Pre-Shared-Key for WPA networks. For WPA-PSK, it's either an ASCII
119 /// passphrase of 8 to 63 characters that is (as specified in the 802.11i
120 /// standard) hashed to derive the actual key, or the key in form of 64
121 /// hexadecimal character. The WPA3-Personal networks use a passphrase
122 /// of any length for SAE authentication.
123 ///
124 /// Readable | Writeable
125 ///
126 ///
127 /// #### `psk-flags`
128 /// Flags indicating how to handle the #NMSettingWirelessSecurity:psk
129 /// property.
130 ///
131 /// Readable | Writeable
132 ///
133 ///
134 /// #### `wep-key-flags`
135 /// Flags indicating how to handle the #NMSettingWirelessSecurity:wep-key0,
136 /// #NMSettingWirelessSecurity:wep-key1, #NMSettingWirelessSecurity:wep-key2,
137 /// and #NMSettingWirelessSecurity:wep-key3 properties.
138 ///
139 /// Readable | Writeable
140 ///
141 ///
142 /// #### `wep-key-type`
143 /// Controls the interpretation of WEP keys. Allowed values are
144 /// [`WepKeyType::Key`][crate::WepKeyType::Key], in which case the key is either a 10- or
145 /// 26-character hexadecimal string, or a 5- or 13-character ASCII password;
146 /// or [`WepKeyType::Passphrase`][crate::WepKeyType::Passphrase], in which case the passphrase is provided
147 /// as a string and will be hashed using the de-facto MD5 method to derive
148 /// the actual WEP key.
149 ///
150 /// Readable | Writeable
151 ///
152 ///
153 /// #### `wep-key0`
154 /// Index 0 WEP key. This is the WEP key used in most networks. See the
155 /// "wep-key-type" property for a description of how this key is interpreted.
156 ///
157 /// Readable | Writeable
158 ///
159 ///
160 /// #### `wep-key1`
161 /// Index 1 WEP key. This WEP index is not used by most networks. See the
162 /// "wep-key-type" property for a description of how this key is interpreted.
163 ///
164 /// Readable | Writeable
165 ///
166 ///
167 /// #### `wep-key2`
168 /// Index 2 WEP key. This WEP index is not used by most networks. See the
169 /// "wep-key-type" property for a description of how this key is interpreted.
170 ///
171 /// Readable | Writeable
172 ///
173 ///
174 /// #### `wep-key3`
175 /// Index 3 WEP key. This WEP index is not used by most networks. See the
176 /// "wep-key-type" property for a description of how this key is interpreted.
177 ///
178 /// Readable | Writeable
179 ///
180 ///
181 /// #### `wep-tx-keyidx`
182 /// When static WEP is used (ie, key-mgmt = "none") and a non-default WEP key
183 /// index is used by the AP, put that WEP key index here. Valid values are 0
184 /// (default key) through 3. Note that some consumer access points (like the
185 /// Linksys WRT54G) number the keys 1 - 4.
186 ///
187 /// Readable | Writeable
188 ///
189 ///
190 /// #### `wps-method`
191 /// Flags indicating which mode of WPS is to be used if any.
192 ///
193 /// There's little point in changing the default setting as NetworkManager will
194 /// automatically determine whether it's feasible to start WPS enrollment from
195 /// the Access Point capabilities.
196 ///
197 /// WPS can be disabled by setting this property to a value of 1.
198 ///
199 /// Readable | Writeable
200 /// <details><summary><h4>Setting</h4></summary>
201 ///
202 ///
203 /// #### `name`
204 /// The setting's name, which uniquely identifies the setting within the
205 /// connection. Each setting type has a name unique to that type, for
206 /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
207 ///
208 /// Readable
209 /// </details>
210 ///
211 /// # Implements
212 ///
213 /// [`SettingExt`][trait@crate::prelude::SettingExt]
214 #[doc(alias = "NMSettingWirelessSecurity")]
215 pub struct SettingWirelessSecurity(Object<ffi::NMSettingWirelessSecurity, ffi::NMSettingWirelessSecurityClass>) @extends Setting;
216
217 match fn {
218 type_ => || ffi::nm_setting_wireless_security_get_type(),
219 }
220}
221
222impl SettingWirelessSecurity {
223 /// Creates a new #NMSettingWirelessSecurity object with default values.
224 ///
225 /// # Returns
226 ///
227 /// the new empty #NMSettingWirelessSecurity object
228 #[doc(alias = "nm_setting_wireless_security_new")]
229 pub fn new() -> SettingWirelessSecurity {
230 assert_initialized_main_thread!();
231 unsafe {
232 Setting::from_glib_full(ffi::nm_setting_wireless_security_new()).unsafe_cast()
233 }
234 }
235
236 // rustdoc-stripper-ignore-next
237 /// Creates a new builder-pattern struct instance to construct [`SettingWirelessSecurity`] objects.
238 ///
239 /// This method returns an instance of [`SettingWirelessSecurityBuilder`](crate::builders::SettingWirelessSecurityBuilder) which can be used to create [`SettingWirelessSecurity`] objects.
240 pub fn builder() -> SettingWirelessSecurityBuilder {
241 SettingWirelessSecurityBuilder::new()
242 }
243
244
245 /// Adds an encryption algorithm to the list of allowed groupwise encryption
246 /// algorithms. If the list is not empty, then only access points that support
247 /// one or more of the encryption algorithms in the list will be considered
248 /// compatible with this connection.
249 /// ## `group`
250 /// the encryption algorithm to add, one of "wep40", "wep104",
251 /// "tkip", or "ccmp"
252 ///
253 /// # Returns
254 ///
255 /// [`true`] if the algorithm was added to the list, [`false`] if it was
256 /// already in the list
257 #[doc(alias = "nm_setting_wireless_security_add_group")]
258 pub fn add_group(&self, group: &str) -> bool {
259 unsafe {
260 from_glib(ffi::nm_setting_wireless_security_add_group(self.to_glib_none().0, group.to_glib_none().0))
261 }
262 }
263
264 /// Adds an encryption algorithm to the list of allowed pairwise encryption
265 /// algorithms. If the list is not empty, then only access points that support
266 /// one or more of the encryption algorithms in the list will be considered
267 /// compatible with this connection.
268 /// ## `pairwise`
269 /// the encryption algorithm to add, one of "tkip" or "ccmp"
270 ///
271 /// # Returns
272 ///
273 /// [`true`] if the algorithm was added to the list, [`false`] if it was
274 /// already in the list
275 #[doc(alias = "nm_setting_wireless_security_add_pairwise")]
276 pub fn add_pairwise(&self, pairwise: &str) -> bool {
277 unsafe {
278 from_glib(ffi::nm_setting_wireless_security_add_pairwise(self.to_glib_none().0, pairwise.to_glib_none().0))
279 }
280 }
281
282 /// Adds a Wi-Fi security protocol (one of "wpa" or "rsn") to the allowed list;
283 /// only protocols in this list will be used when finding and connecting to
284 /// the Wi-Fi network specified by this connection. For example, if the
285 /// protocol list contains only "wpa" but the access point for the SSID specified
286 /// by this connection only supports WPA2/RSN, the connection cannot be used
287 /// with the access point.
288 /// ## `proto`
289 /// the protocol to add, one of "wpa" or "rsn"
290 ///
291 /// # Returns
292 ///
293 /// [`true`] if the protocol was new and was added to the allowed
294 /// protocol list, or [`false`] if it was already in the list
295 #[doc(alias = "nm_setting_wireless_security_add_proto")]
296 pub fn add_proto(&self, proto: &str) -> bool {
297 unsafe {
298 from_glib(ffi::nm_setting_wireless_security_add_proto(self.to_glib_none().0, proto.to_glib_none().0))
299 }
300 }
301
302 /// Removes all algorithms from the allowed list. If there are no algorithms
303 /// specified then all groupwise encryption algorithms are allowed.
304 #[doc(alias = "nm_setting_wireless_security_clear_groups")]
305 pub fn clear_groups(&self) {
306 unsafe {
307 ffi::nm_setting_wireless_security_clear_groups(self.to_glib_none().0);
308 }
309 }
310
311 /// Removes all algorithms from the allowed list. If there are no algorithms
312 /// specified then all pairwise encryption algorithms are allowed.
313 #[doc(alias = "nm_setting_wireless_security_clear_pairwise")]
314 pub fn clear_pairwise(&self) {
315 unsafe {
316 ffi::nm_setting_wireless_security_clear_pairwise(self.to_glib_none().0);
317 }
318 }
319
320 /// Removes all protocols from the allowed list. If there are no protocols
321 /// specified then all protocols are allowed.
322 #[doc(alias = "nm_setting_wireless_security_clear_protos")]
323 pub fn clear_protos(&self) {
324 unsafe {
325 ffi::nm_setting_wireless_security_clear_protos(self.to_glib_none().0);
326 }
327 }
328
329 ///
330 /// # Returns
331 ///
332 /// the #NMSettingWirelessSecurity:auth-alg property of the setting
333 #[doc(alias = "nm_setting_wireless_security_get_auth_alg")]
334 #[doc(alias = "get_auth_alg")]
335 #[doc(alias = "auth-alg")]
336 pub fn auth_alg(&self) -> glib::GString {
337 unsafe {
338 from_glib_none(ffi::nm_setting_wireless_security_get_auth_alg(self.to_glib_none().0))
339 }
340 }
341
342 ///
343 /// # Returns
344 ///
345 /// the #NMSettingWirelessSecurity:fils property of the setting
346 #[cfg(feature = "v1_12")]
347 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
348 #[doc(alias = "nm_setting_wireless_security_get_fils")]
349 #[doc(alias = "get_fils")]
350 pub fn fils(&self) -> SettingWirelessSecurityFils {
351 unsafe {
352 from_glib(ffi::nm_setting_wireless_security_get_fils(self.to_glib_none().0))
353 }
354 }
355
356 /// Returns the allowed groupwise encryption algorithm from allowed algorithm
357 /// list.
358 /// ## `i`
359 /// index of an item in the allowed groupwise encryption algorithm list
360 ///
361 /// # Returns
362 ///
363 /// the groupwise encryption algorithm at index @i
364 #[doc(alias = "nm_setting_wireless_security_get_group")]
365 #[doc(alias = "get_group")]
366 pub fn group(&self, i: u32) -> glib::GString {
367 unsafe {
368 from_glib_none(ffi::nm_setting_wireless_security_get_group(self.to_glib_none().0, i))
369 }
370 }
371
372 ///
373 /// # Returns
374 ///
375 /// the #NMSettingWirelessSecurity:key-mgmt property of the setting
376 #[doc(alias = "nm_setting_wireless_security_get_key_mgmt")]
377 #[doc(alias = "get_key_mgmt")]
378 #[doc(alias = "key-mgmt")]
379 pub fn key_mgmt(&self) -> glib::GString {
380 unsafe {
381 from_glib_none(ffi::nm_setting_wireless_security_get_key_mgmt(self.to_glib_none().0))
382 }
383 }
384
385 ///
386 /// # Returns
387 ///
388 /// the #NMSettingWirelessSecurity:leap-password property of the setting
389 #[doc(alias = "nm_setting_wireless_security_get_leap_password")]
390 #[doc(alias = "get_leap_password")]
391 #[doc(alias = "leap-password")]
392 pub fn leap_password(&self) -> glib::GString {
393 unsafe {
394 from_glib_none(ffi::nm_setting_wireless_security_get_leap_password(self.to_glib_none().0))
395 }
396 }
397
398 ///
399 /// # Returns
400 ///
401 /// the #NMSettingSecretFlags pertaining to the
402 /// #NMSettingWirelessSecurity:leap-password
403 #[doc(alias = "nm_setting_wireless_security_get_leap_password_flags")]
404 #[doc(alias = "get_leap_password_flags")]
405 #[doc(alias = "leap-password-flags")]
406 pub fn leap_password_flags(&self) -> SettingSecretFlags {
407 unsafe {
408 from_glib(ffi::nm_setting_wireless_security_get_leap_password_flags(self.to_glib_none().0))
409 }
410 }
411
412 ///
413 /// # Returns
414 ///
415 /// the #NMSettingWirelessSecurity:leap-username property of the setting
416 #[doc(alias = "nm_setting_wireless_security_get_leap_username")]
417 #[doc(alias = "get_leap_username")]
418 #[doc(alias = "leap-username")]
419 pub fn leap_username(&self) -> glib::GString {
420 unsafe {
421 from_glib_none(ffi::nm_setting_wireless_security_get_leap_username(self.to_glib_none().0))
422 }
423 }
424
425 ///
426 /// # Returns
427 ///
428 /// the number of groupwise encryption algorithms in the allowed list
429 #[doc(alias = "nm_setting_wireless_security_get_num_groups")]
430 #[doc(alias = "get_num_groups")]
431 pub fn num_groups(&self) -> u32 {
432 unsafe {
433 ffi::nm_setting_wireless_security_get_num_groups(self.to_glib_none().0)
434 }
435 }
436
437 ///
438 /// # Returns
439 ///
440 /// the number of pairwise encryption algorithms in the allowed list
441 #[doc(alias = "nm_setting_wireless_security_get_num_pairwise")]
442 #[doc(alias = "get_num_pairwise")]
443 pub fn num_pairwise(&self) -> u32 {
444 unsafe {
445 ffi::nm_setting_wireless_security_get_num_pairwise(self.to_glib_none().0)
446 }
447 }
448
449 ///
450 /// # Returns
451 ///
452 /// the number of security protocols this connection allows when
453 /// connecting to secure Wi-Fi networks
454 #[doc(alias = "nm_setting_wireless_security_get_num_protos")]
455 #[doc(alias = "get_num_protos")]
456 pub fn num_protos(&self) -> u32 {
457 unsafe {
458 ffi::nm_setting_wireless_security_get_num_protos(self.to_glib_none().0)
459 }
460 }
461
462 /// Returns the allowed pairwise encryption algorithm from allowed algorithm
463 /// list.
464 /// ## `i`
465 /// index of an item in the allowed pairwise encryption algorithm list
466 ///
467 /// # Returns
468 ///
469 /// the pairwise encryption algorithm at index @i
470 #[doc(alias = "nm_setting_wireless_security_get_pairwise")]
471 #[doc(alias = "get_pairwise")]
472 pub fn pairwise(&self, i: u32) -> glib::GString {
473 unsafe {
474 from_glib_none(ffi::nm_setting_wireless_security_get_pairwise(self.to_glib_none().0, i))
475 }
476 }
477
478 ///
479 /// # Returns
480 ///
481 /// the #NMSettingWirelessSecurity:pmf property of the setting
482 #[cfg(feature = "v1_10")]
483 #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
484 #[doc(alias = "nm_setting_wireless_security_get_pmf")]
485 #[doc(alias = "get_pmf")]
486 pub fn pmf(&self) -> SettingWirelessSecurityPmf {
487 unsafe {
488 from_glib(ffi::nm_setting_wireless_security_get_pmf(self.to_glib_none().0))
489 }
490 }
491
492 /// ## `i`
493 /// an index into the protocol list
494 ///
495 /// # Returns
496 ///
497 /// the protocol at index @i
498 #[doc(alias = "nm_setting_wireless_security_get_proto")]
499 #[doc(alias = "get_proto")]
500 pub fn proto(&self, i: u32) -> glib::GString {
501 unsafe {
502 from_glib_none(ffi::nm_setting_wireless_security_get_proto(self.to_glib_none().0, i))
503 }
504 }
505
506 ///
507 /// # Returns
508 ///
509 /// the #NMSettingWirelessSecurity:psk property of the setting
510 #[doc(alias = "nm_setting_wireless_security_get_psk")]
511 #[doc(alias = "get_psk")]
512 pub fn psk(&self) -> glib::GString {
513 unsafe {
514 from_glib_none(ffi::nm_setting_wireless_security_get_psk(self.to_glib_none().0))
515 }
516 }
517
518 ///
519 /// # Returns
520 ///
521 /// the #NMSettingSecretFlags pertaining to the
522 /// #NMSettingWirelessSecurity:psk
523 #[doc(alias = "nm_setting_wireless_security_get_psk_flags")]
524 #[doc(alias = "get_psk_flags")]
525 #[doc(alias = "psk-flags")]
526 pub fn psk_flags(&self) -> SettingSecretFlags {
527 unsafe {
528 from_glib(ffi::nm_setting_wireless_security_get_psk_flags(self.to_glib_none().0))
529 }
530 }
531
532 /// ## `idx`
533 /// the WEP key index (0..3 inclusive)
534 ///
535 /// # Returns
536 ///
537 /// the WEP key at the given index
538 #[doc(alias = "nm_setting_wireless_security_get_wep_key")]
539 #[doc(alias = "get_wep_key")]
540 pub fn wep_key(&self, idx: u32) -> glib::GString {
541 unsafe {
542 from_glib_none(ffi::nm_setting_wireless_security_get_wep_key(self.to_glib_none().0, idx))
543 }
544 }
545
546 ///
547 /// # Returns
548 ///
549 /// the #NMSettingSecretFlags pertaining to the all WEP keys
550 #[doc(alias = "nm_setting_wireless_security_get_wep_key_flags")]
551 #[doc(alias = "get_wep_key_flags")]
552 #[doc(alias = "wep-key-flags")]
553 pub fn wep_key_flags(&self) -> SettingSecretFlags {
554 unsafe {
555 from_glib(ffi::nm_setting_wireless_security_get_wep_key_flags(self.to_glib_none().0))
556 }
557 }
558
559 ///
560 /// # Returns
561 ///
562 /// the #NMSettingWirelessSecurity:wep-key-type property of the setting
563 #[doc(alias = "nm_setting_wireless_security_get_wep_key_type")]
564 #[doc(alias = "get_wep_key_type")]
565 #[doc(alias = "wep-key-type")]
566 pub fn wep_key_type(&self) -> WepKeyType {
567 unsafe {
568 from_glib(ffi::nm_setting_wireless_security_get_wep_key_type(self.to_glib_none().0))
569 }
570 }
571
572 ///
573 /// # Returns
574 ///
575 /// the #NMSettingWirelessSecurity:wep-tx-keyidx property of the setting
576 #[doc(alias = "nm_setting_wireless_security_get_wep_tx_keyidx")]
577 #[doc(alias = "get_wep_tx_keyidx")]
578 #[doc(alias = "wep-tx-keyidx")]
579 pub fn wep_tx_keyidx(&self) -> u32 {
580 unsafe {
581 ffi::nm_setting_wireless_security_get_wep_tx_keyidx(self.to_glib_none().0)
582 }
583 }
584
585 ///
586 /// # Returns
587 ///
588 /// the #NMSettingWirelessSecurity:wps-method property of the setting
589 #[cfg(feature = "v1_10")]
590 #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
591 #[doc(alias = "nm_setting_wireless_security_get_wps_method")]
592 #[doc(alias = "get_wps_method")]
593 #[doc(alias = "wps-method")]
594 pub fn wps_method(&self) -> SettingWirelessSecurityWpsMethod {
595 unsafe {
596 from_glib(ffi::nm_setting_wireless_security_get_wps_method(self.to_glib_none().0))
597 }
598 }
599
600 /// Removes an encryption algorithm from the allowed groupwise encryption
601 /// algorithm list.
602 /// ## `i`
603 /// the index of an item in the allowed groupwise encryption algorithm list
604 #[doc(alias = "nm_setting_wireless_security_remove_group")]
605 pub fn remove_group(&self, i: u32) {
606 unsafe {
607 ffi::nm_setting_wireless_security_remove_group(self.to_glib_none().0, i);
608 }
609 }
610
611 /// Removes an encryption algorithm from the allowed groupwise encryption
612 /// algorithm list.
613 /// ## `group`
614 /// the encryption algorithm to remove, one of "wep40", "wep104",
615 /// "tkip", or "ccmp"
616 ///
617 /// # Returns
618 ///
619 /// [`true`] if the algorithm was found and removed; [`false`] if it was not.
620 #[doc(alias = "nm_setting_wireless_security_remove_group_by_value")]
621 pub fn remove_group_by_value(&self, group: &str) -> bool {
622 unsafe {
623 from_glib(ffi::nm_setting_wireless_security_remove_group_by_value(self.to_glib_none().0, group.to_glib_none().0))
624 }
625 }
626
627 /// Removes an encryption algorithm from the allowed pairwise encryption
628 /// algorithm list.
629 /// ## `i`
630 /// the index of an item in the allowed pairwise encryption algorithm list
631 #[doc(alias = "nm_setting_wireless_security_remove_pairwise")]
632 pub fn remove_pairwise(&self, i: u32) {
633 unsafe {
634 ffi::nm_setting_wireless_security_remove_pairwise(self.to_glib_none().0, i);
635 }
636 }
637
638 /// Removes an encryption algorithm from the allowed pairwise encryption
639 /// algorithm list.
640 /// ## `pairwise`
641 /// the encryption algorithm to remove, one of "tkip" or "ccmp"
642 ///
643 /// # Returns
644 ///
645 /// [`true`] if the encryption algorithm was found and removed; [`false`] if it was not.
646 #[doc(alias = "nm_setting_wireless_security_remove_pairwise_by_value")]
647 pub fn remove_pairwise_by_value(&self, pairwise: &str) -> bool {
648 unsafe {
649 from_glib(ffi::nm_setting_wireless_security_remove_pairwise_by_value(self.to_glib_none().0, pairwise.to_glib_none().0))
650 }
651 }
652
653 /// Removes a protocol from the allowed protocol list.
654 /// ## `i`
655 /// index of the protocol to remove
656 #[doc(alias = "nm_setting_wireless_security_remove_proto")]
657 pub fn remove_proto(&self, i: u32) {
658 unsafe {
659 ffi::nm_setting_wireless_security_remove_proto(self.to_glib_none().0, i);
660 }
661 }
662
663 /// Removes a protocol from the allowed protocol list.
664 /// ## `proto`
665 /// the protocol to remove, one of "wpa" or "rsn"
666 ///
667 /// # Returns
668 ///
669 /// [`true`] if the protocol was found and removed; [`false`] if it was not.
670 #[doc(alias = "nm_setting_wireless_security_remove_proto_by_value")]
671 pub fn remove_proto_by_value(&self, proto: &str) -> bool {
672 unsafe {
673 from_glib(ffi::nm_setting_wireless_security_remove_proto_by_value(self.to_glib_none().0, proto.to_glib_none().0))
674 }
675 }
676
677 /// Sets a WEP key in the given index.
678 /// ## `idx`
679 /// the index of the key (0..3 inclusive)
680 /// ## `key`
681 /// the WEP key as a string, in either hexadecimal, ASCII, or passphrase
682 /// form as determined by the value of the #NMSettingWirelessSecurity:wep-key-type
683 /// property.
684 #[doc(alias = "nm_setting_wireless_security_set_wep_key")]
685 pub fn set_wep_key(&self, idx: u32, key: &str) {
686 unsafe {
687 ffi::nm_setting_wireless_security_set_wep_key(self.to_glib_none().0, idx, key.to_glib_none().0);
688 }
689 }
690
691 /// When WEP is used (ie, key-mgmt = "none" or "ieee8021x") indicate the
692 /// 802.11 authentication algorithm required by the AP here. One of "open"
693 /// for Open System, "shared" for Shared Key, or "leap" for Cisco LEAP. When
694 /// using Cisco LEAP (ie, key-mgmt = "ieee8021x" and auth-alg = "leap") the
695 /// "leap-username" and "leap-password" properties must be specified.
696 #[doc(alias = "auth-alg")]
697 pub fn set_auth_alg(&self, auth_alg: Option<&str>) {
698 ObjectExt::set_property(self,"auth-alg", auth_alg)
699 }
700
701 /// Indicates whether Fast Initial Link Setup (802.11ai) must be enabled for
702 /// the connection. One of [`SettingWirelessSecurityFils::Default`][crate::SettingWirelessSecurityFils::Default] (use
703 /// global default value), [`SettingWirelessSecurityFils::Disable`][crate::SettingWirelessSecurityFils::Disable]
704 /// (disable FILS), [`SettingWirelessSecurityFils::Optional`][crate::SettingWirelessSecurityFils::Optional] (enable FILS
705 /// if the supplicant and the access point support it) or
706 /// [`SettingWirelessSecurityFils::Required`][crate::SettingWirelessSecurityFils::Required] (enable FILS and fail if not
707 /// supported). When set to [`SettingWirelessSecurityFils::Default`][crate::SettingWirelessSecurityFils::Default] and
708 /// no global default is set, FILS will be optionally enabled.
709 #[cfg(feature = "v1_12")]
710 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
711 pub fn set_fils(&self, fils: i32) {
712 ObjectExt::set_property(self,"fils", fils)
713 }
714
715 /// A list of group/broadcast encryption algorithms which prevents
716 /// connections to Wi-Fi networks that do not utilize one of the algorithms
717 /// in the list. For maximum compatibility leave this property empty. Each
718 /// list element may be one of "wep40", "wep104", "tkip", or "ccmp".
719 pub fn set_group(&self, group: &[&str]) {
720 ObjectExt::set_property(self,"group", group)
721 }
722
723 /// Key management used for the connection. One of "none" (WEP or no
724 /// password protection), "ieee8021x" (Dynamic WEP), "owe" (Opportunistic
725 /// Wireless Encryption), "wpa-psk" (WPA2 + WPA3 personal), "sae" (WPA3
726 /// personal only), "wpa-eap" (WPA2 + WPA3 enterprise) or
727 /// "wpa-eap-suite-b-192" (WPA3 enterprise only).
728 ///
729 /// This property must be set for any Wi-Fi connection that uses security.
730 #[doc(alias = "key-mgmt")]
731 pub fn set_key_mgmt(&self, key_mgmt: Option<&str>) {
732 ObjectExt::set_property(self,"key-mgmt", key_mgmt)
733 }
734
735 /// The login password for legacy LEAP connections (ie, key-mgmt =
736 /// "ieee8021x" and auth-alg = "leap").
737 #[doc(alias = "leap-password")]
738 pub fn set_leap_password(&self, leap_password: Option<&str>) {
739 ObjectExt::set_property(self,"leap-password", leap_password)
740 }
741
742 /// Flags indicating how to handle the
743 /// #NMSettingWirelessSecurity:leap-password property.
744 #[doc(alias = "leap-password-flags")]
745 pub fn set_leap_password_flags(&self, leap_password_flags: SettingSecretFlags) {
746 ObjectExt::set_property(self,"leap-password-flags", leap_password_flags)
747 }
748
749 /// The login username for legacy LEAP connections (ie, key-mgmt =
750 /// "ieee8021x" and auth-alg = "leap").
751 #[doc(alias = "leap-username")]
752 pub fn set_leap_username(&self, leap_username: Option<&str>) {
753 ObjectExt::set_property(self,"leap-username", leap_username)
754 }
755
756 /// A list of pairwise encryption algorithms which prevents connections to
757 /// Wi-Fi networks that do not utilize one of the algorithms in the list.
758 /// For maximum compatibility leave this property empty. Each list element
759 /// may be one of "tkip" or "ccmp".
760 pub fn set_pairwise(&self, pairwise: &[&str]) {
761 ObjectExt::set_property(self,"pairwise", pairwise)
762 }
763
764 /// Indicates whether Protected Management Frames (802.11w) must be enabled
765 /// for the connection. One of [`SettingWirelessSecurityPmf::Default`][crate::SettingWirelessSecurityPmf::Default]
766 /// (use global default value), [`SettingWirelessSecurityPmf::Disable`][crate::SettingWirelessSecurityPmf::Disable]
767 /// (disable PMF), [`SettingWirelessSecurityPmf::Optional`][crate::SettingWirelessSecurityPmf::Optional] (enable PMF if
768 /// the supplicant and the access point support it) or
769 /// [`SettingWirelessSecurityPmf::Required`][crate::SettingWirelessSecurityPmf::Required] (enable PMF and fail if not
770 /// supported). When set to [`SettingWirelessSecurityPmf::Default`][crate::SettingWirelessSecurityPmf::Default] and no
771 /// global default is set, PMF will be optionally enabled.
772 #[cfg(feature = "v1_10")]
773 #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
774 pub fn set_pmf(&self, pmf: i32) {
775 ObjectExt::set_property(self,"pmf", pmf)
776 }
777
778 /// List of strings specifying the allowed WPA protocol versions to use.
779 /// Each element may be one "wpa" (allow WPA) or "rsn" (allow WPA2/RSN). If
780 /// not specified, both WPA and RSN connections are allowed.
781 pub fn set_proto(&self, proto: &[&str]) {
782 ObjectExt::set_property(self,"proto", proto)
783 }
784
785 /// Pre-Shared-Key for WPA networks. For WPA-PSK, it's either an ASCII
786 /// passphrase of 8 to 63 characters that is (as specified in the 802.11i
787 /// standard) hashed to derive the actual key, or the key in form of 64
788 /// hexadecimal character. The WPA3-Personal networks use a passphrase
789 /// of any length for SAE authentication.
790 pub fn set_psk(&self, psk: Option<&str>) {
791 ObjectExt::set_property(self,"psk", psk)
792 }
793
794 /// Flags indicating how to handle the #NMSettingWirelessSecurity:psk
795 /// property.
796 #[doc(alias = "psk-flags")]
797 pub fn set_psk_flags(&self, psk_flags: SettingSecretFlags) {
798 ObjectExt::set_property(self,"psk-flags", psk_flags)
799 }
800
801 /// Flags indicating how to handle the #NMSettingWirelessSecurity:wep-key0,
802 /// #NMSettingWirelessSecurity:wep-key1, #NMSettingWirelessSecurity:wep-key2,
803 /// and #NMSettingWirelessSecurity:wep-key3 properties.
804 #[doc(alias = "wep-key-flags")]
805 pub fn set_wep_key_flags(&self, wep_key_flags: SettingSecretFlags) {
806 ObjectExt::set_property(self,"wep-key-flags", wep_key_flags)
807 }
808
809 /// Controls the interpretation of WEP keys. Allowed values are
810 /// [`WepKeyType::Key`][crate::WepKeyType::Key], in which case the key is either a 10- or
811 /// 26-character hexadecimal string, or a 5- or 13-character ASCII password;
812 /// or [`WepKeyType::Passphrase`][crate::WepKeyType::Passphrase], in which case the passphrase is provided
813 /// as a string and will be hashed using the de-facto MD5 method to derive
814 /// the actual WEP key.
815 #[doc(alias = "wep-key-type")]
816 pub fn set_wep_key_type(&self, wep_key_type: WepKeyType) {
817 ObjectExt::set_property(self,"wep-key-type", wep_key_type)
818 }
819
820 /// Index 0 WEP key. This is the WEP key used in most networks. See the
821 /// "wep-key-type" property for a description of how this key is interpreted.
822 #[doc(alias = "wep-key0")]
823 pub fn wep_key0(&self) -> Option<glib::GString> {
824 ObjectExt::property(self, "wep-key0")
825 }
826
827 /// Index 0 WEP key. This is the WEP key used in most networks. See the
828 /// "wep-key-type" property for a description of how this key is interpreted.
829 #[doc(alias = "wep-key0")]
830 pub fn set_wep_key0(&self, wep_key0: Option<&str>) {
831 ObjectExt::set_property(self,"wep-key0", wep_key0)
832 }
833
834 /// Index 1 WEP key. This WEP index is not used by most networks. See the
835 /// "wep-key-type" property for a description of how this key is interpreted.
836 #[doc(alias = "wep-key1")]
837 pub fn wep_key1(&self) -> Option<glib::GString> {
838 ObjectExt::property(self, "wep-key1")
839 }
840
841 /// Index 1 WEP key. This WEP index is not used by most networks. See the
842 /// "wep-key-type" property for a description of how this key is interpreted.
843 #[doc(alias = "wep-key1")]
844 pub fn set_wep_key1(&self, wep_key1: Option<&str>) {
845 ObjectExt::set_property(self,"wep-key1", wep_key1)
846 }
847
848 /// Index 2 WEP key. This WEP index is not used by most networks. See the
849 /// "wep-key-type" property for a description of how this key is interpreted.
850 #[doc(alias = "wep-key2")]
851 pub fn wep_key2(&self) -> Option<glib::GString> {
852 ObjectExt::property(self, "wep-key2")
853 }
854
855 /// Index 2 WEP key. This WEP index is not used by most networks. See the
856 /// "wep-key-type" property for a description of how this key is interpreted.
857 #[doc(alias = "wep-key2")]
858 pub fn set_wep_key2(&self, wep_key2: Option<&str>) {
859 ObjectExt::set_property(self,"wep-key2", wep_key2)
860 }
861
862 /// Index 3 WEP key. This WEP index is not used by most networks. See the
863 /// "wep-key-type" property for a description of how this key is interpreted.
864 #[doc(alias = "wep-key3")]
865 pub fn wep_key3(&self) -> Option<glib::GString> {
866 ObjectExt::property(self, "wep-key3")
867 }
868
869 /// Index 3 WEP key. This WEP index is not used by most networks. See the
870 /// "wep-key-type" property for a description of how this key is interpreted.
871 #[doc(alias = "wep-key3")]
872 pub fn set_wep_key3(&self, wep_key3: Option<&str>) {
873 ObjectExt::set_property(self,"wep-key3", wep_key3)
874 }
875
876 /// When static WEP is used (ie, key-mgmt = "none") and a non-default WEP key
877 /// index is used by the AP, put that WEP key index here. Valid values are 0
878 /// (default key) through 3. Note that some consumer access points (like the
879 /// Linksys WRT54G) number the keys 1 - 4.
880 #[doc(alias = "wep-tx-keyidx")]
881 pub fn set_wep_tx_keyidx(&self, wep_tx_keyidx: u32) {
882 ObjectExt::set_property(self,"wep-tx-keyidx", wep_tx_keyidx)
883 }
884
885 /// Flags indicating which mode of WPS is to be used if any.
886 ///
887 /// There's little point in changing the default setting as NetworkManager will
888 /// automatically determine whether it's feasible to start WPS enrollment from
889 /// the Access Point capabilities.
890 ///
891 /// WPS can be disabled by setting this property to a value of 1.
892 #[cfg(feature = "v1_10")]
893 #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
894 #[doc(alias = "wps-method")]
895 pub fn set_wps_method(&self, wps_method: u32) {
896 ObjectExt::set_property(self,"wps-method", wps_method)
897 }
898
899 #[doc(alias = "auth-alg")]
900 pub fn connect_auth_alg_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
901 unsafe extern "C" fn notify_auth_alg_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
902 let f: &F = &*(f as *const F);
903 f(&from_glib_borrow(this))
904 }
905 unsafe {
906 let f: Box_<F> = Box_::new(f);
907 connect_raw(self.as_ptr() as *mut _, c"notify::auth-alg".as_ptr() as *const _,
908 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_auth_alg_trampoline::<F> as *const ())), Box_::into_raw(f))
909 }
910 }
911
912 #[cfg(feature = "v1_12")]
913 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
914 #[doc(alias = "fils")]
915 pub fn connect_fils_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
916 unsafe extern "C" fn notify_fils_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
917 let f: &F = &*(f as *const F);
918 f(&from_glib_borrow(this))
919 }
920 unsafe {
921 let f: Box_<F> = Box_::new(f);
922 connect_raw(self.as_ptr() as *mut _, c"notify::fils".as_ptr() as *const _,
923 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_fils_trampoline::<F> as *const ())), Box_::into_raw(f))
924 }
925 }
926
927 #[doc(alias = "group")]
928 pub fn connect_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
929 unsafe extern "C" fn notify_group_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
930 let f: &F = &*(f as *const F);
931 f(&from_glib_borrow(this))
932 }
933 unsafe {
934 let f: Box_<F> = Box_::new(f);
935 connect_raw(self.as_ptr() as *mut _, c"notify::group".as_ptr() as *const _,
936 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_group_trampoline::<F> as *const ())), Box_::into_raw(f))
937 }
938 }
939
940 #[doc(alias = "key-mgmt")]
941 pub fn connect_key_mgmt_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
942 unsafe extern "C" fn notify_key_mgmt_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
943 let f: &F = &*(f as *const F);
944 f(&from_glib_borrow(this))
945 }
946 unsafe {
947 let f: Box_<F> = Box_::new(f);
948 connect_raw(self.as_ptr() as *mut _, c"notify::key-mgmt".as_ptr() as *const _,
949 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_key_mgmt_trampoline::<F> as *const ())), Box_::into_raw(f))
950 }
951 }
952
953 #[doc(alias = "leap-password")]
954 pub fn connect_leap_password_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
955 unsafe extern "C" fn notify_leap_password_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
956 let f: &F = &*(f as *const F);
957 f(&from_glib_borrow(this))
958 }
959 unsafe {
960 let f: Box_<F> = Box_::new(f);
961 connect_raw(self.as_ptr() as *mut _, c"notify::leap-password".as_ptr() as *const _,
962 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_leap_password_trampoline::<F> as *const ())), Box_::into_raw(f))
963 }
964 }
965
966 #[doc(alias = "leap-password-flags")]
967 pub fn connect_leap_password_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
968 unsafe extern "C" fn notify_leap_password_flags_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
969 let f: &F = &*(f as *const F);
970 f(&from_glib_borrow(this))
971 }
972 unsafe {
973 let f: Box_<F> = Box_::new(f);
974 connect_raw(self.as_ptr() as *mut _, c"notify::leap-password-flags".as_ptr() as *const _,
975 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_leap_password_flags_trampoline::<F> as *const ())), Box_::into_raw(f))
976 }
977 }
978
979 #[doc(alias = "leap-username")]
980 pub fn connect_leap_username_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
981 unsafe extern "C" fn notify_leap_username_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
982 let f: &F = &*(f as *const F);
983 f(&from_glib_borrow(this))
984 }
985 unsafe {
986 let f: Box_<F> = Box_::new(f);
987 connect_raw(self.as_ptr() as *mut _, c"notify::leap-username".as_ptr() as *const _,
988 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_leap_username_trampoline::<F> as *const ())), Box_::into_raw(f))
989 }
990 }
991
992 #[doc(alias = "pairwise")]
993 pub fn connect_pairwise_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
994 unsafe extern "C" fn notify_pairwise_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
995 let f: &F = &*(f as *const F);
996 f(&from_glib_borrow(this))
997 }
998 unsafe {
999 let f: Box_<F> = Box_::new(f);
1000 connect_raw(self.as_ptr() as *mut _, c"notify::pairwise".as_ptr() as *const _,
1001 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_pairwise_trampoline::<F> as *const ())), Box_::into_raw(f))
1002 }
1003 }
1004
1005 #[cfg(feature = "v1_10")]
1006 #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
1007 #[doc(alias = "pmf")]
1008 pub fn connect_pmf_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1009 unsafe extern "C" fn notify_pmf_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1010 let f: &F = &*(f as *const F);
1011 f(&from_glib_borrow(this))
1012 }
1013 unsafe {
1014 let f: Box_<F> = Box_::new(f);
1015 connect_raw(self.as_ptr() as *mut _, c"notify::pmf".as_ptr() as *const _,
1016 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_pmf_trampoline::<F> as *const ())), Box_::into_raw(f))
1017 }
1018 }
1019
1020 #[doc(alias = "proto")]
1021 pub fn connect_proto_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1022 unsafe extern "C" fn notify_proto_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1023 let f: &F = &*(f as *const F);
1024 f(&from_glib_borrow(this))
1025 }
1026 unsafe {
1027 let f: Box_<F> = Box_::new(f);
1028 connect_raw(self.as_ptr() as *mut _, c"notify::proto".as_ptr() as *const _,
1029 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_proto_trampoline::<F> as *const ())), Box_::into_raw(f))
1030 }
1031 }
1032
1033 #[doc(alias = "psk")]
1034 pub fn connect_psk_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1035 unsafe extern "C" fn notify_psk_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1036 let f: &F = &*(f as *const F);
1037 f(&from_glib_borrow(this))
1038 }
1039 unsafe {
1040 let f: Box_<F> = Box_::new(f);
1041 connect_raw(self.as_ptr() as *mut _, c"notify::psk".as_ptr() as *const _,
1042 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_psk_trampoline::<F> as *const ())), Box_::into_raw(f))
1043 }
1044 }
1045
1046 #[doc(alias = "psk-flags")]
1047 pub fn connect_psk_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1048 unsafe extern "C" fn notify_psk_flags_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1049 let f: &F = &*(f as *const F);
1050 f(&from_glib_borrow(this))
1051 }
1052 unsafe {
1053 let f: Box_<F> = Box_::new(f);
1054 connect_raw(self.as_ptr() as *mut _, c"notify::psk-flags".as_ptr() as *const _,
1055 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_psk_flags_trampoline::<F> as *const ())), Box_::into_raw(f))
1056 }
1057 }
1058
1059 #[doc(alias = "wep-key-flags")]
1060 pub fn connect_wep_key_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1061 unsafe extern "C" fn notify_wep_key_flags_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1062 let f: &F = &*(f as *const F);
1063 f(&from_glib_borrow(this))
1064 }
1065 unsafe {
1066 let f: Box_<F> = Box_::new(f);
1067 connect_raw(self.as_ptr() as *mut _, c"notify::wep-key-flags".as_ptr() as *const _,
1068 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_wep_key_flags_trampoline::<F> as *const ())), Box_::into_raw(f))
1069 }
1070 }
1071
1072 #[doc(alias = "wep-key-type")]
1073 pub fn connect_wep_key_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1074 unsafe extern "C" fn notify_wep_key_type_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1075 let f: &F = &*(f as *const F);
1076 f(&from_glib_borrow(this))
1077 }
1078 unsafe {
1079 let f: Box_<F> = Box_::new(f);
1080 connect_raw(self.as_ptr() as *mut _, c"notify::wep-key-type".as_ptr() as *const _,
1081 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_wep_key_type_trampoline::<F> as *const ())), Box_::into_raw(f))
1082 }
1083 }
1084
1085 #[doc(alias = "wep-key0")]
1086 pub fn connect_wep_key0_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1087 unsafe extern "C" fn notify_wep_key0_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1088 let f: &F = &*(f as *const F);
1089 f(&from_glib_borrow(this))
1090 }
1091 unsafe {
1092 let f: Box_<F> = Box_::new(f);
1093 connect_raw(self.as_ptr() as *mut _, c"notify::wep-key0".as_ptr() as *const _,
1094 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_wep_key0_trampoline::<F> as *const ())), Box_::into_raw(f))
1095 }
1096 }
1097
1098 #[doc(alias = "wep-key1")]
1099 pub fn connect_wep_key1_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1100 unsafe extern "C" fn notify_wep_key1_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1101 let f: &F = &*(f as *const F);
1102 f(&from_glib_borrow(this))
1103 }
1104 unsafe {
1105 let f: Box_<F> = Box_::new(f);
1106 connect_raw(self.as_ptr() as *mut _, c"notify::wep-key1".as_ptr() as *const _,
1107 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_wep_key1_trampoline::<F> as *const ())), Box_::into_raw(f))
1108 }
1109 }
1110
1111 #[doc(alias = "wep-key2")]
1112 pub fn connect_wep_key2_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1113 unsafe extern "C" fn notify_wep_key2_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1114 let f: &F = &*(f as *const F);
1115 f(&from_glib_borrow(this))
1116 }
1117 unsafe {
1118 let f: Box_<F> = Box_::new(f);
1119 connect_raw(self.as_ptr() as *mut _, c"notify::wep-key2".as_ptr() as *const _,
1120 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_wep_key2_trampoline::<F> as *const ())), Box_::into_raw(f))
1121 }
1122 }
1123
1124 #[doc(alias = "wep-key3")]
1125 pub fn connect_wep_key3_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1126 unsafe extern "C" fn notify_wep_key3_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1127 let f: &F = &*(f as *const F);
1128 f(&from_glib_borrow(this))
1129 }
1130 unsafe {
1131 let f: Box_<F> = Box_::new(f);
1132 connect_raw(self.as_ptr() as *mut _, c"notify::wep-key3".as_ptr() as *const _,
1133 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_wep_key3_trampoline::<F> as *const ())), Box_::into_raw(f))
1134 }
1135 }
1136
1137 #[doc(alias = "wep-tx-keyidx")]
1138 pub fn connect_wep_tx_keyidx_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1139 unsafe extern "C" fn notify_wep_tx_keyidx_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1140 let f: &F = &*(f as *const F);
1141 f(&from_glib_borrow(this))
1142 }
1143 unsafe {
1144 let f: Box_<F> = Box_::new(f);
1145 connect_raw(self.as_ptr() as *mut _, c"notify::wep-tx-keyidx".as_ptr() as *const _,
1146 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_wep_tx_keyidx_trampoline::<F> as *const ())), Box_::into_raw(f))
1147 }
1148 }
1149
1150 #[cfg(feature = "v1_10")]
1151 #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
1152 #[doc(alias = "wps-method")]
1153 pub fn connect_wps_method_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1154 unsafe extern "C" fn notify_wps_method_trampoline<F: Fn(&SettingWirelessSecurity) + 'static>(this: *mut ffi::NMSettingWirelessSecurity, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
1155 let f: &F = &*(f as *const F);
1156 f(&from_glib_borrow(this))
1157 }
1158 unsafe {
1159 let f: Box_<F> = Box_::new(f);
1160 connect_raw(self.as_ptr() as *mut _, c"notify::wps-method".as_ptr() as *const _,
1161 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_wps_method_trampoline::<F> as *const ())), Box_::into_raw(f))
1162 }
1163 }
1164}
1165
1166impl Default for SettingWirelessSecurity {
1167 fn default() -> Self {
1168 Self::new()
1169 }
1170 }
1171
1172// rustdoc-stripper-ignore-next
1173 /// A [builder-pattern] type to construct [`SettingWirelessSecurity`] objects.
1174 ///
1175 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1176#[must_use = "The builder must be built to be used"]
1177pub struct SettingWirelessSecurityBuilder {
1178 builder: glib::object::ObjectBuilder<'static, SettingWirelessSecurity>,
1179 }
1180
1181 impl SettingWirelessSecurityBuilder {
1182 fn new() -> Self {
1183 Self { builder: glib::object::Object::builder() }
1184 }
1185
1186 /// When WEP is used (ie, key-mgmt = "none" or "ieee8021x") indicate the
1187 /// 802.11 authentication algorithm required by the AP here. One of "open"
1188 /// for Open System, "shared" for Shared Key, or "leap" for Cisco LEAP. When
1189 /// using Cisco LEAP (ie, key-mgmt = "ieee8021x" and auth-alg = "leap") the
1190 /// "leap-username" and "leap-password" properties must be specified.
1191 pub fn auth_alg(self, auth_alg: impl Into<glib::GString>) -> Self {
1192 Self { builder: self.builder.property("auth-alg", auth_alg.into()), }
1193 }
1194
1195 /// Indicates whether Fast Initial Link Setup (802.11ai) must be enabled for
1196 /// the connection. One of [`SettingWirelessSecurityFils::Default`][crate::SettingWirelessSecurityFils::Default] (use
1197 /// global default value), [`SettingWirelessSecurityFils::Disable`][crate::SettingWirelessSecurityFils::Disable]
1198 /// (disable FILS), [`SettingWirelessSecurityFils::Optional`][crate::SettingWirelessSecurityFils::Optional] (enable FILS
1199 /// if the supplicant and the access point support it) or
1200 /// [`SettingWirelessSecurityFils::Required`][crate::SettingWirelessSecurityFils::Required] (enable FILS and fail if not
1201 /// supported). When set to [`SettingWirelessSecurityFils::Default`][crate::SettingWirelessSecurityFils::Default] and
1202 /// no global default is set, FILS will be optionally enabled.
1203 #[cfg(feature = "v1_12")]
1204 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
1205 pub fn fils(self, fils: i32) -> Self {
1206 Self { builder: self.builder.property("fils", fils), }
1207 }
1208
1209 /// A list of group/broadcast encryption algorithms which prevents
1210 /// connections to Wi-Fi networks that do not utilize one of the algorithms
1211 /// in the list. For maximum compatibility leave this property empty. Each
1212 /// list element may be one of "wep40", "wep104", "tkip", or "ccmp".
1213 pub fn group(self, group: impl Into<glib::StrV>) -> Self {
1214 Self { builder: self.builder.property("group", group.into()), }
1215 }
1216
1217 /// Key management used for the connection. One of "none" (WEP or no
1218 /// password protection), "ieee8021x" (Dynamic WEP), "owe" (Opportunistic
1219 /// Wireless Encryption), "wpa-psk" (WPA2 + WPA3 personal), "sae" (WPA3
1220 /// personal only), "wpa-eap" (WPA2 + WPA3 enterprise) or
1221 /// "wpa-eap-suite-b-192" (WPA3 enterprise only).
1222 ///
1223 /// This property must be set for any Wi-Fi connection that uses security.
1224 pub fn key_mgmt(self, key_mgmt: impl Into<glib::GString>) -> Self {
1225 Self { builder: self.builder.property("key-mgmt", key_mgmt.into()), }
1226 }
1227
1228 /// The login password for legacy LEAP connections (ie, key-mgmt =
1229 /// "ieee8021x" and auth-alg = "leap").
1230 pub fn leap_password(self, leap_password: impl Into<glib::GString>) -> Self {
1231 Self { builder: self.builder.property("leap-password", leap_password.into()), }
1232 }
1233
1234 /// Flags indicating how to handle the
1235 /// #NMSettingWirelessSecurity:leap-password property.
1236 pub fn leap_password_flags(self, leap_password_flags: SettingSecretFlags) -> Self {
1237 Self { builder: self.builder.property("leap-password-flags", leap_password_flags), }
1238 }
1239
1240 /// The login username for legacy LEAP connections (ie, key-mgmt =
1241 /// "ieee8021x" and auth-alg = "leap").
1242 pub fn leap_username(self, leap_username: impl Into<glib::GString>) -> Self {
1243 Self { builder: self.builder.property("leap-username", leap_username.into()), }
1244 }
1245
1246 /// A list of pairwise encryption algorithms which prevents connections to
1247 /// Wi-Fi networks that do not utilize one of the algorithms in the list.
1248 /// For maximum compatibility leave this property empty. Each list element
1249 /// may be one of "tkip" or "ccmp".
1250 pub fn pairwise(self, pairwise: impl Into<glib::StrV>) -> Self {
1251 Self { builder: self.builder.property("pairwise", pairwise.into()), }
1252 }
1253
1254 /// Indicates whether Protected Management Frames (802.11w) must be enabled
1255 /// for the connection. One of [`SettingWirelessSecurityPmf::Default`][crate::SettingWirelessSecurityPmf::Default]
1256 /// (use global default value), [`SettingWirelessSecurityPmf::Disable`][crate::SettingWirelessSecurityPmf::Disable]
1257 /// (disable PMF), [`SettingWirelessSecurityPmf::Optional`][crate::SettingWirelessSecurityPmf::Optional] (enable PMF if
1258 /// the supplicant and the access point support it) or
1259 /// [`SettingWirelessSecurityPmf::Required`][crate::SettingWirelessSecurityPmf::Required] (enable PMF and fail if not
1260 /// supported). When set to [`SettingWirelessSecurityPmf::Default`][crate::SettingWirelessSecurityPmf::Default] and no
1261 /// global default is set, PMF will be optionally enabled.
1262 #[cfg(feature = "v1_10")]
1263 #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
1264 pub fn pmf(self, pmf: i32) -> Self {
1265 Self { builder: self.builder.property("pmf", pmf), }
1266 }
1267
1268 /// List of strings specifying the allowed WPA protocol versions to use.
1269 /// Each element may be one "wpa" (allow WPA) or "rsn" (allow WPA2/RSN). If
1270 /// not specified, both WPA and RSN connections are allowed.
1271 pub fn proto(self, proto: impl Into<glib::StrV>) -> Self {
1272 Self { builder: self.builder.property("proto", proto.into()), }
1273 }
1274
1275 /// Pre-Shared-Key for WPA networks. For WPA-PSK, it's either an ASCII
1276 /// passphrase of 8 to 63 characters that is (as specified in the 802.11i
1277 /// standard) hashed to derive the actual key, or the key in form of 64
1278 /// hexadecimal character. The WPA3-Personal networks use a passphrase
1279 /// of any length for SAE authentication.
1280 pub fn psk(self, psk: impl Into<glib::GString>) -> Self {
1281 Self { builder: self.builder.property("psk", psk.into()), }
1282 }
1283
1284 /// Flags indicating how to handle the #NMSettingWirelessSecurity:psk
1285 /// property.
1286 pub fn psk_flags(self, psk_flags: SettingSecretFlags) -> Self {
1287 Self { builder: self.builder.property("psk-flags", psk_flags), }
1288 }
1289
1290 /// Flags indicating how to handle the #NMSettingWirelessSecurity:wep-key0,
1291 /// #NMSettingWirelessSecurity:wep-key1, #NMSettingWirelessSecurity:wep-key2,
1292 /// and #NMSettingWirelessSecurity:wep-key3 properties.
1293 pub fn wep_key_flags(self, wep_key_flags: SettingSecretFlags) -> Self {
1294 Self { builder: self.builder.property("wep-key-flags", wep_key_flags), }
1295 }
1296
1297 /// Controls the interpretation of WEP keys. Allowed values are
1298 /// [`WepKeyType::Key`][crate::WepKeyType::Key], in which case the key is either a 10- or
1299 /// 26-character hexadecimal string, or a 5- or 13-character ASCII password;
1300 /// or [`WepKeyType::Passphrase`][crate::WepKeyType::Passphrase], in which case the passphrase is provided
1301 /// as a string and will be hashed using the de-facto MD5 method to derive
1302 /// the actual WEP key.
1303 pub fn wep_key_type(self, wep_key_type: WepKeyType) -> Self {
1304 Self { builder: self.builder.property("wep-key-type", wep_key_type), }
1305 }
1306
1307 /// Index 0 WEP key. This is the WEP key used in most networks. See the
1308 /// "wep-key-type" property for a description of how this key is interpreted.
1309 pub fn wep_key0(self, wep_key0: impl Into<glib::GString>) -> Self {
1310 Self { builder: self.builder.property("wep-key0", wep_key0.into()), }
1311 }
1312
1313 /// Index 1 WEP key. This WEP index is not used by most networks. See the
1314 /// "wep-key-type" property for a description of how this key is interpreted.
1315 pub fn wep_key1(self, wep_key1: impl Into<glib::GString>) -> Self {
1316 Self { builder: self.builder.property("wep-key1", wep_key1.into()), }
1317 }
1318
1319 /// Index 2 WEP key. This WEP index is not used by most networks. See the
1320 /// "wep-key-type" property for a description of how this key is interpreted.
1321 pub fn wep_key2(self, wep_key2: impl Into<glib::GString>) -> Self {
1322 Self { builder: self.builder.property("wep-key2", wep_key2.into()), }
1323 }
1324
1325 /// Index 3 WEP key. This WEP index is not used by most networks. See the
1326 /// "wep-key-type" property for a description of how this key is interpreted.
1327 pub fn wep_key3(self, wep_key3: impl Into<glib::GString>) -> Self {
1328 Self { builder: self.builder.property("wep-key3", wep_key3.into()), }
1329 }
1330
1331 /// When static WEP is used (ie, key-mgmt = "none") and a non-default WEP key
1332 /// index is used by the AP, put that WEP key index here. Valid values are 0
1333 /// (default key) through 3. Note that some consumer access points (like the
1334 /// Linksys WRT54G) number the keys 1 - 4.
1335 pub fn wep_tx_keyidx(self, wep_tx_keyidx: u32) -> Self {
1336 Self { builder: self.builder.property("wep-tx-keyidx", wep_tx_keyidx), }
1337 }
1338
1339 /// Flags indicating which mode of WPS is to be used if any.
1340 ///
1341 /// There's little point in changing the default setting as NetworkManager will
1342 /// automatically determine whether it's feasible to start WPS enrollment from
1343 /// the Access Point capabilities.
1344 ///
1345 /// WPS can be disabled by setting this property to a value of 1.
1346 #[cfg(feature = "v1_10")]
1347 #[cfg_attr(docsrs, doc(cfg(feature = "v1_10")))]
1348 pub fn wps_method(self, wps_method: u32) -> Self {
1349 Self { builder: self.builder.property("wps-method", wps_method), }
1350 }
1351
1352 // rustdoc-stripper-ignore-next
1353 /// Build the [`SettingWirelessSecurity`].
1354 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1355 pub fn build(self) -> SettingWirelessSecurity {
1356assert_initialized_main_thread!();
1357 self.builder.build() }
1358}