50 #include <arpa/inet.h>
52 # define BIND_8_COMPAT 1
54 #include <arpa/nameser.h>
55 #include <netinet/in.h>
58 #define NCBI_USE_ERRCODE_X Connect_LBSM
61 #define SizeOf(a) (sizeof(a) / sizeof((a)[0]))
65 #define max(a, b) ((a) > (b) ? (a) : (b))
67 #define SERVNSD_TXT_RR_PORT_LEN (sizeof(SERVNSD_TXT_RR_PORT)-1)
69 #define LBDNS_INITIAL_ALLOC 32
72 #if defined(HAVE_SOCKLEN_T) || defined(_SOCKLEN_T)
152 sprintf(
buf,
"TYPE(%hu)", (
unsigned short) atype);
167 sprintf(
buf,
"CLASS(%hu)", (
unsigned short) aclass);
190 sprintf(
buf,
"RCODE(%hu)", rcode);
211 sprintf(
buf,
"OPCODE(%hu)", opcode);
219 #ifdef NETDB_INTERNAL
221 return "Internal error";
223 #ifdef HOST_NOT_FOUND
225 return "Host not found";
229 return "Server failure";
233 return "Unrecoverable error";
236 # if !defined(NO_DATA) || NO_DATA != NO_ADDRESS
238 return "No address record found";
243 return "No data of requested type";
248 return hstrerror(err);
256 size_t len = strlen(ptr);
263 ptr += sprintf(ptr,
", AA");
265 ptr += sprintf(ptr,
", TC");
267 ptr += sprintf(ptr,
", RD");
269 ptr += sprintf(ptr,
", RA");
271 ptr += sprintf(ptr,
", Z?");
273 ptr += sprintf(ptr,
", AD");
275 ptr += sprintf(ptr,
", CD");
276 sprintf(ptr,
", %s",
x_RcodeStr(hdr->rcode, rcode));
285 (
"DNS %s (ID=%hu, 0x%04hX):\n"
287 "\tQD: %hu, AN: %hu, NS: %hu, AR: %hu",
288 hdr->qr ?
"REPLY" :
"QUERY",
290 ntohs(((
const unsigned short*) hdr)[1]),
296 static void x_DumpRR(
const ns_rr* rr,
const char* part,
unsigned short n)
298 char clbuf[40], tybuf[40], ttlbuf[40], szbuf[40];
300 sprintf(ttlbuf,
" %lu", (
unsigned long) ns_rr_ttl(*rr));
301 sprintf(szbuf,
" (%u)", ns_rr_rdlen(*rr));
303 *ttlbuf = *szbuf =
'\0';
305 (
"%s%s %2hu: %s%s %s %s%s",
307 part ?
" RR" :
" ",
n,
308 ns_rr_name(*rr), ttlbuf,
310 x_TypeStr(ns_rr_type(*rr), tybuf), szbuf));
314 static int unpack_rr(
const unsigned char*
msg,
const unsigned char* eom,
315 const unsigned char* ptr, ns_rr* rr,
int qd,
318 const char* what = qd ?
"QD" :
"RR";
321 memset(rr, 0,
sizeof(*rr));
322 if ((
len = dn_expand(
msg, eom, ptr, rr->name,
sizeof(rr->name))) <= 0) {
323 CORE_LOGF(level, (
"DNS %s cannot expand name", what));
327 size = qd ? NS_QFIXEDSZ : NS_RRFIXEDSZ;
328 if (ptr +
size > eom) {
329 CORE_LOGF(level, (
"DNS %s overrun", what));
332 assert(NS_QFIXEDSZ == NS_INT16SZ*2);
333 assert(NS_RRFIXEDSZ == NS_INT16SZ*2 + NS_INT32SZ + NS_INT16SZ);
334 NS_GET16(rr->type, ptr);
335 NS_GET16(rr->rr_class, ptr);
338 NS_GET32(rr->ttl, ptr);
339 NS_GET16(rr->rdlength, ptr);
342 (
"DNS RR %s RDATA empty",
344 }
else if (ptr + rr->rdlength > eom) {
346 (
"DNS RR %s RDATA overrun",
350 size += rr->rdlength;
357 static int skip_rr(
const unsigned char* ptr,
const unsigned char* eom,
360 const char* what = qd ?
"QD" :
"RR";
363 if ((
len = dn_skipname(ptr, eom)) <= 0) {
368 size = qd ? NS_QFIXEDSZ : NS_RRFIXEDSZ;
369 if (ptr +
size > eom) {
374 unsigned short rdlen;
375 ptr += NS_INT16SZ*2 + NS_INT32SZ;
376 NS_GET16(rdlen, ptr);
377 if (ptr + rdlen > eom) {
388 const unsigned char* eom)
390 static const char* kPart[] = { 0,
"AN",
"NS",
"AR" };
391 const unsigned char* ptr =
msg + NS_HFIXEDSZ;
392 const HEADER* hdr = (
const HEADER*)
msg;
396 assert(
sizeof(*hdr) == NS_HFIXEDSZ);
397 count[0] = ntohs(hdr->qdcount);
398 count[1] = ntohs(hdr->ancount);
399 count[2] = ntohs(hdr->nscount);
400 count[3] = ntohs(hdr->arcount);
406 unsigned short c = 0;
429 (
"LBDNS cannot create entry for \"%s\"", iter->
name));
436 for (
n = 0;
n <
data->n_cand; ++
n) {
441 (
"LBDNS ignoring duplicate entry: \"%s\" %s", name,
442 infostr ? infostr :
"<NULL>"));
450 n =
data->a_cand << 1;
452 + (
n - 1) *
sizeof(
data->cand));
455 (
"LBDNS cannot add entry for \"%s\"", iter->
name));
467 (
"LBDNS adding \"%s\" @%p %s", name,
info,
468 infostr ? infostr :
"NULL"));
486 for (
n = 0;
n <
data->n_cand; ++
n) {
489 char buf[INET6_ADDRSTRLEN];
499 x_info->
host = (
unsigned int)(-1);
502 }
else if (
host &&
info->host == (
unsigned int)(-1)) {
511 (
"LBDNS cannot re-update entry \"%s\" @%p with host"
515 if (x_info !=
info) {
518 }
else if (
data->debug) {
521 (
"LBDNS updating entry \"%s\" @%p with host \"%s\": %s",
528 (
"LBDNS multiple entries updated with host \"%s\":"
543 for (
n = 0;
n <
data->n_cand; ++
n) {
550 (
"LBDNS updating entry \"%s\" @%p with port: %hu",
574 double tens = floor(rate / 10.0);
575 return (tens + (rate - tens * 10.0 < 10.0 ? 1.0 : 0.0)) * 10.0;
585 __attribute__((packed))
592 const unsigned char* eom,
const char* fqdn,
593 unsigned short rdlen,
const unsigned char* rdata)
595 const unsigned char* start = rdata;
596 char target[NS_MAXDNAME];
601 if (rdlen <=
sizeof(srv)) {
603 (
"DNS SRV RR RDATA too short: %hu", rdlen));
606 memset(&srv, 0,
sizeof(srv));
608 NS_GET16(srv.
weight, rdata);
609 NS_GET16(srv.
port, rdata);
610 if ((rv = dn_expand(
msg, eom, rdata, target,
sizeof(target))) <= 0) {
614 if (&rdata[rv] > &start[rdlen]) {
620 (
"DNS SRV RR %s -> %s:%hu %hu %hu", fqdn,
621 *target ? target :
".",
624 if (&rdata[rv] != &start[rdlen]) {
625 assert(&rdata[rv] < &start[rdlen]);
627 (
"DNS SRV RR %lu/%hu byte(s) remain unparsed",
628 (
unsigned long)(&start[rdlen] - &rdata[rv]), rdlen));
630 if (!target[0] || (target[0] ==
'.' && !target[1])) {
635 }
else if (!srv.
port) {
650 unsigned short rdlen,
const unsigned char* rdata)
652 unsigned int len = 0;
653 while (
len < rdlen) {
655 unsigned short slen = *rdata++;
656 if ((
len += 1 + slen) > rdlen) {
669 (
"DNS TXT RR %s: \"%.*s\"", fqdn,
670 (
int) slen, (
const char*) rdata));
674 memcpy(
buf, rdata, slen);
677 if (sscanf(
buf,
"%hu%n", &
port, &
n) > 0 &&
n == (
int) slen &&
port)
687 unsigned short rdlen,
const unsigned char* rdata)
690 char buf[INET6_ADDRSTRLEN];
696 assert(
sizeof(ipv4) == NS_INADDRSZ);
697 assert(
sizeof(ipv6) == NS_IN6ADDRSZ);
698 if (rtype == ns_t_a && NS_INADDRSZ <= rdlen) {
699 memcpy(&ipv4, rdata,
sizeof(ipv4));
702 (
"DNS A RR %s @ %s", fqdn,
703 inet_ntop(AF_INET, &ipv4,
706 if (!ipv4 || ipv4 == (
unsigned int)(-1)) {
709 (
"DNS A RR bad IPv4 ignored: %s",
buf));
714 }
else if (rtype == ns_t_aaaa && NS_IN6ADDRSZ <= rdlen) {
715 memcpy(&ipv6, rdata,
sizeof(ipv6));
718 (
"DNS AAAA RR %s @ %s", fqdn,
719 inet_ntop(AF_INET6, &ipv6,
726 (
"DNS AAAA RR bad IPv6 ignored: %s",
buf));
732 (
"DNS %s RR RDATA bad size: %hu",
738 (
"DNS %s RR %u/%hu byte(s) remain unparsed",
741 if (qtype == ns_t_srv)
744 x_info.time += iter->
time;
748 x_info.host = (
unsigned int)(-1);
754 const unsigned char*
msg,
755 const unsigned char* eom,
757 unsigned short rdlen,
758 const unsigned char* rdata)
760 char cname[NS_MAXDNAME];
763 if ((rv = dn_expand(
msg, eom, rdata, cname,
sizeof(cname))) <= 0) {
767 if (rv > (
int) rdlen) {
773 (
"DNS CNAME RR %s -> %s",
776 if (rv != (
int) rdlen) {
779 (
"DNS CNAME RR %d/%hu byte(s) remain unparsed",
780 (
int) rdlen - rv, rdlen));
784 (
"DNS CNAME RR cannot store cname \"%s\" for \"%s\"",
794 size_t lena = strlen(
a);
795 size_t lenb = strlen(
b);
796 if (lena &&
a[lena - 1] ==
'.')
798 if (lenb &&
b[lenb - 1] ==
'.')
806 const char* fqdn, ns_type
type,
807 const unsigned char*
msg,
808 const unsigned char* eom,
809 const unsigned char* ptr,
810 unsigned short count[3])
815 const char* cname = 0;
820 for (
n = 0;
n < 3; ++
n) {
822 for (c = 0; c <
count[
n]; ++c) {
824 int skip =
n && ((
n & 1) ||
type != ns_t_srv);
833 if (ns_rr_class(rr) != ns_c_in || !ns_rr_rdlen(rr))
835 if (!
n &&
type == ns_t_srv &&
836 ns_rr_type(rr) != ns_t_srv && ns_rr_type(rr) != ns_t_cname) {
841 (
"DNS reply AN %u \"%s\" mismatch FQDN \"%s\"",
842 c + 1, ns_rr_name(rr), fqdn));
845 if (ns_rr_type(rr) == ns_t_cname) {
849 ns_rr_rdlen(rr), ns_rr_rdata(rr));
858 (
"DNS CNAME RR misplaced @A%c %u",
863 if (!
n &&
type == ns_t_srv) {
865 assert(ns_rr_type(rr) == ns_t_srv);
867 ns_rr_name(rr), ns_rr_rdlen(rr), ns_rr_rdata(rr));
869 if (rv < 0 && data->
n_cand) {
871 "DNS SRV RR blank target misplaced");
877 if (!
n &&
type != ns_t_srv && ns_rr_type(rr) == ns_t_txt) {
880 ns_rr_name(rr), ns_rr_rdlen(rr), ns_rr_rdata(rr));
883 if (ns_rr_type(rr) != ns_t_a && ns_rr_type(rr) != ns_t_aaaa)
886 ||
type == ns_t_srv);
888 ns_rr_name(rr), ns_rr_rdlen(rr), ns_rr_rdata(rr));
897 assert(ptr && ptr <= eom);
898 return done ? ptr : 0;
904 const unsigned char*
msg,
905 const unsigned char* eom,
906 unsigned short count[3])
908 const HEADER* hdr = (
const HEADER*)
msg;
909 const unsigned char* ptr;
917 (
"DNS reply indicates an error: %s",
923 (
"DNS reply is a query, not a reply"));
926 if (hdr->opcode != ns_o_query) {
928 (
"DNS reply has unexpected opcode: %s",
932 if ((
count[0] = ntohs(hdr->qdcount)) != 1) {
934 (
"DNS reply has bad number of questions: %hu",
938 if (!(
count[0] = ntohs(hdr->ancount))) {
942 ptr =
msg + NS_HFIXEDSZ;
950 if (ns_rr_class(qd) != ns_c_in) {
952 (
"DNS reply for unsupported class: %s",
956 if (ns_rr_type(qd) != ns_t_any) {
958 (
"DNS reply for unmatching type: %s vs. ANY queried",
964 (
"DNS reply for unmatching name: \"%s\" vs. \"%s\" queried",
965 ns_rr_name(qd), fqdn));
974 count[1] = ntohs(hdr->nscount);
975 count[2] = ntohs(hdr->arcount);
981 const unsigned char*
msg,
982 const unsigned char* eom)
986 const unsigned char* ptr;
987 const HEADER* hdr = (
const HEADER*)
msg;
989 if (hdr->rcode || !(hdr->qr & hdr->aa) || hdr->opcode != ns_o_query)
991 if (ntohs(hdr->qdcount) != 1 || hdr->ancount || !hdr->nscount)
994 ptr =
msg + NS_HFIXEDSZ;
997 if (ns_rr_class(rr) != ns_c_in || ns_rr_type(rr) !=
type)
1004 if (!
same_domain(ns_rr_name(rr), strchr(fqdn,
'.') + 1))
1006 return ns_rr_class(rr) != ns_c_in || ns_rr_type(rr) != ns_t_soa
1024 if (
type == ns_t_srv) {
1034 if (pfxlen + xlen +
domlen > NS_MAXCDNAME)
1036 memcpy(ptr, prefix, pfxlen);
1038 memcpy(ptr, zone, zlen);
1044 assert(ptr - fqdn <= NS_MAXCDNAME);
1052 size_t len = strlen(iter->
name);
1053 const unsigned char* ptr, *eom;
1054 char fqdn[NS_MAXCDNAME + 1];
1055 unsigned short count[3];
1056 unsigned char msg[2048];
1057 int rv, err, x_error;
1065 if (
type != ns_t_srv
1072 (
"LBDNS FQDN for \"%s\" %s in \"%s\": Name too long",
1078 h_errno = errno = 0;
1079 memset(
msg, 0, NS_HFIXEDSZ);
1080 rv = res_query(fqdn, ns_c_in, ns_t_any,
msg,
sizeof(
msg));
1089 #
if defined(NO_ADDRESS) && NO_ADDRESS != NO_DATA
1090 || err == NO_ADDRESS
1098 if (!errstr || !*errstr) {
1099 sprintf(errbuf,
"Error %d", err);
1102 err = nodata ? 1 : -1;
1104 CORE_TRACEF((
"LBDNS reply \"%s\": %d byte(s)", fqdn, rv));
1105 if (rv < NS_HFIXEDSZ) {
1107 (
"DNS reply for \"%s\" too short: %d", fqdn, rv));
1110 if (rv >= (
int)
sizeof(
msg)) {
1112 (
"DNS reply overflow: %d", rv));
1120 if (
data->debug && rv)
1126 (
"DNS lookup failure \"%s\": %s", fqdn, errstr));
1129 assert(NS_HFIXEDSZ <= (
size_t)(eom -
msg));
1141 (
"DNS reply %lu/%d byte(s) remain unparsed",
1142 (
unsigned long)(eom - ptr), rv));
1154 while (n < data->
n_cand) {
1156 const char* drop = 0;
1163 if ((ptr = (
char*) strchr(name,
'.')) != 0)
1168 info->u.dns.name = 1;
1170 }
else for (s = 0; s <
data->n_cand; ++s) {
1180 *((
char*) name) =
'\0';
1182 for (s = 0; s < iter->
n_skip; ++s) {
1207 drop =
"incomplete";
1212 if (n < --data->
n_cand) {
1214 (
data->n_cand -
n) *
sizeof(
data->cand));
1225 ? iter->
name :
""))) {
1227 (
"LBDNS cannot create dummy entry for \"%s\"",
1230 data->cand[0].status = 0.0;
1234 (
"LBDNS adding dummy entry \"%s\" @%p %s",
1237 infostr ? infostr :
"<NULL>"));
1244 CORE_TRACEF((
"LBDNS made ready result-set for \"%s\": %lu",
1245 iter->
name, (
unsigned long)
data->n_cand));
1258 rv ?
"located" :
"unknown"));
1270 struct sockaddr_in ns_save;
1271 int ns_count, ns_retry, rv;
1279 struct sockaddr_in ns_addr;
1282 memset(&ns_addr, 0,
sizeof(ns_addr));
1284 ns_addr.sin_len =
sizeof(ns_addr);
1286 ns_addr.sin_family = AF_INET;
1287 ns_addr.sin_addr.s_addr =
data->host;
1288 ns_addr.sin_port = htons(
data->port);
1292 ns_retry =
r->retry;
1293 ns_options =
r->options;
1294 ns_count =
r->nscount;
1295 ns_save =
r->nsaddr;
1297 r->options |= RES_IGNTC;
1299 #ifdef RES_USE_EDNS0
1306 r->options |= RES_USE_EDNS0;
1311 r->options |= RES_DEBUG;
1313 r->nsaddr = ns_addr;
1322 r->options = ns_options;
1323 r->nsaddr = ns_save;
1324 r->nscount = ns_count;
1325 r->retry = ns_retry;
1341 (
unsigned long)
data->n_cand,
data->empty ?
", EOF" :
""));
1343 if (!
data->n_cand) {
1356 data->n_cand *
sizeof(
data->cand));
1371 (
unsigned long)
data->n_cand));
1375 for (
n = 0;
n <
data->n_cand; ++
n) {
1402 #if defined(NCBI_OS_CYGWIN) || defined(NCBI_OS_IRIX)
1403 if (getdomainname(
domain, domainsize) == 0
1411 && (p = strchr(
domain,
'.')) != 0 && p[1]) {
1416 if ((p = getenv(
"LOCALDOMAIN")) != 0) {
1417 size_t n = strlen(p);
1418 if (1 <
n &&
n < domainsize)
1430 #define isdash(s) ((s) == '-' || (s) == '_')
1434 int dot = *
domain ==
'.' ? 1 : 0;
1441 for ( ; *ptr; ++ptr) {
1443 if (dot || (alpha &&
isdash(ptr[-1])))
1451 if (
isdigit((
unsigned char)(*ptr)))
1468 }
else if (
isdash(ptr[-1]))
1470 return 1 <
len &&
len <= NS_MAXCDNAME ? 1 : 0;
1527 size_t len = strlen(iter->
name);
1536 (
"[%s] Argument affinity lookup not supported by LBDNS:"
1537 " %s%s%s%s%s", iter->
name, iter->
arg, &
"="[!iter->
val],
1538 &
"\""[!iter->
val], iter->
val ? iter->
val :
"",
1539 &
"\""[!iter->
val]));
1544 *
sizeof(
data->cand)))) {
1546 "LBDNS failed to create private data structure");
1553 (0,
"CONN_LBDNS_CHECK",
1566 "LBDNS cannot figure out system domain name");
1577 (
"LBDNS failed to store domain name \"%s\"",
domain));
1580 data->domlen = strlen(
data->domain);
1596 if (errno || *end ||
port > 0xFFFF)
1599 port = NS_DEFAULTPORT;
1614 (
"LBDNS using server @ %s",
val));
1616 data->port = (
unsigned short)
port;
1620 (
"LBDNS using domain = \"%s\"",
data->domain));
1646 static void* s_Once = 0;
std::ofstream out("events_result.xml")
main entry point for tests
static const struct type types[]
#define SERV_MAXIMAL_RATE
#define SERV_DEFAULT_ALGO
char * SERV_WriteInfo(const SSERV_Info *info)
unsigned short TSERV_TypeOnly
Server type only, w/o specials.
int SERV_EqualInfo(const SSERV_Info *info1, const SSERV_Info *info2)
@ fSERV_Stateless
Stateless servers only.
size_t SOCK_HostPortToString(unsigned int host, unsigned short port, char *buf, size_t bufsize)
Print numeric string "host:port" into a buffer provided, not to exceed 'bufsize' bytes (including the...
unsigned int SOCK_gethostbyname(const char *hostname)
Same as SOCK_gethostbynameEx(,<current API data logging>)
int SOCK_ntoa(unsigned int addr, char *buf, size_t bufsize)
Convert IP address to a string in dotted notation.
const char * SOCK_gethostbyaddr(unsigned int addr, char *name, size_t namelen)
Same as SOCK_gethostbyaddrEx(,,<current API data logging>)
ELOG_Level
Log severity level.
#define REG_CONN_LBDNS_DEBUG
#define REG_CONN_LBDNS_PORT
#define REG_CONN_LBDNS_DOMAIN
#define REG_CONN_LBDNS_HOST
int ConnNetInfo_Boolean(const char *str)
unsigned int
A callback function used to compare two keys in a database.
if(yy_accept[yy_current_state])
const struct ncbi::grid::netcache::search::fields::SIZE size
#define LBSM_DEFAULT_RATE
#define SERVNSD_TXT_RR_PORT
#define LBSM_DEFAULT_TIME
const char * ConnNetInfo_GetValueInternal(const char *service, const char *param, char *value, size_t value_size, const char *def_value)
int NcbiIsEmptyIPv6(const TNCBI_IPv6Addr *addr)
Return non-zero if the address is empty (either as IPv6 or IPv4); return zero otherwise.
unsigned int NcbiIPv6ToIPv4(const TNCBI_IPv6Addr *addr, size_t pfxlen)
Extract and return a network byte order IPv4 embedded address from an IPv6 address,...
char * NcbiAddrToString(char *buf, size_t bufsize, const TNCBI_IPv6Addr *addr)
Convert an IPv6 address into either a full-quad text IPv4 (for IPv4-mapped IPv6 addresses) or a hex c...
char * NcbiIPv6ToString(char *buf, size_t bufsize, const TNCBI_IPv6Addr *addr)
Convert an IPv6 address into a hex colon-separated text form and store the result in the "buf" of siz...
const char * NcbiStringToIPv4(unsigned int *addr, const char *str, size_t len)
Convert into a network byte order IPv4 address, the first "len" (or "strlen(str)" if "len" is 0) byte...
int NcbiIPv4ToIPv6(TNCBI_IPv6Addr *addr, unsigned int ipv4, size_t pfxlen)
Embed a passed network byte order IPv4 address into an IPv6 address using the specified prefix length...
static int dns_srv(SERV_ITER iter, const unsigned char *msg, const unsigned char *eom, const char *fqdn, unsigned short rdlen, const unsigned char *rdata)
static const unsigned char * x_VerifyReply(const char *fqdn, const unsigned char *msg, const unsigned char *eom, unsigned short count[3])
static const char * x_RcodeStr(unsigned short rcode, char *buf)
static const char * s_SysGetDomainName(char *domain, size_t domainsize)
static const char * x_ClassStr(ns_class aclass, char *buf)
static int x_UpdateHost(SERV_ITER iter, const char *fqdn, const TNCBI_IPv6Addr *addr)
static const SSERV_VTable kLbdnsOp
static int x_AddInfo(SERV_ITER iter, SSERV_Info *info)
#define LBDNS_INITIAL_ALLOC
static int unpack_rr(const unsigned char *msg, const unsigned char *eom, const unsigned char *ptr, ns_rr *rr, int qd, ELOG_Level level)
static const unsigned char * x_DumpMsg(const unsigned char *msg, const unsigned char *eom)
static void s_Close(SERV_ITER)
static int x_Resolve(SERV_ITER iter)
static const char * strherror(int err)
static int x_ResolveType(SERV_ITER iter, ns_type type)
static const char * x_OpcodeStr(unsigned short opcode, char *buf)
#define SERVNSD_TXT_RR_PORT_LEN
static const unsigned char * x_ProcessReply(SERV_ITER iter, const struct SLBDNS_Data *data, const char *fqdn, ns_type type, const unsigned char *msg, const unsigned char *eom, const unsigned char *ptr, unsigned short count[3])
static double x_RoundUp(double rate)
static const char * x_FlagsStr(const HEADER *hdr, char *buf)
static void s_Reset(SERV_ITER)
const SSERV_VTable * SERV_LBDNS_Open(SERV_ITER iter, SSERV_Info **info)
static const char * x_TypeStr(ns_type atype, char *buf)
static const char * x_CopyDomain(const char *domain)
static int x_NoDataReply(const char *fqdn, ns_type type, const unsigned char *msg, const unsigned char *eom)
static const char * dns_cname(unsigned int debug, const unsigned char *msg, const unsigned char *eom, const char *fqdn, unsigned short rdlen, const unsigned char *rdata)
static void x_UpdatePort(SERV_ITER iter, unsigned short port)
static const char * x_FormFQDN(char fqdn[NS_MAXCDNAME+1], const char *prefix, size_t pfxlen, ns_type type, const char *domain, size_t domlen)
static int s_Resolve(SERV_ITER iter)
static void x_Finalize(SERV_ITER iter)
static void x_DumpRR(const ns_rr *rr, const char *part, unsigned short n)
static void x_BlankInfo(SSERV_Info *info, ESERV_Type type)
static SSERV_Info * s_GetNextInfo(SERV_ITER, HOST_INFO *)
static void x_DumpHdr(const HEADER *hdr, const unsigned short count[4])
static int x_CheckDomain(const char *domain)
static int same_domain(const char *a, const char *b)
static int skip_rr(const unsigned char *ptr, const unsigned char *eom, int qd)
static void dns_txt(SERV_ITER iter, const char *fqdn, unsigned short rdlen, const unsigned char *rdata)
static int dns_a(SERV_ITER iter, ns_type qtype, ns_type rtype, const char *fqdn, unsigned short rdlen, const unsigned char *rdata)
#define CORE_Once(once)
Return non-zero (true) if "*once" had a value of NULL, and set the value to non-NULL regardless (best...
#define CORE_LOGF_ERRNO(level, error, fmt_args)
#define CORE_LOG_ERRNO(level, error, message)
#define CORE_TRACEF(fmt_args)
#define CORE_TRACE(message)
#define CORE_LOGF(level, fmt_args)
#define CORE_LOG(level, message)
SSERV_Info * SERV_CopyInfoEx(const SSERV_Info *orig, const char *name)
const char * SERV_NameOfInfo(const SSERV_Info *info)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
CCompressionStreamProcessor * s_Init(EInitType type, CCompressStream::EMethod method, ICompression::TFlags flags, ICompression::ELevel level)
voidp calloc(uInt items, uInt size)