test-resolve.c revision 607553f9306286fdccf0b356bc3d1087adfe21c4
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2005-2008 Lennart Poettering
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.
systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <string.h>
#include <stdio.h>
#include <resolv.h>
#include <assert.h>
#include <signal.h>
#include <errno.h>
#include "sd-resolve.h"
#include "resolve-util.h"
#include "macro.h"
int r = 1, ret;
struct sockaddr_in sa = {};
if (!resolve)
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 */
if (ret)
else {
struct addrinfo *i;
char t[256];
const char *p = NULL;
printf("%s\n", p);
}
}
/* Interpret the result of the addr -> name query */
if (ret)
else
/* Interpret the result of the SRV lookup */
if (ret < 0) {
} 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;
}