diff options
author | Fredrick Galoso <fredrickgaloso@gmail.com> | 2014-01-12 07:23:50 +0400 |
---|---|---|
committer | Fredrick Galoso <fredrickgaloso@gmail.com> | 2014-01-12 07:23:50 +0400 |
commit | d27abb23af5eb9d288be117b4e1106cf3ac75bf7 (patch) | |
tree | c647fbda36f12a7e85eeba2d7abfe2e75a1ba094 /mcs/class | |
parent | bc6da57cc10a5abfa18625f5227771c8faa08707 (diff) |
[system] Add IsIPv6Teredo to System.Net.IpAddress
Adds support for checking for an IPv6 Teredo address, introduced in
.NET Framework 4.
Diffstat (limited to 'mcs/class')
-rwxr-xr-x | mcs/class/System/Documentation/en/System.Net/IPAddress.xml | 15 | ||||
-rw-r--r-- | mcs/class/System/System.Net/IPAddress.cs | 10 | ||||
-rw-r--r-- | mcs/class/System/Test/System.Net/IPAddressTest.cs | 9 |
3 files changed, 34 insertions, 0 deletions
diff --git a/mcs/class/System/Documentation/en/System.Net/IPAddress.xml b/mcs/class/System/Documentation/en/System.Net/IPAddress.xml index f2caec0386d..e428def11c2 100755 --- a/mcs/class/System/Documentation/en/System.Net/IPAddress.xml +++ b/mcs/class/System/Documentation/en/System.Net/IPAddress.xml @@ -541,6 +541,21 @@ in network-byte-order.</para> <remarks>To be added.</remarks> </Docs> </Member> + <Member MemberName="IsIPv6Teredo"> + <MemberSignature Language="C#" Value="public bool IsIPv6Teredo { get; }" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>4.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Boolean</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <value>To be added.</value> + <remarks>To be added.</remarks> + </Docs> + </Member> <Member MemberName="IsLoopback"> <MemberSignature Language="ILASM" Value=".method public hidebysig static bool IsLoopback(class System.Net.IPAddress address)" /> <MemberSignature Language="C#" Value="public static bool IsLoopback (System.Net.IPAddress addr);" /> diff --git a/mcs/class/System/System.Net/IPAddress.cs b/mcs/class/System/System.Net/IPAddress.cs index 2dd7d1ab311..b1081f5bd29 100644 --- a/mcs/class/System/System.Net/IPAddress.cs +++ b/mcs/class/System/System.Net/IPAddress.cs @@ -333,6 +333,16 @@ namespace System.Net { } } +#if NET_4_0 + public bool IsIPv6Teredo { + get { + return m_Family != AddressFamily.InterNetwork && + m_Numbers[0] == 0x2001 && + m_Numbers[1] == 0; + } + } +#endif + public long ScopeId { get { if (m_Family != AddressFamily.InterNetworkV6) diff --git a/mcs/class/System/Test/System.Net/IPAddressTest.cs b/mcs/class/System/Test/System.Net/IPAddressTest.cs index 965b1cd44a0..a07c1a19d92 100644 --- a/mcs/class/System/Test/System.Net/IPAddressTest.cs +++ b/mcs/class/System/Test/System.Net/IPAddressTest.cs @@ -545,6 +545,15 @@ public class IPAddressTest Assert.IsTrue (IPAddress.Parse ("FF01::1").IsIPv6Multicast, "#2"); Assert.IsFalse (IPAddress.Parse ("FE00::1").IsIPv6Multicast, "#3"); } + +#if NET_4_0 + [Test] + public void IsIPv6Teredo () + { + Assert.IsTrue (IPAddress.Parse ("2001::1").IsIPv6Teredo, "#1"); + Assert.IsFalse (IPAddress.Parse ("2002::1").IsIPv6Teredo, "#2"); + } +#endif } } |