/// <summary> /// Creates a new instance of the CAARecord class /// </summary> /// <param name="name"> Name of the zone </param> /// <param name="timeToLive"> Seconds the record should be cached at most </param> /// <param name="flags">The flags</param> /// <param name="tag">The name of the tag</param> /// <param name="value">The value of the tag</param> public CAARecord(DomainName name, int timeToLive, byte flags, string tag, string value) : base(name, RecordType.CAA, RecordClass.INet, timeToLive) { Flags = flags; Tag = tag; Value = value; }
internal override void ParseRecordData(byte[] resultData, int startPosition, int length) { Priority = DnsMessageBase.ParseUShort(resultData, ref startPosition); Weight = DnsMessageBase.ParseUShort(resultData, ref startPosition); Port = DnsMessageBase.ParseUShort(resultData, ref startPosition); Target = DnsMessageBase.ParseDomainName(resultData, ref startPosition); }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length != 1) throw new FormatException(); NameServer = ParseDomainName(origin, stringRepresentation[0]); }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length < 1) throw new FormatException(); PublicKey = String.Join(String.Empty, stringRepresentation).FromBase64String(); }
/// <summary> /// Creates a new instance of the DiffieHellmanKeyRecord class /// </summary> /// <param name="name"> Name of the record </param> /// <param name="recordClass"> Class of the record </param> /// <param name="timeToLive"> Seconds the record should be cached at most </param> /// <param name="flags"> Flags of the key </param> /// <param name="protocol"> Protocol for which the key is used </param> /// <param name="prime"> Binary data of the prime of the key </param> /// <param name="generator"> Binary data of the generator of the key </param> /// <param name="publicValue"> Binary data of the public value </param> public DiffieHellmanKeyRecord(DomainName name, RecordClass recordClass, int timeToLive, ushort flags, ProtocolType protocol, byte[] prime, byte[] generator, byte[] publicValue) : base(name, recordClass, timeToLive, flags, protocol, DnsSecAlgorithm.DiffieHellman) { Prime = prime ?? new byte[] { }; Generator = generator ?? new byte[] { }; PublicValue = publicValue ?? new byte[] { }; }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length == 0) throw new FormatException(); TextParts = stringRepresentation; }
/// <summary> /// Creates a new instance of the MxRecord class /// </summary> /// <param name="name"> Name of the zone </param> /// <param name="timeToLive"> Seconds the record should be cached at most </param> /// <param name="priority"> Priority of the record </param> /// <param name="weight"> Weight of the record </param> /// <param name="target"> Target of the record </param> public UriRecord(DomainName name, int timeToLive, ushort priority, ushort weight, string target) : base(name, RecordType.Uri, RecordClass.INet, timeToLive) { Priority = priority; Weight = weight; Target = target ?? String.Empty; }
public void DomainName_Unit_Constructor1_FirstLevelIsEmpty() { String firstLevelLabel = String.Empty; String secondLevelLabel = "vizistata"; String subDomainLabel = "www"; DomainName target = new DomainName(firstLevelLabel, secondLevelLabel, subDomainLabel); }
/// <summary> /// Creates a new instance of the WksRecord class /// </summary> /// <param name="name"> Name of the host </param> /// <param name="timeToLive"> Seconds the record should be cached at most </param> /// <param name="address"> IP address of the host </param> /// <param name="protocol"> Type of the protocol </param> /// <param name="ports"> List of ports which are supported by the host </param> public WksRecord(DomainName name, int timeToLive, IPAddress address, ProtocolType protocol, List<ushort> ports) : base(name, RecordType.Wks, RecordClass.INet, timeToLive) { Address = address ?? IPAddress.None; Protocol = protocol; Ports = ports ?? new List<ushort>(); }
/// <summary> /// Creates a new instance of the GPosRecord class /// </summary> /// <param name="name"> Name of the record </param> /// <param name="timeToLive"> Seconds the record should be cached at most </param> /// <param name="longitude"> Longitude of the geographical position </param> /// <param name="latitude"> Latitude of the geographical position </param> /// <param name="altitude"> Altitude of the geographical position </param> public GPosRecord(DomainName name, int timeToLive, double longitude, double latitude, double altitude) : base(name, RecordType.GPos, RecordClass.INet, timeToLive) { Longitude = longitude; Latitude = latitude; Altitude = altitude; }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length != 1) throw new FormatException(); X25Address = stringRepresentation[0]; }
/// <summary> /// Creates a new instance of the PxRecord class /// </summary> /// <param name="name"> Name of the record </param> /// <param name="timeToLive"> Seconds the record should be cached at most </param> /// <param name="preference"> Preference of the record </param> /// <param name="map822"> Domain name containing the RFC822 domain </param> /// <param name="mapX400"> Domain name containing the X.400 part </param> public PxRecord(DomainName name, int timeToLive, ushort preference, DomainName map822, DomainName mapX400) : base(name, RecordType.Px, RecordClass.INet, timeToLive) { Preference = preference; Map822 = map822 ?? DomainName.Root; MapX400 = mapX400 ?? DomainName.Root; }
/// <summary> /// Creates a new instace of the HipRecord class /// </summary> /// <param name="name"> Name of the record </param> /// <param name="timeToLive"> Seconds the record should be cached at most </param> /// <param name="algorithm"> Algorithm of the key </param> /// <param name="hit"> Host identity tag </param> /// <param name="publicKey"> Binary data of the public key </param> /// <param name="rendezvousServers"> Possible rendezvous servers </param> public HipRecord(DomainName name, int timeToLive, IpSecKeyRecord.IpSecAlgorithm algorithm, byte[] hit, byte[] publicKey, List<DomainName> rendezvousServers) : base(name, RecordType.Hip, RecordClass.INet, timeToLive) { Algorithm = algorithm; Hit = hit ?? new byte[] { }; PublicKey = publicKey ?? new byte[] { }; RendezvousServers = rendezvousServers ?? new List<DomainName>(); }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length != 2) throw new FormatException(); Cpu = stringRepresentation[0]; OperatingSystem = stringRepresentation[1]; }
/// <summary> /// Creates a new instance of the CDsRecord class /// </summary> /// <param name="name"> Name of the record </param> /// <param name="recordClass"> Class of the record </param> /// <param name="timeToLive"> Seconds the record should be cached at most </param> /// <param name="keyTag"> Key tag </param> /// <param name="algorithm"> Algorithm used </param> /// <param name="digestType"> Type of the digest </param> /// <param name="digest"> Binary data of the digest </param> public CDsRecord(DomainName name, RecordClass recordClass, int timeToLive, ushort keyTag, DnsSecAlgorithm algorithm, DnsSecDigestType digestType, byte[] digest) : base(name, RecordType.Ds, recordClass, timeToLive) { KeyTag = keyTag; Algorithm = algorithm; DigestType = digestType; Digest = digest ?? new byte[] { }; }
/// <summary> /// Creates a new instance of the NSec3ParamRecord class /// </summary> /// <param name="name"> Name of the record </param> /// <param name="recordClass"> Class of the record </param> /// <param name="timeToLive"> Seconds the record should be cached at most </param> /// <param name="hashAlgorithm"> Algorithm of hash </param> /// <param name="flags"> Flags of the record </param> /// <param name="iterations"> Number of iterations </param> /// <param name="salt"> Binary data of salt </param> public NSec3ParamRecord(DomainName name, RecordClass recordClass, int timeToLive, NSec3HashAlgorithm hashAlgorithm, byte flags, ushort iterations, byte[] salt) : base(name, RecordType.NSec3Param, recordClass, timeToLive) { HashAlgorithm = hashAlgorithm; Flags = flags; Iterations = iterations; Salt = salt ?? new byte[] { }; }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length != 2) throw new FormatException(); MailBox = ParseDomainName(origin, stringRepresentation[0]); TxtDomainName = ParseDomainName(origin, stringRepresentation[1]); }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length != 2) throw new FormatException(); Preference = UInt16.Parse(stringRepresentation[0]); ExchangeDomainName = ParseDomainName(origin, stringRepresentation[1]); }
/// <summary> /// Creates a new instance of the SrvRecord class /// </summary> /// <param name="name"> Name of the record </param> /// <param name="timeToLive"> Seconds the record should be cached at most </param> /// <param name="priority"> Priority of the record </param> /// <param name="weight"> Relative weight for records with the same priority </param> /// <param name="port"> The port of the service on the target </param> /// <param name="target"> Domain name of the target host </param> public SrvRecord(DomainName name, int timeToLive, ushort priority, ushort weight, ushort port, DomainName target) : base(name, RecordType.Srv, RecordClass.INet, timeToLive) { Priority = priority; Weight = weight; Port = port; Target = target ?? DomainName.Root; }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length != 3) throw new FormatException(); Longitude = Double.Parse(stringRepresentation[0], CultureInfo.InvariantCulture); Latitude = Double.Parse(stringRepresentation[1], CultureInfo.InvariantCulture); Altitude = Double.Parse(stringRepresentation[2], CultureInfo.InvariantCulture); }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length != 3) throw new FormatException(); Priority = UInt16.Parse(stringRepresentation[0]); Weight = UInt16.Parse(stringRepresentation[1]); Target = stringRepresentation[2]; }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length != 3) throw new FormatException(); Flags = Byte.Parse(stringRepresentation[0]); Tag = stringRepresentation[1]; Value = stringRepresentation[2]; }
/// <summary> /// Queries for specified records. /// </summary> /// <param name="name"> Name, that should be queried </param> /// <param name="recordType"> Type the should be queried </param> /// <returns> All available responses on the local network </returns> public List<LlmnrMessage> Resolve(DomainName name, RecordType recordType = RecordType.A) { if (name == null) throw new ArgumentNullException(nameof(name), "Name must be provided"); LlmnrMessage message = new LlmnrMessage { IsQuery = true, OperationCode = OperationCode.Query }; message.Questions.Add(new DnsQuestion(name, recordType, RecordClass.INet)); return SendMessageParallel(message); }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length > 2) throw new FormatException(); IsdnAddress = stringRepresentation[0]; if (stringRepresentation.Length > 1) SubAddress = stringRepresentation[1]; }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length != 1) throw new NotSupportedException(); Address = stringRepresentation[0].Split('-').Select(x => Convert.ToByte(x, 16)).ToArray(); if (Address.Length != 6) throw new NotSupportedException(); }
/// <summary> /// Creates a new instance of the NaptrRecord class /// </summary> /// <param name="name"> Name of the record </param> /// <param name="timeToLive"> Seconds the record should be cached at most </param> /// <param name="order"> Order of the record </param> /// <param name="preference"> Preference of record with same order </param> /// <param name="flags"> Flags of the record </param> /// <param name="services"> Available services </param> /// <param name="regExp"> Substitution expression that is applied to the original string </param> /// <param name="replacement"> The next name to query </param> public NaptrRecord(DomainName name, int timeToLive, ushort order, ushort preference, string flags, string services, string regExp, DomainName replacement) : base(name, RecordType.Naptr, RecordClass.INet, timeToLive) { Order = order; Preference = preference; Flags = flags ?? String.Empty; Services = services ?? String.Empty; RegExp = regExp ?? String.Empty; Replacement = replacement ?? DomainName.Root; }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length != 1) throw new FormatException(); if (!stringRepresentation[0].StartsWith("0x", StringComparison.InvariantCultureIgnoreCase)) throw new FormatException(); RecordData = stringRepresentation[0].Substring(2).Replace(".", String.Empty).FromBase16String(); }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length < 4) throw new FormatException(); KeyTag = UInt16.Parse(stringRepresentation[0]); Algorithm = (DnsSecAlgorithm) Byte.Parse(stringRepresentation[1]); DigestType = (DnsSecDigestType) Byte.Parse(stringRepresentation[2]); Digest = String.Join(String.Empty, stringRepresentation.Skip(3)).FromBase16String(); }
internal override void ParseRecordData(DomainName origin, string[] stringRepresentation) { if (stringRepresentation.Length != 4) throw new FormatException(); HashAlgorithm = (NSec3HashAlgorithm) Byte.Parse(stringRepresentation[0]); Flags = Byte.Parse(stringRepresentation[1]); Iterations = UInt16.Parse(stringRepresentation[2]); Salt = (stringRepresentation[3] == "-") ? new byte[] { } : stringRepresentation[3].FromBase16String(); }
/// <summary> /// Creates a new instance of the NSecRecord class /// </summary> /// <param name="name"> Name of the record </param> /// <param name="recordClass"> Class of the record </param> /// <param name="timeToLive"> Seconds the record should be cached at most </param> /// <param name="nextDomainName"> Name of next owner </param> /// <param name="types"> Record types of the next owner </param> public NSecRecord(DomainName name, RecordClass recordClass, int timeToLive, DomainName nextDomainName, List<RecordType> types) : base(name, RecordType.NSec, recordClass, timeToLive) { NextDomainName = nextDomainName ?? DomainName.Root; if ((types == null) || (types.Count == 0)) { Types = new List<RecordType>(); } else { Types = types.Distinct().OrderBy(x => x).ToList(); } }