Ejemplo n.º 1
0
 /// <summary>
 /// Constructs an instance out of the precedence, gateway, algorithm and public key fields.
 /// </summary>
 /// <param name="precedence">
 /// Precedence for this record.
 /// Gateways listed in IPSECKEY records with lower precedence are to be attempted first.
 /// Where there is a tie in precedence, the order should be non-deterministic.
 /// </param>
 /// <param name="gateway">
 /// Indicates a gateway to which an IPsec tunnel may be created in order to reach the entity named by this
 /// resource record.
 /// </param>
 /// <param name="algorithm">Identifies the public key's cryptographic algorithm and determines the format of the public key field.</param>
 /// <param name="publicKey">Contains the algorithm-specific portion of the KEY RR RDATA.</param>
 public DnsResourceDataIpSecKey(byte precedence, DnsGateway gateway, DnsPublicKeyAlgorithm algorithm, DataSegment publicKey)
 {
     Precedence = precedence;
     Gateway    = gateway;
     Algorithm  = algorithm;
     PublicKey  = publicKey;
 }
Ejemplo n.º 2
0
        internal override DnsResourceData CreateInstance(DnsDatagram dns, int offsetInDns, int length)
        {
            if (length < ConstPartLength)
            {
                return(null);
            }

            byte                  precedence  = dns[offsetInDns + Offset.Precedence];
            DnsGatewayType        gatewayType = (DnsGatewayType)dns[offsetInDns + Offset.GatewayType];
            DnsPublicKeyAlgorithm algorithm   = (DnsPublicKeyAlgorithm)dns[offsetInDns + Offset.Algorithm];
            DnsGateway            gateway     = DnsGateway.CreateInstance(gatewayType, dns, offsetInDns + Offset.Gateway, length - ConstPartLength);

            if (gateway == null)
            {
                return(null);
            }
            DataSegment publicKey = dns.Subsegment(offsetInDns + ConstPartLength + gateway.Length, length - ConstPartLength - gateway.Length);

            return(new DnsResourceDataIpSecKey(precedence, gateway, algorithm, publicKey));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Two gateway representations are equal if they are of the same type and the value is the same.
 /// </summary>
 public override bool Equals(DnsGateway other)
 {
     return(Equals(other as DnsGatewayIpV4));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Two gateway representations are equal if they are of the same type and the value is the same.
 /// </summary>
 public override bool Equals(DnsGateway other)
 {
     return(Equals(other as DnsGatewayDomainName));
 }