diff --git a/src/face.cpp b/src/face.cpp
index 4a5d5b8..d351c0a 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -235,6 +235,42 @@
   return reinterpret_cast<const RegisteredPrefixId*>(prefixToRegister.get());
 }
 
+const RegisteredPrefixId*
+Face::setInterestFilter(const Name& prefix,
+                        const OnInterest& onInterest,
+                        const OnSetInterestFilterFailed& onSetInterestFilterFailed,
+                        const IdentityCertificate& certificate)
+{
+  shared_ptr<RegisteredPrefix> prefixToRegister(new RegisteredPrefix(prefix, onInterest));
+
+  m_fwController->selfRegisterPrefix(prefixToRegister->getPrefix(),
+                                     bind(&RegisteredPrefixTable::push_back,
+                                          &m_registeredPrefixTable, prefixToRegister),
+                                     bind(onSetInterestFilterFailed,
+                                          prefixToRegister->getPrefix(), _1),
+                                     certificate);
+
+  return reinterpret_cast<const RegisteredPrefixId*>(prefixToRegister.get());
+}
+
+const RegisteredPrefixId*
+Face::setInterestFilter(const Name& prefix,
+                        const OnInterest& onInterest,
+                        const OnSetInterestFilterFailed& onSetInterestFilterFailed,
+                        const Name& identity)
+{
+  shared_ptr<RegisteredPrefix> prefixToRegister(new RegisteredPrefix(prefix, onInterest));
+
+  m_fwController->selfRegisterPrefix(prefixToRegister->getPrefix(),
+                                     bind(&RegisteredPrefixTable::push_back,
+                                          &m_registeredPrefixTable, prefixToRegister),
+                                     bind(onSetInterestFilterFailed,
+                                          prefixToRegister->getPrefix(), _1),
+                                     identity);
+
+  return reinterpret_cast<const RegisteredPrefixId*>(prefixToRegister.get());
+}
+
 void
 Face::unsetInterestFilter(const RegisteredPrefixId* registeredPrefixId)
 {
@@ -242,6 +278,22 @@
 }
 
 void
+Face::unsetInterestFilter(const RegisteredPrefixId* registeredPrefixId,
+                          const IdentityCertificate& certificate)
+{
+  m_ioService->post(bind(&Face::asyncUnsetInterestFilterWithCertificate, this,
+                         registeredPrefixId, certificate));
+}
+
+void
+Face::unsetInterestFilter(const RegisteredPrefixId* registeredPrefixId,
+                          const Name& identity)
+{
+  m_ioService->post(bind(&Face::asyncUnsetInterestFilterWithIdentity, this,
+                         registeredPrefixId, identity));
+}
+
+void
 Face::asyncUnsetInterestFilter(const RegisteredPrefixId* registeredPrefixId)
 {
   RegisteredPrefixTable::iterator i = std::find_if(m_registeredPrefixTable.begin(),
@@ -258,6 +310,42 @@
 }
 
 void
+Face::asyncUnsetInterestFilterWithCertificate(const RegisteredPrefixId* registeredPrefixId,
+                                              const IdentityCertificate& certificate)
+{
+  RegisteredPrefixTable::iterator i = std::find_if(m_registeredPrefixTable.begin(),
+                                                   m_registeredPrefixTable.end(),
+                                                   MatchRegisteredPrefixId(registeredPrefixId));
+  if (i != m_registeredPrefixTable.end())
+    {
+      m_fwController->selfDeregisterPrefix((*i)->getPrefix(),
+                                           bind(&Face::finalizeUnsetInterestFilter, this, i),
+                                           Controller::FailCallback(),
+                                           certificate);
+    }
+
+  // there cannot be two registered prefixes with the same id
+}
+
+void
+Face::asyncUnsetInterestFilterWithIdentity(const RegisteredPrefixId* registeredPrefixId,
+                                           const Name& identity)
+{
+  RegisteredPrefixTable::iterator i = std::find_if(m_registeredPrefixTable.begin(),
+                                                   m_registeredPrefixTable.end(),
+                                                   MatchRegisteredPrefixId(registeredPrefixId));
+  if (i != m_registeredPrefixTable.end())
+    {
+      m_fwController->selfDeregisterPrefix((*i)->getPrefix(),
+                                           bind(&Face::finalizeUnsetInterestFilter, this, i),
+                                           Controller::FailCallback(),
+                                           identity);
+    }
+
+  // there cannot be two registered prefixes with the same id
+}
+
+void
 Face::finalizeUnsetInterestFilter(RegisteredPrefixTable::iterator item)
 {
   m_registeredPrefixTable.erase(item);
