X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem%2FSystem.Net.NetworkInformation%2FIPv4InterfaceProperties.cs;h=21356e88c3f67e0a8a8fadd3bc20dd4e37f389dc;hb=074a90260c3b8b86444248703bc35bd0be6ae7cf;hp=8f1ddbbaef57b1df6baf27af371b750a07c4305e;hpb=8d78815a10a5bbf27714a8e4d600a9a01cb9a735;p=mono.git diff --git a/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceProperties.cs b/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceProperties.cs index 8f1ddbbaef5..21356e88c3f 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceProperties.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceProperties.cs @@ -46,17 +46,17 @@ namespace System.Net.NetworkInformation { public abstract bool UsesWins { get; } } - sealed class LinuxIPv4InterfaceProperties : IPv4InterfaceProperties + abstract class UnixIPv4InterfaceProperties : IPv4InterfaceProperties { - LinuxNetworkInterface iface; + protected UnixNetworkInterface iface; - public LinuxIPv4InterfaceProperties (LinuxNetworkInterface iface) + public UnixIPv4InterfaceProperties (UnixNetworkInterface iface) { this.iface = iface; } public override int Index { - get { return LinuxNetworkInterface.IfNameToIndex (iface.Name); } + get { return UnixNetworkInterface.IfNameToIndex (iface.Name); } } // TODO: how to discover that? @@ -74,6 +74,18 @@ namespace System.Net.NetworkInformation { get { return false; } } + public override bool UsesWins { + get { return false; } + } + } + + sealed class LinuxIPv4InterfaceProperties : UnixIPv4InterfaceProperties + { + public LinuxIPv4InterfaceProperties (LinuxNetworkInterface iface) + : base (iface) + { + } + public override bool IsForwardingEnabled { get { string iface_path = "/proc/sys/net/ipv4/conf/" + iface.Name + "/forwarding"; @@ -87,9 +99,10 @@ namespace System.Net.NetworkInformation { return false; } } + public override int Mtu { get { - string iface_path = iface.IfacePath + "mtu"; + string iface_path = (iface as LinuxNetworkInterface).IfacePath + "mtu"; int ret = 0; if (File.Exists (iface_path)) { @@ -105,10 +118,24 @@ namespace System.Net.NetworkInformation { } } - - public override bool UsesWins { + } + + sealed class MacOsIPv4InterfaceProperties : UnixIPv4InterfaceProperties + { + public MacOsIPv4InterfaceProperties (MacOsNetworkInterface iface) + : base (iface) + { + } + + // dummy + public override bool IsForwardingEnabled { get { return false; } } + + // dummy + public override int Mtu { + get { return 0; } + } } sealed class Win32IPv4InterfaceProperties : IPv4InterfaceProperties