tmore - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 18d5a36a28e13cac153791c0461649478f902c6f
 (DIR) parent 6021858725893ba1e8973c25b8da0f462e781b67
 (HTM) Author: rsc <devnull@localhost>
       Date:   Fri, 27 Jan 2006 08:56:16 +0000
       
       more
       
       Diffstat:
         M src/libndb/sysdnsquery.c            |     128 +++++++++++++++----------------
       
       1 file changed, 63 insertions(+), 65 deletions(-)
       ---
 (DIR) diff --git a/src/libndb/sysdnsquery.c b/src/libndb/sysdnsquery.c
       t@@ -96,8 +96,49 @@ enum
        {
                MAXRR = 100,
                MAXDNS = 4096,
       +
       +        /* RR types */
       +        Ta=        1,
       +        Tns=        2,
       +        Tmd=        3,
       +        Tmf=        4,
       +        Tcname=        5,
       +        Tsoa=        6,
       +        Tmb=        7,
       +        Tmg=        8,
       +        Tmr=        9,
       +        Tnull=        10,
       +        Twks=        11,
       +        Tptr=        12,
       +        Thinfo=        13,
       +        Tminfo=        14,
       +        Tmx=        15,
       +        Ttxt=        16,
       +        Trp=        17,
       +        Tsig=        24,
       +        Tkey=        25,
       +        Taaaa=        28,
       +        Tcert=        37,
       +
       +        /* query types (all RR types are also queries) */
       +        Tixfr=        251,        /* incremental zone transfer */
       +        Taxfr=        252,        /* zone transfer */
       +        Tmailb=        253,        /* { Tmb, Tmg, Tmr } */        
       +        Tall=        255,        /* all records */
       +
       +        /* classes */
       +        Csym=        0,        /* internal symbols */
       +        Cin=        1,        /* internet */
       +        Ccs,                /* CSNET (obsolete) */
       +        Cch,                /* Chaos net */
       +        Chs,                /* Hesiod (?) */
       +
       +        /* class queries (all class types are also queries) */
       +        Call=        255,        /* all classes */
       +
        };
        
       +
        static int name2type(char*);
        static uchar *skipquestion(uchar*, uchar*, uchar*, int);
        static uchar *unpack(uchar*, uchar*, uchar*, Ndbtuple**, int);
       t@@ -121,7 +162,7 @@ doquery(char *name, char *type)
                if(buf == nil)
                        return nil;
        
       -        if((n = res_search(name, ns_c_in, nstype, buf, MAXDNS)) < 0){
       +        if((n = res_search(name, Cin, nstype, buf, MAXDNS)) < 0){
                        free(buf);
                        return nil;
                }
       t@@ -144,49 +185,6 @@ doquery(char *name, char *type)
                return t;
        }
        
       -enum
       -{
       -        /* RR types */
       -        Ta=        1,
       -        Tns=        2,
       -        Tmd=        3,
       -        Tmf=        4,
       -        Tcname=        5,
       -        Tsoa=        6,
       -        Tmb=        7,
       -        Tmg=        8,
       -        Tmr=        9,
       -        Tnull=        10,
       -        Twks=        11,
       -        Tptr=        12,
       -        Thinfo=        13,
       -        Tminfo=        14,
       -        Tmx=        15,
       -        Ttxt=        16,
       -        Trp=        17,
       -        Tsig=        24,
       -        Tkey=        25,
       -        Taaaa=        28,
       -        Tcert=        37,
       -
       -        /* query types (all RR types are also queries) */
       -        Tixfr=        251,        /* incremental zone transfer */
       -        Taxfr=        252,        /* zone transfer */
       -        Tmailb=        253,        /* { Tmb, Tmg, Tmr } */        
       -        Tall=        255,        /* all records */
       -
       -        /* classes */
       -        Csym=        0,        /* internal symbols */
       -        Cin=        1,        /* internet */
       -        Ccs,                /* CSNET (obsolete) */
       -        Cch,                /* Chaos net */
       -        Chs,                /* Hesiod (?) */
       -
       -        /* class queries (all class types are also queries) */
       -        Call=        255,        /* all classes */
       -
       -};
       -
        static struct {
                char *s;
                int t;
       t@@ -315,7 +313,7 @@ rrnext(uchar *buf, uchar *ebuf, uchar *p, Ndbtuple **tt)
                rrlen = G2(p+8);
                p += 10;
                
       -        if(rrtype == ns_t_ptr)
       +        if(rrtype == Tptr)
                        first = ndbnew("ptr", b);
                else
                        first = ndbnew("dom", b);
       t@@ -323,27 +321,27 @@ rrnext(uchar *buf, uchar *ebuf, uchar *p, Ndbtuple **tt)
                switch(rrtype){
                default:
                        goto end;
       -        case ns_t_hinfo:
       +        case Thinfo:
                        t = rrunpack(buf, ebuf, &p, "YY", "cpu", "os");
                        break;
       -        case ns_t_minfo:
       +        case Tminfo:
                        t = rrunpack(buf, ebuf, &p, "NN", "mbox", "mbox");
                        break;
       -        case ns_t_mx:
       +        case Tmx:
                        t = rrunpack(buf, ebuf, &p, "SN", "pref", "mx");
                        break;
       -        case ns_t_cname:
       -        case ns_t_md:
       -        case ns_t_mf:
       -        case ns_t_mg:
       -        case ns_t_mr:
       -        case ns_t_mb:
       -        case ns_t_ns:
       -        case ns_t_ptr:
       -        case ns_t_rp:
       +        case Tcname:
       +        case Tmd:
       +        case Tmf:
       +        case Tmg:
       +        case Tmr:
       +        case Tmb:
       +        case Tns:
       +        case Tptr:
       +        case Trp:
                        t = rrunpack(buf, ebuf, &p, "N", type2name(rrtype));
                        break;
       -        case ns_t_a:
       +        case Ta:
                        if(rrlen != IPv4addrlen)
                                goto corrupt;
                        memmove(ip, v4prefix, IPaddrlen);
       t@@ -352,37 +350,37 @@ rrnext(uchar *buf, uchar *ebuf, uchar *p, Ndbtuple **tt)
                        t = ndbnew("ip", tmp);
                        p += rrlen;
                        break;
       -        case ns_t_aaaa:
       +        case Taaaa:
                        if(rrlen != IPaddrlen)
                                goto corrupt;
                        snprint(tmp, sizeof tmp, "%I", ip);
                        t = ndbnew("ip", tmp);
                        p += rrlen;
                        break;
       -        case ns_t_null:
       +        case Tnull:
                        snprint(tmp, sizeof tmp, "%.*H", rrlen, p);
                        t = ndbnew("null", tmp);
                        p += rrlen;
                        break;
       -        case ns_t_txt:
       +        case Ttxt:
                        t = rrunpack(buf, ebuf, &p, "Y", "txt");
                        break;
        
       -        case ns_t_soa:
       +        case Tsoa:
                        t = rrunpack(buf, ebuf, &p, "NNLLLLL", "ns", "mbox", 
                                "serial", "refresh", "retry", "expire", "ttl");
                        break;
        
       -        case ns_t_key:
       +        case Tkey:
                        t = rrunpack(buf, ebuf, &p, "SCCY", "flags", "proto", "alg", "key");
                        break;
                
       -        case ns_t_sig:
       +        case Tsig:
                        t = rrunpack(buf, ebuf, &p, "SCCLLLSNY", "type", "alg", "labels",
                                "ttl", "exp", "incep", "tag", "signer", "sig");
                        break;
                
       -        case ns_t_cert:
       +        case Tcert:
                        t = rrunpack(buf, ebuf, &p, "SSCY", "type", "tag", "alg", "cert");
                        break;
                }