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   // RFC 1035    - //! $Id: DNS.pmod,v 1.61 2002/01/13 18:44:33 marcus Exp $ + //! $Id: DNS.pmod,v 1.62 2002/03/09 18:27:04 nilsson 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:33:   constant T_MX=15;   constant T_TXT=16;   constant T_AAAA=28;         class protocol   {    string mklabel(string s)    {    if(strlen(s)>63) -  throw(({"Too long component in domain name\n",backtrace()})); +  error("Too long component in domain name.\n");    return sprintf("%c%s",strlen(s),s);    }       static private string mkname(string|array(string) labels, int pos,    mapping(string:int) comp)    {    if(stringp(labels))    labels = labels/"."-({""});    if(!labels || !sizeof(labels))    return "\0";
pike.git/lib/modules/Protocols.pmod/DNS.pmod:182:    n[0]=next;    return ret*".";       case 1..63:    pos+=len+1;    ret+=({msg[pos-len..pos-1]});    continue;       default:    if((~len)&0xc0) -  throw(({"Invalid message compression mode\n",backtrace()})); +  error("Invalid message compression mode.\n");    if(next==-1) next=pos+2;    pos=((len&63)<<8) + msg[pos+1];    continue;    }    break;    }    }       string decode_string(string s, array(int) next)    {
pike.git/lib/modules/Protocols.pmod/DNS.pmod:370:    handle_response(q, m);    else    handle_query(q, m);    }       void create(int|void port)    {    if(!port)    port = 53;    if(!udp::bind(port)) -  throw(({"DNS: failed to bind port "+port+".\n",backtrace()})); +  error("DNS: failed to bind port "+port+".\n");    udp::set_read_callback(rec_data);    }      }         #define RETRIES 12   #define RETRY_DELAY 5      //! Synchronous DNS client.
pike.git/lib/modules/Protocols.pmod/DNS.pmod:524:    /* FIXME: Is this a good idea?    * Why not just try the fallback?    * /grubba 1999-04-14    *    * Now uses 127.0.0.1 as fallback.    * /grubba 2000-10-17    */    resolv_conf = "nameserver 127.0.0.1";    }   #if 0 -  throw(({ "Protocols.DNS.client(): No /etc/resolv.conf!\n", -  backtrace() })); +  error( "Protocols.DNS.client(): No /etc/resolv.conf!\n" );   #endif /* 0 */    }       if (resolv_conf)    foreach(resolv_conf/"\n", string line)    {    string rest;    sscanf(line,"%s#",line);    sscanf(line,"%*[\r \t]%s",line);    line=reverse(line);
pike.git/lib/modules/Protocols.pmod/DNS.pmod:965:    a = column(mx, "mx");    sort(column(mx, "preference"), a);    }    callback(a, @args);    }, callback, @args);    }       void create(void|string|array(string) server, void|string|array(string) domain)    {    if(!udp::bind(0)) -  throw(({"DNS: failed to bind a port.\n",backtrace()})); +  error( "DNS: failed to bind a port.\n" );       udp::set_read_callback(rec_data);    ::create(server,domain);    }   };