Browse Source

[4106] Renamed DHCPv4 and DHCPv6 specific IPC classes.

Marcin Siodelski 9 years ago
parent
commit
05616834ef

+ 1 - 1
src/bin/dhcp4/ctrl_dhcp4_srv.cc

@@ -188,7 +188,7 @@ ControlledDhcpv4Srv::processConfig(isc::data::ConstElementPtr config) {
 
 
     // Setup DHCPv4-over-DHCPv6 IPC
     // Setup DHCPv4-over-DHCPv6 IPC
     try {
     try {
-        Dhcp4o6Ipc::instance().open();
+        Dhcp4to6Ipc::instance().open();
     } catch (const std::exception& ex) {
     } catch (const std::exception& ex) {
         std::ostringstream err;
         std::ostringstream err;
         err << "error starting DHCPv4-over-DHCPv6 IPC "
         err << "error starting DHCPv4-over-DHCPv6 IPC "

+ 9 - 9
src/bin/dhcp4/dhcp4_dhcp4o6_ipc.cc

@@ -24,15 +24,15 @@ using namespace std;
 namespace isc {
 namespace isc {
 namespace dhcp {
 namespace dhcp {
 
 
-Dhcp4o6Ipc::Dhcp4o6Ipc() : Dhcp4o6IpcBase() {
+Dhcp4to6Ipc::Dhcp4to6Ipc() : Dhcp4o6IpcBase() {
 }
 }
 
 
-Dhcp4o6Ipc& Dhcp4o6Ipc::instance() {
-    static Dhcp4o6Ipc dhcp4o6_ipc;
-    return (dhcp4o6_ipc);
+Dhcp4to6Ipc& Dhcp4to6Ipc::instance() {
+    static Dhcp4to6Ipc dhcp4to6_ipc;
+    return (dhcp4to6_ipc);
 }
 }
 
 
-void Dhcp4o6Ipc::open() {
+void Dhcp4to6Ipc::open() {
     uint32_t port = CfgMgr::instance().getStagingCfg()->getDhcp4o6Port();
     uint32_t port = CfgMgr::instance().getStagingCfg()->getDhcp4o6Port();
     if (port == 0) {
     if (port == 0) {
         Dhcp4o6IpcBase::close();
         Dhcp4o6IpcBase::close();
@@ -42,12 +42,12 @@ void Dhcp4o6Ipc::open() {
     int old_fd = socket_fd_;
     int old_fd = socket_fd_;
     socket_fd_ = Dhcp4o6IpcBase::open(static_cast<uint16_t>(port), ENDPOINT_TYPE_V4);
     socket_fd_ = Dhcp4o6IpcBase::open(static_cast<uint16_t>(port), ENDPOINT_TYPE_V4);
     if ((old_fd == -1) && (socket_fd_ != old_fd)) {
     if ((old_fd == -1) && (socket_fd_ != old_fd)) {
-        IfaceMgr::instance().addExternalSocket(socket_fd_, Dhcp4o6Ipc::handler);
+        IfaceMgr::instance().addExternalSocket(socket_fd_, Dhcp4to6Ipc::handler);
     }
     }
 }
 }
 
 
-void Dhcp4o6Ipc::handler() {
-    Dhcp4o6Ipc& ipc = Dhcp4o6Ipc::instance();
+void Dhcp4to6Ipc::handler() {
+    Dhcp4to6Ipc& ipc = Dhcp4to6Ipc::instance();
 
 
     // Reset received message in case we return from this method before the
     // Reset received message in case we return from this method before the
     // received message pointer is updated.
     // received message pointer is updated.
@@ -80,7 +80,7 @@ void Dhcp4o6Ipc::handler() {
     ipc.received_.reset(new Pkt4o6(msg->getData(), pkt));
     ipc.received_.reset(new Pkt4o6(msg->getData(), pkt));
 }
 }
 
 
-Pkt4o6Ptr& Dhcp4o6Ipc::getReceived() {
+Pkt4o6Ptr& Dhcp4to6Ipc::getReceived() {
     return (received_);
     return (received_);
 }
 }
 
 

+ 5 - 5
src/bin/dhcp4/dhcp4_dhcp4o6_ipc.h

@@ -28,23 +28,23 @@ namespace isc {
 namespace dhcp {
 namespace dhcp {
 
 
 /// @brief Handles DHCPv4-over-DHCPv6 IPC on the DHCPv4 server side
 /// @brief Handles DHCPv4-over-DHCPv6 IPC on the DHCPv4 server side
-class Dhcp4o6Ipc : public Dhcp4o6IpcBase {
+class Dhcp4to6Ipc : public Dhcp4o6IpcBase {
 protected:
 protected:
     /// @brief Constructor
     /// @brief Constructor
     ///
     ///
     /// Default constructor
     /// Default constructor
-    Dhcp4o6Ipc();
+    Dhcp4to6Ipc();
 
 
     /// @brief Destructor.
     /// @brief Destructor.
-    virtual ~Dhcp4o6Ipc() { }
+    virtual ~Dhcp4to6Ipc() { }
 
 
 public:
 public:
     /// @brief Returns pointer to the sole instance of Dhcp4o6Ipc
     /// @brief Returns pointer to the sole instance of Dhcp4o6Ipc
     ///
     ///
-    /// Dhcp4o6Ipc is a singleton class
+    /// Dhcp4to6Ipc is a singleton class
     ///
     ///
     /// @return the only existing instance of DHCP4o6 IPC
     /// @return the only existing instance of DHCP4o6 IPC
-    static Dhcp4o6Ipc& instance();
+    static Dhcp4to6Ipc& instance();
 
 
     /// @brief Open communication socket
     /// @brief Open communication socket
     ///
     ///

+ 10 - 10
src/bin/dhcp4/tests/dhcp4_dhcp4o6_ipc_unittest.cc

@@ -38,14 +38,14 @@ const uint16_t TEST_PORT = 32000;
 typedef Dhcp4o6TestIpc TestIpc;
 typedef Dhcp4o6TestIpc TestIpc;
 
 
 /// @brief Test fixture class for DHCPv4 endpoint of DHCPv4o6 IPC.
 /// @brief Test fixture class for DHCPv4 endpoint of DHCPv4o6 IPC.
-class Dhcp4o6IpcTest : public ::testing::Test {
+class Dhcp4to6IpcTest : public ::testing::Test {
 public:
 public:
 
 
     /// @brief Constructor
     /// @brief Constructor
     ///
     ///
     /// Configures IPC to use a test port. It also provides a fake
     /// Configures IPC to use a test port. It also provides a fake
     /// configuration of interfaces.
     /// configuration of interfaces.
-    Dhcp4o6IpcTest()
+    Dhcp4to6IpcTest()
         : iface_mgr_test_config_(true) {
         : iface_mgr_test_config_(true) {
         configurePort(TEST_PORT);
         configurePort(TEST_PORT);
     }
     }
@@ -68,12 +68,12 @@ private:
 };
 };
 
 
 void
 void
-Dhcp4o6IpcTest::configurePort(const uint16_t port) {
+Dhcp4to6IpcTest::configurePort(const uint16_t port) {
     CfgMgr::instance().getStagingCfg()->setDhcp4o6Port(port);
     CfgMgr::instance().getStagingCfg()->setDhcp4o6Port(port);
 }
 }
 
 
 OptionPtr
 OptionPtr
-Dhcp4o6IpcTest::createDHCPv4MsgOption() const {
+Dhcp4to6IpcTest::createDHCPv4MsgOption() const {
     // Create the DHCPv4 message.
     // Create the DHCPv4 message.
     Pkt4Ptr pkt(new Pkt4(DHCPREQUEST, 1234));
     Pkt4Ptr pkt(new Pkt4(DHCPREQUEST, 1234));
     // Make a wire representation of the DHCPv4 message.
     // Make a wire representation of the DHCPv4 message.
@@ -89,9 +89,9 @@ Dhcp4o6IpcTest::createDHCPv4MsgOption() const {
 
 
 // This test verifies that the DHCPv4 endpoint of the DHCPv4o6 IPC can
 // This test verifies that the DHCPv4 endpoint of the DHCPv4o6 IPC can
 // receive messages.
 // receive messages.
-TEST_F(Dhcp4o6IpcTest, receive) {
+TEST_F(Dhcp4to6IpcTest, receive) {
     // Create instance of the IPC endpoint under test.
     // Create instance of the IPC endpoint under test.
-    Dhcp4o6Ipc& ipc = Dhcp4o6Ipc::instance();
+    Dhcp4to6Ipc& ipc = Dhcp4to6Ipc::instance();
     // Create instance of the IPC endpoint being used as a source of messages.
     // Create instance of the IPC endpoint being used as a source of messages.
     TestIpc src_ipc(TEST_PORT, TestIpc::ENDPOINT_TYPE_V6);
     TestIpc src_ipc(TEST_PORT, TestIpc::ENDPOINT_TYPE_V6);
 
 
@@ -121,9 +121,9 @@ TEST_F(Dhcp4o6IpcTest, receive) {
 
 
 // This test verifies that message with multiple DHCPv4 query options
 // This test verifies that message with multiple DHCPv4 query options
 // is rejected.
 // is rejected.
-TEST_F(Dhcp4o6IpcTest, receiveMultipleQueries) {
+TEST_F(Dhcp4to6IpcTest, receiveMultipleQueries) {
     // Create instance of the IPC endpoint under test.
     // Create instance of the IPC endpoint under test.
-    Dhcp4o6Ipc& ipc = Dhcp4o6Ipc::instance();
+    Dhcp4to6Ipc& ipc = Dhcp4to6Ipc::instance();
     // Create instance of the IPC endpoint being used as a source of messages.
     // Create instance of the IPC endpoint being used as a source of messages.
     TestIpc src_ipc(TEST_PORT, TestIpc::ENDPOINT_TYPE_V6);
     TestIpc src_ipc(TEST_PORT, TestIpc::ENDPOINT_TYPE_V6);
 
 
@@ -147,9 +147,9 @@ TEST_F(Dhcp4o6IpcTest, receiveMultipleQueries) {
 }
 }
 
 
 // This test verifies that message with no DHCPv4 query options is rejected.
 // This test verifies that message with no DHCPv4 query options is rejected.
-TEST_F(Dhcp4o6IpcTest, receiveNoQueries) {
+TEST_F(Dhcp4to6IpcTest, receiveNoQueries) {
     // Create instance of the IPC endpoint under test.
     // Create instance of the IPC endpoint under test.
-    Dhcp4o6Ipc& ipc = Dhcp4o6Ipc::instance();
+    Dhcp4to6Ipc& ipc = Dhcp4to6Ipc::instance();
     // Create instance of the IPC endpoint being used as a source of messages.
     // Create instance of the IPC endpoint being used as a source of messages.
     TestIpc src_ipc(TEST_PORT, TestIpc::ENDPOINT_TYPE_V6);
     TestIpc src_ipc(TEST_PORT, TestIpc::ENDPOINT_TYPE_V6);
 
 

+ 1 - 1
src/bin/dhcp6/ctrl_dhcp6_srv.cc

@@ -186,7 +186,7 @@ ControlledDhcpv6Srv::processConfig(isc::data::ConstElementPtr config) {
 
 
     // Setup DHCPv4-over-DHCPv6 IPC
     // Setup DHCPv4-over-DHCPv6 IPC
     try {
     try {
-        Dhcp4o6Ipc::instance().open();
+        Dhcp6to4Ipc::instance().open();
     } catch (const std::exception& ex) {
     } catch (const std::exception& ex) {
         std::ostringstream err;
         std::ostringstream err;
         err << "error starting DHCPv4-over-DHCPv6 IPC "
         err << "error starting DHCPv4-over-DHCPv6 IPC "

+ 9 - 8
src/bin/dhcp6/dhcp6_dhcp4o6_ipc.cc

@@ -12,6 +12,7 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 // PERFORMANCE OF THIS SOFTWARE.
 
 
+
 #include <config.h>
 #include <config.h>
 
 
 #include <util/buffer.h>
 #include <util/buffer.h>
@@ -24,14 +25,14 @@ using namespace std;
 namespace isc {
 namespace isc {
 namespace dhcp {
 namespace dhcp {
 
 
-Dhcp4o6Ipc::Dhcp4o6Ipc() : Dhcp4o6IpcBase() {}
+Dhcp6to4Ipc::Dhcp6to4Ipc() : Dhcp4o6IpcBase() {}
 
 
-Dhcp4o6Ipc& Dhcp4o6Ipc::instance() {
-    static Dhcp4o6Ipc dhcp4o6_ipc;
-    return (dhcp4o6_ipc);
+Dhcp6to4Ipc& Dhcp6to4Ipc::instance() {
+    static Dhcp6to4Ipc dhcp6to4_ipc;
+    return (dhcp6to4_ipc);
 }
 }
 
 
-void Dhcp4o6Ipc::open() {
+void Dhcp6to4Ipc::open() {
     uint32_t port = CfgMgr::instance().getStagingCfg()->getDhcp4o6Port();
     uint32_t port = CfgMgr::instance().getStagingCfg()->getDhcp4o6Port();
     if (port == 0) {
     if (port == 0) {
         Dhcp4o6IpcBase::close();
         Dhcp4o6IpcBase::close();
@@ -41,12 +42,12 @@ void Dhcp4o6Ipc::open() {
     int old_fd = socket_fd_;
     int old_fd = socket_fd_;
     socket_fd_ = Dhcp4o6IpcBase::open(static_cast<uint16_t>(port), ENDPOINT_TYPE_V6);
     socket_fd_ = Dhcp4o6IpcBase::open(static_cast<uint16_t>(port), ENDPOINT_TYPE_V6);
     if ((old_fd == -1) && (socket_fd_ != old_fd)) {
     if ((old_fd == -1) && (socket_fd_ != old_fd)) {
-        IfaceMgr::instance().addExternalSocket(socket_fd_, Dhcp4o6Ipc::handler);
+        IfaceMgr::instance().addExternalSocket(socket_fd_, Dhcp6to4Ipc::handler);
     }
     }
 }
 }
 
 
-void Dhcp4o6Ipc::handler() {
-    Dhcp4o6Ipc& ipc = Dhcp4o6Ipc::instance();
+void Dhcp6to4Ipc::handler() {
+    Dhcp6to4Ipc& ipc = Dhcp6to4Ipc::instance();
 
 
     // Receive message from IPC.
     // Receive message from IPC.
     Pkt6Ptr pkt = ipc.receive();
     Pkt6Ptr pkt = ipc.receive();

+ 4 - 4
src/bin/dhcp6/dhcp6_dhcp4o6_ipc.h

@@ -26,15 +26,15 @@ namespace isc {
 namespace dhcp {
 namespace dhcp {
 
 
 /// @brief Handles DHCPv4-over-DHCPv6 IPC on the DHCPv6 server side
 /// @brief Handles DHCPv4-over-DHCPv6 IPC on the DHCPv6 server side
-class Dhcp4o6Ipc : public Dhcp4o6IpcBase {
+class Dhcp6to4Ipc : public Dhcp4o6IpcBase {
 protected:
 protected:
     /// @brief Constructor
     /// @brief Constructor
     ///
     ///
     /// Default constructor
     /// Default constructor
-    Dhcp4o6Ipc();
+    Dhcp6to4Ipc();
 
 
     /// @brief Destructor.
     /// @brief Destructor.
-    virtual ~Dhcp4o6Ipc() { }
+    virtual ~Dhcp6to4Ipc() { }
 
 
 public:
 public:
     /// @brief Returns pointer to the sole instance of Dhcp4o6Ipc
     /// @brief Returns pointer to the sole instance of Dhcp4o6Ipc
@@ -42,7 +42,7 @@ public:
     /// Dhcp4o6Ipc is a singleton class
     /// Dhcp4o6Ipc is a singleton class
     ///
     ///
     /// @return the only existing instance of DHCP4o6 IPC
     /// @return the only existing instance of DHCP4o6 IPC
-    static Dhcp4o6Ipc& instance();
+    static Dhcp6to4Ipc& instance();
 
 
     /// @brief Open communication socket
     /// @brief Open communication socket
     ///
     ///

+ 1 - 1
src/bin/dhcp6/dhcp6_srv.cc

@@ -241,7 +241,7 @@ Dhcpv6Srv::~Dhcpv6Srv() {
     }
     }
 
 
     try {
     try {
-        Dhcp4o6Ipc::instance().close();
+        Dhcp6to4Ipc::instance().close();
     } catch(const std::exception& ex) {
     } catch(const std::exception& ex) {
         // Highly unlikely, but lets Report it but go on
         // Highly unlikely, but lets Report it but go on
         // LOG_ERROR(dhcp6_logger, DHCP6_SRV_DHCP4O6_ERROR).arg(ex.what());
         // LOG_ERROR(dhcp6_logger, DHCP6_SRV_DHCP4O6_ERROR).arg(ex.what());

+ 6 - 6
src/bin/dhcp6/tests/dhcp6_dhcp4o6_ipc_unittest.cc

@@ -39,14 +39,14 @@ const uint16_t TEST_PORT = 32000;
 typedef Dhcp4o6TestIpc TestIpc;
 typedef Dhcp4o6TestIpc TestIpc;
 
 
 /// @brief Test fixture class for DHCPv4 endpoint of DHCPv4o6 IPC.
 /// @brief Test fixture class for DHCPv4 endpoint of DHCPv4o6 IPC.
-class Dhcp4o6IpcTest : public ::testing::Test {
+class Dhcp6to4IpcTest : public ::testing::Test {
 public:
 public:
 
 
     /// @brief Constructor
     /// @brief Constructor
     ///
     ///
     /// Configures IPC to use a test port. It also provides a fake
     /// Configures IPC to use a test port. It also provides a fake
     /// configuration of interfaces and opens IPv6 sockets.
     /// configuration of interfaces and opens IPv6 sockets.
-    Dhcp4o6IpcTest()
+    Dhcp6to4IpcTest()
         : iface_mgr_test_config_(true) {
         : iface_mgr_test_config_(true) {
         IfaceMgr::instance().openSockets6();
         IfaceMgr::instance().openSockets6();
         configurePort(TEST_PORT);
         configurePort(TEST_PORT);
@@ -69,12 +69,12 @@ private:
 };
 };
 
 
 void
 void
-Dhcp4o6IpcTest::configurePort(const uint16_t port) {
+Dhcp6to4IpcTest::configurePort(const uint16_t port) {
     CfgMgr::instance().getStagingCfg()->setDhcp4o6Port(port);
     CfgMgr::instance().getStagingCfg()->setDhcp4o6Port(port);
 }
 }
 
 
 OptionPtr
 OptionPtr
-Dhcp4o6IpcTest::createDHCPv4MsgOption() const {
+Dhcp6to4IpcTest::createDHCPv4MsgOption() const {
     // Create the DHCPv4 message.
     // Create the DHCPv4 message.
     Pkt4Ptr pkt(new Pkt4(DHCPREQUEST, 1234));
     Pkt4Ptr pkt(new Pkt4(DHCPREQUEST, 1234));
     // Make a wire representation of the DHCPv4 message.
     // Make a wire representation of the DHCPv4 message.
@@ -90,9 +90,9 @@ Dhcp4o6IpcTest::createDHCPv4MsgOption() const {
 
 
 // This test verifies that the DHCPv4 endpoint of the DHCPv4o6 IPC can
 // This test verifies that the DHCPv4 endpoint of the DHCPv4o6 IPC can
 // receive messages.
 // receive messages.
-TEST_F(Dhcp4o6IpcTest, receive) {
+TEST_F(Dhcp6to4IpcTest, receive) {
     // Create instance of the IPC endpoint under test.
     // Create instance of the IPC endpoint under test.
-    Dhcp4o6Ipc& ipc = Dhcp4o6Ipc::instance();
+    Dhcp6to4Ipc& ipc = Dhcp6to4Ipc::instance();
     // Create instance of the IPC endpoint being used as a source of messages.
     // Create instance of the IPC endpoint being used as a source of messages.
     TestIpc src_ipc(TEST_PORT, TestIpc::ENDPOINT_TYPE_V4);
     TestIpc src_ipc(TEST_PORT, TestIpc::ENDPOINT_TYPE_V4);