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.99 2008/07/23 15:11:21 grubba Exp $ + // $Id: DNS.pmod,v 1.100 2008/07/24 16:04:20 grubba Exp $   // Not yet finished -- Fredrik Hubinette      //! Domain Name System   //! RFC 1034, RFC 1035 and RFC 2308   //!      #pike __REAL_VERSION__      final constant NOERROR=0;   final constant FORMERR=1;
pike.git/lib/modules/Protocols.pmod/DNS.pmod:94:    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, +  +  //! Type - SPF - Sender Policy Framework (RFC 4408) +  T_SPF=99,   };      //! Low level DNS protocol   class protocol   {    string mklabel(string s)    {    if(sizeof(s)>63)    error("Too long component in domain name.\n");    return sprintf("%c%s",sizeof(s),s);
pike.git/lib/modules/Protocols.pmod/DNS.pmod:194:    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_SPF: +  return Array.map(stringp(entry->spf)? ({entry->spf}):(entry->spf||({})), +  lambda(string t) { +  return sprintf("%1c%s", sizeof(t), t); +  })*"";    case T_LOC:    // FIXME: Not implemented yet.    default:    return "";    }    }       protected private string encode_entries(array(mapping) entries, int pos,    mapping(string:int) comp)    {
pike.git/lib/modules/Protocols.pmod/DNS.pmod:447:    //! @member int "preference"    //! @member string "flags"    //! @member string "service"    //! @member string "regexp"    //! @member string "replacement"    //! @endmapping    //! @value T_TXT    //! @mapping    //! @member string "txt"    //! @endmapping +  //! @value T_SPF +  //! @mapping +  //! @member string "spf" +  //! @endmapping    //! @endint    //! @endarray    array decode_entries(string s,int num, array(int) next)    {    array(string) ret=({});    for(int e=0;e<num && next[0]<sizeof(s);e++)    {    mapping m=([]);    m->name=decode_domain(s,next);    sscanf(s[next[0]..next[0]+10],
pike.git/lib/modules/Protocols.pmod/DNS.pmod:547:    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; +  case T_SPF: +  m->spf = decode_string(s, next); +  break;    }       next[0]=tmp+m->len;    ret+=({m});    }    return ret;    }       mapping decode_res(string s)    {