using System;
using System.IO;
using System.Runtime.InteropServices;
namespace System.Net.NetworkInformation
{
/// Provides configuration and statistical information for a network interface.
// Token: 0x020001A2 RID: 418
public abstract class NetworkInterface
{
// Token: 0x06000DE1 RID: 3553
[DllImport("libc")]
private static extern int uname(IntPtr buf);
/// Returns objects that describe the network interfaces on the local computer.
/// A array that contains objects that describe the available network interfaces, or an empty array if no interfaces are detected.
/// A Windows system function call failed.
///
///
///
///
///
///
// Token: 0x06000DE2 RID: 3554 RVA: 0x00026E24 File Offset: 0x00025024
[global::System.MonoTODO("Only works on Linux and Windows")]
public static NetworkInterface[] GetAllNetworkInterfaces()
{
if (NetworkInterface.runningOnUnix)
{
bool flag = false;
IntPtr intPtr = Marshal.AllocHGlobal(8192);
if (NetworkInterface.uname(intPtr) == 0)
{
string text = Marshal.PtrToStringAnsi(intPtr);
if (text == "Darwin")
{
flag = true;
}
}
Marshal.FreeHGlobal(intPtr);
try
{
if (flag)
{
return MacOsNetworkInterface.ImplGetAllNetworkInterfaces();
}
return LinuxNetworkInterface.ImplGetAllNetworkInterfaces();
}
catch (SystemException ex)
{
throw ex;
}
catch
{
return new NetworkInterface[0];
}
}
if (Environment.OSVersion.Version >= NetworkInterface.windowsVer51)
{
return Win32NetworkInterface2.ImplGetAllNetworkInterfaces();
}
return new NetworkInterface[0];
}
/// Indicates whether any network connection is available.
/// true if a network connection is available; otherwise, false.
// Token: 0x06000DE3 RID: 3555 RVA: 0x00026F0C File Offset: 0x0002510C
[global::System.MonoTODO("Always returns true")]
public static bool GetIsNetworkAvailable()
{
return true;
}
// Token: 0x06000DE4 RID: 3556 RVA: 0x00026F10 File Offset: 0x00025110
internal static string ReadLine(string path)
{
string text;
using (FileStream fileStream = File.OpenRead(path))
{
using (StreamReader streamReader = new StreamReader(fileStream))
{
text = streamReader.ReadLine();
}
}
return text;
}
/// Gets the index of the IPv4 loopback interface.
/// A that contains the index for the IPv4 loopback interface.
/// This property is not valid on computers running only Ipv6.
// Token: 0x17000483 RID: 1155
// (get) Token: 0x06000DE5 RID: 3557 RVA: 0x00026F90 File Offset: 0x00025190
[global::System.MonoTODO("Only works on Linux. Returns 0 on other systems.")]
public static int LoopbackInterfaceIndex
{
get
{
if (NetworkInterface.runningOnUnix)
{
try
{
return UnixNetworkInterface.IfNameToIndex("lo");
}
catch
{
return 0;
}
return 0;
}
return 0;
}
}
/// Returns an object that describes the configuration of this network interface.
/// An object that describes this network interface.
// Token: 0x06000DE6 RID: 3558
public abstract IPInterfaceProperties GetIPProperties();
/// Gets the IPv4 statistics.
/// An object.
// Token: 0x06000DE7 RID: 3559
public abstract IPv4InterfaceStatistics GetIPv4Statistics();
/// Returns the Media Access Control (MAC) or physical address for this adapter.
/// A object that contains the physical address.
// Token: 0x06000DE8 RID: 3560
public abstract PhysicalAddress GetPhysicalAddress();
/// Gets a value that indicates whether the interface supports the specified protocol.
/// true if the specified protocol is supported; otherwise, false.
/// A value.
// Token: 0x06000DE9 RID: 3561
public abstract bool Supports(NetworkInterfaceComponent networkInterfaceComponent);
/// Gets the description of the interface.
/// A that describes this interface.
// Token: 0x17000484 RID: 1156
// (get) Token: 0x06000DEA RID: 3562
public abstract string Description { get; }
/// Gets the identifier of the network adapter.
/// A that contains the identifier.
// Token: 0x17000485 RID: 1157
// (get) Token: 0x06000DEB RID: 3563
public abstract string Id { get; }
/// Gets a value that indicates whether the network interface is set to only receive data packets.
/// true if the interface only receives network traffic; otherwise, false.
/// This property is not valid on computers running operating systems earlier than Windows XP.
// Token: 0x17000486 RID: 1158
// (get) Token: 0x06000DEC RID: 3564
public abstract bool IsReceiveOnly { get; }
/// Gets the name of the network adapter.
/// A that contains the adapter name.
// Token: 0x17000487 RID: 1159
// (get) Token: 0x06000DED RID: 3565
public abstract string Name { get; }
/// Gets the interface type.
/// An value that specifies the network interface type.
// Token: 0x17000488 RID: 1160
// (get) Token: 0x06000DEE RID: 3566
public abstract NetworkInterfaceType NetworkInterfaceType { get; }
/// Gets the current operational state of the network connection.
/// One of the values.
// Token: 0x17000489 RID: 1161
// (get) Token: 0x06000DEF RID: 3567
public abstract OperationalStatus OperationalStatus { get; }
/// Gets the speed of the network interface.
/// A value that specifies the speed in bits per second.
// Token: 0x1700048A RID: 1162
// (get) Token: 0x06000DF0 RID: 3568
public abstract long Speed { get; }
/// Gets a value that indicates whether the network interface is enabled to receive multicast packets.
/// true if the interface receives multicast packets; otherwise, false.
/// This property is not valid on computers running operating systems earlier than Windows XP.
// Token: 0x1700048B RID: 1163
// (get) Token: 0x06000DF1 RID: 3569
public abstract bool SupportsMulticast { get; }
// Token: 0x04000C91 RID: 3217
private static Version windowsVer51 = new Version(5, 1);
// Token: 0x04000C92 RID: 3218
internal static readonly bool runningOnUnix = Environment.OSVersion.Platform == PlatformID.Unix;
}
}