5 int __res_mkquery(int op
, const char *dname
, int class, int type
,
6 const unsigned char *data
, int datalen
,
7 const unsigned char *newrr
, unsigned char *buf
, int buflen
)
12 size_t l
= strnlen(dname
, 255);
15 if (l
&& dname
[l
-1]=='.') l
--;
17 if (l
>253 || buflen
<n
|| op
>15u || class>255u || type
>255u)
20 /* Construct query template - ID will be filled later */
24 memcpy((char *)q
+13, dname
, l
);
25 for (i
=13; q
[i
]; i
=j
+1) {
26 for (j
=i
; q
[j
] && q
[j
] != '.'; j
++);
27 if (j
-i
-1u > 62u) return -1;
33 /* Make a reasonably unpredictable id */
34 clock_gettime(CLOCK_REALTIME
, &ts
);
35 id
= ts
.tv_nsec
+ ts
.tv_nsec
/65536UL & 0xffff;
43 weak_alias(__res_mkquery
, res_mkquery
);