more portability updates

pull/394/head
bradh352 4 years ago
parent 3f7065235f
commit 86dd24909e
  1. 32
      src/lib/ares_nameser.h
  2. 2
      test/ares-test-parse-a.cc
  3. 16
      test/dns-proto.cc

@ -223,33 +223,53 @@ typedef enum __ns_rcode {
# define QUERY ns_o_query
#endif
#ifndef SERVFAIL
# define SERVFAIL ns_r_servfail
#endif
#ifndef NOTIMP
# define NOTIMP ns_r_notimpl
#endif
#ifndef REFUSED
# define REFUSED ns_r_refused
#endif
#if defined(_WIN32) && !defined(HAVE_ARPA_NAMESER_COMPAT_H) && defined(NOERROR)
# undef NOERROR /* it seems this is already defined in winerror.h */
#endif
#ifndef NOERROR
# define NOERROR ns_r_noerror
#endif
#ifndef FORMERR
# define FORMERR ns_r_formerr
#endif
#ifndef NXDOMAIN
# define NXDOMAIN ns_r_nxdomain
#endif
/* Non-standard response codes, use numeric values */
#ifndef YXDOMAIN
# define YXDOMAIN 6 /* ns_r_yxdomain */
#endif
#ifndef YXRRSET
# define YXRRSET 7 /* ns_r_yxrrset */
#endif
#ifndef NXRRSET
# define NXRRSET 8 /* ns_r_nxrrset */
#endif
#ifndef NOTAUTH
# define NOTAUTH 9 /* ns_r_notauth */
#endif
#ifndef NOTZONE
# define NOTZONE 10 /* ns_r_notzone */
#endif
#ifndef TSIG_BADSIG
# define TSIG_BADSIG 16 /* ns_r_badsig */
#endif
#ifndef TSIG_BADKEY
# define TSIG_BADKEY 17 /* ns_r_badkey */
#endif
#ifndef TSIG_BADTIME
# define TSIG_BADTIME 18 /* ns_r_badtime */
#endif
#ifndef C_IN
# define C_IN ns_c_in

@ -312,7 +312,7 @@ TEST_F(LibraryTest, ParseAReplyErrors) {
EXPECT_EQ(ARES_ENODATA, ares_parse_a_reply(data.data(), data.size(),
&host, info, &count));
EXPECT_EQ(nullptr, host);
pkt.set_rcode(ns_r_noerror);
pkt.set_rcode(NOERROR);
#endif
// Two questions

@ -63,20 +63,20 @@ std::string StatusToString(int status) {
std::string RcodeToString(int rcode) {
switch (rcode) {
case ns_r_noerror: return "NOERROR";
case NOERROR: return "NOERROR";
case FORMERR: return "FORMERR";
case SERVFAIL: return "SERVFAIL";
case NXDOMAIN: return "NXDOMAIN";
case NOTIMP: return "NOTIMP";
case REFUSED: return "REFUSED";
case YXDOMAIN: return "YXDOMAIN";
case ns_r_yxrrset: return "YXRRSET";
case ns_r_nxrrset: return "NXRRSET";
case ns_r_notauth: return "NOTAUTH";
case ns_r_notzone: return "NOTZONE";
case ns_r_badsig: return "BADSIG";
case ns_r_badkey: return "BADKEY";
case ns_r_badtime: return "BADTIME";
case YXRRSET: return "YXRRSET";
case NXRRSET: return "NXRRSET";
case NOTAUTH: return "NOTAUTH";
case NOTZONE: return "NOTZONE";
case TSIG_BADSIG: return "BADSIG";
case TSIG_BADKEY: return "BADKEY";
case TSIG_BADTIME: return "BADTIME";
default: return "UNKNOWN";
}
}

Loading…
Cancel
Save