Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@@ -1,315 +0,0 @@
2010-07-05 Gonzalo Paniagua Javier <gonzalo@novell.com>
* NetworkInterface.cs: avoid endless loop when a bad length is
received for AF_PACKET. Fixes bug #601783.
2010-06-22 Gonzalo Paniagua Javier <gonzalo@novell.com>
* Ping.cs: we need to read the output to give the process time
to start. Fixes bug #591136.
2010-03-25 Marek Safar <marek.safar@gmail.com>
* IPGlobalProperties.cs: Made Win32_IN6_ADDR verifiable.
2009-12-07 Carlos Alberto Cortez <calberto.cortez@gmail.com>
* Ping.cs: Try to detect the path to the bin command, since different
Unix systems store it in different places.
Fixes #519272.
2009-10-06 Gonzalo Paniagua Javier <gonzalo@novell.com>
* GatewayIPAddressInformationCollection.cs:
* IPInterfaceProperties.cs: implement GatewayAddresses for linux.
Original patch by Christoph von Wittich.
Fixes bug #544640.
2009-09-29 Gonzalo Paniagua Javier <gonzalo@novell.com>
* Ping.cs: fix the check for a time-out return value from 'ping'.
2009-09-24 Zoltan Varga <vargaz@gmail.com>
* LinuxNetworkInterfaceMarshal.cs: Add StructLayout attribute to structures, so
the aot compiler can generate PtrToStructure wrappers for them.
2009-09-19 Gonzalo Paniagua Javier <gonzalo@novell.com>
* Ping.cs: if we receive a packet that is ignored, adjust the
timeout. Fixes bug #538013.
2009-05-16 Miguel de Icaza <miguel@novell.com>
* Apply patch from Alex Shulgin
<alexander.shulgin@yessoftware.com> to support OSX in
NetworkInformation classes.
2009-05-03 Gonzalo Paniagua Javier <gonzalo@novell.com>
* Ping.cs: we just need the address(es), not a host entry. This avoids
querying the DNS server(s) when the target is an IP address.
2009-03-24 Gonzalo Paniagua Javier <gonzalo@novell.com>
* Ping.cs: MacOS has different arguments for ping.
Bug #486904 fixed.
2009-01-26 Christian Prochnow <cproch@seculogix.de>
* Ping.cs: ignore ICMP echo request packet in case we ping
localhost.
2009-01-11 Atsushi Enomoto <atsushi@ximian.com>
* NetworkInformationPermission.cs,
NetworkInformationPermissionAttribute.cs : implement some,
otherwise it blocks compilation.
2008-12-20 Gonzalo Paniagua Javier <gonzalo@novell.com>
* Ping.cs: use the new internal method in Socket to avoid having to
throw exceptions when there's a timeout.
2008-12-11 Gonzalo Paniagua Javier <gonzalo@novell.com>
* Ping.cs: close the socket in SendPrivileged. Use Buffer.BlockCopy
instead of Array.Copy. Return IPStatus.Unknown instead of throwing an
exception for unknown status codes received.
2008-11-29 Miguel De Icaza <miguel@novell.com>
* NetworkInterface.cs: Do not throw an exception when scanning
external kernel information that might cause problems. The
application should not crash just trying to fetch interfaces from
the system.
2008-11-20 Gonzalo Paniagua Javier <gonzalo@novell.com>
* Ping.cs: the time for the arguments of 'ping' is in seconds. Don't
read the output of running the command, since we trust the return
code.
2008-10-27 Atsushi Enomoto <atsushi@ximian.com>
* Ping.cs : use privileged mode for non-unix. On Windows there is
no /usr/bin/ping.
2008-10-04 Gonzalo Paniagua Javier <gonzalo@novell.com>
* NetworkInterface.cs: detect wireless 802.11 on linux.
2008-09-28 Gonzalo Paniagua Javier <gonzalo.mono@gmail.com>
* NetworkInterface.cs: special case for loopback interfaces so that
their a physical interface address is PhysicalInterfaceAddress.None.
Fixes bug #422118.
2008-08-15 Atsushi Enomoto <atsushi@ximian.com>
* IPInterfaceProperties.cs, UnicastIPAddressInformation.cs,
UnicastIPAddressInformationCollection.cs : fixed bug #416526, based
on the patch by Fredrik Kling. support UnicastIPAddressInformation
on win32.
2008-08-06 Atsushi Enomoto <atsushi@ximian.com>
* IPGlobalProperties.cs : fixed ToEndPoint() to not bork at
parsing IPv6 string. Fixed bug #410006.
2008-07-31 Jb Evain <jbevain@novell.com>
* NetworkInformationException.cs: cleanup for NET_2_1.
2008-07-17 Marek Habersack <mhabersack@novell.com>
* IPInterfaceProperties.cs: implemented UnicastAddresses
2008-07-14 Marek Habersack <mhabersack@novell.com>
* NetworkInterface.cs: implemented support for Linux. Parts
contributed by Eric Butler (eric@extremeboredom.net), thanks!
* GatewayIPAddressInformationCollection.cs,
IPInterfaceProperties.cs, IPAddressInformationCollection.cs: added
support for Linux. Patch contributed by Eric Butler
(eric@extremeboredom.net), thanks!
* IPv4InterfaceProperties.cs: implemented support for Linux.
* LinuxNetworkInterfaceMarshal.cs: added. Contains a set of
Linux-specific structures required for accessing the network
information. Patch contributed by Eric Butler
(eric@extremeboredom.net), thanks!
* MulticastIPAddressInformation.cs: added support for Linux
multicast information. Patch contributed by Eric Butler
(eric@extremeboredom.net), thanks!
* IPv4InterfaceStatistics.cs: use the parent IfacePath to get the
path to the interface description file.
* UnicastIPAddressInformation.cs: added stubs for
LinuxUnicastIPAddressInformation. Patch contributed by Eric Butler
(eric@extremeboredom.net), thanks!
* Ping.cs: Use /bin/ping when running as non-root user
(implementation by Jackson Harper <jaharper@novell.com>) or use
raw sockets if running as root or if the current process has the
CAP_NET_RAW Linux capability set while running as an unprivileged
user.
2008-03-07 Miguel de Icaza <miguel@novell.com>
* NetworkInterface.cs: Use GetFileSystemEntries, on some systems
the files do not appear to be symlinks, but directories.
2008-02-18 Miguel de Icaza <miguel@novell.com>
* IPv4InterfaceStatistics.cs: Implemented Linux support.
* NetworkInterface.cs: Implemented Linux support.
TODO: still missing GetIPProperties.
2007-10-23 Atsushi Enomoto <atsushi@ximian.com>
* Ping.cs : Do not call OnPingCompleted() at CancelAsync() it should
be called at RunWorkerCompleted. Simplified RunWorkerCompleted.
2007-09-29 Miguel de Icaza <miguel@novell.com>
* NetworkInterface.cs (GetAllNetworkInterfaces): return an empty
array instead of throwing an exception on operating systems where
we can not detect the network interfaces.
2007-09-07 Atsushi Enomoto <atsushi@ximian.com>
* IPGlobalProperties.cs : implemented properties on linux.
2007-09-06 Atsushi Enomoto <atsushi@ximian.com>
* Ping.cs, PingReply.cs, PingCompletedEventArgs.cs : implemented
in managed code.
2007-09-03 Atsushi Enomoto <atsushi@ximian.com>
* IPGlobalStatistics.cs : Mib-* class is nonpublic.
* Win32NetworkInterfaceMarshal.cs IPv4InterfaceProperties.cs
IPGlobalProperties.cs IPInterfaceProperties.cs
NetworkInterface.cs : move Win32NetworkInterfaceMarshal.FixedInfo to
Win32_FIXED_INFO.Instance and share it with Win32IPGlobalProperties.
Fixed GetUdp[6]Table() / GetTcp[6]Table() marshalling issue.
2007-08-29 Atsushi Enomoto <atsushi@ximian.com>
* NetworkInterface.cs,
IPv4InterfaceStatistics.cs
IPInterfaceProperties.cs
IPv4InterfaceProperties.cs
IPv6InterfaceProperties.cs
IPAddressCollection.cs
GatewayIPAddressInformation.cs
GatewayIPAddressInformationCollection.cs
IPAddressInformation.cs
IPAddressInformationCollection.cs
MulticastIPAddressInformation.cs
MulticastIPAddressInformationCollection.cs
UnicastIPAddressInformation.cs
UnicastIPAddressInformationCollection.cs
Win32NetworkInterfaceMarshal.cs (new) :
NetworkInterface implementation using Win32 API.
Not sure how MIB-based implementation (for Linux) is possible but
it will follow.
2007-08-27 Atsushi Enomoto <atsushi@ximian.com>
* IPGlobalProperties.cs : implemented remaining methods in
MibIPGlobalProperties. Support /usr/compat/linux/proc
for some BSD environment.
2007-08-27 Atsushi Enomoto <atsushi@ximian.com>
* IPGlobalProperties.cs, TcpStatistics.cs,
IPGlobalStatistics.cs, IcmpV4Statistics.cs,
IcmpV6Statistics.cs, UdpStatistics.cs :
and here is non-Windows version, based on /proc/net/snmp(6).
2007-08-27 Atsushi Enomoto <atsushi@ximian.com>
* IPGlobalProperties.cs, TcpConnectionInformation.cs,
TcpStatistics.cs, IPGlobalStatistics.cs, IcmpV4Statistics.cs,
IcmpV6Statistics.cs, UdpStatistics.cs :
initial implementation of IPGlobalProperties and its children
for Win32 API, mostly done. Non-Windows implementation should
follow.
2007-08-13 Alan McGovern <amcgovern@novell.com>
* PhysicalAddress.cs: Added patch for #82403 to fix some parsing
errors and a bug in .Equals()
2006-03-11 Miguel de Icaza <miguel@novell.com>
* NetworkChange.cs: Use pragmas to eliminate warnings from events
that we do not trigger yet.
This is a candidate for using Aaron's NetworkManager code. But
would make us depend on d-bus.
* NetworkInformationException.cs: Use error_code for ErrorCode,
instead of NativeErrorCode. Fixes warning.
2006-02-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* UnicastIPAddressInformation.cs:
* PingException.cs:
* TcpConnectionInformation.cs:
* IPv4InterfaceStatistics.cs:
* NetworkInformationException.cs:
* IPAddressInformation.cs:
* MulticastIPAddressInformationCollection.cs:
* TcpStatistics.cs:
* IPGlobalStatistics.cs:
* NetworkInformationPermission.cs:
* MulticastIPAddressInformation.cs:
* IcmpV4Statistics.cs:
* IcmpV6Statistics.cs:
* IPv4InterfaceProperties.cs:
* PhysicalAddress.cs:
* IPv6InterfaceProperties.cs:
* GatewayIPAddressInformationCollection.cs:
* ChangeLog: Modified file.
* UnicastIPAddressInformationCollection.cs:
* IPAddressCollection.cs:
* NetworkInformationPermissionAttribute.cs:
* Ping.cs:
* NetworkChange.cs:
* IPAddressInformationCollection.cs:
* UdpStatistics.cs:
* GatewayIPAddressInformation.cs:
* IPGlobalProperties.cs:
* IPInterfaceProperties.cs:
* NetworkInterface.cs: implemented or stubbed out.
2006-02-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* NetBiosNodeType.cs:
* IPStatus.cs:
* NetworkInterfaceType.cs:
* SuffixOrigin.cs:
* DuplicateAddressDetectionState.cs:
* NetworkInformationAccess.cs:
* OperationalStatus.cs:
* TcpState.cs:
* PingCompletedEventHandler.cs:
* NetworkInterfaceComponent.cs:
* NetworkAvailabilityChangedEventHandler.cs:
* NetworkAvailabilityEventArgs.cs:
* PrefixOrigin.cs:
* NetworkAddressChangedEventHandler.cs:
* PingCompletedEventArgs.cs:
* PingOptions.cs:
* PingReply.cs: all enums, all event handlers/args + 2 classes.

