[svn] commit: r3465 - in /branches/trac356/src/lib/nsas: Makefile.am nameserver_address.h nameserver_entry.cc nameserver_entry.h tests/Makefile.am tests/nameserver_address_unittest.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Nov 5 12:04:36 UTC 2010


Author: ocean
Date: Fri Nov  5 12:04:36 2010
New Revision: 3465

Log:
Definition of data structure and processing required for the caller to update the RTT
associated with the address

Added:
    branches/trac356/src/lib/nsas/nameserver_address.h
    branches/trac356/src/lib/nsas/tests/nameserver_address_unittest.cc
Modified:
    branches/trac356/src/lib/nsas/Makefile.am
    branches/trac356/src/lib/nsas/nameserver_entry.cc
    branches/trac356/src/lib/nsas/nameserver_entry.h
    branches/trac356/src/lib/nsas/tests/Makefile.am

Modified: branches/trac356/src/lib/nsas/Makefile.am
==============================================================================
--- branches/trac356/src/lib/nsas/Makefile.am (original)
+++ branches/trac356/src/lib/nsas/Makefile.am Fri Nov  5 12:04:36 2010
@@ -15,6 +15,7 @@
 libnsas_la_SOURCES += hash_table.h
 libnsas_la_SOURCES += lru_list.h
 libnsas_la_SOURCES += nameserver_address_store.cc nameserver_address_store.h
+libnsas_la_SOURCES += nameserver_address.h
 libnsas_la_SOURCES += nameserver_entry.cc nameserver_entry.h
 libnsas_la_SOURCES += nsas_entry_compare.h
 libnsas_la_SOURCES += nsas_entry.h

Modified: branches/trac356/src/lib/nsas/nameserver_entry.cc
==============================================================================
--- branches/trac356/src/lib/nsas/nameserver_entry.cc (original)
+++ branches/trac356/src/lib/nsas/nameserver_entry.cc Fri Nov  5 12:04:36 2010
@@ -143,6 +143,13 @@
         bind1st(AddressSelection(), family));
 }
 
+asiolink::IOAddress NameserverEntry::getAddressAtIndex(uint32_t index) const
+{
+    assert(index < address_.size());
+
+    return address_[index].getAddress();
+}
+
 // Set the address RTT to a specific value
 void NameserverEntry::setAddressRTT(const IOAddress& address, uint32_t rtt) {
 
@@ -154,6 +161,15 @@
     }
 }
 
+// Update the address's rtt 
+void NameserverEntry::updateAddressRTTAtIndex(uint32_t rtt, uint32_t index) {
+    //make sure it is a valid index
+    if(index >= address_.size()) return;
+
+    //update the rtt
+    address_[index].setRTT(rtt);
+}
+
 // Sets the address to be unreachable
 void NameserverEntry::setAddressUnreachable(const IOAddress& address) {
     setAddressRTT(address, AddressEntry::UNREACHABLE);

Modified: branches/trac356/src/lib/nsas/nameserver_entry.h
==============================================================================
--- branches/trac356/src/lib/nsas/nameserver_entry.h (original)
+++ branches/trac356/src/lib/nsas/nameserver_entry.h Fri Nov  5 12:04:36 2010
@@ -126,6 +126,11 @@
     virtual void getAddresses(NameserverEntry::AddressVector& addresses,
         short family = 0) const;
 
+    /// \brief Return Address that corresponding to the index
+    ///
+    /// \param index The address index in the address vector
+    virtual asiolink::IOAddress getAddressAtIndex(uint32_t index) const;
+
     /// \brief Update RTT
     ///
     /// Updates the RTT for a particular address
@@ -134,6 +139,12 @@
     /// \param RTT New RTT for the address
     virtual void setAddressRTT(const asiolink::IOAddress& address, uint32_t rtt);
 
+    /// \brief Update RTT of the address that corresponding to the index
+    ///
+    /// \param rtt Round-Trip Time
+    /// \param index The address's index in address vector
+    virtual void updateAddressRTTAtIndex(uint32_t rtt, uint32_t index);
+
     /// \brief Set Address Unreachable
     ///
     /// Sets the specified address to be unreachable
@@ -155,6 +166,8 @@
     virtual HashKey hashKey() const {
         return HashKey(name_, classCode_);
     }
+
+    /// \return Hash Key of the Nameserver
 
     /// \return Expiration Time of Data
     ///

Modified: branches/trac356/src/lib/nsas/tests/Makefile.am
==============================================================================
--- branches/trac356/src/lib/nsas/tests/Makefile.am (original)
+++ branches/trac356/src/lib/nsas/tests/Makefile.am Fri Nov  5 12:04:36 2010
@@ -23,6 +23,7 @@
 run_unittests_SOURCES += hash_table_unittest.cc
 run_unittests_SOURCES += hash_unittest.cc
 run_unittests_SOURCES += lru_list_unittest.cc
+run_unittests_SOURCES += nameserver_address_unittest.cc
 run_unittests_SOURCES += nameserver_address_store_unittest.cc
 run_unittests_SOURCES += nameserver_entry_unittest.cc
 run_unittests_SOURCES += nsas_entry_compare_unittest.cc




More information about the bind10-changes mailing list