face+management: Removing ndnd::Controller and re-designing controllers

As of this commit, there is only one controller: nfd::Controller.
Legacy ndnd-tlv is no longer supported, but it is still possible to use
NFD FIB Management directly (RIB Management commands are used by
default).  To request direct FIB management, one needs to call
Face::setDirectFibManagement(true) or configure protocol variable in the
config file.

Instead of using virtual methods of the controllers, a special
setInterestFilterImpl method will select proper prefix registration
method.  In addition to that, setInterestFilterImpl will also remember
how exactly the prefix should be de-registered, including security
parameters.

Change-Id: If9d4c7e87f6d80b6cb766a4116e04e846a51272d
Refs: #1576, #1577
diff --git a/tests-integrated/test-faces.cpp b/tests-integrated/test-faces.cpp
index 8d37d01..2f6d7ec 100644
--- a/tests-integrated/test-faces.cpp
+++ b/tests-integrated/test-faces.cpp
@@ -237,9 +237,6 @@
   Face face;
   Face face2(face.getIoService());
   Scheduler scheduler(*face.ioService());
-  scheduler.scheduleEvent(time::seconds(1),
-                          bind(&FacesFixture::terminate, this, ref(face)));
-
   scheduler.scheduleEvent(time::seconds(2),
                           bind(&FacesFixture::terminate, this, ref(face)));
 
@@ -264,15 +261,55 @@
                           bind(&FacesFixture::expressInterest, this,
                                ref(face2), Name("/Hello/World/a/b/d"))); // should not match
 
-  face.processEvents();
-  // BOOST_REQUIRE_NO_THROW(face.processEvents());
+  BOOST_REQUIRE_NO_THROW(face.processEvents());
 
   BOOST_CHECK_EQUAL(nRegFailures, 0);
   BOOST_CHECK_EQUAL(nInInterests, 2);
-  BOOST_CHECK_EQUAL(nTimeouts, 2);
+  BOOST_CHECK_EQUAL(nTimeouts, 4);
   BOOST_CHECK_EQUAL(nData, 0);
 }
 
+class FacesFixture2 : public FacesFixture
+{
+public:
+  void
+  checkPrefix(bool doesExist)
+  {
+    int result = std::system("nfd-status | grep /Hello/World >/dev/null");
+
+    if (doesExist) {
+      BOOST_CHECK_EQUAL(result, 0);
+    }
+    else {
+      BOOST_CHECK_NE(result, 0);
+    }
+  }
+};
+
+BOOST_FIXTURE_TEST_CASE(RegisterUnregisterPrefix, FacesFixture2)
+{
+  Face face;
+  Scheduler scheduler(*face.ioService());
+  scheduler.scheduleEvent(time::seconds(2),
+                          bind(&FacesFixture::terminate, this, ref(face)));
+
+  regPrefixId = face.setInterestFilter(InterestFilter("/Hello/World"),
+                                       bind(&FacesFixture::onInterest, this,
+                                            ref(face), _1, _2),
+                                       bind(&FacesFixture::onRegFailed, this));
+
+  scheduler.scheduleEvent(time::milliseconds(500),
+                          bind(&FacesFixture2::checkPrefix, this, true));
+
+  scheduler.scheduleEvent(time::seconds(1),
+                          bind(&Face::unsetInterestFilter, &face,
+                               regPrefixId)); // shouldn't match
+
+  scheduler.scheduleEvent(time::milliseconds(1500),
+                          bind(&FacesFixture2::checkPrefix, this, false));
+
+  BOOST_REQUIRE_NO_THROW(face.processEvents());
+}
 
 BOOST_AUTO_TEST_SUITE_END()