View File

@@ -1,37 +0,0 @@
//
// System.Net.NetworkInformation.DuplicateAddressDetectionState
//
// Author:
// Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.NetworkInformation {
public enum DuplicateAddressDetectionState {
Invalid,
Tentative,
Duplicate,
Deprecated,
Preferred
}
}

View File

@@ -1,52 +0,0 @@
//
// System.Net.NetworkInformation.GatewayIPAddressInformation
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@novell.com)
// Atsushi Enomoto (atsushi@ximian.com)
//
// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.NetworkInformation {
public abstract class GatewayIPAddressInformation {
protected GatewayIPAddressInformation ()
{
}
public abstract IPAddress Address { get; }
}
class GatewayIPAddressInformationImpl : GatewayIPAddressInformation
{
IPAddress address;
public GatewayIPAddressInformationImpl (IPAddress address)
{
this.address = address;
}
public override IPAddress Address {
get { return address; }
}
}
}

View File

@@ -1,156 +0,0 @@
//
// System.Net.NetworkInformation.GatewayIPAddressInformationCollection
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@novell.com)
// Atsushi Enomoto (atsushi@ximian.com)
//
// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace System.Net.NetworkInformation {
public class GatewayIPAddressInformationCollection : ICollection<GatewayIPAddressInformation>, IEnumerable<GatewayIPAddressInformation>, IEnumerable {
List<GatewayIPAddressInformation> list = new List<GatewayIPAddressInformation> ();
protected GatewayIPAddressInformationCollection ()
{
}
public virtual void Add (GatewayIPAddressInformation address)
{
if (IsReadOnly)
throw new NotSupportedException ("The collection is read-only.");
list.Add (address);
}
public virtual void Clear ()
{
if (IsReadOnly)
throw new NotSupportedException ("The collection is read-only.");
list.Clear ();
}
public virtual bool Contains (GatewayIPAddressInformation address)
{
return list.Contains (address);
}
public virtual void CopyTo (GatewayIPAddressInformation [] array, int offset)
{
list.CopyTo (array, offset);
}
public virtual IEnumerator<GatewayIPAddressInformation> GetEnumerator ()
{
return ((IEnumerable<GatewayIPAddressInformation>)list).GetEnumerator ();
}
public virtual bool Remove (GatewayIPAddressInformation address)
{
if (IsReadOnly)
throw new NotSupportedException ("The collection is read-only.");
return list.Remove (address);
}
IEnumerator IEnumerable.GetEnumerator ()
{
return list.GetEnumerator ();
}
public virtual int Count {
get { return list.Count; }
}
public virtual bool IsReadOnly {
get { return true; }
}
public virtual GatewayIPAddressInformation this [int index] {
get { return list [index]; }
}
}
#if !MOBILE
class Win32GatewayIPAddressInformationCollection : GatewayIPAddressInformationCollection
{
public static readonly Win32GatewayIPAddressInformationCollection Empty = new Win32GatewayIPAddressInformationCollection (true);
bool is_readonly;
private Win32GatewayIPAddressInformationCollection (bool isReadOnly)
{
this.is_readonly = isReadOnly;
}
public Win32GatewayIPAddressInformationCollection (params Win32_IP_ADDR_STRING [] al)
{
foreach (Win32_IP_ADDR_STRING a in al) {
if (String.IsNullOrEmpty (a.IpAddress))
continue;
Add (new GatewayIPAddressInformationImpl (IPAddress.Parse (a.IpAddress)));
AddSubsequently (a.Next);
}
is_readonly = true;
}
void AddSubsequently (IntPtr head)
{
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 (new GatewayIPAddressInformationImpl (IPAddress.Parse (a.IpAddress)));
}
}
public override bool IsReadOnly {
get { return is_readonly; }
}
}
#endif
class UnixGatewayIPAddressInformationCollection : GatewayIPAddressInformationCollection
{
public static readonly UnixGatewayIPAddressInformationCollection Empty = new UnixGatewayIPAddressInformationCollection (true);
bool is_readonly;
private UnixGatewayIPAddressInformationCollection (bool isReadOnly)
{
this.is_readonly = isReadOnly;
}
public UnixGatewayIPAddressInformationCollection (IPAddressCollection col)
{
foreach (IPAddress a in col)
Add (new GatewayIPAddressInformationImpl (a));
this.is_readonly = true;
}
public override bool IsReadOnly {
get { return is_readonly; }
}
}
}

