diff --git a/rib/rib-entry.cpp b/rib/rib-entry.cpp
index 7d4cff8..a33e113 100644
--- a/rib/rib-entry.cpp
+++ b/rib/rib-entry.cpp
@@ -46,7 +46,7 @@
   return std::find_if(begin(), end(), bind(&compareFaceIdAndOrigin, _1, route));
 }
 
-bool
+std::pair<RibEntry::iterator, bool>
 RibEntry::insertRoute(const Route& route)
 {
   iterator it = findRoute(route);
@@ -58,10 +58,10 @@
 
     m_routes.push_back(route);
 
-    return true;
+    return std::make_pair(std::prev(m_routes.end()), true);
   }
   else {
-    return false;
+    return std::make_pair(it, false);
   }
 }
 
diff --git a/rib/rib-entry.hpp b/rib/rib-entry.hpp
index c3c5b4c..d55d3f1 100644
--- a/rib/rib-entry.hpp
+++ b/rib/rib-entry.hpp
@@ -72,9 +72,12 @@
   /** \brief inserts a new route into the entry's route list
    *  If another route already exists with the same faceId and origin,
    *  the new route is not inserted.
-   *  \return{ true if the route is inserted, false otherwise }
+   *  \return a pair, whose first element is the iterator to the newly
+   *  inserted element if the insert succeeds and to the
+   *  previously-existing element otherwise, and whose second element
+   *  is true if the insert succeeds and false otherwise.
    */
