Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@ -34,13 +34,11 @@ using System.Runtime.InteropServices;
namespace System.Net.NetworkInformation {
#if !MOBILE
#if WIN_PLATFORM
class Win32IPAddressCollection : IPAddressCollection
{
public static readonly Win32IPAddressCollection Empty = new Win32IPAddressCollection (IntPtr.Zero);
bool is_readonly;
// for static methods
Win32IPAddressCollection ()
{
@ -50,7 +48,6 @@ namespace System.Net.NetworkInformation {
{
foreach (IntPtr head in heads)
AddSubsequentlyString (head);
is_readonly = true;
}
public Win32IPAddressCollection (params Win32_IP_ADDR_STRING [] al)
@ -58,10 +55,9 @@ namespace System.Net.NetworkInformation {
foreach (Win32_IP_ADDR_STRING a in al) {
if (String.IsNullOrEmpty (a.IpAddress))
continue;
Add (IPAddress.Parse (a.IpAddress));
InternalAdd (IPAddress.Parse (a.IpAddress));
AddSubsequentlyString (a.Next);
}
is_readonly = true;
}
public static Win32IPAddressCollection FromAnycast (IntPtr ptr)
@ -70,9 +66,8 @@ namespace System.Net.NetworkInformation {
Win32_IP_ADAPTER_ANYCAST_ADDRESS a;
for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) {
a = (Win32_IP_ADAPTER_ANYCAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_ANYCAST_ADDRESS));
c.Add (a.Address.GetIPAddress ());
c.InternalAdd (a.Address.GetIPAddress ());
}
c.is_readonly = true;
return c;
}
@ -84,9 +79,8 @@ namespace System.Net.NetworkInformation {
a = (Win32_IP_ADAPTER_DNS_SERVER_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_DNS_SERVER_ADDRESS));
// FIXME: It somehow fails here. Looks like there is something wrong.
//if (a.Address.Sockaddr == IntPtr.Zero) throw new Exception ("pointer " + p + " a.length " + a.Address.SockaddrLength);
c.Add (a.Address.GetIPAddress ());
c.InternalAdd (a.Address.GetIPAddress ());
}
c.is_readonly = true;
return c;
}
@ -95,13 +89,9 @@ namespace System.Net.NetworkInformation {
Win32_IP_ADDR_STRING a;
for (IntPtr p = head; p != IntPtr.Zero; p = a.Next) {
a = (Win32_IP_ADDR_STRING) Marshal.PtrToStructure (p, typeof (Win32_IP_ADDR_STRING));
Add (IPAddress.Parse (a.IpAddress));
InternalAdd (IPAddress.Parse (a.IpAddress));
}
}
public override bool IsReadOnly {
get { return is_readonly; }
}
}
#endif
}