#include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> int res_findzonecut2(state* res, const char *domain_name, ns_class class, int options, char *zone_name, size_t zone_size, union res_sockaddr_union *addresses, int num_addresses)
The res_findzonecut2() function queries name servers until it finds the enclosing zone and its master name servers for the specified domain name.
res_findzonecut2() differs from res_findzonecut() in that res_findzonecut2() can return IPv6 master name server addresses in the res_sockaddr_union, which is defined in <resolv.h>.union res_sockaddr_union { struct sockaddr_in sin; struct sockaddr_in6 sin6; int64_t __align64; /* 64bit alignment */ char __space[128]; /* max size */ };
The following options are defined for res_findzonecut2() to limit the type of master name server address returned:
#define RES_IPV4ONLY 0x00000002 /* IPv4 only */ #define RES_IPV6ONLY 0x00000004 /* IPv6 only */
For a discussion of the remaining parameters, authorities required, return values, and other related information, see res_findzonecut()--Find the Enclosing Zone and Servers.