PrefixOrigin Enumeration
Assembly: System (in system.dll)
| Member name | Description | |
|---|---|---|
| Dhcp | The prefix was supplied by a Dynamic Host Configuration Protocol (DHCP) server. | |
| Manual | The prefix was manually configured. | |
| Other | The prefix was located using an unspecified source. | |
| RouterAdvertisement | The prefix was supplied by a router advertisement. | |
| WellKnown | The prefix is a well-known prefix. Well-known prefixes are specified in standard-track Request for Comments (RFC) documents and assigned by the Internet Assigned Numbers Authority (Iana) or an address registry. Such prefixes are reserved for special purposes. |
IP addresses are divided into two parts: the prefix and the suffix. The address prefix identifies the network portion of an IP address, and the address suffix identifies the host portion. Prefixes are assigned by global authorities, and suffixes are assigned by local system administrators.
This enumeration is used by the UnicastIPAddressInformation and MulticastIPAddressInformation classes. Instances of this class are returned when you retrieve the address information for a NetworkInterface object.
The following code example displays prefix and suffix information for unicast addresses.
Public Shared Sub DisplayUnicastAddresses() Console.WriteLine("Unicast Addresses") Dim adapters As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces() Dim adapter As NetworkInterface For Each adapter In adapters Dim adapterProperties As IPInterfaceProperties = adapter.GetIPProperties() Dim uniCast As UnicastIPAddressInformationCollection = adapterProperties.UnicastAddresses If uniCast.Count > 0 Then Console.WriteLine(adapter.Description) Dim lifeTimeFormat As String = "dddd, MMMM dd, yyyy hh:mm:ss tt" Dim uni As UnicastIPAddressInformation For Each uni In uniCast Dim [when] As DateTime Console.WriteLine(" Unicast Address ......................... : {0}", uni.Address) Console.WriteLine(" Prefix Origin ........................ : {0}", uni.PrefixOrigin) Console.WriteLine(" Suffix Origin ........................ : {0}", uni.SuffixOrigin) Console.WriteLine(" Duplicate Address Detection .......... : {0}", uni.DuplicateAddressDetectionState) ' Format the lifetimes as Sunday, February 16, 2003 11:33:44 PM ' if en-us is the current culture. ' Calculate the date and time at the end of the lifetimes. [when] = DateTime.UtcNow + TimeSpan.FromSeconds(uni.AddressValidLifetime) [when] = [when].ToLocalTime() Console.WriteLine(" Valid Life Time ...................... : {0}", [when].ToString(lifeTimeFormat, System.Globalization.CultureInfo.CurrentCulture)) [when] = DateTime.UtcNow + TimeSpan.FromSeconds(uni.AddressPreferredLifetime) [when] = [when].ToLocalTime() Console.WriteLine(" Preferred life time .................. : {0}", [when].ToString(lifeTimeFormat, System.Globalization.CultureInfo.CurrentCulture)) [when] = DateTime.UtcNow + TimeSpan.FromSeconds(uni.DhcpLeaseLifetime) [when] = [when].ToLocalTime() Console.WriteLine(" DHCP Leased Life Time ................ : {0}", [when].ToString(lifeTimeFormat, System.Globalization.CultureInfo.CurrentCulture)) Next uni Console.WriteLine() End If Next adapter End Sub 'DisplayUnicastAddresses
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.