]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4497] Documented Option::clone() in all option classes.
authorMarcin Siodelski <marcin@isc.org>
Thu, 30 Jun 2016 11:32:32 +0000 (13:32 +0200)
committerMarcin Siodelski <marcin@isc.org>
Fri, 8 Jul 2016 05:50:19 +0000 (07:50 +0200)
Also udated copyright dates where applicable.

30 files changed:
src/bin/perfdhcp/localized_option.h
src/lib/dhcp/option.cc
src/lib/dhcp/option.h
src/lib/dhcp/option4_addrlst.cc
src/lib/dhcp/option4_addrlst.h
src/lib/dhcp/option4_client_fqdn.cc
src/lib/dhcp/option4_client_fqdn.h
src/lib/dhcp/option6_addrlst.cc
src/lib/dhcp/option6_addrlst.h
src/lib/dhcp/option6_client_fqdn.cc
src/lib/dhcp/option6_client_fqdn.h
src/lib/dhcp/option6_ia.cc
src/lib/dhcp/option6_ia.h
src/lib/dhcp/option6_iaaddr.cc
src/lib/dhcp/option6_iaaddr.h
src/lib/dhcp/option6_iaprefix.cc
src/lib/dhcp/option6_iaprefix.h
src/lib/dhcp/option6_status_code.cc
src/lib/dhcp/option6_status_code.h
src/lib/dhcp/option_custom.cc
src/lib/dhcp/option_custom.h
src/lib/dhcp/option_int.h
src/lib/dhcp/option_int_array.h
src/lib/dhcp/option_opaque_data_tuples.h
src/lib/dhcp/option_string.cc
src/lib/dhcp/option_string.h
src/lib/dhcp/option_vendor.cc
src/lib/dhcp/option_vendor.h
src/lib/dhcp/option_vendor_class.cc
src/lib/dhcp/option_vendor_class.h

index 5c7f89fde0530ac0478c31df71df42a1ea44c73c..289ff7dcdc78f003027a004a87e9f703c1150f9d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index d3bf8ad408d19e1fda66e26ae97bae88796fb2f5..82e3593cfb24aeebe495503728a8853082679e2d 100644 (file)
@@ -74,8 +74,7 @@ Option::operator=(const Option& rhs) {
 
 OptionPtr
 Option::clone() const {
-    OptionPtr option(new Option(*this));
-    return (option);
+    return (cloneInternal<Option>());
 }
 
 void
@@ -214,6 +213,8 @@ Option::getOptionsCopy(OptionCollection& options_copy) const {
         local_options.insert(std::make_pair(it->second->getType(),
                                             copy));
     }
+    // All options copied successfully, so assign them to the output
+    // parameter.
     options_copy.swap(local_options);
 }
 
index b5e385c5c66352b6b5045a14035427cdf16b96cd..fdc9fe917331dc4f757bf57515488cbc7567bcce 100644 (file)
@@ -144,10 +144,31 @@ public:
     Option(Universe u, uint16_t type, OptionBufferConstIter first,
            OptionBufferConstIter last);
 
-    Option(const Option& option);
+    /// @brief Copy constructor.
+    ///
+    /// This constructor makes a deep copy of the option and all of the
+    /// suboptions. It calls @ref getOptionsCopy to deep copy suboptions.
+    ///
+    /// @param source Option to be copied.
+    Option(const Option& source);
 
+    /// @brief Assignment operator.
+    ///
+    /// The assignment operator performs a deep copy of the option and
+    /// its suboptions. It calls @ref getOptionsCopy to deep copy
+    /// suboptions.
+    ///
+    /// @param rhs Option to be assigned.
     Option& operator=(const Option& rhs);
 
+    /// @brief Copies this option and returns a pointer to the copy.
+    ///
+    /// This function must be overriden in the derived classes to make
+    /// a copy of the derived type. The simplest way to do it is by
+    /// calling @ref copyInternal function with an appropriate template
+    /// parmater.
+    ///
+    /// @return Pointer to the copy of the option.
     virtual OptionPtr clone() const;
 
     /// @brief returns option universe (V4 or V6)
@@ -263,6 +284,11 @@ public:
         return (options_);
     }
 
+    /// @brief Performs deep copy of suboptions.
+    ///
+    /// This method calls @ref clone method to deep copy each option.
+    ///
+    /// @param [out] options_copy Container where copied options are stored.
     void getOptionsCopy(OptionCollection& options_copy) const;
 
     /// Attempts to delete first suboption of requested type
@@ -372,6 +398,15 @@ public:
 
 protected:
 
