Class MacInternetProtocolStats
java.lang.Object
oshi.software.common.AbstractInternetProtocolStats
oshi.software.common.os.mac.MacInternetProtocolStats
- All Implemented Interfaces:
InternetProtocolStats
Abstract base for the macOS InternetProtocolStats. The TCP/UDP statistics computation is shared; the JNA and FFM
subclasses read the
net.inet.*.stats sysctls into the
MacInternetProtocolStats.BsdTcpstat/MacInternetProtocolStats.BsdUdpstat/MacInternetProtocolStats.BsdIpstat/ MacInternetProtocolStats.BsdIp6stat carriers, and supply their own native
AbstractInternetProtocolStats.getConnections() implementation.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classSelected fields of the macOSip6statstructure.static final classSelected fields of the macOSipstatstructure.static final classSelected fields of the macOStcpstatstructure.static final classSelected fields of the macOSudpstatstructure.Nested classes/interfaces inherited from interface InternetProtocolStats
InternetProtocolStats.IPConnection, InternetProtocolStats.TcpState, InternetProtocolStats.TcpStats, InternetProtocolStats.UdpStatsModifier and TypeInterfaceDescriptionstatic final classEncapsulates information associated with an IP connection.static enumThe TCP connection state as described in RFC 793.static final classEncapsulates statistics associated with a TCP connection.static final classEncapsulates statistics associated with a UDP connection. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMacInternetProtocolStats(boolean elevated) Constructs a Mac InternetProtocolStats. -
Method Summary
Modifier and TypeMethodDescriptionGet the TCP stats for IPv4 connections.Get the TCP stats for IPv6 connections, if available.Get the UDP stats for IPv4 datagrams.Get the UDP stats for IPv6 datagrams, if available.protected abstract MacInternetProtocolStats.BsdIp6statReads thenet.inet6.ip6.statssysctl into a carrier.protected abstract MacInternetProtocolStats.BsdIpstatReads thenet.inet.ip.statssysctl into a carrier.protected abstract MacInternetProtocolStats.BsdTcpstatReads thenet.inet.tcp.statssysctl into a carrier.protected abstract MacInternetProtocolStats.BsdUdpstatReads thenet.inet.udp.statssysctl into a carrier.Methods inherited from class AbstractInternetProtocolStats
getConnectionsModifier and TypeMethodDescriptionGets a list of TCP and UDP connections.
-
Constructor Details
-
MacInternetProtocolStats
protected MacInternetProtocolStats(boolean elevated) Constructs a Mac InternetProtocolStats.- Parameters:
elevated- whether running with elevated permissions
-
-
Method Details
-
queryTcpstat
Reads thenet.inet.tcp.statssysctl into a carrier.- Returns:
- the TCP statistics
-
queryUdpstat
Reads thenet.inet.udp.statssysctl into a carrier.- Returns:
- the UDP statistics
-
queryIpstat
Reads thenet.inet.ip.statssysctl into a carrier.- Returns:
- the IP statistics
-
queryIp6stat
Reads thenet.inet6.ip6.statssysctl into a carrier.- Returns:
- the IPv6 statistics
-
getTCPv4Stats
Description copied from interface:InternetProtocolStatsGet the TCP stats for IPv4 connections.On macOS connection information requires elevated permissions. Without elevated permissions, segment data is estimated.
- Returns:
- a
InternetProtocolStats.TcpStatsobject encapsulating the stats.
-
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
Description copied from interface:InternetProtocolStatsGet the UDP stats for IPv4 datagrams.- Returns:
- a
InternetProtocolStats.UdpStatsobject encapsulating the stats.
-
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.
-