View File

@@ -33,72 +33,6 @@ using System.Net;
using System.Runtime.InteropServices;
namespace System.Net.NetworkInformation {
public class IPAddressCollection : ICollection<IPAddress>, IEnumerable<IPAddress>, IEnumerable {
IList <IPAddress> list = new List<IPAddress> ();
protected internal IPAddressCollection ()
{
}
internal void SetReadOnly ()
{
if (!IsReadOnly)
list = ((List<IPAddress>) list).AsReadOnly ();
}
public virtual void Add (IPAddress address)
{
if (IsReadOnly)
throw new NotSupportedException ("The collection is read-only.");
list.Add (address);
}
public virtual void Clear ()
{
if (IsReadOnly)
throw new NotSupportedException ("The collection is read-only.");
list.Clear ();
}
public virtual bool Contains (IPAddress address)
{
return list.Contains (address);
}
public virtual void CopyTo (IPAddress [] array, int offset)
{
list.CopyTo (array, offset);
}
public virtual IEnumerator<IPAddress> GetEnumerator ()
{
return ((IEnumerable<IPAddress>)list).GetEnumerator ();
}
public virtual bool Remove (IPAddress address)
{
if (IsReadOnly)
throw new NotSupportedException ("The collection is read-only.");
return list.Remove (address);
}
IEnumerator IEnumerable.GetEnumerator ()
{
return list.GetEnumerator ();
}
public virtual int Count {
get { return list.Count; }
}
public virtual bool IsReadOnly {
get { return list.IsReadOnly; }
}
public virtual IPAddress this [int index] {
get { return list [index]; }
}
}
#if !MOBILE
class Win32IPAddressCollection : IPAddressCollection

View File

@@ -1,68 +0,0 @@
//
// System.Net.NetworkInformation.IPAddressInformation
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@novell.com)
// Atsushi Enomoto (atsushi@ximian.com)
//
// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Net.NetworkInformation {
public abstract class IPAddressInformation {
protected IPAddressInformation ()
{
}
public abstract IPAddress Address { get; }
public abstract bool IsDnsEligible { get; }
public abstract bool IsTransient { get; }
}
class IPAddressInformationImpl : IPAddressInformation
{
IPAddress address;
bool is_dns_eligible, is_transient;
public IPAddressInformationImpl (IPAddress address, bool isDnsEligible, bool isTransient)
{
this.address = address;
this.is_dns_eligible = isDnsEligible;
this.is_transient = isTransient;
}
public override IPAddress Address {
get { return address; }
}
public override bool IsDnsEligible {
get { return is_dns_eligible; }
}
[MonoTODO ("Always false on Linux")]
public override bool IsTransient {
get { return is_transient; }
}
}
}