+    /// @brief Copies this option and returns a pointer to the copy.
+    ///
+    /// The deep copy of the option is performed by calling copy
+    /// constructor of the option of a given type. Derived classes call
+    /// this method in the implementations of @ref clone methods to
+    /// create a copy of the option of their type.
+    ///
+    /// @tparam OptionType Type of the option of which a clone should
+    /// be created.
     template<typename OptionType>
     OptionPtr cloneInternal() const {
         boost::shared_ptr<OptionType>
index 61bdc4f2f69d8ec9b16a2afe549d0a5dd7d2e742..478eb997f1e86c0875e3d80ff3ee4065f4c1156a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index e1448ce29d49a3dd751dab6f4b9ab5b1369948a9..24ff1288c39c82687a6f513319b59b1f64483c31 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -80,6 +80,7 @@ public:
     Option4AddrLst(uint8_t type, OptionBufferConstIter first,
                    OptionBufferConstIter last);
 
+    /// @brief Copies this option and returns a pointer to the copy.
     virtual OptionPtr clone() const;
 
     /// @brief Writes option in a wire-format to a buffer.
index e5057076a723e0e34fbb6f2fb48ec149fda02c0f..1984e8b7e3f4d62030357a3eb6c90e57bd7b1a5b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index 5656112e693b8f16057eb3781849af7c60cfadf1..43767a64bc00fdc828a8018ef6e3fd38ba12ca48 100644 (file)
@@ -219,6 +219,7 @@ public:
     /// @brief Copy constructor
     Option4ClientFqdn(const Option4ClientFqdn& source);
 
+    /// @brief Copies this option and returns a pointer to the copy.
     virtual OptionPtr clone() const;
 
     /// @brief Destructor
index ab505c4da745f0fd8bab255ca52b5b52fbc1f944..ba4cc0de39ab5a92b112c53394c8c8d79923c6e0 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index 217b76ffa045d5deb68a0980763ea026cbecf2e7..67f3b6108da8519debb2a8e424c66cce5115c8cb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index 700146a98c57104231b1d5f61003c9e6c927b843..e1c7c565c7e3e115fa70d6c1ef2d24fd3d58ea59 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index 35c55d15201c8af238c7acdeb895da7cbd78c3d4..58adfbd52e8db41aa25b4457ddc472bd0a041895 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -140,6 +140,7 @@ public:
     /// @brief Copy constructor
     Option6ClientFqdn(const Option6ClientFqdn& source);
 
+    /// @brief Copies this option and returns a pointer to the copy.
     virtual OptionPtr clone() const;
 
     /// @brief Destructor
index 887ec1e64545bccc90afed37a8c83c92498a1760..1c11062b8c5f76c3c444e7c876cbd1bb72aabf44 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index b29c77727fdf96585c7cf48d16a84d1412fdbb44..232d15d6fc51bdedce1d9abd8a9c309eb80189cf 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -39,6 +39,7 @@ public:
     Option6IA(uint16_t type, OptionBuffer::const_iterator begin,
               OptionBuffer::const_iterator end);
 
+    /// @brief Copies this option and returns a pointer to the copy.
     virtual OptionPtr clone() const;
 
     /// Writes option in wire-format to buf, returns pointer to first unused
index 477be9e60357ea56e22a35385cf288bfca36eeb8..a392450ddc337af0e5705a15ad5066b6bc222bfa 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index 47092699655082661dff8842ddf73a36879ef814..8d3cda060fd9b2da7e82e04a9e5921f3508005a7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -46,6 +46,7 @@ public:
     Option6IAAddr(uint32_t type, OptionBuffer::const_iterator begin,
                   OptionBuffer::const_iterator end);
 
+    /// @brief Copies this option and returns a pointer to the copy.
     virtual OptionPtr clone() const;
 
     /// @brief Writes option in wire-format.
index 95dacd6127df16036984438ed71a7809bc4c4cec..e8e9cc82fb1f42dd187b73df162ebb9dda2d3a61 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index c9be8ee68150438113013396b99ab7b823ecc3e1..e3a9b57ef547ebb343f2052616501b4956bec8e6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -74,6 +74,7 @@ public:
     Option6IAPrefix(uint32_t type, OptionBuffer::const_iterator begin,
                     OptionBuffer::const_iterator end);
 
+    /// @brief Copies this option and returns a pointer to the copy.
     virtual OptionPtr clone() const;
 
     /// @brief Writes option in wire-format.
index f0de03bab43d2611f0a8234b77979e45298e45f0..58a56ebc7bcd6205f87b385a0531f7e0d856578d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index 3b012186f0e7247c7c6f0dc0f3fa97015c7e1693..148de7ee36f27b0bf9d4add774d3e66cb64c263c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -37,6 +37,7 @@ public:
     /// @param end Iterator to end of option data (first byte after option end).
     Option6StatusCode(OptionBufferConstIter begin, OptionBufferConstIter end);
 
+    /// @brief Copies this option and returns a pointer to the copy.
     virtual OptionPtr clone() const;
 
     /// @brief Writes option in wire-format.
index e8680834295b403a5aa26b7a450ccb555405e85e..d966bb9b3875372558029839c12e8c2c039da8c4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index 28eb35dc48d7ad53158f2e56d4d62942b7391a13..ae8009f9c14d7cc24945f7554b10da346db2e4fd 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -79,6 +79,7 @@ public:
     OptionCustom(const OptionDefinition& def, Universe u,
                  OptionBufferConstIter first, OptionBufferConstIter last);
 
+    /// @brief Copies this option and returns a pointer to the copy.
     virtual OptionPtr clone() const;
 
     /// @brief Create new buffer and set its value as an IP address.
index fd5d233320a3667dfd420d39533360785ea28968..1a1305084523aa33408c939eb6ee786d885c0492 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -48,6 +48,7 @@ template<typename T>
 class OptionInt: public Option {
 private:
 
+    /// @brief Pointer to the option object for a specified type T.
     typedef boost::shared_ptr<OptionInt<T> > OptionIntTypePtr;
 
 public:
@@ -93,6 +94,7 @@ public:
         unpack(begin, end);
     }
 
+    /// @brief Copies this option and returns a pointer to the copy.
     virtual OptionPtr clone() const {
         return (cloneInternal<OptionInt<T> >());
     }
index d29bc89bf3ad70268871e7354745b0047ff25627..ef379bb5c019928a896ceee516ba69448c129745 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -56,6 +56,7 @@ template<typename T>
 class OptionIntArray: public Option {
 private:
 
+    /// @brief Pointer to the option type for the specified T.
     typedef boost::shared_ptr<OptionIntArray<T> > OptionIntArrayTypePtr;
 
 public:
@@ -120,6 +121,7 @@ public:
         unpack(begin, end);
     }
 
+    /// @brief Copies this option and returns a pointer to the copy.
     virtual OptionPtr clone() const {
         return (cloneInternal<OptionIntArray<T> >());
     }
index 64823ee8bf0853879b779e41bddb6bfd7ebc135f..69d4e1cd2572238c2b2384df892111e37fc93e42 100644 (file)
@@ -62,6 +62,7 @@ public:
                            OptionBufferConstIter begin,
                            OptionBufferConstIter end);
 
