From: Mukund Sivaraman Date: Tue, 12 Mar 2013 02:37:59 +0000 (+0530) Subject: [2387] Remove now unused parseNSEC3ParamText() function X-Git-Tag: bind10-1.2.0beta1-release~481^2~51 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4e379f979dede89254759e40974d9c04d90ed451;p=thirdparty%2Fkea.git [2387] Remove now unused parseNSEC3ParamText() function --- diff --git a/src/lib/dns/rdata/generic/detail/nsec3param_common.cc b/src/lib/dns/rdata/generic/detail/nsec3param_common.cc index 0ce6bcad11..3fc0f0a4db 100644 --- a/src/lib/dns/rdata/generic/detail/nsec3param_common.cc +++ b/src/lib/dns/rdata/generic/detail/nsec3param_common.cc @@ -38,56 +38,6 @@ namespace generic { namespace detail { namespace nsec3 { -ParseNSEC3ParamResult -parseNSEC3ParamText(const char* const rrtype_name, - const string& rdata_str, istringstream& iss, - vector& salt) -{ - unsigned int hashalg, flags, iterations; - string iterations_str, salthex; - - iss >> hashalg >> flags >> iterations_str >> salthex; - if (iss.bad() || iss.fail()) { - isc_throw(InvalidRdataText, "Invalid " << rrtype_name << - " text: " << rdata_str); - } - if (hashalg > 0xff) { - isc_throw(InvalidRdataText, rrtype_name << - " hash algorithm out of range: " << hashalg); - } - if (flags > 0xff) { - isc_throw(InvalidRdataText, rrtype_name << " flags out of range: " << - flags); - } - // Convert iteration. To reject an invalid case where there's no space - // between iteration and salt, we extract this field as string and convert - // to integer. - try { - iterations = boost::lexical_cast(iterations_str); - } catch (const boost::bad_lexical_cast&) { - isc_throw(InvalidRdataText, "Bad " << rrtype_name << - " iteration: " << iterations_str); - } - if (iterations > 0xffff) { - isc_throw(InvalidRdataText, rrtype_name << - " iterations out of range: " << - iterations); - } - - // Salt is up to 255 bytes, and space is not allowed in the HEX encoding, - // so the encoded string cannot be longer than the double of max length - // of the actual salt. - if (salthex.size() > 255 * 2) { - isc_throw(InvalidRdataText, rrtype_name << " salt is too long: " - << salthex.size() << " (encoded) bytes"); - } - if (salthex != "-") { // "-" means a 0-length salt - decodeHex(salthex, salt); - } - - return (ParseNSEC3ParamResult(hashalg, flags, iterations)); -} - ParseNSEC3ParamResult parseNSEC3ParamFromLexer(const char* const rrtype_name, MasterLexer& lexer, vector& salt) diff --git a/src/lib/dns/rdata/generic/detail/nsec3param_common.h b/src/lib/dns/rdata/generic/detail/nsec3param_common.h index 7d7ed54e57..17e17f418f 100644 --- a/src/lib/dns/rdata/generic/detail/nsec3param_common.h +++ b/src/lib/dns/rdata/generic/detail/nsec3param_common.h @@ -20,9 +20,6 @@ #include #include - -#include -#include #include namespace isc { @@ -61,7 +58,7 @@ struct ParseNSEC3ParamResult { /// \brief Convert textual representation of NSEC3 parameters. /// -/// This function takes an input string stream that consists of a complete +/// This function takes an input MasterLexer that points at a complete /// textual representation of an NSEC3 or NSEC3PARAM RDATA and parses it /// extracting the hash algorithm, flags, iterations, and salt fields. /// @@ -69,37 +66,11 @@ struct ParseNSEC3ParamResult { /// The salt will be stored in the given vector. The vector is expected /// to be empty, but if not, the existing content will be overridden. /// -/// On successful return the given input stream will reach the end of the +/// On successful return the given MasterLexer will reach the end of the /// salt field. /// /// \exception isc::BadValue The salt is not a valid hex string. -/// \exception InvalidRdataText The given string is otherwise invalid for -/// NSEC3 or NSEC3PARAM fields. -/// -/// \param rrtype_name Either "NSEC3" or "NSEC3PARAM"; used as part of -/// exception messages. -/// \param rdata_str A complete textual string of the RDATA; used as part of -/// exception messages. -/// \param iss Input stream that consists of a complete textual string of -/// the RDATA. -/// \param salt A placeholder for the salt field value of the RDATA. -/// Expected to be empty, but it's not checked (and will be overridden). -/// -/// \return The hash algorithm, flags, iterations in the form of -/// ParseNSEC3ParamResult. -ParseNSEC3ParamResult parseNSEC3ParamText(const char* const rrtype_name, - const std::string& rdata_str, - std::istringstream& iss, - std::vector& salt); - -/// \brief Convert textual representation of NSEC3 parameters -/// (MasterLexer variant). -/// -/// This function is identical to \c parseNSEC3ParamText(), except that -/// it reads the NSEC3 parameters from a MasterLexer. -/// -/// \exception isc::BadValue The salt is not a valid hex string. -/// \exception InvalidRdataText The given string is otherwise invalid for +/// \exception InvalidRdataText The given RDATA is otherwise invalid for /// NSEC3 or NSEC3PARAM fields. /// \exception MasterLexer::LexerError There was a failure reading a /// field from the MasterLexer.