SuffixOrigin Enumeración

Definición

Especifica cómo se encontró el sufijo de host de una dirección IP.

public enum class SuffixOrigin
public enum SuffixOrigin
type SuffixOrigin = 
Public Enum SuffixOrigin
Herencia
SuffixOrigin

Campos

LinkLayerAddress 4

El sufijo es un sufijo local de vínculo.

Manual 1

El sufijo se configuró manualmente.

OriginDhcp 3

Un servidor DHCP (Protocolo de configuración dinámica de host) proporcionó el sufijo.

Other 0

El sufijo se encontró utilizando un origen no especificado.

Random 5

El sufijo se asignó aleatoriamente.

WellKnown 2

El sufijo es un sufijo conocido. Los sufijos conocidos se especifican en documentos de seguimiento estándar RFC (solicitudes de comentarios) y son asignados por IANA (Internet Assigned Numbers Authority) o por un registro de direcciones. Dichos sufijos se reservan para fines especiales.

Ejemplos

En el ejemplo de código siguiente se muestra información de prefijo y sufijo para las direcciones de unidifusión.

void DisplayUnicastAddresses()
{
   Console::WriteLine( "Unicast Addresses" );
   array<NetworkInterface^>^adapters = NetworkInterface::GetAllNetworkInterfaces();
   System::Collections::IEnumerator^ myEnum17 = adapters->GetEnumerator();
   while ( myEnum17->MoveNext() )
   {
      NetworkInterface ^ adapter = safe_cast<NetworkInterface ^>(myEnum17->Current);
      IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties();
      UnicastIPAddressInformationCollection ^ uniCast = adapterProperties->UnicastAddresses;
      if ( uniCast->Count > 0 )
      {
         Console::WriteLine( adapter->Description );
         String^ lifeTimeFormat = "dddd, MMMM dd, yyyy  hh:mm:ss tt";
         System::Collections::IEnumerator^ myEnum18 = uniCast->GetEnumerator();
         while ( myEnum18->MoveNext() )
         {
            UnicastIPAddressInformation ^ uni = safe_cast<UnicastIPAddressInformation ^>(myEnum18->Current);
            DateTime when;
            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( (double)uni->AddressValidLifetime );
            when = when.ToLocalTime();
            Console::WriteLine( "     Valid Life Time ...................... : {0}", 
               when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) );
            when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->AddressPreferredLifetime );
            when = when.ToLocalTime();
            Console::WriteLine( "     Preferred life time .................. : {0}", 
               when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) );
            when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->DhcpLeaseLifetime );
            when = when.ToLocalTime();
            Console::WriteLine( "     DHCP Leased Life Time ................ : {0}", 
               when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) );
         }
         Console::WriteLine();
      }
   }
}
public static void DisplayUnicastAddresses()
{
    Console.WriteLine("Unicast Addresses");
    NetworkInterface[] adapters  = NetworkInterface.GetAllNetworkInterfaces();
    foreach (NetworkInterface adapter in adapters)
    {
        IPInterfaceProperties adapterProperties = adapter.GetIPProperties();
        UnicastIPAddressInformationCollection uniCast = adapterProperties.UnicastAddresses;
        if (uniCast.Count >0)
        {
            Console.WriteLine(adapter.Description);
            string lifeTimeFormat = "dddd, MMMM dd, yyyy  hh:mm:ss tt";
            foreach (UnicastIPAddressInformation uni in uniCast)
            {
                DateTime when;

                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)
                );
            }
            Console.WriteLine();
        }
    }
}
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

Comentarios

Las direcciones IP se dividen en dos partes: el prefijo y el sufijo. El prefijo de dirección identifica la parte de red de una dirección IP y el sufijo de dirección identifica la parte del host. Los prefijos se asignan por las autoridades globales y los administradores del sistema local asignan los sufijos.

La clase UnicastIPAddressInformation utiliza esta enumeración. Las instancias de esta clase se devuelven cuando se recupera la información de dirección de unidifusión de un NetworkInterface objeto .

Se aplica a