pike.git / lib / modules / Protocols.pmod / DNS.pmod

version» Context lines:

pike.git/lib/modules/Protocols.pmod/DNS.pmod:1:   // Not yet finished -- Fredrik Hubinette   //! Domain Name System   //! RFC 1035 - //! $Id: DNS.pmod,v 1.67 2002/12/01 21:08:59 bill Exp $ + //! $Id: DNS.pmod,v 1.68 2002/12/01 22:46:06 bill Exp $      #pike __REAL_VERSION__      constant NOERROR=0;   constant FORMERR=1;   constant SERVFAIL=2;   constant NXDOMAIN=3;   constant NOTIMPL=4;   constant NXRRSET=8;   
pike.git/lib/modules/Protocols.pmod/DNS.pmod:214:   //!   //! @param dnameorquery   //! @param cl   //! record class such as Protocols.DNS.C_IN   //! @param type   //! query type such Protocols.DNS.T_A   //!   //! @returns   //! data suitable for use with   //! @[Protocols.DNS.client.do_sync_query] + //! + //! @example + //! // generate a query PDU for a address lookup on the hostname pike.ida.liu.se + //! string q=Protocols.DNS.protocol()->mkquery("pike.ida.liu.se", Protocols.DNS.C_IN, Protocols.DNS.T_A);    string mkquery(string|mapping dnameorquery, int|void cl, int|void type)    {    if(mappingp(dnameorquery))    return low_low_mkquery(dnameorquery);    else    return low_mkquery(random(65536),dnameorquery,cl,type);    }       string decode_domain(string msg, array(int) n)    {
pike.git/lib/modules/Protocols.pmod/DNS.pmod:695:    domains = ({ domain });    }    }      //! perform a syncronous query   //!   //! @param s   //! result of @[Protocols.DNS.protocol.mkquery]   //! @returns   //! mapping containing query result or 0 on failure/timeout + //! + //! @example + //! // perform a hostname lookup, results stored in r->an + //! object d=Protocols.DNS.client(); + //! mapping r=d->do_sync_query(d->mkquery("pike.ida.liu.se", C_IN, T_A));    mapping do_sync_query(string s)    {    object udp = Stdio.UDP();    udp->bind(0);    mapping m;    int i;    for (i=0; i < RETRIES; i++) {    udp->send(nameservers[i % sizeof(nameservers)], 53, s);       // upd->wait() can throw an error sometimes.