pub trait ConnectionExt: IsA<Connection> + 'static {
Show 63 methods
// Provided methods
fn add_setting(&self, setting: impl IsA<Setting>) { ... }
fn clear_secrets(&self) { ... }
fn clear_secrets_with_flags(
&self,
func: Option<&mut dyn FnMut(&Setting, &str, &SettingSecretFlags) -> bool>,
) { ... }
fn clear_settings(&self) { ... }
fn compare(
&self,
b: &impl IsA<Connection>,
flags: SettingCompareFlags,
) -> bool { ... }
fn dump(&self) { ... }
fn connection_type(&self) -> GString { ... }
fn id(&self) -> GString { ... }
fn interface_name(&self) -> GString { ... }
fn path(&self) -> GString { ... }
fn setting(&self, setting_type: Type) -> Setting { ... }
fn setting_802_1x(&self) -> Setting8021x { ... }
fn setting_adsl(&self) -> SettingAdsl { ... }
fn setting_bluetooth(&self) -> SettingBluetooth { ... }
fn setting_bond(&self) -> SettingBond { ... }
fn setting_bridge(&self) -> SettingBridge { ... }
fn setting_bridge_port(&self) -> SettingBridgePort { ... }
fn setting_by_name(&self, name: &str) -> Setting { ... }
fn setting_cdma(&self) -> SettingCdma { ... }
fn setting_connection(&self) -> SettingConnection { ... }
fn setting_dcb(&self) -> SettingDcb { ... }
fn setting_dummy(&self) -> SettingDummy { ... }
fn setting_generic(&self) -> SettingGeneric { ... }
fn setting_gsm(&self) -> SettingGsm { ... }
fn setting_infiniband(&self) -> SettingInfiniband { ... }
fn setting_ip4_config(&self) -> SettingIP4Config { ... }
fn setting_ip6_config(&self) -> SettingIP6Config { ... }
fn setting_ip_tunnel(&self) -> SettingIPTunnel { ... }
fn setting_macsec(&self) -> SettingMacsec { ... }
fn setting_macvlan(&self) -> SettingMacvlan { ... }
fn setting_olpc_mesh(&self) -> SettingOlpcMesh { ... }
fn setting_ovs_bridge(&self) -> SettingOvsBridge { ... }
fn setting_ovs_patch(&self) -> SettingOvsPatch { ... }
fn setting_ovs_port(&self) -> SettingOvsPort { ... }
fn setting_ppp(&self) -> SettingPpp { ... }
fn setting_pppoe(&self) -> SettingPppoe { ... }
fn setting_proxy(&self) -> SettingProxy { ... }
fn setting_serial(&self) -> SettingSerial { ... }
fn setting_tc_config(&self) -> SettingTCConfig { ... }
fn setting_team(&self) -> SettingTeam { ... }
fn setting_team_port(&self) -> SettingTeamPort { ... }
fn setting_tun(&self) -> SettingTun { ... }
fn setting_vlan(&self) -> SettingVlan { ... }
fn setting_vpn(&self) -> SettingVpn { ... }
fn setting_vxlan(&self) -> SettingVxlan { ... }
fn setting_wimax(&self) -> SettingWimax { ... }
fn setting_wired(&self) -> SettingWired { ... }
fn setting_wireless(&self) -> SettingWireless { ... }
fn setting_wireless_security(&self) -> SettingWirelessSecurity { ... }
fn settings(&self) -> Vec<Setting> { ... }
fn uuid(&self) -> GString { ... }
fn virtual_device_description(&self) -> GString { ... }
fn is_type(&self, type_: &str) -> bool { ... }
fn is_virtual(&self) -> bool { ... }
fn need_secrets(&self) -> (Option<GString>, Vec<GString>) { ... }
fn remove_setting(&self, setting_type: Type) { ... }
fn replace_settings_from_connection(
&self,
new_connection: &impl IsA<Connection>,
) { ... }
fn set_path(&self, path: &str) { ... }
fn verify(&self) -> Result<(), Error> { ... }
fn verify_secrets(&self) -> Result<(), Error> { ... }
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn connect_secrets_cleared<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_secrets_updated<F: Fn(&Self, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}Expand description
Trait containing all Connection methods.
§Implementors
Provided Methods§
Sourcefn add_setting(&self, setting: impl IsA<Setting>)
fn add_setting(&self, setting: impl IsA<Setting>)
Adds a #NMSetting to the connection, replacing any previous #NMSetting of the same name which has previously been added to the #NMConnection. The connection takes ownership of the #NMSetting object and does not increase the setting object’s reference count.
§setting
the #NMSetting to add to the connection object
Sourcefn clear_secrets(&self)
fn clear_secrets(&self)
Clears and frees any secrets that may be stored in the connection, to avoid keeping secret data in memory when not needed.
Sourcefn clear_secrets_with_flags(
&self,
func: Option<&mut dyn FnMut(&Setting, &str, &SettingSecretFlags) -> bool>,
)
fn clear_secrets_with_flags( &self, func: Option<&mut dyn FnMut(&Setting, &str, &SettingSecretFlags) -> bool>, )
Sourcefn clear_settings(&self)
fn clear_settings(&self)
Deletes all of @self’s settings.
fn compare(&self, b: &impl IsA<Connection>, flags: SettingCompareFlags) -> bool
Sourcefn dump(&self)
fn dump(&self)
Print the connection (including secrets!) to stdout. For debugging purposes ONLY, should NOT be used for serialization of the setting, or machine-parsed in any way. The output format is not guaranteed to be stable and may change at any time.
Sourcefn connection_type(&self) -> GString
fn connection_type(&self) -> GString
A shortcut to return the type from the connection’s #NMSettingConnection.
§Returns
the type from the connection’s ‘connection’ setting
Sourcefn id(&self) -> GString
fn id(&self) -> GString
A shortcut to return the ID from the connection’s #NMSettingConnection.
§Returns
the ID from the connection’s ‘connection’ setting
Sourcefn interface_name(&self) -> GString
fn interface_name(&self) -> GString
Returns the interface name as stored in NMSettingConnection:interface_name.
If the connection contains no NMSettingConnection, it will return None.
For hardware devices and software devices created outside of NetworkManager, this name is used to match the device. for software devices created by NetworkManager, this is the name of the created interface.
§Returns
Name of the kernel interface or None
Sourcefn path(&self) -> GString
fn path(&self) -> GString
Returns the connection’s D-Bus path.
§Returns
the D-Bus path of the connection, previously set by a call to nm_connection_set_path().
Sourcefn setting_802_1x(&self) -> Setting8021x
fn setting_802_1x(&self) -> Setting8021x
Sourcefn setting_adsl(&self) -> SettingAdsl
fn setting_adsl(&self) -> SettingAdsl
Sourcefn setting_bluetooth(&self) -> SettingBluetooth
fn setting_bluetooth(&self) -> SettingBluetooth
Sourcefn setting_bond(&self) -> SettingBond
fn setting_bond(&self) -> SettingBond
Sourcefn setting_bridge(&self) -> SettingBridge
fn setting_bridge(&self) -> SettingBridge
Sourcefn setting_bridge_port(&self) -> SettingBridgePort
fn setting_bridge_port(&self) -> SettingBridgePort
Sourcefn setting_by_name(&self, name: &str) -> Setting
fn setting_by_name(&self, name: &str) -> Setting
Sourcefn setting_cdma(&self) -> SettingCdma
fn setting_cdma(&self) -> SettingCdma
Sourcefn setting_connection(&self) -> SettingConnection
fn setting_connection(&self) -> SettingConnection
Sourcefn setting_dcb(&self) -> SettingDcb
fn setting_dcb(&self) -> SettingDcb
A shortcut to return any #NMSettingDcb the connection might contain.
§Returns
an #NMSettingDcb if the connection contains one, otherwise NULL
Sourcefn setting_dummy(&self) -> SettingDummy
Available on crate feature v1_8 only.
fn setting_dummy(&self) -> SettingDummy
v1_8 only.Sourcefn setting_generic(&self) -> SettingGeneric
fn setting_generic(&self) -> SettingGeneric
A shortcut to return any #NMSettingGeneric the connection might contain.
§Returns
an #NMSettingGeneric if the connection contains one, otherwise NULL
Sourcefn setting_gsm(&self) -> SettingGsm
fn setting_gsm(&self) -> SettingGsm
Sourcefn setting_infiniband(&self) -> SettingInfiniband
fn setting_infiniband(&self) -> SettingInfiniband
Sourcefn setting_ip4_config(&self) -> SettingIP4Config
fn setting_ip4_config(&self) -> SettingIP4Config
A shortcut to return any #NMSettingIP4Config the connection might contain.
Note that it returns the value as type #NMSettingIPConfig, since the vast majority of IPv4-setting-related methods are on that type, not #NMSettingIP4Config.
§Returns
an #NMSettingIP4Config if the
connection contains one, otherwise None
Sourcefn setting_ip6_config(&self) -> SettingIP6Config
fn setting_ip6_config(&self) -> SettingIP6Config
A shortcut to return any #NMSettingIP6Config the connection might contain.
Note that it returns the value as type #NMSettingIPConfig, since the vast majority of IPv6-setting-related methods are on that type, not #NMSettingIP6Config.
§Returns
an #NMSettingIP6Config if the
connection contains one, otherwise None
Sourcefn setting_ip_tunnel(&self) -> SettingIPTunnel
Available on crate feature v1_2 only.
fn setting_ip_tunnel(&self) -> SettingIPTunnel
v1_2 only.Sourcefn setting_macsec(&self) -> SettingMacsec
Available on crate feature v1_6 only.
fn setting_macsec(&self) -> SettingMacsec
v1_6 only.Sourcefn setting_macvlan(&self) -> SettingMacvlan
Available on crate feature v1_2 only.
fn setting_macvlan(&self) -> SettingMacvlan
v1_2 only.Sourcefn setting_olpc_mesh(&self) -> SettingOlpcMesh
fn setting_olpc_mesh(&self) -> SettingOlpcMesh
Sourcefn setting_ovs_bridge(&self) -> SettingOvsBridge
Available on crate feature v1_14 only.
fn setting_ovs_bridge(&self) -> SettingOvsBridge
v1_14 only.Sourcefn setting_ovs_patch(&self) -> SettingOvsPatch
Available on crate feature v1_14 only.
fn setting_ovs_patch(&self) -> SettingOvsPatch
v1_14 only.Sourcefn setting_ovs_port(&self) -> SettingOvsPort
Available on crate feature v1_14 only.
fn setting_ovs_port(&self) -> SettingOvsPort
v1_14 only.Sourcefn setting_ppp(&self) -> SettingPpp
fn setting_ppp(&self) -> SettingPpp
Sourcefn setting_pppoe(&self) -> SettingPppoe
fn setting_pppoe(&self) -> SettingPppoe
Sourcefn setting_proxy(&self) -> SettingProxy
Available on crate feature v1_6 only.
fn setting_proxy(&self) -> SettingProxy
v1_6 only.Sourcefn setting_serial(&self) -> SettingSerial
fn setting_serial(&self) -> SettingSerial
Sourcefn setting_tc_config(&self) -> SettingTCConfig
Available on crate feature v1_12 only.
fn setting_tc_config(&self) -> SettingTCConfig
v1_12 only.Sourcefn setting_team(&self) -> SettingTeam
fn setting_team(&self) -> SettingTeam
Sourcefn setting_team_port(&self) -> SettingTeamPort
fn setting_team_port(&self) -> SettingTeamPort
Sourcefn setting_tun(&self) -> SettingTun
Available on crate feature v1_14 only.
fn setting_tun(&self) -> SettingTun
v1_14 only.Sourcefn setting_vlan(&self) -> SettingVlan
fn setting_vlan(&self) -> SettingVlan
Sourcefn setting_vpn(&self) -> SettingVpn
fn setting_vpn(&self) -> SettingVpn
Sourcefn setting_vxlan(&self) -> SettingVxlan
Available on crate feature v1_2 only.
fn setting_vxlan(&self) -> SettingVxlan
v1_2 only.Sourcefn setting_wimax(&self) -> SettingWimax
fn setting_wimax(&self) -> SettingWimax
Sourcefn setting_wired(&self) -> SettingWired
fn setting_wired(&self) -> SettingWired
Sourcefn setting_wireless(&self) -> SettingWireless
fn setting_wireless(&self) -> SettingWireless
Sourcefn setting_wireless_security(&self) -> SettingWirelessSecurity
fn setting_wireless_security(&self) -> SettingWirelessSecurity
Sourcefn uuid(&self) -> GString
fn uuid(&self) -> GString
A shortcut to return the UUID from the connection’s #NMSettingConnection.
§Returns
the UUID from the connection’s ‘connection’ setting
Sourcefn virtual_device_description(&self) -> GString
fn virtual_device_description(&self) -> GString
Sourcefn is_type(&self, type_: &str) -> bool
fn is_type(&self, type_: &str) -> bool
A convenience function to check if the given @self is a particular type (ie wired, Wi-Fi, ppp, etc). Checks the #NMSettingConnection:type property of the connection and matches that against @type_.
§type_
a setting name to check the connection’s type against (like
SETTING_WIRELESS_SETTING_NAME or SETTING_WIRED_SETTING_NAME)
§Returns
Sourcefn is_virtual(&self) -> bool
fn is_virtual(&self) -> bool
Checks if @self refers to a virtual device (and thus can potentially be activated even if the device it refers to doesn’t exist).
§Returns
whether @self refers to a virtual device
Sourcefn need_secrets(&self) -> (Option<GString>, Vec<GString>)
fn need_secrets(&self) -> (Option<GString>, Vec<GString>)
Returns the name of the first setting object in the connection which would need secrets to make a successful connection. The returned hints are only intended as a guide to what secrets may be required, because in some circumstances, there is no way to conclusively determine exactly which secrets are needed.
§Returns
the setting name of the #NMSetting object which has invalid or missing secrets
§hints
the address of a pointer to a #GPtrArray, initialized to None, which on
return points to an allocated #GPtrArray containing the property names of
secrets of the #NMSetting which may be required; the caller owns the array
and must free the array itself with g_ptr_array_free(), but not free its
elements
Sourcefn remove_setting(&self, setting_type: Type)
fn remove_setting(&self, setting_type: Type)
Removes the #NMSetting with the given #GType from the #NMConnection. This operation dereferences the #NMSetting object.
§setting_type
the #GType of the setting object to remove
Sourcefn replace_settings_from_connection(
&self,
new_connection: &impl IsA<Connection>,
)
fn replace_settings_from_connection( &self, new_connection: &impl IsA<Connection>, )
Deep-copies the settings of @new_connection and replaces the settings of @self with the copied settings.
§new_connection
a #NMConnection to replace the settings of @self with
Sourcefn set_path(&self, path: &str)
fn set_path(&self, path: &str)
Sets the D-Bus path of the connection. This property is not serialized, and is only for the reference of the caller. Sets the #NMConnection:path property.
§path
the D-Bus path of the connection as given by the settings service which provides the connection
Sourcefn verify(&self) -> Result<(), Error>
fn verify(&self) -> Result<(), Error>
Validates the connection and all its settings. Each setting’s properties have allowed values, and some values are dependent on other values. For example, if a Wi-Fi connection is security enabled, the #NMSettingWireless setting object’s ‘security’ property must contain the setting name of the #NMSettingWirelessSecurity object, which must also be present in the connection for the connection to be valid. As another example, the #NMSettingWired object’s ‘mac-address’ property must be a validly formatted MAC address. The returned #GError contains information about which setting and which property failed validation, and how it failed validation.
§Returns
Sourcefn verify_secrets(&self) -> Result<(), Error>
Available on crate feature v1_2 only.
fn verify_secrets(&self) -> Result<(), Error>
v1_2 only.Sourcefn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
The ::changed signal is emitted when any property (including secrets) of any setting of the connection is modified, or when settings are added or removed.
Sourcefn connect_secrets_cleared<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_secrets_cleared<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
The ::secrets-cleared signal is emitted when the secrets of a connection are cleared.
Sourcefn connect_secrets_updated<F: Fn(&Self, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_secrets_updated<F: Fn(&Self, &str) + 'static>( &self, f: F, ) -> SignalHandlerId
The ::secrets-updated signal is emitted when the secrets of a setting have been changed.
§setting_name
the setting name of the #NMSetting for which secrets were updated
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.