Merge pull request #2998 from lateralusX/jlorenss/win-x64-full-aot-support
[mono.git] / mcs / class / System / System.Net.NetworkInformation / IPGlobalProperties.cs
index 570b89625bcea4c1ce278ba276bb1585654f640c..be2d13b71c02383937747b08837e1de486198005 100644 (file)
@@ -4,6 +4,7 @@
 // Authors:
 //     Gonzalo Paniagua Javier (gonzalo@novell.com)
 //     Atsushi Enomoto (atsushi@ximian.com)
+//     Marek Safar (marek.safar@gmail.com)
 //
 // Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com)
 //
@@ -36,56 +37,6 @@ using System.Runtime.InteropServices;
 using System.Text;
 
 namespace System.Net.NetworkInformation {
-       public abstract class IPGlobalProperties {
-               protected IPGlobalProperties ()
-               {
-               }
-
-               public static IPGlobalProperties GetIPGlobalProperties ()
-               {
-                       switch (Environment.OSVersion.Platform) {
-                       case PlatformID.Unix:
-                               MibIPGlobalProperties impl = null;
-                               if (Directory.Exists (MibIPGlobalProperties.ProcDir)) {
-                                       impl = new MibIPGlobalProperties (MibIPGlobalProperties.ProcDir);
-                                       if (File.Exists (impl.StatisticsFile))
-                                               return impl;
-                               }
-                               if (Directory.Exists (MibIPGlobalProperties.CompatProcDir)) {
-                                       impl = new MibIPGlobalProperties (MibIPGlobalProperties.CompatProcDir);
-                                       if (File.Exists (impl.StatisticsFile))
-                                               return impl;
-                               }
-                               return new UnixIPGlobalProperties ();
-                       default:
-                               return new Win32IPGlobalProperties ();
-                       }
-               }
-
-               internal static IPGlobalProperties InternalGetIPGlobalProperties()
-               {
-                       return GetIPGlobalProperties ();
-               }
-
-               public abstract TcpConnectionInformation [] GetActiveTcpConnections ();
-               public abstract IPEndPoint [] GetActiveTcpListeners ();
-               public abstract IPEndPoint [] GetActiveUdpListeners ();
-               public abstract IcmpV4Statistics GetIcmpV4Statistics ();
-               public abstract IcmpV6Statistics GetIcmpV6Statistics ();
-               public abstract IPGlobalStatistics GetIPv4GlobalStatistics ();
-               public abstract IPGlobalStatistics GetIPv6GlobalStatistics ();
-               public abstract TcpStatistics GetTcpIPv4Statistics ();
-               public abstract TcpStatistics GetTcpIPv6Statistics ();
-               public abstract UdpStatistics GetUdpIPv4Statistics ();
-               public abstract UdpStatistics GetUdpIPv6Statistics ();
-
-               public abstract string DhcpScopeName { get; }
-               public abstract string DomainName { get; }
-               public abstract string HostName { get; }
-               public abstract bool IsWinsProxy { get; }
-               public abstract NetBiosNodeType NodeType { get; }
-       }
-
        abstract class CommonUnixIPGlobalProperties : IPGlobalProperties
        {
                [DllImport ("libc")]
@@ -185,6 +136,17 @@ namespace System.Net.NetworkInformation {
                }
        }
 
+#if MONODROID
+       sealed class AndroidIPGlobalProperties : UnixIPGlobalProperties
+       {
+               public override string DomainName {
+                       get {
+                               return String.Empty;
+                       }
+               }
+       }
+#endif
+
        // It expects /proc/net/snmp (or /usr/compat/linux/proc/net/snmp),
        // formatted like:
        // http://www.linuxdevcenter.com/linux/2000/11/16/example5.html
@@ -325,7 +287,7 @@ namespace System.Net.NetworkInformation {
                                IPEndPoint local = ToEndpoint (list [i] [1]);
                                IPEndPoint remote = ToEndpoint (list [i] [2]);
                                TcpState state = (TcpState) int.Parse (list [i] [3], NumberStyles.HexNumber);
-                               ret [i] = new TcpConnectionInformationImpl (local, remote, state);
+                               ret [i] = new SystemTcpConnectionInformation (local, remote, state);
                        }
                        return ret;
                }
@@ -389,6 +351,7 @@ namespace System.Net.NetworkInformation {
                }
        }
 
+#if !MOBILE
        class Win32IPGlobalProperties : IPGlobalProperties
        {
                public const int AF_INET = 2;
@@ -671,7 +634,7 @@ namespace System.Net.NetworkInformation {
                        }
 
                        public TcpConnectionInformation TcpInfo {
-                               get { return new TcpConnectionInformationImpl (LocalEndPoint, RemoteEndPoint, State); }
+                               get { return new SystemTcpConnectionInformation (LocalEndPoint, RemoteEndPoint, State); }
                        }
                }
 
@@ -695,7 +658,7 @@ namespace System.Net.NetworkInformation {
                        }
 
                        public TcpConnectionInformation TcpInfo {
-                               get { return new TcpConnectionInformationImpl (LocalEndPoint, RemoteEndPoint, State); }
+                               get { return new SystemTcpConnectionInformation (LocalEndPoint, RemoteEndPoint, State); }
                        }
                }
 
@@ -722,4 +685,5 @@ namespace System.Net.NetworkInformation {
                        }
                }
        }
+#endif
 }