Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
05616834
Commit
05616834
authored
Dec 09, 2015
by
Marcin Siodelski
Browse files
[4106] Renamed DHCPv4 and DHCPv6 specific IPC classes.
parent
0799cba4
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp4/ctrl_dhcp4_srv.cc
View file @
05616834
...
...
@@ -188,7 +188,7 @@ ControlledDhcpv4Srv::processConfig(isc::data::ConstElementPtr config) {
// Setup DHCPv4-over-DHCPv6 IPC
try
{
Dhcp4o6Ipc
::
instance
().
open
();
Dhcp4
t
o6Ipc
::
instance
().
open
();
}
catch
(
const
std
::
exception
&
ex
)
{
std
::
ostringstream
err
;
err
<<
"error starting DHCPv4-over-DHCPv6 IPC "
...
...
src/bin/dhcp4/dhcp4_dhcp4o6_ipc.cc
View file @
05616834
...
...
@@ -24,15 +24,15 @@ using namespace std;
namespace
isc
{
namespace
dhcp
{
Dhcp4o6Ipc
::
Dhcp4o6Ipc
()
:
Dhcp4o6IpcBase
()
{
Dhcp4
t
o6Ipc
::
Dhcp4
t
o6Ipc
()
:
Dhcp4o6IpcBase
()
{
}
Dhcp4o6Ipc
&
Dhcp4o6Ipc
::
instance
()
{
static
Dhcp4o6Ipc
dhcp4o6_ipc
;
return
(
dhcp4o6_ipc
);
Dhcp4
t
o6Ipc
&
Dhcp4
t
o6Ipc
::
instance
()
{
static
Dhcp4
t
o6Ipc
dhcp4
t
o6_ipc
;
return
(
dhcp4
t
o6_ipc
);
}
void
Dhcp4o6Ipc
::
open
()
{
void
Dhcp4
t
o6Ipc
::
open
()
{
uint32_t
port
=
CfgMgr
::
instance
().
getStagingCfg
()
->
getDhcp4o6Port
();
if
(
port
==
0
)
{
Dhcp4o6IpcBase
::
close
();
...
...
@@ -42,12 +42,12 @@ void Dhcp4o6Ipc::open() {
int
old_fd
=
socket_fd_
;
socket_fd_
=
Dhcp4o6IpcBase
::
open
(
static_cast
<
uint16_t
>
(
port
),
ENDPOINT_TYPE_V4
);
if
((
old_fd
==
-
1
)
&&
(
socket_fd_
!=
old_fd
))
{
IfaceMgr
::
instance
().
addExternalSocket
(
socket_fd_
,
Dhcp4o6Ipc
::
handler
);
IfaceMgr
::
instance
().
addExternalSocket
(
socket_fd_
,
Dhcp4
t
o6Ipc
::
handler
);
}
}
void
Dhcp4o6Ipc
::
handler
()
{
Dhcp4o6Ipc
&
ipc
=
Dhcp4o6Ipc
::
instance
();
void
Dhcp4
t
o6Ipc
::
handler
()
{
Dhcp4
t
o6Ipc
&
ipc
=
Dhcp4
t
o6Ipc
::
instance
();
// Reset received message in case we return from this method before the
// received message pointer is updated.
...
...
@@ -80,7 +80,7 @@ void Dhcp4o6Ipc::handler() {
ipc
.
received_
.
reset
(
new
Pkt4o6
(
msg
->
getData
(),
pkt
));
}
Pkt4o6Ptr
&
Dhcp4o6Ipc
::
getReceived
()
{
Pkt4o6Ptr
&
Dhcp4
t
o6Ipc
::
getReceived
()
{
return
(
received_
);
}
...
...
src/bin/dhcp4/dhcp4_dhcp4o6_ipc.h
View file @
05616834
...
...
@@ -28,23 +28,23 @@ namespace isc {
namespace
dhcp
{
/// @brief Handles DHCPv4-over-DHCPv6 IPC on the DHCPv4 server side
class
Dhcp4o6Ipc
:
public
Dhcp4o6IpcBase
{
class
Dhcp4
t
o6Ipc
:
public
Dhcp4o6IpcBase
{
protected:
/// @brief Constructor
///
/// Default constructor
Dhcp4o6Ipc
();
Dhcp4
t
o6Ipc
();
/// @brief Destructor.
virtual
~
Dhcp4o6Ipc
()
{
}
virtual
~
Dhcp4
t
o6Ipc
()
{
}
public:
/// @brief Returns pointer to the sole instance of Dhcp4o6Ipc
///
/// Dhcp4o6Ipc is a singleton class
/// Dhcp4
t
o6Ipc is a singleton class
///
/// @return the only existing instance of DHCP4o6 IPC
static
Dhcp4o6Ipc
&
instance
();
static
Dhcp4
t
o6Ipc
&
instance
();
/// @brief Open communication socket
///
...
...
src/bin/dhcp4/tests/dhcp4_dhcp4o6_ipc_unittest.cc
View file @
05616834
...
...
@@ -38,14 +38,14 @@ const uint16_t TEST_PORT = 32000;
typedef
Dhcp4o6TestIpc
TestIpc
;
/// @brief Test fixture class for DHCPv4 endpoint of DHCPv4o6 IPC.
class
Dhcp4o6IpcTest
:
public
::
testing
::
Test
{
class
Dhcp4
t
o6IpcTest
:
public
::
testing
::
Test
{
public:
/// @brief Constructor
///
/// Configures IPC to use a test port. It also provides a fake
/// configuration of interfaces.
Dhcp4o6IpcTest
()
Dhcp4
t
o6IpcTest
()
:
iface_mgr_test_config_
(
true
)
{
configurePort
(
TEST_PORT
);
}
...
...
@@ -68,12 +68,12 @@ private:
};
void
Dhcp4o6IpcTest
::
configurePort
(
const
uint16_t
port
)
{
Dhcp4
t
o6IpcTest
::
configurePort
(
const
uint16_t
port
)
{
CfgMgr
::
instance
().
getStagingCfg
()
->
setDhcp4o6Port
(
port
);
}
OptionPtr
Dhcp4o6IpcTest
::
createDHCPv4MsgOption
()
const
{
Dhcp4
t
o6IpcTest
::
createDHCPv4MsgOption
()
const
{
// Create the DHCPv4 message.
Pkt4Ptr
pkt
(
new
Pkt4
(
DHCPREQUEST
,
1234
));
// 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
// receive messages.
TEST_F
(
Dhcp4o6IpcTest
,
receive
)
{
TEST_F
(
Dhcp4
t
o6IpcTest
,
receive
)
{
// Create instance of the IPC endpoint under test.
Dhcp4o6Ipc
&
ipc
=
Dhcp4o6Ipc
::
instance
();
Dhcp4
t
o6Ipc
&
ipc
=
Dhcp4
t
o6Ipc
::
instance
();
// Create instance of the IPC endpoint being used as a source of messages.
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
// is rejected.
TEST_F
(
Dhcp4o6IpcTest
,
receiveMultipleQueries
)
{
TEST_F
(
Dhcp4
t
o6IpcTest
,
receiveMultipleQueries
)
{
// Create instance of the IPC endpoint under test.
Dhcp4o6Ipc
&
ipc
=
Dhcp4o6Ipc
::
instance
();
Dhcp4
t
o6Ipc
&
ipc
=
Dhcp4
t
o6Ipc
::
instance
();
// Create instance of the IPC endpoint being used as a source of messages.
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.
TEST_F
(
Dhcp4o6IpcTest
,
receiveNoQueries
)
{
TEST_F
(
Dhcp4
t
o6IpcTest
,
receiveNoQueries
)
{
// Create instance of the IPC endpoint under test.
Dhcp4o6Ipc
&
ipc
=
Dhcp4o6Ipc
::
instance
();
Dhcp4
t
o6Ipc
&
ipc
=
Dhcp4
t
o6Ipc
::
instance
();
// Create instance of the IPC endpoint being used as a source of messages.
TestIpc
src_ipc
(
TEST_PORT
,
TestIpc
::
ENDPOINT_TYPE_V6
);
...
...
src/bin/dhcp6/ctrl_dhcp6_srv.cc
View file @
05616834
...
...
@@ -186,7 +186,7 @@ ControlledDhcpv6Srv::processConfig(isc::data::ConstElementPtr config) {
// Setup DHCPv4-over-DHCPv6 IPC
try
{
Dhcp
4o6
Ipc
::
instance
().
open
();
Dhcp
6to4
Ipc
::
instance
().
open
();
}
catch
(
const
std
::
exception
&
ex
)
{
std
::
ostringstream
err
;
err
<<
"error starting DHCPv4-over-DHCPv6 IPC "
...
...
src/bin/dhcp6/dhcp6_dhcp4o6_ipc.cc
View file @
05616834
...
...
@@ -12,6 +12,7 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include
<config.h>
#include
<util/buffer.h>
...
...
@@ -24,14 +25,14 @@ using namespace std;
namespace
isc
{
namespace
dhcp
{
Dhcp
4o6
Ipc
::
Dhcp
4o6
Ipc
()
:
Dhcp4o6IpcBase
()
{}
Dhcp
6to4
Ipc
::
Dhcp
6to4
Ipc
()
:
Dhcp4o6IpcBase
()
{}
Dhcp
4o6
Ipc
&
Dhcp
4o6
Ipc
::
instance
()
{
static
Dhcp
4o6
Ipc
dhcp
4o6
_ipc
;
return
(
dhcp
4o6
_ipc
);
Dhcp
6to4
Ipc
&
Dhcp
6to4
Ipc
::
instance
()
{
static
Dhcp
6to4
Ipc
dhcp
6to4
_ipc
;
return
(
dhcp
6to4
_ipc
);
}
void
Dhcp
4o6
Ipc
::
open
()
{
void
Dhcp
6to4
Ipc
::
open
()
{
uint32_t
port
=
CfgMgr
::
instance
().
getStagingCfg
()
->
getDhcp4o6Port
();
if
(
port
==
0
)
{
Dhcp4o6IpcBase
::
close
();
...
...
@@ -41,12 +42,12 @@ void Dhcp4o6Ipc::open() {
int
old_fd
=
socket_fd_
;
socket_fd_
=
Dhcp4o6IpcBase
::
open
(
static_cast
<
uint16_t
>
(
port
),
ENDPOINT_TYPE_V6
);
if
((
old_fd
==
-
1
)
&&
(
socket_fd_
!=
old_fd
))
{
IfaceMgr
::
instance
().
addExternalSocket
(
socket_fd_
,
Dhcp
4o6
Ipc
::
handler
);
IfaceMgr
::
instance
().
addExternalSocket
(
socket_fd_
,
Dhcp
6to4
Ipc
::
handler
);
}
}
void
Dhcp
4o6
Ipc
::
handler
()
{
Dhcp
4o6
Ipc
&
ipc
=
Dhcp
4o6
Ipc
::
instance
();
void
Dhcp
6to4
Ipc
::
handler
()
{
Dhcp
6to4
Ipc
&
ipc
=
Dhcp
6to4
Ipc
::
instance
();
// Receive message from IPC.
Pkt6Ptr
pkt
=
ipc
.
receive
();
...
...
src/bin/dhcp6/dhcp6_dhcp4o6_ipc.h
View file @
05616834
...
...
@@ -26,15 +26,15 @@ namespace isc {
namespace
dhcp
{
/// @brief Handles DHCPv4-over-DHCPv6 IPC on the DHCPv6 server side
class
Dhcp
4o6
Ipc
:
public
Dhcp4o6IpcBase
{
class
Dhcp
6to4
Ipc
:
public
Dhcp4o6IpcBase
{
protected:
/// @brief Constructor
///
/// Default constructor
Dhcp
4o6
Ipc
();
Dhcp
6to4
Ipc
();
/// @brief Destructor.
virtual
~
Dhcp
4o6
Ipc
()
{
}
virtual
~
Dhcp
6to4
Ipc
()
{
}
public:
/// @brief Returns pointer to the sole instance of Dhcp4o6Ipc
...
...
@@ -42,7 +42,7 @@ public:
/// Dhcp4o6Ipc is a singleton class
///
/// @return the only existing instance of DHCP4o6 IPC
static
Dhcp
4o6
Ipc
&
instance
();
static
Dhcp
6to4
Ipc
&
instance
();
/// @brief Open communication socket
///
...
...
src/bin/dhcp6/dhcp6_srv.cc
View file @
05616834
...
...
@@ -241,7 +241,7 @@ Dhcpv6Srv::~Dhcpv6Srv() {
}
try
{
Dhcp
4o6
Ipc
::
instance
().
close
();
Dhcp
6to4
Ipc
::
instance
().
close
();
}
catch
(
const
std
::
exception
&
ex
)
{
// Highly unlikely, but lets Report it but go on
// LOG_ERROR(dhcp6_logger, DHCP6_SRV_DHCP4O6_ERROR).arg(ex.what());
...
...
src/bin/dhcp6/tests/dhcp6_dhcp4o6_ipc_unittest.cc
View file @
05616834
...
...
@@ -39,14 +39,14 @@ const uint16_t TEST_PORT = 32000;
typedef
Dhcp4o6TestIpc
TestIpc
;
/// @brief Test fixture class for DHCPv4 endpoint of DHCPv4o6 IPC.
class
Dhcp
4o6
IpcTest
:
public
::
testing
::
Test
{
class
Dhcp
6to4
IpcTest
:
public
::
testing
::
Test
{
public:
/// @brief Constructor
///
/// Configures IPC to use a test port. It also provides a fake
/// configuration of interfaces and opens IPv6 sockets.
Dhcp
4o6
IpcTest
()
Dhcp
6to4
IpcTest
()
:
iface_mgr_test_config_
(
true
)
{
IfaceMgr
::
instance
().
openSockets6
();
configurePort
(
TEST_PORT
);
...
...
@@ -69,12 +69,12 @@ private:
};
void
Dhcp
4o6
IpcTest
::
configurePort
(
const
uint16_t
port
)
{
Dhcp
6to4
IpcTest
::
configurePort
(
const
uint16_t
port
)
{
CfgMgr
::
instance
().
getStagingCfg
()
->
setDhcp4o6Port
(
port
);
}
OptionPtr
Dhcp
4o6
IpcTest
::
createDHCPv4MsgOption
()
const
{
Dhcp
6to4
IpcTest
::
createDHCPv4MsgOption
()
const
{
// Create the DHCPv4 message.
Pkt4Ptr
pkt
(
new
Pkt4
(
DHCPREQUEST
,
1234
));
// 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
// receive messages.
TEST_F
(
Dhcp
4o6
IpcTest
,
receive
)
{
TEST_F
(
Dhcp
6to4
IpcTest
,
receive
)
{
// Create instance of the IPC endpoint under test.
Dhcp
4o6
Ipc
&
ipc
=
Dhcp
4o6
Ipc
::
instance
();
Dhcp
6to4
Ipc
&
ipc
=
Dhcp
6to4
Ipc
::
instance
();
// Create instance of the IPC endpoint being used as a source of messages.
TestIpc
src_ipc
(
TEST_PORT
,
TestIpc
::
ENDPOINT_TYPE_V4
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment