- HEADER *header = (HEADER *) buf;
-#ifndef HAVE_LRAND48
- int k = 0;
- struct timeval tv;
-#endif
- /*
- * generate an unique id
- * NOTE: we don't have to worry about converting this to and from
- * network byte order, the nameserver does not interpret this value
- * and returns it unchanged
- */
-#ifdef HAVE_LRAND48
- do
- {
- header->id = (header->id + lrand48()) & 0xffff;
- } while (find_id(header->id));
-#else
- gettimeofday(&tv, NULL);
- do
- {
- header->id = (header->id + k + tv.tv_usec) & 0xffff;
- k++;
- } while (find_id(header->id));
-#endif /* HAVE_LRAND48 */
- request->id = header->id;