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

version» Context lines:

pike.git/lib/modules/Protocols.pmod/DNS.pmod:1: - // $Id: DNS.pmod,v 1.89 2006/12/11 15:52:57 bill Exp $ + // $Id: DNS.pmod,v 1.90 2007/03/19 10:52:48 grubba Exp $   // Not yet finished -- Fredrik Hubinette      //! Domain Name System   //! RFC 1035      #pike __REAL_VERSION__      constant NOERROR=0;   constant FORMERR=1;   constant SERVFAIL=2;
pike.git/lib/modules/Protocols.pmod/DNS.pmod:87:       //! Type - IPv6 address record (RFC 1886, deprecated)    T_AAAA=28,       //! Type - Location Record (RFC 1876)    T_LOC=29,       //! Type - Service location record (RFC 2782)    T_SRV=33,    +  //! Type - NAPTR (RFC 3403) +  T_NAPTR=35, +     //! Type - IPv6 address record (RFC 2874, incomplete support)    T_A6=38,   };      //! Low level DNS protocol   class protocol   {    string mklabel(string s)    {    if(sizeof(s)>63)
pike.git/lib/modules/Protocols.pmod/DNS.pmod:175:    mkname(entry->target||"", pos+6, c);    case T_A:    return sprintf("%@1c", (array(int))((entry->a||"0.0.0.0")/".")[0..3]);    case T_AAAA:    return make_raw_addr6(entry->aaaa);    case T_SOA:    string mname = mkname(entry->mname, pos, c);    return mname + mkname(entry->rname, pos+sizeof(mname), c) +    sprintf("%4c%4c%4c%4c%4c", entry->serial, entry->refresh,    entry->retry, entry->expire, entry->minimum); +  case T_NAPTR: +  string rnaptr = sprintf("%2c%2c", entry->order, entry->preference); +  rnaptr += sprintf("%1c%s%1c%s%1c%s%s", +  sizeof(entry->flags || ""), entry->flags || "", +  sizeof(entry->service || ""), entry->service || "", +  sizeof(entry->regexp || ""), entry->regexp || "", +  mkname(entry->replacement, pos, c)); +  return rnaptr; +     case T_TXT:    return Array.map(stringp(entry->txt)? ({entry->txt}):(entry->txt||({})),    lambda(string t) {    return sprintf("%1c%s", sizeof(t), t);    })*"";    case T_LOC:    // FIXME: Not implemented yet.    default:    return "";    }
pike.git/lib/modules/Protocols.pmod/DNS.pmod:411:    break;    case T_SOA:    m->mname=decode_domain(s,next);    m->rname=decode_domain(s,next);    m->serial=decode_int(s,next);    m->refresh=decode_int(s,next);    m->retry=decode_int(s,next);    m->expire=decode_int(s,next);    m->minimum=decode_int(s,next);    break; +  case T_NAPTR: +  m->order = decode_short (s, next); +  m->preference = decode_short (s, next); +  m->flags = decode_string (s, next); +  m->service = decode_string (s, next); +  m->regexp = decode_string (s, next); +  m->replacement = decode_domain (s, next); +  break;    case T_TXT:    m->txt = decode_string(s, next);    break;    }       next[0]=tmp+m->len;    ret+=({m});    }    return ret;    }