Package oshi.software.os.mac
Class MacInternetProtocolStats
- java.lang.Object
-
- oshi.software.common.AbstractInternetProtocolStats
-
- oshi.software.os.mac.MacInternetProtocolStats
-
- All Implemented Interfaces:
InternetProtocolStats
@ThreadSafe public class MacInternetProtocolStats extends AbstractInternetProtocolStats
Internet Protocol Stats implementation
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface oshi.software.os.InternetProtocolStats
InternetProtocolStats.IPConnection, InternetProtocolStats.TcpState, InternetProtocolStats.TcpStats, InternetProtocolStats.UdpStats
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.Supplier<Pair<java.lang.Long,java.lang.Long>>establishedv4v6private java.util.function.Supplier<CLibrary.BsdIp6stat>ip6statprivate java.util.function.Supplier<CLibrary.BsdIpstat>ipstatprivate booleanisElevatedprivate java.util.function.Supplier<CLibrary.BsdTcpstat>tcpstatprivate java.util.function.Supplier<CLibrary.BsdUdpstat>udpstat
-
Constructor Summary
Constructors Constructor Description MacInternetProtocolStats(boolean elevated)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<InternetProtocolStats.IPConnection>getConnections()Gets a list of TCP and UDP connections.InternetProtocolStats.TcpStatsgetTCPv4Stats()Get the TCP stats for IPv4 connections.InternetProtocolStats.TcpStatsgetTCPv6Stats()Get the TCP stats for IPv6 connections, if available.InternetProtocolStats.UdpStatsgetUDPv4Stats()Get the UDP stats for IPv4 datagrams.InternetProtocolStats.UdpStatsgetUDPv6Stats()Get the UDP stats for IPv6 datagrams, if available.private static java.util.List<java.lang.Integer>queryFdList(int pid)private static CLibrary.BsdIp6statqueryIp6stat()private static InternetProtocolStats.IPConnectionqueryIPConnection(int pid, int fd)private static CLibrary.BsdIpstatqueryIpstat()private static CLibrary.BsdTcpstatqueryTcpstat()static CLibrary.BsdUdpstatqueryUdpstat()private static InternetProtocolStats.TcpStatestateLookup(int state)
-
-
-
Field Detail
-
isElevated
private boolean isElevated
-
establishedv4v6
private java.util.function.Supplier<Pair<java.lang.Long,java.lang.Long>> establishedv4v6
-
tcpstat
private java.util.function.Supplier<CLibrary.BsdTcpstat> tcpstat
-
udpstat
private java.util.function.Supplier<CLibrary.BsdUdpstat> udpstat
-
ipstat
private java.util.function.Supplier<CLibrary.BsdIpstat> ipstat
-
ip6stat
private java.util.function.Supplier<CLibrary.BsdIp6stat> ip6stat
-
-
Method Detail
-
getTCPv4Stats
public InternetProtocolStats.TcpStats getTCPv4Stats()
Description copied from interface:InternetProtocolStatsGet the TCP stats for IPv4 connections.On macOS connection information requires elevated permissions. Without elevatd permissions, segment data is estimated.
- Returns:
- a
InternetProtocolStats.TcpStatsobject encapsulating the stats.
-
getTCPv6Stats
public InternetProtocolStats.TcpStats getTCPv6Stats()
Description copied from interface:InternetProtocolStatsGet the TCP stats for IPv6 connections, if available. If not available separately, these may be 0 and included in IPv4 connections.- Specified by:
getTCPv6Statsin interfaceInternetProtocolStats- Overrides:
getTCPv6Statsin classAbstractInternetProtocolStats- Returns:
- a
InternetProtocolStats.TcpStatsobject encapsulating the stats.
-
getUDPv4Stats
public InternetProtocolStats.UdpStats getUDPv4Stats()
Description copied from interface:InternetProtocolStatsGet the UDP stats for IPv4 datagrams.- Returns:
- a
InternetProtocolStats.UdpStatsobject encapsulating the stats.
-
getUDPv6Stats
public InternetProtocolStats.UdpStats getUDPv6Stats()
Description copied from interface:InternetProtocolStatsGet the UDP stats for IPv6 datagrams, if available. If not available separately, these may be 0 and included in IPv4 datagrams.- Specified by:
getUDPv6Statsin interfaceInternetProtocolStats- Overrides:
getUDPv6Statsin classAbstractInternetProtocolStats- Returns:
- a
InternetProtocolStats.UdpStatsobject encapsulating the stats.
-
getConnections
public java.util.List<InternetProtocolStats.IPConnection> getConnections()
Description copied from interface:InternetProtocolStatsGets a list of TCP and UDP connections.- Specified by:
getConnectionsin interfaceInternetProtocolStats- Overrides:
getConnectionsin classAbstractInternetProtocolStats- Returns:
- A list of
InternetProtocolStats.IPConnectionobjects for TCP and UDP connections.
-
queryFdList
private static java.util.List<java.lang.Integer> queryFdList(int pid)
-
queryIPConnection
private static InternetProtocolStats.IPConnection queryIPConnection(int pid, int fd)
-
stateLookup
private static InternetProtocolStats.TcpState stateLookup(int state)
-
queryTcpstat
private static CLibrary.BsdTcpstat queryTcpstat()
-
queryIpstat
private static CLibrary.BsdIpstat queryIpstat()
-
queryIp6stat
private static CLibrary.BsdIp6stat queryIp6stat()
-
queryUdpstat
public static CLibrary.BsdUdpstat queryUdpstat()
-
-