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

version» Context lines:

pike.git/lib/modules/Protocols.pmod/DNS.pmod:408:    return map(stringp(entry->txt)? ({entry->txt}):(entry->txt||({})),    lambda(string t) {    return sprintf("%1H", t);    })*"";    case T_SPF:    return map(stringp(entry->spf)? ({entry->spf}):(entry->spf||({})),    lambda(string t) {    return sprintf("%1H", t);    })*"";    case T_LOC: -  // FIXME: Not implemented yet. +  int encode_T_LOC_tinyfloat(float|int subject) +  { +  int power = min((int)(log(subject*100.0)/log(10.0)), 9); +  int base = min((int)(subject*100.0/pow(10.0,power)), 9); +  return ((base&0xf)<<4)|(power&0xf); +  }; +  if ((entry->version? entry->version:1) != 1) +  error("Only T_LOC version 1 is supported"); +  return sprintf("%1c%1c%1c%1c%4c%4c%4c", +  0, // Only version that currently exists +  encode_T_LOC_tinyfloat(entry->size? entry->size:100.0), //Default is 1M +  encode_T_LOC_tinyfloat(entry->h_prec? entry->h_prec:1000*100.0), // Default is 10KM +  encode_T_LOC_tinyfloat(entry->v_prec? entry->v_prec:10*100.0), // Default is 10M +  entry->lat?(int)(entry->lat*3600000.0)+(2<<30):2<<30, // Default is 2<<30 which is 0.0 +  entry->long?(int)(entry->long*3600000.0)+(2<<30):2<<30, // Default is 2<<30 which is 0.0 +  entry->alt?(int)((entry->alt+100000)*100):100000, // Default to 0 WGS84 (which is 100000) +  );    default:    return "";    }    }       protected private string encode_entries(array(mapping) entries, int pos,    mapping(string:int) comp)    {    string res="";    foreach(entries, mapping entry) {
pike.git/lib/modules/Protocols.pmod/DNS.pmod:627:    //! @value T_AAAA    //! @mapping    //! @member string "aaaa"    //! IPv6-address in colon-separated hexadecimal format.    //! @endmapping    //! @value T_LOC    //! @mapping    //! @member int "version"    //! Version, currently only version @expr{0@} (zero) is    //! supported. -  //! @member int "size" -  //! @member int "h_perc" -  //! @member int "v_perc" -  //! @member int "lat" -  //! @member int "long" -  //! @member int "alt" +  //! @member float "size" +  //! @member float "h_perc" +  //! @member float "v_perc" +  //! @member float "lat" +  //! @member float "long" +  //! @member float "alt"    //! @endmapping    //! @value T_SOA    //! @mapping    //! @member string "mname"    //! @member string "rname"    //! @member int "serial"    //! @member int "refresh"    //! @member int "retry"    //! @member int "expire"    //!
pike.git/lib/modules/Protocols.pmod/DNS.pmod:744:    case T_AAAA:    m->aaaa=sprintf("%{%02X%}",    (values(s[next[0]..next[0]+m->len-1])/2)[*])*":";    break;    case T_LOC:    m->version = decode_byte(s,next);    if (m->version == 0)    {    int aByte;    aByte = decode_byte(s,next); -  m->size = pow((aByte>>4)&0xf , aByte&0xf)/100.0; +  m->size = (((aByte>>4)&0xf)%10)*(pow(10,(aByte&0xf)%10)/100.0);    aByte = decode_byte(s,next); -  m->h_perc = pow((aByte>>4)&0xf , aByte&0xf)/100.0; +  m->h_perc = (((aByte>>4)&0xf)%10)*(pow(10,(aByte&0xf)%10)/100.0);    aByte = decode_byte(s,next); -  m->v_perc = pow((aByte>>4)&0xf , aByte&0xf)/100.0; +  m->v_perc = (((aByte>>4)&0xf)%10)*(pow(10,(aByte&0xf)%10)/100.0);    m->lat = ((decode_int(s,next)-(2<<30))/3600000.0);    m->long = ((decode_int(s,next)-(2<<30))/3600000.0);    m->alt = ((decode_int(s,next)/100.0)-100000.0);    }    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);