BIND 10 trac992, updated. 64546f4f97bf4032f7b97f768649ba1024503fc0 [992] Changes after review.
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Dec 12 17:05:44 UTC 2011
The branch, trac992 has been updated
via 64546f4f97bf4032f7b97f768649ba1024503fc0 (commit)
from d8cd199a66645341270081a7f409c557e596099b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 64546f4f97bf4032f7b97f768649ba1024503fc0
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Mon Dec 12 18:04:12 2011 +0100
[992] Changes after review.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 6 ++++++
src/bin/dhcp4/dhcp4_srv.cc | 14 +++++++-------
src/bin/dhcp4/dhcp4_srv.h | 22 +++++++++++++---------
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc | 11 ++---------
src/bin/dhcp4/tests/dhcp4_unittests.cc | 2 +-
5 files changed, 29 insertions(+), 26 deletions(-)
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index d3da7e4..a2dc66f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+3XX. [func] tomek
+ dhcp4: Dummy DHCPv4 component implemented. Currently it does
+ nothing useful, except providing skeleton implementation that can
+ be expanded in the future.
+ (Trac #992, git TBD)
+
328. [func] jelte
b10-auth now passes IXFR requests on to b10-xfrout, and no longer
responds to them with NOTIMPL.
diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc
index 38b6c9a..9686a35 100644
--- a/src/bin/dhcp4/dhcp4_srv.cc
+++ b/src/bin/dhcp4/dhcp4_srv.cc
@@ -34,7 +34,7 @@ Dhcpv4Srv::Dhcpv4Srv(uint16_t port) {
setServerID();
- shutdown = false;
+ shutdown_ = false;
}
Dhcpv4Srv::~Dhcpv4Srv() {
@@ -43,7 +43,7 @@ Dhcpv4Srv::~Dhcpv4Srv() {
bool
Dhcpv4Srv::run() {
- while (!shutdown) {
+ while (!shutdown_) {
boost::shared_ptr<Pkt4> query; // client's message
boost::shared_ptr<Pkt4> rsp; // server's response
@@ -127,28 +127,28 @@ Dhcpv4Srv::setServerID() {
}
boost::shared_ptr<Pkt4>
-Dhcpv4Srv::processDiscover(boost::shared_ptr<Pkt4> discover) {
+Dhcpv4Srv::processDiscover(boost::shared_ptr<Pkt4>& discover) {
/// TODO: Currently implemented echo mode. Implement this for real
return (discover);
}
boost::shared_ptr<Pkt4>
-Dhcpv4Srv::processRequest(boost::shared_ptr<Pkt4> request) {
+Dhcpv4Srv::processRequest(boost::shared_ptr<Pkt4>& request) {
/// TODO: Currently implemented echo mode. Implement this for real
return (request);
}
-void Dhcpv4Srv::processRelease(boost::shared_ptr<Pkt4> release) {
+void Dhcpv4Srv::processRelease(boost::shared_ptr<Pkt4>& release) {
/// TODO: Implement this.
cout << "Received RELEASE on " << release->getIface() << " interface." << endl;
}
-void Dhcpv4Srv::processDecline(boost::shared_ptr<Pkt4> decline) {
+void Dhcpv4Srv::processDecline(boost::shared_ptr<Pkt4>& decline) {
/// TODO: Implement this.
cout << "Received DECLINE on " << decline->getIface() << " interface." << endl;
}
-boost::shared_ptr<Pkt4> Dhcpv4Srv::processInform(boost::shared_ptr<Pkt4> inform) {
+boost::shared_ptr<Pkt4> Dhcpv4Srv::processInform(boost::shared_ptr<Pkt4>& inform) {
/// TODO: Currently implemented echo mode. Implement this for real
return (inform);
}
diff --git a/src/bin/dhcp4/dhcp4_srv.h b/src/bin/dhcp4/dhcp4_srv.h
index c5af8aa..033ac5a 100644
--- a/src/bin/dhcp4/dhcp4_srv.h
+++ b/src/bin/dhcp4/dhcp4_srv.h
@@ -35,13 +35,17 @@ namespace dhcp {
/// appropriate responses.
class Dhcpv4Srv : public boost::noncopyable {
-public:
+ public:
/// @brief Default constructor.
///
/// Instantiates necessary services, required to run DHCPv6 server.
/// In particular, creates IfaceMgr that will be responsible for
/// network interaction. Will instantiate lease manager, and load
- /// old or create new DUID.
+ /// old or create new DUID. It is possible to specify alternate
+ /// port on which DHCPv4 server will listen on. That is mostly useful
+ /// for testing purposes.
+ ///
+ /// @param port specifies port number to listen on
Dhcpv4Srv(uint16_t port = DHCP4_SERVER_PORT);
/// @brief Destructor. Used during DHCPv6 service shutdown.
@@ -68,13 +72,13 @@ protected:
///
/// @return OFFER message or NULL
boost::shared_ptr<Pkt4>
- processDiscover(boost::shared_ptr<Pkt4> discover);
+ processDiscover(boost::shared_ptr<Pkt4>& discover);
/// @brief Processes incoming REQUEST and returns REPLY response.
///
/// Processes incoming REQUEST message and verifies that its sender
/// should be served. In particular, verifies that requested lease
- /// is valid, not expired, not reserved, not used by other client and
+ /// is valid, not expired, not reserved, not used by other client and
/// that requesting client is allowed to use it.
///
/// Returns ACK message, NACK message, or NULL
@@ -82,7 +86,7 @@ protected:
/// @param request a message received from client
///
/// @return ACK or NACK message
- boost::shared_ptr<Pkt4> processRequest(boost::shared_ptr<Pkt4> request);
+ boost::shared_ptr<Pkt4> processRequest(boost::shared_ptr<Pkt4>& request);
/// @brief Stub function that will handle incoming RELEASE messages.
///
@@ -90,17 +94,17 @@ protected:
/// this function does not return anything.
///
/// @param release message received from client
- void processRelease(boost::shared_ptr<Pkt4> release);
+ void processRelease(boost::shared_ptr<Pkt4>& release);
/// @brief Stub function that will handle incoming DHCPDECLINE messages.
///
/// @param decline message received from client
- void processDecline(boost::shared_ptr<Pkt4> decline);
+ void processDecline(boost::shared_ptr<Pkt4>& decline);
/// @brief Stub function that will handle incoming INFORM messages.
///
/// @param infRequest message received from client
- boost::shared_ptr<Pkt4> processInform(boost::shared_ptr<Pkt4> inform);
+ boost::shared_ptr<Pkt4> processInform(boost::shared_ptr<Pkt4>& inform);
/// @brief Returns server-intentifier option
///
@@ -124,7 +128,7 @@ protected:
/// indicates if shutdown is in progress. Setting it to true will
/// initiate server shutdown procedure.
- volatile bool shutdown;
+ volatile bool shutdown_;
};
}; // namespace isc::dhcp
diff --git a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
index 897ac6d..c20e983 100644
--- a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
+++ b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
@@ -30,7 +30,7 @@ using namespace isc::dhcp;
namespace {
class NakedDhcpv4Srv: public Dhcpv4Srv {
- // "naked" Interface Manager, exposes internal fields
+ // "naked" DHCPv4 server, exposes internal fields
public:
NakedDhcpv4Srv() { }
@@ -69,11 +69,7 @@ TEST_F(Dhcpv4SrvTest, basic) {
srv = new Dhcpv4Srv();
});
- if (srv) {
- ASSERT_NO_THROW({
- delete srv;
- });
- }
+ delete srv;
}
TEST_F(Dhcpv4SrvTest, processDiscover) {
@@ -91,7 +87,6 @@ TEST_F(Dhcpv4SrvTest, processDiscover) {
// TODO: Implement more reasonable tests before starting
// work on processSomething() method.
-
delete srv;
}
@@ -110,7 +105,6 @@ TEST_F(Dhcpv4SrvTest, processRequest) {
// TODO: Implement more reasonable tests before starting
// work on processSomething() method.
-
delete srv;
}
@@ -142,7 +136,6 @@ TEST_F(Dhcpv4SrvTest, processDecline) {
// TODO: Implement more reasonable tests before starting
// work on processSomething() method.
-
delete srv;
}
diff --git a/src/bin/dhcp4/tests/dhcp4_unittests.cc b/src/bin/dhcp4/tests/dhcp4_unittests.cc
index ebd889d..ebc72fb 100644
--- a/src/bin/dhcp4/tests/dhcp4_unittests.cc
+++ b/src/bin/dhcp4/tests/dhcp4_unittests.cc
@@ -24,5 +24,5 @@ main(int argc, char* argv[]) {
int result = RUN_ALL_TESTS();
- return result;
+ return (result);
}
More information about the bind10-changes
mailing list