diff options
author | Marcin Siodelski <marcin@isc.org> | 2012-12-11 13:12:33 +0100 |
---|---|---|
committer | Marcin Siodelski <marcin@isc.org> | 2012-12-11 13:12:33 +0100 |
commit | 26f89e5cc91ec20cb7607e81b82ec7087d40de2f (patch) | |
tree | 88326d693c3d0833a59e38ad0215413fcce19f83 /src | |
parent | [2526] OptionInt can be now used for V4 and V6. (diff) | |
download | kea-26f89e5cc91ec20cb7607e81b82ec7087d40de2f.tar.xz kea-26f89e5cc91ec20cb7607e81b82ec7087d40de2f.zip |
[2526] Renamed Option6IntArray to OptionIntArray.
... as this class is going to be used either for V6 or V4 now.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/dhcp6/dhcp6_srv.cc | 6 | ||||
-rw-r--r-- | src/bin/dhcp6/tests/dhcp6_srv_unittest.cc | 6 | ||||
-rw-r--r-- | src/lib/dhcp/Makefile.am | 2 | ||||
-rw-r--r-- | src/lib/dhcp/libdhcp++.cc | 2 | ||||
-rw-r--r-- | src/lib/dhcp/option_data_types.h | 2 | ||||
-rw-r--r-- | src/lib/dhcp/option_definition.cc | 4 | ||||
-rw-r--r-- | src/lib/dhcp/option_definition.h | 14 | ||||
-rw-r--r-- | src/lib/dhcp/option_int_array.h (renamed from src/lib/dhcp/option6_int_array.h) | 20 | ||||
-rw-r--r-- | src/lib/dhcp/std_option_defs.h | 4 | ||||
-rw-r--r-- | src/lib/dhcp/tests/Makefile.am | 2 | ||||
-rw-r--r-- | src/lib/dhcp/tests/libdhcp++_unittest.cc | 14 | ||||
-rw-r--r-- | src/lib/dhcp/tests/option_definition_unittest.cc | 26 | ||||
-rw-r--r-- | src/lib/dhcp/tests/option_int_array_unittest.cc (renamed from src/lib/dhcp/tests/option6_int_array_unittest.cc) | 80 |
13 files changed, 91 insertions, 91 deletions
diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 33bab99c9b..6f34cd8b36 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -23,8 +23,8 @@ #include <dhcp/option6_ia.h> #include <dhcp/option6_iaaddr.h> #include <dhcp/option6_iaaddr.h> -#include <dhcp/option6_int_array.h> #include <dhcp/option_custom.h> +#include <dhcp/option_int_array.h> #include <dhcp/pkt6.h> #include <dhcp6/dhcp6_log.h> #include <dhcp6/dhcp6_srv.h> @@ -327,8 +327,8 @@ void Dhcpv6Srv::appendRequestedOptions(const Pkt6Ptr& question, Pkt6Ptr& answer) // Client requests some options using ORO option. Try to // get this option from client's message. - boost::shared_ptr<Option6IntArray<uint16_t> > option_oro = - boost::dynamic_pointer_cast<Option6IntArray<uint16_t> >(question->getOption(D6O_ORO)); + boost::shared_ptr<OptionIntArray<uint16_t> > option_oro = + boost::dynamic_pointer_cast<OptionIntArray<uint16_t> >(question->getOption(D6O_ORO)); // Option ORO not found. Don't do anything then. if (!option_oro) { return; diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc index 6a598ebd48..b906ffb594 100644 --- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc @@ -22,7 +22,7 @@ #include <dhcp/option6_addrlst.h> #include <dhcp/option6_ia.h> #include <dhcp/option6_iaaddr.h> -#include <dhcp/option6_int_array.h> +#include <dhcp/option_int_array.h> #include <dhcp6/config_parser.h> #include <dhcp6/dhcp6_srv.h> #include <dhcpsrv/cfgmgr.h> @@ -351,8 +351,8 @@ TEST_F(Dhcpv6SrvTest, advertiseOptions) { // Let's now request option with code 1000. // We expect that server will include this option in its reply. - boost::shared_ptr<Option6IntArray<uint16_t> > - option_oro(new Option6IntArray<uint16_t>(D6O_ORO)); + boost::shared_ptr<OptionIntArray<uint16_t> > + option_oro(new OptionIntArray<uint16_t>(D6O_ORO)); // Create vector with two option codes. std::vector<uint16_t> codes(2); codes[0] = 1000; diff --git a/src/lib/dhcp/Makefile.am b/src/lib/dhcp/Makefile.am index 567b60198c..571f11d398 100644 --- a/src/lib/dhcp/Makefile.am +++ b/src/lib/dhcp/Makefile.am @@ -29,7 +29,7 @@ libb10_dhcp___la_SOURCES += option6_iaaddr.cc option6_iaaddr.h libb10_dhcp___la_SOURCES += option6_addrlst.cc option6_addrlst.h libb10_dhcp___la_SOURCES += option4_addrlst.cc option4_addrlst.h libb10_dhcp___la_SOURCES += option_int.h -libb10_dhcp___la_SOURCES += option6_int_array.h +libb10_dhcp___la_SOURCES += option_int_array.h libb10_dhcp___la_SOURCES += dhcp6.h dhcp4.h libb10_dhcp___la_SOURCES += pkt6.cc pkt6.h libb10_dhcp___la_SOURCES += pkt4.cc pkt4.h diff --git a/src/lib/dhcp/libdhcp++.cc b/src/lib/dhcp/libdhcp++.cc index 4260e80083..1faa5e9906 100644 --- a/src/lib/dhcp/libdhcp++.cc +++ b/src/lib/dhcp/libdhcp++.cc @@ -20,8 +20,8 @@ #include <dhcp/option.h> #include <dhcp/option6_ia.h> #include <dhcp/option6_iaaddr.h> -#include <dhcp/option6_int_array.h> #include <dhcp/option_definition.h> +#include <dhcp/option_int_array.h> #include <dhcp/std_option_defs.h> #include <exceptions/exceptions.h> #include <util/buffer.h> diff --git a/src/lib/dhcp/option_data_types.h b/src/lib/dhcp/option_data_types.h index ff5789d16e..e53fa6e2db 100644 --- a/src/lib/dhcp/option_data_types.h +++ b/src/lib/dhcp/option_data_types.h @@ -70,7 +70,7 @@ enum OptionDataType { /// @brief Trait class for data types supported in DHCP option definitions. /// /// This is useful to check whether the type specified as template parameter -/// is supported by classes like Option6Int, Option6IntArray and some template +/// is supported by classes like OptionInt, OptionIntArray and some template /// factory functions in OptionDefinition class. template<typename T> struct OptionDataTypeTraits { diff --git a/src/lib/dhcp/option_definition.cc b/src/lib/dhcp/option_definition.cc index c4c9b8fcac..a753a1af3c 100644 --- a/src/lib/dhcp/option_definition.cc +++ b/src/lib/dhcp/option_definition.cc @@ -17,10 +17,10 @@ #include <dhcp/option6_addrlst.h> #include <dhcp/option6_ia.h> #include <dhcp/option6_iaaddr.h> -#include <dhcp/option6_int_array.h> -#include <dhcp/option_int.h> #include <dhcp/option_custom.h> #include <dhcp/option_definition.h> +#include <dhcp/option_int.h> +#include <dhcp/option_int_array.h> #include <util/encode/hex.h> using namespace std; diff --git a/src/lib/dhcp/option_definition.h b/src/lib/dhcp/option_definition.h index 698c2fda7d..a3985e87c2 100644 --- a/src/lib/dhcp/option_definition.h +++ b/src/lib/dhcp/option_definition.h @@ -51,22 +51,22 @@ typedef boost::shared_ptr<OptionDefinition> OptionDefinitionPtr; /// @brief Forward declaration to OptionInt. /// /// This forward declaration is needed to access OptionInt class -/// without having to include option6_int.h header. This is because +/// without having to include option_int.h header. This is because /// this header includes libdhcp++.h and this causes circular /// inclusion between libdhcp++.h, option_definition.h and /// option6_int.h. template<typename T> class OptionInt; -/// @brief Forward declaration to Option6IntArray. +/// @brief Forward declaration to OptionIntArray. /// -/// This forward declaration is needed to access Option6IntArray class -/// without having to include option6_int_array.h header. This is because +/// This forward declaration is needed to access OptionIntArray class +/// without having to include option_int_array.h header. This is because /// this header includes libdhcp++.h and this causes circular /// inclusion between libdhcp++.h, option_definition.h and -/// option6_int_array.h. +/// option_int_array.h. template<typename T> -class Option6IntArray; +class OptionIntArray; /// @brief Base class representing a DHCP option definition. /// @@ -371,7 +371,7 @@ public: static OptionPtr factoryIntegerArray(uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end) { - OptionPtr option(new Option6IntArray<T>(type, begin, end)); + OptionPtr option(new OptionIntArray<T>(type, begin, end)); return (option); } diff --git a/src/lib/dhcp/option6_int_array.h b/src/lib/dhcp/option_int_array.h index 3b642137fa..4c57818225 100644 --- a/src/lib/dhcp/option6_int_array.h +++ b/src/lib/dhcp/option_int_array.h @@ -12,8 +12,8 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. -#ifndef OPTION6_INT_ARRAY_H -#define OPTION6_INT_ARRAY_H +#ifndef OPTION_INT_ARRAY_H +#define OPTION_INT_ARRAY_H #include <dhcp/libdhcp++.h> #include <dhcp/option.h> @@ -25,9 +25,9 @@ namespace isc { namespace dhcp { -/// This template class represents DHCPv6 option with array of -/// integer values. The type of the elements in the array can be -/// any of the following: +/// This template class represents DHCP (v4 or v6) option with an +/// array of integer values. The type of the elements in the array +/// can be any of the following: /// - uint8_t, /// - uint16_t, /// - uint32_t, @@ -43,7 +43,7 @@ namespace dhcp { /// /// @param T data field type (see above). template<typename T> -class Option6IntArray: public Option { +class OptionIntArray: public Option { public: @@ -55,7 +55,7 @@ public: /// /// @throw isc::dhcp::InvalidDataType if data field type provided /// as template parameter is not a supported integer type. - Option6IntArray(uint16_t type) + OptionIntArray(uint16_t type) : Option(Option::V6, type), values_(0) { if (!OptionDataTypeTraits<T>::integer_type) { @@ -72,7 +72,7 @@ public: /// is not multiple of size of the data type in bytes. /// @throw isc::dhcp::InvalidDataType if data field type provided /// as template parameter is not a supported integer type. - Option6IntArray(uint16_t type, const OptionBuffer& buf) + OptionIntArray(uint16_t type, const OptionBuffer& buf) : Option(Option::V6, type) { if (!OptionDataTypeTraits<T>::integer_type) { isc_throw(dhcp::InvalidDataType, "non-integer type"); @@ -94,7 +94,7 @@ public: /// is not multiple of size of the data type in bytes. /// @throw isc::dhcp::InvalidDataType if data field type provided /// as template parameter is not a supported integer type. - Option6IntArray(uint16_t type, OptionBufferConstIter begin, + OptionIntArray(uint16_t type, OptionBufferConstIter begin, OptionBufferConstIter end) : Option(Option::V6, type) { if (!OptionDataTypeTraits<T>::integer_type) { @@ -225,4 +225,4 @@ private: } // isc::dhcp namespace } // isc namespace -#endif // OPTION6_INT_ARRAY_H +#endif // OPTION_INT_ARRAY_H diff --git a/src/lib/dhcp/std_option_defs.h b/src/lib/dhcp/std_option_defs.h index 35cd56b0b4..8a382e29b1 100644 --- a/src/lib/dhcp/std_option_defs.h +++ b/src/lib/dhcp/std_option_defs.h @@ -25,7 +25,7 @@ namespace { /// @param name name of the array being declared. /// @param types data types of fields that belong to the record. #ifndef RECORD_DECL -#define RECORD_DECL(name, types...) static const OptionDataType name[] = { types } +#define RECORD_DECL(name, types...) static OptionDataType name[] = { types } #endif /// @brief A pair of values: one pointing to the array holding types of @@ -56,7 +56,7 @@ struct OptionDefParams { // RFC 1035, section 3.1. The latter could be handled // by OPT_FQDN_TYPE but we can't use it here because // clients may request ASCII encoding. -RECORD_DECL(FQDN_RECORDS, OPT_UINT8_TYPE, OPT_UINT8_TYPE, OPT_STRING_TYPE) +RECORD_DECL(FQDN_RECORDS, OPT_UINT8_TYPE, OPT_UINT8_TYPE, OPT_STRING_TYPE); /// @brief Definitions of standard DHCPv4 options. static const OptionDefParams OPTION_DEF_PARAMS4[] = { diff --git a/src/lib/dhcp/tests/Makefile.am b/src/lib/dhcp/tests/Makefile.am index 1e988be963..4d177d1dc9 100644 --- a/src/lib/dhcp/tests/Makefile.am +++ b/src/lib/dhcp/tests/Makefile.am @@ -33,8 +33,8 @@ libdhcp___unittests_SOURCES += option4_addrlst_unittest.cc libdhcp___unittests_SOURCES += option6_addrlst_unittest.cc libdhcp___unittests_SOURCES += option6_ia_unittest.cc libdhcp___unittests_SOURCES += option6_iaaddr_unittest.cc -libdhcp___unittests_SOURCES += option6_int_array_unittest.cc libdhcp___unittests_SOURCES += option_int_unittest.cc +libdhcp___unittests_SOURCES += option_int_array_unittest.cc libdhcp___unittests_SOURCES += option_data_types_unittest.cc libdhcp___unittests_SOURCES += option_definition_unittest.cc libdhcp___unittests_SOURCES += option_custom_unittest.cc diff --git a/src/lib/dhcp/tests/libdhcp++_unittest.cc b/src/lib/dhcp/tests/libdhcp++_unittest.cc index 39c7160af5..f0bf343114 100644 --- a/src/lib/dhcp/tests/libdhcp++_unittest.cc +++ b/src/lib/dhcp/tests/libdhcp++_unittest.cc @@ -20,9 +20,9 @@ #include <dhcp/option6_addrlst.h> #include <dhcp/option6_ia.h> #include <dhcp/option6_iaaddr.h> -#include <dhcp/option6_int_array.h> -#include <dhcp/option_int.h> #include <dhcp/option_custom.h> +#include <dhcp/option_int.h> +#include <dhcp/option_int_array.h> #include <util/buffer.h> #include <gtest/gtest.h> @@ -288,11 +288,11 @@ TEST_F(LibDhcpTest, unpackOptions6) { EXPECT_EQ(6, x->second->getType()); // this should be option 6 ASSERT_EQ(8, x->second->len()); // it should be of length 8 // Option with code 6 is the OPTION_ORO. This option is - // represented by the Option6IntArray<uint16_t> class which + // represented by the OptionIntArray<uint16_t> class which // comprises the set of uint16_t values. We need to cast the // returned pointer to this type to get values stored in it. - boost::shared_ptr<Option6IntArray<uint16_t> > opt_oro = - boost::dynamic_pointer_cast<Option6IntArray<uint16_t> >(x->second); + boost::shared_ptr<OptionIntArray<uint16_t> > opt_oro = + boost::dynamic_pointer_cast<OptionIntArray<uint16_t> >(x->second); // This value will be NULL if cast was unsuccessful. This is the case // when returned option has different type than expected. ASSERT_TRUE(opt_oro); @@ -632,7 +632,7 @@ TEST_F(LibDhcpTest, stdOptionDefs6) { LibDhcpTest::testStdOptionDefs6(D6O_IAADDR, buf, typeid(Option6IAAddr)); LibDhcpTest::testStdOptionDefs6(D6O_ORO, buf, - typeid(Option6IntArray<uint16_t>)); + typeid(OptionIntArray<uint16_t>)); LibDhcpTest::testStdOptionDefs6(D6O_PREFERENCE, buf, typeid(OptionInt<uint8_t>)); @@ -723,7 +723,7 @@ TEST_F(LibDhcpTest, stdOptionDefs6) { typeid(OptionCustom)); LibDhcpTest::testStdOptionDefs6(D6O_ERO, buf, - typeid(Option6IntArray<uint16_t>)); + typeid(OptionIntArray<uint16_t>)); LibDhcpTest::testStdOptionDefs6(D6O_LQ_QUERY, buf, typeid(OptionCustom)); diff --git a/src/lib/dhcp/tests/option_definition_unittest.cc b/src/lib/dhcp/tests/option_definition_unittest.cc index b3daf95332..c88df8338d 100644 --- a/src/lib/dhcp/tests/option_definition_unittest.cc +++ b/src/lib/dhcp/tests/option_definition_unittest.cc @@ -21,10 +21,10 @@ #include <dhcp/option6_addrlst.h> #include <dhcp/option6_ia.h> #include <dhcp/option6_iaaddr.h> -#include <dhcp/option6_int_array.h> #include <dhcp/option_custom.h> #include <dhcp/option_definition.h> #include <dhcp/option_int.h> +#include <dhcp/option_int_array.h> #include <exceptions/exceptions.h> #include <boost/pointer_cast.hpp> @@ -740,9 +740,9 @@ TEST_F(OptionDefinitionTest, uint16Array) { EXPECT_NO_THROW( option_v6 = opt_def.optionFactory(Option::V6, opt_code, buf); ); - ASSERT_TRUE(typeid(*option_v6) == typeid(Option6IntArray<uint16_t>)); - boost::shared_ptr<Option6IntArray<uint16_t> > option_cast_v6 = - boost::static_pointer_cast<Option6IntArray<uint16_t> >(option_v6); + ASSERT_TRUE(typeid(*option_v6) == typeid(OptionIntArray<uint16_t>)); + boost::shared_ptr<OptionIntArray<uint16_t> > option_cast_v6 = + boost::static_pointer_cast<OptionIntArray<uint16_t> >(option_v6); // Get the values from the initiated options and validate. std::vector<uint16_t> values = option_cast_v6->getValues(); for (int i = 0; i < values.size(); ++i) { @@ -782,9 +782,9 @@ TEST_F(OptionDefinitionTest, uint16ArrayTokenized) { EXPECT_NO_THROW( option_v6 = opt_def.optionFactory(Option::V6, opt_code, str_values); ); - ASSERT_TRUE(typeid(*option_v6) == typeid(Option6IntArray<uint16_t>)); - boost::shared_ptr<Option6IntArray<uint16_t> > option_cast_v6 = - boost::static_pointer_cast<Option6IntArray<uint16_t> >(option_v6); + ASSERT_TRUE(typeid(*option_v6) == typeid(OptionIntArray<uint16_t>)); + boost::shared_ptr<OptionIntArray<uint16_t> > option_cast_v6 = + boost::static_pointer_cast<OptionIntArray<uint16_t> >(option_v6); // Get the values from the initiated options and validate. std::vector<uint16_t> values = option_cast_v6->getValues(); EXPECT_EQ(12345, values[0]); @@ -813,9 +813,9 @@ TEST_F(OptionDefinitionTest, uint32Array) { EXPECT_NO_THROW( option_v6 = opt_def.optionFactory(Option::V6, opt_code, buf); ); - ASSERT_TRUE(typeid(*option_v6) == typeid(Option6IntArray<uint32_t>)); - boost::shared_ptr<Option6IntArray<uint32_t> > option_cast_v6 = - boost::static_pointer_cast<Option6IntArray<uint32_t> >(option_v6); + ASSERT_TRUE(typeid(*option_v6) == typeid(OptionIntArray<uint32_t>)); + boost::shared_ptr<OptionIntArray<uint32_t> > option_cast_v6 = + boost::static_pointer_cast<OptionIntArray<uint32_t> >(option_v6); // Get the values from the initiated options and validate. std::vector<uint32_t> values = option_cast_v6->getValues(); for (int i = 0; i < values.size(); ++i) { @@ -858,9 +858,9 @@ TEST_F(OptionDefinitionTest, uint32ArrayTokenized) { EXPECT_NO_THROW( option_v6 = opt_def.optionFactory(Option::V6, opt_code, str_values); ); - ASSERT_TRUE(typeid(*option_v6) == typeid(Option6IntArray<uint32_t>)); - boost::shared_ptr<Option6IntArray<uint32_t> > option_cast_v6 = - boost::static_pointer_cast<Option6IntArray<uint32_t> >(option_v6); + ASSERT_TRUE(typeid(*option_v6) == typeid(OptionIntArray<uint32_t>)); + boost::shared_ptr<OptionIntArray<uint32_t> > option_cast_v6 = + boost::static_pointer_cast<OptionIntArray<uint32_t> >(option_v6); // Get the values from the initiated options and validate. std::vector<uint32_t> values = option_cast_v6->getValues(); EXPECT_EQ(123456, values[0]); diff --git a/src/lib/dhcp/tests/option6_int_array_unittest.cc b/src/lib/dhcp/tests/option_int_array_unittest.cc index 3a8640a59d..4ba47d2cdc 100644 --- a/src/lib/dhcp/tests/option6_int_array_unittest.cc +++ b/src/lib/dhcp/tests/option_int_array_unittest.cc @@ -17,7 +17,7 @@ #include <dhcp/dhcp6.h> #include <dhcp/option.h> #include <dhcp/option6_iaaddr.h> -#include <dhcp/option6_int_array.h> +#include <dhcp/option_int_array.h> #include <util/buffer.h> #include <boost/pointer_cast.hpp> @@ -31,13 +31,13 @@ using namespace isc::util; namespace { -/// @brief Option6IntArray test class. -class Option6IntArrayTest : public ::testing::Test { +/// @brief OptionIntArray test class. +class OptionIntArrayTest : public ::testing::Test { public: /// @brief Constructor. /// /// Initializes the option buffer with some data. - Option6IntArrayTest(): buf_(255), out_buf_(255) { + OptionIntArrayTest(): buf_(255), out_buf_(255) { for (int i = 0; i < 255; i++) { buf_[i] = 255 - i; } @@ -57,21 +57,21 @@ public: // returns the buffer which is actually the array of uint8_t. // However, since we allow using uint8_t types with this template // class we have to test it here. - boost::shared_ptr<Option6IntArray<T> > opt; + boost::shared_ptr<OptionIntArray<T> > opt; const int opt_len = 10; const uint16_t opt_code = 80; // Constructor throws exception if provided buffer is empty. EXPECT_THROW( - Option6IntArray<T>(opt_code, buf_.begin(), buf_.begin()), + OptionIntArray<T>(opt_code, buf_.begin(), buf_.begin()), isc::OutOfRange ); // Provided buffer is not empty so it should not throw exception. ASSERT_NO_THROW( opt = boost::shared_ptr< - Option6IntArray<T> >(new Option6IntArray<T>(opt_code, buf_.begin(), - buf_.begin() + opt_len)) + OptionIntArray<T> >(new OptionIntArray<T>(opt_code, buf_.begin(), + buf_.begin() + opt_len)) ); EXPECT_EQ(Option::V6, opt->getUniverse()); @@ -124,28 +124,28 @@ public: template<typename T> void bufferToIntTest16() { // Create option that conveys array of multiple uint16_t or int16_t values. - boost::shared_ptr<Option6IntArray<T> > opt; + boost::shared_ptr<OptionIntArray<T> > opt; const int opt_len = 20; const uint16_t opt_code = 81; // Constructor throws exception if provided buffer is empty. EXPECT_THROW( - Option6IntArray<T>(opt_code, buf_.begin(), buf_.begin()), + OptionIntArray<T>(opt_code, buf_.begin(), buf_.begin()), isc::OutOfRange ); // Constructor throws exception if provided buffer's length is not // multiple of 2-bytes. EXPECT_THROW( - Option6IntArray<T>(opt_code, buf_.begin(), buf_.begin() + 5), + OptionIntArray<T>(opt_code, buf_.begin(), buf_.begin() + 5), isc::OutOfRange ); // Now the buffer length is correct. ASSERT_NO_THROW( opt = boost::shared_ptr< - Option6IntArray<T> >(new Option6IntArray<T>(opt_code, buf_.begin(), - buf_.begin() + opt_len)) + OptionIntArray<T> >(new OptionIntArray<T>(opt_code, buf_.begin(), + buf_.begin() + opt_len)) ); EXPECT_EQ(Option::V6, opt->getUniverse()); @@ -195,28 +195,28 @@ public: template<typename T> void bufferToIntTest32() { // Create option that conveys array of multiple uint16_t values. - boost::shared_ptr<Option6IntArray<T> > opt; + boost::shared_ptr<OptionIntArray<T> > opt; const int opt_len = 40; const uint16_t opt_code = 82; // Constructor throws exception if provided buffer is empty. EXPECT_THROW( - Option6IntArray<T>(opt_code, buf_.begin(), buf_.begin()), + OptionIntArray<T>(opt_code, buf_.begin(), buf_.begin()), isc::OutOfRange ); // Constructor throws exception if provided buffer's length is not // multiple of 4-bytes. EXPECT_THROW( - Option6IntArray<T>(opt_code, buf_.begin(), buf_.begin() + 9), + OptionIntArray<T>(opt_code, buf_.begin(), buf_.begin() + 9), isc::OutOfRange ); // Now the buffer length is correct. ASSERT_NO_THROW( opt = boost::shared_ptr< - Option6IntArray<T> >(new Option6IntArray<T>(opt_code, buf_.begin(), - buf_.begin() + opt_len)) + OptionIntArray<T> >(new OptionIntArray<T>(opt_code, buf_.begin(), + buf_.begin() + opt_len)) ); EXPECT_EQ(Option::V6, opt->getUniverse()); @@ -268,51 +268,51 @@ public: /// convey unsigned values. We should maybe extend these tests for /// signed types too. -TEST_F(Option6IntArrayTest, useInvalidType) { +TEST_F(OptionIntArrayTest, useInvalidType) { const uint16_t opt_code = 80; EXPECT_THROW( boost::scoped_ptr< - Option6IntArray<bool> >(new Option6IntArray<bool>(opt_code, OptionBuffer(5))), + OptionIntArray<bool> >(new OptionIntArray<bool>(opt_code, OptionBuffer(5))), InvalidDataType ); EXPECT_THROW( boost::scoped_ptr< - Option6IntArray<int64_t> >(new Option6IntArray<int64_t>(opt_code, - OptionBuffer(10))), + OptionIntArray<int64_t> >(new OptionIntArray<int64_t>(opt_code, + OptionBuffer(10))), InvalidDataType ); } -TEST_F(Option6IntArrayTest, bufferToUint8) { +TEST_F(OptionIntArrayTest, bufferToUint8) { bufferToIntTest8<uint8_t>(); } -TEST_F(Option6IntArrayTest, bufferToInt8) { +TEST_F(OptionIntArrayTest, bufferToInt8) { bufferToIntTest8<int8_t>(); } -TEST_F(Option6IntArrayTest, bufferToUint16) { +TEST_F(OptionIntArrayTest, bufferToUint16) { bufferToIntTest16<uint16_t>(); } -TEST_F(Option6IntArrayTest, bufferToInt16) { +TEST_F(OptionIntArrayTest, bufferToInt16) { bufferToIntTest16<int16_t>(); } -TEST_F(Option6IntArrayTest, bufferToUint32) { +TEST_F(OptionIntArrayTest, bufferToUint32) { bufferToIntTest32<uint32_t>(); } -TEST_F(Option6IntArrayTest, bufferToInt32) { +TEST_F(OptionIntArrayTest, bufferToInt32) { bufferToIntTest32<int32_t>(); } -TEST_F(Option6IntArrayTest, setValuesUint8) { +TEST_F(OptionIntArrayTest, setValuesUint8) { const uint16_t opt_code = 100; // Create option with empty vector of values. - boost::shared_ptr<Option6IntArray<uint8_t> > opt(new Option6IntArray<uint8_t>(opt_code)); + boost::shared_ptr<OptionIntArray<uint8_t> > opt(new OptionIntArray<uint8_t>(opt_code)); // Initialize vector with some data and pass to the option. std::vector<uint8_t> values; for (int i = 0; i < 10; ++i) { @@ -327,10 +327,10 @@ TEST_F(Option6IntArrayTest, setValuesUint8) { EXPECT_TRUE(std::equal(values.begin(), values.end(), returned_values.begin())); } -TEST_F(Option6IntArrayTest, setValuesInt8) { +TEST_F(OptionIntArrayTest, setValuesInt8) { const uint16_t opt_code = 100; // Create option with empty vector of values. - boost::shared_ptr<Option6IntArray<int8_t> > opt(new Option6IntArray<int8_t>(opt_code)); + boost::shared_ptr<OptionIntArray<int8_t> > opt(new OptionIntArray<int8_t>(opt_code)); // Initialize vector with some data and pass to the option. std::vector<int8_t> values; for (int i = 0; i < 10; ++i) { @@ -345,10 +345,10 @@ TEST_F(Option6IntArrayTest, setValuesInt8) { EXPECT_TRUE(std::equal(values.begin(), values.end(), returned_values.begin())); } -TEST_F(Option6IntArrayTest, setValuesUint16) { +TEST_F(OptionIntArrayTest, setValuesUint16) { const uint16_t opt_code = 101; // Create option with empty vector of values. - boost::shared_ptr<Option6IntArray<uint16_t> > opt(new Option6IntArray<uint16_t>(opt_code)); + boost::shared_ptr<OptionIntArray<uint16_t> > opt(new OptionIntArray<uint16_t>(opt_code)); // Initialize vector with some data and pass to the option. std::vector<uint16_t> values; for (int i = 0; i < 10; ++i) { @@ -363,10 +363,10 @@ TEST_F(Option6IntArrayTest, setValuesUint16) { EXPECT_TRUE(std::equal(values.begin(), values.end(), returned_values.begin())); } -TEST_F(Option6IntArrayTest, setValuesInt16) { +TEST_F(OptionIntArrayTest, setValuesInt16) { const uint16_t opt_code = 101; // Create option with empty vector of values. - boost::shared_ptr<Option6IntArray<int16_t> > opt(new Option6IntArray<int16_t>(opt_code)); + boost::shared_ptr<OptionIntArray<int16_t> > opt(new OptionIntArray<int16_t>(opt_code)); // Initialize vector with some data and pass to the option. std::vector<int16_t> values; for (int i = 0; i < 10; ++i) { @@ -381,10 +381,10 @@ TEST_F(Option6IntArrayTest, setValuesInt16) { EXPECT_TRUE(std::equal(values.begin(), values.end(), returned_values.begin())); } -TEST_F(Option6IntArrayTest, setValuesUint32) { +TEST_F(OptionIntArrayTest, setValuesUint32) { const uint32_t opt_code = 101; // Create option with empty vector of values. - boost::shared_ptr<Option6IntArray<uint32_t> > opt(new Option6IntArray<uint32_t>(opt_code)); + boost::shared_ptr<OptionIntArray<uint32_t> > opt(new OptionIntArray<uint32_t>(opt_code)); // Initialize vector with some data and pass to the option. std::vector<uint32_t> values; for (int i = 0; i < 10; ++i) { @@ -399,10 +399,10 @@ TEST_F(Option6IntArrayTest, setValuesUint32) { EXPECT_TRUE(std::equal(values.begin(), values.end(), returned_values.begin())); } -TEST_F(Option6IntArrayTest, setValuesInt32) { +TEST_F(OptionIntArrayTest, setValuesInt32) { const uint32_t opt_code = 101; // Create option with empty vector of values. - boost::shared_ptr<Option6IntArray<int32_t> > opt(new Option6IntArray<int32_t>(opt_code)); + boost::shared_ptr<OptionIntArray<int32_t> > opt(new OptionIntArray<int32_t>(opt_code)); // Initialize vector with some data and pass to the option. std::vector<int32_t> values; for (int i = 0; i < 10; ++i) { |