Separate InterestManger and DataManager from nlsr
diff --git a/nlsr.cpp b/nlsr.cpp
index 248382e..cff9c3c 100644
--- a/nlsr.cpp
+++ b/nlsr.cpp
@@ -5,115 +5,40 @@
 #include <cstdlib>
 
 #include "nlsr.hpp"
-#include "conf_processor.hpp"
 #include "conf_param.hpp"
-#include "nlsr_tokenizer.hpp"
-#include "adl.hpp"
-#include "adjacent.hpp"
+#include "conf_processor.hpp"
 
 
 using namespace ndn;
 using namespace std;
 
-void 
-nlsr::processInterest(const ptr_lib::shared_ptr<const Name> &name, 
-							const ptr_lib::shared_ptr<const Interest> &interest)
-{
-
-	cout << "<< I: " << *interest << endl;
-    
-    Data data(ndn::Name(interest->getName()).append("testApp").appendVersion());
-    data.setFreshnessPeriod(1000); // 10 sec
-
-    data.setContent((const uint8_t*)"HELLO KITTY", sizeof("HELLO KITTY"));
-
-    kChain.sign(data);
-
-    cout << ">> D: " << data << endl;
-    nlsrFace.put(data);
-}
-
 void
 nlsr::nlsrRegistrationFailed(const ptr_lib::shared_ptr<const Name>&)
 {
-	cerr << "ERROR: Failed to register prefix in local hub's daemon" << endl;
-    nlsrFace.shutdown();
+  cerr << "ERROR: Failed to register prefix in local hub's daemon" << endl;
+  nlsrFace.shutdown();
 }
 
+
 void
-nlsr::processContent(const ndn::ptr_lib::shared_ptr<const ndn::Interest> &interest,
-								 const ndn::ptr_lib::shared_ptr<ndn::Data> &data)
+nlsr::setInterestFilterNlsr(const string& name)
 {
-
-	cout << "I: " << interest->toUri() << endl;
-  	cout << "D: " << data->getName().toUri() << endl;
-	cout << "Data Content: " << data->getContent() << endl;
-
-}
-
-void
-nlsr::processInterestTimedOut(
-				const ndn::ptr_lib::shared_ptr<const ndn::Interest> &interest)
-{
-	cout << "Timed out interest : " << interest->getName().toUri() << endl;
-	string intName=	interest->getName().toUri();
-	cout << intName <<endl;
-	nlsrTokenizer nt(intName,"/");
-	string chkString("info");
-	if( nt.doesTokenExist(chkString) ){
-		string nbr=nt.getTokenString(0,nt.getTokenPosition(chkString)-1);
-		cout<<"Neighbor :"<<nbr<<endl;
-	}
-
-}
-
-void
-nlsr::setInterestFilterNlsr(const string& name){
-	nlsrFace.setInterestFilter(name,
-                        	func_lib::bind(&nlsr::processInterest, this, _1, _2),
+  nlsrFace.setInterestFilter(name,
+                        func_lib::bind(&interestManager::processInterest, &im, 
+                        boost::ref(*this), _1, _2),
                         func_lib::bind(&nlsr::nlsrRegistrationFailed, this, _1));
 }
 
+
 void
-nlsr::expressInterest(const string& interestNamePrefix, int scope, int seconds)
+nlsr::startEventLoop()
 {
-	Interest i((ndn::Name(interestNamePrefix)));
-    //i.setScope(scope);
-    i.setInterestLifetime(seconds*1000);
-    i.setMustBeFresh(true);
-
-	nlsrFace.expressInterest(i,
-                          ndn::func_lib::bind(&nlsr::processContent, this, _1, _2),
-                          ndn::func_lib::bind(&nlsr::processInterestTimedOut, this, _1));
-
-}
-
-
-void
-nlsr::scheduleInfoInterest(int seconds){
-	scheduler.scheduleEvent(ndn::time::seconds(seconds),
-							ndn::bind(&nlsr::sendScheduledInfoInterest, this,seconds));
-}
-
-void
-nlsr::sendScheduledInfoInterest(int seconds){
-
-	std::list<Adjacent> adjList=adl.getAdjList();
-	for(std::list<Adjacent>::iterator it	=adjList.begin(); it!= adjList.end(); ++it){
-		string adjName=(*it).getAdjacentName()+"/"+"info"+confParam.getRouterPrefix();
-		expressInterest(	adjName,2,confParam.getInterestResendTime());
-	}
-
-	scheduleInfoInterest(confParam.getInfoInterestInterval());
-}
-
-void
-nlsr::startEventLoop(){
 	nlsrFace.processEvents();
 }
 
 int 
-nlsr::usage(const string& progname){
+nlsr::usage(const string& progname)
+{
 
         cout << "Usage: " << progname << " [OPTIONS...]"<<endl;
         cout << "   NDN routing...." << endl;
@@ -138,9 +63,8 @@
 	nlsr.adl.printAdl();
 	nlsr.npl.printNpl();
 /* debugging purpose end */
-	nlsr.setInterestFilterNlsr("/ndn/memphis.edu/cs/pollux/");
-	
-	nlsr.scheduleInfoInterest(1);
+	nlsr.setInterestFilterNlsr(nlsr.confParam.getRouterPrefix());
+	nlsr.im.scheduleInfoInterest(nlsr,1);