face: specify registerPrefix signing parameters with CommandOptions

refs #2039

Change-Id: I26a49f155a776e38bf04e1a797c1472f3d88178c
diff --git a/src/detail/face-impl.hpp b/src/detail/face-impl.hpp
index eb286d7..5e3558b 100644
--- a/src/detail/face-impl.hpp
+++ b/src/detail/face-impl.hpp
@@ -36,6 +36,7 @@
 #include "transport/tcp-transport.hpp"
 
 #include "management/nfd-controller.hpp"
+#include "management/nfd-command-options.hpp"
 
 namespace ndn {
 
@@ -182,23 +183,21 @@
   /////////////////////////////////////////////////////////////////////////////////////////////////
   /////////////////////////////////////////////////////////////////////////////////////////////////
 
-  template<class SignatureGenerator>
   const RegisteredPrefixId*
   registerPrefix(const Name& prefix,
                  const shared_ptr<InterestFilterRecord>& filter,
                  const RegisterPrefixSuccessCallback& onSuccess,
                  const RegisterPrefixFailureCallback& onFailure,
                  uint64_t flags,
-                 const SignatureGenerator& signatureGenerator)
+                 const nfd::CommandOptions& options)
   {
     using namespace nfd;
 
-    typedef void (nfd::Controller::*Registrator)
-      (const nfd::ControlParameters&,
-       const nfd::Controller::CommandSucceedCallback&,
-       const nfd::Controller::CommandFailCallback&,
-       const SignatureGenerator&,
-       const time::milliseconds&);
+    typedef void (Controller::*Registrator)
+      (const ControlParameters&,
+       const Controller::CommandSucceedCallback&,
+       const Controller::CommandFailCallback&,
+       const CommandOptions&);
 
     ControlParameters registerParameters, unregisterParameters;
     registerParameters.setName(prefix);
@@ -217,9 +216,9 @@
     }
 
     RegisteredPrefix::Unregistrator bindedUnregistrator =
-        ndn::bind(unregistrator, m_face.m_nfdController, unregisterParameters, _1, _2,
-                  signatureGenerator,
-                  m_face.m_nfdController->getDefaultCommandTimeout());
+        std::bind(unregistrator, m_face.m_nfdController, unregisterParameters, _1, _2,
+                  options);
+    // @todo get rid of "std::" after #2109
 
     shared_ptr<RegisteredPrefix> prefixToRegister =
       make_shared<RegisteredPrefix>(prefix, filter, bindedUnregistrator);
@@ -228,8 +227,7 @@
                                              bind(&Impl::afterPrefixRegistered, this,
                                                   prefixToRegister, onSuccess),
                                              bind(onFailure, prefixToRegister->getPrefix(), _2),
-                                             signatureGenerator,
-                                             m_face.m_nfdController->getDefaultCommandTimeout());
+                                             options);
 
     return reinterpret_cast<const RegisteredPrefixId*>(prefixToRegister.get());
   }
diff --git a/src/face.cpp b/src/face.cpp
index b24a436..66e61bf 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -239,10 +239,17 @@
   shared_ptr<InterestFilterRecord> filter =
     make_shared<InterestFilterRecord>(interestFilter, onInterest);
 
+  nfd::CommandOptions options;
+  if (certificate.getName().empty()) {
+    options.setSigningDefault();
+  }
+  else {
+    options.setSigningCertificate(certificate);
+  }
+
   return m_impl->registerPrefix(interestFilter.getPrefix(), filter,
                                 onSuccess, onFailure,
-                                flags,
-                                certificate);
+                                flags, options);
 }
 
 const RegisteredPrefixId*
@@ -255,10 +262,17 @@
   shared_ptr<InterestFilterRecord> filter =
     make_shared<InterestFilterRecord>(interestFilter, onInterest);
 
+  nfd::CommandOptions options;
+  if (certificate.getName().empty()) {
+    options.setSigningDefault();
+  }
+  else {
+    options.setSigningCertificate(certificate);
+  }
+
   return m_impl->registerPrefix(interestFilter.getPrefix(), filter,
                                 RegisterPrefixSuccessCallback(), onFailure,
-                                flags,
-                                certificate);
+                                flags, options);
 }
 
 const RegisteredPrefixId*
@@ -272,10 +286,12 @@
   shared_ptr<InterestFilterRecord> filter =
     make_shared<InterestFilterRecord>(interestFilter, onInterest);
 
+  nfd::CommandOptions options;
+  options.setSigningIdentity(identity);
+
   return m_impl->registerPrefix(interestFilter.getPrefix(), filter,
                                 onSuccess, onFailure,
-                                flags,
-                                identity);
+                                flags, options);
 }
 
 const RegisteredPrefixId*
@@ -288,10 +304,12 @@
   shared_ptr<InterestFilterRecord> filter =
     make_shared<InterestFilterRecord>(interestFilter, onInterest);
 
+  nfd::CommandOptions options;
+  options.setSigningIdentity(identity);
+
   return m_impl->registerPrefix(interestFilter.getPrefix(), filter,
                                 RegisterPrefixSuccessCallback(), onFailure,
-                                flags,
-                                identity);
+                                flags, options);
 }
 
 
@@ -314,10 +332,17 @@
                      const IdentityCertificate& certificate,
                      uint64_t flags)
 {
+  nfd::CommandOptions options;
+  if (certificate.getName().empty()) {
+    options.setSigningDefault();
+  }
+  else {
+    options.setSigningCertificate(certificate);
+  }
+
   return m_impl->registerPrefix(prefix, shared_ptr<InterestFilterRecord>(),
                                 onSuccess, onFailure,
-                                flags,
-                                certificate);
+                                flags, options);
 }
 
 const RegisteredPrefixId*
@@ -327,10 +352,12 @@
                      const Name& identity,
                      uint64_t flags)
 {
+  nfd::CommandOptions options;
+  options.setSigningIdentity(identity);
+
   return m_impl->registerPrefix(prefix, shared_ptr<InterestFilterRecord>(),
                                 onSuccess, onFailure,
-                                flags,
-                                identity);
+                                flags, options);
 }
 
 void