⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.htm

📁 发送邮件
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<HTML>
<HEADER>
<TITLE>Simple DNS Resolver v1.4</TITLE>
</HEADER>

<BODY>

<h3 align="center"><font color="#AOAO99">

Simple DNS Resolver v1.4

</font></h3>

<P><hr></P>

<p>Author: <a href="mailto:emmanuel@kartmann.org">Emmanuel KARTMANN</a>.</p>
<p>Last Update: November 19th, 2001</p>

<P><hr></P>

<p><CENTER><img src="SimpleDNSResolver.jpg" alt="Using the SimpleDNSResolver in Internet Explorer"></CENTER></p>

<A NAME="OVERVIEW">
<h3>OVERVIEW</h3>
</A>

<P>
This ATL COM component provides very simple Internet name resolving functionality (Domain Name System or DNS).
For example, it can automagically find the email (SMTP) servers available for your machine (see 
"<A HREF="#DNS Magic: Who's my email server?">DNS Magic: Who's my email server?</A>" for details).
</P>

<P><HR></P>

<A NAME="WHAT_S_NEW">
<h3>WHAT'S NEW</h3>
</A>

<P>
This version is a complete rewriting of the DNS component. Instead of using a porting of the 
BIND 8 library (from UNIX to NT), it relies on the Microsoft Platform SDK (August 2001), which, 
at last, contains a decent DNS API. Please refer to the <A HREF="#IMPLEMENTATION">implementation</A> 
section for more details.
</P>

<P><HR></P>
<H3>CONTENTS</H3>
<UL>
    <LI><A HREF="#OVERVIEW">OVERVIEW</A>
    <LI><A HREF="#WHAT_S_NEW">WHAT'S NEW</A>
    <LI><A HREF="#INTRODUCTION TO DNS">INTRODUCTION TO DNS</A>
    <UL>
        <LI><A HREF="#What the Hell is DNS?">What the Hell is DNS?</A>
        <LI><A HREF="#The DNS Protocol">The DNS Protocol</A>
        <LI><A HREF="#Resource Records">Resource Records</A>
        <UL>
            <LI><A HREF="#General Resource Record Format">General Resource Record Format
            <LI><A HREF="#Standard Resource Record Formats">Standard Resource Record Formats</A>
            <UL>
                <LI><A HREF="#Internet Address Format (A)">Internet Address Format (A)</A>
                <LI><A HREF="#Canonical Name Format (CNAME)">Canonical Name Format (CNAME)</A>
                <LI><A HREF="#Domain Name Pointer Format (PTR)">Domain Name Pointer Format (PTR)</A>
                <LI><A HREF="#Mail eXchanger Format (MX)">Mail eXchanger Format (MX)</A>
            </UL>
        </UL>
        <LI><A HREF="#Well Known DNS Implementations">Well Known DNS Implementations</A>
        <LI><A HREF="#Resolver Tool: nslookup">Resolver Tool: nslookup</A>
        <LI><A HREF="#DNS Magic: Who's my email server?">DNS Magic: Who's my email server?</A>
    </UL>
    <LI><A HREF="#COMPONENT FEATURES">COMPONENT FEATURES</A>
    <LI><A HREF="#USAGE">USAGE</A>
    <LI><A HREF="#SAMPLE CODE (VBScript)">SAMPLE CODE (VBScript)</A>
    <LI><A HREF="#IMPLEMENTATION">IMPLEMENTATION</A>
    <LI><A HREF="#TO DO LIST">TO DO LIST</A>
    <LI><A HREF="#REFERENCE DOCUMENTATION">REFERENCE DOCUMENTATION</A>
</UL>

<P><HR></P>

<A NAME="INTRODUCTION TO DNS">
<h3>INTRODUCTION TO DNS</h3>
</A>

<UL>

    <A NAME="What the Hell is DNS?">
    <h4>What the Hell is DNS?</h4>
    </A>

    <UL>

        <P>The Domain Name System (DNS) is a <EM><B>distributed host information database used in the Internet</B></EM>.</P>

        <P>Most (if not all) Internet software (e.g. ping, telnet, ftp, web browsers, etc...)
        use the DNS database to resolve IP addresses so that you, the user, can type
        the name of a machine instead of its IP address (user-friendly, isn't it?).</P>

        <P>Let me give you an example: when you type a Web address in your favorite browser (e.g. "www.kartmann.org"), the
        browser fetches the corresponding IP address in the DNS database and uses this
        address to connect to the Web server.</P>

        <P>Information held in the DNS database can be:</P>

        <UL>
            <LI>an ip address (e.g. "209.132.1.74")
            <LI>a hostname (e.g. "www.kartmann.org")
            <LI>a canonical name (i.e. the real name of an IP alias)
            <LI>a mail server name
            <LI>etc...
        </UL>

        <P>Information in the DNS is held in <EM><B>Resource Records</B></EM> (RR). RRs come in several types,
        which correspond to the varieties of data that can be contained in the DNS. Many RFCs
        (most of them still experimental) propose additional RR types, like the geographical location (RFC 1712), 
        digital certificates (RFC 2538), cryptographic keys (RFC 2536), etc...</P>

        <P>A application or library (or COM object) acting as a DNS client is called a <EM><B>resolver</B></EM>.</P>


    </UL>

    <A NAME="The DNS Protocol">
    <H4>The DNS Protocol</H4>
    </A>

    <UL>

    <P>Application programs can use the domain name system via a resolver library (or COM object in our case). 
    The resolver sends queries corresponding to the library function, and waits for responses from the local name server. 
    The local name server can either:
    <UL>
        <LI>Reply immediately if it knows the answer (i.e. if the query is about data in its name space)
        <LI>Reply immediately if the answer is in its cache (DNS data has a Time-To-Live; the data in the cache must not
            have expired yet).
        <LI>Reply with a alternate server name for the request (non-recursive queries). The resolver must then
            send the same query to the alternate server.
        <LI>Send queries to foreign name servers, wait for answers and transmit them to the resolver (recursive queries).
    </UL>
    </P>

    </UL>
</UL>
    <P><CENTER><A HREF="DNSProtocol.jpg"><IMG SRC="DNSProtocol.jpg" ALT="The DNS Protocol" WIDTH=100%></A></CENTER></P>
<UL>
    <UL>

    <P>Queries and Responses are usually sent via UDP (datagrams), in one (or more) packets (some implementations use
    TCP instead of UDP).</P>
    </UL>

    <A NAME="Resource Records">
    <H4>Resource Records</H4>
    </A>

    <UL>

        <P>Information in the DNS is held in Resource Records (RR); when a server replies to a resolver, it sends
        resource records in its response. RRs come in different types and formats, as describes in this section.</A>

        <A NAME="General Resource Record Format">
        <H4>General Resource Record Format</H4>
        </A>

        <UL>
            <P>All RRs have the same top level format shown below:<BR>
            <IMG SRC="DNSResourceRecord.jpg" BORDER=0 ALT="DNS Resource Record Format">
            </P>

            <P>Where:
            <TABLE>
            <TR>
            <TD VALIGN=TOP>NAME</TD><TD>an owner name, i.e., the name of the node to which this resource record pertains.</TD>
            </TR>
            <TR>
            <TD VALIGN=TOP>TYPE</TD><TD>two octets containing one of the RR TYPE codes. Valid types include:
                <UL>
                    <LI>"A" (value 1) a host address
                    <LI>"CNAME" (value 5) the canonical name for an alias
                    <LI>"PTR" (value 12) a domain name pointer
                    <LI>"MX" (value 15) a mail exchanger
                    <LI>etc...
                </UL>
            </TD>
            </TR>
            <TR>
            <TD VALIGN=TOP>CLASS</TD><TD>two octets containing one of the RR CLASS codes. Valid classes are:
                <UL>
                    <LI>"IN" (value 1) the Internet
                    <LI>"CS" (value 2) the CSNET class (Obsolete)
                    <LI>"CH" (value 3) the CHAOS class (MIT)
                    <LI>"HS" (value 4) Hesiod (MIT)

                </UL>
            </TD>
            </TR>
            <TR>
            <TD VALIGN=TOP>TTL</TD><TD>a 32 bit signed integer that specifies the time interval (in seconds)
                    that the resource record may be cached before the source
                    of the information should again be consulted.  Zero
                    values are interpreted to mean that the RR can only be
                    used for the transaction in progress, and should not be
                    cached.</TD>
            </TR>
            <TR>
            <TD VALIGN=TOP>RDLENGTH</TD><TD>an unsigned 16 bit integer that specifies the length in
                    octets of the RDATA field.</TD>
            </TR>
            <TR>
            <TD VALIGN=TOP>RDATA</TD><TD>a variable length string of octets that describes the
                    resource.  The format of this information varies
                    according to the TYPE and CLASS of the resource record. See below for
                    list of the most common types.</TD>
            </TR>
            </TABLE>
            </P>

        </UL>

        <A NAME="Standard Resource Record Formats">
        <H4>Standard Resource Record Formats</H4>
        </A>

        <UL>
            <A NAME="Internet Address Format (A)">
            <H6>Internet Address Format (A)</H6>
            </A>

            <UL>
            <P>The A RR contains an IPv4 address (32 bits):<BR>
            <IMG SRC="DNSResourceRecordA.jpg" BORDER=0 ALT="DNS Resource Record Format (A)">
            </P>
            </UL>

        </UL>

        <UL>
            <A NAME="Canonical Name Format (CNAME)">
            <H6>Canonical Name Format (CNAME)</H6>
            </A>

            <UL>
            <P>The CNAME RR contains a resource name (sequence of labels):<BR>
            <IMG SRC="DNSResourceRecordCNAME.jpg" BORDER=0 ALT="DNS Resource Record Format (CNAME)">
            </P>
            </UL>

        </UL>

        <UL>
            <A NAME="Domain Name Pointer Format (PTR)">
            <H6>Domain Name Pointer Format (PTR)</H6>
            </A>

            <UL>
            <P>The PTR RR contains a resource name (sequence of labels):<BR>
            <IMG SRC="DNSResourceRecordPTR.jpg" BORDER=0 ALT="DNS Resource Record Format (PTR)">
            </P>
            </UL>

        </UL>

        <UL>
            <A NAME="Mail eXchanger Format (MX)">
            <H6>Mail eXchanger Format (MX)</H6>
            </A>

            <UL>
            <P>The MX RR contains a preference (integer, 16 bits) and a resource name (sequence of labels):<BR>
            <IMG SRC="DNSResourceRecordMX.jpg" BORDER=0 ALT="DNS Resource Record Format (MX)">
            </P>
            </UL>

        </UL>

    </UL>

    <A NAME="Well Known DNS Implementations">
    <h4>Well Known DNS Implementations</h4>
    </A>

    <UL>
        <LI>berkeley sockets: the berkeley C library provides a very basic implementation of 
            the DNS via functions <B>gethostbyname</B> (resolve an hostname into its ip address) and 
            <B>gethostbyaddr</B> (reverse: from the ip address, finds the corresponding hostname).
        <LI>Winsock: on Windows, you have the same functions (and their asynchronous versions 
            <B>WSAAsyncGetHostByName</B> and <B>WSAAsyncGetHostByAddr</B>).
        <LI>BIND: the Berkeley Internet Name Domain is the most popular
           implementation of the DNS specifications (full implementation with client
           and server software).
    </UL>

    <A NAME="Resolver Tool: nslookup">
    <h4>Resolver Tool: nslookup</h4>
    </A>

    <UL>
        <P>Windows NT, Windows 2000 and UNIX systems provide a DNS resolver via the command-line program nslookup
        (probably a port of the nslookup program shipped with BIND). With this program,
        you can read information from the DNS database.</P>

        <P>Here's an example sesssion of the nslookup program:</P>
        <UL>
            <LI>Start a MS-DOS command prompt and type the nslookup command:<BR>
            <PRE>
        C:\> <B>nslookup</B>
        Default Server:  mynameserver.mydomain.com
        Address:  XXX.XXX.XXX.XXX

        > <B>myhost.mydomain.com</B>
        Server:  mynameserver.mydomain.com
        Address:  XXX.XXX.XXX.XXX

        Name:    myhost.mydomain.com
        Address:  YYY.YYY.YYY.YYY


        > <B>yourhost.mydomain.com</B>
        *** mynameserver.mydomain.com can't find yourhost.mydomain.com: Non-existent domain
            </PRE>
        </UL>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -