face+node: Improving async operations

Now expressInterest is executed strictly in io_service thread, which
should guarantee absence of resource contention, provided that
io_service has exactly one thread.

Instead of numerical IDs for expressed Interests and registered
prefixes, an opaque PendingInterestId and RegisteredPrefixId classed are
used.  These classes are basically reinterpret_cast pointers to the
PendingInterest and RegisteredPrefix objects stored on the node.

refs #1142 (http://redmine.named-data.net/issues/1142)

Change-Id: I4b146ee34b98bfa6564935d5f2fe33056a402694
diff --git a/tests/test-publish-async.cpp b/tests/test-publish-async.cpp
index 92fcae8..b6a680f 100644
--- a/tests/test-publish-async.cpp
+++ b/tests/test-publish-async.cpp
@@ -72,8 +72,7 @@
   
   // onInterest.
   void operator()
-     (const ptr_lib::shared_ptr<const Name>& prefix, const ptr_lib::shared_ptr<const Interest>& interest, Transport& transport,
-      uint64_t registeredPrefixId) 
+     (const ptr_lib::shared_ptr<const Name>& prefix, const ptr_lib::shared_ptr<const Interest>& interest) 
   {
     ++responseCount_;
     
@@ -90,7 +89,7 @@
 
     // Unregister prefix to ensure that the processing thread finishes after Data
     // packet is send out to the forwarder
-    face_.unsetInterestFilter(registeredPrefixId);
+    face_.unsetInterestFilter(id_);
   }
   
   // onRegisterFailed.
@@ -103,6 +102,8 @@
   KeyChainImpl<SecPublicInfoMemory, SecTpmMemory> &keyChain_;
   Face &face_;
   int responseCount_;
+
+  const RegisteredPrefixId *id_;
 };
 
 int main(int argc, char** argv)
@@ -128,7 +129,7 @@
     Echo echo(keyChain, face);
     Name prefix("/testecho");
     cout << "Register prefix  " << prefix.toUri() << endl;
-    face.setInterestFilter(prefix, func_lib::ref(echo), func_lib::ref(echo));
+    echo.id_ = face.setInterestFilter(prefix, func_lib::ref(echo), func_lib::ref(echo));
     
     face.processEvents();
   } catch (std::exception& e) {