1034 Resolver Algo Question

William Stacey staceyw at mvps.org
Wed Aug 18 18:44:45 UTC 2004


Trying to do some pseudocode to get my head around resolver process better.
Is this close or could you please change or add to fix?  TIA.

///
/// 5.3.3 Algorithm Pseudocode
///
Step1:
    reply = IsLocal(question);
    if ( reply != null )
        return reply;

Step2:
    slist = FindBestServers(question)

Step3:
    reply = slist.Ask(question)

Step4:
    if ( reply.Header.RCode == RCode.NoError )
    {
        if ( reply.AnswerSection.Count > 0 )
        {
            if ( answersection answers the question ? ) // 4a.
            {
                CacheReply(reply);
                return reply;
            }
            if ( answer is CNAME ? ) // 4c.
            {
                CacheCName(reply);
                question.SName = GetCName(reply);
                goto Step1;
            }
        }
        if ( reply.AuthoritySection.Count > 0 ) // 4b.
        {
            CacheNS(reply);
            goto Step2;
        }
        else
            // nxrrset ? - noerror + noAnswers + noDelegations
            Error("bad reply"); // Not sure this is needed or what to do
here.
    }
    else if ( nxdomain ) // Part of 4a.
    {
        CacheNX(reply);
        return reply;
    }
    else // 4d.
    {
       slist.RemoveCurrentServer();
       goto Step3;
    }
/// Done

-- 
William Stacey




More information about the bind-users mailing list