/*****************************************************************************/
/* Advanced resolving Program */
/* */
/* The client get the following input: */
/* Entity (address, reverse, MX, etc.) we want to get details about */
/* Usually we would use the following values,details in <arpa/nameser.h> */
/* ns_c_in as class field (its value is 1) */
/* The type field can be: */
/* ns_t_a = 1, /* Host address. */
/* ns_t_ns = 2, /* Authoritative server. */
/* ns_t_cname = 5, /* Canonical name. */
/* ns_t_soa = 6, /* Start of authority zone. */
/* ns_t_ptr = 12, /* Domain name pointer. */
/* ns_t_mx = 15, /* Mail routing information. */
/* */
/* */
/* */
/* Process: */
/* The program issues resolving procedure (res_query) and the */
/* addresses returned are printed on the screen. */
/* */
/* */
/* */
/* */
/* */
/* Writen by Eddie Aronovich Nov 2001. */
/* */
/*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/utsname.h>
#include <arpa/nameser.h>
#include <resolv.h>
int
main(int argc, char **argv)
{
char *ptr; /* Pointer for the address list */
char **pptr; /* Pointer for the alias list */
struct hostent *hptr; /* hostentry struct */
char str[INET_ADDRSTRLEN]; /* IP (v4) address length */
char resolv[1024]; /* The resolve reply */
int res_len=1024;
if (res_query("homtmail.com.", ns_c_in, ns_t_mx, resolv, res_len) < 0){
herror ("Error ");
}
printf("Reply from mx query size is: %d \n", res_len);
res_len = 1024;
if (res_query("homtmail.com.", ns_c_in, ns_t_ns, resolv, res_len) < 0){
herror ("Error ");
}
printf("Reply from mx query size is: %d \n", res_len);
exit(0);
}