pike.git
/
lib
/
modules
/
Protocols.pmod
/
DNS.pmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Protocols.pmod/DNS.pmod:313:
string mkquery(string|mapping dnameorquery, int|void cl, int|void type) { if(mappingp(dnameorquery)) return low_low_mkquery(dnameorquery); else return low_mkquery(random(65536),dnameorquery,cl,type); } string decode_domain(string msg, array(int) n) {
-
array(string) domains=({});
-
+
int pos=n[0]; int next=-1; array(string) ret=({}); while(pos < sizeof(msg)) { switch(int len=msg[pos]) { case 0: if(next==-1) next=pos+1; n[0]=next;
pike.git/lib/modules/Protocols.pmod/DNS.pmod:553:
{ if(x[1][0..0]=="_") m->proto=x[1][1..]; else m->proto=x[1]; } m->name=x[2..]*"."; break; case T_A:
-
m->a=
sprintf
(
"%{.%d%}",
values(s[next[0]..next[0]+m->len-1])
)[1
.
.]
;
+
m->a=(
array(string))
values(s[next[0]..next[0]+m->len-1])
*"
.
"
;
break; case T_AAAA:
-
m->aaaa=sprintf("%{
:
%02X%
02X%
}",
-
values(s[next[0]..next[0]+m->len-1])/2)[
1..
];
+
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; aByte = decode_byte(s,next); m->h_perc = pow((aByte>>4)&0xf , aByte&0xf)/100.0;
pike.git/lib/modules/Protocols.pmod/DNS.pmod:640:
m->opcode=(m->c1>>3)&15; m->qr=(m->c1>>7)&1; m->rcode=m->c2&15; m->cd=(m->c2>>4)&1; m->ad=(m->c2>>5)&1; m->ra=(m->c2>>7)&1; m->length=sizeof(s);
-
array(string) tmp=({});
-
+
array(int) next=({12}); m->qd = allocate(m->qdcount); for(int i=0; i<m->qdcount; i++) { m->qd[i]=(["name":decode_domain(s,next)]); sscanf(s[next[0]..next[0]+3],"%2c%2c",m->qd[i]->type, m->qd[i]->cl); next[0]+=4; } m->an=decode_entries(s,m->ancount,next); m->ns=decode_entries(s,m->nscount,next); m->ar=decode_entries(s,m->arcount,next);