nm_rs/auto/setting_wireless.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#![allow(deprecated)]
6
7#[cfg(feature = "v1_2")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
9use crate::SettingMacRandomization;
10#[cfg(feature = "v1_50")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
12use crate::SettingWirelessChannelWidth;
13#[cfg(feature = "v1_12")]
14#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
15use crate::SettingWirelessWakeOnWLan;
16#[cfg(feature = "v1_28")]
17#[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
18use crate::Ternary;
19use crate::{
20 NM80211ApFlags, NM80211ApSecurityFlags, NM80211Mode, Setting, SettingWirelessSecurity, ffi,
21};
22use glib::{
23 prelude::*,
24 signal::{SignalHandlerId, connect_raw},
25 translate::*,
26};
27use std::{borrow::Borrow, boxed::Box as Box_};
28
29glib::wrapper! {
30 /// Wi-Fi Settings
31 ///
32 /// ## Properties
33 ///
34 ///
35 /// #### `ap-isolation`
36 /// Configures AP isolation, which prevents communication between
37 /// wireless devices connected to this AP. This property can be set
38 /// to a value different from [`Ternary::Default`][crate::Ternary::Default] only when the
39 /// interface is configured in AP mode.
40 ///
41 /// If set to [`Ternary::True`][crate::Ternary::True], devices are not able to communicate
42 /// with each other. This increases security because it protects
43 /// devices against attacks from other clients in the network. At
44 /// the same time, it prevents devices to access resources on the
45 /// same wireless networks as file shares, printers, etc.
46 ///
47 /// If set to [`Ternary::False`][crate::Ternary::False], devices can talk to each other.
48 ///
49 /// When set to [`Ternary::Default`][crate::Ternary::Default], the global default is used; in
50 /// case the global default is unspecified it is assumed to be
51 /// [`Ternary::False`][crate::Ternary::False].
52 ///
53 /// Readable | Writeable
54 ///
55 ///
56 /// #### `band`
57 /// 802.11 frequency band of the network. One of "a" for 5GHz 802.11a or
58 /// "bg" for 2.4GHz 802.11. This will lock associations to the Wi-Fi network
59 /// to the specific band, i.e. if "a" is specified, the device will not
60 /// associate with the same network in the 2.4GHz band even if the network's
61 /// settings are compatible. This setting depends on specific driver
62 /// capability and may not work with all drivers.
63 ///
64 /// Readable | Writeable
65 ///
66 ///
67 /// #### `bssid`
68 /// If specified, directs the device to only associate with the given access
69 /// point. This capability is highly driver dependent and not supported by
70 /// all devices. Note: this property does not control the BSSID used when
71 /// creating an Ad-Hoc network and is unlikely to in the future.
72 ///
73 /// Locking a client profile to a certain BSSID will prevent roaming and also
74 /// disable background scanning. That can be useful, if there is only one access
75 /// point for the SSID.
76 ///
77 /// Readable | Writeable
78 ///
79 ///
80 /// #### `channel`
81 /// Wireless channel to use for the Wi-Fi connection. The device will only
82 /// join (or create for Ad-Hoc networks) a Wi-Fi network on the specified
83 /// channel. Because channel numbers overlap between bands, this property
84 /// also requires the "band" property to be set.
85 ///
86 /// Readable | Writeable
87 ///
88 ///
89 /// #### `channel-width`
90 /// Specifies width of the wireless channel in Access Point (AP) mode.
91 ///
92 /// When set to [`SettingWirelessChannelWidth::Auto`][crate::SettingWirelessChannelWidth::Auto] (the default), the
93 /// channel width is automatically determined. At the moment, this means that
94 /// the safest (smallest) width is chosen.
95 ///
96 /// If the value is not [`SettingWirelessChannelWidth::Auto`][crate::SettingWirelessChannelWidth::Auto], then the
97 /// 'channel' property must also be set. When using the 2.4GHz band, the width
98 /// can be at most 40MHz.
99 ///
100 /// This property can be set to a value different from
101 /// [`SettingWirelessChannelWidth::Auto`][crate::SettingWirelessChannelWidth::Auto] only when the interface is configured
102 /// in AP mode.
103 ///
104 /// Readable | Writeable
105 ///
106 ///
107 /// #### `cloned-mac-address`
108 /// If specified, request that the device use this MAC address instead.
109 /// This is known as MAC cloning or spoofing.
110 ///
111 /// Beside explicitly specifying a MAC address, the special values "preserve", "permanent",
112 /// "random", "stable" and "stable-ssid" are supported.
113 /// "preserve" means not to touch the MAC address on activation.
114 /// "permanent" means to use the permanent hardware address of the device.
115 /// "random" creates a random MAC address on each connect.
116 /// "stable" creates a hashed MAC address based on connection.stable-id and a
117 /// machine dependent key.
118 /// "stable-ssid" creates a hashed MAC address based on the SSID, the same as setting the
119 /// stable-id to "${NETWORK_SSID}".
120 ///
121 /// If unspecified, the value can be overwritten via global defaults, see manual
122 /// of NetworkManager.conf. If still unspecified, it defaults to "preserve"
123 /// (older versions of NetworkManager may use a different default value).
124 ///
125 /// On D-Bus, this field is expressed as "assigned-mac-address" or the deprecated
126 /// "cloned-mac-address".
127 ///
128 /// Readable | Writeable
129 ///
130 ///
131 /// #### `generate-mac-address-mask`
132 /// With #NMSettingWireless:cloned-mac-address setting "random" or "stable",
133 /// by default all bits of the MAC address are scrambled and a locally-administered,
134 /// unicast MAC address is created. This property allows one to specify that certain bits
135 /// are fixed. Note that the least significant bit of the first MAC address will
136 /// always be unset to create a unicast MAC address.
137 ///
138 /// If the property is [`None`], it is eligible to be overwritten by a default
139 /// connection setting. If the value is still [`None`] or an empty string, the
140 /// default is to create a locally-administered, unicast MAC address.
141 ///
142 /// If the value contains one MAC address, this address is used as mask. The set
143 /// bits of the mask are to be filled with the current MAC address of the device,
144 /// while the unset bits are subject to randomization.
145 /// Setting "FE:FF:FF:00:00:00" means to preserve the OUI of the current MAC address
146 /// and only randomize the lower 3 bytes using the "random" or "stable" algorithm.
147 ///
148 /// If the value contains one additional MAC address after the mask,
149 /// this address is used instead of the current MAC address to fill the bits
150 /// that shall not be randomized. For example, a value of
151 /// "FE:FF:FF:00:00:00 68:F7:28:00:00:00" will set the OUI of the MAC address
152 /// to 68:F7:28, while the lower bits are randomized. A value of
153 /// "02:00:00:00:00:00 00:00:00:00:00:00" will create a fully scrambled
154 /// globally-administered, burned-in MAC address.
155 ///
156 /// If the value contains more than one additional MAC addresses, one of
157 /// them is chosen randomly. For example, "02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00"
158 /// will create a fully scrambled MAC address, randomly locally or globally
159 /// administered.
160 ///
161 /// Readable | Writeable
162 ///
163 ///
164 /// #### `hidden`
165 /// If [`true`], indicates that the network is a non-broadcasting network that
166 /// hides its SSID. This works both in infrastructure and AP mode.
167 ///
168 /// In infrastructure mode, various workarounds are used for a more reliable
169 /// discovery of hidden networks, such as probe-scanning the SSID. However,
170 /// these workarounds expose inherent insecurities with hidden SSID networks,
171 /// and thus hidden SSID networks should be used with caution.
172 ///
173 /// In AP mode, the created network does not broadcast its SSID.
174 ///
175 /// Note that marking the network as hidden may be a privacy issue for you
176 /// (in infrastructure mode) or client stations (in AP mode), as the explicit
177 /// probe-scans are distinctly recognizable on the air.
178 ///
179 /// Readable | Writeable
180 ///
181 ///
182 /// #### `mac-address`
183 /// If specified, this connection will only apply to the Wi-Fi device whose
184 /// permanent MAC address matches. This property does not change the MAC
185 /// address of the device (i.e. MAC spoofing).
186 ///
187 /// Readable | Writeable
188 ///
189 ///
190 /// #### `mac-address-blacklist`
191 /// A list of permanent MAC addresses of Wi-Fi devices to which this
192 /// connection should never apply. Each MAC address should be given in the
193 /// standard hex-digits-and-colons notation (eg "00:11:22:33:44:55").
194 ///
195 /// Readable | Writeable
196 ///
197 ///
198 /// #### `mac-address-denylist`
199 /// A list of permanent MAC addresses of Wi-Fi devices to which this
200 /// connection should never apply. Each MAC address should be given in the
201 /// standard hex-digits-and-colons notation (eg "00:11:22:33:44:55").
202 ///
203 /// Readable | Writeable
204 ///
205 ///
206 /// #### `mac-address-randomization`
207 /// One of [`SettingMacRandomization::Default`][crate::SettingMacRandomization::Default] (never randomize unless
208 /// the user has set a global default to randomize and the supplicant
209 /// supports randomization), [`SettingMacRandomization::Never`][crate::SettingMacRandomization::Never] (never
210 /// randomize the MAC address), or [`SettingMacRandomization::Always`][crate::SettingMacRandomization::Always]
211 /// (always randomize the MAC address).
212 ///
213 /// Readable | Writeable
214 ///
215 ///
216 /// #### `mode`
217 /// Wi-Fi network mode; one of "infrastructure", "mesh", "adhoc" or "ap". If blank,
218 /// infrastructure is assumed.
219 ///
220 /// Readable | Writeable
221 ///
222 ///
223 /// #### `mtu`
224 /// If non-zero, only transmit packets of the specified size or smaller,
225 /// breaking larger packets up into multiple Ethernet frames.
226 ///
227 /// Readable | Writeable
228 ///
229 ///
230 /// #### `powersave`
231 /// One of [`SettingWirelessPowersave::Disable`][crate::SettingWirelessPowersave::Disable] (disable Wi-Fi power
232 /// saving), [`SettingWirelessPowersave::Enable`][crate::SettingWirelessPowersave::Enable] (enable Wi-Fi power
233 /// saving), [`SettingWirelessPowersave::Ignore`][crate::SettingWirelessPowersave::Ignore] (don't touch currently
234 /// configure setting) or [`SettingWirelessPowersave::Default`][crate::SettingWirelessPowersave::Default] (use the
235 /// globally configured value). All other values are reserved.
236 ///
237 /// Readable | Writeable
238 ///
239 ///
240 /// #### `rate`
241 /// This property is not implemented and has no effect.
242 ///
243 /// Readable | Writeable
244 ///
245 ///
246 /// #### `seen-bssids`
247 /// A list of BSSIDs (each BSSID formatted as a MAC address like
248 /// "00:11:22:33:44:55") that have been detected as part of the Wi-Fi
249 /// network. NetworkManager internally tracks previously seen BSSIDs. The
250 /// property is only meant for reading and reflects the BSSID list of
251 /// NetworkManager. The changes you make to this property will not be
252 /// preserved.
253 ///
254 /// This is not a regular property that the user would configure. Instead,
255 /// NetworkManager automatically sets the seen BSSIDs and tracks them internally
256 /// in "/var/lib/NetworkManager/seen-bssids" file.
257 ///
258 /// Readable | Writeable
259 ///
260 ///
261 /// #### `ssid`
262 /// SSID of the Wi-Fi network. Must be specified.
263 ///
264 /// Readable | Writeable
265 ///
266 ///
267 /// #### `tx-power`
268 /// This property is not implemented and has no effect.
269 ///
270 /// Readable | Writeable
271 ///
272 ///
273 /// #### `wake-on-wlan`
274 /// The #NMSettingWirelessWakeOnWLan options to enable. Not all devices support all options.
275 /// May be any combination of [`SettingWirelessWakeOnWLan::ANY`][crate::SettingWirelessWakeOnWLan::ANY],
276 /// [`SettingWirelessWakeOnWLan::DISCONNECT`][crate::SettingWirelessWakeOnWLan::DISCONNECT],
277 /// [`SettingWirelessWakeOnWLan::MAGIC`][crate::SettingWirelessWakeOnWLan::MAGIC],
278 /// [`SettingWirelessWakeOnWLan::GTK_REKEY_FAILURE`][crate::SettingWirelessWakeOnWLan::GTK_REKEY_FAILURE],
279 /// [`SettingWirelessWakeOnWLan::EAP_IDENTITY_REQUEST`][crate::SettingWirelessWakeOnWLan::EAP_IDENTITY_REQUEST],
280 /// [`SettingWirelessWakeOnWLan::_4WAY_HANDSHAKE`][crate::SettingWirelessWakeOnWLan::_4WAY_HANDSHAKE],
281 /// [`SettingWirelessWakeOnWLan::RFKILL_RELEASE`][crate::SettingWirelessWakeOnWLan::RFKILL_RELEASE],
282 /// [`SettingWirelessWakeOnWLan::TCP`][crate::SettingWirelessWakeOnWLan::TCP] or the special values
283 /// [`SettingWirelessWakeOnWLan::DEFAULT`][crate::SettingWirelessWakeOnWLan::DEFAULT] (to use global settings) and
284 /// [`SettingWirelessWakeOnWLan::IGNORE`][crate::SettingWirelessWakeOnWLan::IGNORE] (to disable management of Wake-on-LAN in
285 /// NetworkManager).
286 ///
287 /// Readable | Writeable
288 /// <details><summary><h4>Setting</h4></summary>
289 ///
290 ///
291 /// #### `name`
292 /// The setting's name, which uniquely identifies the setting within the
293 /// connection. Each setting type has a name unique to that type, for
294 /// example "ppp" or "802-11-wireless" or "802-3-ethernet".
295 ///
296 /// Readable
297 /// </details>
298 ///
299 /// # Implements
300 ///
301 /// [`SettingExt`][trait@crate::prelude::SettingExt]
302 #[doc(alias = "NMSettingWireless")]
303 pub struct SettingWireless(Object<ffi::NMSettingWireless, ffi::NMSettingWirelessClass>) @extends Setting;
304
305 match fn {
306 type_ => || ffi::nm_setting_wireless_get_type(),
307 }
308}
309
310impl SettingWireless {
311 /// Creates a new #NMSettingWireless object with default values.
312 ///
313 /// # Returns
314 ///
315 /// the new empty #NMSettingWireless object
316 #[doc(alias = "nm_setting_wireless_new")]
317 pub fn new() -> SettingWireless {
318 assert_initialized_main_thread!();
319 unsafe { Setting::from_glib_full(ffi::nm_setting_wireless_new()).unsafe_cast() }
320 }
321
322 // rustdoc-stripper-ignore-next
323 /// Creates a new builder-pattern struct instance to construct [`SettingWireless`] objects.
324 ///
325 /// This method returns an instance of [`SettingWirelessBuilder`](crate::builders::SettingWirelessBuilder) which can be used to create [`SettingWireless`] objects.
326 pub fn builder() -> SettingWirelessBuilder {
327 SettingWirelessBuilder::new()
328 }
329
330 /// Adds a new MAC address to the #NMSettingWireless:mac-address-denylist property.
331 ///
332 /// # Deprecated since 1.48
333 ///
334 /// Use nm_setting_wireless_add_mac_denylist_item() instead.
335 /// ## `mac`
336 /// the MAC address string (hex-digits-and-colons notation) to denylist
337 ///
338 /// # Returns
339 ///
340 /// [`true`] if the MAC address was added; [`false`] if the MAC address
341 /// is invalid or was already present
342 #[cfg_attr(feature = "v1_48", deprecated = "Since 1.48")]
343 #[allow(deprecated)]
344 #[doc(alias = "nm_setting_wireless_add_mac_blacklist_item")]
345 pub fn add_mac_blacklist_item(&self, mac: &str) -> bool {
346 unsafe {
347 from_glib(ffi::nm_setting_wireless_add_mac_blacklist_item(
348 self.to_glib_none().0,
349 mac.to_glib_none().0,
350 ))
351 }
352 }
353
354 /// Adds a new MAC address to the #NMSettingWireless:mac-address-denylist property.
355 /// ## `mac`
356 /// the MAC address string (hex-digits-and-colons notation) to denylist
357 ///
358 /// # Returns
359 ///
360 /// [`true`] if the MAC address was added; [`false`] if the MAC address
361 /// is invalid or was already present
362 #[cfg(feature = "v1_48")]
363 #[cfg_attr(docsrs, doc(cfg(feature = "v1_48")))]
364 #[doc(alias = "nm_setting_wireless_add_mac_denylist_item")]
365 pub fn add_mac_denylist_item(&self, mac: &str) -> bool {
366 unsafe {
367 from_glib(ffi::nm_setting_wireless_add_mac_denylist_item(
368 self.to_glib_none().0,
369 mac.to_glib_none().0,
370 ))
371 }
372 }
373
374 /// Adds a new Wi-Fi AP's BSSID to the previously seen BSSID list of the setting.
375 /// NetworkManager now tracks previously seen BSSIDs internally so this function
376 /// no longer has much use. Actually, changes you make using this function will
377 /// not be preserved.
378 /// ## `bssid`
379 /// the new BSSID to add to the list
380 ///
381 /// # Returns
382 ///
383 /// [`true`] if @bssid was already known, [`false`] if not
384 #[doc(alias = "nm_setting_wireless_add_seen_bssid")]
385 pub fn add_seen_bssid(&self, bssid: &str) -> bool {
386 unsafe {
387 from_glib(ffi::nm_setting_wireless_add_seen_bssid(
388 self.to_glib_none().0,
389 bssid.to_glib_none().0,
390 ))
391 }
392 }
393
394 /// Given a #NMSettingWireless and an optional #NMSettingWirelessSecurity,
395 /// determine if the configuration given by the settings is compatible with
396 /// the security of an access point using that access point's capability flags
397 /// and mode. Useful for clients that wish to filter a set of connections
398 /// against a set of access points and determine which connections are
399 /// compatible with which access points.
400 /// ## `s_wireless_sec`
401 /// a #NMSettingWirelessSecurity or [`None`]
402 /// ## `ap_flags`
403 /// the `NM80211ApFlags` of the given access point
404 /// ## `ap_wpa`
405 /// the `NM80211ApSecurityFlags` of the given access point's WPA
406 /// capabilities
407 /// ## `ap_rsn`
408 /// the `NM80211ApSecurityFlags` of the given access point's WPA2/RSN
409 /// capabilities
410 /// ## `ap_mode`
411 /// the 802.11 mode of the AP, either Ad-Hoc or Infrastructure
412 ///
413 /// # Returns
414 ///
415 /// [`true`] if the given settings are compatible with the access point's
416 /// security flags and mode, [`false`] if they are not.
417 #[doc(alias = "nm_setting_wireless_ap_security_compatible")]
418 pub fn ap_security_compatible(
419 &self,
420 s_wireless_sec: &SettingWirelessSecurity,
421 ap_flags: NM80211ApFlags,
422 ap_wpa: NM80211ApSecurityFlags,
423 ap_rsn: NM80211ApSecurityFlags,
424 ap_mode: NM80211Mode,
425 ) -> bool {
426 unsafe {
427 from_glib(ffi::nm_setting_wireless_ap_security_compatible(
428 self.to_glib_none().0,
429 s_wireless_sec.to_glib_none().0,
430 ap_flags.into_glib(),
431 ap_wpa.into_glib(),
432 ap_rsn.into_glib(),
433 ap_mode.into_glib(),
434 ))
435 }
436 }
437
438 /// Removes all denylisted MAC addresses.
439 ///
440 /// # Deprecated since 1.48
441 ///
442 /// Use nm_setting_wireless_clear_mac_denylist_items() instead.
443 #[cfg_attr(feature = "v1_48", deprecated = "Since 1.48")]
444 #[allow(deprecated)]
445 #[doc(alias = "nm_setting_wireless_clear_mac_blacklist_items")]
446 pub fn clear_mac_blacklist_items(&self) {
447 unsafe {
448 ffi::nm_setting_wireless_clear_mac_blacklist_items(self.to_glib_none().0);
449 }
450 }
451
452 /// Removes all denylisted MAC addresses.
453 #[cfg(feature = "v1_48")]
454 #[cfg_attr(docsrs, doc(cfg(feature = "v1_48")))]
455 #[doc(alias = "nm_setting_wireless_clear_mac_denylist_items")]
456 pub fn clear_mac_denylist_items(&self) {
457 unsafe {
458 ffi::nm_setting_wireless_clear_mac_denylist_items(self.to_glib_none().0);
459 }
460 }
461
462 ///
463 /// # Returns
464 ///
465 /// the #NMSettingWireless:ap-isolation property of the setting
466 #[cfg(feature = "v1_28")]
467 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
468 #[doc(alias = "nm_setting_wireless_get_ap_isolation")]
469 #[doc(alias = "get_ap_isolation")]
470 #[doc(alias = "ap-isolation")]
471 pub fn ap_isolation(&self) -> Ternary {
472 unsafe {
473 from_glib(ffi::nm_setting_wireless_get_ap_isolation(
474 self.to_glib_none().0,
475 ))
476 }
477 }
478
479 ///
480 /// # Returns
481 ///
482 /// the #NMSettingWireless:band property of the setting
483 #[doc(alias = "nm_setting_wireless_get_band")]
484 #[doc(alias = "get_band")]
485 pub fn band(&self) -> glib::GString {
486 unsafe { from_glib_none(ffi::nm_setting_wireless_get_band(self.to_glib_none().0)) }
487 }
488
489 ///
490 /// # Returns
491 ///
492 /// the #NMSettingWireless:bssid property of the setting
493 #[doc(alias = "nm_setting_wireless_get_bssid")]
494 #[doc(alias = "get_bssid")]
495 pub fn bssid(&self) -> glib::GString {
496 unsafe { from_glib_none(ffi::nm_setting_wireless_get_bssid(self.to_glib_none().0)) }
497 }
498
499 ///
500 /// # Returns
501 ///
502 /// the #NMSettingWireless:channel property of the setting
503 #[doc(alias = "nm_setting_wireless_get_channel")]
504 #[doc(alias = "get_channel")]
505 pub fn channel(&self) -> u32 {
506 unsafe { ffi::nm_setting_wireless_get_channel(self.to_glib_none().0) }
507 }
508
509 /// Returns the #NMSettingWireless:channel-width property.
510 ///
511 /// # Returns
512 ///
513 /// the channel width
514 #[cfg(feature = "v1_50")]
515 #[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
516 #[doc(alias = "nm_setting_wireless_get_channel_width")]
517 #[doc(alias = "get_channel_width")]
518 #[doc(alias = "channel-width")]
519 pub fn channel_width(&self) -> SettingWirelessChannelWidth {
520 unsafe {
521 from_glib(ffi::nm_setting_wireless_get_channel_width(
522 self.to_glib_none().0,
523 ))
524 }
525 }
526
527 ///
528 /// # Returns
529 ///
530 /// the #NMSettingWireless:cloned-mac-address property of the setting
531 #[doc(alias = "nm_setting_wireless_get_cloned_mac_address")]
532 #[doc(alias = "get_cloned_mac_address")]
533 #[doc(alias = "cloned-mac-address")]
534 pub fn cloned_mac_address(&self) -> glib::GString {
535 unsafe {
536 from_glib_none(ffi::nm_setting_wireless_get_cloned_mac_address(
537 self.to_glib_none().0,
538 ))
539 }
540 }
541
542 ///
543 /// # Returns
544 ///
545 /// the #NMSettingWireless:generate-mac-address-mask property of the setting
546 #[cfg(feature = "v1_4")]
547 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
548 #[doc(alias = "nm_setting_wireless_get_generate_mac_address_mask")]
549 #[doc(alias = "get_generate_mac_address_mask")]
550 #[doc(alias = "generate-mac-address-mask")]
551 pub fn generate_mac_address_mask(&self) -> glib::GString {
552 unsafe {
553 from_glib_none(ffi::nm_setting_wireless_get_generate_mac_address_mask(
554 self.to_glib_none().0,
555 ))
556 }
557 }
558
559 ///
560 /// # Returns
561 ///
562 /// the #NMSettingWireless:hidden property of the setting
563 #[doc(alias = "nm_setting_wireless_get_hidden")]
564 #[doc(alias = "get_hidden")]
565 #[doc(alias = "hidden")]
566 pub fn is_hidden(&self) -> bool {
567 unsafe { from_glib(ffi::nm_setting_wireless_get_hidden(self.to_glib_none().0)) }
568 }
569
570 ///
571 /// # Returns
572 ///
573 /// the #NMSettingWireless:mac-address property of the setting
574 #[doc(alias = "nm_setting_wireless_get_mac_address")]
575 #[doc(alias = "get_mac_address")]
576 #[doc(alias = "mac-address")]
577 pub fn mac_address(&self) -> glib::GString {
578 unsafe {
579 from_glib_none(ffi::nm_setting_wireless_get_mac_address(
580 self.to_glib_none().0,
581 ))
582 }
583 }
584
585 ///
586 /// # Deprecated since 1.48
587 ///
588 /// Use nm_setting_wireless_get_mac_address_denylist() instead.
589 ///
590 /// # Returns
591 ///
592 /// the #NMSettingWireless:mac-address-blacklist property of the setting
593 #[cfg_attr(feature = "v1_48", deprecated = "Since 1.48")]
594 #[allow(deprecated)]
595 #[doc(alias = "nm_setting_wireless_get_mac_address_blacklist")]
596 #[doc(alias = "get_mac_address_blacklist")]
597 #[doc(alias = "mac-address-blacklist")]
598 pub fn mac_address_blacklist(&self) -> Vec<glib::GString> {
599 unsafe {
600 FromGlibPtrContainer::from_glib_none(
601 ffi::nm_setting_wireless_get_mac_address_blacklist(self.to_glib_none().0),
602 )
603 }
604 }
605
606 ///
607 /// # Returns
608 ///
609 /// the #NMSettingWireless:mac-address-denylist property of the setting
610 #[cfg(feature = "v1_48")]
611 #[cfg_attr(docsrs, doc(cfg(feature = "v1_48")))]
612 #[doc(alias = "nm_setting_wireless_get_mac_address_denylist")]
613 #[doc(alias = "get_mac_address_denylist")]
614 #[doc(alias = "mac-address-denylist")]
615 pub fn mac_address_denylist(&self) -> Vec<glib::GString> {
616 unsafe {
617 FromGlibPtrContainer::from_glib_none(ffi::nm_setting_wireless_get_mac_address_denylist(
618 self.to_glib_none().0,
619 ))
620 }
621 }
622
623 ///
624 /// # Returns
625 ///
626 /// the #NMSettingWireless:mac-address-randomization property of the
627 /// setting
628 #[cfg(feature = "v1_2")]
629 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
630 #[doc(alias = "nm_setting_wireless_get_mac_address_randomization")]
631 #[doc(alias = "get_mac_address_randomization")]
632 #[doc(alias = "mac-address-randomization")]
633 pub fn mac_address_randomization(&self) -> SettingMacRandomization {
634 unsafe {
635 from_glib(ffi::nm_setting_wireless_get_mac_address_randomization(
636 self.to_glib_none().0,
637 ))
638 }
639 }
640
641 /// Since 1.46, access at index "len" is allowed and returns NULL.
642 ///
643 /// # Deprecated since 1.48
644 ///
645 /// Use nm_setting_wireless_get_mac_denylist_item() instead.
646 /// ## `idx`
647 /// the zero-based index of the MAC address entry
648 ///
649 /// # Returns
650 ///
651 /// the denylisted MAC address string (hex-digits-and-colons notation)
652 /// at index @idx
653 #[cfg_attr(feature = "v1_48", deprecated = "Since 1.48")]
654 #[allow(deprecated)]
655 #[doc(alias = "nm_setting_wireless_get_mac_blacklist_item")]
656 #[doc(alias = "get_mac_blacklist_item")]
657 pub fn mac_blacklist_item(&self, idx: u32) -> glib::GString {
658 unsafe {
659 from_glib_none(ffi::nm_setting_wireless_get_mac_blacklist_item(
660 self.to_glib_none().0,
661 idx,
662 ))
663 }
664 }
665
666 /// ## `idx`
667 /// the zero-based index of the MAC address entry
668 ///
669 /// # Returns
670 ///
671 /// the denylisted MAC address string (hex-digits-and-colons notation)
672 /// at index @idx
673 #[cfg(feature = "v1_48")]
674 #[cfg_attr(docsrs, doc(cfg(feature = "v1_48")))]
675 #[doc(alias = "nm_setting_wireless_get_mac_denylist_item")]
676 #[doc(alias = "get_mac_denylist_item")]
677 pub fn mac_denylist_item(&self, idx: u32) -> glib::GString {
678 unsafe {
679 from_glib_none(ffi::nm_setting_wireless_get_mac_denylist_item(
680 self.to_glib_none().0,
681 idx,
682 ))
683 }
684 }
685
686 ///
687 /// # Returns
688 ///
689 /// the #NMSettingWireless:mode property of the setting
690 #[doc(alias = "nm_setting_wireless_get_mode")]
691 #[doc(alias = "get_mode")]
692 pub fn mode(&self) -> glib::GString {
693 unsafe { from_glib_none(ffi::nm_setting_wireless_get_mode(self.to_glib_none().0)) }
694 }
695
696 ///
697 /// # Returns
698 ///
699 /// the #NMSettingWireless:mtu property of the setting
700 #[doc(alias = "nm_setting_wireless_get_mtu")]
701 #[doc(alias = "get_mtu")]
702 pub fn mtu(&self) -> u32 {
703 unsafe { ffi::nm_setting_wireless_get_mtu(self.to_glib_none().0) }
704 }
705
706 ///
707 /// # Deprecated since 1.48
708 ///
709 /// Use nm_setting_wireless_get_num_mac_denylist_items() instead.
710 ///
711 /// # Returns
712 ///
713 /// the number of blacklist MAC addresses
714 #[cfg_attr(feature = "v1_48", deprecated = "Since 1.48")]
715 #[allow(deprecated)]
716 #[doc(alias = "nm_setting_wireless_get_num_mac_blacklist_items")]
717 #[doc(alias = "get_num_mac_blacklist_items")]
718 pub fn num_mac_blacklist_items(&self) -> u32 {
719 unsafe { ffi::nm_setting_wireless_get_num_mac_blacklist_items(self.to_glib_none().0) }
720 }
721
722 ///
723 /// # Returns
724 ///
725 /// the number of denylisted MAC addresses
726 #[cfg(feature = "v1_48")]
727 #[cfg_attr(docsrs, doc(cfg(feature = "v1_48")))]
728 #[doc(alias = "nm_setting_wireless_get_num_mac_denylist_items")]
729 #[doc(alias = "get_num_mac_denylist_items")]
730 pub fn num_mac_denylist_items(&self) -> u32 {
731 unsafe { ffi::nm_setting_wireless_get_num_mac_denylist_items(self.to_glib_none().0) }
732 }
733
734 ///
735 /// # Returns
736 ///
737 /// the number of BSSIDs in the previously seen BSSID list
738 #[doc(alias = "nm_setting_wireless_get_num_seen_bssids")]
739 #[doc(alias = "get_num_seen_bssids")]
740 pub fn num_seen_bssids(&self) -> u32 {
741 unsafe { ffi::nm_setting_wireless_get_num_seen_bssids(self.to_glib_none().0) }
742 }
743
744 ///
745 /// # Returns
746 ///
747 /// the #NMSettingWireless:powersave property of the setting
748 #[cfg(feature = "v1_2")]
749 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
750 #[doc(alias = "nm_setting_wireless_get_powersave")]
751 #[doc(alias = "get_powersave")]
752 pub fn powersave(&self) -> u32 {
753 unsafe { ffi::nm_setting_wireless_get_powersave(self.to_glib_none().0) }
754 }
755
756 ///
757 /// # Deprecated since 1.44
758 ///
759 /// This setting is not implemented and has no effect.
760 ///
761 /// # Returns
762 ///
763 /// the #NMSettingWireless:rate property of the setting
764 #[cfg_attr(feature = "v1_44", deprecated = "Since 1.44")]
765 #[allow(deprecated)]
766 #[doc(alias = "nm_setting_wireless_get_rate")]
767 #[doc(alias = "get_rate")]
768 pub fn rate(&self) -> u32 {
769 unsafe { ffi::nm_setting_wireless_get_rate(self.to_glib_none().0) }
770 }
771
772 /// ## `i`
773 /// index of a BSSID in the previously seen BSSID list
774 ///
775 /// # Returns
776 ///
777 /// the BSSID at index @i
778 #[doc(alias = "nm_setting_wireless_get_seen_bssid")]
779 #[doc(alias = "get_seen_bssid")]
780 pub fn seen_bssid(&self, i: u32) -> glib::GString {
781 unsafe {
782 from_glib_none(ffi::nm_setting_wireless_get_seen_bssid(
783 self.to_glib_none().0,
784 i,
785 ))
786 }
787 }
788
789 ///
790 /// # Deprecated since 1.44
791 ///
792 /// This setting is not implemented and has no effect.
793 ///
794 /// # Returns
795 ///
796 /// the #NMSettingWireless:tx-power property of the setting
797 #[cfg_attr(feature = "v1_44", deprecated = "Since 1.44")]
798 #[allow(deprecated)]
799 #[doc(alias = "nm_setting_wireless_get_tx_power")]
800 #[doc(alias = "get_tx_power")]
801 #[doc(alias = "tx-power")]
802 pub fn tx_power(&self) -> u32 {
803 unsafe { ffi::nm_setting_wireless_get_tx_power(self.to_glib_none().0) }
804 }
805
806 /// Returns the Wake-on-WLAN options enabled for the connection
807 ///
808 /// # Returns
809 ///
810 /// the Wake-on-WLAN options
811 #[cfg(feature = "v1_12")]
812 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
813 #[doc(alias = "nm_setting_wireless_get_wake_on_wlan")]
814 #[doc(alias = "get_wake_on_wlan")]
815 #[doc(alias = "wake-on-wlan")]
816 pub fn wake_on_wlan(&self) -> SettingWirelessWakeOnWLan {
817 unsafe {
818 from_glib(ffi::nm_setting_wireless_get_wake_on_wlan(
819 self.to_glib_none().0,
820 ))
821 }
822 }
823
824 /// Removes the MAC address at index @idx from the denylist.
825 ///
826 /// # Deprecated since 1.48
827 ///
828 /// Use nm_setting_wireless_remove_mac_denylist_item() instead.
829 /// ## `idx`
830 /// index number of the MAC address
831 #[cfg_attr(feature = "v1_48", deprecated = "Since 1.48")]
832 #[allow(deprecated)]
833 #[doc(alias = "nm_setting_wireless_remove_mac_blacklist_item")]
834 pub fn remove_mac_blacklist_item(&self, idx: u32) {
835 unsafe {
836 ffi::nm_setting_wireless_remove_mac_blacklist_item(self.to_glib_none().0, idx);
837 }
838 }
839
840 /// Removes the MAC address @mac from the denylist.
841 ///
842 /// # Deprecated since 1.48
843 ///
844 /// Use nm_setting_wireless_remove_mac_denylist_item_by_value() instead.
845 /// ## `mac`
846 /// the MAC address string (hex-digits-and-colons notation) to remove from
847 /// the denylist
848 ///
849 /// # Returns
850 ///
851 /// [`true`] if the MAC address was found and removed; [`false`] if it was not.
852 #[cfg_attr(feature = "v1_48", deprecated = "Since 1.48")]
853 #[allow(deprecated)]
854 #[doc(alias = "nm_setting_wireless_remove_mac_blacklist_item_by_value")]
855 pub fn remove_mac_blacklist_item_by_value(&self, mac: &str) -> bool {
856 unsafe {
857 from_glib(ffi::nm_setting_wireless_remove_mac_blacklist_item_by_value(
858 self.to_glib_none().0,
859 mac.to_glib_none().0,
860 ))
861 }
862 }
863
864 /// Removes the MAC address at index @idx from the denylist.
865 /// ## `idx`
866 /// index number of the MAC address
867 #[cfg(feature = "v1_48")]
868 #[cfg_attr(docsrs, doc(cfg(feature = "v1_48")))]
869 #[doc(alias = "nm_setting_wireless_remove_mac_denylist_item")]
870 pub fn remove_mac_denylist_item(&self, idx: u32) {
871 unsafe {
872 ffi::nm_setting_wireless_remove_mac_denylist_item(self.to_glib_none().0, idx);
873 }
874 }
875
876 /// Removes the MAC address @mac from the denylist.
877 /// ## `mac`
878 /// the MAC address string (hex-digits-and-colons notation) to remove from
879 /// the denylist
880 ///
881 /// # Returns
882 ///
883 /// [`true`] if the MAC address was found and removed; [`false`] if it was not.
884 #[cfg(feature = "v1_48")]
885 #[cfg_attr(docsrs, doc(cfg(feature = "v1_48")))]
886 #[doc(alias = "nm_setting_wireless_remove_mac_denylist_item_by_value")]
887 pub fn remove_mac_denylist_item_by_value(&self, mac: &str) -> bool {
888 unsafe {
889 from_glib(ffi::nm_setting_wireless_remove_mac_denylist_item_by_value(
890 self.to_glib_none().0,
891 mac.to_glib_none().0,
892 ))
893 }
894 }
895
896 /// Configures AP isolation, which prevents communication between
897 /// wireless devices connected to this AP. This property can be set
898 /// to a value different from [`Ternary::Default`][crate::Ternary::Default] only when the
899 /// interface is configured in AP mode.
900 ///
901 /// If set to [`Ternary::True`][crate::Ternary::True], devices are not able to communicate
902 /// with each other. This increases security because it protects
903 /// devices against attacks from other clients in the network. At
904 /// the same time, it prevents devices to access resources on the
905 /// same wireless networks as file shares, printers, etc.
906 ///
907 /// If set to [`Ternary::False`][crate::Ternary::False], devices can talk to each other.
908 ///
909 /// When set to [`Ternary::Default`][crate::Ternary::Default], the global default is used; in
910 /// case the global default is unspecified it is assumed to be
911 /// [`Ternary::False`][crate::Ternary::False].
912 #[cfg(feature = "v1_28")]
913 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
914 #[doc(alias = "ap-isolation")]
915 pub fn set_ap_isolation(&self, ap_isolation: Ternary) {
916 ObjectExt::set_property(self, "ap-isolation", ap_isolation)
917 }
918
919 /// 802.11 frequency band of the network. One of "a" for 5GHz 802.11a or
920 /// "bg" for 2.4GHz 802.11. This will lock associations to the Wi-Fi network
921 /// to the specific band, i.e. if "a" is specified, the device will not
922 /// associate with the same network in the 2.4GHz band even if the network's
923 /// settings are compatible. This setting depends on specific driver
924 /// capability and may not work with all drivers.
925 pub fn set_band(&self, band: Option<&str>) {
926 ObjectExt::set_property(self, "band", band)
927 }
928
929 /// If specified, directs the device to only associate with the given access
930 /// point. This capability is highly driver dependent and not supported by
931 /// all devices. Note: this property does not control the BSSID used when
932 /// creating an Ad-Hoc network and is unlikely to in the future.
933 ///
934 /// Locking a client profile to a certain BSSID will prevent roaming and also
935 /// disable background scanning. That can be useful, if there is only one access
936 /// point for the SSID.
937 pub fn set_bssid(&self, bssid: Option<&str>) {
938 ObjectExt::set_property(self, "bssid", bssid)
939 }
940
941 /// Wireless channel to use for the Wi-Fi connection. The device will only
942 /// join (or create for Ad-Hoc networks) a Wi-Fi network on the specified
943 /// channel. Because channel numbers overlap between bands, this property
944 /// also requires the "band" property to be set.
945 pub fn set_channel(&self, channel: u32) {
946 ObjectExt::set_property(self, "channel", channel)
947 }
948
949 /// Specifies width of the wireless channel in Access Point (AP) mode.
950 ///
951 /// When set to [`SettingWirelessChannelWidth::Auto`][crate::SettingWirelessChannelWidth::Auto] (the default), the
952 /// channel width is automatically determined. At the moment, this means that
953 /// the safest (smallest) width is chosen.
954 ///
955 /// If the value is not [`SettingWirelessChannelWidth::Auto`][crate::SettingWirelessChannelWidth::Auto], then the
956 /// 'channel' property must also be set. When using the 2.4GHz band, the width
957 /// can be at most 40MHz.
958 ///
959 /// This property can be set to a value different from
960 /// [`SettingWirelessChannelWidth::Auto`][crate::SettingWirelessChannelWidth::Auto] only when the interface is configured
961 /// in AP mode.
962 #[cfg(feature = "v1_50")]
963 #[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
964 #[doc(alias = "channel-width")]
965 pub fn set_channel_width(&self, channel_width: i32) {
966 ObjectExt::set_property(self, "channel-width", channel_width)
967 }
968
969 /// If specified, request that the device use this MAC address instead.
970 /// This is known as MAC cloning or spoofing.
971 ///
972 /// Beside explicitly specifying a MAC address, the special values "preserve", "permanent",
973 /// "random", "stable" and "stable-ssid" are supported.
974 /// "preserve" means not to touch the MAC address on activation.
975 /// "permanent" means to use the permanent hardware address of the device.
976 /// "random" creates a random MAC address on each connect.
977 /// "stable" creates a hashed MAC address based on connection.stable-id and a
978 /// machine dependent key.
979 /// "stable-ssid" creates a hashed MAC address based on the SSID, the same as setting the
980 /// stable-id to "${NETWORK_SSID}".
981 ///
982 /// If unspecified, the value can be overwritten via global defaults, see manual
983 /// of NetworkManager.conf. If still unspecified, it defaults to "preserve"
984 /// (older versions of NetworkManager may use a different default value).
985 ///
986 /// On D-Bus, this field is expressed as "assigned-mac-address" or the deprecated
987 /// "cloned-mac-address".
988 #[doc(alias = "cloned-mac-address")]
989 pub fn set_cloned_mac_address(&self, cloned_mac_address: Option<&str>) {
990 ObjectExt::set_property(self, "cloned-mac-address", cloned_mac_address)
991 }
992
993 #[cfg(not(feature = "v1_4"))]
994 #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_4"))))]
995 #[doc(alias = "generate-mac-address-mask")]
996 pub fn generate_mac_address_mask(&self) -> Option<glib::GString> {
997 ObjectExt::property(self, "generate-mac-address-mask")
998 }
999
1000 /// With #NMSettingWireless:cloned-mac-address setting "random" or "stable",
1001 /// by default all bits of the MAC address are scrambled and a locally-administered,
1002 /// unicast MAC address is created. This property allows one to specify that certain bits
1003 /// are fixed. Note that the least significant bit of the first MAC address will
1004 /// always be unset to create a unicast MAC address.
1005 ///
1006 /// If the property is [`None`], it is eligible to be overwritten by a default
1007 /// connection setting. If the value is still [`None`] or an empty string, the
1008 /// default is to create a locally-administered, unicast MAC address.
1009 ///
1010 /// If the value contains one MAC address, this address is used as mask. The set
1011 /// bits of the mask are to be filled with the current MAC address of the device,
1012 /// while the unset bits are subject to randomization.
1013 /// Setting "FE:FF:FF:00:00:00" means to preserve the OUI of the current MAC address
1014 /// and only randomize the lower 3 bytes using the "random" or "stable" algorithm.
1015 ///
1016 /// If the value contains one additional MAC address after the mask,
1017 /// this address is used instead of the current MAC address to fill the bits
1018 /// that shall not be randomized. For example, a value of
1019 /// "FE:FF:FF:00:00:00 68:F7:28:00:00:00" will set the OUI of the MAC address
1020 /// to 68:F7:28, while the lower bits are randomized. A value of
1021 /// "02:00:00:00:00:00 00:00:00:00:00:00" will create a fully scrambled
1022 /// globally-administered, burned-in MAC address.
1023 ///
1024 /// If the value contains more than one additional MAC addresses, one of
1025 /// them is chosen randomly. For example, "02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00"
1026 /// will create a fully scrambled MAC address, randomly locally or globally
1027 /// administered.
1028 #[doc(alias = "generate-mac-address-mask")]
1029 pub fn set_generate_mac_address_mask(&self, generate_mac_address_mask: Option<&str>) {
1030 ObjectExt::set_property(self, "generate-mac-address-mask", generate_mac_address_mask)
1031 }
1032
1033 /// If [`true`], indicates that the network is a non-broadcasting network that
1034 /// hides its SSID. This works both in infrastructure and AP mode.
1035 ///
1036 /// In infrastructure mode, various workarounds are used for a more reliable
1037 /// discovery of hidden networks, such as probe-scanning the SSID. However,
1038 /// these workarounds expose inherent insecurities with hidden SSID networks,
1039 /// and thus hidden SSID networks should be used with caution.
1040 ///
1041 /// In AP mode, the created network does not broadcast its SSID.
1042 ///
1043 /// Note that marking the network as hidden may be a privacy issue for you
1044 /// (in infrastructure mode) or client stations (in AP mode), as the explicit
1045 /// probe-scans are distinctly recognizable on the air.
1046 pub fn set_hidden(&self, hidden: bool) {
1047 ObjectExt::set_property(self, "hidden", hidden)
1048 }
1049
1050 /// If specified, this connection will only apply to the Wi-Fi device whose
1051 /// permanent MAC address matches. This property does not change the MAC
1052 /// address of the device (i.e. MAC spoofing).
1053 #[doc(alias = "mac-address")]
1054 pub fn set_mac_address(&self, mac_address: Option<&str>) {
1055 ObjectExt::set_property(self, "mac-address", mac_address)
1056 }
1057
1058 /// A list of permanent MAC addresses of Wi-Fi devices to which this
1059 /// connection should never apply. Each MAC address should be given in the
1060 /// standard hex-digits-and-colons notation (eg "00:11:22:33:44:55").
1061 #[doc(alias = "mac-address-blacklist")]
1062 pub fn set_mac_address_blacklist(&self, mac_address_blacklist: &[&str]) {
1063 ObjectExt::set_property(self, "mac-address-blacklist", mac_address_blacklist)
1064 }
1065
1066 #[cfg(not(feature = "v1_48"))]
1067 #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_48"))))]
1068 #[doc(alias = "mac-address-denylist")]
1069 pub fn mac_address_denylist(&self) -> Vec<glib::GString> {
1070 ObjectExt::property(self, "mac-address-denylist")
1071 }
1072
1073 /// A list of permanent MAC addresses of Wi-Fi devices to which this
1074 /// connection should never apply. Each MAC address should be given in the
1075 /// standard hex-digits-and-colons notation (eg "00:11:22:33:44:55").
1076 #[doc(alias = "mac-address-denylist")]
1077 pub fn set_mac_address_denylist(&self, mac_address_denylist: &[&str]) {
1078 ObjectExt::set_property(self, "mac-address-denylist", mac_address_denylist)
1079 }
1080
1081 /// One of [`SettingMacRandomization::Default`][crate::SettingMacRandomization::Default] (never randomize unless
1082 /// the user has set a global default to randomize and the supplicant
1083 /// supports randomization), [`SettingMacRandomization::Never`][crate::SettingMacRandomization::Never] (never
1084 /// randomize the MAC address), or [`SettingMacRandomization::Always`][crate::SettingMacRandomization::Always]
1085 /// (always randomize the MAC address).
1086 ///
1087 /// # Deprecated since 1.4
1088 ///
1089 /// Use the #NMSettingWireless:cloned-mac-address property instead.
1090 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1091 #[cfg(feature = "v1_2")]
1092 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1093 #[doc(alias = "mac-address-randomization")]
1094 pub fn set_mac_address_randomization(&self, mac_address_randomization: u32) {
1095 ObjectExt::set_property(self, "mac-address-randomization", mac_address_randomization)
1096 }
1097
1098 /// Wi-Fi network mode; one of "infrastructure", "mesh", "adhoc" or "ap". If blank,
1099 /// infrastructure is assumed.
1100 pub fn set_mode(&self, mode: Option<&str>) {
1101 ObjectExt::set_property(self, "mode", mode)
1102 }
1103
1104 /// If non-zero, only transmit packets of the specified size or smaller,
1105 /// breaking larger packets up into multiple Ethernet frames.
1106 pub fn set_mtu(&self, mtu: u32) {
1107 ObjectExt::set_property(self, "mtu", mtu)
1108 }
1109
1110 /// One of [`SettingWirelessPowersave::Disable`][crate::SettingWirelessPowersave::Disable] (disable Wi-Fi power
1111 /// saving), [`SettingWirelessPowersave::Enable`][crate::SettingWirelessPowersave::Enable] (enable Wi-Fi power
1112 /// saving), [`SettingWirelessPowersave::Ignore`][crate::SettingWirelessPowersave::Ignore] (don't touch currently
1113 /// configure setting) or [`SettingWirelessPowersave::Default`][crate::SettingWirelessPowersave::Default] (use the
1114 /// globally configured value). All other values are reserved.
1115 #[cfg(feature = "v1_2")]
1116 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1117 pub fn set_powersave(&self, powersave: u32) {
1118 ObjectExt::set_property(self, "powersave", powersave)
1119 }
1120
1121 /// This property is not implemented and has no effect.
1122 ///
1123 /// # Deprecated since 1.44
1124 ///
1125 /// This property is not implemented and has no effect.
1126 #[cfg_attr(feature = "v1_44", deprecated = "Since 1.44")]
1127 pub fn set_rate(&self, rate: u32) {
1128 ObjectExt::set_property(self, "rate", rate)
1129 }
1130
1131 /// A list of BSSIDs (each BSSID formatted as a MAC address like
1132 /// "00:11:22:33:44:55") that have been detected as part of the Wi-Fi
1133 /// network. NetworkManager internally tracks previously seen BSSIDs. The
1134 /// property is only meant for reading and reflects the BSSID list of
1135 /// NetworkManager. The changes you make to this property will not be
1136 /// preserved.
1137 ///
1138 /// This is not a regular property that the user would configure. Instead,
1139 /// NetworkManager automatically sets the seen BSSIDs and tracks them internally
1140 /// in "/var/lib/NetworkManager/seen-bssids" file.
1141 #[doc(alias = "seen-bssids")]
1142 pub fn seen_bssids(&self) -> Vec<glib::GString> {
1143 ObjectExt::property(self, "seen-bssids")
1144 }
1145
1146 /// A list of BSSIDs (each BSSID formatted as a MAC address like
1147 /// "00:11:22:33:44:55") that have been detected as part of the Wi-Fi
1148 /// network. NetworkManager internally tracks previously seen BSSIDs. The
1149 /// property is only meant for reading and reflects the BSSID list of
1150 /// NetworkManager. The changes you make to this property will not be
1151 /// preserved.
1152 ///
1153 /// This is not a regular property that the user would configure. Instead,
1154 /// NetworkManager automatically sets the seen BSSIDs and tracks them internally
1155 /// in "/var/lib/NetworkManager/seen-bssids" file.
1156 #[doc(alias = "seen-bssids")]
1157 pub fn set_seen_bssids(&self, seen_bssids: &[&str]) {
1158 ObjectExt::set_property(self, "seen-bssids", seen_bssids)
1159 }
1160
1161 //pub fn set_ssid(&self, ssid: /*Ignored*/Option<&glib::Bytes>) {
1162 // ObjectExt::set_property(self,"ssid", ssid)
1163 //}
1164
1165 /// This property is not implemented and has no effect.
1166 ///
1167 /// # Deprecated since 1.44
1168 ///
1169 /// This property is not implemented and has no effect.
1170 #[cfg_attr(feature = "v1_44", deprecated = "Since 1.44")]
1171 #[doc(alias = "tx-power")]
1172 pub fn set_tx_power(&self, tx_power: u32) {
1173 ObjectExt::set_property(self, "tx-power", tx_power)
1174 }
1175
1176 /// The #NMSettingWirelessWakeOnWLan options to enable. Not all devices support all options.
1177 /// May be any combination of [`SettingWirelessWakeOnWLan::ANY`][crate::SettingWirelessWakeOnWLan::ANY],
1178 /// [`SettingWirelessWakeOnWLan::DISCONNECT`][crate::SettingWirelessWakeOnWLan::DISCONNECT],
1179 /// [`SettingWirelessWakeOnWLan::MAGIC`][crate::SettingWirelessWakeOnWLan::MAGIC],
1180 /// [`SettingWirelessWakeOnWLan::GTK_REKEY_FAILURE`][crate::SettingWirelessWakeOnWLan::GTK_REKEY_FAILURE],
1181 /// [`SettingWirelessWakeOnWLan::EAP_IDENTITY_REQUEST`][crate::SettingWirelessWakeOnWLan::EAP_IDENTITY_REQUEST],
1182 /// [`SettingWirelessWakeOnWLan::_4WAY_HANDSHAKE`][crate::SettingWirelessWakeOnWLan::_4WAY_HANDSHAKE],
1183 /// [`SettingWirelessWakeOnWLan::RFKILL_RELEASE`][crate::SettingWirelessWakeOnWLan::RFKILL_RELEASE],
1184 /// [`SettingWirelessWakeOnWLan::TCP`][crate::SettingWirelessWakeOnWLan::TCP] or the special values
1185 /// [`SettingWirelessWakeOnWLan::DEFAULT`][crate::SettingWirelessWakeOnWLan::DEFAULT] (to use global settings) and
1186 /// [`SettingWirelessWakeOnWLan::IGNORE`][crate::SettingWirelessWakeOnWLan::IGNORE] (to disable management of Wake-on-LAN in
1187 /// NetworkManager).
1188 #[cfg(feature = "v1_12")]
1189 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
1190 #[doc(alias = "wake-on-wlan")]
1191 pub fn set_wake_on_wlan(&self, wake_on_wlan: u32) {
1192 ObjectExt::set_property(self, "wake-on-wlan", wake_on_wlan)
1193 }
1194
1195 #[cfg(feature = "v1_28")]
1196 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1197 #[doc(alias = "ap-isolation")]
1198 pub fn connect_ap_isolation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1199 unsafe extern "C" fn notify_ap_isolation_trampoline<F: Fn(&SettingWireless) + 'static>(
1200 this: *mut ffi::NMSettingWireless,
1201 _param_spec: glib::ffi::gpointer,
1202 f: glib::ffi::gpointer,
1203 ) {
1204 let f: &F = &*(f as *const F);
1205 f(&from_glib_borrow(this))
1206 }
1207 unsafe {
1208 let f: Box_<F> = Box_::new(f);
1209 connect_raw(
1210 self.as_ptr() as *mut _,
1211 c"notify::ap-isolation".as_ptr() as *const _,
1212 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1213 notify_ap_isolation_trampoline::<F> as *const (),
1214 )),
1215 Box_::into_raw(f),
1216 )
1217 }
1218 }
1219
1220 #[doc(alias = "band")]
1221 pub fn connect_band_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1222 unsafe extern "C" fn notify_band_trampoline<F: Fn(&SettingWireless) + 'static>(
1223 this: *mut ffi::NMSettingWireless,
1224 _param_spec: glib::ffi::gpointer,
1225 f: glib::ffi::gpointer,
1226 ) {
1227 let f: &F = &*(f as *const F);
1228 f(&from_glib_borrow(this))
1229 }
1230 unsafe {
1231 let f: Box_<F> = Box_::new(f);
1232 connect_raw(
1233 self.as_ptr() as *mut _,
1234 c"notify::band".as_ptr() as *const _,
1235 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1236 notify_band_trampoline::<F> as *const (),
1237 )),
1238 Box_::into_raw(f),
1239 )
1240 }
1241 }
1242
1243 #[doc(alias = "bssid")]
1244 pub fn connect_bssid_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1245 unsafe extern "C" fn notify_bssid_trampoline<F: Fn(&SettingWireless) + 'static>(
1246 this: *mut ffi::NMSettingWireless,
1247 _param_spec: glib::ffi::gpointer,
1248 f: glib::ffi::gpointer,
1249 ) {
1250 let f: &F = &*(f as *const F);
1251 f(&from_glib_borrow(this))
1252 }
1253 unsafe {
1254 let f: Box_<F> = Box_::new(f);
1255 connect_raw(
1256 self.as_ptr() as *mut _,
1257 c"notify::bssid".as_ptr() as *const _,
1258 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1259 notify_bssid_trampoline::<F> as *const (),
1260 )),
1261 Box_::into_raw(f),
1262 )
1263 }
1264 }
1265
1266 #[doc(alias = "channel")]
1267 pub fn connect_channel_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1268 unsafe extern "C" fn notify_channel_trampoline<F: Fn(&SettingWireless) + 'static>(
1269 this: *mut ffi::NMSettingWireless,
1270 _param_spec: glib::ffi::gpointer,
1271 f: glib::ffi::gpointer,
1272 ) {
1273 let f: &F = &*(f as *const F);
1274 f(&from_glib_borrow(this))
1275 }
1276 unsafe {
1277 let f: Box_<F> = Box_::new(f);
1278 connect_raw(
1279 self.as_ptr() as *mut _,
1280 c"notify::channel".as_ptr() as *const _,
1281 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1282 notify_channel_trampoline::<F> as *const (),
1283 )),
1284 Box_::into_raw(f),
1285 )
1286 }
1287 }
1288
1289 #[cfg(feature = "v1_50")]
1290 #[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
1291 #[doc(alias = "channel-width")]
1292 pub fn connect_channel_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1293 unsafe extern "C" fn notify_channel_width_trampoline<F: Fn(&SettingWireless) + 'static>(
1294 this: *mut ffi::NMSettingWireless,
1295 _param_spec: glib::ffi::gpointer,
1296 f: glib::ffi::gpointer,
1297 ) {
1298 let f: &F = &*(f as *const F);
1299 f(&from_glib_borrow(this))
1300 }
1301 unsafe {
1302 let f: Box_<F> = Box_::new(f);
1303 connect_raw(
1304 self.as_ptr() as *mut _,
1305 c"notify::channel-width".as_ptr() as *const _,
1306 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1307 notify_channel_width_trampoline::<F> as *const (),
1308 )),
1309 Box_::into_raw(f),
1310 )
1311 }
1312 }
1313
1314 #[doc(alias = "cloned-mac-address")]
1315 pub fn connect_cloned_mac_address_notify<F: Fn(&Self) + 'static>(
1316 &self,
1317 f: F,
1318 ) -> SignalHandlerId {
1319 unsafe extern "C" fn notify_cloned_mac_address_trampoline<
1320 F: Fn(&SettingWireless) + 'static,
1321 >(
1322 this: *mut ffi::NMSettingWireless,
1323 _param_spec: glib::ffi::gpointer,
1324 f: glib::ffi::gpointer,
1325 ) {
1326 let f: &F = &*(f as *const F);
1327 f(&from_glib_borrow(this))
1328 }
1329 unsafe {
1330 let f: Box_<F> = Box_::new(f);
1331 connect_raw(
1332 self.as_ptr() as *mut _,
1333 c"notify::cloned-mac-address".as_ptr() as *const _,
1334 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1335 notify_cloned_mac_address_trampoline::<F> as *const (),
1336 )),
1337 Box_::into_raw(f),
1338 )
1339 }
1340 }
1341
1342 #[doc(alias = "generate-mac-address-mask")]
1343 pub fn connect_generate_mac_address_mask_notify<F: Fn(&Self) + 'static>(
1344 &self,
1345 f: F,
1346 ) -> SignalHandlerId {
1347 unsafe extern "C" fn notify_generate_mac_address_mask_trampoline<
1348 F: Fn(&SettingWireless) + 'static,
1349 >(
1350 this: *mut ffi::NMSettingWireless,
1351 _param_spec: glib::ffi::gpointer,
1352 f: glib::ffi::gpointer,
1353 ) {
1354 let f: &F = &*(f as *const F);
1355 f(&from_glib_borrow(this))
1356 }
1357 unsafe {
1358 let f: Box_<F> = Box_::new(f);
1359 connect_raw(
1360 self.as_ptr() as *mut _,
1361 c"notify::generate-mac-address-mask".as_ptr() as *const _,
1362 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1363 notify_generate_mac_address_mask_trampoline::<F> as *const (),
1364 )),
1365 Box_::into_raw(f),
1366 )
1367 }
1368 }
1369
1370 #[doc(alias = "hidden")]
1371 pub fn connect_hidden_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1372 unsafe extern "C" fn notify_hidden_trampoline<F: Fn(&SettingWireless) + 'static>(
1373 this: *mut ffi::NMSettingWireless,
1374 _param_spec: glib::ffi::gpointer,
1375 f: glib::ffi::gpointer,
1376 ) {
1377 let f: &F = &*(f as *const F);
1378 f(&from_glib_borrow(this))
1379 }
1380 unsafe {
1381 let f: Box_<F> = Box_::new(f);
1382 connect_raw(
1383 self.as_ptr() as *mut _,
1384 c"notify::hidden".as_ptr() as *const _,
1385 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1386 notify_hidden_trampoline::<F> as *const (),
1387 )),
1388 Box_::into_raw(f),
1389 )
1390 }
1391 }
1392
1393 #[doc(alias = "mac-address")]
1394 pub fn connect_mac_address_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1395 unsafe extern "C" fn notify_mac_address_trampoline<F: Fn(&SettingWireless) + 'static>(
1396 this: *mut ffi::NMSettingWireless,
1397 _param_spec: glib::ffi::gpointer,
1398 f: glib::ffi::gpointer,
1399 ) {
1400 let f: &F = &*(f as *const F);
1401 f(&from_glib_borrow(this))
1402 }
1403 unsafe {
1404 let f: Box_<F> = Box_::new(f);
1405 connect_raw(
1406 self.as_ptr() as *mut _,
1407 c"notify::mac-address".as_ptr() as *const _,
1408 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1409 notify_mac_address_trampoline::<F> as *const (),
1410 )),
1411 Box_::into_raw(f),
1412 )
1413 }
1414 }
1415
1416 #[doc(alias = "mac-address-blacklist")]
1417 pub fn connect_mac_address_blacklist_notify<F: Fn(&Self) + 'static>(
1418 &self,
1419 f: F,
1420 ) -> SignalHandlerId {
1421 unsafe extern "C" fn notify_mac_address_blacklist_trampoline<
1422 F: Fn(&SettingWireless) + 'static,
1423 >(
1424 this: *mut ffi::NMSettingWireless,
1425 _param_spec: glib::ffi::gpointer,
1426 f: glib::ffi::gpointer,
1427 ) {
1428 let f: &F = &*(f as *const F);
1429 f(&from_glib_borrow(this))
1430 }
1431 unsafe {
1432 let f: Box_<F> = Box_::new(f);
1433 connect_raw(
1434 self.as_ptr() as *mut _,
1435 c"notify::mac-address-blacklist".as_ptr() as *const _,
1436 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1437 notify_mac_address_blacklist_trampoline::<F> as *const (),
1438 )),
1439 Box_::into_raw(f),
1440 )
1441 }
1442 }
1443
1444 #[doc(alias = "mac-address-denylist")]
1445 pub fn connect_mac_address_denylist_notify<F: Fn(&Self) + 'static>(
1446 &self,
1447 f: F,
1448 ) -> SignalHandlerId {
1449 unsafe extern "C" fn notify_mac_address_denylist_trampoline<
1450 F: Fn(&SettingWireless) + 'static,
1451 >(
1452 this: *mut ffi::NMSettingWireless,
1453 _param_spec: glib::ffi::gpointer,
1454 f: glib::ffi::gpointer,
1455 ) {
1456 let f: &F = &*(f as *const F);
1457 f(&from_glib_borrow(this))
1458 }
1459 unsafe {
1460 let f: Box_<F> = Box_::new(f);
1461 connect_raw(
1462 self.as_ptr() as *mut _,
1463 c"notify::mac-address-denylist".as_ptr() as *const _,
1464 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1465 notify_mac_address_denylist_trampoline::<F> as *const (),
1466 )),
1467 Box_::into_raw(f),
1468 )
1469 }
1470 }
1471
1472 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1473 #[cfg(feature = "v1_2")]
1474 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1475 #[doc(alias = "mac-address-randomization")]
1476 pub fn connect_mac_address_randomization_notify<F: Fn(&Self) + 'static>(
1477 &self,
1478 f: F,
1479 ) -> SignalHandlerId {
1480 unsafe extern "C" fn notify_mac_address_randomization_trampoline<
1481 F: Fn(&SettingWireless) + 'static,
1482 >(
1483 this: *mut ffi::NMSettingWireless,
1484 _param_spec: glib::ffi::gpointer,
1485 f: glib::ffi::gpointer,
1486 ) {
1487 let f: &F = &*(f as *const F);
1488 f(&from_glib_borrow(this))
1489 }
1490 unsafe {
1491 let f: Box_<F> = Box_::new(f);
1492 connect_raw(
1493 self.as_ptr() as *mut _,
1494 c"notify::mac-address-randomization".as_ptr() as *const _,
1495 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1496 notify_mac_address_randomization_trampoline::<F> as *const (),
1497 )),
1498 Box_::into_raw(f),
1499 )
1500 }
1501 }
1502
1503 #[doc(alias = "mode")]
1504 pub fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1505 unsafe extern "C" fn notify_mode_trampoline<F: Fn(&SettingWireless) + 'static>(
1506 this: *mut ffi::NMSettingWireless,
1507 _param_spec: glib::ffi::gpointer,
1508 f: glib::ffi::gpointer,
1509 ) {
1510 let f: &F = &*(f as *const F);
1511 f(&from_glib_borrow(this))
1512 }
1513 unsafe {
1514 let f: Box_<F> = Box_::new(f);
1515 connect_raw(
1516 self.as_ptr() as *mut _,
1517 c"notify::mode".as_ptr() as *const _,
1518 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1519 notify_mode_trampoline::<F> as *const (),
1520 )),
1521 Box_::into_raw(f),
1522 )
1523 }
1524 }
1525
1526 #[doc(alias = "mtu")]
1527 pub fn connect_mtu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1528 unsafe extern "C" fn notify_mtu_trampoline<F: Fn(&SettingWireless) + 'static>(
1529 this: *mut ffi::NMSettingWireless,
1530 _param_spec: glib::ffi::gpointer,
1531 f: glib::ffi::gpointer,
1532 ) {
1533 let f: &F = &*(f as *const F);
1534 f(&from_glib_borrow(this))
1535 }
1536 unsafe {
1537 let f: Box_<F> = Box_::new(f);
1538 connect_raw(
1539 self.as_ptr() as *mut _,
1540 c"notify::mtu".as_ptr() as *const _,
1541 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1542 notify_mtu_trampoline::<F> as *const (),
1543 )),
1544 Box_::into_raw(f),
1545 )
1546 }
1547 }
1548
1549 #[cfg(feature = "v1_2")]
1550 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1551 #[doc(alias = "powersave")]
1552 pub fn connect_powersave_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1553 unsafe extern "C" fn notify_powersave_trampoline<F: Fn(&SettingWireless) + 'static>(
1554 this: *mut ffi::NMSettingWireless,
1555 _param_spec: glib::ffi::gpointer,
1556 f: glib::ffi::gpointer,
1557 ) {
1558 let f: &F = &*(f as *const F);
1559 f(&from_glib_borrow(this))
1560 }
1561 unsafe {
1562 let f: Box_<F> = Box_::new(f);
1563 connect_raw(
1564 self.as_ptr() as *mut _,
1565 c"notify::powersave".as_ptr() as *const _,
1566 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1567 notify_powersave_trampoline::<F> as *const (),
1568 )),
1569 Box_::into_raw(f),
1570 )
1571 }
1572 }
1573
1574 #[cfg_attr(feature = "v1_44", deprecated = "Since 1.44")]
1575 #[doc(alias = "rate")]
1576 pub fn connect_rate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1577 unsafe extern "C" fn notify_rate_trampoline<F: Fn(&SettingWireless) + 'static>(
1578 this: *mut ffi::NMSettingWireless,
1579 _param_spec: glib::ffi::gpointer,
1580 f: glib::ffi::gpointer,
1581 ) {
1582 let f: &F = &*(f as *const F);
1583 f(&from_glib_borrow(this))
1584 }
1585 unsafe {
1586 let f: Box_<F> = Box_::new(f);
1587 connect_raw(
1588 self.as_ptr() as *mut _,
1589 c"notify::rate".as_ptr() as *const _,
1590 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1591 notify_rate_trampoline::<F> as *const (),
1592 )),
1593 Box_::into_raw(f),
1594 )
1595 }
1596 }
1597
1598 #[doc(alias = "seen-bssids")]
1599 pub fn connect_seen_bssids_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1600 unsafe extern "C" fn notify_seen_bssids_trampoline<F: Fn(&SettingWireless) + 'static>(
1601 this: *mut ffi::NMSettingWireless,
1602 _param_spec: glib::ffi::gpointer,
1603 f: glib::ffi::gpointer,
1604 ) {
1605 let f: &F = &*(f as *const F);
1606 f(&from_glib_borrow(this))
1607 }
1608 unsafe {
1609 let f: Box_<F> = Box_::new(f);
1610 connect_raw(
1611 self.as_ptr() as *mut _,
1612 c"notify::seen-bssids".as_ptr() as *const _,
1613 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1614 notify_seen_bssids_trampoline::<F> as *const (),
1615 )),
1616 Box_::into_raw(f),
1617 )
1618 }
1619 }
1620
1621 #[doc(alias = "ssid")]
1622 pub fn connect_ssid_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1623 unsafe extern "C" fn notify_ssid_trampoline<F: Fn(&SettingWireless) + 'static>(
1624 this: *mut ffi::NMSettingWireless,
1625 _param_spec: glib::ffi::gpointer,
1626 f: glib::ffi::gpointer,
1627 ) {
1628 let f: &F = &*(f as *const F);
1629 f(&from_glib_borrow(this))
1630 }
1631 unsafe {
1632 let f: Box_<F> = Box_::new(f);
1633 connect_raw(
1634 self.as_ptr() as *mut _,
1635 c"notify::ssid".as_ptr() as *const _,
1636 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1637 notify_ssid_trampoline::<F> as *const (),
1638 )),
1639 Box_::into_raw(f),
1640 )
1641 }
1642 }
1643
1644 #[cfg_attr(feature = "v1_44", deprecated = "Since 1.44")]
1645 #[doc(alias = "tx-power")]
1646 pub fn connect_tx_power_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1647 unsafe extern "C" fn notify_tx_power_trampoline<F: Fn(&SettingWireless) + 'static>(
1648 this: *mut ffi::NMSettingWireless,
1649 _param_spec: glib::ffi::gpointer,
1650 f: glib::ffi::gpointer,
1651 ) {
1652 let f: &F = &*(f as *const F);
1653 f(&from_glib_borrow(this))
1654 }
1655 unsafe {
1656 let f: Box_<F> = Box_::new(f);
1657 connect_raw(
1658 self.as_ptr() as *mut _,
1659 c"notify::tx-power".as_ptr() as *const _,
1660 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1661 notify_tx_power_trampoline::<F> as *const (),
1662 )),
1663 Box_::into_raw(f),
1664 )
1665 }
1666 }
1667
1668 #[cfg(feature = "v1_12")]
1669 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
1670 #[doc(alias = "wake-on-wlan")]
1671 pub fn connect_wake_on_wlan_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1672 unsafe extern "C" fn notify_wake_on_wlan_trampoline<F: Fn(&SettingWireless) + 'static>(
1673 this: *mut ffi::NMSettingWireless,
1674 _param_spec: glib::ffi::gpointer,
1675 f: glib::ffi::gpointer,
1676 ) {
1677 let f: &F = &*(f as *const F);
1678 f(&from_glib_borrow(this))
1679 }
1680 unsafe {
1681 let f: Box_<F> = Box_::new(f);
1682 connect_raw(
1683 self.as_ptr() as *mut _,
1684 c"notify::wake-on-wlan".as_ptr() as *const _,
1685 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1686 notify_wake_on_wlan_trampoline::<F> as *const (),
1687 )),
1688 Box_::into_raw(f),
1689 )
1690 }
1691 }
1692}
1693
1694impl Default for SettingWireless {
1695 fn default() -> Self {
1696 Self::new()
1697 }
1698}
1699
1700// rustdoc-stripper-ignore-next
1701/// A [builder-pattern] type to construct [`SettingWireless`] objects.
1702///
1703/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1704#[must_use = "The builder must be built to be used"]
1705pub struct SettingWirelessBuilder {
1706 builder: glib::object::ObjectBuilder<'static, SettingWireless>,
1707}
1708
1709impl SettingWirelessBuilder {
1710 fn new() -> Self {
1711 Self {
1712 builder: glib::object::Object::builder(),
1713 }
1714 }
1715
1716 /// Configures AP isolation, which prevents communication between
1717 /// wireless devices connected to this AP. This property can be set
1718 /// to a value different from [`Ternary::Default`][crate::Ternary::Default] only when the
1719 /// interface is configured in AP mode.
1720 ///
1721 /// If set to [`Ternary::True`][crate::Ternary::True], devices are not able to communicate
1722 /// with each other. This increases security because it protects
1723 /// devices against attacks from other clients in the network. At
1724 /// the same time, it prevents devices to access resources on the
1725 /// same wireless networks as file shares, printers, etc.
1726 ///
1727 /// If set to [`Ternary::False`][crate::Ternary::False], devices can talk to each other.
1728 ///
1729 /// When set to [`Ternary::Default`][crate::Ternary::Default], the global default is used; in
1730 /// case the global default is unspecified it is assumed to be
1731 /// [`Ternary::False`][crate::Ternary::False].
1732 #[cfg(feature = "v1_28")]
1733 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
1734 pub fn ap_isolation(self, ap_isolation: Ternary) -> Self {
1735 Self {
1736 builder: self.builder.property("ap-isolation", ap_isolation),
1737 }
1738 }
1739
1740 /// 802.11 frequency band of the network. One of "a" for 5GHz 802.11a or
1741 /// "bg" for 2.4GHz 802.11. This will lock associations to the Wi-Fi network
1742 /// to the specific band, i.e. if "a" is specified, the device will not
1743 /// associate with the same network in the 2.4GHz band even if the network's
1744 /// settings are compatible. This setting depends on specific driver
1745 /// capability and may not work with all drivers.
1746 pub fn band(self, band: impl Into<glib::GString>) -> Self {
1747 Self {
1748 builder: self.builder.property("band", band.into()),
1749 }
1750 }
1751
1752 /// If specified, directs the device to only associate with the given access
1753 /// point. This capability is highly driver dependent and not supported by
1754 /// all devices. Note: this property does not control the BSSID used when
1755 /// creating an Ad-Hoc network and is unlikely to in the future.
1756 ///
1757 /// Locking a client profile to a certain BSSID will prevent roaming and also
1758 /// disable background scanning. That can be useful, if there is only one access
1759 /// point for the SSID.
1760 pub fn bssid(self, bssid: impl Into<glib::GString>) -> Self {
1761 Self {
1762 builder: self.builder.property("bssid", bssid.into()),
1763 }
1764 }
1765
1766 /// Wireless channel to use for the Wi-Fi connection. The device will only
1767 /// join (or create for Ad-Hoc networks) a Wi-Fi network on the specified
1768 /// channel. Because channel numbers overlap between bands, this property
1769 /// also requires the "band" property to be set.
1770 pub fn channel(self, channel: u32) -> Self {
1771 Self {
1772 builder: self.builder.property("channel", channel),
1773 }
1774 }
1775
1776 /// Specifies width of the wireless channel in Access Point (AP) mode.
1777 ///
1778 /// When set to [`SettingWirelessChannelWidth::Auto`][crate::SettingWirelessChannelWidth::Auto] (the default), the
1779 /// channel width is automatically determined. At the moment, this means that
1780 /// the safest (smallest) width is chosen.
1781 ///
1782 /// If the value is not [`SettingWirelessChannelWidth::Auto`][crate::SettingWirelessChannelWidth::Auto], then the
1783 /// 'channel' property must also be set. When using the 2.4GHz band, the width
1784 /// can be at most 40MHz.
1785 ///
1786 /// This property can be set to a value different from
1787 /// [`SettingWirelessChannelWidth::Auto`][crate::SettingWirelessChannelWidth::Auto] only when the interface is configured
1788 /// in AP mode.
1789 #[cfg(feature = "v1_50")]
1790 #[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
1791 pub fn channel_width(self, channel_width: i32) -> Self {
1792 Self {
1793 builder: self.builder.property("channel-width", channel_width),
1794 }
1795 }
1796
1797 /// If specified, request that the device use this MAC address instead.
1798 /// This is known as MAC cloning or spoofing.
1799 ///
1800 /// Beside explicitly specifying a MAC address, the special values "preserve", "permanent",
1801 /// "random", "stable" and "stable-ssid" are supported.
1802 /// "preserve" means not to touch the MAC address on activation.
1803 /// "permanent" means to use the permanent hardware address of the device.
1804 /// "random" creates a random MAC address on each connect.
1805 /// "stable" creates a hashed MAC address based on connection.stable-id and a
1806 /// machine dependent key.
1807 /// "stable-ssid" creates a hashed MAC address based on the SSID, the same as setting the
1808 /// stable-id to "${NETWORK_SSID}".
1809 ///
1810 /// If unspecified, the value can be overwritten via global defaults, see manual
1811 /// of NetworkManager.conf. If still unspecified, it defaults to "preserve"
1812 /// (older versions of NetworkManager may use a different default value).
1813 ///
1814 /// On D-Bus, this field is expressed as "assigned-mac-address" or the deprecated
1815 /// "cloned-mac-address".
1816 pub fn cloned_mac_address(self, cloned_mac_address: impl Into<glib::GString>) -> Self {
1817 Self {
1818 builder: self
1819 .builder
1820 .property("cloned-mac-address", cloned_mac_address.into()),
1821 }
1822 }
1823
1824 /// With #NMSettingWireless:cloned-mac-address setting "random" or "stable",
1825 /// by default all bits of the MAC address are scrambled and a locally-administered,
1826 /// unicast MAC address is created. This property allows one to specify that certain bits
1827 /// are fixed. Note that the least significant bit of the first MAC address will
1828 /// always be unset to create a unicast MAC address.
1829 ///
1830 /// If the property is [`None`], it is eligible to be overwritten by a default
1831 /// connection setting. If the value is still [`None`] or an empty string, the
1832 /// default is to create a locally-administered, unicast MAC address.
1833 ///
1834 /// If the value contains one MAC address, this address is used as mask. The set
1835 /// bits of the mask are to be filled with the current MAC address of the device,
1836 /// while the unset bits are subject to randomization.
1837 /// Setting "FE:FF:FF:00:00:00" means to preserve the OUI of the current MAC address
1838 /// and only randomize the lower 3 bytes using the "random" or "stable" algorithm.
1839 ///
1840 /// If the value contains one additional MAC address after the mask,
1841 /// this address is used instead of the current MAC address to fill the bits
1842 /// that shall not be randomized. For example, a value of
1843 /// "FE:FF:FF:00:00:00 68:F7:28:00:00:00" will set the OUI of the MAC address
1844 /// to 68:F7:28, while the lower bits are randomized. A value of
1845 /// "02:00:00:00:00:00 00:00:00:00:00:00" will create a fully scrambled
1846 /// globally-administered, burned-in MAC address.
1847 ///
1848 /// If the value contains more than one additional MAC addresses, one of
1849 /// them is chosen randomly. For example, "02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00"
1850 /// will create a fully scrambled MAC address, randomly locally or globally
1851 /// administered.
1852 pub fn generate_mac_address_mask(
1853 self,
1854 generate_mac_address_mask: impl Into<glib::GString>,
1855 ) -> Self {
1856 Self {
1857 builder: self.builder.property(
1858 "generate-mac-address-mask",
1859 generate_mac_address_mask.into(),
1860 ),
1861 }
1862 }
1863
1864 /// If [`true`], indicates that the network is a non-broadcasting network that
1865 /// hides its SSID. This works both in infrastructure and AP mode.
1866 ///
1867 /// In infrastructure mode, various workarounds are used for a more reliable
1868 /// discovery of hidden networks, such as probe-scanning the SSID. However,
1869 /// these workarounds expose inherent insecurities with hidden SSID networks,
1870 /// and thus hidden SSID networks should be used with caution.
1871 ///
1872 /// In AP mode, the created network does not broadcast its SSID.
1873 ///
1874 /// Note that marking the network as hidden may be a privacy issue for you
1875 /// (in infrastructure mode) or client stations (in AP mode), as the explicit
1876 /// probe-scans are distinctly recognizable on the air.
1877 pub fn hidden(self, hidden: bool) -> Self {
1878 Self {
1879 builder: self.builder.property("hidden", hidden),
1880 }
1881 }
1882
1883 /// If specified, this connection will only apply to the Wi-Fi device whose
1884 /// permanent MAC address matches. This property does not change the MAC
1885 /// address of the device (i.e. MAC spoofing).
1886 pub fn mac_address(self, mac_address: impl Into<glib::GString>) -> Self {
1887 Self {
1888 builder: self.builder.property("mac-address", mac_address.into()),
1889 }
1890 }
1891
1892 /// A list of permanent MAC addresses of Wi-Fi devices to which this
1893 /// connection should never apply. Each MAC address should be given in the
1894 /// standard hex-digits-and-colons notation (eg "00:11:22:33:44:55").
1895 pub fn mac_address_blacklist(self, mac_address_blacklist: impl Into<glib::StrV>) -> Self {
1896 Self {
1897 builder: self
1898 .builder
1899 .property("mac-address-blacklist", mac_address_blacklist.into()),
1900 }
1901 }
1902
1903 /// A list of permanent MAC addresses of Wi-Fi devices to which this
1904 /// connection should never apply. Each MAC address should be given in the
1905 /// standard hex-digits-and-colons notation (eg "00:11:22:33:44:55").
1906 pub fn mac_address_denylist(self, mac_address_denylist: impl Into<glib::StrV>) -> Self {
1907 Self {
1908 builder: self
1909 .builder
1910 .property("mac-address-denylist", mac_address_denylist.into()),
1911 }
1912 }
1913
1914 /// One of [`SettingMacRandomization::Default`][crate::SettingMacRandomization::Default] (never randomize unless
1915 /// the user has set a global default to randomize and the supplicant
1916 /// supports randomization), [`SettingMacRandomization::Never`][crate::SettingMacRandomization::Never] (never
1917 /// randomize the MAC address), or [`SettingMacRandomization::Always`][crate::SettingMacRandomization::Always]
1918 /// (always randomize the MAC address).
1919 /// Use the #NMSettingWireless:cloned-mac-address property instead.
1920 #[cfg(feature = "v1_2")]
1921 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1922 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
1923 pub fn mac_address_randomization(self, mac_address_randomization: u32) -> Self {
1924 Self {
1925 builder: self
1926 .builder
1927 .property("mac-address-randomization", mac_address_randomization),
1928 }
1929 }
1930
1931 /// Wi-Fi network mode; one of "infrastructure", "mesh", "adhoc" or "ap". If blank,
1932 /// infrastructure is assumed.
1933 pub fn mode(self, mode: impl Into<glib::GString>) -> Self {
1934 Self {
1935 builder: self.builder.property("mode", mode.into()),
1936 }
1937 }
1938
1939 /// If non-zero, only transmit packets of the specified size or smaller,
1940 /// breaking larger packets up into multiple Ethernet frames.
1941 pub fn mtu(self, mtu: u32) -> Self {
1942 Self {
1943 builder: self.builder.property("mtu", mtu),
1944 }
1945 }
1946
1947 /// One of [`SettingWirelessPowersave::Disable`][crate::SettingWirelessPowersave::Disable] (disable Wi-Fi power
1948 /// saving), [`SettingWirelessPowersave::Enable`][crate::SettingWirelessPowersave::Enable] (enable Wi-Fi power
1949 /// saving), [`SettingWirelessPowersave::Ignore`][crate::SettingWirelessPowersave::Ignore] (don't touch currently
1950 /// configure setting) or [`SettingWirelessPowersave::Default`][crate::SettingWirelessPowersave::Default] (use the
1951 /// globally configured value). All other values are reserved.
1952 #[cfg(feature = "v1_2")]
1953 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1954 pub fn powersave(self, powersave: u32) -> Self {
1955 Self {
1956 builder: self.builder.property("powersave", powersave),
1957 }
1958 }
1959
1960 /// This property is not implemented and has no effect.
1961 /// This property is not implemented and has no effect.
1962 #[cfg_attr(feature = "v1_44", deprecated = "Since 1.44")]
1963 pub fn rate(self, rate: u32) -> Self {
1964 Self {
1965 builder: self.builder.property("rate", rate),
1966 }
1967 }
1968
1969 /// A list of BSSIDs (each BSSID formatted as a MAC address like
1970 /// "00:11:22:33:44:55") that have been detected as part of the Wi-Fi
1971 /// network. NetworkManager internally tracks previously seen BSSIDs. The
1972 /// property is only meant for reading and reflects the BSSID list of
1973 /// NetworkManager. The changes you make to this property will not be
1974 /// preserved.
1975 ///
1976 /// This is not a regular property that the user would configure. Instead,
1977 /// NetworkManager automatically sets the seen BSSIDs and tracks them internally
1978 /// in "/var/lib/NetworkManager/seen-bssids" file.
1979 pub fn seen_bssids(self, seen_bssids: impl Into<glib::StrV>) -> Self {
1980 Self {
1981 builder: self.builder.property("seen-bssids", seen_bssids.into()),
1982 }
1983 }
1984
1985 /// SSID of the Wi-Fi network. Must be specified.
1986 pub fn ssid<B: Borrow<[u8]> + ?Sized>(self, ssid: &B) -> Self {
1987 let bytes = glib::Bytes::from(ssid);
1988 Self {
1989 builder: self.builder.property("ssid", bytes),
1990 }
1991 }
1992
1993 /// This property is not implemented and has no effect.
1994 /// This property is not implemented and has no effect.
1995 #[cfg_attr(feature = "v1_44", deprecated = "Since 1.44")]
1996 pub fn tx_power(self, tx_power: u32) -> Self {
1997 Self {
1998 builder: self.builder.property("tx-power", tx_power),
1999 }
2000 }
2001
2002 /// The #NMSettingWirelessWakeOnWLan options to enable. Not all devices support all options.
2003 /// May be any combination of [`SettingWirelessWakeOnWLan::ANY`][crate::SettingWirelessWakeOnWLan::ANY],
2004 /// [`SettingWirelessWakeOnWLan::DISCONNECT`][crate::SettingWirelessWakeOnWLan::DISCONNECT],
2005 /// [`SettingWirelessWakeOnWLan::MAGIC`][crate::SettingWirelessWakeOnWLan::MAGIC],
2006 /// [`SettingWirelessWakeOnWLan::GTK_REKEY_FAILURE`][crate::SettingWirelessWakeOnWLan::GTK_REKEY_FAILURE],
2007 /// [`SettingWirelessWakeOnWLan::EAP_IDENTITY_REQUEST`][crate::SettingWirelessWakeOnWLan::EAP_IDENTITY_REQUEST],
2008 /// [`SettingWirelessWakeOnWLan::_4WAY_HANDSHAKE`][crate::SettingWirelessWakeOnWLan::_4WAY_HANDSHAKE],
2009 /// [`SettingWirelessWakeOnWLan::RFKILL_RELEASE`][crate::SettingWirelessWakeOnWLan::RFKILL_RELEASE],
2010 /// [`SettingWirelessWakeOnWLan::TCP`][crate::SettingWirelessWakeOnWLan::TCP] or the special values
2011 /// [`SettingWirelessWakeOnWLan::DEFAULT`][crate::SettingWirelessWakeOnWLan::DEFAULT] (to use global settings) and
2012 /// [`SettingWirelessWakeOnWLan::IGNORE`][crate::SettingWirelessWakeOnWLan::IGNORE] (to disable management of Wake-on-LAN in
2013 /// NetworkManager).
2014 #[cfg(feature = "v1_12")]
2015 #[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
2016 pub fn wake_on_wlan(self, wake_on_wlan: u32) -> Self {
2017 Self {
2018 builder: self.builder.property("wake-on-wlan", wake_on_wlan),
2019 }
2020 }
2021
2022 // rustdoc-stripper-ignore-next
2023 /// Build the [`SettingWireless`].
2024 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2025 pub fn build(self) -> SettingWireless {
2026 assert_initialized_main_thread!();
2027 self.builder.build()
2028 }
2029}