View Javadoc
1   /*
2    * Copyright 2020-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.software.common;
6   
7   import java.util.List;
8   
9   import oshi.driver.unix.NetStat;
10  import oshi.software.os.InternetProtocolStats;
11  
12  /**
13   * Common implementations for IP Stats
14   */
15  public abstract class AbstractInternetProtocolStats implements InternetProtocolStats {
16  
17      @Override
18      public TcpStats getTCPv6Stats() {
19          // Default when OS doesn't have separate TCPv6 stats
20          return new TcpStats(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L);
21      }
22  
23      @Override
24      public UdpStats getUDPv6Stats() {
25          // Default when OS doesn't have separate UDPv6 stats
26          return new UdpStats(0L, 0L, 0L, 0L);
27      }
28  
29      @Override
30      public List<IPConnection> getConnections() {
31          return NetStat.queryNetstat();
32      }
33  }