#include <boost/lexical_cast.hpp>
-#include <cassert>
#include <cctype>
#include <cstring>
#include <vector>
int c = (*s & 0xff);
if (escape && std::isdigit(c) != 0) {
c = decimalToNumber(s, s_end);
- assert(n >= 3);
+ // decimalToNumber() already throws if (s_end - s) is less
+ // than 3. 'n' is an unsigned type (size_t) and can underflow.
+ // 'n' and 's' are also updated by 1 in the for statement's
+ // expression, so we update them by 2 instead of 3 here.
n -= 2;
s += 2;
} else if (!escape && c == '\\') {
if (escape && std::isdigit(c) != 0) {
c = decimalToNumber(s, s_end);
// decimalToNumber() already throws if (s_end - s) is less
- // than 3, so the following assertion is unnecessary. But we
- // assert it anyway. 'n' is an unsigned type (size_t) and
- // can underflow.
- assert(n >= 3);
+ // than 3. 'n' is an unsigned type (size_t) and can underflow.
// 'n' and 's' are also updated by 1 in the for statement's
// expression, so we update them by 2 instead of 3 here.
n -= 2;
// will lead to a crash, so disabling this check is not
// unsafe. Except for a programming mistake, this case should not
// happen.
- if (buf == NULL) {
+ if (!buf) {
isc_throw(BadValue,
"Null pointer passed to LabelSequence constructor");
}
#include <config.h>
#include <exceptions/exceptions.h>
-
+#include <exceptions/isc_assert.h>
#include <dns/master_lexer.h>
#include <dns/master_lexer_inputsource.h>
#include <dns/master_lexer_state.h>
#include <boost/lexical_cast.hpp>
#include <bitset>
-#include <cassert>
#include <limits>
#include <string>
#include <vector>
}
void setTotalSize() {
- assert(source_ != NULL);
+ isc_throw_assert(source_);
if (total_size_ != SOURCE_SIZE_UNKNOWN) {
const size_t current_size = source_->getSize();
if (current_size != SOURCE_SIZE_UNKNOWN) {
}
// Make sure a token was produced. Since this Can Not Happen, we assert
// here instead of throwing.
- assert(impl_->token_.getType() != MasterToken::ERROR ||
- impl_->token_.getErrorCode() != MasterToken::NO_TOKEN_PRODUCED);
+ isc_throw_assert(impl_->token_.getType() != MasterToken::ERROR ||
+ impl_->token_.getErrorCode() != MasterToken::NO_TOKEN_PRODUCED);
return (impl_->token_);
}
throw LexerError(__FILE__, __LINE__,
MasterToken(MasterToken::UNEXPECTED_END));
}
- assert(expect == MasterToken::NUMBER);
+ isc_throw_assert(expect == MasterToken::NUMBER);
throw LexerError(__FILE__, __LINE__,
MasterToken(MasterToken::BAD_NUMBER));
}
}
// The class integrity ensures the following:
- assert(val_.error_code_ < error_text_max_count);
+ isc_throw_assert(val_.error_code_ < error_text_max_count);
return (error_text[val_.error_code_]);
}
// This is a bug of the caller, and this method is only expected to be
// used by tests, so we just forcefully make it fail by asserting the
// condition.
- assert(false);
+ isc_throw_assert(false);
return (STRING_STATE); // a dummy return, to silence some compilers.
}
} else if (c == '"') {
if (escaped) {
// found escaped '"'. overwrite the preceding backslash.
- assert(!data.empty());
+ isc_throw_assert(!data.empty());
escaped = false;
data.back() = '"';
} else {
/// case of failure.
///
/// \return true if pushing the file succeeds; false otherwise.
- bool pushSource(const char* filename, std::string* error = NULL);
+ bool pushSource(const char* filename, std::string* error = 0);
/// \brief Make the given stream the current input source of MasterLexer.
///
#include <config.h>
+#include <exceptions/isc_assert.h>
#include <dns/master_lexer_inputsource.h>
#include <dns/master_lexer.h>
#include <istream>
#include <iostream>
-#include <cassert>
#include <cerrno>
#include <cstring>
isc_throw(InputSource::OpenError,
"failed to seek beginning of input source");
}
- assert(len >= 0 || ret == MasterLexer::SOURCE_SIZE_UNKNOWN);
+ isc_throw_assert(len >= 0 || ret == MasterLexer::SOURCE_SIZE_UNKNOWN);
return (ret);
}
void
InputSource::ungetAll() {
- assert(total_pos_ >= buffer_pos_);
+ isc_throw_assert(total_pos_ >= buffer_pos_);
total_pos_ -= buffer_pos_;
buffer_pos_ = 0;
line_ = saved_line_;
#include <config.h>
+#include <exceptions/isc_assert.h>
#include <dns/master_loader.h>
#include <dns/master_lexer.h>
#include <dns/name.h>
// We move in tandem, there's an extra item included during the
// initialization, so we can never run out of them
- assert(!include_info_.empty());
+ isc_throw_assert(!include_info_.empty());
const IncludeInfo& info(include_info_.back());
active_origin_ = info.first;
last_name_ = info.second;
} else {
// If it is not optional, we must not get anything but
// a string token.
- assert(is_optional);
+ isc_throw_assert(is_optional);
// We return the newline there. This is because we want to
// behave the same if there is or isn't the name, leaving the
"last explicitly stated TTL");
warn_rfc1035_ttl_ = false; // we only warn about this once
}
- assert(current_ttl_);
+ isc_throw_assert(current_ttl_);
return (*current_ttl_);
}
}
// We are going to parse an RR, have known the owner name,
// and are now seeing the next string token in the rest of the RR.
- assert(next_token.getType() == MasterToken::STRING);
+ isc_throw_assert(next_token.getType() == MasterToken::STRING);
bool explicit_ttl = false;
const RRType rrtype = parseRRParams(explicit_ttl, next_token);
/// \param tsig_ctx A TSIG context that is to be used for signing the
/// message
void toWire(AbstractMessageRenderer& renderer,
- TSIGContext* tsig_ctx = NULL);
+ TSIGContext* tsig_ctx = 0);
/// Parse options.
///
#include <config.h>
#include <exceptions/exceptions.h>
+#include <exceptions/isc_assert.h>
#include <dns/name.h>
#include <dns/name_internal.h>
#include <dns/labelsequence.h>
// on a valid name, which is an assumption for this class.
// But we'll abort if a bug could cause an infinite loop.
i += 2;
- assert(i < Name::MAX_WIRE);
+ isc_throw_assert(i < Name::MAX_WIRE);
}
llen = buffer[pos];
} else {
#include <config.h>
#include <exceptions/exceptions.h>
+#include <exceptions/isc_assert.h>
#include <dns/name.h>
#include <dns/messagerenderer.h>
#include <dns/master_lexer.h>
} while (true);
// We shouldn't reach here
- assert(false);
+ isc_throw_assert(false);
return (RdataPtr()); // add explicit return to silence some compilers
}
#include <config.h>
#include <exceptions/exceptions.h>
+#include <exceptions/isc_assert.h>
#include <dns/exceptions.h>
#include <dns/master_lexer.h>
#include <dns/master_loader.h>
b.writeUint32(retry);
b.writeUint32(expire);
b.writeUint32(minimum);
- assert(b.getLength() == sizeof(numdata_));
+ isc_throw_assert(b.getLength() == sizeof(numdata_));
memcpy(numdata_, b.getData(), sizeof(numdata_));
}
/// This constructor never throws an exception.
///
/// \param classcode An 16-bit integer code corresponding to the RRClass.
- explicit RRClass(uint16_t classcode) : classcode_(classcode) {}
+ explicit RRClass(uint16_t classcode) : classcode_(classcode) {
+ }
///
/// A valid string is one of "well-known" textual class representations
/// such as "IN" or "CH", or in the standard format for "unknown"
return (classcode_ < other.classcode_);
}
- // BEGIN_WELL_KNOWN_CLASS_DECLARATIONS
static const RRClass& ANY();
static const RRClass& IN();
static const RRClass& CH();
static const RRClass& NONE();
- // END_WELL_KNOWN_CLASS_DECLARATIONS
private:
uint16_t classcode_;
};
-// BEGIN_WELL_KNOWN_CLASS_DEFINITIONS
inline const RRClass&
RRClass::ANY() {
static RRClass rrclass(255);
return (rrclass);
}
-// END_WELL_KNOWN_CLASS_DEFINITIONS
-
///
/// \brief Insert the \c RRClass as a string into stream.
///
#include <config.h>
#include <exceptions/exceptions.h>
+#include <exceptions/isc_assert.h>
#include <dns/rrparamregistry.h>
#include <dns/rrclass.h>
#include <dns/rrtype.h>
// set up parameters for well-known RRs
try {
- // BEGIN_WELL_KNOWN_PARAMS
add("A", 1, "IN", 1, RdataFactoryPtr(new RdataFactory<in::A>()));
add("NS", 2, "IN", 1, RdataFactoryPtr(new RdataFactory<generic::NS>()));
add("SOA", 6, "IN", 1, RdataFactoryPtr(new RdataFactory<generic::SOA>()));
// Meta classes
addClass("CH", 3);
addClass("NONE", 254);
- // END_WELL_KNOWN_PARAMS
} catch (...) {
throw;
}
bool
caseStringEqual(const string& s1, const string& s2, size_t n) {
- assert(s1.size() >= n && s2.size() >= n);
+ isc_throw_assert(s1.size() >= n && s2.size() >= n);
return (mismatch(s1.begin(), s1.begin() + n, s2.begin(), CICharEqual).first
== s1.begin() + n);
if (found != codemap.end()) {
size_t erased = stringmap.erase(found->second->code_string_);
// We must have a corresponding entry of the str2 map exists
- assert(erased == 1);
+ isc_throw_assert(erased == 1);
codemap.erase(found);
#include <config.h>
+#include <exceptions/isc_assert.h>
#include <dns/messagerenderer.h>
#include <dns/name.h>
#include <dns/rrclass.h>
// other options. Details to be considered.
do {
const size_t pos0 = output.getLength();
- assert(pos0 < 65536);
+ isc_throw_assert(pos0 < 65536);
rrset.getName().toWire(output);
rrset.getType().toWire(output);
// other options. Details to be considered.
for (auto const& rdata : rdatalist_) {
const size_t pos0 = renderer.getLength();
- assert(pos0 < 65536);
+ isc_throw_assert(pos0 < 65536);
name_.toWire(renderer);
rrtype_.toWire(renderer);
rrlen += 2; // RDLENGTH field
rrlen += it->getCurrent().getLength();
- assert(length + rrlen < 65536);
+ isc_throw_assert(length + rrlen < 65536);
length += rrlen;
it->next();
const uint16_t rrsigs_length = rrsig_->getLength();
// the uint16_ts are promoted to ints during addition below, so
// it won't overflow a 16-bit register.
- assert(length + rrsigs_length < 65536);
+ isc_throw_assert(length + rrsigs_length < 65536);
length += rrsigs_length;
}
#include <config.h>
+#include <exceptions/isc_assert.h>
#include <dns/messagerenderer.h>
#include <dns/rrttl.h>
#include <util/buffer.h>
// seconds cannot be out of range at this point.
const uint64_t seconds = value * multiply;
- assert(seconds <= 0xffffffff);
+ isc_throw_assert(seconds <= 0xffffffff);
// Add what we found
val += seconds;
/// This constructor never throws an exception.
///
/// \param typecode An 16-bit integer code corresponding to the RRType.
- explicit RRType(uint16_t typecode) : typecode_(typecode) {}
+ explicit RRType(uint16_t typecode) : typecode_(typecode) {
+ }
/// Constructor from a string.
///
/// A valid string is one of "well-known" textual type representations
}
//@}
- // BEGIN_WELL_KNOWN_TYPE_DECLARATIONS
static const RRType& A();
static const RRType& NS();
static const RRType& SOA();
static const RRType& TKEY();
static const RRType& TSIG();
static const RRType& ANY();
- // END_WELL_KNOWN_TYPE_DECLARATIONS
private:
uint16_t typecode_;
};
-// BEGIN_WELL_KNOWN_TYPE_DEFINITIONS
-
inline const RRType&
RRType::A() {
static RRType rrtype(1);
return (rrtype);
}
-// END_WELL_KNOWN_TYPE_DEFINITIONS
-
///
/// \brief Insert the \c RRType as a string into stream.
///
TSIGContext& tsig_ctx, const char* const expected_file,
unsigned int message_flags = RD_FLAG,
RRType qtype = RRType::A(),
- const vector<const char*>* answer_data = NULL) {
+ const vector<const char*>* answer_data = 0) {
message.setOpcode(Opcode::QUERY());
message.setRcode(Rcode::NOERROR());
if ((message_flags & QR_FLAG) != 0) {
message.addQuestion(Question(Name("www.example.com"), RRClass::IN(),
qtype));
- if (answer_data != NULL) {
+ if (answer_data) {
RRsetPtr ans_rrset(new RRset(Name("www.example.com"), RRClass::IN(),
qtype, RRTTL(86400)));
for (auto const& it : *answer_data) {
EXPECT_TRUE(message_parse.getHeaderFlag(Message::HEADERFLAG_TC));
// Note that the number of questions are 66, not 67 as we tried to add.
EXPECT_EQ(66, message_parse.getRRCount(Message::SECTION_QUESTION));
- EXPECT_TRUE(message_parse.getTSIGRecord() != NULL);
+ EXPECT_TRUE(message_parse.getTSIGRecord());
}
TEST_F(MessageTest, toWireTSIGNoTruncation) {
uint8_t idata[32];
size_t length = std::strlen(cur->data);
// length (1 byte) + string (length bytes)
- assert(sizeof(idata) > length);
+ ASSERT_TRUE(sizeof(idata) > length);
idata[0] = static_cast<uint8_t>(length);
std::memcpy(idata + 1, cur->data, length);
const CharString test_data(idata, idata + length + 1);
// we can only check these don't throw.
EXPECT_NO_THROW(rdataFactoryFromFile(RRType::OPT(), RRClass("CLASS4096"),
"rdata_opt_fromWire1"));
- EXPECT_NO_THROW(rdataFactoryFromFile(RRType::OPT(), RRClass::ANY(),
+ EXPECT_NO_THROW(rdataFactoryFromFile(RRType::OPT(), RRClass::CH(),
"rdata_opt_fromWire1", 2));
// Short RDLEN. This throws InvalidRdataLength even if subsequent
const generic::OPT rdata_opt;
EXPECT_THROW(rdata_opt.compare(
- *rdataFactoryFromFile(RRType::OPT(), RRClass::ANY(),
+ *rdataFactoryFromFile(RRType::OPT(), RRClass::CH(),
"rdata_opt_fromWire1", 2)),
isc::InvalidOperation);
{}
template <typename ExForString, typename ExForLexer>
- void checkFromTextSOA(const string& soa_txt, const Name* origin = NULL,
+ void checkFromTextSOA(const string& soa_txt, const Name* origin = 0,
bool throw_str_version = true,
bool throw_lexer_version = true)
{
data.push_back(254);
data.insert(data.end(), 254, ch);
- assert(data.size() == 65535);
+ ASSERT_TRUE(data.size() == 65535);
}
TYPED_TEST(Rdata_TXT_LIKE_Test, createFromWire) {
const RdataType& rdata_expected,
bool throw_str_version = true,
bool throw_lexer_version = true,
- const Name* origin = NULL) {
+ const Name* origin = 0) {
SCOPED_TRACE(rdata_txt);
if (throw_str_version) {
// http://www.iana.org/assignments/dns-parameters/dns-parameters.xml
struct ClassParam {
const char* const txt; // "IN", "CH", etc
- const uint16_t code; // 1, 3,
- const RRClass& (*obj)(); // RRClass::IN(), etc
+ const uint16_t code; // 1, 3, etc
+ const RRClass& (*obj)(); // RRClass::IN(), RRClass::CH(), etc
} known_classes[] = {
{"IN", 1, RRClass::IN}, {"CH", 3, RRClass::CH},
{"NONE", 254, RRClass::NONE}, {"ANY", 255, RRClass::ANY},
const uint16_t code; // 1, 28, 2, etc
const RRType& (*obj)(); // RRType::A(), etc
} known_types[] = {
- {"A", 1, RRType::A}, {"NS", 2, RRType::NS},
- {"SOA", 6, RRType::SOA}, {"PTR", 12, RRType::PTR},
- {"TXT", 16, RRType::TXT}, {"AAAA", 28, RRType::AAAA},
- {"OPT", 41, RRType::OPT}, {"RRSIG", 46, RRType::RRSIG},
- {"DHCID", 49, RRType::DHCID}, {"TKEY", 249, RRType::TKEY},
- {"TSIG", 250, RRType::TSIG}, {"ANY", 255, RRType::ANY},
+ {"A", 1, RRType::A},
+ {"NS", 2, RRType::NS},
+ {"SOA", 6, RRType::SOA},
+ {"PTR", 12, RRType::PTR},
+ {"TXT", 16, RRType::TXT},
+ {"AAAA", 28, RRType::AAAA},
+ {"OPT", 41, RRType::OPT},
+ {"RRSIG", 46, RRType::RRSIG},
+ {"DHCID", 49, RRType::DHCID},
+ {"TKEY", 249, RRType::TKEY},
+ {"TSIG", 250, RRType::TSIG},
+ {"ANY", 255, RRType::ANY},
+ {"MD", 3, []() -> const RRType& {static const RRType r("MD"); return (r);}},
+ {"MF", 4, []() -> const RRType& {static const RRType r("MF"); return (r);}},
+ {"CNAME", 5, []() -> const RRType& {static const RRType r("CNAME"); return (r);}},
+ {"MB", 7, []() -> const RRType& {static const RRType r("MB"); return (r);}},
+ {"MG", 8, []() -> const RRType& {static const RRType r("MG"); return (r);}},
+ {"MR", 9, []() -> const RRType& {static const RRType r("MR"); return (r);}},
+ {"NULL", 10, []() -> const RRType& {static const RRType r("NULL"); return (r);}},
+ {"WKS", 11, []() -> const RRType& {static const RRType r("WKS"); return (r);}},
+ {"HINFO", 13, []() -> const RRType& {static const RRType r("HINFO"); return (r);}},
+ {"MINFO", 14, []() -> const RRType& {static const RRType r("MINFO"); return (r);}},
+ {"MX", 15, []() -> const RRType& {static const RRType r("MX"); return (r);}},
+ {"RP", 17, []() -> const RRType& {static const RRType r("RP"); return (r);}},
+ {"AFSDB", 18, []() -> const RRType& {static const RRType r("AFSDB"); return (r);}},
+ {"X25", 19, []() -> const RRType& {static const RRType r("X25"); return (r);}},
+ {"ISDN", 20, []() -> const RRType& {static const RRType r("ISDN"); return (r);}},
+ {"RT", 21, []() -> const RRType& {static const RRType r("RT"); return (r);}},
+ {"NSAP", 22, []() -> const RRType& {static const RRType r("NSAP"); return (r);}},
+ {"NSAP-PTR", 23, []() -> const RRType& {static const RRType r("NSAP-PTR"); return (r);}},
+ {"SIG", 24, []() -> const RRType& {static const RRType r("SIG"); return (r);}},
+ {"KEY", 25, []() -> const RRType& {static const RRType r("KEY"); return (r);}},
+ {"PX", 26, []() -> const RRType& {static const RRType r("PX"); return (r);}},
+ {"GPOS", 27, []() -> const RRType& {static const RRType r("GPOS"); return (r);}},
+ {"LOC", 29, []() -> const RRType& {static const RRType r("LOC"); return (r);}},
+ {"NXT", 30, []() -> const RRType& {static const RRType r("NXT"); return (r);}},
+ {"EID", 31, []() -> const RRType& {static const RRType r("EID"); return (r);}},
+ {"NIMLOC", 32, []() -> const RRType& {static const RRType r("NIMLOC"); return (r);}},
+ {"SRV", 33, []() -> const RRType& {static const RRType r("SRV"); return (r);}},
+ {"ATMA", 34, []() -> const RRType& {static const RRType r("ATMA"); return (r);}},
+ {"NAPTR", 35, []() -> const RRType& {static const RRType r("NAPTR"); return (r);}},
+ {"KX", 36, []() -> const RRType& {static const RRType r("KX"); return (r);}},
+ {"CERT", 37, []() -> const RRType& {static const RRType r("CERT"); return (r);}},
+ {"A6", 38, []() -> const RRType& {static const RRType r("A6"); return (r);}},
+ {"DNAME", 39, []() -> const RRType& {static const RRType r("DNAME"); return (r);}},
+ {"SINK", 40, []() -> const RRType& {static const RRType r("SINK"); return (r);}},
+ {"APL", 42, []() -> const RRType& {static const RRType r("APL"); return (r);}},
+ {"DS", 43, []() -> const RRType& {static const RRType r("DS"); return (r);}},
+ {"SSHFP", 44, []() -> const RRType& {static const RRType r("SSHFP"); return (r);}},
+ {"IPSECKEY", 45, []() -> const RRType& {static const RRType r("IPSECKEY"); return (r);}},
+ {"NSEC", 47, []() -> const RRType& {static const RRType r("NSEC"); return (r);}},
+ {"DNSKEY", 48, []() -> const RRType& {static const RRType r("DNSKEY"); return (r);}},
+ {"NSEC3", 50, []() -> const RRType& {static const RRType r("NSEC3"); return (r);}},
+ {"NSEC3PARAM", 51, []() -> const RRType& {static const RRType r("NSEC3PARAM"); return (r);}},
+ {"TLSA", 52, []() -> const RRType& {static const RRType r("TLSA"); return (r);}},
+ {"SMIMEA", 53, []() -> const RRType& {static const RRType r("SMIMEA"); return (r);}},
+ // Unassigned 54
+ {"HIP", 55, []() -> const RRType& {static const RRType r("HIP"); return (r);}},
+ {"NINFO", 56, []() -> const RRType& {static const RRType r("NINFO"); return (r);}},
+ {"RKEY", 57, []() -> const RRType& {static const RRType r("RKEY"); return (r);}},
+ {"TALINK", 58, []() -> const RRType& {static const RRType r("TALINK"); return (r);}},
+ {"CDS", 59, []() -> const RRType& {static const RRType r("CDS"); return (r);}},
+ {"CDNSKEY", 60, []() -> const RRType& {static const RRType r("CDNSKEY"); return (r);}},
+ {"OPENPGPKEY", 61, []() -> const RRType& {static const RRType r("OPENPGPKEY"); return (r);}},
+ {"CSYNC", 62 , []() -> const RRType& {static const RRType r("CSYNC"); return (r);}},
+ {"ZONEMD", 63, []() -> const RRType& {static const RRType r("ZONEMD"); return (r);}},
+ {"SVCB", 64, []() -> const RRType& {static const RRType r("SVCB"); return (r);}},
+ {"HTTPS", 65, []() -> const RRType& {static const RRType r("HTTPS"); return (r);}},
+ // Unassigned 66-98
+ {"SPF", 99, []() -> const RRType& {static const RRType r("SPF"); return (r);}},
+ {"UINFO", 100, []() -> const RRType& {static const RRType r("UINFO"); return (r);}},
+ {"UID", 101, []() -> const RRType& {static const RRType r("UID"); return (r);}},
+ {"GID", 102, []() -> const RRType& {static const RRType r("GID"); return (r);}},
+ {"UNSPEC", 103, []() -> const RRType& {static const RRType r("UNSPEC"); return (r);}},
+ {"NID", 104, []() -> const RRType& {static const RRType r("NID"); return (r);}},
+ {"L32", 105, []() -> const RRType& {static const RRType r("L32"); return (r);}},
+ {"L64", 106, []() -> const RRType& {static const RRType r("L64"); return (r);}},
+ {"LP", 107, []() -> const RRType& {static const RRType r("LP"); return (r);}},
+ {"EUI48", 108, []() -> const RRType& {static const RRType r("EUI48"); return (r);}},
+ {"EUI64", 109, []() -> const RRType& {static const RRType r("EUI64"); return (r);}},
+ // Unassigned 110-248
+ {"IXFR", 251, []() -> const RRType& {static const RRType r("IXFR"); return (r);}},
+ {"AXFR", 252, []() -> const RRType& {static const RRType r("AXFR"); return (r);}},
+ {"MAILB", 253, []() -> const RRType& {static const RRType r("MAILB"); return (r);}},
+ {"MAILA", 254, []() -> const RRType& {static const RRType r("MAILA"); return (r);}},
+ {"ANY", 255, []() -> const RRType& {static const RRType r("ANY"); return (r);}}, // also known as "*"
+ {"URI", 256, []() -> const RRType& {static const RRType r("URI"); return (r);}},
+ {"CAA", 257, []() -> const RRType& {static const RRType r("CAA"); return (r);}},
+ {"AVC", 258, []() -> const RRType& {static const RRType r("AVC"); return (r);}},
+ {"DOA", 259, []() -> const RRType& {static const RRType r("DOA"); return (r);}},
+ {"AMTRELAY", 260, []() -> const RRType& {static const RRType r("AMTRELAY"); return (r);}},
+ {"RESINFO", 261, []() -> const RRType& {static const RRType r("RESINFO"); return (r);}},
+ // Unassigned 262-32767
+ {"TA", 32768, []() -> const RRType& {static const RRType r("TA"); return (r);}},
+ {"DLV", 32769, []() -> const RRType& {static const RRType r("DLV"); return (r);}},
{NULL, 0, NULL}
};
const uint8_t* expected_mac, size_t expected_maclen,
uint16_t expected_error = 0,
uint16_t expected_otherlen = 0,
- const uint8_t* expected_otherdata = NULL,
+ const uint8_t* expected_otherdata = 0,
const Name& expected_algorithm = TSIGKey::HMACMD5_NAME()) {
- ASSERT_TRUE(tsig != NULL);
+ ASSERT_TRUE(tsig);
const TSIG& tsig_rdata = tsig->getRdata();
EXPECT_EQ(expected_algorithm, tsig_rdata.getAlgorithm());
// Create and sign the AXFR request
ConstTSIGRecordPtr tsig = createMessageAndSign(axfr_qid, zone_name,
tsig_ctx.get(), 0,
- RRType(252));
+ RRType("AXFR"));
// Then verify it (the wire format test data should contain the same
// message data, and verification should succeed).
received_data.clear();
// Create and sign the first response message
tsig = createMessageAndSign(axfr_qid, zone_name, tsig_verify_ctx.get(),
- AA_FLAG|QR_FLAG, RRType(252),
+ AA_FLAG|QR_FLAG, RRType("AXFR"),
"ns.example.com. root.example.com. "
"2011041503 7200 3600 2592000 1200",
&RRType::SOA());
{
SCOPED_TRACE("Sign test for continued response in TCP stream");
tsig = createMessageAndSign(axfr_qid, zone_name, tsig_verify_ctx.get(),
- AA_FLAG|QR_FLAG, RRType(252),
+ AA_FLAG|QR_FLAG, RRType("AXFR"),
"ns.example.com.", &RRType::NS(), false);
commonSignChecks(tsig, axfr_qid, 0x4da8e951, expected_mac,
sizeof(expected_mac));
#include <config.h>
#include <exceptions/exceptions.h>
+#include <exceptions/isc_assert.h>
#include <cryptolink/cryptolink.h>
#include <cryptolink/crypto_hmac.h>
#include <dns/rdataclass.h>
TSIGContext::TSIGContextImpl::digestPreviousMAC(HMACPtr hmac) {
// We should have ensured the digest size fits 16 bits within this class
// implementation.
- assert(previous_digest_.size() <= 0xffff);
+ isc_throw_assert(previous_digest_.size() <= 0xffff);
if (previous_digest_.empty()) {
// The previous digest was already used. We're in the middle of
// Get the final digest, update internal state, then finish.
vector<uint8_t> digest = hmac->sign(impl_->digest_len_);
- assert(digest.size() <= 0xffff); // cryptolink API should have ensured it.
+ isc_throw_assert(digest.size() <= 0xffff); // cryptolink API should have ensured it.
ConstTSIGRecordPtr tsig(new TSIGRecord(
impl_->key_.getKeyName(),
any::TSIG(impl_->key_.getAlgorithmName(),