pub struct Device {Show 32 fields
pub object_path: OwnedObjectPath,
pub udi: Property<String>,
pub udev_path: Property<String>,
pub interface: Property<String>,
pub ip_interface: Property<String>,
pub driver: Property<String>,
pub driver_version: Property<String>,
pub firmware_version: Property<String>,
pub capabilities: Property<NMDeviceCapabilities>,
pub state: Property<NMDeviceState>,
pub state_reason: Property<(NMDeviceState, NMDeviceStateReason)>,
pub active_connection: Property<OwnedObjectPath>,
pub ip4_config: Property<OwnedObjectPath>,
pub dhcp4_config: Property<OwnedObjectPath>,
pub ip6_config: Property<OwnedObjectPath>,
pub dhcp6_config: Property<OwnedObjectPath>,
pub managed: Property<bool>,
pub autoconnect: Property<bool>,
pub firmware_missing: Property<bool>,
pub nm_plugin_missing: Property<bool>,
pub device_type: Property<NMDeviceType>,
pub available_connections: Property<Vec<OwnedObjectPath>>,
pub physical_port_id: Property<String>,
pub mtu: Property<u32>,
pub metered: Property<NMMetered>,
pub lldp_neighbors: Property<Vec<LldpNeighbor>>,
pub real: Property<bool>,
pub ip4_connectivity: Property<NMConnectivityState>,
pub ip6_connectivity: Property<NMConnectivityState>,
pub interface_flags: Property<NMDeviceInterfaceFlags>,
pub hw_address: Property<String>,
pub ports: Property<Vec<OwnedObjectPath>>,
/* private fields */
}Expand description
Network device managed by NetworkManager.
Common functionality for all network interfaces (WiFi, ethernet, etc). Contains hardware information, state, configuration, and statistics.
Fields§
§object_path: OwnedObjectPathD-Bus object path for this device.
udi: Property<String>Operating-system specific transient device hardware identifier. Opaque string representing the underlying hardware for the device, and shouldn’t be used to keep track of individual devices. For some device types (Bluetooth, Modems) it is an identifier used by the hardware service (eg bluez or ModemManager) to refer to that device, and client programs use it get additional information from those services which NM does not provide. The Udi is not guaranteed to be consistent across reboots or hotplugs of the hardware.
udev_path: Property<String>The path of the device as exposed by the udev property ID_PATH.
interface: Property<String>The name of the device’s control (and often data) interface. Note that non UTF-8 characters are backslash escaped, so the resulting name may be longer then 15 characters. Use g_strcompress() to revert the escaping.
ip_interface: Property<String>The name of the device’s data interface when available. May not refer to the actual data interface until the device has successfully established a data connection, indicated by the device’s State becoming ACTIVATED. Note that non UTF-8 characters are backslash escaped, so the resulting name may be longer then 15 characters. Use g_strcompress() to revert the escaping.
driver: Property<String>The driver handling the device. Non-UTF-8 sequences are backslash escaped.
driver_version: Property<String>The version of the driver handling the device. Non-UTF-8 sequences are backslash escaped.
firmware_version: Property<String>The firmware version for the device. Non-UTF-8 sequences are backslash escaped.
capabilities: Property<NMDeviceCapabilities>Flags describing the capabilities of the device. See NMDeviceCapabilities.
state: Property<NMDeviceState>The current state of the device.
state_reason: Property<(NMDeviceState, NMDeviceStateReason)>The current state and reason for that state.
active_connection: Property<OwnedObjectPath>Object path of an ActiveConnection object that “owns” this device during activation. The ActiveConnection object tracks the life-cycle of a connection to a specific network and implements the org.freedesktop.NetworkManager.Connection.Active D-Bus interface.
ip4_config: Property<OwnedObjectPath>Object path of the Ip4Config object describing the configuration of the device. Only valid when the device is in the NM_DEVICE_STATE_ACTIVATED state.
dhcp4_config: Property<OwnedObjectPath>Object path of the Dhcp4Config object describing the DHCP options returned by the DHCP server. Only valid when the device is in the NM_DEVICE_STATE_ACTIVATED state.
ip6_config: Property<OwnedObjectPath>Object path of the Ip6Config object describing the configuration of the device. Only valid when the device is in the NM_DEVICE_STATE_ACTIVATED state.
dhcp6_config: Property<OwnedObjectPath>Object path of the Dhcp6Config object describing the DHCP options returned by the DHCP server. Only valid when the device is in the NM_DEVICE_STATE_ACTIVATED state.
managed: Property<bool>Whether or not this device is managed by NetworkManager. Setting this property has a similar effect to configuring the device as unmanaged via the keyfile.unmanaged-devices setting in NetworkManager.conf.
autoconnect: Property<bool>If TRUE, indicates the device is allowed to autoconnect. If FALSE, manual intervention is required before the device will automatically connect to a known network, such as activating a connection using the device, or setting this property to TRUE.
firmware_missing: Property<bool>If TRUE, indicates the device is likely missing firmware necessary for its operation.
nm_plugin_missing: Property<bool>If TRUE, indicates the NetworkManager plugin for the device is likely missing or misconfigured.
device_type: Property<NMDeviceType>The general type of the network device.
available_connections: Property<Vec<OwnedObjectPath>>An array of object paths of every configured connection that is currently ‘available’ through this device.
physical_port_id: Property<String>If non-empty, an (opaque) indicator of the physical network port associated with the device. Can be used to recognize when two seemingly-separate hardware devices are actually just different virtual interfaces to the same physical port.
mtu: Property<u32>The MTU of the device.
metered: Property<NMMetered>Whether the amount of traffic flowing through the device is subject to limitations, for example set by service providers.
lldp_neighbors: Property<Vec<LldpNeighbor>>Array of LLDP neighbors; each element is a dictionary mapping LLDP TLV names to variant boxed values.
real: Property<bool>True if the device exists, or False for placeholder devices that do not yet exist but could be automatically created by NetworkManager if one of their AvailableConnections was activated.
ip4_connectivity: Property<NMConnectivityState>The result of the last IPv4 connectivity check.
ip6_connectivity: Property<NMConnectivityState>The result of the last IPv6 connectivity check.
interface_flags: Property<NMDeviceInterfaceFlags>The flags of the network interface. See NMDeviceInterfaceFlags for the currently defined flags.
hw_address: Property<String>The hardware address of the device.
ports: Property<Vec<OwnedObjectPath>>The port devices of the controller device. Array of object paths of port devices for controller devices. For devices that are not controllers this is an empty array.
Implementations§
Source§impl Device
impl Device
Sourcepub async fn set_managed(&self, managed: bool) -> Result<(), Error>
pub async fn set_managed(&self, managed: bool) -> Result<(), Error>
Whether or not this device is managed by NetworkManager.
§Errors
Returns error if the D-Bus operation fails.
Sourcepub async fn set_autoconnect(&self, autoconnect: bool) -> Result<(), Error>
pub async fn set_autoconnect(&self, autoconnect: bool) -> Result<(), Error>
If TRUE, indicates the device is allowed to autoconnect.
§Errors
Returns error if the D-Bus operation fails.
Sourcepub async fn reapply(
&self,
connection_settings: HashMap<String, HashMap<String, OwnedValue>>,
version_id: u64,
flags: u32,
) -> Result<(), Error>
pub async fn reapply( &self, connection_settings: HashMap<String, HashMap<String, OwnedValue>>, version_id: u64, flags: u32, ) -> Result<(), Error>
Sourcepub async fn get_applied_connection(
&self,
flags: u32,
) -> Result<AppliedConnection, Error>
pub async fn get_applied_connection( &self, flags: u32, ) -> Result<AppliedConnection, Error>
Sourcepub async fn disconnect(&self) -> Result<(), Error>
pub async fn disconnect(&self) -> Result<(), Error>
Disconnects a device and prevents the device from automatically activating further connections without user intervention.
§Errors
Returns error if the disconnect operation fails.
Sourcepub async fn delete(&self) -> Result<(), Error>
pub async fn delete(&self) -> Result<(), Error>
Deletes a software device from NetworkManager and removes the interface from the system.
§Errors
Returns error if the delete operation fails.
Sourcepub async fn set_managed_ext(
&self,
managed: NMDeviceManaged,
flags: NMDeviceManagedFlags,
) -> Result<(), Error>
pub async fn set_managed_ext( &self, managed: NMDeviceManaged, flags: NMDeviceManagedFlags, ) -> Result<(), Error>
Sets the managed state with optional persistence. Since: NM 1.58.
§Errors
Returns error if the operation fails.