Merge pull request #3142 from henricm/fix-for-win-mono_string_to_utf8
[mono.git] / mcs / class / referencesource / System / net / System / Net / NetworkInformation / SystemIPAddressInformation.cs
1
2     /// <summary><para>
3     ///    Provides support for ip configuation information and statistics.
4     ///</para></summary>
5     ///
6 namespace System.Net.NetworkInformation {
7
8     using System.Net;
9     using System.Net.Sockets;
10     using System;
11     using System.Runtime.InteropServices;
12     using System.Collections;
13     using System.ComponentModel;
14     using System.Security.Permissions;
15     using Microsoft.Win32;
16
17
18
19     //this is the main addressinformation class that contains the ipaddress
20     //and other properties
21     internal class SystemIPAddressInformation:IPAddressInformation{
22
23         IPAddress address;
24         internal bool transient = false;
25         internal bool dnsEligible = true;
26
27 #if MONO
28         public SystemIPAddressInformation(IPAddress address, bool isDnsEligible, bool isTransient)
29         {
30             this.address = address;
31             this.dnsEligible = isDnsEligible;
32             this.transient = isTransient;
33         }
34 #else
35         internal SystemIPAddressInformation(IPAddress address, AdapterAddressFlags flags) {
36             this.address = address;
37             transient = (flags & AdapterAddressFlags.Transient) > 0;
38             dnsEligible = (flags & AdapterAddressFlags.DnsEligible) > 0;
39         }
40 #endif
41
42         public override IPAddress Address{get {return address;}}
43
44         /// <summary>The address is a cluster address and shouldn't be used by most applications.</summary>
45         public override bool IsTransient{
46             get {
47                 return (transient);
48             }
49         }
50
51         /// <summary>This address can be used for DNS.</summary>
52         public override bool IsDnsEligible{
53             get {
54                 return (dnsEligible);
55             }
56         }
57     }
58 }
59