+    /// @brief Copies this option and returns a pointer to the copy.
     OptionPtr clone() const;
 
     /// @brief Renders option into the buffer in the wire format.
index 553f84fee53335dbe27fb67b570e9cd9fd2476ab..ddf3052025946730dcb648c5810b1de3e8ec90c3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index 701c3705074b7e13845c19d353a4d90fafaefa81..dfc907f77a8fe88d171c58fffbe9955882814f54 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -56,6 +56,7 @@ public:
     OptionString(const Option::Universe u, const uint16_t type,
                  OptionBufferConstIter begin, OptionBufferConstIter end);
 
+    /// @brief Copies this option and returns a pointer to the copy.
     OptionPtr clone() const;
 
     /// @brief Returns length of the whole option, including header.
index 25fed0047e1ef817592323c1255b267fc2522668..7b0220c1c5e5a59ca3edd9464369cc540eeb7375 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index 7dddf42e0054b7072bcfa2f203376bcaaceea92f..f8a55a54a7d256bfc0304d0771fd9dd5c9251a16 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -50,6 +50,7 @@ public:
     OptionVendor(Option::Universe u, OptionBufferConstIter begin,
                  OptionBufferConstIter end);
 
+    /// @brief Copies this option and returns a pointer to the copy.
     OptionPtr clone() const;
 
     /// @brief Writes option in wire-format to buf, returns pointer to first
index 3e1ec161d1015574011fbb6e249ed99e3325404b..e6ae79c7548ca9425560e3a716dcca1da0be75fb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
index b00f9f189cc19a63af1414db3112a0fe0460176d..14a29a3030f1782554b703d6766990c8922b6cc9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -69,6 +69,7 @@ public:
     OptionVendorClass(Option::Universe u, OptionBufferConstIter begin,
                       OptionBufferConstIter end);
 
+    /// @brief Copies this option and returns a pointer to the copy.
     OptionPtr clone() const;
 
     /// @brief Renders option into the buffer in the wire format.