Ejemplo n.º 1
0
 /// <summary>
 /// Construct the question reading from a DNS Server response.
 /// </summary>
 /// <param name="pointer">A logical pointer to the Question in byte array form.</param>
 internal Question(RecordPointer pointer)
 {
     // extract from the pointer
     domain_    = pointer.GetDomain();
     dns_type_  = (DnsType)pointer.GetShort();
     dns_class_ = (DnsClass)pointer.GetShort();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResourceRecord"/> class by using the specified
        /// pointer.
        /// </summary>
        /// <param name="pointer">The position in the byte array of the record.</param>
        internal ResourceRecord(RecordPointer pointer) {
            domain_ = pointer.GetDomain();
            dns_type_ = (DnsType)pointer.GetShort();
            dns_class_ = (DnsClass)pointer.GetShort();
            ttl_ = pointer.GetInt();

            // the next short is the record length, we only use it for unrecognised record types.
            int length = pointer.GetShort();
            switch(dns_type_) {
                case DnsType.MX:
                    record_ = new MXRecord(pointer);
                    break;

                default:
                    // move the pointer over this unrecognised record
                    pointer += length;
                    break;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResourceRecord"/> class by using the specified
        /// pointer.
        /// </summary>
        /// <param name="pointer">The position in the byte array of the record.</param>
        internal ResourceRecord(RecordPointer pointer)
        {
            domain_    = pointer.GetDomain();
            dns_type_  = (DnsType)pointer.GetShort();
            dns_class_ = (DnsClass)pointer.GetShort();
            ttl_       = pointer.GetInt();

            // the next short is the record length, we only use it for unrecognised record types.
            int length = pointer.GetShort();

            switch (dns_type_)
            {
            case DnsType.MX:
                record_ = new MXRecord(pointer);
                break;

            default:
                // move the pointer over this unrecognised record
                pointer += length;
                break;
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Construct the question reading from a DNS Server response.
 /// </summary>
 /// <param name="pointer">A logical pointer to the Question in byte array form.</param>
 internal Question(RecordPointer pointer) {
     // extract from the pointer
     domain_ = pointer.GetDomain();
     dns_type_ = (DnsType)pointer.GetShort();
     dns_class_ = (DnsClass)pointer.GetShort();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a nes instance_ of the MXRecord class by using the specified pointer.
 /// </summary>
 /// <param name="pointer">A logical pointer to the bytes holding the record</param>
 internal MXRecord(RecordPointer pointer)
 {
     preference_  = pointer.GetShort();
     domain_name_ = pointer.GetDomain();
 }