-  bool
+  std::pair<RibEntry::iterator, bool>
   insertRoute(const Route& route);
 
   /** \brief erases a Route with the same faceId and origin
diff --git a/rib/rib.cpp b/rib/rib.cpp
index eb577bb..97492b2 100644
--- a/rib/rib.cpp
+++ b/rib/rib.cpp
@@ -89,42 +89,45 @@
   if (ribIt != m_rib.end()) {
     shared_ptr<RibEntry> entry(ribIt->second);
 
-    RibEntry::iterator routeIt = entry->findRoute(route);
+    RibEntry::iterator entryIt;
+    bool didInsert = false;
+    std::tie(entryIt, didInsert) = entry->insertRoute(route);
 
-    if (routeIt == entry->end()) {
-      // New route
-      entry->insertRoute(route);
+    if (didInsert) {
+      // The route was new and we successfully inserted it.
       m_nItems++;
 
+      afterAddRoute(RibRouteRef{entry, entryIt});
+
       // Register with face lookup table
       m_faceMap[route.faceId].push_back(entry);
     }
     else {
       // Route exists, update fields
       // First cancel old scheduled event, if any, then set the EventId to new one
-      if (static_cast<bool>(routeIt->getExpirationEvent())) {
+      if (static_cast<bool>(entryIt->getExpirationEvent())) {
         NFD_LOG_TRACE("Cancelling expiration event for " << entry->getName() << " "
-                                                         << *routeIt);
-        scheduler::cancel(routeIt->getExpirationEvent());
+                                                         << (*entryIt));
+        scheduler::cancel(entryIt->getExpirationEvent());
       }
 
       // No checks are required here as the iterator needs to be updated in all cases.
-      routeIt->setExpirationEvent(route.getExpirationEvent());
+      entryIt->setExpirationEvent(route.getExpirationEvent());
 
-      routeIt->flags = route.flags;
-      routeIt->cost = route.cost;
-      routeIt->expires = route.expires;
+      entryIt->flags = route.flags;
+      entryIt->cost = route.cost;
+      entryIt->expires = route.expires;
     }
   }
   else {
     // New name prefix
-    shared_ptr<RibEntry> entry(make_shared<RibEntry>(RibEntry()));
+    shared_ptr<RibEntry> entry = make_shared<RibEntry>();
 
     m_rib[prefix] = entry;
     m_nItems++;
 
     entry->setName(prefix);
-    entry->insertRoute(route);
+    RibEntry::iterator routeIt = entry->insertRoute(route).first;
 
     // Find prefix's parent
     shared_ptr<RibEntry> parent = findParent(prefix);
@@ -152,6 +155,7 @@
 
     // do something after inserting an entry
     afterInsertEntry(prefix);
+    afterAddRoute(RibRouteRef{entry, routeIt});
   }
 }
 
@@ -166,6 +170,8 @@
     RibEntry::iterator routeIt = entry->findRoute(route);
 
     if (routeIt != entry->end()) {
+      beforeRemoveRoute(RibRouteRef{entry, routeIt});
+
       auto faceId = route.faceId;
       entry->eraseRoute(routeIt);
       m_nItems--;
diff --git a/rib/rib.hpp b/rib/rib.hpp
index 4c9e608..70554e6 100644
--- a/rib/rib.hpp
+++ b/rib/rib.hpp
@@ -38,7 +38,20 @@
 
 class FibUpdater;
 
-/** \brief represents the RIB
+  /** \brief references a route
+   */
+struct RibRouteRef
+{
+  shared_ptr<RibEntry> entry;
+  RibEntry::const_iterator route;
+};
+
+/** \brief represents the Routing Information Base
+
+    The Routing Information Base contains a collection of Routes, each
+    represents a piece of static or dynamic routing information
+    registered by applications, operators, or NFD itself. Routes
+    associated with the same namespace are collected into a RIB entry.
  */
 class Rib : noncopyable
 {
@@ -201,9 +214,29 @@
   findRoutesWithFaceId(uint64_t faceId);
 
 public:
+  /** \brief signals after a RIB entry is inserted
+   *
+   *  A RIB entry is inserted when the first route associated with a
+   *  certain namespace is added.
+   */
   ndn::util::signal::Signal<Rib, Name> afterInsertEntry;
+
+  /** \brief signals after a RIB entry is erased
+   *
+   *  A RIB entry is erased when the last route associated with a
+   *  certain namespace is removed.
+   */
+
   ndn::util::signal::Signal<Rib, Name> afterEraseEntry;
 
+  /** \brief signals after a Route is added
+   */
+  ndn::util::signal::Signal<Rib, RibRouteRef> afterAddRoute;
+
+  /** \brief signals before a route is removed
+   */
+  ndn::util::signal::Signal<Rib, RibRouteRef> beforeRemoveRoute;
+
 private:
   RibTable m_rib;
   FaceLookupTable m_faceMap;
diff --git a/tests/rib/rib-entry.t.cpp b/tests/rib/rib-entry.t.cpp
new file mode 100644
index 0000000..03cd8b9
--- /dev/null
+++ b/tests/rib/rib-entry.t.cpp
@@ -0,0 +1,79 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2016,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "rib/rib-entry.hpp"
+#include "tests/test-common.hpp"
+
+namespace nfd {
+namespace rib {
+namespace tests {
+
+BOOST_FIXTURE_TEST_SUITE(TestRibEntry, nfd::tests::BaseFixture)
+
+BOOST_AUTO_TEST_CASE(Basic)
+{
+  rib::RibEntry entry;
+  rib::RibEntry::iterator entryIt;
+  bool didInsert = false;
+
+  rib::Route route1;
+  route1.faceId = 1;
+  route1.origin = 0;
+
+  std::tie(entryIt, didInsert) =  entry.insertRoute(route1);
+  BOOST_CHECK_EQUAL(entry.getRoutes().size(), 1);
+  BOOST_CHECK(entryIt == entry.findRoute(route1));
+  BOOST_CHECK(didInsert);
+
+  Route route2;
+  route2.faceId = 1;
+  route2.origin = 128;
+
+  std::tie(entryIt, didInsert) = entry.insertRoute(route2);
+  BOOST_CHECK_EQUAL(entry.getRoutes().size(), 2);
+  BOOST_CHECK(entryIt == entry.findRoute(route2));
+  BOOST_CHECK(didInsert);
+
+  entry.eraseRoute(route1);
+  BOOST_CHECK_EQUAL(entry.getRoutes().size(), 1);
+  BOOST_CHECK(entry.findRoute(route1) == entry.end());
+
+  BOOST_CHECK(entry.findRoute(route1) == entry.getRoutes().end());
+  BOOST_CHECK(entry.findRoute(route2) != entry.getRoutes().end());
+
+  std::tie(entryIt, didInsert) = entry.insertRoute(route2);
+  BOOST_CHECK_EQUAL(entry.getRoutes().size(), 1);
+  BOOST_CHECK(!didInsert);
+
+  entry.eraseRoute(route1);
+  BOOST_CHECK_EQUAL(entry.getRoutes().size(), 1);
+  BOOST_CHECK(entry.findRoute(route2) != entry.getRoutes().end());
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestRibEntry
+
+} // namespace tests
+} // namespace rib
+} // namespace nfd
diff --git a/tests/rib/rib.t.cpp b/tests/rib/rib.t.cpp
index eed09f9..9a73ac7 100644
--- a/tests/rib/rib.t.cpp
+++ b/tests/rib/rib.t.cpp
@@ -1,4 +1,4 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
  * Copyright (c) 2014-2016,  Regents of the University of California,
  *                           Arizona Board of Regents,
@@ -35,38 +35,6 @@
 
 BOOST_FIXTURE_TEST_SUITE(TestRib, nfd::tests::BaseFixture)
 
-BOOST_AUTO_TEST_CASE(RibEntry)
-{
-  rib::RibEntry entry;
-
-  rib::Route route1;
-  route1.faceId = 1;
-  route1.origin = 0;
-
-  entry.insertRoute(route1);
-  BOOST_CHECK_EQUAL(entry.getRoutes().size(), 1);
-
-  Route route2;
-  route2.faceId = 1;
-  route2.origin = 128;
-
-  entry.insertRoute(route2);
-  BOOST_CHECK_EQUAL(entry.getRoutes().size(), 2);
-
-  entry.eraseRoute(route1);
-  BOOST_CHECK_EQUAL(entry.getRoutes().size(), 1);
-
-  BOOST_CHECK(entry.findRoute(route1) == entry.getRoutes().end());
-  BOOST_CHECK(entry.findRoute(route2) != entry.getRoutes().end());
-
-  entry.insertRoute(route2);
-  BOOST_CHECK_EQUAL(entry.getRoutes().size(), 1);
-
-  entry.eraseRoute(route1);
-  BOOST_CHECK_EQUAL(entry.getRoutes().size(), 1);
-  BOOST_CHECK(entry.findRoute(route2) != entry.getRoutes().end());
-}
-
 BOOST_AUTO_TEST_CASE(Parent)
 {
   rib::Rib rib;
@@ -295,6 +263,79 @@
   BOOST_CHECK_EQUAL(rib.size(), 1);
 }
 
+BOOST_AUTO_TEST_CASE(RibSignals)
+{
+  rib::Rib rib;
+
+  Route route;
+  Name name("/hello/world");
+
+  Route route1;
+  route1.faceId = 1;
+  route1.origin = 20;
+  route1.cost = 10;
+
+  Route route2;
+  route2.faceId = 2;
+  route2.origin = 30;
+  route2.cost = 20;
+
+  RibRouteRef routeInfo;
+
+  int nAfterInsertEntryInvocations = 0;
+  int nAfterAddRouteInvocations = 0;
+  int nBeforeRemoveRouteInvocations = 0;
+  int nAfterEraseEntryInvocations = 0;
+  rib.afterInsertEntry.connect([&] (const Name& inName) {
+      BOOST_CHECK_EQUAL(nAfterInsertEntryInvocations, 0);
+      BOOST_CHECK_EQUAL(nAfterAddRouteInvocations, 0);
+      BOOST_CHECK(rib.find(name) != rib.end());
+      nAfterInsertEntryInvocations++;
+    });
+
+  rib.afterAddRoute.connect([&] (const RibRouteRef& rrr) {
+      BOOST_CHECK_EQUAL(nAfterInsertEntryInvocations, 1);
+      BOOST_CHECK(rib.find(name) != rib.end());
+      BOOST_CHECK(rib.find(name, route) != nullptr);
+      nAfterAddRouteInvocations++;
+    });
+
+  rib.beforeRemoveRoute.connect([&] (const RibRouteRef& rrr) {
+      BOOST_CHECK_EQUAL(nAfterEraseEntryInvocations, 0);
+      BOOST_CHECK(rib.find(name) != rib.end());
+      BOOST_CHECK(rib.find(name, route) != nullptr);
+      nBeforeRemoveRouteInvocations++;
+    });
+
+  rib.afterEraseEntry.connect([&] (const Name& inName) {
+      BOOST_CHECK_EQUAL(nBeforeRemoveRouteInvocations, 2);
+      BOOST_CHECK_EQUAL(nAfterEraseEntryInvocations, 0);
+      BOOST_CHECK(rib.find(name) == rib.end());
+      nAfterEraseEntryInvocations++;
+    });
+
+  route = route1;
+  rib.insert(name, route);
+  BOOST_CHECK_EQUAL(nAfterInsertEntryInvocations, 1);
+  BOOST_CHECK_EQUAL(nAfterAddRouteInvocations, 1);
+
+  route = route2;
+  rib.insert(name, route);
+  BOOST_CHECK_EQUAL(nAfterInsertEntryInvocations, 1);
+  BOOST_CHECK_EQUAL(nAfterAddRouteInvocations, 2);
+
+  route = route1;
+  rib.erase(name, route);
+  BOOST_CHECK_EQUAL(nBeforeRemoveRouteInvocations, 1);
+  BOOST_CHECK_EQUAL(nAfterEraseEntryInvocations, 0);
+
+  route = route2;
+  rib.erase(name, route);
+  BOOST_CHECK_EQUAL(nBeforeRemoveRouteInvocations, 2);
+  BOOST_CHECK_EQUAL(nAfterEraseEntryInvocations, 1);
+
+}
+
 BOOST_AUTO_TEST_SUITE_END() // TestRib
 
 } // namespace tests
