node+face-management-protocol: Finalizing prefix registration (selfreg)

Change-Id: I88aa15b785824a53fcc167b57fb1f0831b5aa9fa
diff --git a/src/node.cpp b/src/node.cpp
index b766718..3610344 100644
--- a/src/node.cpp
+++ b/src/node.cpp
@@ -152,25 +152,33 @@
       return;
     }
 
-  switch(content.getAll().begin()->type())
+  Block::element_iterator val = content.getAll().begin();
+  
+  switch(val->type())
     {
     case Tlv::FaceManagement::ForwardingEntry:
       {
+        ForwardingEntry entry;
+        entry.wireDecode(*val);
+
+        // Save the onInterest callback and send the registration interest.
+        registeredPrefixTable_.push_back(ptr_lib::make_shared<RegisteredPrefix>(registeredPrefixId, prefix, onInterest));
+
+        /// @todo Notify user about successful registration
+        
         // succeeded
-        break;
+        return;
       }
     case Tlv::FaceManagement::StatusResponse:
       {
         // failed :(
         StatusResponse resp;
-        resp.wireDecode(*content.getAll().begin());
+        resp.wireDecode(*val);
 
         std::cerr << "StatusReponse: " << resp << std::endl;
       
         onRegisterFailed(prefix);
         return;
-      
-        break;
       }
     default:
       {
@@ -178,16 +186,8 @@
       
         onRegisterFailed(prefix);
         return;
-        break;
       }
     }
-
-     
-  
-  // Save the onInterest callback and send the registration interest.
-  registeredPrefixTable_.push_back(ptr_lib::make_shared<RegisteredPrefix>(registeredPrefixId, prefix, onInterest));
-
-  /// @todo Notify user about successful registration
 }
 
 void