Parcourir la source

[1186] Part 5 of the review changes

- Option6Lst is now Option6Collection
- Corrected data_len_ mistake in Option::pack4
- Added comments about length calculation
- Added doxygen comments
- Some const and references added
- Many other minor changes.
Tomek Mrugalski il y a 13 ans
Parent
commit
4ec7a8d9ab

+ 3 - 3
src/lib/dhcp/libdhcp.cc

@@ -32,7 +32,7 @@ unsigned int
 LibDHCP::unpackOptions6(const boost::shared_array<uint8_t> buf,
                         unsigned int buf_len,
                         unsigned int offset, unsigned int parse_len,
-                        isc::dhcp::Option::Option6Lst& options) {
+                        isc::dhcp::Option::Option6Collection& options) {
     if (offset + parse_len > buf_len) {
         isc_throw(OutOfRange, "Option parse failed. Tried to parse "
                   << parse_len << " bytes at offset " << offset
@@ -88,9 +88,9 @@ unsigned int
 LibDHCP::packOptions6(boost::shared_array<uint8_t> data,
                       unsigned int data_len,
                       unsigned int offset,
-                      const isc::dhcp::Option::Option6Lst& options) {
+                      const isc::dhcp::Option::Option6Collection& options) {
     try {
-        for (isc::dhcp::Option::Option6Lst::const_iterator it = options.begin();
+        for (isc::dhcp::Option::Option6Collection::const_iterator it = options.begin();
              it != options.end();
              ++it) {
             unsigned short opt_len = (*it).second->len();

+ 2 - 2
src/lib/dhcp/libdhcp.h

@@ -39,7 +39,7 @@ public:
     static unsigned int
     packOptions6(boost::shared_array<uint8_t> buf, unsigned int buf_len,
                  unsigned int offset,
-                 const isc::dhcp::Option::Option6Lst& options);
+                 const isc::dhcp::Option::Option6Collection& options);
 
     ///
     /// Parses provided buffer and creates Option objects.
@@ -57,7 +57,7 @@ public:
     static unsigned int
     unpackOptions6(const boost::shared_array<uint8_t> buf, unsigned int buf_len,
                    unsigned int offset, unsigned int parse_len,
-                   isc::dhcp::Option::Option6Lst& options_);
+                   isc::dhcp::Option::Option6Collection& options_);
 
     ///
     /// Registers factory method that produces options of specific option types.

+ 28 - 22
src/lib/dhcp/option.cc

@@ -32,7 +32,8 @@ Option::Option(Universe u, unsigned short type)
 
 }
 
-Option::Option(Universe u, unsigned short type, boost::shared_array<uint8_t> buf,
+Option::Option(Universe u, unsigned short type,
+               boost::shared_array<uint8_t> buf,
                unsigned int offset, unsigned int len)
     :universe_(u), type_(type), data_(buf),
      data_len_(len), offset_(offset)
@@ -69,7 +70,7 @@ Option::pack4(boost::shared_array<uint8_t> buf,
     ptr[0] = type_;
     ptr[1] = data_len_;
     ptr += 2;
-    memcpy(ptr, &data_[0], data_len_+4);
+    memcpy(ptr, &data_[0], data_len_);
 
     return offset + len();
 }
@@ -95,7 +96,7 @@ Option::pack6(boost::shared_array<uint8_t> buf,
 
     offset += 4 + data_len_; // end of this option
 
-    return LibDHCP::packOptions6(buf, buf_len, offset, optionLst_);
+    return LibDHCP::packOptions6(buf, buf_len, offset, options_);
 }
 
 unsigned int
@@ -142,25 +143,30 @@ Option::unpack6(boost::shared_array<uint8_t> buf,
     data_len_ = buf_len;
 
     return LibDHCP::unpackOptions6(buf, buf_len, offset, parse_len,
-                                   optionLst_);
+                                   options_);
 }
 
-unsigned short Option::len() {
+unsigned short
+Option::len() {
+
+    // length of the whole option is header and data stored in this option...
     int length = getHeaderLen() + data_len_;
 
-    for (Option::Option6Lst::iterator it = optionLst_.begin();
-         it != optionLst_.end();
+    // ... and sum of lengths of all suboptions
+    for (Option::Option6Collection::iterator it = options_.begin();
+         it != options_.end();
          ++it) {
         length += (*it).second->len();
     }
 
+    // note that this is not equal to lenght field. This value denotes
+    // number of bytes required to store this option. length option should
+    // contain (len()-getHeaderLen()) value.
     return (length);
 }
 
-bool Option::valid() {
-    // total length of buffer is not stored. shared_array is not very useful.
-    // we should either add buf_len field or better replace shared_array
-    // with shared_ptr to array
+bool
+Option::valid() {
     if (universe_ != V4 &&
         universe_ != V6) {
         return (false);
@@ -171,15 +177,16 @@ bool Option::valid() {
 
 void
 isc::dhcp::Option::addOption(boost::shared_ptr<isc::dhcp::Option> opt) {
-    optionLst_.insert(pair<int, boost::shared_ptr<Option> >(opt->getType(),
+    options_.insert(pair<int, boost::shared_ptr<Option> >(opt->getType(),
                                                             opt));
 
 }
 
 boost::shared_ptr<isc::dhcp::Option>
 Option::getOption(unsigned short opt_type) {
-    isc::dhcp::Option::Option6Lst::const_iterator x = optionLst_.find(opt_type);
-    if (x!=optionLst_.end()) {
+    isc::dhcp::Option::Option6Collection::const_iterator x =
+        options_.find(opt_type);
+    if ( x != options_.end() ) {
         return (*x).second;
     }
     return boost::shared_ptr<isc::dhcp::Option>(); // NULL
@@ -187,9 +194,9 @@ Option::getOption(unsigned short opt_type) {
 
 bool
 Option::delOption(unsigned short opt_type) {
-    isc::dhcp::Option::Option6Lst::iterator x = optionLst_.find(opt_type);
-    if (x!=optionLst_.end()) {
-        optionLst_.erase(x);
+    isc::dhcp::Option::Option6Collection::iterator x = options_.find(opt_type);
+    if ( x != options_.end() ) {
+        options_.erase(x);
         return true; // delete successful
     }
     return (false); // option not found, can't delete
@@ -213,8 +220,8 @@ std::string Option::toText(int indent /* =0 */ ) {
     }
 
     // print suboptions
-    for (Option6Lst::const_iterator opt=optionLst_.begin();
-         opt!=optionLst_.end();
+    for (Option6Collection::const_iterator opt=options_.begin();
+         opt!=options_.end();
          ++opt) {
         tmp << (*opt).second->toText(indent+2);
     }
@@ -239,14 +246,13 @@ unsigned short
 Option::getHeaderLen() {
     switch (universe_) {
     case V4:
-        return 2; // header length for v4
+        return OPTION4_HDR_LEN; // header length for v4
     case V6:
-        return 4; // header length for v6
+        return OPTION6_HDR_LEN; // header length for v6
     }
     return 0; // should not happen
 }
 
-
 Option::~Option() {
 
 }

+ 81 - 44
src/lib/dhcp/option.h

@@ -24,36 +24,78 @@ namespace dhcp {
 
 class Option {
 public:
+    /// length of the usual DHCPv4 option header (there are exceptions)
+    const static size_t OPTION4_HDR_LEN = 2;
+
+    /// length of any DHCPv6 option header
+    const static size_t OPTION6_HDR_LEN = 4;
+
+    /// defines option universe DHCPv4 or DHCPv6
     enum Universe { V4, V6 };
-    typedef std::map<unsigned int, boost::shared_ptr<Option> > Option4Lst;
-    typedef std::multimap<unsigned int, boost::shared_ptr<Option> > Option6Lst;
+
+    /// a collection of DHCPv4 options
+    typedef std::map<unsigned int, boost::shared_ptr<Option> >
+    Option4Collection;
+
+    /// a collection of DHCPv6 options
+    typedef std::multimap<unsigned int, boost::shared_ptr<Option> >
+    Option6Collection;
+
+    /// @brief a factory function prototype
+    ///
+    /// @param u option universe (DHCPv4 or DHCPv6)
+    /// @param type option type
+    /// @param buf pointer to a buffer
+    /// @param offset offset to first data byte in that buffer
+    /// @param len data length of this option
+    ///
+    /// @return a pointer to a created option object
     typedef boost::shared_ptr<Option> Factory(Option::Universe u,
                                               unsigned short type,
                                               boost::shared_array<uint8_t> buf,
                                               unsigned int offset,
                                               unsigned int len);
 
-    // ctor, used for options constructed, usually during transmission
+    /// @brief ctor, used for options constructed, usually during transmission
+    ///
+    /// @param u option universe (DHCPv4 or DHCPv6)
+    /// @param type option type
     Option(Universe u, unsigned short type);
 
-    // ctor, used for received options
-    // boost::shared_array allows sharing a buffer, but it requires that
-    // different instances share pointer to the whole array, not point
-    // to different elements in shared array. Therefore we need to share
-    // pointer to the whole array and remember offset where data for
-    // this option begins
+    /// @brief ctor, used for received options
+    ///
+    /// boost::shared_array allows sharing a buffer, but it requires that
+    /// different instances share pointer to the whole array, not point
+    /// to different elements in shared array. Therefore we need to share
+    /// pointer to the whole array and remember offset where data for
+    /// this option begins
+    ///
+    /// @param u specifies universe (V4 or V6)
+    /// @param type option type
+    /// @param buf pointer to a buffer
+    /// @param offset offset in a buffer pointing to first byte of data
+    /// @param len length of the option data
     Option(Universe u, unsigned short type, boost::shared_array<uint8_t> buf,
            unsigned int offset,
            unsigned int len);
 
-    // writes option in wire-format to buf, returns pointer to first unused
-    // byte after stored option
+    /// @brief writes option in wire-format to buf
+    ///
+    /// Writes option in wire-format to buffer, returns pointer to first unused
+    /// byte after stored option (that is useful for writing options one after
+    /// another)
+    ///
+    /// @param buf pointer to a buffer
+    /// @param buf_len length of the buffer
+    /// @param offset offset to place, where option shout be stored
+    ///
+    /// @return offset to first unused byte after stored option
+    ///
     virtual unsigned int
     pack(boost::shared_array<uint8_t> buf,
          unsigned int buf_len,
          unsigned int offset);
 
-    ///
     /// @brief Parses buffer.
     ///
     /// Parses received buffer, returns offset to the first unused byte after
@@ -65,28 +107,23 @@ public:
     /// @param parse_len how many bytes should be parsed
     ///
     /// @return offset after last parsed option
-    ///
     virtual unsigned int
     unpack(boost::shared_array<uint8_t> buf,
            unsigned int buf_len,
            unsigned int offset,
            unsigned int parse_len);
 
-    ///
     /// Returns string representation of the option.
     ///
     /// @param indent number of spaces before printing text
     ///
     /// @return string with text representation.
-    ///
     virtual std::string
     toText(int indent = 0);
 
-    ///
     /// Returns option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
     ///
     /// @return option type
-    ///
     unsigned short
     getType();
 
@@ -94,32 +131,33 @@ public:
     /// option header)
     ///
     /// @return length of the option
-    ///
     virtual unsigned short
     len();
 
     /// @brief Returns length of header (2 for v4, 4 for v6)
     ///
     /// @return length of option header
-    ///
     virtual unsigned short
     getHeaderLen();
 
     /// returns if option is valid (e.g. option may be truncated)
+    ///
+    /// @return true, if option is valid
     virtual bool
     valid();
 
     /// Returns pointer to actual data.
     ///
     /// @return pointer to actual data (or NULL if there is no data)
-    ///
     virtual uint8_t*
     getData();
 
     /// Adds a sub-option.
     ///
-    /// @param opt shared pointer to a suboption that is going to be added.
+    /// Some DHCPv6 options can have suboptions. This method allows adding
+    /// options within options.
     ///
+    /// @param opt shared pointer to a suboption that is going to be added.
     void
     addOption(boost::shared_ptr<Option> opt);
 
@@ -128,7 +166,6 @@ public:
     /// @param type type of requested suboption
     ///
     /// @return shared_ptr to requested suoption
-    ///
     boost::shared_ptr<isc::dhcp::Option>
     getOption(unsigned short type);
 
@@ -141,15 +178,12 @@ public:
     bool
     delOption(unsigned short type);
 
-    /// TODO Need to implement getOptions() as well
-
-    // just to force that every option has virtual dtor
+    /// just to force that every option has virtual dtor
     virtual
     ~Option();
 
 protected:
 
-    ///
     /// Builds raw (over-wire) buffer of this option, including all
     /// defined suboptions. Version for building DHCPv4 options.
     ///
@@ -158,13 +192,11 @@ protected:
     /// @param offset offset from start of the buf buffer
     ///
     /// @return offset to the next byte after last used byte
-    ///
     virtual unsigned int
     pack4(boost::shared_array<uint8_t> buf,
           unsigned int buf_len,
           unsigned int offset);
 
-    ///
     /// Builds raw (over-wire) buffer of this option, including all
     /// defined suboptions. Version for building DHCPv4 options.
     ///
@@ -173,13 +205,11 @@ protected:
     /// @param offset offset from start of the buf buffer
     ///
     /// @return offset to the next byte after last used byte
-    ///
     virtual unsigned int
     pack6(boost::shared_array<uint8_t> buf,
           unsigned int buf_len,
           unsigned int offset);
 
-    ///
     /// Parses provided buffer and creates DHCPv4 options.
     ///
     /// @param buf buffer that contains raw buffer to parse (on-wire format)
@@ -187,14 +217,12 @@ protected:
     /// @param offset offset from start of the buf buffer
     ///
     /// @return offset to the next byte after last parsed byte
-    ///
     virtual unsigned int
     unpack4(boost::shared_array<uint8_t> buf,
             unsigned int buf_len,
             unsigned int offset,
             unsigned int parse_len);
 
-    ///
     /// Parses provided buffer and creates DHCPv6 options.
     ///
     /// @param buf buffer that contains raw buffer to parse (on-wire format)
@@ -202,26 +230,35 @@ protected:
     /// @param offset offset from start of the buf buffer
     ///
     /// @return offset to the next byte after last parsed byte
-    ///
     virtual unsigned int
     unpack6(boost::shared_array<uint8_t> buf,
             unsigned int buf_len,
             unsigned int offset,
             unsigned int parse_len);
 
-    Universe universe_; // option universe (V4 or V6)
-    unsigned short type_; // option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
+    /// option universe (V4 or V6)
+    Universe universe_;
+
+    /// option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
+    unsigned short type_;
 
+    /// shared pointer to a buffer (usually a part of packet)
     boost::shared_array<uint8_t> data_;
-    unsigned int data_len_; // length of data only. Use len() if you want to
-                            // know proper length with option header overhead
-    unsigned int offset_; // data is a shared_pointer that points out to the
-                          // whole packet. offset_ specifies where data for
-                          // this option begins.
-
-    // TODO: probably 2 different containers have to be used for v4 (unique
-    // options) and v6 (options with the same type can repeat)
-    Option6Lst optionLst_;
+
+    /// length of data only. Use len() if you want to
+    /// know proper length with option header overhead
+    unsigned int data_len_;
+
+    /// data is a shared_pointer that points out to the
+    /// whole packet. offset_ specifies where data for
+    /// this option begins.
+    unsigned int offset_;
+
+    /// collection for storing suboptions
+    Option6Collection options_;
+
+    /// TODO: probably 2 different containers have to be used for v4 (unique
+    /// options) and v6 (options with the same type can repeat)
 };
 
 } // namespace isc::dhcp

+ 10 - 12
src/lib/dhcp/option6_addrlst.cc

@@ -29,15 +29,13 @@ using namespace isc::asiolink;
 
 
 Option6AddrLst::Option6AddrLst(unsigned short type,
-                               std::vector<isc::asiolink::IOAddress>& addrs)
-    :Option(V6, type) {
-    addrs_ = addrs;
+                               const AddressContainer& addrs)
+    :Option(V6, type), addrs_(addrs) {
 }
 
 Option6AddrLst::Option6AddrLst(unsigned short type,
-                               isc::asiolink::IOAddress addr)
-    :Option(V6, type) {
-    addrs_.push_back(addr);
+                               const isc::asiolink::IOAddress& addr)
+    :Option(V6, type), addrs_(1,addr) {
 }
 
 Option6AddrLst::Option6AddrLst(unsigned short type,
@@ -50,13 +48,13 @@ Option6AddrLst::Option6AddrLst(unsigned short type,
 }
 
 void
-Option6AddrLst::setAddress(isc::asiolink::IOAddress addr) {
+Option6AddrLst::setAddress(const isc::asiolink::IOAddress& addr) {
     addrs_.clear();
     addrs_.push_back(addr);
 }
 
 void
-Option6AddrLst::setAddresses(std::vector<isc::asiolink::IOAddress>& addrs) {
+Option6AddrLst::setAddresses(const AddressContainer& addrs) {
     addrs_ = addrs;
 }
 
@@ -80,8 +78,8 @@ Option6AddrLst::pack(boost::shared_array<uint8_t> buf,
          ++addr) {
         memcpy(&buf[offset],
                addr->getAddress().to_v6().to_bytes().data(),
-               16);
-        offset += 16;
+               V6ADDRESS_LEN);
+        offset += V6ADDRESS_LEN;
     }
 
     return offset;
@@ -118,7 +116,7 @@ std::string Option6AddrLst::toText(int indent /* =0 */) {
 
     tmp << "type=" << type_ << " " << addrs_.size() << "addr(s): ";
 
-    for (AddrsContainer::const_iterator addr=addrs_.begin();
+    for (AddressContainer::const_iterator addr=addrs_.begin();
          addr!=addrs_.end();
          ++addr) {
         tmp << addr->toText() << " ";
@@ -128,5 +126,5 @@ std::string Option6AddrLst::toText(int indent /* =0 */) {
 
 unsigned short Option6AddrLst::len() {
 
-    return (4 /* DHCPv6 option header len */ + addrs_.size()*16);
+    return (OPTION6_HDR_LEN + addrs_.size()*16);
 }

+ 10 - 7
src/lib/dhcp/option6_addrlst.h

@@ -31,7 +31,10 @@ class Option6AddrLst: public Option {
 
 
 public:
-    typedef std::vector<isc::asiolink::IOAddress> AddrsContainer;
+    /// a container for (IPv6) addresses
+    typedef std::vector<isc::asiolink::IOAddress> AddressContainer;
+
+    const static size_t V6ADDRESS_LEN = 16;
 
     /// @brief Constructor used during option generation.
     ///
@@ -39,7 +42,7 @@ public:
     /// @param addrs vector of addresses to be stored
     ///
     Option6AddrLst(unsigned short type,
-                   AddrsContainer& addrs);
+                   const AddressContainer& addrs);
 
     /// @brief Simplified constructor for a single address
     ///
@@ -47,7 +50,7 @@ public:
     /// @param addr a single address to be stored
     ///
     Option6AddrLst(unsigned short type,
-                   isc::asiolink::IOAddress addr);
+                   const isc::asiolink::IOAddress& addr);
 
     /// @brief Constructor used for parsing received option
     ///
@@ -95,13 +98,13 @@ public:
     ///
     /// @param addr a single address to be added
     ///
-    void setAddress(isc::asiolink::IOAddress addr);
+    void setAddress(const isc::asiolink::IOAddress& addr);
 
     /// @brief Sets list of addresses.
     ///
     /// @param addrs a vector of addresses to be added
     ///
-    void setAddresses(std::vector<isc::asiolink::IOAddress>& addrs);
+    void setAddresses(const AddressContainer& addrs);
 
     /// @brief Returns vector with addresses.
     ///
@@ -111,14 +114,14 @@ public:
     ///
     /// @return vector with addresses
     ///
-    AddrsContainer
+    AddressContainer
     getAddresses() { return addrs_; };
 
     // returns data length (data length + DHCPv4/DHCPv6 option header)
     virtual unsigned short len();
 
 protected:
-    AddrsContainer addrs_;
+    AddressContainer addrs_;
 };
 
 } // isc::dhcp namespace

+ 7 - 7
src/lib/dhcp/option6_ia.cc

@@ -65,7 +65,7 @@ Option6IA::pack(boost::shared_array<uint8_t> buf,
     *(uint32_t*)ptr = htonl(t2_);
     ptr += 4;
 
-    offset = LibDHCP::packOptions6(buf, buf_len, offset+16, optionLst_);
+    offset = LibDHCP::packOptions6(buf, buf_len, offset+16, options_);
     return offset;
 }
 
@@ -84,7 +84,7 @@ Option6IA::unpack(boost::shared_array<uint8_t> buf,
     t2_ = ntohl(*(uint32_t*)&buf[offset]);
     offset +=4;
     offset = LibDHCP::unpackOptions6(buf, buf_len, offset,
-                                     parse_len - 12, optionLst_);
+                                     parse_len - 12, options_);
 
     return (offset);
 }
@@ -107,10 +107,10 @@ std::string Option6IA::toText(int indent /* = 0*/) {
         tmp << "(unknown)";
     }
     tmp << " iaid=" << iaid_ << ", t1=" << t1_ << ", t2=" << t2_
-        << " " << optionLst_.size() << " sub-options:" << endl;
+        << " " << options_.size() << " sub-options:" << endl;
 
-    for (Option6Lst::const_iterator opt=optionLst_.begin();
-         opt!=optionLst_.end();
+    for (Option6Collection::const_iterator opt=options_.begin();
+         opt!=options_.end();
          ++opt) {
         tmp << (*opt).second->toText(indent+2);
     }
@@ -122,8 +122,8 @@ unsigned short Option6IA::len() {
     unsigned short length = 4/*header*/ + 12 /* option content */; // header
 
     // length of all suboptions
-    for (Option::Option6Lst::iterator it = optionLst_.begin();
-         it != optionLst_.end();
+    for (Option::Option6Collection::iterator it = options_.begin();
+         it != options_.end();
          ++it) {
         length += (*it).second->len();
     }

+ 6 - 7
src/lib/dhcp/option6_iaaddr.cc

@@ -68,7 +68,7 @@ Option6IAAddr::pack(boost::shared_array<uint8_t> buf,
     offset += 4;
 
     // parse suboption (there shouldn't be any)
-    offset = LibDHCP::packOptions6(buf, buf_len, offset, optionLst_);
+    offset = LibDHCP::packOptions6(buf, buf_len, offset, options_);
     return offset;
 }
 
@@ -91,7 +91,7 @@ Option6IAAddr::unpack(boost::shared_array<uint8_t> buf,
     valid_ = ntohl(*(uint32_t*)&buf[offset]);
     offset +=4;
     offset = LibDHCP::unpackOptions6(buf, buf_len, offset,
-                                     parse_len - 24, optionLst_);
+                                     parse_len - 24, options_);
 
     return offset;
 }
@@ -105,8 +105,8 @@ std::string Option6IAAddr::toText(int indent /* =0 */) {
         << ", preferred-lft=" << preferred_  << ", valid-lft="
         << valid_ << endl;
 
-    for (Option6Lst::const_iterator opt=optionLst_.begin();
-         opt!=optionLst_.end();
+    for (Option6Collection::const_iterator opt=options_.begin();
+         opt!=options_.end();
          ++opt) {
         tmp << (*opt).second->toText(indent+2);
     }
@@ -120,9 +120,8 @@ unsigned short Option6IAAddr::len() {
     // length of all suboptions
     // TODO implement:
     // protected: unsigned short Option::lenHelper(int header_size);
-
-    for (Option::Option6Lst::iterator it = optionLst_.begin();
-         it != optionLst_.end();
+    for (Option::Option6Collection::iterator it = options_.begin();
+         it != options_.end();
          ++it) {
         length += (*it).second->len();
     }

+ 4 - 4
src/lib/dhcp/pkt6.cc

@@ -78,7 +78,7 @@ Pkt6::Pkt6(uint8_t msg_type,
 unsigned short Pkt6::len() {
     unsigned int length = 4; // DHCPv6 header
 
-    for (Option::Option6Lst::iterator it = options_.begin();
+    for (Option::Option6Collection::iterator it = options_.begin();
          it != options_.end();
          ++it) {
         length += (*it).second->len();
@@ -253,7 +253,7 @@ Pkt6::toText() {
         << "]:" << remote_port_ << endl;
     tmp << "msgtype=" << msg_type_ << ", transid=0x" << hex << transid_
         << dec << endl;
-    for (isc::dhcp::Option::Option6Lst::iterator opt=options_.begin();
+    for (isc::dhcp::Option::Option6Collection::iterator opt=options_.begin();
          opt != options_.end();
          ++opt) {
         tmp << opt->second->toText() << std::endl;
@@ -274,7 +274,7 @@ Pkt6::toText() {
  */
 boost::shared_ptr<isc::dhcp::Option>
 Pkt6::getOption(unsigned short opt_type) {
-    isc::dhcp::Option::Option6Lst::const_iterator x = options_.find(opt_type);
+    isc::dhcp::Option::Option6Collection::const_iterator x = options_.find(opt_type);
     if (x!=options_.end()) {
         return (*x).second;
     }
@@ -298,7 +298,7 @@ Pkt6::addOption(boost::shared_ptr<Option> opt) {
 
 bool
 Pkt6::delOption(unsigned short type) {
-    isc::dhcp::Option::Option6Lst::iterator x = options_.find(type);
+    isc::dhcp::Option::Option6Collection::iterator x = options_.find(type);
     if (x!=options_.end()) {
         options_.erase(x);
         return (true); // delete successful

+ 1 - 1
src/lib/dhcp/pkt6.h

@@ -88,7 +88,7 @@ namespace isc {
         /// TODO Need to implement getOptions() as well
 
         // XXX: add *a lot* here
-        isc::dhcp::Option::Option6Lst options_;
+        isc::dhcp::Option::Option6Collection options_;
 
     protected:
         bool packTCP();

+ 3 - 3
src/lib/dhcp/tests/libdhcp_unittest.cc

@@ -35,7 +35,7 @@ public:
 
 TEST_F(LibDhcpTest, packOptions6) {
     boost::shared_array<uint8_t> buf(new uint8_t[512]);
-    isc::dhcp::Option::Option6Lst opts; // list of options
+    isc::dhcp::Option::Option6Collection opts; // list of options
 
     // generate content for options
     for (int i=0;i<64;i++) {
@@ -84,7 +84,7 @@ TEST_F(LibDhcpTest, unpackOptions6) {
     // More advanced uses are validated in tests dedicated for
     // specific derived classes.
 
-    isc::dhcp::Option::Option6Lst options; // list of options
+    isc::dhcp::Option::Option6Collection options; // list of options
 
     // we can't use packed directly, as shared_array would try to
     // free it eventually
@@ -99,7 +99,7 @@ TEST_F(LibDhcpTest, unpackOptions6) {
     EXPECT_EQ(35, offset); // parsed first 35 bytes (offset 0..34)
     EXPECT_EQ(options.size(), 5); // there should be 5 options
 
-    isc::dhcp::Option::Option6Lst::const_iterator x = options.find(12);
+    isc::dhcp::Option::Option6Collection::const_iterator x = options.find(12);
     ASSERT_NE(x, options.end()); // option 1 should exist
     EXPECT_EQ(12, x->second->getType());  // this should be option 12
     ASSERT_EQ(9, x->second->len()); // it should be of length 9

+ 4 - 4
src/lib/dhcp/tests/option6_addrlst_unittest.cc

@@ -108,7 +108,7 @@ TEST_F(Option6AddrLstTest, basic) {
 
     EXPECT_EQ(D6O_NAME_SERVERS, opt1->getType());
     EXPECT_EQ(20, opt1->len());
-    Option6AddrLst::AddrsContainer addrs = opt1->getAddresses();
+    Option6AddrLst::AddressContainer addrs = opt1->getAddresses();
     ASSERT_EQ(1, addrs.size());
     IOAddress addr = addrs[0];
     EXPECT_EQ("2001:db8:1::dead:beef", addr.toText());
@@ -173,7 +173,7 @@ TEST_F(Option6AddrLstTest, constructors) {
                                                 IOAddress("::1"));
      EXPECT_EQ(1234, opt1->getType());
 
-     Option6AddrLst::AddrsContainer addrs = opt1->getAddresses();
+     Option6AddrLst::AddressContainer addrs = opt1->getAddresses();
      ASSERT_EQ(1, addrs.size() );
      EXPECT_EQ("::1", addrs[0].toText());
 
@@ -184,7 +184,7 @@ TEST_F(Option6AddrLstTest, constructors) {
      Option6AddrLst * opt2 = new Option6AddrLst(5678,
                                                 addrs);
 
-     Option6AddrLst::AddrsContainer check = opt2->getAddresses();
+     Option6AddrLst::AddressContainer check = opt2->getAddresses();
      ASSERT_EQ(2, check.size() );
      EXPECT_EQ("fe80::1234", check[0].toText());
      EXPECT_EQ("2001:db8:1::baca", check[1].toText());
@@ -198,7 +198,7 @@ TEST_F(Option6AddrLstTest, setAddress) {
                                                 IOAddress("::1"));
     opt1->setAddress(IOAddress("::2"));
 
-    Option6AddrLst::AddrsContainer addrs = opt1->getAddresses();
+    Option6AddrLst::AddressContainer addrs = opt1->getAddresses();
     ASSERT_EQ(1, addrs.size() );
     EXPECT_EQ("::2", addrs[0].toText());