using System; using System.Collections.Generic; using System.Net.Sockets; using System.Runtime.InteropServices; namespace System.Net.NetworkInformation { // Token: 0x02000164 RID: 356 internal class Win32IPGlobalProperties : IPGlobalProperties { // Token: 0x06000C0A RID: 3082 RVA: 0x00024B40 File Offset: 0x00022D40 private unsafe void FillTcpTable(out List tab4, out List tab6) { tab4 = new List(); int num = 0; Win32IPGlobalProperties.GetTcpTable(null, ref num, true); byte[] array = new byte[num]; Win32IPGlobalProperties.GetTcpTable(array, ref num, true); int num2 = Marshal.SizeOf(typeof(Win32IPGlobalProperties.Win32_MIB_TCPROW)); fixed (byte* ptr = (ref array != null && array.Length != 0 ? ref array[0] : ref *null)) { int num3 = Marshal.ReadInt32((IntPtr)((void*)ptr)); for (int i = 0; i < num3; i++) { Win32IPGlobalProperties.Win32_MIB_TCPROW win32_MIB_TCPROW = new Win32IPGlobalProperties.Win32_MIB_TCPROW(); Marshal.PtrToStructure((IntPtr)((void*)(ptr + i * num2 + 4)), win32_MIB_TCPROW); tab4.Add(win32_MIB_TCPROW); } } tab6 = new List(); if (Environment.OSVersion.Version.Major >= 6) { int num4 = 0; Win32IPGlobalProperties.GetTcp6Table(null, ref num4, true); byte[] array2 = new byte[num4]; Win32IPGlobalProperties.GetTcp6Table(array2, ref num4, true); int num5 = Marshal.SizeOf(typeof(Win32IPGlobalProperties.Win32_MIB_TCP6ROW)); fixed (byte* ptr2 = (ref array2 != null && array2.Length != 0 ? ref array2[0] : ref *null)) { int num6 = Marshal.ReadInt32((IntPtr)((void*)ptr2)); for (int j = 0; j < num6; j++) { Win32IPGlobalProperties.Win32_MIB_TCP6ROW win32_MIB_TCP6ROW = new Win32IPGlobalProperties.Win32_MIB_TCP6ROW(); Marshal.PtrToStructure((IntPtr)((void*)(ptr2 + j * num5 + 4)), win32_MIB_TCP6ROW); tab6.Add(win32_MIB_TCP6ROW); } } } } // Token: 0x06000C0B RID: 3083 RVA: 0x00024CA8 File Offset: 0x00022EA8 private bool IsListenerState(TcpState state) { switch (state) { case TcpState.Listen: case TcpState.SynSent: case TcpState.FinWait1: case TcpState.FinWait2: case TcpState.CloseWait: return true; } return false; } // Token: 0x06000C0C RID: 3084 RVA: 0x00024CE4 File Offset: 0x00022EE4 public override TcpConnectionInformation[] GetActiveTcpConnections() { List list = null; List list2 = null; this.FillTcpTable(out list, out list2); int count = list.Count; TcpConnectionInformation[] array = new TcpConnectionInformation[count + list2.Count]; for (int i = 0; i < count; i++) { array[i] = list[i].TcpInfo; } for (int j = 0; j < list2.Count; j++) { array[count + j] = list2[j].TcpInfo; } return array; } // Token: 0x06000C0D RID: 3085 RVA: 0x00024D6C File Offset: 0x00022F6C public override IPEndPoint[] GetActiveTcpListeners() { List list = null; List list2 = null; this.FillTcpTable(out list, out list2); List list3 = new List(); int i = 0; int count = list.Count; while (i < count) { if (this.IsListenerState(list[i].State)) { list3.Add(list[i].LocalEndPoint); } i++; } int j = 0; int count2 = list2.Count; while (j < count2) { if (this.IsListenerState(list2[j].State)) { list3.Add(list2[j].LocalEndPoint); } j++; } return list3.ToArray(); } // Token: 0x06000C0E RID: 3086 RVA: 0x00024E24 File Offset: 0x00023024 public unsafe override IPEndPoint[] GetActiveUdpListeners() { List list = new List(); int num = 0; Win32IPGlobalProperties.GetUdpTable(null, ref num, true); byte[] array = new byte[num]; Win32IPGlobalProperties.GetUdpTable(array, ref num, true); int num2 = Marshal.SizeOf(typeof(Win32IPGlobalProperties.Win32_MIB_UDPROW)); fixed (byte* ptr = (ref array != null && array.Length != 0 ? ref array[0] : ref *null)) { int num3 = Marshal.ReadInt32((IntPtr)((void*)ptr)); for (int i = 0; i < num3; i++) { Win32IPGlobalProperties.Win32_MIB_UDPROW win32_MIB_UDPROW = new Win32IPGlobalProperties.Win32_MIB_UDPROW(); Marshal.PtrToStructure((IntPtr)((void*)(ptr + i * num2 + 4)), win32_MIB_UDPROW); list.Add(win32_MIB_UDPROW.LocalEndPoint); } } if (Environment.OSVersion.Version.Major >= 6) { int num4 = 0; Win32IPGlobalProperties.GetUdp6Table(null, ref num4, true); byte[] array2 = new byte[num4]; Win32IPGlobalProperties.GetUdp6Table(array2, ref num4, true); int num5 = Marshal.SizeOf(typeof(Win32IPGlobalProperties.Win32_MIB_UDP6ROW)); fixed (byte* ptr2 = (ref array2 != null && array2.Length != 0 ? ref array2[0] : ref *null)) { int num6 = Marshal.ReadInt32((IntPtr)((void*)ptr2)); for (int j = 0; j < num6; j++) { Win32IPGlobalProperties.Win32_MIB_UDP6ROW win32_MIB_UDP6ROW = new Win32IPGlobalProperties.Win32_MIB_UDP6ROW(); Marshal.PtrToStructure((IntPtr)((void*)(ptr2 + j * num5 + 4)), win32_MIB_UDP6ROW); list.Add(win32_MIB_UDP6ROW.LocalEndPoint); } } } return list.ToArray(); } // Token: 0x06000C0F RID: 3087 RVA: 0x00024F9C File Offset: 0x0002319C public override IcmpV4Statistics GetIcmpV4Statistics() { if (!global::System.Net.Sockets.Socket.SupportsIPv4) { throw new NetworkInformationException(); } Win32_MIBICMPINFO win32_MIBICMPINFO; Win32IPGlobalProperties.GetIcmpStatistics(out win32_MIBICMPINFO, 2); return new Win32IcmpV4Statistics(win32_MIBICMPINFO); } // Token: 0x06000C10 RID: 3088 RVA: 0x00024FC8 File Offset: 0x000231C8 public override IcmpV6Statistics GetIcmpV6Statistics() { if (!global::System.Net.Sockets.Socket.OSSupportsIPv6) { throw new NetworkInformationException(); } Win32_MIB_ICMP_EX win32_MIB_ICMP_EX; Win32IPGlobalProperties.GetIcmpStatisticsEx(out win32_MIB_ICMP_EX, 23); return new Win32IcmpV6Statistics(win32_MIB_ICMP_EX); } // Token: 0x06000C11 RID: 3089 RVA: 0x00024FF8 File Offset: 0x000231F8 public override IPGlobalStatistics GetIPv4GlobalStatistics() { if (!global::System.Net.Sockets.Socket.SupportsIPv4) { throw new NetworkInformationException(); } Win32_MIB_IPSTATS win32_MIB_IPSTATS; Win32IPGlobalProperties.GetIPStatisticsEx(out win32_MIB_IPSTATS, 2); return new Win32IPGlobalStatistics(win32_MIB_IPSTATS); } // Token: 0x06000C12 RID: 3090 RVA: 0x00025024 File Offset: 0x00023224 public override IPGlobalStatistics GetIPv6GlobalStatistics() { if (!global::System.Net.Sockets.Socket.OSSupportsIPv6) { throw new NetworkInformationException(); } Win32_MIB_IPSTATS win32_MIB_IPSTATS; Win32IPGlobalProperties.GetIPStatisticsEx(out win32_MIB_IPSTATS, 23); return new Win32IPGlobalStatistics(win32_MIB_IPSTATS); } // Token: 0x06000C13 RID: 3091 RVA: 0x00025054 File Offset: 0x00023254 public override TcpStatistics GetTcpIPv4Statistics() { if (!global::System.Net.Sockets.Socket.SupportsIPv4) { throw new NetworkInformationException(); } Win32_MIB_TCPSTATS win32_MIB_TCPSTATS; Win32IPGlobalProperties.GetTcpStatisticsEx(out win32_MIB_TCPSTATS, 2); return new Win32TcpStatistics(win32_MIB_TCPSTATS); } // Token: 0x06000C14 RID: 3092 RVA: 0x00025080 File Offset: 0x00023280 public override TcpStatistics GetTcpIPv6Statistics() { if (!global::System.Net.Sockets.Socket.OSSupportsIPv6) { throw new NetworkInformationException(); } Win32_MIB_TCPSTATS win32_MIB_TCPSTATS; Win32IPGlobalProperties.GetTcpStatisticsEx(out win32_MIB_TCPSTATS, 23); return new Win32TcpStatistics(win32_MIB_TCPSTATS); } // Token: 0x06000C15 RID: 3093 RVA: 0x000250B0 File Offset: 0x000232B0 public override UdpStatistics GetUdpIPv4Statistics() { if (!global::System.Net.Sockets.Socket.SupportsIPv4) { throw new NetworkInformationException(); } Win32_MIB_UDPSTATS win32_MIB_UDPSTATS; Win32IPGlobalProperties.GetUdpStatisticsEx(out win32_MIB_UDPSTATS, 2); return new Win32UdpStatistics(win32_MIB_UDPSTATS); } // Token: 0x06000C16 RID: 3094 RVA: 0x000250DC File Offset: 0x000232DC public override UdpStatistics GetUdpIPv6Statistics() { if (!global::System.Net.Sockets.Socket.OSSupportsIPv6) { throw new NetworkInformationException(); } Win32_MIB_UDPSTATS win32_MIB_UDPSTATS; Win32IPGlobalProperties.GetUdpStatisticsEx(out win32_MIB_UDPSTATS, 23); return new Win32UdpStatistics(win32_MIB_UDPSTATS); } // Token: 0x17000308 RID: 776 // (get) Token: 0x06000C17 RID: 3095 RVA: 0x0002510C File Offset: 0x0002330C public override string DhcpScopeName { get { return Win32_FIXED_INFO.Instance.ScopeId; } } // Token: 0x17000309 RID: 777 // (get) Token: 0x06000C18 RID: 3096 RVA: 0x00025118 File Offset: 0x00023318 public override string DomainName { get { return Win32_FIXED_INFO.Instance.DomainName; } } // Token: 0x1700030A RID: 778 // (get) Token: 0x06000C19 RID: 3097 RVA: 0x00025124 File Offset: 0x00023324 public override string HostName { get { return Win32_FIXED_INFO.Instance.HostName; } } // Token: 0x1700030B RID: 779 // (get) Token: 0x06000C1A RID: 3098 RVA: 0x00025130 File Offset: 0x00023330 public override bool IsWinsProxy { get { return Win32_FIXED_INFO.Instance.EnableProxy != 0U; } } // Token: 0x1700030C RID: 780 // (get) Token: 0x06000C1B RID: 3099 RVA: 0x00025144 File Offset: 0x00023344 public override NetBiosNodeType NodeType { get { return Win32_FIXED_INFO.Instance.NodeType; } } // Token: 0x06000C1C RID: 3100 [DllImport("Iphlpapi.dll")] private static extern int GetTcpTable(byte[] pTcpTable, ref int pdwSize, bool bOrder); // Token: 0x06000C1D RID: 3101 [DllImport("Iphlpapi.dll")] private static extern int GetTcp6Table(byte[] TcpTable, ref int SizePointer, bool Order); // Token: 0x06000C1E RID: 3102 [DllImport("Iphlpapi.dll")] private static extern int GetUdpTable(byte[] pUdpTable, ref int pdwSize, bool bOrder); // Token: 0x06000C1F RID: 3103 [DllImport("Iphlpapi.dll")] private static extern int GetUdp6Table(byte[] Udp6Table, ref int SizePointer, bool Order); // Token: 0x06000C20 RID: 3104 [DllImport("Iphlpapi.dll")] private static extern int GetTcpStatisticsEx(out Win32_MIB_TCPSTATS pStats, int dwFamily); // Token: 0x06000C21 RID: 3105 [DllImport("Iphlpapi.dll")] private static extern int GetUdpStatisticsEx(out Win32_MIB_UDPSTATS pStats, int dwFamily); // Token: 0x06000C22 RID: 3106 [DllImport("Iphlpapi.dll")] private static extern int GetIcmpStatistics(out Win32_MIBICMPINFO pStats, int dwFamily); // Token: 0x06000C23 RID: 3107 [DllImport("Iphlpapi.dll")] private static extern int GetIcmpStatisticsEx(out Win32_MIB_ICMP_EX pStats, int dwFamily); // Token: 0x06000C24 RID: 3108 [DllImport("Iphlpapi.dll")] private static extern int GetIPStatisticsEx(out Win32_MIB_IPSTATS pStats, int dwFamily); // Token: 0x04000BAF RID: 2991 public const int AF_INET = 2; // Token: 0x04000BB0 RID: 2992 public const int AF_INET6 = 23; // Token: 0x02000165 RID: 357 [StructLayout(LayoutKind.Explicit)] private struct Win32_IN6_ADDR { // Token: 0x04000BB1 RID: 2993 [FieldOffset(0)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] Bytes; } // Token: 0x02000166 RID: 358 [StructLayout(LayoutKind.Sequential)] private class Win32_MIB_TCPROW { // Token: 0x1700030D RID: 781 // (get) Token: 0x06000C26 RID: 3110 RVA: 0x00025158 File Offset: 0x00023358 public IPEndPoint LocalEndPoint { get { return new IPEndPoint((long)((ulong)this.LocalAddr), this.LocalPort); } } // Token: 0x1700030E RID: 782 // (get) Token: 0x06000C27 RID: 3111 RVA: 0x0002516C File Offset: 0x0002336C public IPEndPoint RemoteEndPoint { get { return new IPEndPoint((long)((ulong)this.RemoteAddr), this.RemotePort); } } // Token: 0x1700030F RID: 783 // (get) Token: 0x06000C28 RID: 3112 RVA: 0x00025180 File Offset: 0x00023380 public TcpConnectionInformation TcpInfo { get { return new TcpConnectionInformationImpl(this.LocalEndPoint, this.RemoteEndPoint, this.State); } } // Token: 0x04000BB2 RID: 2994 public TcpState State; // Token: 0x04000BB3 RID: 2995 public uint LocalAddr; // Token: 0x04000BB4 RID: 2996 public int LocalPort; // Token: 0x04000BB5 RID: 2997 public uint RemoteAddr; // Token: 0x04000BB6 RID: 2998 public int RemotePort; } // Token: 0x02000167 RID: 359 [StructLayout(LayoutKind.Sequential)] private class Win32_MIB_TCP6ROW { // Token: 0x17000310 RID: 784 // (get) Token: 0x06000C2A RID: 3114 RVA: 0x000251A4 File Offset: 0x000233A4 public IPEndPoint LocalEndPoint { get { return new IPEndPoint(new IPAddress(this.LocalAddr.Bytes, (long)((ulong)this.LocalScopeId)), this.LocalPort); } } // Token: 0x17000311 RID: 785 // (get) Token: 0x06000C2B RID: 3115 RVA: 0x000251D4 File Offset: 0x000233D4 public IPEndPoint RemoteEndPoint { get { return new IPEndPoint(new IPAddress(this.RemoteAddr.Bytes, (long)((ulong)this.RemoteScopeId)), this.RemotePort); } } // Token: 0x17000312 RID: 786 // (get) Token: 0x06000C2C RID: 3116 RVA: 0x00025204 File Offset: 0x00023404 public TcpConnectionInformation TcpInfo { get { return new TcpConnectionInformationImpl(this.LocalEndPoint, this.RemoteEndPoint, this.State); } } // Token: 0x04000BB7 RID: 2999 public TcpState State; // Token: 0x04000BB8 RID: 3000 public Win32IPGlobalProperties.Win32_IN6_ADDR LocalAddr; // Token: 0x04000BB9 RID: 3001 public uint LocalScopeId; // Token: 0x04000BBA RID: 3002 public int LocalPort; // Token: 0x04000BBB RID: 3003 public Win32IPGlobalProperties.Win32_IN6_ADDR RemoteAddr; // Token: 0x04000BBC RID: 3004 public uint RemoteScopeId; // Token: 0x04000BBD RID: 3005 public int RemotePort; } // Token: 0x02000168 RID: 360 [StructLayout(LayoutKind.Sequential)] private class Win32_MIB_UDPROW { // Token: 0x17000313 RID: 787 // (get) Token: 0x06000C2E RID: 3118 RVA: 0x00025228 File Offset: 0x00023428 public IPEndPoint LocalEndPoint { get { return new IPEndPoint((long)((ulong)this.LocalAddr), this.LocalPort); } } // Token: 0x04000BBE RID: 3006 public uint LocalAddr; // Token: 0x04000BBF RID: 3007 public int LocalPort; } // Token: 0x02000169 RID: 361 [StructLayout(LayoutKind.Sequential)] private class Win32_MIB_UDP6ROW { // Token: 0x17000314 RID: 788 // (get) Token: 0x06000C30 RID: 3120 RVA: 0x00025244 File Offset: 0x00023444 public IPEndPoint LocalEndPoint { get { return new IPEndPoint(new IPAddress(this.LocalAddr.Bytes, (long)((ulong)this.LocalScopeId)), this.LocalPort); } } // Token: 0x04000BC0 RID: 3008 public Win32IPGlobalProperties.Win32_IN6_ADDR LocalAddr; // Token: 0x04000BC1 RID: 3009 public uint LocalScopeId; // Token: 0x04000BC2 RID: 3010 public int LocalPort; } } }