From: Marcin Siodelski Date: Thu, 12 Mar 2015 11:01:16 +0000 (+0100) Subject: [3736] Removed a bunch of unused functions. X-Git-Tag: trac3764_base~14^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ed885b735fafa55ce6d2b2009f19dbcc8c69320;p=thirdparty%2Fkea.git [3736] Removed a bunch of unused functions. --- diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index beadeda68e..47909f87c5 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -1960,12 +1960,6 @@ Dhcpv4Srv::unpackOptions(const OptionBuffer& buf, return (offset); } -void -Dhcpv4Srv::ifaceMgrSocket4ErrorHandler(const std::string& errmsg) { - // Log the reason for socket opening failure and return. - LOG_WARN(dhcp4_logger, DHCP4_OPEN_SOCKET_FAIL).arg(errmsg); -} - void Dhcpv4Srv::classifyPacket(const Pkt4Ptr& pkt) { boost::shared_ptr vendor_class = boost::dynamic_pointer_cast(pkt->getOption(DHO_VENDOR_CLASS_IDENTIFIER)); diff --git a/src/bin/dhcp4/dhcp4_srv.h b/src/bin/dhcp4/dhcp4_srv.h index 67da636913..6623aae572 100644 --- a/src/bin/dhcp4/dhcp4_srv.h +++ b/src/bin/dhcp4/dhcp4_srv.h @@ -676,15 +676,6 @@ private: /// @return Option that contains netmask information static OptionPtr getNetmaskOption(const Subnet4Ptr& subnet); - /// @brief Implements the error handler for socket open failure. - /// - /// This callback function is installed on the @c isc::dhcp::IfaceMgr - /// when IPv4 sockets are being open. When socket fails to open for - /// any reason, this function is called. It simply logs the error message. - /// - /// @param errmsg An error message containing a cause of the failure. - static void ifaceMgrSocket4ErrorHandler(const std::string& errmsg); - /// @brief Allocation Engine. /// Pointer to the allocation engine that we are currently using /// It must be a pointer, because we will support changing engines diff --git a/src/bin/dhcp4/json_config_parser.cc b/src/bin/dhcp4/json_config_parser.cc index 278d8bcf90..a3a28c0b1b 100644 --- a/src/bin/dhcp4/json_config_parser.cc +++ b/src/bin/dhcp4/json_config_parser.cc @@ -199,26 +199,6 @@ protected: return (parser); } - /// @brief Determines if the given option space name and code describe - /// a standard option for the DHCP4 server. - /// - /// @param option_space is the name of the option space to consider - /// @param code is the numeric option code to consider - /// @return returns true if the space and code are part of the server's - /// standard options. - bool isServerStdOption(std::string option_space, uint32_t code) { - return ((option_space.compare("dhcp4") == 0) - && LibDHCP::isStandardOption(Option::V4, code)); - } - - /// @brief Returns the option definition for a given option code from - /// the DHCP4 server's standard set of options. - /// @param code is the numeric option code of the desired option definition. - /// @return returns a pointer the option definition - OptionDefinitionPtr getServerStdOptionDefinition (uint32_t code) { - return (LibDHCP::getOptionDef(Option::V4, code)); - } - /// @brief Issues a DHCP4 server specific warning regarding duplicate subnet /// options. /// diff --git a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc index 6344774e04..bdceb0f354 100644 --- a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc @@ -1815,22 +1815,6 @@ public: return buffer4_receive_callout(callout_handle); } - /// Test callback that deletes MAC address - /// @param callout_handle handle passed by the hooks framework - /// @return always 0 - static int - buffer4_receive_delete_hwaddr(CalloutHandle& callout_handle) { - - Pkt4Ptr pkt; - callout_handle.getArgument("query4", pkt); - - pkt->data_[2] = 0; // offset 2 is hlen, let's set it to zero - memset(&pkt->data_[28], 0, Pkt4::MAX_CHADDR_LEN); // Clear CHADDR content - - // carry on as usual - return buffer4_receive_callout(callout_handle); - } - /// Test callback that sets skip flag /// @param callout_handle handle passed by the hooks framework /// @return always 0 diff --git a/src/bin/dhcp4/tests/fqdn_unittest.cc b/src/bin/dhcp4/tests/fqdn_unittest.cc index 3f3d78e571..d143b378b2 100644 --- a/src/bin/dhcp4/tests/fqdn_unittest.cc +++ b/src/bin/dhcp4/tests/fqdn_unittest.cc @@ -291,37 +291,6 @@ public: } - // Test that the client message holding an FQDN is processed and - // that the response packet is as expected. - void testProcessMessageWithFqdn(const uint8_t msg_type, - const std::string& hostname) { - Pkt4Ptr req = generatePktWithFqdn(msg_type, Option4ClientFqdn::FLAG_S | - Option4ClientFqdn::FLAG_E, hostname, - Option4ClientFqdn::FULL, true); - Pkt4Ptr reply; - if (msg_type == DHCPDISCOVER) { - ASSERT_NO_THROW(reply = srv_->processDiscover(req)); - - } else if (msg_type == DHCPREQUEST) { - ASSERT_NO_THROW(reply = srv_->processRequest(req)); - - } else if (msg_type == DHCPRELEASE) { - ASSERT_NO_THROW(srv_->processRelease(req)); - return; - - } else { - return; - } - - if (msg_type == DHCPDISCOVER) { - checkResponse(reply, DHCPOFFER, 1234); - - } else { - checkResponse(reply, DHCPACK, 1234); - } - - } - // Verify that NameChangeRequest holds valid values. void verifyNameChangeRequest(const isc::dhcp_ddns::NameChangeType type, const bool reverse, const bool forward, diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 3483808e45..45481a237e 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -2582,12 +2582,6 @@ Dhcpv6Srv::unpackOptions(const OptionBuffer& buf, return (offset); } -void -Dhcpv6Srv::ifaceMgrSocket6ErrorHandler(const std::string& errmsg) { - // Log the reason for socket opening failure and return. - LOG_WARN(dhcp6_logger, DHCP6_OPEN_SOCKET_FAIL).arg(errmsg); -} - void Dhcpv6Srv::classifyPacket(const Pkt6Ptr& pkt) { OptionVendorClassPtr vclass = boost::dynamic_pointer_cast< OptionVendorClass>(pkt->getOption(D6O_VENDOR_CLASS)); diff --git a/src/bin/dhcp6/dhcp6_srv.h b/src/bin/dhcp6/dhcp6_srv.h index 2f294de5bd..fd90aea6d4 100644 --- a/src/bin/dhcp6/dhcp6_srv.h +++ b/src/bin/dhcp6/dhcp6_srv.h @@ -616,15 +616,6 @@ protected: private: - /// @brief Implements the error handler for socket open failure. - /// - /// This callback function is installed on the @c isc::dhcp::IfaceMgr - /// when IPv6 sockets are being open. When socket fails to open for - /// any reason, this function is called. It simply logs the error message. - /// - /// @param errmsg An error message containing a cause of the failure. - static void ifaceMgrSocket6ErrorHandler(const std::string& errmsg); - /// @brief Generate FQDN to be sent to a client if none exists. /// /// This function is meant to be called by the functions which process diff --git a/src/bin/dhcp6/json_config_parser.cc b/src/bin/dhcp6/json_config_parser.cc index 708a45c944..b170b534b1 100644 --- a/src/bin/dhcp6/json_config_parser.cc +++ b/src/bin/dhcp6/json_config_parser.cc @@ -408,27 +408,6 @@ protected: return (parser); } - - /// @brief Determines if the given option space name and code describe - /// a standard option for the DHCP6 server. - /// - /// @param option_space is the name of the option space to consider - /// @param code is the numeric option code to consider - /// @return returns true if the space and code are part of the server's - /// standard options. - bool isServerStdOption(std::string option_space, uint32_t code) { - return ((option_space.compare("dhcp6") == 0) - && LibDHCP::isStandardOption(Option::V6, code)); - } - - /// @brief Returns the option definition for a given option code from - /// the DHCP6 server's standard set of options. - /// @param code is the numeric option code of the desired option definition. - /// @return returns a pointer the option definition - OptionDefinitionPtr getServerStdOptionDefinition (uint32_t code) { - return (LibDHCP::getOptionDef(Option::V6, code)); - } - /// @brief Issues a DHCP6 server specific warning regarding duplicate subnet /// options. /// diff --git a/src/lib/dhcp/iface_mgr.h b/src/lib/dhcp/iface_mgr.h index 2627468d8b..74d66f3e15 100644 --- a/src/lib/dhcp/iface_mgr.h +++ b/src/lib/dhcp/iface_mgr.h @@ -1132,23 +1132,6 @@ protected: /// Control-buffer, used in transmission and reception. boost::scoped_array control_buf_; - /// @brief A wrapper for OS-specific operations before sending IPv4 packet - /// - /// @param m message header (will be later used for sendmsg() call) - /// @param control_buf buffer to be used during transmission - /// @param control_buf_len buffer length - /// @param pkt packet to be sent - void os_send4(struct msghdr& m, boost::scoped_array& control_buf, - size_t control_buf_len, const Pkt4Ptr& pkt); - - /// @brief OS-specific operations during IPv4 packet reception - /// - /// @param m message header (was used during recvmsg() call) - /// @param pkt packet received (some fields will be set here) - /// - /// @return true if successful, false otherwise - bool os_receive4(struct msghdr& m, Pkt4Ptr& pkt); - private: /// @brief Identifies local network address to be used to /// connect to remote address. diff --git a/src/lib/dhcp/iface_mgr_bsd.cc b/src/lib/dhcp/iface_mgr_bsd.cc index 35cd503555..10b7e3c8bb 100644 --- a/src/lib/dhcp/iface_mgr_bsd.cc +++ b/src/lib/dhcp/iface_mgr_bsd.cc @@ -129,21 +129,6 @@ void Iface::setFlags(uint64_t flags) { flag_broadcast_ = flags & IFF_BROADCAST; } -void IfaceMgr::os_send4(struct msghdr& /*m*/, - boost::scoped_array& /*control_buf*/, - size_t /*control_buf_len*/, - const Pkt4Ptr& /*pkt*/) { - // @todo: Are there any specific actions required before sending IPv4 packet - // on BSDs? See iface_mgr_linux.cc for working Linux implementation. -} - -bool IfaceMgr::os_receive4(struct msghdr& /*m*/, Pkt4Ptr& /*pkt*/) { - // @todo: Are there any specific actions required before receiving IPv4 packet - // on BSDs? See iface_mgr_linux.cc for working Linux implementation. - - return (true); // pretend that we have everything set up for reception. -} - void IfaceMgr::setMatchingPacketFilter(const bool direct_response_desired) { // If direct response is desired we have to use BPF. If the direct diff --git a/src/lib/dhcp/iface_mgr_linux.cc b/src/lib/dhcp/iface_mgr_linux.cc index b4b81c80f9..783c675bee 100644 --- a/src/lib/dhcp/iface_mgr_linux.cc +++ b/src/lib/dhcp/iface_mgr_linux.cc @@ -524,16 +524,6 @@ IfaceMgr::setMatchingPacketFilter(const bool direct_response_desired) { } } -void IfaceMgr::os_send4(struct msghdr&, boost::scoped_array&, - size_t, const Pkt4Ptr&) { - return; - -} - -bool IfaceMgr::os_receive4(struct msghdr&, Pkt4Ptr&) { - return (true); -} - bool IfaceMgr::openMulticastSocket(Iface& iface, const isc::asiolink::IOAddress& addr, diff --git a/src/lib/dhcp/iface_mgr_sun.cc b/src/lib/dhcp/iface_mgr_sun.cc index ff30cfeb66..8a5c34e354 100644 --- a/src/lib/dhcp/iface_mgr_sun.cc +++ b/src/lib/dhcp/iface_mgr_sun.cc @@ -131,22 +131,6 @@ void Iface::setFlags(uint64_t flags) { flag_broadcast_ = flags & IFF_BROADCAST; } -void IfaceMgr::os_send4(struct msghdr& /*m*/, - boost::scoped_array& /*control_buf*/, - size_t /*control_buf_len*/, - const Pkt4Ptr& /*pkt*/) { - // @todo: Are there any specific actions required before sending IPv4 packet - // on Solaris based systems? See iface_mgr_linux.cc - // for working Linux implementation. -} - -bool IfaceMgr::os_receive4(struct msghdr& /*m*/, Pkt4Ptr& /*pkt*/) { - // @todo: Are there any specific actions required before receiving IPv4 packet - // on BSDs? See iface_mgr_linux.cc for working Linux implementation. - - return (true); // pretend that we have everything set up for reception. -} - void IfaceMgr::setMatchingPacketFilter(const bool /* direct_response_desired */) { // @todo Currently we ignore the preference to use direct traffic diff --git a/src/lib/dhcpsrv/parsers/dhcp_parsers.h b/src/lib/dhcpsrv/parsers/dhcp_parsers.h index 7fc0c07817..8d3b89be91 100644 --- a/src/lib/dhcpsrv/parsers/dhcp_parsers.h +++ b/src/lib/dhcpsrv/parsers/dhcp_parsers.h @@ -996,22 +996,6 @@ protected: virtual DhcpConfigParser* createSubnetConfigParser( const std::string& config_id) = 0; - /// @brief Determines if the given option space name and code describe - /// a standard option for the server. - /// - /// @param option_space is the name of the option space to consider - /// @param code is the numeric option code to consider - /// @return returns true if the space and code are part of the server's - /// standard options. - virtual bool isServerStdOption(std::string option_space, uint32_t code) = 0; - - /// @brief Returns the option definition for a given option code from - /// the server's standard set of options. - /// @param code is the numeric option code of the desired option definition. - /// @return returns a pointer the option definition - virtual OptionDefinitionPtr getServerStdOptionDefinition ( - uint32_t code) = 0; - /// @brief Issues a server specific warning regarding duplicate subnet /// options. /// diff --git a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc index 3a1ba1defb..93fea40b05 100644 --- a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc +++ b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc @@ -62,14 +62,6 @@ public: virtual ~D2ClientMgrTest(){ } - /// @brief Updates the D2ClientMgr's configuration to DDNS disabled. - void disableDdns() { - D2ClientConfigPtr new_cfg; - ASSERT_NO_THROW(new_cfg.reset(new D2ClientConfig())); - ASSERT_NO_THROW(setD2ClientConfig(new_cfg)); - ASSERT_FALSE(ddnsEnabled()); - } - /// @brief Updates the D2ClientMgr's configuration to DDNS enabled. /// /// @param server_address IP address of kea-dhcp-ddns. diff --git a/src/lib/log/tests/logger_manager_unittest.cc b/src/lib/log/tests/logger_manager_unittest.cc index 1b6e2da965..660f6fd40b 100644 --- a/src/lib/log/tests/logger_manager_unittest.cc +++ b/src/lib/log/tests/logger_manager_unittest.cc @@ -64,7 +64,7 @@ class SpecificationForFileLogger { public: // Constructor - allocate file and create the specification object - SpecificationForFileLogger() : spec_(), name_(createTempFileName()), + SpecificationForFileLogger() : spec_(), name_(createTempFilename()), logname_("filelogger") { // Set the output to a temporary file. diff --git a/src/lib/util/signal_set.cc b/src/lib/util/signal_set.cc index 76229d61fa..e863a6182c 100644 --- a/src/lib/util/signal_set.cc +++ b/src/lib/util/signal_set.cc @@ -184,6 +184,11 @@ SignalSet::add(const int sig) { } } +void +SignalSet::block() const { + maskSignals(SIG_BLOCK); +} + void SignalSet::clear() { // Iterate over a copy of the registered signal set because the @@ -297,6 +302,12 @@ SignalSet::remove(const int sig) { } } +void +SignalSet::unblock() const { + maskSignals(SIG_UNBLOCK); +} + + void SignalSet::setOnReceiptHandler(BoolSignalHandler handler) { onreceipt_handler_ = handler; diff --git a/src/lib/util/signal_set.h b/src/lib/util/signal_set.h index 816a1a638f..bba826cc75 100644 --- a/src/lib/util/signal_set.h +++ b/src/lib/util/signal_set.h @@ -197,9 +197,7 @@ private: /// /// This function blocks the signals in a set to prevent race condition /// between the signal handler and the new signal coming in. - void block() const { - maskSignals(SIG_BLOCK); - } + void block() const; /// @brief Removes the signal from the set. /// @@ -235,9 +233,7 @@ private: /// @brief Unblocks signals in the set. /// /// This function unblocks the signals in a set. - void unblock() const { - maskSignals(SIG_UNBLOCK); - } + void unblock() const; /// @brief Stores the set of signals registered in this signal set. std::set local_signals_;