+++ /dev/null
-//
-// 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
- }
-}
-
+++ /dev/null
-//
-// 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; }
- }
- }
-}
-
+++ /dev/null
-//
-// 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; }
- }
- }
-}
-
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
+++ /dev/null
-//
-// 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; }
- }
- }
-}
-
+++ /dev/null
-//
-// 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;
- }
- }
-}
-
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")]
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;
}
}
public TcpConnectionInformation TcpInfo {
- get { return new TcpConnectionInformationImpl (LocalEndPoint, RemoteEndPoint, State); }
+ get { return new SystemTcpConnectionInformation (LocalEndPoint, RemoteEndPoint, State); }
}
}
}
public TcpConnectionInformation TcpInfo {
- get { return new TcpConnectionInformationImpl (LocalEndPoint, RemoteEndPoint, State); }
+ get { return new SystemTcpConnectionInformation (LocalEndPoint, RemoteEndPoint, State); }
}
}
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;
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;
try {
str = match.Groups ["address"].Value;
str = str.Trim ();
- dns_servers.Add (IPAddress.Parse (str));
+ dns_servers.InternalAdd (IPAddress.Parse (str));
} catch {
}
} else {
}
}
} 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;
}
}
// that all store their configuration differently.
// I'm not sure what to do here.
IPAddressCollection coll = new IPAddressCollection ();
- coll.SetReadOnly ();
return coll;
}
}
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;
}
}
class LinuxIPInterfaceProperties : UnixIPInterfaceProperties
{
- IPAddressCollection gateways;
-
public LinuxIPInterfaceProperties (LinuxNetworkInterface iface, List <IPAddress> addresses)
: base (iface, addresses)
{
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;
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)
{
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
}
}
- if (gateways.Count > 0)
- return new UnixGatewayIPAddressInformationCollection (gateways);
- else
- return UnixGatewayIPAddressInformationCollection.Empty;
+ return SystemGatewayIPAddressInformation.ToGatewayIpAddressInformationCollection (gateways);
}
}
}
}
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 {
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)));
}
}
}
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.Add (new Win32UnicastIPAddressInformation (ifIndex, a));
+ }
+ return c;
+ }
+
public override IPAddressCollection WinsServersAddresses {
get {
Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
}
#endif
+
}
+++ /dev/null
-//
-// 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
- }
-}
-
-
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;
// 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
{
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;
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;
+++ /dev/null
-//
-// 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; }
- }
-
- }
-}
+++ /dev/null
-//
-// 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;
- }
- }
-}
+++ /dev/null
-//
-// 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,
- }
-}
-
+++ /dev/null
-//
-// 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);
-}
-
+++ /dev/null
-//
-// 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);
-}
+++ /dev/null
-//
-// System.Net.NetworkInformation.NetworkAvailabilityEventArgs
-//
-// 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.
-//
-using System;
-
-namespace System.Net.NetworkInformation {
- public class NetworkAvailabilityEventArgs : EventArgs {
- bool available;
-
- internal NetworkAvailabilityEventArgs (bool available)
- {
- this.available = available;
- }
-
- public bool IsAvailable {
- get { return available; }
- }
- }
-}
-
+++ /dev/null
-//
-// System.Net.NetworkInformation.NetworkInformationAccess
-//
-// 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.
-//
-using System;
-namespace System.Net.NetworkInformation {
- [Flags]
- public enum NetworkInformationAccess {
- None,
- Read,
- Ping = 4
- }
-}
-
+++ /dev/null
-//
-// System.Net.NetworkInformation.NetworkInformationException
-//
-// 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.
-//
-using System.ComponentModel;
-using System.Runtime.Serialization;
-
-namespace System.Net.NetworkInformation {
- [Serializable]
- public class NetworkInformationException
-#if !NET_2_1
- : Win32Exception
-#else
- : Exception
-#endif
- {
- int error_code;
-
- public NetworkInformationException ()
- {
- }
-
-#if !NET_2_1
- public NetworkInformationException (int errorCode) : base (errorCode)
- {
- }
-#else
- public NetworkInformationException (int errorCode)
- {
- error_code = errorCode;
- }
-#endif
-
-#if !NET_2_1
- protected NetworkInformationException (SerializationInfo info, StreamingContext context)
- : base (info, context)
- {
- error_code = info.GetInt32 ("ErrorCode");
- }
-#endif
-
- public
-#if !NET_2_1
- override
-#endif
- int ErrorCode {
- get { return error_code; }
- }
- }
-}
-
+++ /dev/null
-//
-// System.Net.NetworkInformation.NetworkInformationPermission
-//
-// 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.
-//
-using System;
-using System.Security;
-using System.Security.Permissions;
-
-namespace System.Net.NetworkInformation {
- [Serializable]
- public sealed class NetworkInformationPermission : CodeAccessPermission, IUnrestrictedPermission {
- private const int version = 1;
-
- [MonoTODO]
- public NetworkInformationPermission (PermissionState state)
- {
- }
-
- [MonoTODO]
- public NetworkInformationPermission (NetworkInformationAccess access)
- {
- }
-
- [MonoTODO]
- public void AddPermission (NetworkInformationAccess access)
- {
- }
-
- [MonoTODO]
- public override IPermission Copy ()
- {
- return null;
- }
-
- [MonoTODO]
- public override void FromXml (SecurityElement securityElement)
- {
- }
-
- [MonoTODO]
- public override IPermission Intersect (System.Security.IPermission target)
- {
- return null;
- }
-
- [MonoTODO]
- public override bool IsSubsetOf (IPermission target)
- {
- return false;
- }
-
- [MonoTODO]
- public bool IsUnrestricted ()
- {
- return false;
- }
-
- [MonoTODO]
- public override SecurityElement ToXml ()
- {
- SecurityElement se = PermissionHelper.Element (typeof (NetworkInformationPermission), version);
-
- // FIXME: add fields
-
- return se;
- }
-
- [MonoTODO]
- public override IPermission Union (IPermission target)
- {
- return null;
- }
-
- [MonoTODO]
- public NetworkInformationAccess Access {
- get { return 0; }
- }
- }
-}
-
+++ /dev/null
-//
-// System.Net.NetworkInformation.NetworkInformationPermissionAttribute
-//
-// 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.
-//
-using System;
-using System.Security;
-using System.Security.Permissions;
-
-namespace System.Net.NetworkInformation {
- [Serializable]
- [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
- public sealed class NetworkInformationPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute {
- string access;
-
- public NetworkInformationPermissionAttribute (SecurityAction action)
- : base (action)
- {
- }
-
- [MonoTODO ("verify implementation")]
- public override IPermission CreatePermission ()
- {
- NetworkInformationAccess a = NetworkInformationAccess.None;
- switch (Access) {
- case "Read":
- a = NetworkInformationAccess.Read;
- break;
- case "Full":
- a = NetworkInformationAccess.Read | NetworkInformationAccess.Ping;
- break;
- }
- return new NetworkInformationPermission (a);
- }
-
- public string Access {
- get { return access; }
- set {
- switch (access) {
- case "Read":
- case "Full":
- case "None":
- break;
- default:
- throw new ArgumentException ("Only 'Read', 'Full' and 'None' are allowed");
- }
- access = value;
- }
- }
- }
-}
-
using System.Globalization;
namespace System.Net.NetworkInformation {
- public abstract class NetworkInterface {
+ static class SystemNetworkInterface {
static readonly NetworkInterfaceFactory nif = NetworkInterfaceFactory.Create ();
- protected NetworkInterface ()
- {
- }
-
- public static NetworkInterface [] GetAllNetworkInterfaces ()
+ public static NetworkInterface [] GetNetworkInterfaces ()
{
try {
return nif.GetAllNetworkInterfaces ();
}
}
- [MonoTODO("Always returns true")]
- public static bool GetIsNetworkAvailable ()
+ public static bool InternalGetIsNetworkAvailable ()
{
+ // TODO:
return true;
}
-
- public static int LoopbackInterfaceIndex {
+
+ public static int InternalLoopbackInterfaceIndex {
get {
return nif.GetLoopbackInterfaceIndex ();
}
}
+ public static int InternalIPv6LoopbackInterfaceIndex {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
public static IPAddress GetNetMask (IPAddress address)
{
return nif.GetNetMask (address);
}
-
- public abstract IPInterfaceProperties GetIPProperties ();
- public abstract IPv4InterfaceStatistics GetIPv4Statistics ();
- public abstract PhysicalAddress GetPhysicalAddress ();
- public abstract bool Supports (NetworkInterfaceComponent networkInterfaceComponent);
-
- public abstract string Description { get; }
- public abstract string Id { get; }
- public abstract bool IsReceiveOnly { get; }
- public abstract string Name { get; }
- public abstract NetworkInterfaceType NetworkInterfaceType { get; }
- public abstract OperationalStatus OperationalStatus { get; }
- public abstract long Speed { get; }
- public abstract bool SupportsMulticast { get; }
}
abstract class NetworkInterfaceFactory
+++ /dev/null
-//
-// System.Net.NetworkInformation.NetworkInterfaceComponent
-//
-// 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.
-//
-using System;
-namespace System.Net.NetworkInformation {
- public enum NetworkInterfaceComponent {
- IPv4,
- IPv6
- }
-}
-
+++ /dev/null
-//
-// System.Net.NetworkInformation.NetworkInterfaceType
-//
-// 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.
-//
-using System;
-namespace System.Net.NetworkInformation {
- public enum NetworkInterfaceType {
- Unknown = 1,
- Ethernet = 6,
- TokenRing = 9,
- Fddi = 15,
- BasicIsdn = 20,
- PrimaryIsdn = 21,
- Ppp = 23,
- Loopback = 24,
- Ethernet3Megabit = 26,
- Slip = 28,
- Atm = 37,
- GenericModem = 48,
- FastEthernetT = 62,
- Isdn = 63,
- FastEthernetFx = 69,
- Wireless80211 = 71,
- AsymmetricDsl = 94,
- RateAdaptDsl = 95,
- SymmetricDsl = 96,
- VeryHighSpeedDsl = 97,
- IPOverAtm = 114,
- GigabitEthernet = 117,
- Tunnel = 131,
- MultiRateSymmetricDsl = 143,
- HighPerformanceSerialBus = 144
- }
-}
-
+++ /dev/null
-//
-// System.Net.NetworkInformation.OperationalStatus
-//
-// 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 OperationalStatus {
- Up = 1,
- Down = 2,
- Testing = 3,
- Unknown = 4,
- Dormant = 5,
- NotPresent = 6,
- LowerLayerDown = 7
- }
-}
-
+++ /dev/null
-//
-// System.Net.NetworkInformation.PhysicalAddress
-//
-// 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.
-//
-using System;
-using System.Text;
-using System.Globalization;
-
-namespace System.Net.NetworkInformation {
- public class PhysicalAddress {
- public static readonly PhysicalAddress None = new PhysicalAddress (new byte [0]);
- private const int numberOfBytes = 6;
- byte [] bytes;
-
- public PhysicalAddress (byte [] address)
- {
- this.bytes = address;
- }
-
- internal static PhysicalAddress ParseEthernet (string address)
- {
- if (address == null)
- return None;
-
- string [] blocks = address.Split (':');
- byte [] bytes = new byte [blocks.Length];
- int i = 0;
- foreach (string b in blocks){
- bytes [i++] = Byte.Parse (b, NumberStyles.HexNumber);
- }
- return new PhysicalAddress (bytes);
- }
-
- public static PhysicalAddress Parse (string address)
- {
- if (address == null)
- return None;
-
- if (address == string.Empty)
- throw new FormatException("An invalid physical address was specified.");
-
- string[] addrSplit = address.Split('-');
-
- if (addrSplit.Length == 1) {
- if (address.Length != numberOfBytes * 2)
- throw new FormatException("An invalid physical address was specified.");
-
- addrSplit = new string[numberOfBytes];
- for (int index = 0; index < addrSplit.Length; index++) {
- addrSplit[index] = address.Substring(index * 2, 2);
- }
- }
-
- if (addrSplit.Length == numberOfBytes) {
- foreach (string str in addrSplit)
- if (str.Length > 2)
- throw new FormatException("An invalid physical address was specified.");
- else if (str.Length < 2)
- throw new IndexOutOfRangeException("An invalid physical address was specified.");
- }
- else
- throw new FormatException("An invalid physical address was specified.");
-
- byte[] data = new byte[numberOfBytes];
- for (int i = 0; i < numberOfBytes; i++) {
- byte b = (byte)(GetValue(addrSplit[i][0]) << 4);
- b += GetValue(addrSplit[i][1]);
- data[i] = b;
- }
-
- return new PhysicalAddress (data);
- }
-
- static byte GetValue (char c)
- {
- if (c >= '0' && c <= '9')
- return (byte) (c - '0');
-
- if (c >= 'a' && c <= 'f')
- return (byte) (c - 'a' + 10);
-
- if (c >= 'A' && c <= 'F')
- return (byte) (c - 'A' + 10);
-
- throw new FormatException ("Invalid physical address.");
- }
-
- public override bool Equals (object comparand)
- {
- PhysicalAddress other = comparand as PhysicalAddress;
- if (other == null)
- return false;
-
- if (bytes.Length != other.bytes.Length)
- return false;
-
- for (int index = 0; index < bytes.Length; index++)
- if (bytes[index] != other.bytes[index])
- return false;
-
- return true;
- }
-
- public override int GetHashCode ()
- {
- return (bytes[5] << 8) ^ (bytes[4]) ^ (bytes[3] << 24) ^ (bytes[2] << 16) ^ (bytes[1] << 8) ^ (bytes[0]);
- }
-
- public byte [] GetAddressBytes ()
- {
- return bytes;
- }
-
- public override string ToString ()
- {
- if (bytes == null)
- return "";
-
- StringBuilder sb = new StringBuilder ();
- foreach (byte b in bytes)
- sb.AppendFormat("{0:X2}", b);
- return sb.ToString ();
- }
- }
-}
+++ /dev/null
-//
-// System.Net.NetworkInformation.PingException
-//
-// 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.
-//
-using System;
-using System.Collections;
-using System.Runtime.Serialization;
-
-namespace System.Net.NetworkInformation {
- [Serializable]
- public class PingException : InvalidOperationException {
- public PingException (string message)
- : base (message)
- {
- }
-
- public PingException (string message, Exception innerException)
- : base (message, innerException)
- {
- }
-
- protected PingException (SerializationInfo serializationInfo, StreamingContext streamingContext)
- : base (serializationInfo, streamingContext)
- {
- }
-
- }
-}
-
+++ /dev/null
-//
-// System.Net.NetworkInformation.PingOptions
-//
-// 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 class PingOptions {
- int ttl = 128;
- bool dont_fragment;
-
- public PingOptions ()
- {
- }
-
- public PingOptions (int ttl, bool dontFragment)
- {
- if (ttl <= 0)
- throw new ArgumentOutOfRangeException ("Must be greater than zero.", "ttl");
- this.ttl = ttl;
- this.dont_fragment = dontFragment;
- }
-
- public bool DontFragment {
- get { return dont_fragment; }
- set { dont_fragment = value; }
- }
-
- public int Ttl {
- get { return ttl; }
- set { ttl = value; }
- }
- }
-}
-
+++ /dev/null
-//
-// System.Net.NetworkInformation.PingReply
-//
-// 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 class PingReply {
- IPAddress address;
- byte [] buffer;
- PingOptions options;
- long rtt;
- IPStatus status;
-
- internal PingReply (IPAddress address, byte [] buffer, PingOptions options, long roundtripTime, IPStatus status)
- {
- this.address = address;
- this.buffer = buffer;
- this.options = options;
- this.rtt = roundtripTime;
- this.status = status;
- }
-
- public IPAddress Address {
- get { return address; }
- }
-
- public byte [] Buffer {
- get { return buffer; }
- }
-
- public PingOptions Options {
- get { return options; }
- }
-
- public long RoundtripTime {
- get { return rtt; }
- }
-
- public IPStatus Status {
- get { return status; }
- }
- }
-}
-
+++ /dev/null
-//
-// System.Net.NetworkInformation.PrefixOrigin
-//
-// 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 PrefixOrigin {
- Other = 0,
- Manual = 1,
- WellKnown = 2,
- Dhcp = 3,
- RouterAdvertisement = 4
- }
-}
-
+++ /dev/null
-//
-// System.Net.NetworkInformation.SuffixOrigin
-//
-// 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 SuffixOrigin {
- Other = 0,
- Manual = 1,
- WellKnown = 2,
- OriginDhcp = 3,
- LinkLayerAddress = 4,
- Random = 5
- }
-}
-
+++ /dev/null
-//
-// System.Net.NetworkInformation.TcpConnectionInformation
-//
-// 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.Net;
-
-namespace System.Net.NetworkInformation {
- public abstract class TcpConnectionInformation {
- protected TcpConnectionInformation ()
- {
- }
-
- public abstract IPEndPoint LocalEndPoint { get; }
- public abstract IPEndPoint RemoteEndPoint { get; }
- public abstract TcpState State { get; }
- }
-
- class TcpConnectionInformationImpl : TcpConnectionInformation
- {
- IPEndPoint local;
- IPEndPoint remote;
- TcpState state;
-
- public TcpConnectionInformationImpl (IPEndPoint local, IPEndPoint remote, TcpState state)
- {
- this.local = local;
- this.remote = remote;
- this.state = state;
- }
-
- public override IPEndPoint LocalEndPoint {
- get { return local; }
- }
- public override IPEndPoint RemoteEndPoint {
- get { return remote; }
- }
- public override TcpState State {
- get { return state; }
- }
- }
-}
-
+++ /dev/null
-//
-// System.Net.NetworkInformation.TcpState
-//
-// 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 TcpState {
- Unknown = 0,
- Closed = 1,
- Listen = 2,
- SynSent = 3,
- SynReceived = 4,
- Established = 5,
- FinWait1 = 6,
- FinWait2 = 7,
- CloseWait = 8,
- Closing = 9,
- LastAck = 10,
- TimeWait = 11,
- DeleteTcb = 12
- }
-}
-
using System.Globalization;
namespace System.Net.NetworkInformation {
- public abstract class TcpStatistics {
- protected TcpStatistics ()
- {
- }
-
- public abstract long ConnectionsAccepted { get; }
- public abstract long ConnectionsInitiated { get; }
- public abstract long CumulativeConnections { get; }
- public abstract long CurrentConnections { get; }
- public abstract long ErrorsReceived { get; }
- public abstract long FailedConnectionAttempts { get; }
- public abstract long MaximumConnections { get; }
- public abstract long MaximumTransmissionTimeout { get; }
- public abstract long MinimumTransmissionTimeout { get; }
- public abstract long ResetConnections { get; }
- public abstract long ResetsSent { get; }
- public abstract long SegmentsReceived { get; }
- public abstract long SegmentsResent { get; }
- public abstract long SegmentsSent { get; }
- }
-
class MibTcpStatistics : TcpStatistics
{
StringDictionary dic;
using System.Globalization;
namespace System.Net.NetworkInformation {
- public abstract class UdpStatistics {
- protected UdpStatistics ()
- {
- }
-
- public abstract long DatagramsReceived { get; }
- public abstract long DatagramsSent { get; }
- public abstract long IncomingDatagramsDiscarded { get; }
- public abstract long IncomingDatagramsWithErrors { get; }
- public abstract int UdpListeners { get; }
- }
-
class MibUdpStatistics : UdpStatistics
{
StringDictionary dic;
return IPAddress.Any;
if (ipv4Mask == null)
- ipv4Mask = NetworkInterface.GetNetMask (address);
+ ipv4Mask = SystemNetworkInterface.GetNetMask (address);
return ipv4Mask;
}
+++ /dev/null
-//
-// System.Net.NetworkInformation.UnicastIPAddressInformationCollection
-//
-// 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 UnicastIPAddressInformationCollection : ICollection<UnicastIPAddressInformation>,
- IEnumerable<UnicastIPAddressInformation> {
-
- List<UnicastIPAddressInformation> list = new List<UnicastIPAddressInformation> ();
-
- protected internal UnicastIPAddressInformationCollection ()
- {
- }
-
- public virtual void Add (UnicastIPAddressInformation 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 (UnicastIPAddressInformation address)
- {
- return list.Contains (address);
- }
-
- public virtual void CopyTo (UnicastIPAddressInformation [] array, int offset)
- {
- list.CopyTo (array, offset);
- }
-
- public virtual IEnumerator<UnicastIPAddressInformation> GetEnumerator ()
- {
- return ((IEnumerable<UnicastIPAddressInformation>)list).GetEnumerator ();
- }
-
- public virtual bool Remove (UnicastIPAddressInformation 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 UnicastIPAddressInformation this [int index] {
- get { return list [index]; }
- }
- }
-
- class UnicastIPAddressInformationImplCollection : UnicastIPAddressInformationCollection
- {
- public static readonly UnicastIPAddressInformationImplCollection Empty = new UnicastIPAddressInformationImplCollection (true);
-
- bool is_readonly;
-
- // for static methods
- UnicastIPAddressInformationImplCollection (bool isReadOnly)
- {
- is_readonly = isReadOnly;
- }
-
- public override bool IsReadOnly {
- get { return is_readonly; }
- }
-
-#if !MOBILE
- public static UnicastIPAddressInformationCollection Win32FromUnicast (int ifIndex, IntPtr ptr)
- {
- UnicastIPAddressInformationImplCollection c = new UnicastIPAddressInformationImplCollection (false);
- 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.Add (new Win32UnicastIPAddressInformation (ifIndex, a));
- }
- c.is_readonly = true;
- return c;
- }
-#endif
-
- public static UnicastIPAddressInformationCollection LinuxFromList (List<IPAddress> addresses)
- {
- UnicastIPAddressInformationImplCollection c = new UnicastIPAddressInformationImplCollection (false);
- foreach (IPAddress address in addresses) {
- c.Add (new LinuxUnicastIPAddressInformation (address));
- }
- c.is_readonly = true;
- return c;
- }
- }
-}
-
System.Net/MonoHttpDate.cs
System.Net/NetConfig.cs
System.Net/NetworkCredential.cs
-System.Net.NetworkInformation/DuplicateAddressDetectionState.cs
-System.Net.NetworkInformation/GatewayIPAddressInformationCollection.cs
-System.Net.NetworkInformation/GatewayIPAddressInformation.cs
System.Net.NetworkInformation/IcmpV4Statistics.cs
System.Net.NetworkInformation/IcmpV6Statistics.cs
System.Net.NetworkInformation/IPAddressCollection.cs
-System.Net.NetworkInformation/IPAddressInformationCollection.cs
-System.Net.NetworkInformation/IPAddressInformation.cs
System.Net.NetworkInformation/IPGlobalProperties.cs
System.Net.NetworkInformation/IPGlobalStatistics.cs
System.Net.NetworkInformation/IPInterfaceProperties.cs
-System.Net.NetworkInformation/IPStatus.cs
System.Net.NetworkInformation/IPv4InterfaceProperties.cs
System.Net.NetworkInformation/IPv4InterfaceStatistics.cs
System.Net.NetworkInformation/IPv6InterfaceProperties.cs
System.Net.NetworkInformation/LinuxNetworkInterfaceMarshal.cs
System.Net.NetworkInformation/MacOsNetworkInterfaceMarshal.cs
-System.Net.NetworkInformation/MulticastIPAddressInformationCollection.cs
-System.Net.NetworkInformation/MulticastIPAddressInformation.cs
-System.Net.NetworkInformation/NetBiosNodeType.cs
-System.Net.NetworkInformation/NetworkAddressChangedEventHandler.cs
-System.Net.NetworkInformation/NetworkAvailabilityChangedEventHandler.cs
-System.Net.NetworkInformation/NetworkAvailabilityEventArgs.cs
System.Net.NetworkInformation/NetworkChange.cs
-System.Net.NetworkInformation/NetworkInformationAccess.cs
-System.Net.NetworkInformation/NetworkInformationException.cs
-System.Net.NetworkInformation/NetworkInformationPermissionAttribute.cs
-System.Net.NetworkInformation/NetworkInformationPermission.cs
-System.Net.NetworkInformation/NetworkInterfaceComponent.cs
System.Net.NetworkInformation/NetworkInterface.cs
-System.Net.NetworkInformation/NetworkInterfaceType.cs
-System.Net.NetworkInformation/OperationalStatus.cs
-System.Net.NetworkInformation/PhysicalAddress.cs
System.Net.NetworkInformation/PingCompletedEventArgs.cs
System.Net.NetworkInformation/PingCompletedEventHandler.cs
System.Net.NetworkInformation/Ping.cs
-System.Net.NetworkInformation/PingException.cs
-System.Net.NetworkInformation/PingOptions.cs
-System.Net.NetworkInformation/PingReply.cs
-System.Net.NetworkInformation/PrefixOrigin.cs
-System.Net.NetworkInformation/SuffixOrigin.cs
-System.Net.NetworkInformation/TcpConnectionInformation.cs
-System.Net.NetworkInformation/TcpState.cs
System.Net.NetworkInformation/TcpStatistics.cs
System.Net.NetworkInformation/UdpStatistics.cs
-System.Net.NetworkInformation/UnicastIPAddressInformationCollection.cs
System.Net.NetworkInformation/UnicastIPAddressInformation.cs
System.Net.NetworkInformation/Win32NetworkInterfaceMarshal.cs
System.Net/NtlmClient.cs
../referencesource/System/net/System/Net/Sockets/IPProtectionLevel.cs
../referencesource/System/net/System/Net/Sockets/NetworkStream.cs
+../referencesource/System/net/System/Net/NetworkInformation/DuplicateAddressDetectionState.cs
+../referencesource/System/net/System/Net/NetworkInformation/GatewayIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/GatewayIPAddressInformationCollection.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPAddressCollection.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPAddressInformationCollection.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPGlobalProperties.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPGlobalStatistics.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPInterfaceProperties.cs
../referencesource/System/net/System/Net/NetworkInformation/IPInterfaceStatistics.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPStatus.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPv4InterfaceProperties.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPv6InterfaceProperties.cs
+../referencesource/System/net/System/Net/NetworkInformation/IcmpV4Statistics.cs
+../referencesource/System/net/System/Net/NetworkInformation/IcmpV6Statistics.cs
+../referencesource/System/net/System/Net/NetworkInformation/MulticastIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/MulticastIPAddressInformationCollection.cs
+../referencesource/System/net/System/Net/NetworkInformation/NetworkAddressChange.cs
+../referencesource/System/net/System/Net/NetworkInformation/NetworkInformationException.cs
+../referencesource/System/net/System/Net/NetworkInformation/NetworkInformationPermission.cs
+../referencesource/System/net/System/Net/NetworkInformation/NetworkInterface.cs
+../referencesource/System/net/System/Net/NetworkInformation/NetworkInterfaceComponent.cs
+../referencesource/System/net/System/Net/NetworkInformation/OperationalStatus.cs
+../referencesource/System/net/System/Net/NetworkInformation/PhysicalAddress.cs
+../referencesource/System/net/System/Net/NetworkInformation/PingOptions.cs
+../referencesource/System/net/System/Net/NetworkInformation/PingReply.cs
+../referencesource/System/net/System/Net/NetworkInformation/PrefixOrigin.cs
../referencesource/System/net/System/Net/NetworkInformation/ScopeLevel.cs
+../referencesource/System/net/System/Net/NetworkInformation/SuffixOrigin.cs
+../referencesource/System/net/System/Net/NetworkInformation/SystemGatewayIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/SystemIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/SystemMulticastIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/SystemUnicastIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/SystemTcpConnection.cs
+../referencesource/System/net/System/Net/NetworkInformation/TcpConnection.cs
+../referencesource/System/net/System/Net/NetworkInformation/TcpState.cs
+../referencesource/System/net/System/Net/NetworkInformation/TcpStatistics.cs
+../referencesource/System/net/System/Net/NetworkInformation/UdpStatistics.cs
../referencesource/System/net/System/Net/NetworkInformation/UnicastIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/UnicastIPAddressInformationCollection.cs
+../referencesource/System/net/System/Net/NetworkInformation/interfacetype.cs
+../referencesource/System/net/System/Net/NetworkInformation/nodetype.cs
+../referencesource/System/net/System/Net/NetworkInformation/pingexception.cs
../referencesource/System/sys/system/runtime/interopservices/DefaultParameterValueAttribute.cs
../referencesource/System/sys/system/runtime/interopservices/handlecollector.cs
../referencesource/System/net/System/Net/mail/TransferEncoding.cs
../referencesource/System/net/System/Net/mail/WriteStateInfoBase.cs
../referencesource/System/net/System/Net/mail/mediatypenames.cs
-System.Net.NetworkInformation/DuplicateAddressDetectionState.cs
-System.Net.NetworkInformation/GatewayIPAddressInformation.cs
-System.Net.NetworkInformation/GatewayIPAddressInformationCollection.cs
+System.Net.NetworkInformation/IcmpV4Statistics.cs
+System.Net.NetworkInformation/IcmpV6Statistics.cs
System.Net.NetworkInformation/IPAddressCollection.cs
-System.Net.NetworkInformation/IPAddressInformation.cs
-System.Net.NetworkInformation/IPAddressInformationCollection.cs
System.Net.NetworkInformation/IPGlobalProperties.cs
System.Net.NetworkInformation/IPGlobalStatistics.cs
System.Net.NetworkInformation/IPInterfaceProperties.cs
-System.Net.NetworkInformation/IPStatus.cs
System.Net.NetworkInformation/IPv4InterfaceProperties.cs
System.Net.NetworkInformation/IPv4InterfaceStatistics.cs
System.Net.NetworkInformation/IPv6InterfaceProperties.cs
-System.Net.NetworkInformation/IcmpV4Statistics.cs
-System.Net.NetworkInformation/IcmpV6Statistics.cs
System.Net.NetworkInformation/LinuxNetworkInterfaceMarshal.cs
System.Net.NetworkInformation/MacOsNetworkInterfaceMarshal.cs
-System.Net.NetworkInformation/MulticastIPAddressInformation.cs
-System.Net.NetworkInformation/MulticastIPAddressInformationCollection.cs
-System.Net.NetworkInformation/NetBiosNodeType.cs
-System.Net.NetworkInformation/NetworkAddressChangedEventHandler.cs
-System.Net.NetworkInformation/NetworkAvailabilityChangedEventHandler.cs
-System.Net.NetworkInformation/NetworkAvailabilityEventArgs.cs
System.Net.NetworkInformation/NetworkChange.cs
-System.Net.NetworkInformation/NetworkInformationAccess.cs
-System.Net.NetworkInformation/NetworkInformationException.cs
System.Net.NetworkInformation/NetworkInterface.cs
-System.Net.NetworkInformation/NetworkInterfaceComponent.cs
-System.Net.NetworkInformation/NetworkInterfaceType.cs
-System.Net.NetworkInformation/OperationalStatus.cs
-System.Net.NetworkInformation/PhysicalAddress.cs
System.Net.NetworkInformation/Ping.cs
System.Net.NetworkInformation/PingCompletedEventArgs.cs
System.Net.NetworkInformation/PingCompletedEventHandler.cs
-System.Net.NetworkInformation/PingException.cs
-System.Net.NetworkInformation/PingOptions.cs
-System.Net.NetworkInformation/PingReply.cs
-System.Net.NetworkInformation/PrefixOrigin.cs
-System.Net.NetworkInformation/SuffixOrigin.cs
-System.Net.NetworkInformation/TcpConnectionInformation.cs
-System.Net.NetworkInformation/TcpState.cs
System.Net.NetworkInformation/TcpStatistics.cs
System.Net.NetworkInformation/UdpStatistics.cs
System.Net.NetworkInformation/UnicastIPAddressInformation.cs
-System.Net.NetworkInformation/UnicastIPAddressInformationCollection.cs
+System.Net.NetworkInformation/Win32NetworkInterfaceMarshal.cs
../referencesource/System/net/System/Net/SecureProtocols/AuthenticatedStream.cs
../referencesource/System/net/System/Net/SecureProtocols/NegotiateEnumTypes.cs
System.Net.Security/EncryptionPolicy.cs
../referencesource/System/net/System/Net/Sockets/IPProtectionLevel.cs
../referencesource/System/net/System/Net/Sockets/NetworkStream.cs
+
+../referencesource/System/net/System/Net/NetworkInformation/DuplicateAddressDetectionState.cs
+../referencesource/System/net/System/Net/NetworkInformation/GatewayIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/GatewayIPAddressInformationCollection.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPAddressCollection.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPAddressInformationCollection.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPGlobalProperties.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPGlobalStatistics.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPInterfaceProperties.cs
../referencesource/System/net/System/Net/NetworkInformation/IPInterfaceStatistics.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPStatus.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPv4InterfaceProperties.cs
+../referencesource/System/net/System/Net/NetworkInformation/IPv6InterfaceProperties.cs
+../referencesource/System/net/System/Net/NetworkInformation/IcmpV4Statistics.cs
+../referencesource/System/net/System/Net/NetworkInformation/IcmpV6Statistics.cs
+../referencesource/System/net/System/Net/NetworkInformation/MulticastIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/MulticastIPAddressInformationCollection.cs
+../referencesource/System/net/System/Net/NetworkInformation/NetworkAddressChange.cs
+../referencesource/System/net/System/Net/NetworkInformation/NetworkInformationException.cs
+../referencesource/System/net/System/Net/NetworkInformation/NetworkInformationPermission.cs
+../referencesource/System/net/System/Net/NetworkInformation/NetworkInterface.cs
+../referencesource/System/net/System/Net/NetworkInformation/NetworkInterfaceComponent.cs
+../referencesource/System/net/System/Net/NetworkInformation/OperationalStatus.cs
+../referencesource/System/net/System/Net/NetworkInformation/PhysicalAddress.cs
+../referencesource/System/net/System/Net/NetworkInformation/PingOptions.cs
+../referencesource/System/net/System/Net/NetworkInformation/PingReply.cs
+../referencesource/System/net/System/Net/NetworkInformation/PrefixOrigin.cs
../referencesource/System/net/System/Net/NetworkInformation/ScopeLevel.cs
+../referencesource/System/net/System/Net/NetworkInformation/SuffixOrigin.cs
+../referencesource/System/net/System/Net/NetworkInformation/SystemGatewayIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/SystemIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/SystemMulticastIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/SystemUnicastIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/SystemTcpConnection.cs
+../referencesource/System/net/System/Net/NetworkInformation/TcpConnection.cs
+../referencesource/System/net/System/Net/NetworkInformation/TcpState.cs
+../referencesource/System/net/System/Net/NetworkInformation/TcpStatistics.cs
+../referencesource/System/net/System/Net/NetworkInformation/UdpStatistics.cs
../referencesource/System/net/System/Net/NetworkInformation/UnicastIPAddressInformation.cs
+../referencesource/System/net/System/Net/NetworkInformation/UnicastIPAddressInformationCollection.cs
+../referencesource/System/net/System/Net/NetworkInformation/interfacetype.cs
+../referencesource/System/net/System/Net/NetworkInformation/nodetype.cs
+../referencesource/System/net/System/Net/NetworkInformation/pingexception.cs
../referencesource/System/sys/system/runtime/interopservices/DefaultParameterValueAttribute.cs
../referencesource/System/sys/system/runtime/interopservices/handlecollector.cs
using System.Threading.Tasks;
using System.Security.Permissions;
using System.Diagnostics.CodeAnalysis;
+using System.IO;
namespace System.Net.NetworkInformation
{
{
public static IPGlobalProperties GetIPGlobalProperties()
{
+#if MONODROID
+ return new AndroidIPGlobalProperties ();
+#elif MONOTOUCH || XAMMAC || MOBILE_STATIC
+ return new UnixIPGlobalProperties ();
+#elif MONO
+ 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 ();
+ }
+#else
(new NetworkInformationPermission(NetworkInformationAccess.Read)).Demand();
return new SystemIPGlobalProperties();
+#endif
}
internal static IPGlobalProperties InternalGetIPGlobalProperties()
{
+#if MONO
+ return GetIPGlobalProperties();
+#else
return new SystemIPGlobalProperties();
+#endif
}
/// Gets the Active Udp Listeners on this machine
}
}
}
-
+#if !MONO
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1053:StaticHolderTypesShouldNotHaveConstructors")]
public class NetworkChange{
#region designer support for System.Windows.dll
} //ends ignoreaddresschanges
}
}
-
+#endif
public delegate void NetworkAddressChangedEventHandler(object sender, EventArgs e);
public delegate void NetworkAvailabilityChangedEventHandler(object sender, NetworkAvailabilityEventArgs e);
}
const int DontFragmentFlag = 2;
int ttl = 128;
bool dontFragment;
-
+#if !MONO
internal PingOptions (IPOptions options) {
this.ttl = options.ttl;
this.dontFragment = ((options.flags & DontFragmentFlag) > 0 ? true : false);
}
-
+#endif
public PingOptions (int ttl, bool dontFragment) {
if (ttl <= 0) {
throw new ArgumentOutOfRangeException("ttl");
buffer = new byte[0];
}
-
+#if MONO
+ internal PingReply (IPAddress address, byte [] buffer, PingOptions options, long roundtripTime, IPStatus status)
+ {
+ this.address = address;
+ this.buffer = buffer;
+ this.options = options;
+ this.rtt = roundtripTime;
+ this.ipStatus = status;
+ }
+#else
// the main constructor for the icmpsendecho apis
internal PingReply (IcmpEchoReply reply) {
address = new IPAddress (reply.address);
buffer = new byte[0];
}
-
+#endif
//translates the relevant icmpsendecho codes to a ipstatus code
{
IPAddress address;
- private SystemGatewayIPAddressInformation(IPAddress address){
+ internal SystemGatewayIPAddressInformation(IPAddress address){
this.address = address;
}
internal bool transient = false;
internal bool dnsEligible = true;
+#if MONO
+ public SystemIPAddressInformation(IPAddress address, bool isDnsEligible, bool isTransient)
+ {
+ this.address = address;
+ this.dnsEligible = isDnsEligible;
+ this.transient = isTransient;
+ }
+#else
internal SystemIPAddressInformation(IPAddress address, AdapterAddressFlags flags) {
this.address = address;
transient = (flags & AdapterAddressFlags.Transient) > 0;
dnsEligible = (flags & AdapterAddressFlags.DnsEligible) > 0;
}
+#endif
public override IPAddress Address{get {return address;}}
using System.Threading;
using System.Collections.Generic;
+#if !MONO
internal class SystemIPGlobalProperties:IPGlobalProperties {
private FixedInfo fixedInfo;
private bool fixedInfoInitialized = false;
} //ends networkinformation class
-
+#endif
internal struct FixedInfo{
internal FIXED_INFO info;
IPEndPoint localEndPoint;
IPEndPoint remoteEndPoint;
TcpState state;
-
+#if MONO
+ public SystemTcpConnectionInformation (IPEndPoint local, IPEndPoint remote, TcpState state)
+ {
+ localEndPoint = local;
+ remoteEndPoint = remote;
+ this.state = state;
+ }
+#else
internal SystemTcpConnectionInformation(MibTcpRow row) {
state = row.state;
localEndPoint = new IPEndPoint(new IPAddress(row.localAddr, row.localScopeId), (int)localPort);
remoteEndPoint = new IPEndPoint(new IPAddress(row.remoteAddr, row.remoteScopeId), (int)remotePort);
}
-
+#endif
public override TcpState State{get {return state;}}
public override IPEndPoint LocalEndPoint{get {return localEndPoint;}}
private uint preferredLifetime;
private byte prefixLength;
+#if !MONO
internal SystemUnicastIPAddressInformation(IpAdapterUnicastAddress adapterAddress) {
IPAddress ipAddress = adapterAddress.address.MarshalIPAddress();
this.innerInfo = new SystemIPAddressInformation(ipAddress, adapterAddress.flags);
ipv4Mask = PrefixLengthToSubnetMask(prefixLength, ipAddress.AddressFamily);
}
}
+#endif
/// <include file='doc\NetworkInterface.uex' path='docs/doc[@for="IPAddressInformation.Address"]/*' />
public override IPAddress Address{get {return innerInfo.Address;}}
return dhcpLeaseLifetime;
}
}
-
+#if !MONO
// Helper method that marshals the addressinformation into the classes
internal static UnicastIPAddressInformationCollection MarshalUnicastIpAddressInformationCollection(IntPtr ptr) {
UnicastIPAddressInformationCollection addressList = new UnicastIPAddressInformationCollection();
return new IPAddress(addressBytes);
}
+#endif
}
}
#endif // !FEATURE_PAL
}
+
+#if !MONO
//
// This class is a wrapper for Http.sys V2 request queue handle.
//
return true;
}
}
-
+#endif
//
// SafeHandle to wrap handles created by IcmpCreateFile or Icmp6CreateFile
// from either icmp.dll or iphlpapi.dll. These handles must be closed by
}
}
+#if !MONO
//
// Used when working with WinHTTP APIs, like WinHttpOpen(). Holds the HINTERNET handle.
//
return UnsafeNclNativeMethods.SspiHelper.SspiFreeAuthIdentity(handle) == SecurityStatus.OK;
}
}
+#endif
#if !FEATURE_PAL
}
}
+#if !MONO
///////////////////////////////////////////////////////////////
//
// A few Win32 APIs return pointers to blobs that need GlobalFree().
return UnsafeNclNativeMethods.SafeNetHandles.LocalFree(handle) == IntPtr.Zero;
}
}
+#endif
#if !FEATURE_PAL
[SuppressUnmanagedCodeSecurity]
#endif // !FEATURE_PAL
+#if !MONO
internal class SafeNativeOverlapped : SafeHandle
{
internal static readonly SafeNativeOverlapped Zero = new SafeNativeOverlapped();
}
}
+#endif
#if !FEATURE_PAL