NetworkInterface
Description
The NetworkInterface object is an abstract base object for all kind of specific network interface objects such as WiredNetworkInterface, WirelessNetworkInterface and MobileNetworkInterface. It provides common properties and enumerations which apply to all network interfaces and implements common configuration mechanisms.
- › Inherits:
- › Inherited by:
MobileNetworkInterface, WiredNetworkInterface, WirelessNetworkInterface
Overview
Properties
Methods
Signals
Enumerations
Properties
bytesRx
This property holds the number of bytes received through this interface since the device has been started.
This property was introduced in InCore 2.6.
- › Type:
UnsignedBigInteger
- › Signal:
bytesRxChanged()
- › Attributes:
Readonly, Requires Polling
bytesTx
This property holds the number of bytes transmitted through this interface since the device has been started.
This property was introduced in InCore 2.6.
- › Type:
UnsignedBigInteger
- › Signal:
bytesTxChanged()
- › Attributes:
Readonly, Requires Polling
dhcpClientIdentifier
This property holds the DHCPv4 client identifier to use when sending DHCP requests. For all options the MAC address of the corresponding network interface is used to generate a unique identifier. When set to NetworkInterface.MacIdentifier the MAC address is used directly. Otherwise an RFC4361-compliant client ID is generated based on the MAC address.
- › Type:
- › Default:
- › Signal:
dhcpClientIdentifierChanged()
- › Attributes:
Writable, Optional
enabled
This property holds whether the network interface is enabled at all. If enabled the interface is managed and configured by the system according to the settings represented by other properties in this object and derived objects.
- › Type:
Boolean
- › Default:
false- › Signal:
enabledChanged()
- › Attributes:
Writable
enabledItem
This property holds an internal ConfigurationItem instance for the enabled property.
- › Type:
- › Attributes:
Readonly
error
This property holds the most recently occurred error or NetworkInterface.NoError if no error occurred. If the same error occurs multiple times this property does not change. Use the errorOccurred() signal to detect multiple occurrences of the same error.
- › Type:
- › Signal:
errorChanged()
- › Attributes:
Readonly
errorString
This property holds the current human readable error string corresponding to the current value in the error property. It may include additional information such as failure reasons or locations.
- › Type:
String
- › Signal:
errorStringChanged()
- › Attributes:
Readonly
hardwareAddress
This property holds the hardware address of the network interface, usually the MAC address.
- › Type:
String
- › Signal:
hardwareAddressChanged()
- › Attributes:
Readonly
hardwareAddressItem
This property holds an internal ConfigurationItem instance for the hardwareAddress property.
- › Type:
- › Attributes:
Readonly
hardwareName
This property holds the unique hardware name of the network interface as seen by the operating system, e.g. eth0.
- › Type:
String
- › Attributes:
Readonly
networkAddresses
This property holds the actual IP addresses in effect which have been assigned by the network or configured by the user.
This property was introduced in InCore 1.1.
- › Type:
StringList
- › Signal:
networkAddressesChanged()
- › Attributes:
Readonly
ntp
This property holds a list of NTP servers which should be used for synchronizing the system clock of the device. Multiple server addresses can be specified (IPv4/IPv6 addresses and resolvable hostnames allowed) and separated by space.
- › Type:
String
- › Signal:
ntpChanged()
- › Attributes:
Writable
ntpItem
This property holds an internal ConfigurationItem instance for the ntp property.
- › Type:
- › Attributes:
Readonly
operationalState
This property holds the operational state of the network interface. The most common case is to check whether the operational state equals NetworkInterface.Routable in order to determine whether the device is ready to communicate with certain hosts or networks. See the NetworkInterface.OperationalState enumeration for more details.
- › Type:
- › Default:
- › Signal:
operationalStateChanged()
- › Attributes:
Readonly
routes
This property holds a list of NetworkRoute objects which hold additional network routes to configure.
This property was introduced in InCore 2.3.
- › Type:
- › Signal:
routesChanged()
- › Attributes:
Readonly
setupState
This property holds the setup state of the network interface which specifies the state and progress of the interface configuration. The most common case is to check whether the setup state equals NetworkInterface.Configured which indicates that the network interface has been configured successfully. See the NetworkInterface.SetupState enumeration for more details.
- › Type:
- › Default:
- › Signal:
setupStateChanged()
- › Attributes:
Readonly
trafficRx
This property holds the number of bytes received per second through this interface during the last polling interval.
This property was introduced in InCore 2.5.
- › Type:
SignedInteger
- › Signal:
trafficRxChanged()
- › Attributes:
Readonly, Requires Polling
trafficTx
This property holds the number of bytes transmitted per second through this interface during the last polling interval.
This property was introduced in InCore 2.5.
- › Type:
SignedInteger
- › Signal:
trafficTxChanged()
- › Attributes:
Readonly, Requires Polling
useRoutes
This property holds whether to add the routes received during the configuration process to the routing table (e.g. routes advertisted by DHCP servers). This can be important when using multiple network interfaces which would normally lead to multiple default routes being added to the routing table. If in this case not all network gateways have access to the internet, the internet connectivity of the device itself can be impacted as well and may not work reliable and deterministic. By setting this property to false except for one specific interface the device will access the internet and non-local networks through the specific interface.
- › Type:
Boolean
- › Default:
true- › Signal:
useRoutesChanged()
- › Attributes:
Writable
useRoutesItem
This property holds an internal ConfigurationItem instance for the useRoutes property.
- › Type:
- › Attributes:
Readonly
Methods
pollBytesRx()
This method polls the bytesRx property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.
pollBytesTx()
This method polls the bytesTx property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.
pollTrafficRx()
This method polls the trafficRx property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.
pollTrafficTx()
This method polls the trafficTx property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.
Signals
errorOccurred()
This signal is emitted whenever an error has occurred, regardless of whether the error property has changed or not. In contrast to the change notification signal of the error property this signal is also emitted several times if a certain error occurs several times in succession.
routesDataChanged(SignedInteger index)
This signal is emitted whenever the List.dataChanged() signal is emitted, i.e. the item at index in the routes list itself emitted the dataChanged() signal.
Enumerations
DhcpClientIdentifier
This enumeration describes the DHCPv4 client identifier to use when sending DHCP requests.
Name |
Value |
Description |
|---|---|---|
|
|
Use the MAC address of the interface as DHCP client identifier. |
|
|
Use an RFC4361-compliant client ID (based on the MAC address) as DUID. |
Error
This enumeration describes all errors which can occur in NetworkInterface objects. The most recently occurred error is stored in the error property.
Name |
Value |
Description |
|---|---|---|
|
|
No error occurred or was detected. |
|
|
Invalid interface index. |
|
|
Invalid or empty configuration. |
|
|
Can’t update configuration - likely configuration files could not be opened for writing. |
|
|
Can’t apply configuration likely due to system service errors. |
|
|
System error. |
|
|
Device could not be unlocked, e.g. due to missing or invalid PIN. |
|
|
Specified country code is invalid or could not be set. |
|
|
The requested operation is not supported by the the interface. |
|
|
The device for the network interface is not available or not ready yet. |
|
|
The address (e.g. SMS recipient number) is empty. |
|
|
The message (e.g. SMS text) is empty. |
|
|
The message could not be created for sending. |
|
|
The message could not be sent, likely due to a network error or an invalid address. |
|
|
The message could not be deleted. |
OperationalState
This enumeration describes all operational states a network interface can enter.
Name |
Value |
Description |
|---|---|---|
|
|
The device is not operated at all. |
|
|
The device is powered down. |
|
|
The device is powered up, but it does not yet have a carrier. |
|
|
The device has a carrier, but is not yet ready for normal traffic. |
|
|
The link has carrier and addresses valid on the local link configured. |
|
|
The link has a carrier. |
|
|
The link has carrier and addresses valid on the local link configured. |
|
|
The link has carrier and is enslaved to bond or bridge master network interface. |
|
|
The link has carrier and routable address configured. |
SetupState
This enumeration describes all setup states a network interface can enter.
Name |
Value |
Description |
|---|---|---|
|
|
The link is not set up. |
|
|
udev is still processing the link, we don’t yet know if we will manage it. |
|
|
udev has processed the link, but we don’t yet know if we will manage it. |
|
|
System is in the process of retrieving configuration or configuring the link. |
|
|
The link has been configured successfully. |
|
|
The link is not managed by networkd. |
|
|
networkd failed to manage the link. |
|
|
The link is gone, but has not yet been dropped by networkd. |