From: Marcin Siodelski Date: Fri, 8 Jun 2012 10:09:02 +0000 (+0200) Subject: [1955] Removed redundant constructors, used default values instead. X-Git-Tag: trac2351_base~226^2~58^2~6^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=652738d33dd4a62c676b3bcb26996d646253191c;p=thirdparty%2Fkea.git [1955] Removed redundant constructors, used default values instead. --- diff --git a/tests/tools/perfdhcp/perf_pkt4.cc b/tests/tools/perfdhcp/perf_pkt4.cc index 072aaeeb30..6d13eea968 100644 --- a/tests/tools/perfdhcp/perf_pkt4.cc +++ b/tests/tools/perfdhcp/perf_pkt4.cc @@ -25,11 +25,6 @@ using namespace dhcp; namespace isc { namespace perfdhcp { -PerfPkt4::PerfPkt4(const uint8_t* buf, size_t len) : - Pkt4(buf, len), - transid_offset_(1) { -} - PerfPkt4::PerfPkt4(const uint8_t* buf, size_t len, size_t transid_offset, @@ -39,11 +34,6 @@ PerfPkt4::PerfPkt4(const uint8_t* buf, transid_ = transid; } -PerfPkt4::PerfPkt4(const uint8_t* buf, size_t len, size_t transid_offset) : - Pkt4(buf, len), - transid_offset_(transid_offset) { -} - bool PerfPkt4::rawPack() { return (PktTransform::pack(dhcp::Option::V4, diff --git a/tests/tools/perfdhcp/perf_pkt4.h b/tests/tools/perfdhcp/perf_pkt4.h index ec12f457d2..f7b918540b 100644 --- a/tests/tools/perfdhcp/perf_pkt4.h +++ b/tests/tools/perfdhcp/perf_pkt4.h @@ -50,60 +50,26 @@ public: /// Localized option pointer type. typedef boost::shared_ptr LocalizedOptionPtr; - /// \brief Constructor, used for outgoing and incoming messages + /// \brief Constructor, used to create messages from packet + /// template files. /// - /// This constructor initializes the transaction ID and - /// transaction id offset of the packet with default - /// values. - /// - /// \param buf buffer holding contents of the message. - /// \param len length of the data in the buffer. - PerfPkt4(const uint8_t* buf, size_t len); - - /// \brief Constructor, used for outgoing DHCP messages. - /// - /// Creates new DHCPv4 message using the provided buffer. The - /// transaction ID and its offset are specified via this - /// constructor. The transaction ID is stored in the outgoing message - /// when the client class calls \ref PerfPkt4::rawPack. - /// - /// \note This constructor should be used only for outgoing - /// messages that are created from template files. + /// Creates a new DHCPv4 message using the provided buffer. + /// The transaction ID and its offset are specified via this + /// constructor. The transaction ID is stored in outgoing message + /// when client class calls \ref PerfPkt4::rawPack. Transaction id + /// offset value is used for incoming and outgoing messages to + /// identify transaction ID field's position in incoming and outgoing + /// messages. /// /// \param buf buffer holding contents of the message (this can /// be directly read from template file). /// \param len length of the data in the buffer. - /// \param transid_offset transaction id offset in outgoing message. - /// \param transid transaction id to be stored in outgoing message. - PerfPkt4(const uint8_t* buf, - size_t len, - size_t transid_offset, - uint32_t transid); - - /// Constructor, used for incoming DHCP messages. - /// - /// Creates new DHCPv4 message using the provided buffer. - /// The client class may indicate which options are to be read - /// from the buffer. Such options should be added to the - /// options collection using \ref dhcp::Pkt4::addOption: these - /// options should be of \ref LocalizedOption class. - /// - /// The transaction ID offset points to the location where the - /// transaction ID field is stored. The transaction ID will - /// be read from this location when \ref PerfPkt4::rawUnpack is - /// called. The transid_ class member will be updated accordingly. - /// - /// \note Use this constructor only in the case where you want to create - /// an incoming DHCPv4 object from the raw buffer - /// and you know the options offsets. The options offsets are - /// specified on the perfdhcp command line by the user. - /// - /// \param buf pointer to a buffer of received packet content. - /// \param len size of buffer of packet content. /// \param transid_offset transaction id offset in a message. + /// \param transid transaction id to be stored in outgoing message. PerfPkt4(const uint8_t* buf, size_t len, - size_t transid_offset); + size_t transid_offset = 1, + uint32_t transid = 0); /// \brief Returns transaction id offset in packet buffer /// diff --git a/tests/tools/perfdhcp/perf_pkt6.cc b/tests/tools/perfdhcp/perf_pkt6.cc index 17dbf3a20a..6d2d686cbc 100644 --- a/tests/tools/perfdhcp/perf_pkt6.cc +++ b/tests/tools/perfdhcp/perf_pkt6.cc @@ -27,11 +27,6 @@ using namespace dhcp; namespace isc { namespace perfdhcp { -PerfPkt6::PerfPkt6(const uint8_t* buf, size_t len) : - Pkt6(buf, len), - transid_offset_(1) { -} - PerfPkt6::PerfPkt6(const uint8_t* buf, size_t len, size_t transid_offset, @@ -41,13 +36,6 @@ PerfPkt6::PerfPkt6(const uint8_t* buf, transid_ = transid; } -PerfPkt6::PerfPkt6(const uint8_t* buf, - size_t len, - size_t transid_offset) : - Pkt6(buf, len, Pkt6::UDP), - transid_offset_(transid_offset) { -} - bool PerfPkt6::rawPack() { return (PktTransform::pack(dhcp::Option::V6, diff --git a/tests/tools/perfdhcp/perf_pkt6.h b/tests/tools/perfdhcp/perf_pkt6.h index 8990f34ca6..8a814b5b17 100644 --- a/tests/tools/perfdhcp/perf_pkt6.h +++ b/tests/tools/perfdhcp/perf_pkt6.h @@ -50,60 +50,26 @@ public: /// Localized option pointer type. typedef boost::shared_ptr LocalizedOptionPtr; - /// \brief Constructor, used for outgoing and incoming messages - /// - /// This constructor initializes the transaction ID and the - /// transaction ID offset of the packet with default - /// values. - /// - /// \param buf buffer holding contents of the message. - /// \param len length of the data in the buffer. - PerfPkt6(const uint8_t* buf, size_t len); - - /// \brief Constructor, used for outgoing DHCP messages. + /// \brief Constructor, used to create messages from packet + /// template files. /// /// Creates a new DHCPv6 message using the provided buffer. /// The transaction ID and its offset are specified via this /// constructor. The transaction ID is stored in outgoing message - /// when client class calls \ref PerfPkt6::rawPack. - /// - /// \note This constructor should be used only for outgoing - /// messages that are created from template files. + /// when client class calls \ref PerfPkt6::rawPack. Transaction id + /// offset value is used for incoming and outgoing messages to + /// identify transaction ID field's position in incoming and outgoing + /// messages. /// /// \param buf buffer holding contents of the message (this can /// be directly read from template file). /// \param len length of the data in the buffer. - /// \param transid_offset transaction id offset in outgoing message. - /// \param transid transaction id to be stored in outgoing message. - PerfPkt6(const uint8_t* buf, - size_t len, - size_t transid_offset, - uint32_t transid); - - /// Constructor, used for incoming DHCP messages. - /// - /// Creates a new DHCPv6 message using the provided buffer. The - /// client class may indicate which options are to be read - /// from the buffer. Such options should be added to the - /// options collection using \ref dhcp::Pkt4::addOption. The - /// options should be of \ref LocalizedOption class. - /// - /// The transaction ID offset points to location where the - /// transaction ID field is stored. The transaction ID will - /// be read from this location when \ref PerfPkt4::rawUnpack is - /// called. The transid_ class member will be updated accordingly. - /// - /// \note Use this constructor only in the case where you want to create - /// incoming DHCPv4 object from the raw buffer - /// and you know the options offsets. Options offsets are - /// specified on the perfdhcp command line by the user. - /// - /// \param buf pointer to a buffer of received packet content. - /// \param len size of buffer of packet content. /// \param transid_offset transaction id offset in a message. + /// \param transid transaction id to be stored in outgoing message. PerfPkt6(const uint8_t* buf, size_t len, - size_t transid_offset); + size_t transid_offset = 1, + uint32_t transid = 0); /// \brief Returns transaction id offset in packet buffer ///