View File

@@ -1,140 +0,0 @@
//
// System.Net.NetworkInformation.IPAddressInformationCollection
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@novell.com)
// Atsushi Enomoto (atsushi@ximian.com)
//
// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace System.Net.NetworkInformation {
public class IPAddressInformationCollection : ICollection<IPAddressInformation>, IEnumerable<IPAddressInformation>, IEnumerable {
List <IPAddressInformation> list = new List <IPAddressInformation> ();
internal IPAddressInformationCollection ()
{
}
public virtual void Add (IPAddressInformation address)
{
if (IsReadOnly)
throw new NotSupportedException ("The collection is read-only.");
list.Add (address);
}
public virtual void Clear ()
{
if (IsReadOnly)
throw new NotSupportedException ("The collection is read-only.");
list.Clear ();
}
public virtual bool Contains (IPAddressInformation address)
{
return list.Contains (address);
}
public virtual void CopyTo (IPAddressInformation [] array, int offset)
{
list.CopyTo (array, offset);
}
public virtual IEnumerator<IPAddressInformation> GetEnumerator ()
{
return ((IEnumerable<IPAddressInformation>)list).GetEnumerator ();
}
public virtual bool Remove (IPAddressInformation address)
{
if (IsReadOnly)
throw new NotSupportedException ("The collection is read-only.");
return list.Remove (address);
}
IEnumerator IEnumerable.GetEnumerator ()
{
return list.GetEnumerator ();
}
public virtual int Count {
get { return list.Count; }
}
public virtual bool IsReadOnly {
get { return true; }
}
public virtual IPAddressInformation this [int index] {
get { return list [index]; }
}
}
class IPAddressInformationImplCollection : IPAddressInformationCollection
{
public static readonly IPAddressInformationImplCollection Empty = new IPAddressInformationImplCollection (true);
bool is_readonly;
// for static methods
IPAddressInformationImplCollection (bool isReadOnly)
{
is_readonly = isReadOnly;
}
public override bool IsReadOnly {
get { return is_readonly; }
}
#if !MOBILE
public static IPAddressInformationCollection Win32FromAnycast (IntPtr ptr)
{
IPAddressInformationImplCollection c = new IPAddressInformationImplCollection (false);
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 (new IPAddressInformationImpl (
a.Address.GetIPAddress (),
a.LengthFlags.IsDnsEligible,
a.LengthFlags.IsTransient));
}
c.is_readonly = true;
return c;
}
#endif
public static IPAddressInformationImplCollection LinuxFromAnycast (IList<IPAddress> addresses)
{
IPAddressInformationImplCollection c = new IPAddressInformationImplCollection (false);
foreach (IPAddress address in addresses) {
c.Add (new IPAddressInformationImpl (address, false, false));
}
c.is_readonly = true;
return c;
}
}
}

View File

@@ -37,62 +37,6 @@ using System.Runtime.InteropServices;
using System.Text;
namespace System.Net.NetworkInformation {
public abstract class IPGlobalProperties {
protected IPGlobalProperties ()
{
}
public static IPGlobalProperties GetIPGlobalProperties ()
{
#if MONODROID
return new AndroidIPGlobalProperties ();
#elif MONOTOUCH || XAMMAC || MOBILE_STATIC
return new UnixIPGlobalProperties ();
#else
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 ();
}
#endif
}
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")]
@@ -343,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;
}
@@ -690,7 +634,7 @@ namespace System.Net.NetworkInformation {
}
public TcpConnectionInformation TcpInfo {
get { return new TcpConnectionInformationImpl (LocalEndPoint, RemoteEndPoint, State); }
get { return new SystemTcpConnectionInformation (LocalEndPoint, RemoteEndPoint, State); }
}
}
@@ -714,7 +658,7 @@ namespace System.Net.NetworkInformation {
}
public TcpConnectionInformation TcpInfo {
get { return new TcpConnectionInformationImpl (LocalEndPoint, RemoteEndPoint, State); }
get { return new SystemTcpConnectionInformation (LocalEndPoint, RemoteEndPoint, State); }
}
}

View File

