test-dns.c revision e963e3ada17e7592ad499b9d7fbb3355287a05ca
/***
This file is part of libasyncns.
Copyright 2005-2008 Lennart Poettering
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 2.1 of the
License, or (at your option) any later version.
libasyncns is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with libasyncns. If not, see
***/
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <stdio.h>
#include <resolv.h>
#include <assert.h>
#include <signal.h>
#include <errno.h>
#include "sd-dns.h"
#include "dns-util.h"
#include "macro.h"
int r = 1, ret;
struct sockaddr_in sa = {};
if (!asyncns)
log_oom();
/* Make a name -> address query */
if (!q1)
/* Make an address -> name query */
if (!q2)
/* Make a res_query() call */
if (!q3)
/* Wait until the three queries are completed */
}
}
/* Interpret the result of the name -> addr query */
else {
struct addrinfo *i;
char t[256];
const char *p = NULL;
printf("%s\n", p);
}
}
/* Interpret the result of the addr -> name query */
else
/* Interpret the result of the SRV lookup */
} else if (ret == 0) {
} else {
int qdcount;
int ancount;
int len;
char name[256];
/* Ignore the questions */
}
/* Parse the answers */
/* Ignore the initial string */
/* Ignore type, ttl, class and dlen */
pos += 10;
printf("\tpreference: %2d weight: %2d port: %d host: %s\n",
}
}
r = 0;
return r;
}