Class LinuxNetworkIF
- All Implemented Interfaces:
NetworkIF
- Direct Known Subclasses:
LinuxNetworkIfNF
-
Nested Class Summary
Nested classes/interfaces inherited from interface NetworkIF
NetworkIF.IfOperStatus -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLinuxNetworkIF(NetworkInterface netint, String model) Creates a LinuxNetworkIF. -
Method Summary
Modifier and TypeMethodDescriptionTheifAliasas described in RFC 2863.TheifOperStatusas described in RFC 2863.int(Windows, macOS) The NDIS Interface Type.boolean(Windows Vista and higher) Set if a connector is present on the network interface.protected static NetworkIF.IfOperStatusparseIfOperStatus(String operState) Parses the operational status from a sysfs operstate string.protected static StringqueryIfModelFromSysfs(String name) Reads vendor/model from the sysfs uevent file.booleanUpdates interface network statistics on this interface.Methods inherited from class AbstractNetworkIF
getBytesRecv, getBytesSent, getCollisions, getDisplayName, getIndex, getInDrops, getInErrors, getIPv4addr, getIPv6addr, getMacaddr, getMTU, getName, getNetworkInterfaces, getOutErrors, getPacketsRecv, getPacketsSent, getPrefixLengths, getSpeed, getSubnetMasks, getTimeStamp, isKnownVmMacAddr, queryNetworkInterface, setBytesRecv, setBytesSent, setCollisions, setInDrops, setInErrors, setOutErrors, setPacketsRecv, setPacketsSent, setSpeed, setTimeStamp, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface NetworkIF
getNdisPhysicalMediumType
-
Constructor Details
-
LinuxNetworkIF
Creates a LinuxNetworkIF.- Parameters:
netint- the network interfacemodel- the model string- Throws:
InstantiationException- if the interface cannot be instantiated
-
-
Method Details
-
queryIfModelFromSysfs
-
getIfType
public int getIfType()Description copied from interface:NetworkIF(Windows, macOS) The NDIS Interface Type. NDIS interface types are registered with the Internet Assigned Numbers Authority (IANA), which publishes a list of interface types periodically in the Assigned Numbers RFC, or in a derivative of it that is specific to Internet network management number assignments.(Linux) ARP Protocol hardware identifiers defined in
include/uapi/linux/if_arp.h- Returns:
- the ifType
-
isConnectorPresent
public boolean isConnectorPresent()Description copied from interface:NetworkIF(Windows Vista and higher) Set if a connector is present on the network interface.(Linux) Indicates the current physical link state of the interface.
- Returns:
trueif there is a physical network adapter (Windows) or a connected cable (Linux), false otherwise
-
getIfAlias
Description copied from interface:NetworkIFTheifAliasas described in RFC 2863.The ifAlias object allows a network manager to give one or more interfaces their own unique names, irrespective of any interface-stack relationship. Further, the ifAlias name is non-volatile, and thus an interface must retain its assigned ifAlias value across reboots, even if an agent chooses a new ifIndex value for the interface.
Only implemented for Windows (Vista and newer) and Linux.
- Returns:
- The
ifAliasof the interface if available, otherwise the empty string.
-
getIfOperStatus
Description copied from interface:NetworkIFTheifOperStatusas described in RFC 2863.Only implemented for Windows (Vista and newer) and Linux.
- Returns:
- The current operational state of the interface.
-
updateAttributes
public boolean updateAttributes()Description copied from interface:NetworkIFUpdates interface network statistics on this interface. Statistics include packets and bytes sent and received, and interface speed.This method is intended for updating a single interface that is being individually monitored. If you are updating multiple interfaces, it is more efficient to re-query the entire list from
HardwareAbstractionLayer.getNetworkIFs()and correlate the results, since on many platforms the full list must be queried to provide any individual result.- Returns:
trueif the update was successful,falseotherwise.
-
parseIfOperStatus
Parses the operational status from a sysfs operstate string.- Parameters:
operState- the operstate string- Returns:
- the parsed IfOperStatus
-