openmediavault  4.0 (Arrakis)
The open network attached storage solution
Public Member Functions | Public Attributes | Protected Attributes | List of all members
OMV\System\Net\NetworkInterface Class Reference
Inheritance diagram for OMV\System\Net\NetworkInterface:
OMV\System\Net\NetworkInterfaceBond

Public Member Functions

 __construct ($name)
 
 getDeviceName ()
 
 exists ()
 
 getIP ()
 
 getIP6 ()
 
 getPrefix ()
 
 getPrefix6 ()
 
 getNetmask ()
 
 getNetmask6 ()
 
 getMask ()
 
 getMask6 ()
 
 getMAC ()
 
 getMTU ()
 
 getGateway ()
 
 getGateway6 ()
 
 getState ()
 
 getLink ()
 
 getStatistics ()
 
 getOperState ()
 
 getDuplex ()
 
 getSpeed ()
 
 getCarrier ()
 
 isVlan ()
 
 getVlanId ()
 

Public Attributes

 ipv4cidr
 

Protected Attributes

 $name = ""
 
 $ip = null
 
 $ethtool = null
 
 $regex
 

Detailed Description

This class provides a simple interface to handle Linux network interfaces.

Constructor & Destructor Documentation

◆ __construct()

OMV\System\Net\NetworkInterface::__construct (   $name)

Constructor

Parameters
nameThe network interface name, e.g. eth0, ethx, ...

Member Function Documentation

◆ exists()

OMV\System\Net\NetworkInterface::exists ( )

Check whether the network interface exists.

Returns
TRUE if the network interface exists, otherwise FALSE.

◆ getCarrier()

OMV\System\Net\NetworkInterface::getCarrier ( )

Get the network interface physical link state.

See also
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net
Returns
The network interface physical link state, otherwise FALSE.

◆ getDeviceName()

OMV\System\Net\NetworkInterface::getDeviceName ( )

Get the network interface name, e.g. eth0 or ethx.

Returns
The network interface name.

◆ getDuplex()

OMV\System\Net\NetworkInterface::getDuplex ( )

Get the network interface duplex value.

See also
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net
Returns
The network interface duplex value as string, otherwise FALSE.

◆ getGateway()

OMV\System\Net\NetworkInterface::getGateway ( )

Get the network interface IPv4 default gateway.

Returns
The interface default gateway, or FALSE on failure.
Exceptions

◆ getGateway6()

OMV\System\Net\NetworkInterface::getGateway6 ( )

Get the network interface IPv6 default gateway.

Returns
The interface default gateway, or FALSE on failure.
Exceptions

◆ getIP()

OMV\System\Net\NetworkInterface::getIP ( )

Get the network interface IPv4 address.

Returns
The network interface IPv4 address, otherwise FALSE.
Exceptions

◆ getIP6()

OMV\System\Net\NetworkInterface::getIP6 ( )

Get the network interface IPv6 address.

Returns
The network interface IPv6 address, otherwise FALSE.
Exceptions

◆ getLink()

OMV\System\Net\NetworkInterface::getLink ( )

Get the network interface link state.

Returns
TRUE if link is established, otherwise FALSE.

◆ getMAC()

OMV\System\Net\NetworkInterface::getMAC ( )

Get the network interface MAC address.

Returns
The network interface MAC address, otherwise FALSE.

◆ getMask()

OMV\System\Net\NetworkInterface::getMask ( )
Deprecated:
Will be removed in OMV5.

◆ getMask6()

OMV\System\Net\NetworkInterface::getMask6 ( )
Deprecated:
Will be removed in OMV5.

◆ getMTU()

OMV\System\Net\NetworkInterface::getMTU ( )

Get the network interface MTU.

Returns
The network interface MTU, otherwise FALSE.

◆ getNetmask()

OMV\System\Net\NetworkInterface::getNetmask ( )

Get the network interface IPv4 netmask.

Returns
The network interface netmask, otherwise FALSE.
Exceptions

◆ getNetmask6()

OMV\System\Net\NetworkInterface::getNetmask6 ( )

Get the network interface IPv6 mask/prefix length.

Returns
The network interface IPv6 mask/prefix length as integer, otherwise FALSE.
Exceptions

◆ getOperState()

OMV\System\Net\NetworkInterface::getOperState ( )

Get the network interface operation state.

Returns
The network interface operation state, otherwise FALSE.

◆ getPrefix()

OMV\System\Net\NetworkInterface::getPrefix ( )

Get the network interface IPv4 prefix length.

Returns
The network interface prefix, otherwise FALSE.
Exceptions

◆ getPrefix6()

OMV\System\Net\NetworkInterface::getPrefix6 ( )

Get the network interface IPv6 prefix length.

Returns
The network interface IPv6 mask/prefix length as integer, otherwise FALSE.
Exceptions

◆ getSpeed()

OMV\System\Net\NetworkInterface::getSpeed ( )

Get the network interface speed value.

See also
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net
Returns
The network interface speed as number in Mbits/sec, otherwise FALSE.

◆ getState()

OMV\System\Net\NetworkInterface::getState ( )

Get the network interface state.

Returns
The network interface state, e.g. 'UP', 'DOWN' or 'UNKNOWN', otherwise FALSE.
Exceptions

◆ getStatistics()

OMV\System\Net\NetworkInterface::getStatistics ( )

Get the network interface statistics.

Returns
The network interface statistics, otherwise FALSE.
array(
rx_bytes => xxx,
rx_packets => xxx,
rx_errors => xxx,
rx_dropped => xxx,
rx_fifo_errors => xxx,
rx_frame_errors => xxx,
rx_compressed => xxx,
rx_multicast => xxx,
tx_bytes => xxx,
tx_packets => xxx,
tx_errors => xxx,
tx_dropped => xxx,
tx_fifo_errors => xxx,
tx_collisions => xxx,
tx_carrier_errors => xxx,
tx_compressed => xxx
)

◆ getVlanId()

OMV\System\Net\NetworkInterface::getVlanId ( )

Get VLAN ID of the network interface.

Returns
The VLAN id, otherwise FALSE.

◆ isVlan()

OMV\System\Net\NetworkInterface::isVlan ( )

Check if the network interface is a VLAN (802.1q) device.

Returns
TRUE if the network interface is a VLAN (802.1q) device, otherwise FALSE.

Member Data Documentation

◆ $regex

OMV\System\Net\NetworkInterface::$regex
protected
Initial value:
= [
"ipv4" => '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'

◆ ipv4cidr

OMV\System\Net\NetworkInterface::ipv4cidr
Initial value:
=> '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\/(\d{1,2})',
"ipv6" => '[a-f0-9:.]+',
"ipv6cidr" => '([a-f0-9:.]+)\/(\d{1,3})',
"state" => 'UP|DOWN|UNKNOWN'
]

The documentation for this class was generated from the following file: