BIND 10 trac3156, updated. a617211d81b31c5e72f73ed6043d183be61679cf [3156] Minor review changes.

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Sep 24 15:53:34 UTC 2013


The branch, trac3156 has been updated
       via  a617211d81b31c5e72f73ed6043d183be61679cf (commit)
       via  4e9470edf1e15d65d8291fa6e33118cc92f70086 (commit)
      from  08f0151628c90ba7c70412414dd0dd1019b708b8 (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 a617211d81b31c5e72f73ed6043d183be61679cf
Author: Thomas Markwalder <tmark at isc.org>
Date:   Tue Sep 24 11:52:08 2013 -0400

    [3156] Minor review changes.
    
    Added empty implemenation of StateMode::onModelFailure and
    renamed event and state boundary constants.

commit 4e9470edf1e15d65d8291fa6e33118cc92f70086
Author: Thomas Markwalder <tmark at isc.org>
Date:   Thu Sep 19 14:59:10 2013 -0400

    [3156] Corrected a few doxygen errors.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/d2/d2_cfg_mgr.h                   |    2 +-
 src/bin/d2/nc_trans.cc                    |    4 +--
 src/bin/d2/nc_trans.h                     |   41 ++++++++++++++++++-----------
 src/bin/d2/state_model.cc                 |    9 +++++--
 src/bin/d2/state_model.h                  |   17 +++++++-----
 src/bin/d2/tests/nc_trans_unittests.cc    |    4 +--
 src/bin/d2/tests/state_model_unittests.cc |   18 ++++++-------
 7 files changed, 56 insertions(+), 39 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/d2/d2_cfg_mgr.h b/src/bin/d2/d2_cfg_mgr.h
index c9b794f..d95a890 100644
--- a/src/bin/d2/d2_cfg_mgr.h
+++ b/src/bin/d2/d2_cfg_mgr.h
@@ -199,7 +199,7 @@ public:
     /// output:
     ///0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.9.0.0.2.0.3.0.8.B.D.0.1.0.0.2.ip6.arpa.
     ///
-    /// @param address string containing a valid IPv6 address.
+    /// @param ioaddr string containing a valid IPv6 address.
     ///
     /// @return a std::string containing the reverse order address.
     ///
diff --git a/src/bin/d2/nc_trans.cc b/src/bin/d2/nc_trans.cc
index 7296828..50741fe 100644
--- a/src/bin/d2/nc_trans.cc
+++ b/src/bin/d2/nc_trans.cc
@@ -25,7 +25,7 @@ const int NameChangeTransaction::SELECTING_REV_SERVER_ST;
 const int NameChangeTransaction::PROCESS_TRANS_OK_ST;
 const int NameChangeTransaction::PROCESS_TRANS_FAILED_ST;
 
-const int NameChangeTransaction::NCT_STATE_MAX;
+const int NameChangeTransaction::NCT_DERIVED_STATE_MIN;
 
 // Common transaction events
 const int NameChangeTransaction::SELECT_SERVER_EVT;
@@ -36,7 +36,7 @@ const int NameChangeTransaction::IO_COMPLETED_EVT;
 const int NameChangeTransaction::UPDATE_OK_EVT;
 const int NameChangeTransaction::UPDATE_FAILED_EVT;
 
-const int NameChangeTransaction::NCT_EVENT_MAX;
+const int NameChangeTransaction::NCT_DERIVED_EVENT_MIN;
 
 NameChangeTransaction::
 NameChangeTransaction(isc::asiolink::IOService& io_service,
diff --git a/src/bin/d2/nc_trans.h b/src/bin/d2/nc_trans.h
index 6b58b5d..d30dff7 100644
--- a/src/bin/d2/nc_trans.h
+++ b/src/bin/d2/nc_trans.h
@@ -87,7 +87,7 @@ public:
     //@{ States common to all transactions.
 
     /// @brief State from which a transaction is started.
-    static const int READY_ST = SM_STATE_MAX + 1;
+    static const int READY_ST = SM_DERIVED_STATE_MIN + 1;
 
     /// @brief State in which forward DNS server selection is done.
     ///
@@ -95,7 +95,7 @@ public:
     /// to use is conducted.  Upon conclusion of this state the next server
     /// is either selected or it should transition out with NO_MORE_SERVERS_EVT
     /// event.
-    static const int SELECTING_FWD_SERVER_ST = SM_STATE_MAX + 2;
+    static const int SELECTING_FWD_SERVER_ST = SM_DERIVED_STATE_MIN + 2;
 
     /// @brief State in which reverse DNS server  selection is done.
     ///
@@ -103,43 +103,52 @@ public:
     /// to use is conducted.  Upon conclusion of this state the next server
     /// is either selected or it should transition out with NO_MORE_SERVERS_EVT
     /// event.
-    static const int SELECTING_REV_SERVER_ST = SM_STATE_MAX + 3;
+    static const int SELECTING_REV_SERVER_ST = SM_DERIVED_STATE_MIN + 3;
 
-    static const int PROCESS_TRANS_OK_ST = SM_STATE_MAX + 4;
+    /// @brief State which processes successful transaction conclusion.
+    static const int PROCESS_TRANS_OK_ST = SM_DERIVED_STATE_MIN + 4;
 
-    static const int PROCESS_TRANS_FAILED_ST = SM_STATE_MAX + 5;
+    /// @brief State which processes an unsuccessful transaction conclusion.
+    static const int PROCESS_TRANS_FAILED_ST = SM_DERIVED_STATE_MIN + 5;
 
-    /// @define Value at which custom states in a derived class should begin.
-    static const int NCT_STATE_MAX = SM_STATE_MAX + 100;
+    /// @brief Value at which custom states in a derived class should begin.
+    static const int NCT_DERIVED_STATE_MIN = SM_DERIVED_STATE_MIN + 101;
     //@}
 
     //@{ Events common to all transactions.
     /// @brief Issued when a server needs to be selected.
-    static const int SELECT_SERVER_EVT = SM_STATE_MAX + 1;
+    static const int SELECT_SERVER_EVT = SM_DERIVED_EVENT_MIN + 1;
+
     /// @brief Issued when a server  has been selected.
-    static const int SERVER_SELECTED_EVT = SM_EVENT_MAX + 2;
+    static const int SERVER_SELECTED_EVT = SM_DERIVED_EVENT_MIN + 2;
+
     /// @brief Issued when an update fails due to an IO error.
-    static const int SERVER_IO_ERROR_EVT = SM_EVENT_MAX + 3;
+    static const int SERVER_IO_ERROR_EVT = SM_DERIVED_EVENT_MIN + 3;
+
     /// @brief Issued when there are no more servers from which to select.
     /// This occurs when none of the servers in the list can be reached to
     /// perform the update.
-    static const int NO_MORE_SERVERS_EVT =SM_EVENT_MAX +  4;
+
+    static const int NO_MORE_SERVERS_EVT =SM_DERIVED_EVENT_MIN +  4;
     /// @brief Issued when a DNS update packet exchange has completed.
     /// This occurs whenever the DNSClient callback is invoked whether the
     /// exchange was successful or not.
-    static const int IO_COMPLETED_EVT = SM_EVENT_MAX + 5;
+
+    static const int IO_COMPLETED_EVT = SM_DERIVED_EVENT_MIN + 5;
     /// @brief Issued when the attempted update successfully completed.
     /// This occurs when an DNS update packet was successfully processed
     /// by the server.
-    static const int UPDATE_OK_EVT = SM_EVENT_MAX + 6;
+
+    static const int UPDATE_OK_EVT = SM_DERIVED_EVENT_MIN + 6;
+
     /// @brief Issued when the attempted update fails to complete.
     /// This occurs when an DNS update packet fails to process. The nature of
     /// the failure is given by the DNSClient return status and the response
     /// packet (if one was received).
-    static const int UPDATE_FAILED_EVT = SM_EVENT_MAX + 7;
+    static const int UPDATE_FAILED_EVT = SM_DERIVED_EVENT_MIN + 7;
 
-    /// @define Value at which custom events in a derived class should begin.
-    static const int NCT_EVENT_MAX = SM_EVENT_MAX + 100;
+    /// @brief Value at which custom events in a derived class should begin.
+    static const int NCT_DERIVED_EVENT_MIN = SM_DERIVED_EVENT_MIN + 101;
     //@}
 
     /// @brief Constructor
diff --git a/src/bin/d2/state_model.cc b/src/bin/d2/state_model.cc
index be961c3..6786e43 100644
--- a/src/bin/d2/state_model.cc
+++ b/src/bin/d2/state_model.cc
@@ -71,7 +71,7 @@ StateSet::getState(int value) {
 const int StateModel::NEW_ST;
 const int StateModel::END_ST;
 
-const int StateModel::SM_STATE_MAX;
+const int StateModel::SM_DERIVED_STATE_MIN;
 
 // Common state model events
 const int StateModel::NOP_EVT;
@@ -79,7 +79,7 @@ const int StateModel::START_EVT;
 const int StateModel::END_EVT;
 const int StateModel::FAIL_EVT;
 
-const int StateModel::SM_EVENT_MAX;
+const int StateModel::SM_DERIVED_EVENT_MIN;
 
 StateModel::StateModel() : events_(), states_(), dictionaries_initted_(false),
                           curr_state_(NEW_ST), prev_state_(NEW_ST),
@@ -233,6 +233,11 @@ StateModel::verifyStates() {
     getState(END_ST);
 }
 
+void 
+StateModel::onModelFailure(const std::string&) {
+    // Empty implementation to make deriving classes simpler.
+}
+
 void
 StateModel::transition(unsigned int state, unsigned int event) {
     setState(state);
diff --git a/src/bin/d2/state_model.h b/src/bin/d2/state_model.h
index 43d8c08..1596bb6 100644
--- a/src/bin/d2/state_model.h
+++ b/src/bin/d2/state_model.h
@@ -245,8 +245,8 @@ public:
     /// @brief Final state, all the state model has reached its conclusion.
     static const int END_ST = 1;
 
-    /// @define Value at which custom states in a derived class should begin.
-    static const int SM_STATE_MAX = 10;
+    /// @brief Value at which custom states in a derived class should begin.
+    static const int SM_DERIVED_STATE_MIN = 11;
     //@}
 
     //@{ Events common to all state models.
@@ -264,8 +264,8 @@ public:
     /// @brief Event issued to abort the model execution.
     static const int FAIL_EVT = 3;
 
-    /// @define Value at which custom events in a derived class should begin.
-    static const int SM_EVENT_MAX = 10;
+    /// @brief Value at which custom events in a derived class should begin.
+    static const int SM_DERIVED_EVENT_MIN = 11;
     //@}
 
     /// @brief Constructor
@@ -419,6 +419,8 @@ protected:
     /// @param value is the numeric value of the state
     /// @param label is the text label of the state used in log messages and
     /// exceptions.
+    /// @param handler is the bound instance method which implements the state's
+    /// actions.
     ///
     /// @throw StateModelError if the model has already been started, if
     /// the value is already defined, or if the label is empty.
@@ -464,10 +466,11 @@ protected:
     /// model execution, such as a state handler throwing an exception.
     /// It provides derivations an opportunity to act accordingly by setting
     /// the appropriate status or taking other remedial action.   This allows
-    /// the model execution loop to remain exception safe.
+    /// the model execution loop to remain exception safe.  This default
+    /// implementation does nothing.
     ///
     /// @param explanation text detailing the error and state machine context
-    virtual void onModelFailure(const std::string& explanation) = 0;
+    virtual void onModelFailure(const std::string& explanation);
 
     /// @brief Sets up the model to transition into given state with a given
     /// event.
@@ -512,7 +515,7 @@ protected:
     /// event that will be passed into the current state's handler on the next
     /// iteration of the run loop.
     ///
-    /// @param the numeric event value to post as the next event.
+    /// @param event the numeric event value to post as the next event.
     ///
     /// @throw StateModelError if the event is undefined
     void postNextEvent(unsigned int event);
diff --git a/src/bin/d2/tests/nc_trans_unittests.cc b/src/bin/d2/tests/nc_trans_unittests.cc
index 4e1bb96..31785a4 100644
--- a/src/bin/d2/tests/nc_trans_unittests.cc
+++ b/src/bin/d2/tests/nc_trans_unittests.cc
@@ -35,10 +35,10 @@ class NameChangeStub : public NameChangeTransaction {
 public:
 
     // NameChangeStub states
-    static const int DOING_UPDATE_ST = NCT_STATE_MAX + 1;
+    static const int DOING_UPDATE_ST = NCT_DERIVED_STATE_MIN + 1;
 
     // NameChangeStub events
-    static const int SEND_UPDATE_EVT = NCT_EVENT_MAX + 2;
+    static const int SEND_UPDATE_EVT = NCT_DERIVED_EVENT_MIN + 2;
 
     /// @brief Constructor
     ///
diff --git a/src/bin/d2/tests/state_model_unittests.cc b/src/bin/d2/tests/state_model_unittests.cc
index 55cdae0..63a0203 100644
--- a/src/bin/d2/tests/state_model_unittests.cc
+++ b/src/bin/d2/tests/state_model_unittests.cc
@@ -35,32 +35,32 @@ public:
 
     ///@brief StateModelTest states
     ///@brief Fake state used for handler mapping tests.
-    static const int DUMMY_ST = SM_STATE_MAX + 1;
+    static const int DUMMY_ST = SM_DERIVED_STATE_MIN + 1;
 
     ///@brief Starting state for the test state model.
-    static const int READY_ST = SM_STATE_MAX + 2;
+    static const int READY_ST = SM_DERIVED_STATE_MIN + 2;
 
     ///@brief State which simulates doing asynchronous work.
-    static const int DO_WORK_ST = SM_STATE_MAX + 3;
+    static const int DO_WORK_ST = SM_DERIVED_STATE_MIN + 3;
 
     ///@brief State which finishes off processing.
-    static const int DONE_ST = SM_STATE_MAX + 4;
+    static const int DONE_ST = SM_DERIVED_STATE_MIN + 4;
 
     // StateModelTest events
     ///@brief Event used to trigger initiation of asynchronous work.
-    static const int WORK_START_EVT = SM_EVENT_MAX + 1;
+    static const int WORK_START_EVT = SM_DERIVED_EVENT_MIN + 1;
 
     ///@brief Event issued when the asynchronous work "completes".
-    static const int WORK_DONE_EVT = SM_EVENT_MAX + 2;
+    static const int WORK_DONE_EVT = SM_DERIVED_EVENT_MIN + 2;
 
     ///@brief Event issued when all the work is done.
-    static const int ALL_DONE_EVT = SM_EVENT_MAX + 3;
+    static const int ALL_DONE_EVT = SM_DERIVED_EVENT_MIN + 3;
 
     ///@brief Event used to trigger an attempt to transition to bad state
-    static const int FORCE_UNDEFINED_ST_EVT = SM_EVENT_MAX + 4;
+    static const int FORCE_UNDEFINED_ST_EVT = SM_DERIVED_EVENT_MIN + 4;
 
     ///@brief Event used to trigger an attempt to transition to bad state
-    static const int SIMULATE_ERROR_EVT = SM_EVENT_MAX + 5;
+    static const int SIMULATE_ERROR_EVT = SM_DERIVED_EVENT_MIN + 5;
 
     /// @brief Constructor
     ///



More information about the bind10-changes mailing list