@@ -31,35 +31,6 @@ using System.Globalization;
using System.Runtime.InteropServices;
namespace System.Net.NetworkInformation {
public abstract class IPGlobalStatistics {
protected IPGlobalStatistics ()
{
}
public abstract int DefaultTtl { get; }
public abstract bool ForwardingEnabled { get; }
public abstract int NumberOfInterfaces { get; }
public abstract int NumberOfIPAddresses { get; }
public abstract int NumberOfRoutes { get; }
public abstract long OutputPacketRequests { get; }
public abstract long OutputPacketRoutingDiscards { get; }
public abstract long OutputPacketsDiscarded { get; }
public abstract long OutputPacketsWithNoRoute { get; }
public abstract long PacketFragmentFailures { get; }
public abstract long PacketReassembliesRequired { get; }
public abstract long PacketReassemblyFailures { get; }
public abstract long PacketReassemblyTimeout { get; }
public abstract long PacketsFragmented { get; }
public abstract long PacketsReassembled { get; }
public abstract long ReceivedPackets { get; }
public abstract long ReceivedPacketsDelivered { get; }
public abstract long ReceivedPacketsDiscarded { get; }
public abstract long ReceivedPacketsForwarded { get; }
public abstract long ReceivedPacketsWithAddressErrors { get; }
public abstract long ReceivedPacketsWithHeadersErrors { get; }
public abstract long ReceivedPacketsWithUnknownProtocol { get; }
}
class MibIPGlobalStatistics : IPGlobalStatistics
{
StringDictionary dic;

View File

@@ -32,28 +32,9 @@ using System.IO;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;
namespace System.Net.NetworkInformation {
public abstract class IPInterfaceProperties {
protected IPInterfaceProperties ()
{
}
public abstract IPv4InterfaceProperties GetIPv4Properties ();
public abstract IPv6InterfaceProperties GetIPv6Properties ();
public abstract IPAddressInformationCollection AnycastAddresses { get; }
public abstract IPAddressCollection DhcpServerAddresses { get; }
public abstract IPAddressCollection DnsAddresses { get; }
public abstract string DnsSuffix { get; }
public abstract GatewayIPAddressInformationCollection GatewayAddresses { get; }
public abstract bool IsDnsEnabled { get; }
public abstract bool IsDynamicDnsEnabled { get; }
public abstract MulticastIPAddressInformationCollection MulticastAddresses { get; }
public abstract UnicastIPAddressInformationCollection UnicastAddresses { get; }
public abstract IPAddressCollection WinsServersAddresses { get; }
}
abstract class UnixIPInterfaceProperties : IPInterfaceProperties
{
protected IPv4InterfaceProperties ipv4iface_properties;
@@ -98,7 +79,7 @@ namespace System.Net.NetworkInformation {
try {
str = match.Groups ["address"].Value;
str = str.Trim ();
dns_servers.Add (IPAddress.Parse (str));
dns_servers.InternalAdd (IPAddress.Parse (str));
} catch {
}
} else {
@@ -112,22 +93,16 @@ namespace System.Net.NetworkInformation {
}
}
} catch {
} finally {
dns_servers.SetReadOnly ();
}
}
public override IPAddressInformationCollection AnycastAddresses {
get {
List<IPAddress> anycastAddresses = new List<IPAddress> ();
/* XXX:
var c = new IPAddressInformationCollection ();
foreach (IPAddress address in addresses) {
if (is_anycast_address (address)) {
anycastAddresses.Add (address);
}
c.InternalAdd (new SystemIPAddressInformation (address, false, false));
}
*/
return IPAddressInformationImplCollection.LinuxFromAnycast (anycastAddresses);
return c;
}
}
@@ -138,7 +113,6 @@ namespace System.Net.NetworkInformation {
// that all store their configuration differently.
// I'm not sure what to do here.
IPAddressCollection coll = new IPAddressCollection ();
coll.SetReadOnly ();
return coll;
}
}
@@ -173,37 +147,37 @@ namespace System.Net.NetworkInformation {
public override MulticastIPAddressInformationCollection MulticastAddresses {
get {
List<IPAddress> multicastAddresses = new List<IPAddress> ();
var multicastAddresses = new MulticastIPAddressInformationCollection ();
foreach (IPAddress address in addresses) {
byte[] addressBytes = address.GetAddressBytes ();
if (addressBytes[0] >= 224 && addressBytes[0] <= 239) {
multicastAddresses.Add (address);
multicastAddresses.InternalAdd (new SystemMulticastIPAddressInformation (new SystemIPAddressInformation (address, true, false)));
}
}
return MulticastIPAddressInformationImplCollection.LinuxFromList (multicastAddresses);
return multicastAddresses;
}
}
public override UnicastIPAddressInformationCollection UnicastAddresses {
get {
List<IPAddress> unicastAddresses = new List<IPAddress> ();
var unicastAddresses = new UnicastIPAddressInformationCollection ();
foreach (IPAddress address in addresses) {
switch (address.AddressFamily) {
case AddressFamily.InterNetwork:
byte top = address.GetAddressBytes () [0];
if (top >= 224 && top <= 239)
continue;
unicastAddresses.Add (address);
unicastAddresses.InternalAdd (new LinuxUnicastIPAddressInformation (address));
break;
case AddressFamily.InterNetworkV6:
if (address.IsIPv6Multicast)
continue;
unicastAddresses.Add (address);
unicastAddresses.InternalAdd (new LinuxUnicastIPAddressInformation (address));
break;
}
}
return UnicastIPAddressInformationImplCollection.LinuxFromList (unicastAddresses);
return unicastAddresses;
}
}
@@ -218,8 +192,6 @@ namespace System.Net.NetworkInformation {
class LinuxIPInterfaceProperties : UnixIPInterfaceProperties
{
IPAddressCollection gateways;
public LinuxIPInterfaceProperties (LinuxNetworkInterface iface, List <IPAddress> addresses)
: base (iface, addresses)
{
@@ -233,8 +205,9 @@ namespace System.Net.NetworkInformation {
return ipv4iface_properties;
}
void ParseRouteInfo (string iface)
IPAddressCollection ParseRouteInfo (string iface)
{
var col = new IPAddressCollection ();
try {
using (StreamReader reader = new StreamReader ("/proc/net/route")) {
string line;
@@ -255,31 +228,26 @@ namespace System.Net.NetworkInformation {
continue;
}
IPAddress ip = new IPAddress (ipbytes);
if (!ip.Equals (IPAddress.Any) && !gateways.Contains (ip))
gateways.Add (ip);
if (!ip.Equals (IPAddress.Any) && !col.Contains (ip))
col.InternalAdd (ip);
}
}
}
} catch {
}
return col;
}
public override GatewayIPAddressInformationCollection GatewayAddresses {
get {
gateways = new IPAddressCollection ();
ParseRouteInfo (this.iface.Name.ToString());
if (gateways.Count > 0)
return new UnixGatewayIPAddressInformationCollection (gateways);
else
return UnixGatewayIPAddressInformationCollection.Empty;
return SystemGatewayIPAddressInformation.ToGatewayIpAddressInformationCollection (ParseRouteInfo (this.iface.Name.ToString()));
}
}
}
class MacOsIPInterfaceProperties : UnixIPInterfaceProperties
{
IPAddressCollection gateways;
public MacOsIPInterfaceProperties (MacOsNetworkInterface iface, List <IPAddress> addresses)
: base (iface, addresses)
{
@@ -298,16 +266,16 @@ namespace System.Net.NetworkInformation {
public override GatewayIPAddressInformationCollection GatewayAddresses {
get {
gateways = new IPAddressCollection ();
var gateways = new IPAddressCollection ();
string[] gw_addrlist;
if (!ParseRouteInfo_internal (this.iface.Name.ToString(), out gw_addrlist))
return UnixGatewayIPAddressInformationCollection.Empty;
return new GatewayIPAddressInformationCollection ();
for(int i=0; i<gw_addrlist.Length; i++) {
try {
IPAddress ip = IPAddress.Parse(gw_addrlist[i]);
if (!ip.Equals (IPAddress.Any) && !gateways.Contains (ip))
gateways.Add (ip);
gateways.InternalAdd (ip);
} catch (ArgumentNullException) {
/* Ignore this, as the
* internal call might have
@@ -317,10 +285,7 @@ namespace System.Net.NetworkInformation {
}
}
if (gateways.Count > 0)
return new UnixGatewayIPAddressInformationCollection (gateways);
else
return UnixGatewayIPAddressInformationCollection.Empty;
return SystemGatewayIPAddressInformation.ToGatewayIpAddressInformationCollection (gateways);
}
}
}
@@ -351,7 +316,21 @@ namespace System.Net.NetworkInformation {
}
public override IPAddressInformationCollection AnycastAddresses {
get { return IPAddressInformationImplCollection.Win32FromAnycast (addr.FirstAnycastAddress); }
get { return Win32FromAnycast (addr.FirstAnycastAddress); }
}
static IPAddressInformationCollection Win32FromAnycast (IntPtr ptr)
{
var c = new IPAddressInformationCollection ();
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.InternalAdd (new SystemIPAddressInformation (
a.Address.GetIPAddress (),
a.LengthFlags.IsDnsEligible,
a.LengthFlags.IsTransient));
}
return c;
}
public override IPAddressCollection DhcpServerAddresses {
@@ -374,7 +353,26 @@ namespace System.Net.NetworkInformation {
get {
Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
// FIXME: should ipv6 DhcpServer be considered?
return v4info != null ? new Win32GatewayIPAddressInformationCollection (v4info.GatewayList) : Win32GatewayIPAddressInformationCollection.Empty;
var col = new GatewayIPAddressInformationCollection ();
if (v4info != null) {
var a = v4info.GatewayList;
if (!String.IsNullOrEmpty (a.IpAddress)) {
col.InternalAdd(new SystemGatewayIPAddressInformation(IPAddress.Parse (a.IpAddress)));
AddSubsequently (a.Next, col);
}
}
return col;
}
}
static void AddSubsequently (IntPtr head, GatewayIPAddressInformationCollection col)
{
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));
col.InternalAdd (new SystemGatewayIPAddressInformation (IPAddress.Parse (a.IpAddress)));
}
}
@@ -387,17 +385,42 @@ namespace System.Net.NetworkInformation {
}
public override MulticastIPAddressInformationCollection MulticastAddresses {
get { return MulticastIPAddressInformationImplCollection.Win32FromMulticast (addr.FirstMulticastAddress); }
get { return Win32FromMulticast (addr.FirstMulticastAddress); }
}
static MulticastIPAddressInformationCollection Win32FromMulticast (IntPtr ptr)
{
var c = new MulticastIPAddressInformationCollection ();
Win32_IP_ADAPTER_MULTICAST_ADDRESS a;
for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) {
a = (Win32_IP_ADAPTER_MULTICAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_MULTICAST_ADDRESS));
c.InternalAdd (new SystemMulticastIPAddressInformation (new SystemIPAddressInformation (
a.Address.GetIPAddress (),
a.LengthFlags.IsDnsEligible,
a.LengthFlags.IsTransient)));
}
return c;
}
public override UnicastIPAddressInformationCollection UnicastAddresses {
get {
Win32_IP_ADAPTER_INFO ai = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
// FIXME: should ipv6 DhcpServer be considered?
return ai != null ? UnicastIPAddressInformationImplCollection.Win32FromUnicast ((int) ai.Index, addr.FirstUnicastAddress) : UnicastIPAddressInformationImplCollection.Empty;
return ai != null ? Win32FromUnicast ((int) ai.Index, addr.FirstUnicastAddress) : new UnicastIPAddressInformationCollection ();
}
}
static UnicastIPAddressInformationCollection Win32FromUnicast (int ifIndex, IntPtr ptr)
{
UnicastIPAddressInformationCollection c = new UnicastIPAddressInformationCollection ();
Win32_IP_ADAPTER_UNICAST_ADDRESS a;
for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) {
a = (Win32_IP_ADAPTER_UNICAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_UNICAST_ADDRESS));
c.InternalAdd (new Win32UnicastIPAddressInformation (ifIndex, a));
}
return c;
}
public override IPAddressCollection WinsServersAddresses {
get {
Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
@@ -408,6 +431,7 @@ namespace System.Net.NetworkInformation {
}
#endif
}

View File

@@ -1,57 +0,0 @@
//
// System.Net.NetworkInformation.IPStatus
//
// Author:
// Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.NetworkInformation {
public enum IPStatus {
Unknown = -1,
Success = 0,
DestinationNetworkUnreachable = 11002,
DestinationHostUnreachable = 11003,
DestinationProhibited = 11004,
DestinationProtocolUnreachable = 11004,
DestinationPortUnreachable = 11005,
NoResources = 11006,
BadOption = 11007,
HardwareError = 11008,
PacketTooBig = 11009,
TimedOut = 11010,
BadRoute = 11012,
TtlExpired = 11013,
TtlReassemblyTimeExceeded = 11014,
ParameterProblem = 11015,
SourceQuench = 11016,
BadDestination = 11018,
DestinationUnreachable = 11040,
TimeExceeded = 11041,
BadHeader = 11042,
UnrecognizedNextHeader = 11043,
IcmpError = 11044,
DestinationScopeMismatch = 11045
}
}

View File

@@ -31,20 +31,6 @@ using System.IO;
using System.Runtime.InteropServices;
namespace System.Net.NetworkInformation {
public abstract class IPv4InterfaceProperties {
protected IPv4InterfaceProperties ()
{
}
public abstract int Index { get; }
public abstract bool IsAutomaticPrivateAddressingActive { get; }
public abstract bool IsAutomaticPrivateAddressingEnabled { get; }
public abstract bool IsDhcpEnabled { get; }
public abstract bool IsForwardingEnabled { get; }
public abstract int Mtu { get; }
public abstract bool UsesWins { get; }
}
abstract class UnixIPv4InterfaceProperties : IPv4InterfaceProperties
{
protected UnixNetworkInterface iface;

View File

@@ -27,14 +27,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.NetworkInformation {
public abstract class IPv6InterfaceProperties {
protected IPv6InterfaceProperties ()
{
}
public abstract int Index { get; }
public abstract int Mtu { get; }
}
#if !MOBILE
class Win32IPv6InterfaceProperties : IPv6InterfaceProperties
{

View File

@@ -30,39 +30,6 @@ using System.Collections.Specialized;
using System.Globalization;
namespace System.Net.NetworkInformation {
public abstract class IcmpV4Statistics {
protected IcmpV4Statistics ()
{
}
public abstract long AddressMaskRepliesReceived { get; }
public abstract long AddressMaskRepliesSent { get; }
public abstract long AddressMaskRequestsReceived { get; }
public abstract long AddressMaskRequestsSent { get; }
public abstract long DestinationUnreachableMessagesReceived { get; }
public abstract long DestinationUnreachableMessagesSent { get; }
public abstract long EchoRepliesReceived { get; }
public abstract long EchoRepliesSent { get; }
public abstract long EchoRequestsReceived { get; }
public abstract long EchoRequestsSent { get; }
public abstract long ErrorsReceived { get; }
public abstract long ErrorsSent { get; }
public abstract long MessagesReceived { get; }
public abstract long MessagesSent { get; }
public abstract long ParameterProblemsReceived { get; }
public abstract long ParameterProblemsSent { get; }
public abstract long RedirectsReceived { get; }
public abstract long RedirectsSent { get; }
public abstract long SourceQuenchesReceived { get; }
public abstract long SourceQuenchesSent { get; }
public abstract long TimeExceededMessagesReceived { get; }
public abstract long TimeExceededMessagesSent { get; }
public abstract long TimestampRepliesReceived { get; }
public abstract long TimestampRepliesSent { get; }
public abstract long TimestampRequestsReceived { get; }
public abstract long TimestampRequestsSent { get; }
}
class MibIcmpV4Statistics : IcmpV4Statistics
{
StringDictionary dic;

View File

@@ -31,45 +31,6 @@ using System.Globalization;
using System.Runtime.InteropServices;
namespace System.Net.NetworkInformation {
public abstract class IcmpV6Statistics {
protected IcmpV6Statistics ()
{
}
public abstract long DestinationUnreachableMessagesReceived { get; }
public abstract long DestinationUnreachableMessagesSent { get; }
public abstract long EchoRepliesReceived { get; }
public abstract long EchoRepliesSent { get; }
public abstract long EchoRequestsReceived { get; }
public abstract long EchoRequestsSent { get; }
public abstract long ErrorsReceived { get; }
public abstract long ErrorsSent { get; }
public abstract long MembershipQueriesReceived { get; }
public abstract long MembershipQueriesSent { get; }
public abstract long MembershipReductionsReceived { get; }
public abstract long MembershipReductionsSent { get; }
public abstract long MembershipReportsReceived { get; }
public abstract long MembershipReportsSent { get; }
public abstract long MessagesReceived { get; }
public abstract long MessagesSent { get; }
public abstract long NeighborAdvertisementsReceived { get; }
public abstract long NeighborAdvertisementsSent { get; }
public abstract long NeighborSolicitsReceived { get; }
public abstract long NeighborSolicitsSent { get; }
public abstract long PacketTooBigMessagesReceived { get; }
public abstract long PacketTooBigMessagesSent { get; }
public abstract long ParameterProblemsReceived { get; }
public abstract long ParameterProblemsSent { get; }
public abstract long RedirectsReceived { get; }
public abstract long RedirectsSent { get; }
public abstract long RouterAdvertisementsReceived { get; }
public abstract long RouterAdvertisementsSent { get; }
public abstract long RouterSolicitsReceived { get; }
public abstract long RouterSolicitsSent { get; }
public abstract long TimeExceededMessagesReceived { get; }
public abstract long TimeExceededMessagesSent { get; }
}
class MibIcmpV6Statistics : IcmpV6Statistics
{
StringDictionary dic;

View File

@@ -1,95 +0,0 @@
//
// System.Net.NetworkInformation.MulticastIPAddressInformation
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@novell.com)
// Atsushi Enomoto (atsushi@ximian.com)
//
// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
namespace System.Net.NetworkInformation {
public abstract class MulticastIPAddressInformation : IPAddressInformation {
protected MulticastIPAddressInformation ()
{
}
public abstract long AddressPreferredLifetime { get; }
public abstract long AddressValidLifetime { get; }
public abstract long DhcpLeaseLifetime { get; }
public abstract DuplicateAddressDetectionState DuplicateAddressDetectionState { get; }
public abstract PrefixOrigin PrefixOrigin { get; }
public abstract SuffixOrigin SuffixOrigin { get; }
}
// So, why are there many pointless members in the base class?
class MulticastIPAddressInformationImpl : MulticastIPAddressInformation
{
IPAddress address;
bool is_dns_eligible, is_transient;
public MulticastIPAddressInformationImpl (IPAddress address, bool isDnsEligible, bool isTransient)
{
this.address = address;
this.is_dns_eligible = isDnsEligible;
this.is_transient = isTransient;
}
public override IPAddress Address {
get { return address; }
}
public override bool IsDnsEligible {
get { return is_dns_eligible; }
}
public override bool IsTransient {
get { return is_transient; }
}
public override long AddressPreferredLifetime {
get { return 0; }
}
public override long AddressValidLifetime {
get { return 0; }
}
public override long DhcpLeaseLifetime {
get { return 0; }
}
public override DuplicateAddressDetectionState DuplicateAddressDetectionState {
get { return DuplicateAddressDetectionState.Invalid; }
}
public override PrefixOrigin PrefixOrigin {
get { return PrefixOrigin.Other; }
}
public override SuffixOrigin SuffixOrigin {
get { return SuffixOrigin.Other; }
}
}
}

View File

@@ -1,142 +0,0 @@
//
// System.Net.NetworkInformation.MulticastIPAddressInformationCollection
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@novell.com)
// Atsushi Enomoto (atsushi@ximian.com)
// Eric Butler (eric@extremeboredom.net)
//
// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace System.Net.NetworkInformation {
public class MulticastIPAddressInformationCollection : ICollection<MulticastIPAddressInformation>, IEnumerable<MulticastIPAddressInformation>, IEnumerable {
List<MulticastIPAddressInformation> list = new List<MulticastIPAddressInformation> ();
protected internal MulticastIPAddressInformationCollection ()
{
}
public virtual void Add (MulticastIPAddressInformation address)
{
if (IsReadOnly)
throw new NotSupportedException ("The collection is read-only.");
list.Add (address);
}
public virtual void Clear ()
{
if (IsReadOnly)
throw new NotSupportedException ("The collection is read-only.");
list.Clear ();
}
public virtual bool Contains (MulticastIPAddressInformation address)
{
return list.Contains (address);
}
public virtual void CopyTo (MulticastIPAddressInformation [] array, int offset)
{
list.CopyTo (array, offset);
}
public virtual IEnumerator<MulticastIPAddressInformation> GetEnumerator ()
{
return ((IEnumerable<MulticastIPAddressInformation>)list).GetEnumerator ();
}
public virtual bool Remove (MulticastIPAddressInformation address)
{
if (IsReadOnly)
throw new NotSupportedException ("The collection is read-only.");
return list.Remove (address);
}
IEnumerator IEnumerable.GetEnumerator ()
{
return list.GetEnumerator ();
}
public virtual int Count {
get { return list.Count; }
}
public virtual bool IsReadOnly {
get { return true; }
}
public virtual MulticastIPAddressInformation this [int index] {
get { return list [index]; }
}
}
class MulticastIPAddressInformationImplCollection : MulticastIPAddressInformationCollection
{
public static readonly MulticastIPAddressInformationImplCollection Empty = new MulticastIPAddressInformationImplCollection (true);
bool is_readonly;
// for static methods
MulticastIPAddressInformationImplCollection (bool isReadOnly)
{
is_readonly = isReadOnly;
}
public override bool IsReadOnly {
get { return is_readonly; }
}
#if !MOBILE
public static MulticastIPAddressInformationCollection Win32FromMulticast (IntPtr ptr)
{
MulticastIPAddressInformationImplCollection c = new MulticastIPAddressInformationImplCollection (false);
Win32_IP_ADAPTER_MULTICAST_ADDRESS a;
for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) {
a = (Win32_IP_ADAPTER_MULTICAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_MULTICAST_ADDRESS));
c.Add (new MulticastIPAddressInformationImpl (
a.Address.GetIPAddress (),
a.LengthFlags.IsDnsEligible,
a.LengthFlags.IsTransient));
}
c.is_readonly = true;
return c;
}
#endif
public static MulticastIPAddressInformationImplCollection LinuxFromList (List<IPAddress> addresses)
{
MulticastIPAddressInformationImplCollection c = new MulticastIPAddressInformationImplCollection (false);
foreach (IPAddress address in addresses) {
c.Add (new MulticastIPAddressInformationImpl (
address,
true,
false));
}
c.is_readonly = true;
return c;
}
}
}

View File

@@ -1,37 +0,0 @@
//
// System.Net.NetworkInformation.NetBiosNodeType
//
// Author:
// Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.NetworkInformation {
public enum NetBiosNodeType {
Unknown = 0,
Broadcast = 1,
Peer2Peer = 1 << 1,
Mixed = 1 << 2,
Hybrid = 1 << 3,
}
}

View File

@@ -1,31 +0,0 @@
//
// System.Net.NetworkInformation.NetworkAddressChangeEventHandler
//
// Author:
// Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.NetworkInformation {
public delegate void NetworkAddressChangedEventHandler (object sender, EventArgs e);
}

View File

@@ -1,31 +0,0 @@
//
// System.Net.NetworkInformation.NetworkAvailabilityChangedEventHandler
//
// Author:
// Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.NetworkInformation {
public delegate void NetworkAvailabilityChangedEventHandler (object sender, NetworkAvailabilityEventArgs e);
}

Some files were not shown because too many files have changed in this diff Show More