diff --git a/Makefile b/Makefile
index 3236fe6..313a3ac 100644
--- a/Makefile
+++ b/Makefile
@@ -1,20 +1,20 @@
-CC = cc
-CFLAGS = -g -Wall -Wpointer-arith -Wreturn-type -Wstrict-prototypes
-LIBS = -lccn -lcrypto
+CC = gcc
+CFLAGS = -g -Wall -gdwarf-2 -g3 
+LIBS = -lccn -lccnsync -lcrypto 
 
 PROGRAMS = nlsrc nlsr
 INSTALL_PATH=/usr/local/bin/
 
-NLSR_SRCS=nlsr.c nlsr_ndn.c nlsr_npl.c  nlsr_adl.c nlsr_lsdb.c nlsr_route.c nlsr_npt.c nlsr_fib.c utility.c
+NLSR_SRCS=nlsr.c nlsr_ndn.c nlsr_npl.c  nlsr_adl.c nlsr_lsdb.c nlsr_route.c nlsr_npt.c nlsr_fib.c nlsr_sync.c  nlsr_face.c utility.c
 NLSRC_SRCS=nlsrc.c
 
 all: $(PROGRAMS)
 
 nlsr: $(NLSR_SRCS)
-	$(CC) $(CFLAGS) $(NLSR_SRCS) -o nlsr $(LIBS) -lm
+	$(CC) $(CFLAGS) $(NLSR_SRCS) $(LIBS) -lm -o nlsr
 
 nlsrc: $(NLSRC_SRCS)
-	$(CC) $(CFLAGS) $(NLSRC_SRCS) -o nlsrc $(LIBS) -lm
+	$(CC) $(CFLAGS) $(NLSRC_SRCS) $(LIBS) -lm -o nlsrc
 
 install: $(PROGRAMS)
 	cp $(PROGRAMS) $(INSTALL_PATH)
diff --git a/NLSR_Timing_Diagram.odg b/NLSR_Timing_Diagram.odg
index 41e9837..820b307 100644
--- a/NLSR_Timing_Diagram.odg
+++ b/NLSR_Timing_Diagram.odg
Binary files differ
diff --git a/macbook.conf b/macbook.conf
index 19b6c30..05389cc 100644
--- a/macbook.conf
+++ b/macbook.conf
@@ -1,17 +1,25 @@
 #----configuration file for macbook----------
 #
-router-name /ndn/memphis.edu/netlab/macbook/
-ccnneighbor /ndn/memphis.edu/dunhall/castor face9
-ccnneighbor /ndn/memphis.edu/pollux face38
-ccnname /ndn/memphis.edu/patterson
-ccnname /ndn/memphis.edu/houston/
+router-name /ndn/memphis.edu/netlab/macbook
+ccnneighbor /ndn/memphis.edu/cs/maia
+ccnneighbor /ndn/memphis.edu/cs/mira
+ccnneighbor /ndn/memphis.edu/cs/castor
+ccnneighbor /ndn/router/pollux 141.225.11.132
+ccnname /ndn/memphis.edu/macbook/patterson
+ccnname /ndn/memphis.edu/macbook/houston/
 #------lsdb-synch-interval-----
-lsdb-synch-interval 350
+#lsdb-synch-interval 350
 interest-retry 2 
 interest-resend-time 5
 lsa-refresh-time 600
 router-dead-interval 900
-multi-path-face-num 2 
-#debug on
+max_faces_per_prefix 1 
+debug on
+hyperbolic-routing on
+hyperbolic-cordinate 1234.0 0.875
+tunnel-type udp
+
+topo-prefix /ndn/routing/nlsr/
+slice-prefix /ndn/routing/nlsr/LSA
 
 logdir /Users/akmhoque/NLSR2.0
diff --git a/nlsr-sync-0.0/1 b/nlsr-sync-0.0/1
deleted file mode 100755
index dfc274e..0000000
--- a/nlsr-sync-0.0/1
+++ /dev/null
@@ -1,8 +0,0 @@
-router-name /ndn/memphis.edu/netlab/macbook
-ccnneighbor /ndn/memphis.edu/dunhall/castor face9
-ccnneighbor /ndn/memphis.edu/joneshall/mira face11
-ccnname /ndn/memphis.edu/patterson
-ccnname /ndn/memphis.edu/houston
-lsdb-synch-interval 350
-interest-retry 4
-interest-resend-time 5
diff --git a/nlsr-sync-0.0/Makefile b/nlsr-sync-0.0/Makefile
deleted file mode 100755
index 313a3ac..0000000
--- a/nlsr-sync-0.0/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-CC = gcc
-CFLAGS = -g -Wall -gdwarf-2 -g3 
-LIBS = -lccn -lccnsync -lcrypto 
-
-PROGRAMS = nlsrc nlsr
-INSTALL_PATH=/usr/local/bin/
-
-NLSR_SRCS=nlsr.c nlsr_ndn.c nlsr_npl.c  nlsr_adl.c nlsr_lsdb.c nlsr_route.c nlsr_npt.c nlsr_fib.c nlsr_sync.c  nlsr_face.c utility.c
-NLSRC_SRCS=nlsrc.c
-
-all: $(PROGRAMS)
-
-nlsr: $(NLSR_SRCS)
-	$(CC) $(CFLAGS) $(NLSR_SRCS) $(LIBS) -lm -o nlsr
-
-nlsrc: $(NLSRC_SRCS)
-	$(CC) $(CFLAGS) $(NLSRC_SRCS) $(LIBS) -lm -o nlsrc
-
-install: $(PROGRAMS)
-	cp $(PROGRAMS) $(INSTALL_PATH)
-	cd $(INSTALL_PATH); chown root:0 $(PROGRAMS); chmod 755 $(PROGRAMS)
-
-uninstall:
-	cd $(INSTALL_PATH); rm -f $(PROGRAMS)
-
-clean:
-	rm -f *.o
-	rm -f $(PROGRAMS)
-	rm -rf *.dSYM
-
-.c.o:
-	$(CC) $(CFLAGS) -c $<
-
-.PHONY: all clean
diff --git a/nlsr-sync-0.0/NLSR_Design.docx b/nlsr-sync-0.0/NLSR_Design.docx
deleted file mode 100755
index c9070c6..0000000
--- a/nlsr-sync-0.0/NLSR_Design.docx
+++ /dev/null
Binary files differ
diff --git a/nlsr-sync-0.0/NLSR_Timing_Diagram.odg b/nlsr-sync-0.0/NLSR_Timing_Diagram.odg
deleted file mode 100755
index 820b307..0000000
--- a/nlsr-sync-0.0/NLSR_Timing_Diagram.odg
+++ /dev/null
Binary files differ
diff --git a/nlsr-sync-0.0/README b/nlsr-sync-0.0/README
deleted file mode 100644
index bd4039a..0000000
--- a/nlsr-sync-0.0/README
+++ /dev/null
@@ -1,4 +0,0 @@
-Only experimental code here for nlsr using parc's sync implementation.
-It's not a working version, so don't rely on it at all.
-This README will be updated once the code is in working condition. 
-
diff --git a/nlsr-sync-0.0/README.md b/nlsr-sync-0.0/README.md
deleted file mode 100755
index 18880a1..0000000
--- a/nlsr-sync-0.0/README.md
+++ /dev/null
@@ -1,111 +0,0 @@
-NLSR0.0
-=======
-
-Named-data Link State Routing ( NLSR ):
-  NLSR is routing protocol caluclate routing table dynamically and manipulate 
-ccnd forwarding information base (FIB) based on routing table.
-
-1. Download:
-	Check out the code from the github by following
-git://github.com/NDN-Routing/NLSR0.0.git
-
-2. Installation:
-	For installation of NLSR you must need to have ccnd installed. Go to NLSR0.0.
-Then make it and install by following
-
-$make
-$sudo make install
-
-3. Configuring NLSR:
-	For the explanation of configuring NLSR, we will consider following network topology.
-
-
-                                ---------
-                                |       |
-                                |       |  /ndn/memphis.edu/castor
-                                ---------
-                           face9/       \ face11
-                               /         \
-                              /           \
-                             /             \
-                       face7/               \ face10
-                   ---------               ---------                    ---------
-                   |       |face8   face11 |       |face13         face7|       |
-                   |       |---------------|       |--------------------|       |
-                   ---------               ---------                    ---------
-           -/ndn/memphis.edu/pollux     /ndn/memphis.edu/mira     /ndn/memphis.edu/sirius
-		
-
-3.1 Creating faces for neighbors
-	For configuring of NLSR first system admin first need to create faces for the neighbors.
-For router having router-name /ndn/memphis.edu/castor, system admin need to create two faces for
-neighbors routers /ndn/memphis.edu/pollux and /ndn/memphis.edu/mira. By ccndc utility one can
-create face as below
-
-$ccndc add /ndn/memphis.edu/pollux udp pollux.cs.memphis.edu
-$ccndc add /ndn/memphis.edu/mira udp mira.cs.memphis.edu
-
-Let us assume that that face id for /ndn/memphis.edu/pollux is 9 and /ndn/memphis.edu/mira is 11.
-
-3.2 Configuration Commands
-3.2.1 router-name /name/prefix/of/router
-	router-name commands assigns name of the router. Router-name is unique in the network and
-maintained by name management. This is mandatory configuration command.
-
-3.2.2 ccnneighbor /name/prefix/of/neighbor/router faceX.
-	By this command router configures neighboring router. X is integer and must be precedeed 
-by "face". faceX is the connecting face for that neighbors.
-
-3.2.3 ccnname /name/prefix/to/be/advertised
-	With this configuration command router advertise name prefix
-
-3.2.4 lsdb-synch-interval secs
-	its the time interval after which neighbors will synchronize Link State Database. Default
-value is 300.
-
-3.2.5 interest-retry tries
-	its number of tries router will try if interest is timed out. Defualt value is 3.
-
-3.2.6 interest-resend-time secs
-	its the amount of time after which interest for a content will timed out. Defualt value
-is 15.
-
-3.2.7 lsa-refresh-time secs
-	its the amount of time after which router will regenerate its own LSDB and regenerate
-every LSA. Default value is 1800.
-
-3.2.8 router-dead-interval secs
-	its the amounnt of time after which a router will consider its neighbor dead if it does
-not hear anything from the neighbor. Default value 3600.
-
-3.2.9 multi-path-face-num n
-	with this command one activate to do multi-path routing. If n is greater than 1 then
-multi-path is triggered on and n faces will be added in ccnd fib after routing table calculation.
-Default value is 0 and then NLSR perform single path routing.
-
-3.2.10 logdir path/to/log/dir
-	By this command one can configure where NLSR will write logfiles. By default NLSR will
-write log file to /home/nlsrLog/ directory.
-
-3.3 Sample configuration file
-	Let assume that router /ndn/memphis.edu/castor wants to advertise two names 
-/ndn/memphis.edu/cslab/netlab and /ndn/memphis.edu/cslab/wisemanet. Configuration file for 
-/ndn/memphis.edu/castor will look like below 
-
-!-----Configuration file starts here
-
-router-name /ndn/memphis.edu/castor
-ccnneighbor /ndn/memphis.edu/mira face10
-ccnneighbor /ndn/memphis.edu/pollux face9
-ccnname /ndn/memphis.edu/cslab/netlab
-ccnname /ndn/memphis.edu/cslab/wisemanet
-
-lsdb-synch-interval 350
-interest-retry 3 
-interest-resend-time 10
-lsa-refresh-time 1800
-router-dead-interval 3600
-multi-path-face-num 2
-logdir /home/nlsrLog/ 
-
-!-----Configuration file ends here
diff --git a/nlsr-sync-0.0/docs/FigureSource.odg b/nlsr-sync-0.0/docs/FigureSource.odg
deleted file mode 100644
index fd7f796..0000000
--- a/nlsr-sync-0.0/docs/FigureSource.odg
+++ /dev/null
Binary files differ
diff --git a/nlsr-sync-0.0/docs/NLSR Sync-v1.pptx b/nlsr-sync-0.0/docs/NLSR Sync-v1.pptx
deleted file mode 100644
index cbd9620..0000000
--- a/nlsr-sync-0.0/docs/NLSR Sync-v1.pptx
+++ /dev/null
Binary files differ
diff --git a/nlsr-sync-0.0/docs/NLSR Sync.pptx b/nlsr-sync-0.0/docs/NLSR Sync.pptx
deleted file mode 100644
index 61a4474..0000000
--- a/nlsr-sync-0.0/docs/NLSR Sync.pptx
+++ /dev/null
Binary files differ
diff --git a/nlsr-sync-0.0/docs/NLSR_Design_Doc.odg b/nlsr-sync-0.0/docs/NLSR_Design_Doc.odg
deleted file mode 100644
index bd38d2c..0000000
--- a/nlsr-sync-0.0/docs/NLSR_Design_Doc.odg
+++ /dev/null
Binary files differ
diff --git a/nlsr-sync-0.0/docs/NLSR_Manual.doc b/nlsr-sync-0.0/docs/NLSR_Manual.doc
deleted file mode 100644
index 9449934..0000000
--- a/nlsr-sync-0.0/docs/NLSR_Manual.doc
+++ /dev/null
Binary files differ
diff --git a/nlsr-sync-0.0/macbook.conf b/nlsr-sync-0.0/macbook.conf
deleted file mode 100755
index 9e5835c..0000000
--- a/nlsr-sync-0.0/macbook.conf
+++ /dev/null
@@ -1,25 +0,0 @@
-#----configuration file for macbook----------
-#
-router-name /ndn/memphis.edu/netlab/macbook
-ccnneighbor /ndn/memphis.edu/cs/maia
-ccnneighbor /ndn/memphis.edu/cs/mira
-ccnneighbor /ndn/memphis.edu/cs/castor
-ccnneighbor /ndn/router/pollux 141.225.11.132
-ccnname /ndn/memphis.edu/macbook/patterson
-ccnname /ndn/memphis.edu/macbook/houston/
-#------lsdb-synch-interval-----
-#lsdb-synch-interval 350
-interest-retry 2 
-interest-resend-time 5
-lsa-refresh-time 600
-router-dead-interval 900
-max_faces_per_prefix 1 
-debug on
-#hyperbolic-routing on
-#hyperbolic-cordinate 1234.0 0.875
-tunnel-type udp
-
-topo-prefix /ndn/routing/nlsr/
-slice-prefix /ndn/routing/nlsr/LSA
-
-logdir /Users/akmhoque/NLSR2.0
diff --git a/nlsr-sync-0.0/nlsr.c b/nlsr-sync-0.0/nlsr.c
deleted file mode 100755
index 351554f..0000000
--- a/nlsr-sync-0.0/nlsr.c
+++ /dev/null
@@ -1,1403 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <assert.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-#include <ccn/sync.h>
-#include <ccn/seqwriter.h>
-
-#include "nlsr.h"
-#include "nlsr_ndn.h"
-#include "nlsr_lsdb.h"
-#include "utility.h"
-#include "nlsr_npl.h"
-#include "nlsr_adl.h"
-#include "nlsr_npt.h"
-#include "nlsr_route.h"
-#include "nlsr_sync.h"
-#include "nlsr_face.h"
-#include "nlsr_fib.h"
-
-
-#define ON_ERROR_DESTROY(resval) \
-{           \
-    if ((resval) < 0) { \
-        nlsr_destroy(); \
-	exit(1);\
-    } \
-}
-
-
-#define ON_ERROR_EXIT(resval) \
-{           \
-    if ((resval) < 0) { \
-        exit(1); \
-    } \
-}
-
-struct option longopts[] =
-{
-    { "daemon",      no_argument,       NULL, 'd'},
-    { "config_file", required_argument, NULL, 'f'},
-    { "api_port",    required_argument, NULL, 'p'},
-    { "help",        no_argument,       NULL, 'h'},
-    { 0 }
-};
-
-static int 
-usage(char *progname)
-{
-
-    printf("Usage: %s [OPTIONS...]\n\
-	NDN routing....\n\
-	-d, --daemon        Run in daemon mode\n\
-	-f, --config_file   Specify configuration file name\n\
-	-p, --api_port      port where api client will connect\n\
-	-h, --help          Display this help message\n", progname);
-
-    exit(1);
-}
-
-void ndn_rtr_gettime(const struct ccn_gettime *self, struct ccn_timeval *result)
-{
-    struct timeval now = {0};
-    gettimeofday(&now, 0);
-    result->s = now.tv_sec;
-    result->micros = now.tv_usec;
-}
-
-static struct ccn_gettime ndn_rtr_ticker = {
-    "timer",
-    &ndn_rtr_gettime,
-    1000000,
-    NULL
-};
-
-void
-nlsr_lock(void)
-{
-	nlsr->semaphor=NLSR_LOCKED;
-}
-
-void
-nlsr_unlock(void)
-{
-	nlsr->semaphor=NLSR_UNLOCKED;
-}
-
-void 
-nlsr_stop_signal_handler(int sig)
-{
-	signal(sig, SIG_IGN);
- 	nlsr_destroy();
-	exit(0);	
-}
-
-void  
-daemonize_nlsr(void)
-{
-	int ret;
-	pid_t process_id = 0;
-	pid_t sid = 0;
-	process_id = fork();
-	if (process_id < 0)
-	{
-		printf("Daemonization failed!\n");
-		ON_ERROR_DESTROY(process_id);
-	}
-	if (process_id > 0)
-	{
-		printf("Process daemonized. Process id: %d \n", process_id);
-		ret=process_id;
-		exit(0);
-	}
-	
-	umask(0);
-	sid = setsid();
-	if(sid < 0)
-	{
-		ON_ERROR_DESTROY(sid);		
-	}
-	
-	chdir("/");	
-	close(STDIN_FILENO);
-	close(STDOUT_FILENO);
-	close(STDERR_FILENO);
-}
-
-void 
-process_command_ccnneighbor(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( ccnneighbor router_name faceX)\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *rtr_name;
-	char *nbr_ip_addr;
-	int is_ip_configured=0;
-	//char *face;
-	char *ip_addr=(char *)malloc(13);
-	memset(ip_addr,0,13);
-
-	rtr_name=strtok_r(command,sep,&rem);
-	if(rtr_name==NULL)
-	{
-		printf(" Wrong Command Format ( ccnneighbor router_name faceX)\n");
-		return;
-	}
-	if ( rtr_name[strlen(rtr_name)-1] == '/' )
-	{
-		rtr_name[strlen(rtr_name)-1]='\0';
-	}
-
-	if (rem != NULL )
-	{
-		nbr_ip_addr=strtok_r(NULL,sep,&rem);
-		is_ip_configured=1;
-	}
-	struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	nbr->name=(char *)malloc(strlen(rtr_name)+1);
-	memset(nbr->name,0,strlen(rtr_name)+1);
-	memcpy(nbr->name,rtr_name,strlen(rtr_name)+1);
-	nbr->length=strlen(rtr_name)+1;
-
-	
-	if ( !is_ip_configured )
-	{
-		struct name_prefix *nbr_name=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-		get_host_name_from_command_string(nbr_name,nbr->name,0);
-		printf("Hostname of neighbor: %s ",nbr_name->name);
-		get_ip_from_hostname_02(nbr_name->name,ip_addr);
-		printf("IP Address: %s \n",ip_addr);
-		free(nbr_name->name);
-		free(nbr_name);
-	}
-	else
-	{
-		memcpy(ip_addr,nbr_ip_addr,strlen(nbr_ip_addr));
-		printf("Name of neighbor: %s ",nbr->name);
-		printf("IP Address: %s \n",ip_addr);
-	}
-	add_nbr_to_adl(nbr,0,ip_addr);
-	
-
-	free(nbr->name);
-	free(nbr);
-}
-
-void 
-process_command_ccnname(char *command)
-{
-
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( ccnname /name/prefix)\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *name;
-	name=strtok_r(command,sep,&rem);
-	if(name==NULL)
-	{
-		printf(" Wrong Command Format ( ccnname /name/prefix/ )\n");
-		return;
-	}
-
-	printf("Name Prefix: %s \n",name);
-
-	if ( name[strlen(name)-1] == '/' )
-		name[strlen(name)-1]='\0';
-
-	struct name_prefix *np=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	np->name=(char *)malloc(strlen(name)+1);
-	memset(np->name,0,strlen(name)+1);
-	memcpy(np->name,name,strlen(name)+1);
-	np->length=strlen(name)+1;
-
-	add_name_to_npl(np);
-
-	free(np->name);
-	free(np);
-}
-
-
-void 
-process_command_router_name(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( router-name /router/name )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *rtr_name;
-
-	rtr_name=strtok_r(command,sep,&rem);
-	if(rtr_name==NULL)
-	{
-		printf(" Wrong Command Format ( router-name /router/name )\n");
-		return;
-	}
-	
-
-	if ( rtr_name[strlen(rtr_name)-1] == '/' )
-		rtr_name[strlen(rtr_name)-1]='\0';
-
-	nlsr->router_name=(char *)malloc(strlen(rtr_name)+1);
-	memset(nlsr->router_name,0,strlen(rtr_name)+1);
-	memcpy(nlsr->router_name,rtr_name,strlen(rtr_name)+1);
-
-
-}
-
-/*
-void 
-process_command_lsdb_synch_interval(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( lsdb-synch-interval secs )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *secs;
-	long int seconds;
-	
-	secs=strtok_r(command,sep,&rem);
-	if(secs==NULL)
-	{
-		printf(" Wrong Command Format ( lsdb-synch-interval secs)\n");
-		return;
-	}
-
-	seconds=atoi(secs);
-	if ( seconds >= 120 && seconds <= 3600 )
-	{
-		nlsr->lsdb_synch_interval=seconds;
-	}
-
-}
-*/
-
-void 
-process_command_interest_retry(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( interest-retry number )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *retry;
-	long int retry_number;
-	
-	retry=strtok_r(command,sep,&rem);
-	if(retry==NULL)
-	{
-		printf(" Wrong Command Format ( interest-retry number)\n");
-		return;
-	}
-
-	retry_number=atoi(retry);
-	if ( retry_number >= 1 && retry_number<=10 )
-	{
-		nlsr->interest_retry=retry_number;
-	}
-
-}
-
-void 
-process_command_interest_resend_time(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( interest-resend-time secs )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *secs;
-	long int seconds;
-	
-	secs=strtok_r(command,sep,&rem);
-	if(secs==NULL)
-	{
-		printf(" Wrong Command Format ( interest-resend-time secs)\n");
-		return;
-	}
-
-	seconds=atoi(secs);
-	if ( seconds <= 60 && seconds >= 1 )
-	{
-		nlsr->interest_resend_time=seconds;
-	}
-}
-
-
-void 
-process_command_lsa_refresh_time(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( lsa-refresh-time secs )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *secs;
-	long int seconds;
-	
-	secs=strtok_r(command,sep,&rem);
-	if(secs==NULL)
-	{
-		printf(" Wrong Command Format ( lsa-refresh-time secs)\n");
-		return;
-	}
-
-	seconds=atoi(secs);
-	if ( seconds >= 240)
-	{
-		nlsr->lsa_refresh_time=seconds;
-		if ( nlsr->router_dead_interval < nlsr->lsa_refresh_time * 2 )
-		{
-			nlsr->router_dead_interval=2*nlsr->lsa_refresh_time;
-		}
-	}
-
-}
-
-void 
-process_command_router_dead_interval(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( router-dead-interval secs )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *secs;
-	long int seconds;
-	
-	secs=strtok_r(command,sep,&rem);
-	if(secs==NULL)
-	{
-		printf(" Wrong Command Format ( router-dead-interval secs)\n");
-		return;
-	}
-
-	seconds=atoi(secs);
-	if ( seconds >= 480 )
-	{
-		nlsr->router_dead_interval=seconds;
-		if ( nlsr->router_dead_interval < nlsr->lsa_refresh_time * 2 )
-		{
-			nlsr->router_dead_interval=2*nlsr->lsa_refresh_time;
-		}
-	}
-
-}
-
-void 
-process_command_max_faces_per_prefix(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( max-faces-per-prefix n )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *num;
-	long int number;
-	
-	num=strtok_r(command,sep,&rem);
-	if(num==NULL)
-	{
-		printf(" Wrong Command Format ( max-faces-per-prefix n)\n");
-		return;
-	}
-
-	number=atoi(num);
-	if ( number >= 0 && number <= 60 )
-	{
-		nlsr->max_faces_per_prefix=number;
-	}
-
-}
-
-void 
-process_command_logdir(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( logdir /path/to/logdir )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *dir;
-
-	dir=strtok_r(command,sep,&rem);
-	if(dir==NULL)
-	{
-		printf(" Wrong Command Format ( logdir /path/to/logdir/ )\n");
-		return;
-	}
-	
-	nlsr->logDir=(char *)malloc(strlen(dir)+1);
-	memset(nlsr->logDir,0,strlen(dir)+1);
-	memcpy(nlsr->logDir,dir,strlen(dir));
-}
-
-void 
-process_command_detailed_log(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( detailed-log on/off )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *on_off;
-
-	on_off=strtok_r(command,sep,&rem);
-	if(on_off==NULL)
-	{
-		printf(" Wrong Command Format ( detailed-log on/off )\n");
-		return;
-	}
-	
-	if ( strcmp(on_off,"ON") == 0  || strcmp(on_off,"on") == 0)
-	{
-		nlsr->detailed_logging=1;
-	}
-}
-
-void 
-process_command_debug(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( debug on/off )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *on_off;
-
-	on_off=strtok_r(command,sep,&rem);
-	if(on_off==NULL)
-	{
-		printf(" Wrong Command Format ( debug on/off )\n");
-		return;
-	}
-	
-	if ( strcmp(on_off,"ON") == 0 || strcmp(on_off,"on") == 0 )
-	{
-		nlsr->debugging=1;
-	}
-}
-
-
-void 
-process_command_topo_prefix(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( topo-prefix )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *topo_prefix;
-
-	topo_prefix=strtok_r(command,sep,&rem);
-	if(topo_prefix==NULL)
-	{
-		printf(" Wrong Command Format (  topo-prefix /name/prefix  )\n");
-		return;
-	}
-	else
-	{
-		if( nlsr->topo_prefix != NULL)	
-			free(nlsr->topo_prefix);
-		if ( topo_prefix[strlen(topo_prefix)-1] == '/' )
-			topo_prefix[strlen(topo_prefix)-1]='\0';
-
-		nlsr->topo_prefix=(char *)malloc(strlen(topo_prefix)+1);
-		memset(nlsr->topo_prefix,0,strlen(topo_prefix)+1);
-		puts(topo_prefix);
-		memcpy(nlsr->topo_prefix,topo_prefix,strlen(topo_prefix));
-
-	}
-}
-
-
-void 
-process_command_slice_prefix(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( slice-prefix /name/prefix )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *slice_prefix;
-
-	slice_prefix=strtok_r(command,sep,&rem);
-	if(slice_prefix==NULL)
-	{
-		printf(" Wrong Command Format (  slice-prefix /name/prefix  )\n");
-		return;
-	}
-	else
-	{
-		if ( nlsr->slice_prefix != NULL)
-			free(nlsr->slice_prefix);
-		if ( slice_prefix[strlen(slice_prefix)-1] == '/' )
-			slice_prefix[strlen(slice_prefix)-1]='\0';
-
-		nlsr->slice_prefix=(char *)malloc(strlen(slice_prefix)+1);
-		memset(nlsr->slice_prefix,0,strlen(slice_prefix)+1);
-		memcpy(nlsr->slice_prefix,slice_prefix,strlen(slice_prefix));
-	}
-}
-
-void 
-process_command_hyperbolic_routing(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( hyperbolic-routing on)\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *on_off;
-
-	on_off=strtok_r(command,sep,&rem);
-	if(on_off==NULL)
-	{
-		printf(" Wrong Command Format ( hyperbolic-routing on )\n");
-		return;
-	}
-	
-	if ( strcmp(on_off,"ON") == 0 || strcmp(on_off,"on") == 0 )
-	{
-		nlsr->is_hyperbolic_calc=1;
-	}
-}
-
-void
-process_command_hyperbolic_cordinate(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( hyperbolic r 0 )\n");
-		return;
-	}
-
-	char *rem;
-	const char *sep=" \t\n\r";
-	char *radious;
-	char *theta;
-
-	radious=strtok_r(command,sep,&rem);
-	if (radious == NULL )
-	{
-		printf(" Wrong Command Format ( hyperbolic r 0 )\n");
-		return;
-	}
-
-	theta=strtok_r(NULL,sep,&rem);
-	if (theta == NULL )
-	{
-		printf(" Wrong Command Format ( hyperbolic r 0 )\n");
-		return;
-	}
-
-	nlsr->cor_r=strtof(radious,NULL);
-	nlsr->cor_theta=strtof(theta,NULL);
-
-}
-
-void 
-process_command_tunnel_type(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( tunnel-type udp/tcp)\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *on_off;
-
-	on_off=strtok_r(command,sep,&rem);
-	if(on_off==NULL)
-	{
-		printf(" Wrong Command Format ( tunnel-type udp/tcp )\n");
-		return;
-	}
-	
-	if ( strcmp(on_off,"TCP") == 0 || strcmp(on_off,"tcp") == 0 )
-	{
-		nlsr->tunnel_type=IPPROTO_TCP;
-	}
-	else if ( strcmp(on_off,"UDP") == 0 || strcmp(on_off,"udp") == 0 )
-	{
-		nlsr->tunnel_type=IPPROTO_UDP;
-	}
-}
-
-void 
-process_conf_command(char *command)
-{
-	const char *separators=" \t\n";
-	char *remainder=NULL;
-	char *cmd_type=NULL;
-
-	if(command==NULL || strlen(command)==0 || command[0]=='!')
-		return;	
-
-	cmd_type=strtok_r(command,separators,&remainder);
-
-	if(!strcmp(cmd_type,"router-name") )
-	{
-		process_command_router_name(remainder);
-	}
-	else if(!strcmp(cmd_type,"ccnneighbor") )
-	{
-		process_command_ccnneighbor(remainder);
-	} 
-	else if(!strcmp(cmd_type,"ccnname") )
-	{
-		process_command_ccnname(remainder);
-	}
-	/*else if(!strcmp(cmd_type,"lsdb-synch-interval") )
-	{
-		process_command_lsdb_synch_interval(remainder);
-	}*/
-	else if(!strcmp(cmd_type,"interest-retry") )
-	{
-		process_command_interest_retry(remainder);
-	}
-	else if(!strcmp(cmd_type,"interest-resend-time") )
-	{
-		process_command_interest_resend_time(remainder);
-	}
-	else if(!strcmp(cmd_type,"lsa-refresh-time") )
-	{
-		process_command_lsa_refresh_time(remainder);
-	}
-	else if(!strcmp(cmd_type,"router-dead-interval") )
-	{
-		process_command_router_dead_interval(remainder);
-	}
-	else if(!strcmp(cmd_type,"max-faces-per-prefix") )
-	{
-		process_command_max_faces_per_prefix(remainder);
-	}
-	else if(!strcmp(cmd_type,"logdir") )
-	{
-			process_command_logdir(remainder);
-	}
-	else if(!strcmp(cmd_type,"detailed-log") )
-	{
-			process_command_detailed_log(remainder);
-	}
-	else if(!strcmp(cmd_type,"debug") )
-	{
-			process_command_debug(remainder);
-	}
-	else if(!strcmp(cmd_type,"topo-prefix") )
-	{
-			process_command_topo_prefix(remainder);
-	}
-	else if(!strcmp(cmd_type,"slice-prefix") )
-	{
-			process_command_slice_prefix(remainder);
-	}
-	else if(!strcmp(cmd_type,"hyperbolic-cordinate") )
-	{
-		process_command_hyperbolic_cordinate(remainder);
-	}
-	else if(!strcmp(cmd_type,"hyperbolic-routing") )
-	{
-		process_command_hyperbolic_routing(remainder);
-	}
-	else if(!strcmp(cmd_type,"tunnel-type") )
-	{
-		process_command_tunnel_type(remainder);
-	}
-	else 
-	{
-		printf("Wrong configuration Command %s \n",cmd_type);
-	}
-}
-
-
-int 
-readConfigFile(const char *filename)
-{
-	FILE *cfg;
-	char buf[1024];
-	int len;
-
-	cfg=fopen(filename, "r");
-
-	if(cfg == NULL)
-	{
-		printf("\nConfiguration File does not exists\n");
-		exit(1);	
-	}
-
-	while(fgets((char *)buf, sizeof(buf), cfg))
-	{
-		len=strlen(buf);
-		if(buf[len-1] == '\n')
-		buf[len-1]='\0';
-		if ( buf[0] != '#' && buf[0] != '!') 
-			process_conf_command(buf);	
-	}
-
-	fclose(cfg);
-
-	return 0;
-}
-
-
-void
-add_faces_for_nbrs(void)
-{	
-	int i, adl_element;
-	struct ndn_neighbor *nbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-
-	for(i=0;i<adl_element;i++)
-	{
-		nbr=e->data;
-		int face_id=add_ccn_face(nlsr->ccn, (const char *)nbr->neighbor->name, (const char *)nbr->ip_address, 9695,nlsr->tunnel_type);
-		update_face_to_adl_for_nbr(nbr->neighbor->name, face_id);		
-		add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->topo_prefix, OP_REG, face_id);
-		add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->slice_prefix, OP_REG, face_id);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-void
-destroy_faces_for_nbrs(void)
-{	
-	int i, adl_element;
-	struct ndn_neighbor *nbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-
-	for(i=0;i<adl_element;i++)
-	{
-		nbr=e->data;
-		if ( nbr->face > 0 )
-		{	
-			add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->topo_prefix, OP_UNREG, nbr->face);
-			add_delete_ccn_face_by_face_id(nlsr->ccn,(const char *)nbr->neighbor->name,OP_UNREG,nbr->face);
-			add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->slice_prefix, OP_UNREG, nbr->face);
-		}
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-char *
-process_api_client_command(char *command)
-{
-	char *msg;
-	msg=(char *)malloc(100);	
-	memset(msg,0,100);
-	
-	const char *sep=" \t\n";
-	char *rem=NULL;
-	char *cmd_type=NULL;
-	char *op_type=NULL;
-	char *name=NULL;
-	char *face=NULL;
-	int face_id;
-	int res;
-
-	op_type=strtok_r(command,sep,&rem);
-	cmd_type=strtok_r(NULL,sep,&rem);
-	name=strtok_r(NULL,sep,&rem);
-	if ( name[strlen(name)-1] == '/' )
-		name[strlen(name)-1]='\0';
-
-	struct name_prefix *np=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	np->name=(char *)malloc(strlen(name)+1);
-	memset(np->name,0,strlen(name)+1);
-	memcpy(np->name,name,strlen(name)+1);
-	np->length=strlen(name)+1;
-
-	if ( strcmp(cmd_type,"name")!= 0 )
-	{
-		face=strtok_r(NULL,sep,&rem);
-		sscanf(face,"face%d",&face_id);
-	}
-	
-	if ( strcmp(cmd_type,"name")== 0 )
-	{
-		if ( strcmp(op_type,"del") == 0 ) 
-		{
-			res=does_name_exist_in_npl(np);
-			if ( res == 0)
-			{
-				sprintf(msg,"Name %s does not exist !!",name);
-			}
-			else
-			{
-				long int ls_id=get_lsa_id_from_npl(np);
-				if ( ls_id != 0 )
-				{
-					make_name_lsa_invalid(np,LS_TYPE_NAME,ls_id);
-					sprintf(msg,"Name %s has been deleted and Advertised.",name);
-				}
-				else 
-				{
-					sprintf(msg,"Name %s does not have an Name LSA yet !!",name);
-				}
-			}			
-		}
-		else if ( strcmp(op_type,"add") == 0 )
-		{
-			res=does_name_exist_in_npl(np);
-			if ( res == 0)
-			{
-				add_name_to_npl(np);
-				build_and_install_single_name_lsa(np);
-				sprintf(msg,"Name %s has been added to advertise.",name);
-			}
-			else
-			{
-				sprintf(msg,"Name %s has already been advertised from this router !!",name);
-			}
-		} 
-	}
-	else if ( strcmp(cmd_type,"neighbor") == 0 )
-	{
-		if ( strcmp(op_type,"del") == 0 ) 
-		{
-			res=is_neighbor(np->name);
-			if ( res == 0)
-			{
-				sprintf(msg,"Neighbor %s does not exist !!",name);
-			}
-			else
-			{
-				update_adjacent_status_to_adl(np,NBR_DOWN);
-				int face_id=get_next_hop_face_from_adl(np->name);
-				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)np->name, OP_UNREG, face_id);
-				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->topo_prefix, OP_UNREG, face_id);
-				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->slice_prefix, OP_UNREG, face_id);
-				delete_nbr_from_adl(np);
-				if(!nlsr->is_build_adj_lsa_sheduled)
-				{
-					nlsr->event_build_adj_lsa = ccn_schedule_event(nlsr->sched, 1000, &build_and_install_adj_lsa, NULL, 0);
-					nlsr->is_build_adj_lsa_sheduled=1;		
-				}
-				sprintf(msg,"Neighbor %s has been deleted from adjacency list.",name);	
-			}
-		}
-		else if ( strcmp(op_type,"add") == 0 )
-		{
-			res=is_neighbor(np->name);
-			if ( res == 0 )
-			{
-				struct name_prefix *nbr_name=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-				get_host_name_from_command_string(nbr_name,np->name,0);
-				printf("Hostname of neighbor: %s ",nbr_name->name);
-
-				char *ip_addr=(char *)malloc(13);
-				memset(ip_addr,0,13);
-				get_ip_from_hostname_02(nbr_name->name,ip_addr);
-				printf("IP Address: %s \n",ip_addr);
-				int face_id=add_ccn_face(nlsr->ccn, (const char *)nbr_name->name, (const char *)ip_addr, 9695,nlsr->tunnel_type);
-				update_face_to_adl_for_nbr(nbr_name->name, face_id);		
-				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->topo_prefix, OP_REG, face_id);
-				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->slice_prefix, OP_REG, face_id);				
-
-				add_nbr_to_adl(np,face_id,ip_addr);
-
-				sprintf(msg,"Neighbor %s has been added to adjacency list.",name);
-
-			}
-			else
-			{
-				sprintf(msg,"Neighbor %s already exists in adjacency list.",name);
-			}
-		}
-	}
-		
-
-	return msg;
-}
-
-int
-nlsr_api_server_poll(long int time_out_micro_sec, int ccn_fd)
-{
-	struct timeval timeout;
-	if (time_out_micro_sec< 500000 && time_out_micro_sec> 0 )
-	{
-		timeout.tv_sec=0;
-		timeout.tv_usec=time_out_micro_sec;
-	}
-	else 
-	{
-		timeout.tv_sec = 0;
-		timeout.tv_usec = 500000;
-	}
-	
-	int fd;
-	int nread;
-	int result;
-	fd_set testfds;
-	unsigned int client_len;
-	int client_sockfd;
-	char recv_buffer[1024];
-	bzero(recv_buffer,1024);
-	struct sockaddr_in client_address;
-
-	testfds=nlsr->readfds;
-	result = select(FD_SETSIZE, &testfds, NULL,NULL, &timeout);
-	
-	for(fd = 0; fd < FD_SETSIZE && result > 0; fd++) 
-	{
-		if(FD_ISSET(fd,&testfds)) 
-		{
-			if ( fd == ccn_fd )
-			{
-				return 0;
-			}			
-			else if(fd == nlsr->nlsr_api_server_sock_fd)
-			{
-				client_len = sizeof(client_address);
-				client_sockfd = accept(nlsr->nlsr_api_server_sock_fd,(struct sockaddr *)&client_address, &client_len);
-				FD_SET(client_sockfd, &nlsr->readfds);
-			}
-			else
-			{   
-					
-				ioctl(fd, FIONREAD, &nread);
-				if(nread == 0) 
-				{
-					close(fd);
-					FD_CLR(fd, &nlsr->readfds);
-				}
-				else 
-				{
-					recv(fd, recv_buffer, 1024, 0);
-					printf("Received Data from NLSR API cleint: %s \n",recv_buffer);
-					char *msg=process_api_client_command(recv_buffer);
-					send(fd, msg, strlen(msg),0);
-					free(msg);
-					close(fd);
-					FD_CLR(fd, &nlsr->readfds);
-				}
-			}
-		}
-	}
-
-	return 0;
-}
-
-int
-check_config_validity()
-{
-	if (nlsr->router_name == NULL )
-	{
-		fprintf(stderr,"Router name has not been configured :(\n");
-		return -1;
-	}
-	if ( nlsr->is_hyperbolic_calc == 1 && (nlsr->cor_r == -1.0 && nlsr->cor_theta== -1.0) ) 	
-	{
-		fprintf(stderr,"Hyperbolic codinate has not been defined :(\n");
-		return -1;
-	}
-	
-	return 0;
-}
-
-void 
-nlsr_destroy( void )
-{
-	if ( nlsr->debugging )
-	{
-		printf("Freeing Allocated Memory....\n");
-	}	
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"Freeing Allocated Memory....\n");	
-	/* Destroying all face created by nlsr in CCND */
-	destroy_all_face_by_nlsr();	
-	destroy_faces_for_nbrs();
-	/* Destroying every hash table attached to each neighbor in ADL before destorying ADL */	
-	hashtb_destroy(&nlsr->npl);
-	hashtb_destroy(&nlsr->adl);	
-	hashtb_destroy(&nlsr->lsdb->name_lsdb);
-	hashtb_destroy(&nlsr->lsdb->adj_lsdb);
-	hashtb_destroy(&nlsr->pit_alsa);
-
-		
-
-	hashtb_destroy(&nlsr->routing_table);
-
-
-	int i, npt_element;
-	struct npt_entry *ne;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	hashtb_start(nlsr->npt, e);
-	npt_element=hashtb_n(nlsr->npt);
-	for(i=0;i<npt_element;i++)
-	{
-		ne=e->data;
-		hashtb_destroy(&ne->name_list);
-		hashtb_destroy(&ne->face_list);	
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-	hashtb_destroy(&nlsr->npt);
-
-
-	ccns_close(&nlsr->ccns, NULL, NULL);
-	ccns_slice_destroy(&nlsr->slice);
-
-
-
-	close(nlsr->nlsr_api_server_sock_fd);	
-
-	ccn_schedule_destroy(&nlsr->sched);
-	ccn_destroy(&nlsr->ccn);
-
-	free(nlsr->lsdb->lsdb_version);
-	free(nlsr->lsdb);
-	free(nlsr->router_name);
-	free(nlsr);
-	if ( nlsr->debugging )
-	{
-		printf("Finished freeing allocated memory\n");
-	}
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"Finished freeing allocated memory\n");
-
-}
-
-
-
-void
-init_api_server(int ccn_fd)
-{
-	int server_sockfd;
-	int server_len;
-	struct sockaddr_in server_address;
-	unsigned int yes=1;	
-
-	server_sockfd = socket(AF_INET, SOCK_STREAM, 0);
-
-	int flags = fcntl(server_sockfd, F_GETFL, 0);
-	fcntl(server_sockfd, F_SETFL, O_NONBLOCK|flags);
-
-	if (setsockopt(server_sockfd,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(yes)) < 0) 
-	{
-       		ON_ERROR_DESTROY(-1);
-       	}
-
-	server_address.sin_family = AF_INET;
-	server_address.sin_addr.s_addr = INADDR_ANY;
-	server_address.sin_port = htons(nlsr->api_port);
-
-	server_len = sizeof(server_address);
-	bind(server_sockfd, (struct sockaddr *)&server_address, server_len);
-	listen(server_sockfd, 100);
-	FD_ZERO(&nlsr->readfds);
-	FD_SET(server_sockfd, &nlsr->readfds);
-	FD_SET(ccn_fd, &nlsr->readfds);
-	nlsr->nlsr_api_server_sock_fd=server_sockfd;
-
-}
-
-int 
-init_nlsr(void)
-{
-	if (signal(SIGQUIT, nlsr_stop_signal_handler ) == SIG_ERR) 
-	{
-		perror("SIGQUIT install error\n");
-		return -1;
-	}
-	if (signal(SIGTERM, nlsr_stop_signal_handler ) == SIG_ERR) 
-	{
-		perror("SIGTERM install error\n");
-		return -1;
-    	}
- 	if (signal(SIGINT, nlsr_stop_signal_handler ) == SIG_ERR)
-	{
-		perror("SIGTERM install error\n");
-		return -1;
-	}
-
-	nlsr=(struct nlsr *)malloc(sizeof(struct nlsr));
-	
-	struct hashtb_param param_adl = {0};
-	nlsr->adl=hashtb_create(sizeof(struct ndn_neighbor), &param_adl);
-	struct hashtb_param param_npl = {0};
-	nlsr->npl = hashtb_create(sizeof(struct name_prefix_list_entry), &param_npl);
-	struct hashtb_param param_pit_alsa = {0};	
-	nlsr->pit_alsa = hashtb_create(sizeof(struct pending_interest), &param_pit_alsa);
-	struct hashtb_param param_npt = {0};	
-	nlsr->npt = hashtb_create(sizeof(struct npt_entry), &param_npt);
-	struct hashtb_param param_rte = {0};	
-	nlsr->routing_table = hashtb_create(sizeof(struct routing_table_entry), &param_rte);
-
-	nlsr->in_interest.p = &incoming_interest;
-	nlsr->in_content.p = &incoming_content;
-
-	nlsr->lsdb=(struct linkStateDatabase *)malloc(sizeof(struct linkStateDatabase));
-
-	char *time_stamp=(char *)malloc(20);
-	memset(time_stamp,0,20);
-	get_current_timestamp_micro(time_stamp);
-	nlsr->lsdb->lsdb_version=(char *)malloc(strlen(time_stamp)+1);
-	memset(nlsr->lsdb->lsdb_version,0,strlen(time_stamp));
-	free(time_stamp);
-	
-	struct hashtb_param param_adj_lsdb = {0};
-	nlsr->lsdb->adj_lsdb = hashtb_create(sizeof(struct alsa), &param_adj_lsdb);
-	struct hashtb_param param_name_lsdb = {0};
-	nlsr->lsdb->name_lsdb = hashtb_create(sizeof(struct nlsa), &param_name_lsdb);
-	struct hashtb_param param_cor_lsdb = {0};
-	nlsr->lsdb->cor_lsdb = hashtb_create(sizeof(struct clsa), &param_cor_lsdb);
-	
-	
-
-
-	nlsr->is_synch_init=1;
-	nlsr->nlsa_id=0;
-	nlsr->adj_build_flag=0;
-	nlsr->adj_build_count=0;
-	nlsr->is_build_adj_lsa_sheduled=0;
-	nlsr->is_send_lsdb_interest_scheduled=0;
-	nlsr->is_route_calculation_scheduled=0;	
-
-	nlsr->detailed_logging=0;
-	nlsr->debugging=0;
-
-	//nlsr->lsdb_synch_interval = LSDB_SYNCH_INTERVAL;
-	nlsr->interest_retry = INTEREST_RETRY;
-	nlsr->interest_resend_time = INTEREST_RESEND_TIME;
-	nlsr->lsa_refresh_time=LSA_REFRESH_TIME;
-	nlsr->router_dead_interval=ROUTER_DEAD_INTERVAL;
-	nlsr->max_faces_per_prefix=MAX_FACES_PER_PREFIX;
-	nlsr->semaphor=NLSR_UNLOCKED;
-
-	nlsr->api_port=API_PORT;
-
-	nlsr->topo_prefix=(char *)malloc(strlen("/ndn/routing/nlsr")+1);
-	memset(nlsr->topo_prefix,0,strlen("/ndn/routing/nlsr")+1);
-	memcpy(nlsr->topo_prefix,"/ndn/routing/nlsr",strlen("/ndn/routing/nlsr"));
-
-	nlsr->slice_prefix=(char *)malloc(strlen("/ndn/routing/nlsr/LSA")+1);
-	memset(nlsr->slice_prefix, 0, strlen("/ndn/routing/nlsr/LSA")+1);
-	memcpy(nlsr->slice_prefix,"/ndn/routing/nlsr/LSA",strlen("/ndn/routing/nlsr/LSA"));
-
-	nlsr->is_hyperbolic_calc=0;
-	nlsr->cor_r=-1.0;
-	nlsr->cor_theta=-1.0;
-
-	nlsr->tunnel_type=IPPROTO_UDP;
-
-	return 0;
-}
-
-
-int 
-main(int argc, char *argv[])
-{
-    	int res, ret;
-    	char *config_file;
-	int daemon_mode=0;
-	int port=0;
-
-	
-
-	while ((res = getopt_long(argc, argv, "df:p:h", longopts, 0)) != -1) 
-	{
-        	switch (res) 
-		{
-			case 'd':
-				daemon_mode = 1;
-				break;
-			case 'f':
-				config_file = optarg;
-				break;
-			case 'p':
-				port = atoi(optarg);
-				break;
-			case 'h':
-			default:
-				usage(argv[0]);
-		}
-    	}
-
-	ret=init_nlsr();	
-    	ON_ERROR_EXIT(ret);
-
-	if ( port !=0 )
-		nlsr->api_port=port;
-
-	readConfigFile(config_file);
-
-	ON_ERROR_DESTROY(check_config_validity());
-
-	print_adjacent_from_adl();
-
-	if ( daemon_mode == 1 )
-	{
-		nlsr->debugging=0;
-		daemonize_nlsr();
-	}
-	
-	startLogging(nlsr->logDir);
-	
-	nlsr->ccn=ccn_create();
-	int ccn_fd=ccn_connect(nlsr->ccn, NULL);
-	if(ccn_fd == -1)
-	{
-		fprintf(stderr,"Could not connect to ccnd\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Could not connect to ccnd\n");
-		ON_ERROR_DESTROY(-1);
-	}
-
-	init_api_server(ccn_fd);
-
-	res=create_sync_slice(nlsr->topo_prefix, nlsr->slice_prefix);
-	if(res<0)
-	{
-		fprintf(stderr, "Can not create slice for prefix %s\n",nlsr->slice_prefix);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Can not create slice for prefix %s\n",nlsr->slice_prefix);
-		ON_ERROR_DESTROY(res);
-	}
-	struct ccn_charbuf *router_prefix;	
-	router_prefix=ccn_charbuf_create(); 
-	res=ccn_name_from_uri(router_prefix,nlsr->router_name);		
-	if(res<0)
-	{
-		fprintf(stderr, "Bad ccn URI: %s\n",nlsr->router_name);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Bad ccn URI: %s\n",nlsr->router_name);
-		ON_ERROR_DESTROY(res);
-	}
-
-	ccn_name_append_str(router_prefix,"nlsr");
-	nlsr->in_interest.data=nlsr->router_name;
-	res=ccn_set_interest_filter(nlsr->ccn,router_prefix,&nlsr->in_interest);
-	if ( res < 0 )
-	{
-		fprintf(stderr,"Failed to register interest for router\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Failed to register interest for router\n");
-		ON_ERROR_DESTROY(res);
-	}
-	ccn_charbuf_destroy(&router_prefix);
-	
-	if ( nlsr->debugging )
-		printf("Router Name : %s\n",nlsr->router_name);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"Router Name : %s\n",nlsr->router_name);
-	if ( nlsr->debugging )
-		printf("lsdb_version: %s\n",nlsr->lsdb->lsdb_version);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"lsdb_version: %s\n",nlsr->lsdb->lsdb_version);
-
-	add_faces_for_nbrs();
-	print_name_prefix_from_npl();
-	print_adjacent_from_adl();
-	build_and_install_name_lsas();	
-
-	sync_monitor(nlsr->topo_prefix,nlsr->slice_prefix);
-
-
-	print_name_lsdb();
-	if ( nlsr->cor_r != -1.0 && nlsr->cor_theta== -1.0)
-	{
-		build_and_install_cor_lsa();
-	}
-	write_name_lsdb_to_repo(nlsr->slice_prefix);
-
-	nlsr->sched = ccn_schedule_create(nlsr, &ndn_rtr_ticker);
-	nlsr->event_send_info_interest = ccn_schedule_event(nlsr->sched, 1, &send_info_interest, NULL, 0);
-	nlsr->event = ccn_schedule_event(nlsr->sched, 60000000, &refresh_lsdb, NULL, 0);
-
-	
-	while(1)
-	{	
-		if ( nlsr->semaphor == NLSR_UNLOCKED  )
-		{
-			if( nlsr->sched != NULL )
-			{
-				long int micro_sec=ccn_schedule_run(nlsr->sched);
-				res=nlsr_api_server_poll(micro_sec,ccn_fd);
-				ON_ERROR_DESTROY(res);
-			}
-			if(nlsr->ccn != NULL)
-			{
-        			res = ccn_run(nlsr->ccn, 1);
-			}
-			if (!(nlsr->sched && nlsr->ccn))
-			{	      
-				break;
-			}
-		}
-
-	}
-	
-
-	return 0;
-}
-
diff --git a/nlsr-sync-0.0/nlsr.conf b/nlsr-sync-0.0/nlsr.conf
deleted file mode 100755
index ced844f..0000000
--- a/nlsr-sync-0.0/nlsr.conf
+++ /dev/null
@@ -1,10 +0,0 @@
-router-name /ndn/memphis.edu/netlab/macbook
-ccnneighbor /ndn/memphis.edu/netlab/pollux face2 10
-ccnneighbor /ndn/memphis.edu/netlab/castor face3 8
-ccnname /ndn/memphis.edu/netlab/macbook/name1
-ccnname /ndn/memphis.edu/netlab/macbook/test
-lsdb-synch-interval 310
-interest-retry 4
-interest-resend-time 5
-
-
diff --git a/nlsr-sync-0.0/nlsr.h b/nlsr-sync-0.0/nlsr.h
deleted file mode 100755
index 681973b..0000000
--- a/nlsr-sync-0.0/nlsr.h
+++ /dev/null
@@ -1,132 +0,0 @@
-#ifndef _NLSR_H_
-#define _NLSR_H_
-
-
-#define LSDB_SYNCH_INTERVAL 300
-#define INTEREST_RETRY 3
-#define INTEREST_RESEND_TIME 15
-#define NLSR_LOCKED 1
-#define NLSR_UNLOCKED 0
-#define LSA_REFRESH_TIME 1800
-#define ROUTER_DEAD_INTERVAL 3600
-#define MAX_FACES_PER_PREFIX 0
-
-#define LINK_METRIC 10
-
-#define NAME_LSA_VALID 1
-#define NAME_LSA_INVALID 0
-
-#define API_PORT 9999
-
-
-struct name_prefix
-{
-	char *name;
-	int length;
-};
-
-struct linkStateDatabase
-{
-	struct hashtb *name_lsdb;
-	struct hashtb *adj_lsdb;
-	struct hashtb *cor_lsdb;
-	
-	char *lsdb_version;
-};
-
-struct pending_interest
-{
-	char *int_name;
-	int timed_out;
-};
-
-struct nlsr
-{
-
-	struct ccn_closure in_interest;
-	struct ccn_closure in_content;
-
-	struct ccns_name_closure *closure;
-
-	struct ccns_slice *slice;
-    	struct ccns_handle *ccns;
-
-	struct ccn_schedule *sched;
-    	struct ccn_scheduled_event *event;
-	struct ccn_scheduled_event *event_send_lsdb_interest;
-	struct ccn_scheduled_event *event_send_info_interest;
-	struct ccn_scheduled_event *event_build_name_lsa;
-	struct ccn_scheduled_event *event_build_adj_lsa;
-	struct ccn_scheduled_event *event_calculate_route;
-
-	struct hashtb *adl;
-	struct hashtb *npl;
-	struct hashtb *pit_alsa;
-	struct hashtb *map;
-	struct hashtb *rev_map;
-	struct hashtb *npt;
-	struct hashtb *routing_table;
-
-
-	struct linkStateDatabase *lsdb;
-
-	struct ccn *ccn;
-	char *router_name;
-
-	
-
-	int is_synch_init;
-	long int nlsa_id;
-	int adj_build_flag;
-	long int adj_build_count;
-	int is_build_adj_lsa_sheduled;
-	int is_send_lsdb_interest_scheduled;
-	int is_route_calculation_scheduled;
-
-	//long int lsdb_synch_interval;
-	int interest_retry;
-	long int interest_resend_time;
-	long int lsa_refresh_time;
-	long int router_dead_interval;
-	//long int multi_path_face_num;
-	long int max_faces_per_prefix;
-	char *logDir;
-	int detailed_logging;
-	int debugging;
-
-	int semaphor;
-
-	int nlsr_api_server_sock_fd;
-	fd_set readfds;
-	int api_port;
-
-	char *topo_prefix;
-	char *slice_prefix;
-
-	int is_hyperbolic_calc;
-	double cor_r;
-	double cor_theta;
-
-	int tunnel_type;
-	
-	
-};
-
-struct nlsr *nlsr;
-
-void process_command_ccnneighbor(char *command);
-void process_command_ccnname(char *command);
-void process_command_lsdb_synch_interval(char *command);
-void process_command_interest_retry(char *command);
-void process_command_interest_resend_time(char *command);
-void process_conf_command(char *command);
-int readConfigFile(const char *filename);
-
-void nlsr_lock(void);
-void nlsr_unlock(void);
-
-int init_nlsr(void);
-void nlsr_destroy( void );
-void nlsr_stop_signal_handler(int sig);
-
-#endif
diff --git a/nlsr-sync-0.0/nlsr_adl.c b/nlsr-sync-0.0/nlsr_adl.c
deleted file mode 100755
index 042466a..0000000
--- a/nlsr-sync-0.0/nlsr_adl.c
+++ /dev/null
@@ -1,978 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include<math.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#endif
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-#include "nlsr.h"
-#include "nlsr_npl.h"
-#include "nlsr_adl.h"
-#include "utility.h"
-#include "nlsr_npt.h"
-
-void 
-add_nbr_to_adl(struct name_prefix *new_nbr,int face,char *ip)
-{
-	struct ndn_neighbor *nbr=(struct ndn_neighbor *)malloc(sizeof(struct ndn_neighbor )); //free
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->adl, e);
-    	res = hashtb_seek(e, new_nbr->name, new_nbr->length, 0);
-
-	if(res == HT_NEW_ENTRY )
-	{
-   
-		nbr = e->data;
-
-		nbr->neighbor=(struct name_prefix *)malloc(sizeof( struct name_prefix )); //free
-		nbr->neighbor->name=(char *)malloc(new_nbr->length);
-		memcpy(nbr->neighbor->name,new_nbr->name,new_nbr->length);
-		nbr->neighbor->length=new_nbr->length;
-		nbr->face=face;
-		nbr->status=NBR_DOWN;
-		nbr->info_interest_timed_out=0;
-		nbr->lsdb_interest_timed_out=0;
-		nbr->lsdb_random_time_component=(int)(LSDB_SYNCH_INTERVAL/2);
-		nbr->lsdb_synch_interval=LSDB_SYNCH_INTERVAL;
-		nbr->metric=LINK_METRIC;
-		nbr->is_lsdb_send_interest_scheduled=0;
-		
-		nbr->ip_address=(char *)malloc(13);
-		memset(nbr->ip_address,0,13);
-		memcpy(nbr->ip_address,ip,strlen(ip));
-
-		char *time_stamp=(char *)malloc(20);
-		get_current_timestamp_micro(time_stamp);
-		nbr->last_lsdb_version=(char *)malloc(strlen(time_stamp)+1); //free
-		memcpy(nbr->last_lsdb_version,time_stamp,strlen(time_stamp)+1);
-		memset(nbr->last_lsdb_version,'0',strlen(time_stamp));
-		nbr->last_info_version=(char *)malloc(strlen(time_stamp)+1); //free
-		memcpy(nbr->last_info_version,time_stamp,strlen(time_stamp)+1);
-		memset(nbr->last_info_version,'0',strlen(time_stamp));
-		free(time_stamp);		
-
-		nbr->last_lsdb_requested=0;
-	}
-
-    	hashtb_end(e);
-}
-
-
-void 
-print_adjacent(struct ndn_neighbor *nbr)
-{
-	if ( nlsr->debugging )
-	{
-		printf("print_adjacent called\n");
-		printf("--------Neighbor---------------------------\n");
-		printf("	Neighbor: %s \n",nbr->neighbor->name);
-		printf("	Length  : %d \n",nbr->neighbor->length);
-		printf("	Ip Address: %s \n",nbr->ip_address);
-		printf("	Face    : %d \n",nbr->face);
-		printf("	Metric    : %d \n",nbr->metric);
-		printf("	Status  : %d \n",nbr->status);
-		printf("	LSDB Version: %s \n",nbr->last_lsdb_version);
-		printf("	Info Version: %s \n",nbr->last_info_version);
-		printf("	Info Interest Timed Out : %d \n",nbr->info_interest_timed_out);
-		printf("	LSDB Interest Timed Out : %d \n",nbr->lsdb_interest_timed_out);
-		printf("	LSDB Synch Interval     : %ld \n",nbr->lsdb_synch_interval);
-		printf("	LSDB Random Time comp   : %d \n",nbr->lsdb_random_time_component);
-		printf("	Las Time LSDB Requested: %ld \n",nbr->last_lsdb_requested);
-		printf("	IS_lsdb_send_interest_scheduled : %d \n",nbr->is_lsdb_send_interest_scheduled);
-
-		printf("\n");
-	}
-
-	if ( nlsr->detailed_logging )
-	{
-		
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_adjacent called\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"--------Neighbor---------------------------\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Neighbor: %s \n",nbr->neighbor->name);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Length  : %d \n",nbr->neighbor->length);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Face    : %d \n",nbr->face);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Metric    : %d \n",nbr->metric);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Status  : %d \n",nbr->status);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	LSDB Version: %s \n",nbr->last_lsdb_version);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Info Version: %s \n",nbr->last_info_version);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Info Interest Timed Out : %d \n",nbr->info_interest_timed_out);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	LSDB Interest Timed Out : %d \n",nbr->lsdb_interest_timed_out);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	LSDB Synch Interval     : %ld \n",nbr->lsdb_synch_interval);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	LSDB Random Time comp   : %d \n",nbr->lsdb_random_time_component);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Las Time LSDB Requested: %ld \n",nbr->last_lsdb_requested);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	IS_lsdb_send_interest_scheduled : %d \n",nbr->is_lsdb_send_interest_scheduled);
-
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-	}
-
-}
-
-void
-print_adjacent_from_adl(void)
-{
-	if ( nlsr->debugging )
-		printf("print_adjacent_from_adl called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_adjacent_from_adl called \n");		
-	
-	int i, adl_element;
-	struct ndn_neighbor *nbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-
-	for(i=0;i<adl_element;i++)
-	{
-		nbr=e->data;
-		print_adjacent(nbr);	
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-int 
-get_adjacent_status(struct name_prefix *nbr)
-{
-
-	if ( nlsr->debugging )
-		printf("get_adjacent_status called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_adjacent_status called \n");
-
-	int res;
-	int status=-1;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-	if (res == HT_OLD_ENTRY)
-	{
-		nnbr=e->data;
-		status=nnbr->status;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return status;
-
-}
-
-int 
-get_timed_out_number(struct name_prefix *nbr)
-{
-
-	if ( nlsr->debugging )
-		printf("get_timed_out_number called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_timed_out_number called \n");
-
-
-	int res,ret=-1;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		ret=nnbr->info_interest_timed_out;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return ret;	
-}
-
-int 
-get_lsdb_interest_timed_out_number(struct name_prefix *nbr)
-{
-
-	if ( nlsr->debugging )
-		printf("get_lsdb_interest_timed_out_number called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_lsdb_interest_timed_out_number called \n");
-
-	int res,ret=-1;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		ret=nnbr->lsdb_interest_timed_out;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return ret;	
-}
-
-void 
-update_adjacent_timed_out_to_adl(struct name_prefix *nbr, int increment)
-{
-	if ( nlsr->debugging )
-		printf("update_adjacent_timed_out_to_adl called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_timed_out_to_adl called \n");
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		nnbr->info_interest_timed_out += increment;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-void 
-update_adjacent_timed_out_zero_to_adl(struct name_prefix *nbr)
-{
-	if ( nlsr->debugging )
-		printf("update_adjacent_timed_out_zero_to_adl called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_timed_out_zero_to_adl called \n");
-	
-	int time_out_number=get_timed_out_number(nbr);
-	update_adjacent_timed_out_to_adl(nbr,-time_out_number);
-
-}
-
-
-void 
-update_lsdb_interest_timed_out_to_adl(struct name_prefix *nbr, int increment)
-{
-	if ( nlsr->debugging )
-		printf("update_lsdb_interest_timed_out_to_adl called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_lsdb_interest_timed_out_to_adl called \n");
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-
-	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		nnbr->lsdb_interest_timed_out += increment;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}		
-	hashtb_end(e);
-}
-
-void 
-update_lsdb_interest_timed_out_zero_to_adl(struct name_prefix *nbr)
-{
-	if ( nlsr->debugging )
-		printf("update_adjacent_timed_out_zero_to_adl called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_timed_out_zero_to_adl called\n");
-	
-	int time_out_number=get_lsdb_interest_timed_out_number(nbr);
-	update_lsdb_interest_timed_out_to_adl(nbr,-time_out_number);
-
-}
-
-void 
-update_adjacent_status_to_adl(struct name_prefix *nbr, int status)
-{
-	if ( nlsr->debugging )
-		printf("update_adjacent_status_to_adl called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_status_to_adl called \n");
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-   	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-
-	if (res == HT_OLD_ENTRY)
-	{
-		nnbr=e->data;
-		if ( nnbr->status!=status )
-		{
-			nnbr->status=status;
-			nlsr->adj_build_flag++;
-		}
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-
-void 
-delete_nbr_from_adl(struct name_prefix *nbr)
-{
-	if ( nlsr->debugging )
-		printf("delete_nbr_from_adl called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_nbr_from_adl called \n");
-
-	int res;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-   	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-
-	if (res == HT_OLD_ENTRY)
-	{
-		hashtb_delete(e);	
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-void 
-update_lsdb_synch_interval_to_adl(struct name_prefix *nbr, long int interval)
-{
-	if ( nlsr->debugging )
-		printf("update_lsdb_synch_interval_to_adl called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_lsdb_synch_interval_to_adl called \n");
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-   	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-
-	if (res == HT_OLD_ENTRY)
-	{
-		nnbr=e->data;
-		if ( nnbr->lsdb_synch_interval!= interval )
-		{
-			nnbr->lsdb_synch_interval=interval;
-			nnbr->lsdb_random_time_component=(int)(interval/2);
-
-		}
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-
-int 
-no_active_nbr(void)
-{
-	int i, adl_element;
-	int no_link=0;
-	struct ndn_neighbor *nbr;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-
-	for(i=0;i<adl_element;i++)
-	{
-		nbr=e->data;
-		if( nbr->status	== 1 )
-			no_link++;
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	return no_link;
-
-}
-
-int
-is_adj_lsa_build(void)
-{
-	int ret=0;
-
-	int nbr_count=0;	
-
-	int i, adl_element;
-	struct ndn_neighbor *nbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-
-	for(i=0;i<adl_element;i++)
-	{
-		nbr=e->data;
-		if(nbr->status	== 1 )
-		{
-			nbr_count++;
-		}
-		else if ( (nbr->status == 0) && (nbr->info_interest_timed_out >= nlsr->interest_retry || nbr->lsdb_interest_timed_out >= nlsr->interest_retry))
-		{
-			nbr_count++;
-		}
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-	if(nbr_count == adl_element)
-		ret=1;
-
-	return ret;
-}
-
-
-void 
-get_active_nbr_adj_data(struct ccn_charbuf *c)
-{
-
-	int i, adl_element;
-	struct ndn_neighbor *nbr;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-
-	for(i=0;i<adl_element;i++)
-	{
-		nbr=e->data;
-		if( nbr->status	== 1 )
-		{
-			ccn_charbuf_append_string(c,nbr->neighbor->name);
-			ccn_charbuf_append_string(c,"|");
-
-			char *temp_length=(char *)malloc(20);
-			memset(temp_length,0,20);
-			sprintf(temp_length,"%d",nbr->neighbor->length);
-			ccn_charbuf_append_string(c,temp_length);
-			free(temp_length);
-			ccn_charbuf_append_string(c,"|");
-
-			char *temp_face=(char *)malloc(20);
-			memset(temp_face,0,20);
-			sprintf(temp_face,"%d",nbr->face);
-			ccn_charbuf_append_string(c,temp_face);
-			free(temp_face);
-			ccn_charbuf_append_string(c,"|");
-
-			char *temp_metric=(char *)malloc(20);
-			memset(temp_metric,0,20);
-			sprintf(temp_metric,"%d",nbr->metric);
-			ccn_charbuf_append_string(c,temp_metric);
-			free(temp_metric);
-			ccn_charbuf_append_string(c,"|");
-
-		}
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-}
-
-long int
-get_nbr_time_diff_lsdb_req(char *nbr)
-{
-	if ( nlsr->debugging )
-		printf("get_nbr_time_diff_lsdb_req called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_nbr_time_diff_lsdb_req called\n");
-
-	long int time_diff=get_lsdb_synch_interval(nbr)+1;	
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if (res == HT_OLD_ENTRY)
-	{
-		nnbr=e->data;
-
-		if (nnbr->last_lsdb_requested == 0)
-			time_diff=get_lsdb_synch_interval(nbr)+1;
-		else time_diff=get_current_time_sec() - get_nbr_last_lsdb_requested(nbr);
-
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return time_diff;
-}
-
-long int 
-get_nbr_last_lsdb_requested(char *nbr)
-{
-	if ( nlsr->debugging )
-		printf("get_timed_out_number called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_timed_out_number called\n");
-
-	long int last_lsdb_requested=0;
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if (res == HT_OLD_ENTRY)
-	{
-		nnbr=e->data;
-		last_lsdb_requested=nnbr->last_lsdb_requested;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return last_lsdb_requested;
-}
-
-
-int 
-get_nbr_random_time_component(char *nbr)
-{
-	if ( nlsr->debugging )
-		printf("get_nbr_random_time_component called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_nbr_random_time_component called\n");
-
-	int time=0;
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if (res == HT_OLD_ENTRY)
-	{
-		nnbr=e->data;
-		time=nnbr->lsdb_random_time_component * (int)pow(-1,nnbr->lsdb_interest_timed_out+1);
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return time;
-}
-
-long int 
-get_lsdb_synch_interval(char *nbr)
-{
-	if ( nlsr->debugging )
-		printf("get_lsdb_synch_interval called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_lsdb_synch_interval called \n");
-
-	long int lsdb_synch_interval=300;	
-
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if (res == HT_OLD_ENTRY)
-	{
-		nnbr=e->data;
-		lsdb_synch_interval=nnbr->lsdb_synch_interval;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return lsdb_synch_interval;
-
-}
-
-char *
-get_nbr_lsdb_version(char *nbr)
-{
-	if ( nlsr->debugging )
-		printf("get_nbr_lsdb_version called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_nbr_lsdb_version called \n");
-
-	char *version=NULL;
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if (res == HT_OLD_ENTRY)
-	{
-		nnbr=e->data;
-		version=(char *)malloc(strlen(nnbr->last_lsdb_version)+1);
-		memset(version,0,strlen(nnbr->last_lsdb_version)+1);
-		memcpy(version,nnbr->last_lsdb_version,strlen(nnbr->last_lsdb_version)+1);
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return version;
-}
-
-void 
-update_adjacent_last_lsdb_requested_to_adl(char *nbr, long int timestamp)
-{
-	if ( nlsr->debugging )
-		printf("update_adjacent_last_lsdb_requested_to_adl called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_last_lsdb_requested_to_adl called \n");
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		nnbr->last_lsdb_requested=timestamp;
-
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-void 
-set_is_lsdb_send_interest_scheduled_to_zero(char *nbr)
-{
-	if ( nlsr->debugging )
-		printf("set_is_lsdb_send_interest_scheduled_to_zero called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"set_is_lsdb_send_interest_scheduled_to_zero called\n");
-
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if (res == HT_OLD_ENTRY)
-	{
-		nnbr=e->data;
-		nnbr->is_lsdb_send_interest_scheduled=0;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-void 
-update_adjacent_lsdb_version_to_adl(struct name_prefix *nbr, char *version)
-{
-	if ( nlsr->debugging )
-		printf("update_adjacent_timed_out_to_adl called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_timed_out_to_adl called\n");
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		free(nnbr->last_lsdb_version);
-		nnbr->last_lsdb_version=(char *)malloc(strlen(version)+1);
-		memset(nnbr->last_lsdb_version,0,strlen(version)+1);
-		memcpy(nnbr->last_lsdb_version,version,strlen(version)+1);
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-}
-
-void 
-adjust_adjacent_last_lsdb_requested_to_adl(char *nbr, long int sec)
-{
-	printf("update_adjacent_last_lsdb_requested_to_adl called \n");
-
-	if ( nlsr->debugging )
-		printf("update_adjacent_last_lsdb_requested_to_adl called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_last_lsdb_requested_to_adl called\n");
-
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		nnbr->last_lsdb_requested=nnbr->last_lsdb_requested-sec;
-
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-}
-
-int 
-get_next_hop_face_from_adl(char *nbr)
-{
-	int res;
-	int connecting_face=NO_FACE;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		connecting_face=nnbr->face;
-		
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-	return connecting_face;
-}
-
-void
-update_face_to_adl_for_nbr(char *nbr, int face)
-{
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		nnbr->face=face;
-		
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-int 
-is_neighbor(char *nbr)
-{
-	int ret=0;
-
-	int res;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		ret=1;	
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return ret;
-}
-
-int 
-is_active_neighbor(char *nbr)
-{
-	int ret=0;
-
-	int res;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		struct ndn_neighbor *nnbr;
-		nnbr=e->data;
-		if (nnbr->status == NBR_ACTIVE )
-		{
-			ret=1;	
-		}
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return ret;
-}
-
diff --git a/nlsr-sync-0.0/nlsr_adl.h b/nlsr-sync-0.0/nlsr_adl.h
deleted file mode 100755
index 1eb74d6..0000000
--- a/nlsr-sync-0.0/nlsr_adl.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef _NLSR_ADL_H_
-#define _NLSR_ADL_H_
-
-#define NBR_DOWN 0
-#define NBR_ACTIVE 1
-
-struct ndn_neighbor
-{
-	struct name_prefix *neighbor;
-	int face;
-	int status;
-	char * last_lsdb_version;
-	char * last_info_version;
-	char *ip_address;
-	int info_interest_timed_out;
-	int lsdb_interest_timed_out;
-	int lsdb_random_time_component;
-	long int lsdb_synch_interval;
-	long int last_lsdb_requested;
-	int is_lsdb_send_interest_scheduled;
-	int metric;
-};
-
-void add_nbr_to_adl(struct name_prefix *new_nbr,int face,char *ip);
-void delete_nbr_from_adl(struct name_prefix *nbr);
-void print_adjacent(struct ndn_neighbor *nbr);
-void print_adjacent_from_adl(void);
-int get_adjacent_status(struct name_prefix *nbr);
-int get_timed_out_number(struct name_prefix *nbr);
-int get_lsdb_interest_timed_out_number(struct name_prefix *nbr);
-void update_adjacent_timed_out_to_adl(struct name_prefix *nbr, int increment);
-void update_adjacent_timed_out_zero_to_adl(struct name_prefix *nbr);
-void update_lsdb_interest_timed_out_to_adl(struct name_prefix *nbr, int increment);
-void update_lsdb_interest_timed_out_zero_to_adl(struct name_prefix *nbr);
-void update_adjacent_status_to_adl(struct name_prefix *nbr, int status);
-void update_lsdb_synch_interval_to_adl(struct name_prefix *nbr, long int interval);
-int no_active_nbr(void);
-int is_adj_lsa_build(void);
-void get_active_nbr_adj_data(struct ccn_charbuf *c);
-long int get_nbr_time_diff_lsdb_req(char *nbr);
-long int get_nbr_last_lsdb_requested(char *nbr);
-long int get_nbr_last_lsdb_requested(char *nbr);
-long int get_lsdb_synch_interval(char *nbr);
-int get_nbr_random_time_component(char *nbr);
-char * get_nbr_lsdb_version(char *nbr);
-void update_adjacent_last_lsdb_requested_to_adl(char *nbr, long int timestamp);
-void set_is_lsdb_send_interest_scheduled_to_zero(char *nbr);
-void update_adjacent_lsdb_version_to_adl(struct name_prefix *nbr, char *version);
-void adjust_adjacent_last_lsdb_requested_to_adl(char *nbr, long int sec);
-int get_next_hop_face_from_adl(char *nbr);
-int is_neighbor(char *nbr);
-int is_active_neighbor(char *nbr);
-void update_face_to_adl_for_nbr(char *nbr, int face);
-#endif
diff --git a/nlsr-sync-0.0/nlsr_face.c b/nlsr-sync-0.0/nlsr_face.c
deleted file mode 100644
index 708fab7..0000000
--- a/nlsr-sync-0.0/nlsr_face.c
+++ /dev/null
@@ -1,410 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <string.h>
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/face_mgmt.h>
-#include <ccn/reg_mgmt.h>
-#include <ccn/charbuf.h>
-
-
-
-#include "nlsr_face.h"
-
-static void 
-ccn_fib_warn(int lineno, const char *format, ...)
-{
-	struct timeval t;
-	va_list ap;
-	va_start(ap, format);
-	gettimeofday(&t, NULL);
-	fprintf(stderr, "%d.%06d ccn_fib[%d]:%d: ", (int)t.tv_sec, (unsigned)t.tv_usec, (int)getpid(), lineno);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-}
-
-static void 
-ccn_fib_fatal(int lineno, const char *format, ...)
-{
-	struct timeval t;
-	va_list ap;
-	va_start(ap, format);
-	gettimeofday(&t, NULL);
-	fprintf(stderr, "%d.%06d ccn_fib[%d]:%d: ", (int)t.tv_sec, (unsigned)t.tv_usec, (int)getpid(), lineno);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	exit(1);
-}
-
-#define ON_ERROR_EXIT(resval, msg) on_error_exit((resval), __LINE__, msg)
-
-static void 
-on_error_exit(int res, int lineno, const char *msg)
-{
-	if (res >= 0)
-		return;
-	ccn_fib_fatal(lineno, "fatal error, res = %d, %s\n", res, msg);
-}
-
-#define ON_ERROR_CLEANUP(resval) \
-{           \
-    if ((resval) < 0) { \
-        ccn_fib_warn (__LINE__, "OnError cleanup\n"); \
-        goto cleanup; \
-    } \
-}
-
-#define ON_NULL_CLEANUP(resval) \
-{           \
-    if ((resval) == NULL) { \
-        ccn_fib_warn(__LINE__, "OnNull cleanup\n"); \
-        goto cleanup; \
-    } \
-}
-
-
-/**
- * 
- * Bind a prefix to a face
- *
- */
-static int 
-register_unregister_prefix(struct ccn *h, struct ccn_charbuf *local_scope_template,
-        struct ccn_charbuf *no_name, struct ccn_charbuf *name_prefix,
-        struct ccn_face_instance *face_instance, int operation)
-{
-	struct ccn_charbuf *temp = NULL;
-	struct ccn_charbuf *resultbuf = NULL;
-	struct ccn_charbuf *signed_info = NULL;
-	struct ccn_charbuf *name = NULL;
-	struct ccn_charbuf *prefixreg = NULL;
-	struct ccn_parsed_ContentObject pcobuf = {0};
-	struct ccn_forwarding_entry forwarding_entry_storage = {0};
-	struct ccn_forwarding_entry *forwarding_entry = &forwarding_entry_storage;
-	struct ccn_forwarding_entry *new_forwarding_entry;
-	const unsigned char *ptr = NULL;
-	size_t length = 0;
-	int res;
-
-	/* Register or unregister the prefix */
-	forwarding_entry->action = (operation == OP_REG) ? "prefixreg" : "unreg";
-	forwarding_entry->name_prefix = name_prefix;
-	forwarding_entry->ccnd_id = face_instance->ccnd_id;
-	forwarding_entry->ccnd_id_size = face_instance->ccnd_id_size;
-	forwarding_entry->faceid = face_instance->faceid;
-	forwarding_entry->flags = -1;
-	forwarding_entry->lifetime = 2100;
-
-	prefixreg = ccn_charbuf_create();
-	ccnb_append_forwarding_entry(prefixreg, forwarding_entry);
-	temp = ccn_charbuf_create();
-	res = ccn_sign_content(h, temp, no_name, NULL, prefixreg->buf, prefixreg->length);
-	resultbuf = ccn_charbuf_create();
-
-	/* construct Interest containing prefixreg request */
-	name = ccn_charbuf_create();
-	ccn_name_init(name);
-	ccn_name_append_str(name, "ccnx");
-	ccn_name_append(name, face_instance->ccnd_id, face_instance->ccnd_id_size);
-	ccn_name_append_str(name, (operation == OP_REG) ? "prefixreg" : "unreg");
-	ccn_name_append(name, temp->buf, temp->length);
-
-	/* send Interest, get Data */
-	res = ccn_get(h, name, local_scope_template, 1000, resultbuf, &pcobuf, NULL, 0);
-	ON_ERROR_CLEANUP(res);
-
-	res = ccn_content_get_value(resultbuf->buf, resultbuf->length, &pcobuf, &ptr, &length);
-	ON_ERROR_CLEANUP(res);
-    
-	/* extract new forwarding entry from Data */
-	new_forwarding_entry = ccn_forwarding_entry_parse(ptr, length);
-	ON_NULL_CLEANUP(new_forwarding_entry);
-
-	res = new_forwarding_entry->faceid;
-
-	ccn_forwarding_entry_destroy(&new_forwarding_entry);
-	ccn_charbuf_destroy(&signed_info);
-	ccn_charbuf_destroy(&temp);
-	ccn_charbuf_destroy(&resultbuf);
-	ccn_charbuf_destroy(&name);
-	ccn_charbuf_destroy(&prefixreg);
-
-	return res;
-
-	cleanup:
-		ccn_forwarding_entry_destroy(&new_forwarding_entry);
-		ccn_charbuf_destroy(&signed_info);
-		ccn_charbuf_destroy(&temp);
-		ccn_charbuf_destroy(&resultbuf);
-		ccn_charbuf_destroy(&name);
-		ccn_charbuf_destroy(&prefixreg);
-
-	return -1;
-}
-
-/**
- *
- * Create new face by sending out a request Interest
- * The actual new face instance is returned
- * 
- */
-static 
-struct ccn_face_instance *create_face(struct ccn *h, struct ccn_charbuf *local_scope_template,
-        struct ccn_charbuf *no_name, struct ccn_face_instance *face_instance)
-{
-	struct ccn_charbuf *newface = NULL;
-	struct ccn_charbuf *signed_info = NULL;
-	struct ccn_charbuf *temp = NULL;
-	struct ccn_charbuf *name = NULL;
-	struct ccn_charbuf *resultbuf = NULL;
-	struct ccn_parsed_ContentObject pcobuf = {0};
-	struct ccn_face_instance *new_face_instance = NULL;
-	const unsigned char *ptr = NULL;
-	size_t length = 0;
-	int res = 0;
-
-	/* Encode the given face instance */
-	newface = ccn_charbuf_create();
-	ccnb_append_face_instance(newface, face_instance);
-
-	temp = ccn_charbuf_create();
-	res = ccn_sign_content(h, temp, no_name, NULL, newface->buf, newface->length);
-	resultbuf = ccn_charbuf_create();
-
-	/* Construct the Interest name that will create the face */
-	name = ccn_charbuf_create();
-	ccn_name_init(name);
-	ccn_name_append_str(name, "ccnx");
-	ccn_name_append(name, face_instance->ccnd_id, face_instance->ccnd_id_size);
-	ccn_name_append_str(name, face_instance->action);
-	ccn_name_append(name, temp->buf, temp->length);
-
-	/* send Interest to retrieve Data that contains the newly created face */
-	res = ccn_get(h, name, local_scope_template, 1000, resultbuf, &pcobuf, NULL, 0);
-	ON_ERROR_CLEANUP(res);
-
-	/* decode Data to get the actual face instance */
-	res = ccn_content_get_value(resultbuf->buf, resultbuf->length, &pcobuf, &ptr, &length);
-	ON_ERROR_CLEANUP(res);
-
-	new_face_instance = ccn_face_instance_parse(ptr, length);
-
-	ccn_charbuf_destroy(&newface);
-	ccn_charbuf_destroy(&signed_info);
-	ccn_charbuf_destroy(&temp);
-	ccn_charbuf_destroy(&resultbuf);
-	ccn_charbuf_destroy(&name);
-
-	return new_face_instance;
-
-	cleanup:
-		ccn_charbuf_destroy(&newface);
-		ccn_charbuf_destroy(&signed_info);
-		ccn_charbuf_destroy(&temp);
-		ccn_charbuf_destroy(&resultbuf);
-		ccn_charbuf_destroy(&name);
-
-	return NULL;
-}
-
-/**
- *
- * Get ccnd id
- *
- */
-static int 
-get_ccndid(struct ccn *h, struct ccn_charbuf *local_scope_template,
-        unsigned char *ccndid)
-{
-	struct ccn_charbuf *name = NULL;
-	struct ccn_charbuf *resultbuf = NULL;
-	struct ccn_parsed_ContentObject pcobuf = {0};
-	char ccndid_uri[] = "ccnx:/%C1.M.S.localhost/%C1.M.SRV/ccnd/KEY";
-	const unsigned char *ccndid_result;
-	static size_t ccndid_result_size;
-	int res;
-
-	name = ccn_charbuf_create();
-	resultbuf = ccn_charbuf_create();
-
-	res = ccn_name_from_uri(name, ccndid_uri);
-	ON_ERROR_EXIT(res, "Unable to parse service locator URI for ccnd key\n");
-
-	/* get Data */
-	res = ccn_get(h, name, local_scope_template, 4500, resultbuf, &pcobuf, NULL, 0);
-	ON_ERROR_EXIT(res, "Unable to get key from ccnd\n");
-
-	/* extract from Data */
-	res = ccn_ref_tagged_BLOB(CCN_DTAG_PublisherPublicKeyDigest,
-            resultbuf->buf,
-            pcobuf.offset[CCN_PCO_B_PublisherPublicKeyDigest],
-            pcobuf.offset[CCN_PCO_E_PublisherPublicKeyDigest],
-            &ccndid_result, &ccndid_result_size);
-	ON_ERROR_EXIT(res, "Unable to parse ccnd response for ccnd id\n");
-
-	memcpy((void *)ccndid, ccndid_result, ccndid_result_size);
-
-	ccn_charbuf_destroy(&name);
-	ccn_charbuf_destroy(&resultbuf);
-
-	return (ccndid_result_size);
-}
-
-/**
- * Construct a new face instance based on the given address and port
- * This face instance is only used to send new face request
- */
-static struct 
-ccn_face_instance *construct_face(const unsigned char *ccndid, size_t ccndid_size,
-        const char *address, const char *port, unsigned int tunnel_proto)
-{
-	struct ccn_face_instance *fi = calloc(1, sizeof(*fi));
-	char rhostnamebuf[NI_MAXHOST];
-	char rhostportbuf[NI_MAXSERV];
-	struct addrinfo hints = {.ai_family = AF_UNSPEC, .ai_flags = (AI_ADDRCONFIG),
-        .ai_socktype = SOCK_DGRAM};
-	struct addrinfo *raddrinfo = NULL;
-	struct ccn_charbuf *store = ccn_charbuf_create();
-	int host_off = -1;
-	int port_off = -1;
-	int res;
-
-	res = getaddrinfo(address, port, &hints, &raddrinfo);
-	if (res != 0 || raddrinfo == NULL) 
-	{
-		fprintf(stderr, "Error: getaddrinfo\n");
-		return NULL;
-	}
-
-	res = getnameinfo(raddrinfo->ai_addr, raddrinfo->ai_addrlen,
-            rhostnamebuf, sizeof(rhostnamebuf),
-            rhostportbuf, sizeof(rhostportbuf),
-            NI_NUMERICHOST | NI_NUMERICSERV);
-	freeaddrinfo(raddrinfo);	
-	if (res != 0) 
-	{
-		fprintf(stderr, "Error: getnameinfo\n");
-		return NULL;
-	}
-
-	fi->store = store;
-	fi->descr.ipproto = tunnel_proto;
-	fi->descr.mcast_ttl = CCN_FIB_MCASTTTL;
-	fi->lifetime = CCN_FIB_LIFETIME;
-
-	ccn_charbuf_append(store, "newface", strlen("newface") + 1);
-	host_off = store->length;
-	ccn_charbuf_append(store, rhostnamebuf, strlen(rhostnamebuf) + 1);
-	port_off = store->length;
-	ccn_charbuf_append(store, rhostportbuf, strlen(rhostportbuf) + 1);
-
-	char *b = (char *)store->buf;
-	fi->action = b;
-	fi->descr.address = b + host_off;
-	fi->descr.port = b + port_off;
-	fi->descr.source_address = NULL;
-	fi->ccnd_id = ccndid;
-	fi->ccnd_id_size = ccndid_size;
-
-	return fi;
-}
-
-/**
- * initialize local data
- */
-static void 
-init_data(struct ccn_charbuf *local_scope_template,
-        struct ccn_charbuf *no_name)
-{
-	ccn_charbuf_append_tt(local_scope_template, CCN_DTAG_Interest, CCN_DTAG);
-	ccn_charbuf_append_tt(local_scope_template, CCN_DTAG_Name, CCN_DTAG);
-	ccn_charbuf_append_closer(local_scope_template);    /* </Name> */
-	ccnb_tagged_putf(local_scope_template, CCN_DTAG_Scope, "1");
-	ccn_charbuf_append_closer(local_scope_template);    /* </Interest> */
-
-	ccn_name_init(no_name);
-}
-
-static int 
-add_delete_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int p, int operation,unsigned int tunnel_proto)
-{
-	struct ccn_charbuf *prefix;
-	char port[6];
-	struct ccn_charbuf *local_scope_template = ccn_charbuf_create();
-	struct ccn_charbuf *no_name = ccn_charbuf_create();
-	unsigned char ccndid_storage[32] = {0};
-	unsigned char *ccndid = ccndid_storage;
-	size_t ccndid_size = 0;
-	struct ccn_face_instance *fi;
-	struct ccn_face_instance *nfi;
-	int res;
-
-	prefix = ccn_charbuf_create();
-	res = ccn_name_from_uri(prefix, uri);
-	ON_ERROR_CLEANUP(res);
-	memset(port, 0, 6);
-	sprintf(port, "%d", p);
-
-	init_data(local_scope_template, no_name);
-
-	ccndid_size = get_ccndid(h, local_scope_template, ccndid);
-	if (ccndid_size != sizeof(ccndid_storage))
- 	{
-		fprintf(stderr, "Incorrect size for ccnd id in response\n");
-		ON_ERROR_CLEANUP(-1);
-	}
-
-	/* construct a face instance for new face request */
-	fi = construct_face(ccndid, ccndid_size, address, port,tunnel_proto);
-	ON_NULL_CLEANUP(fi);
-
-	/* send new face request to actually create a new face */
-	nfi = create_face(h, local_scope_template, no_name, fi);
-	ON_NULL_CLEANUP(nfi);
-
-
-	res = register_unregister_prefix(h, local_scope_template, no_name, prefix, nfi, operation);
-	ON_ERROR_CLEANUP(res);
-
-	int faceid=nfi->faceid;
-
-	ccn_charbuf_destroy(&local_scope_template);
-	ccn_charbuf_destroy(&no_name);
-	ccn_face_instance_destroy(&fi);
-	ccn_face_instance_destroy(&nfi);
-	ccn_charbuf_destroy(&prefix);
-
-	
-	return faceid;
-
-	cleanup:
-		ccn_charbuf_destroy(&prefix);
-		ccn_charbuf_destroy(&local_scope_template);
-		ccn_charbuf_destroy(&no_name);
-		ccn_face_instance_destroy(&fi);
-		ccn_face_instance_destroy(&nfi);
-
-	return -1;
-}
-
-
-int 
-add_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port, unsigned int tunnel_proto)
-{
-	return add_delete_ccn_face(h, uri, address, port, OP_REG,tunnel_proto);
-}
-
-
-int 
-delete_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port,unsigned int tunnel_proto)
-{
-	return add_delete_ccn_face(h, uri, address, port, OP_UNREG,tunnel_proto);
-}
-
diff --git a/nlsr-sync-0.0/nlsr_face.h b/nlsr-sync-0.0/nlsr_face.h
deleted file mode 100644
index d50ea09..0000000
--- a/nlsr-sync-0.0/nlsr_face.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _NLSR_FACE_H_
-#define _NLSR_FACE_H_
-
-#define CCN_FIB_LIFETIME ((~0U) >> 1)
-#define CCN_FIB_MCASTTTL (-1)
-#define OP_REG  0
-#define OP_UNREG 1
-
-int add_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port,unsigned int tunnel_proto);
-int delete_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port,unsigned int tunnel_proto);
-
-#endif
diff --git a/nlsr-sync-0.0/nlsr_fib.c b/nlsr-sync-0.0/nlsr_fib.c
deleted file mode 100755
index 6ef81cb..0000000
--- a/nlsr-sync-0.0/nlsr_fib.c
+++ /dev/null
@@ -1,231 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <string.h>
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/face_mgmt.h>
-#include <ccn/reg_mgmt.h>
-#include <ccn/charbuf.h>
-
-#include "nlsr_fib.h"
-#include "nlsr.h"
-
-
-static void 
-ccn_fib_warn(int lineno, const char *format, ...)
-{
-	struct timeval t;
-	va_list ap;
-	va_start(ap, format);
-	gettimeofday(&t, NULL);
-	fprintf(stderr, "%d.%06d ccn_fib[%d]:%d: ", (int)t.tv_sec, (unsigned)t.tv_usec, (int)getpid(), lineno);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-}
-
-#define ON_ERROR_CLEANUP(resval) \
-{           \
-    if ((resval) < 0) { \
-        ccn_fib_warn (__LINE__, "OnError cleanup\n"); \
-        goto cleanup; \
-    } \
-}
-
-#define ON_NULL_CLEANUP(resval) \
-{           \
-    if ((resval) == NULL) { \
-        ccn_fib_warn(__LINE__, "OnNull cleanup\n"); \
-        goto cleanup; \
-    } \
-}
-
-
-
-static int 
-register_unregister_prefix(struct ccn *h, struct ccn_charbuf *local_scope_template,
-        struct ccn_charbuf *no_name, struct ccn_charbuf *name_prefix,const unsigned char *ccndid, size_t ccnd_id_size, int faceid, int operation)
-{
-	struct ccn_charbuf *temp = NULL;
-	struct ccn_charbuf *resultbuf = NULL;
-	struct ccn_charbuf *signed_info = NULL;
-	struct ccn_charbuf *name = NULL;
-	struct ccn_charbuf *prefixreg = NULL;
-	struct ccn_parsed_ContentObject pcobuf = {0};
-	struct ccn_forwarding_entry forwarding_entry_storage = {0};
-	struct ccn_forwarding_entry *forwarding_entry = &forwarding_entry_storage;
-	struct ccn_forwarding_entry *new_forwarding_entry;
-	const unsigned char *ptr = NULL;
-	size_t length = 0;
-	int res;
-
-	/* Register or unregister the prefix */
-	forwarding_entry->action = (operation == OP_REG) ? "prefixreg" : "unreg";
-	forwarding_entry->name_prefix = name_prefix;
-	forwarding_entry->ccnd_id = ccndid;
-	forwarding_entry->ccnd_id_size =ccnd_id_size;
-	forwarding_entry->faceid = faceid;
-	forwarding_entry->flags = -1;
-	forwarding_entry->lifetime = 2100;
-
-	prefixreg = ccn_charbuf_create();
-	ccnb_append_forwarding_entry(prefixreg, forwarding_entry);
-	temp = ccn_charbuf_create();
-	res = ccn_sign_content(h, temp, no_name, NULL, prefixreg->buf, prefixreg->length);
-	resultbuf = ccn_charbuf_create();
-
-	/* construct Interest containing prefixreg request */
-	name = ccn_charbuf_create();
-	ccn_name_init(name);
-	ccn_name_append_str(name, "ccnx");
-	ccn_name_append(name, ccndid, ccnd_id_size);
-	ccn_name_append_str(name, (operation == OP_REG) ? "prefixreg" : "unreg");
-	ccn_name_append(name, temp->buf, temp->length);
-
-	/* send Interest, get Data */
-	res = ccn_get(h, name, local_scope_template, 1000, resultbuf, &pcobuf, NULL, 0);
-	ON_ERROR_CLEANUP(res);
-
-	res = ccn_content_get_value(resultbuf->buf, resultbuf->length, &pcobuf, &ptr, &length);
-	ON_ERROR_CLEANUP(res);
-    
-	/* extract new forwarding entry from Data */
-	new_forwarding_entry = ccn_forwarding_entry_parse(ptr, length);
-	ON_NULL_CLEANUP(new_forwarding_entry);
-
-	res = new_forwarding_entry->faceid;
-
-	ccn_forwarding_entry_destroy(&new_forwarding_entry);
-	ccn_charbuf_destroy(&signed_info);
-	ccn_charbuf_destroy(&temp);
-	ccn_charbuf_destroy(&resultbuf);
-	ccn_charbuf_destroy(&name);
-	ccn_charbuf_destroy(&prefixreg);
-
-	return res;
-
-	cleanup:
-		ccn_forwarding_entry_destroy(&new_forwarding_entry);
-		ccn_charbuf_destroy(&signed_info);
-		ccn_charbuf_destroy(&temp);
-		ccn_charbuf_destroy(&resultbuf);
-		ccn_charbuf_destroy(&name);
-		ccn_charbuf_destroy(&prefixreg);
-
-	return -1;
-}
-
-
-static int 
-get_ccndid(struct ccn *h, struct ccn_charbuf *local_scope_template,
-        unsigned char *ccndid)
-{
-	struct ccn_charbuf *name = NULL;
-	struct ccn_charbuf *resultbuf = NULL;
-	struct ccn_parsed_ContentObject pcobuf = {0};
-	char ccndid_uri[] = "ccnx:/%C1.M.S.localhost/%C1.M.SRV/ccnd/KEY";
-	const unsigned char *ccndid_result;
-	static size_t ccndid_result_size;
-	int res;
-
-	name = ccn_charbuf_create();
-	resultbuf = ccn_charbuf_create();
-
-	res = ccn_name_from_uri(name, ccndid_uri);
-	ON_ERROR_CLEANUP(res);
-
-	/* get Data */
-	res = ccn_get(h, name, local_scope_template, 4500, resultbuf, &pcobuf, NULL, 0);
-	ON_ERROR_CLEANUP(res);
-
-	/* extract from Data */
-	res = ccn_ref_tagged_BLOB(CCN_DTAG_PublisherPublicKeyDigest,
-            resultbuf->buf,
-            pcobuf.offset[CCN_PCO_B_PublisherPublicKeyDigest],
-            pcobuf.offset[CCN_PCO_E_PublisherPublicKeyDigest],
-            &ccndid_result, &ccndid_result_size);
-	ON_ERROR_CLEANUP(res);
-
-	memcpy((void *)ccndid, ccndid_result, ccndid_result_size);
-
-	ccn_charbuf_destroy(&name);
-	ccn_charbuf_destroy(&resultbuf);
-
-	return (ccndid_result_size);
-
-	cleanup:
-		ccn_charbuf_destroy(&name);
-		ccn_charbuf_destroy(&resultbuf);
-
-	return -1;
-}
-
-static void 
-init_data(struct ccn_charbuf *local_scope_template,
-        struct ccn_charbuf *no_name)
-{
-	ccn_charbuf_append_tt(local_scope_template, CCN_DTAG_Interest, CCN_DTAG);
-	ccn_charbuf_append_tt(local_scope_template, CCN_DTAG_Name, CCN_DTAG);
-	ccn_charbuf_append_closer(local_scope_template);    /* </Name> */
-	ccnb_tagged_putf(local_scope_template, CCN_DTAG_Scope, "1");
-	ccn_charbuf_append_closer(local_scope_template);    /* </Interest> */
-
-	ccn_name_init(no_name);
-}
-
-int 
-add_delete_ccn_face_by_face_id(struct ccn *h, const char *uri, int operation, int faceid)
-{
-	if ( nlsr->debugging )
-	{
-		printf("add_delete_ccn_face_by_face_id called\n");
-		printf("Uri: %s  Face: %d Operation: %s \n",(char *)uri , faceid, operation == OP_REG ? "Registration" : "Unregistration");
-	}
-
-	struct ccn_charbuf *prefix;
-	struct ccn_charbuf *local_scope_template = ccn_charbuf_create();
-	struct ccn_charbuf *no_name = ccn_charbuf_create();
-	unsigned char ccndid_storage[32] = {0};
-	unsigned char *ccndid = ccndid_storage;
-	size_t ccndid_size = 0;
-	int res;
-
-	prefix = ccn_charbuf_create();
-	res = ccn_name_from_uri(prefix, uri);
-	ON_ERROR_CLEANUP(res);
-
-
-	init_data(local_scope_template, no_name);
-
-	ccndid_size = get_ccndid(h, local_scope_template, ccndid);
-	if (ccndid_size != sizeof(ccndid_storage))
- 	{
-		fprintf(stderr, "Incorrect size for ccnd id in response\n");
-		ON_ERROR_CLEANUP(-1);
-	}
-
-	res = register_unregister_prefix(h, local_scope_template, no_name, prefix,ccndid, ccndid_size,faceid, operation);
-	
-	ON_ERROR_CLEANUP(res);
-
-	ccn_charbuf_destroy(&local_scope_template);
-	ccn_charbuf_destroy(&no_name);
-	ccn_charbuf_destroy(&prefix);
-
-	return 0;
-
-	cleanup:
-		ccn_charbuf_destroy(&prefix);
-		ccn_charbuf_destroy(&local_scope_template);
-		ccn_charbuf_destroy(&no_name);
-
-	return -1;
-}
-
-
diff --git a/nlsr-sync-0.0/nlsr_fib.h b/nlsr-sync-0.0/nlsr_fib.h
deleted file mode 100755
index ce5e6d1..0000000
--- a/nlsr-sync-0.0/nlsr_fib.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _NLSR_FIB_H_
-#define _NLSR_FIB_H_
-
-#define CCN_FIB_LIFETIME ((~0U) >> 1)
-#define CCN_FIB_MCASTTTL (-1)
-#define OP_REG  0
-#define OP_UNREG 1
-
-int add_delete_ccn_face_by_face_id(struct ccn *h, const char *uri, int operation, int faceid);
-
-#endif
diff --git a/nlsr-sync-0.0/nlsr_lsdb.c b/nlsr-sync-0.0/nlsr_lsdb.c
deleted file mode 100755
index 00bb5b1..0000000
--- a/nlsr-sync-0.0/nlsr_lsdb.c
+++ /dev/null
@@ -1,2521 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-#include "nlsr.h"
-#include "nlsr_ndn.h"
-#include "nlsr_lsdb.h"
-#include "utility.h"
-#include "nlsr_npl.h"
-#include "nlsr_adl.h"
-#include "nlsr_route.h"
-#include "nlsr_npt.h"
-#include "nlsr_sync.h"
-
-void
-set_new_lsdb_version(void)
-{
-	char *time_stamp=(char *)malloc(20);
-	memset(time_stamp,0,20);
-	get_current_timestamp_micro(time_stamp);
-	
-	free(nlsr->lsdb->lsdb_version);
-	nlsr->lsdb->lsdb_version=(char *)malloc(strlen(time_stamp)+1);
-	memset(nlsr->lsdb->lsdb_version,0,strlen(time_stamp)+1);
-	memcpy(nlsr->lsdb->lsdb_version,time_stamp,strlen(time_stamp)+1);
-
-	free(time_stamp);
-	
-}
-
-void 
-make_name_lsa_key(char *key, char *orig_router, int ls_type, long int ls_id)
-{
-	
-	char lst[2];
-	memset(lst,0,2);
-	sprintf(lst,"%d",ls_type);	
-
-	char lsid[10];
-	memset(lsid,0,10);
-	sprintf(lsid,"%ld",ls_id);
-	
-	memcpy(key+strlen(key),orig_router,strlen(orig_router));
-	memcpy(key+strlen(key),"/",1);
-	memcpy(key+strlen(key),lst,strlen(lst));
-	memcpy(key+strlen(key),"/",1);
-	memcpy(key+strlen(key),lsid,strlen(lsid));
-	
-	if ( nlsr->debugging )
-		printf("name LSA Key: %s\n", key);
-}
-
-
-void 
-make_name_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, long int ls_id,char *orig_time,char *slice_prefix)
-{
-	sprintf(key,"%s%s/%ld/%d/%s",slice_prefix, orig_router, ls_id,ls_type, orig_time);
-	
-	if ( nlsr->debugging )
-		printf("Name LSA prefix for repo content: %s\n",key);
-}
-
-void 
-make_adj_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, char *orig_time,char *slice_prefix)
-{
-		
-	sprintf(key,"%s%s/%d/%s",slice_prefix,orig_router,ls_type, orig_time );	
-
-	if ( nlsr->debugging )
-		printf("Name LSA prefix for repo content:%s\n",key);	
-}
-
-void 
-make_cor_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, char *orig_time,char *slice_prefix)
-{
-		
-	sprintf(key,"%s%s/%d/%s",slice_prefix,orig_router,ls_type, orig_time );	
-
-	if ( nlsr->debugging )
-		printf("Cor LSA prefix for repo content:%s\n",key);	
-}
-
-void 
-build_and_install_name_lsas(void)
-{
-	if ( nlsr->debugging )
-		printf("build_and_install_name_lsas called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_and_install_name_lsas called\n");
-
-	int i, npl_element;
-	struct name_prefix_list_entry *npe;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npl, e);
-	npl_element=hashtb_n(nlsr->npl);
-
-	for(i=0;i<npl_element;i++)
-	{
-		npe=e->data;
-		struct nlsa *name_lsa=(struct nlsa *)malloc(sizeof( struct nlsa ));
-		build_name_lsa(name_lsa,npe->np);
-		
-		install_name_lsa(name_lsa);
-		update_nlsa_id_for_name_in_npl(npe->np,name_lsa->header->ls_id);
-		free(name_lsa->header->orig_router->name);
-		free(name_lsa->header->orig_router);
-		free(name_lsa->header);
-		free(name_lsa->name_prefix->name);
-		free(name_lsa->name_prefix);
-		free(name_lsa);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);	
-	
-	print_name_prefix_from_npl();
-
-}
-
-void 
-build_and_install_single_name_lsa(struct name_prefix *np)
-{
-	if ( nlsr->debugging )
-		printf("build_and_install_single_name_lsa called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_and_install_single_name_lsa called\n");
-	
-	struct nlsa *name_lsa=(struct nlsa *)malloc(sizeof( struct nlsa ));
-	build_name_lsa(name_lsa,np);
-		
-	install_name_lsa(name_lsa);
-	update_nlsa_id_for_name_in_npl(np,name_lsa->header->ls_id);
-
-	free(name_lsa->header->orig_router->name);
-	free(name_lsa->header->orig_router);
-	free(name_lsa->header);
-	free(name_lsa->name_prefix->name);
-	free(name_lsa->name_prefix);
-	free(name_lsa);
-	
-	print_name_prefix_from_npl();
-
-}
-
-void 
-build_name_lsa(struct nlsa *name_lsa, struct name_prefix *np)
-{
-	name_lsa->header=(struct nlsa_header *)malloc(sizeof(struct nlsa_header ));
-	name_lsa->header->ls_type=LS_TYPE_NAME;
-
-	char *time_stamp=(char *)malloc(20);
-	memset(time_stamp,0,20);
-	get_current_timestamp_micro(time_stamp);
-
-	name_lsa->header->orig_time=(char *)malloc(strlen(time_stamp)+1); //free 
-	memset(name_lsa->header->orig_time,0,strlen(time_stamp)+1);
-	memcpy(name_lsa->header->orig_time,time_stamp,strlen(time_stamp)+1);
-	
-	free(time_stamp);
-
-	name_lsa->header->ls_id=++nlsr->nlsa_id;
-	name_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	name_lsa->header->orig_router->name=(char *)malloc(strlen(nlsr->router_name)+1);
-	memset(name_lsa->header->orig_router->name,0,strlen(nlsr->router_name)+1);
-	memcpy(name_lsa->header->orig_router->name,nlsr->router_name,strlen(nlsr->router_name)+1);
-	name_lsa->header->orig_router->length=strlen(nlsr->router_name)+1;
-	name_lsa->header->isValid=1;
-
-	
-	name_lsa->name_prefix=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	name_lsa->name_prefix->name=(char *)malloc(np->length);
-	memcpy(name_lsa->name_prefix->name,np->name,np->length);
-	name_lsa->name_prefix->length=np->length;
-
-}
-
-void 
-install_name_lsa(struct nlsa *name_lsa)
-{
-
-	char *time_stamp=(char *)malloc(20);
-	memset(time_stamp,0,20);
-	get_current_timestamp_micro(time_stamp);
-	
-
-		char lst[2];
-		memset(lst,0,2);
-		sprintf(lst,"%d",name_lsa->header->ls_type);	
-
-		char lsid[10];
-		memset(lsid,0,10);
-		sprintf(lsid,"%ld",name_lsa->header->ls_id);
-	
-	
-		char *key=(char *)malloc(strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
-		memset(key,0,strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
-
-
-		make_name_lsa_key(key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id);
-		if ( nlsr->debugging )
-			printf("Key:%s Length:%d\n",key,(int)strlen(key));
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Key:%s Length:%d\n",key,(int)strlen(key));	
-		
-
-		struct nlsa *new_name_lsa=(struct nlsa*)malloc(sizeof(struct nlsa )); //free
-
-		struct hashtb_enumerator ee;
-    		struct hashtb_enumerator *e = &ee; 	
-    		int res;
-
-   		hashtb_start(nlsr->lsdb->name_lsdb, e);
-    		res = hashtb_seek(e, key, strlen(key), 0);
-
-		if(res == HT_NEW_ENTRY )
-		{
-		
-			if ( nlsr->debugging )
-				printf("New Name LSA... Adding to LSDB\n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Name LSA... Adding to LSDB\n");
-
-
-			new_name_lsa = e->data;
-
-			new_name_lsa->header=(struct nlsa_header *)malloc(sizeof(struct nlsa_header )); //free
-			new_name_lsa->header->ls_type=name_lsa->header->ls_type;
-
-			new_name_lsa->header->orig_time=(char *)malloc(strlen(name_lsa->header->orig_time)+1);
-			memset(new_name_lsa->header->orig_time,0,strlen(name_lsa->header->orig_time)+1);
-			memcpy(new_name_lsa->header->orig_time,name_lsa->header->orig_time,strlen(name_lsa->header->orig_time)+1);
-
-			new_name_lsa->header->ls_id=name_lsa->header->ls_id;
-			new_name_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix )); //free
-			new_name_lsa->header->orig_router->name=(char *)malloc(name_lsa->header->orig_router->length);
-			memcpy(new_name_lsa->header->orig_router->name,name_lsa->header->orig_router->name,name_lsa->header->orig_router->length);
-			new_name_lsa->header->orig_router->length=name_lsa->header->orig_router->length;
-			new_name_lsa->header->isValid=name_lsa->header->isValid;
-
-	
-			new_name_lsa->name_prefix=(struct name_prefix *)malloc(sizeof(struct name_prefix )); //free
-			new_name_lsa->name_prefix->name=(char *)malloc(name_lsa->name_prefix->length);
-			memcpy(new_name_lsa->name_prefix->name,name_lsa->name_prefix->name,name_lsa->name_prefix->length);
-			new_name_lsa->name_prefix->length=name_lsa->name_prefix->length;
-
-			if ( nlsr->debugging )
-			{
-				printf("New Name LSA Added....\n");	
-				printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-			}
-			if ( nlsr->detailed_logging )
-			{
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Name LSA Added....\n");	
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-			}
-			set_new_lsdb_version();	
-			if ( nlsr->debugging )
-				printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);	
-
-			
-			int num_next_hop=get_number_of_next_hop(new_name_lsa->header->orig_router->name);
-			if ( num_next_hop < 0 )
-			{
-				int check=add_npt_entry(new_name_lsa->header->orig_router->name,new_name_lsa->name_prefix->name,NO_NEXT_HOP,NULL,NULL);
-				if ( check == HT_NEW_ENTRY )
-				{
-					if ( nlsr->debugging )
-						printf("Added in npt \n");
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Added in npt \n");
-				}
-			}
-			else 
-			{
-				int *faces=malloc(num_next_hop*sizeof(int));
-				int *route_costs=malloc(num_next_hop*sizeof(int));			
-				int next_hop=get_next_hop(new_name_lsa->header->orig_router->name,faces,route_costs);
-				if ( nlsr->debugging )
-				{
-					printf("Printing from install_name_lsa \n");
-					int j;
-					for(j=0;j<num_next_hop;j++)
-						printf("Face: %d Route Cost: %d \n",faces[j],route_costs[j]);
-				}
-				if ( nlsr->detailed_logging )
-				{
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Printing from install_name_lsa \n");
-					int j;
-					for(j=0;j<num_next_hop;j++)
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Face: %d Route Cost: %d \n",faces[j],route_costs[j]);
-				}
-				int check=add_npt_entry(new_name_lsa->header->orig_router->name,new_name_lsa->name_prefix->name,next_hop,faces,route_costs);
-				if ( check == HT_NEW_ENTRY )
-				{
-					if ( nlsr->debugging )
-						printf("Added in npt \n");
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Added in npt \n");
-				}
-				free(faces);
-				free(route_costs);
-
-			}
-			
-			writeLogg(__FILE__,__FUNCTION__,__LINE__," Name-LSA\n");
-			writeLogg(__FILE__,__FUNCTION__,__LINE__," Adding name lsa\n");
-			write_log_for_name_lsa(new_name_lsa);
-			writeLogg(__FILE__,__FUNCTION__,__LINE__," name_lsa_end\n");
-		
-			free(time_stamp);
-
-		}
-		else if(res == HT_OLD_ENTRY)
-		{
-			new_name_lsa=e->data;
-			if(strcmp(name_lsa->header->orig_time,new_name_lsa->header->orig_time)<0)
-			{
-				if ( nlsr->debugging )
-					printf("Older Adj LSA. Discarded... \n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Older Adj LSA. Discarded...\n");
-			}
-			else if( strcmp(name_lsa->header->orig_time,new_name_lsa->header->orig_time) == 0 )
-			{
-				if ( nlsr->debugging )
-					printf("Duplicate Adj LSA. Discarded... \n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Duplicate Adj LSA. Discarded...\n");
-			}
-			else 
-			{
-				if ( name_lsa->header->isValid == 0 )
-				{
-					// have to call to delete npt table entry
-					delete_npt_entry_by_router_and_name_prefix(new_name_lsa->header->orig_router->name,new_name_lsa->name_prefix->name);
-				
-					if ( strcmp(name_lsa->header->orig_router->name,nlsr->router_name)!= 0)
-					{
-						writeLogg(__FILE__,__FUNCTION__,__LINE__," Name-LSA\n");
-						writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting name lsa\n");
-						write_log_for_name_lsa(new_name_lsa);
-						writeLogg(__FILE__,__FUNCTION__,__LINE__," name_lsa_end\n");
-						
-						hashtb_delete(e);
-						if ( nlsr->debugging )
-							printf("isValid bit not set for Router %s so LSA Deleted from LSDB\n",name_lsa->header->orig_router->name);
-						if ( nlsr->detailed_logging )
-							writeLogg(__FILE__,__FUNCTION__,__LINE__,"isValid bit not set for Router %s so LSA Deleted from LSDB\n",name_lsa->header->orig_router->name);
-					}
-					else 
-					{
-						new_name_lsa->header->isValid=name_lsa->header->isValid;
-						free(new_name_lsa->header->orig_time);
-						new_name_lsa->header->orig_time=(char *)malloc(strlen(name_lsa->header->orig_time)+1);
-						memset(new_name_lsa->header->orig_time,0,strlen(name_lsa->header->orig_time)+1);
-						memcpy(new_name_lsa->header->orig_time,name_lsa->header->orig_time,strlen(name_lsa->header->orig_time)+1);
-					}
-					if ( nlsr->debugging )
-						printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-					set_new_lsdb_version();	
-					if ( nlsr->debugging )
-						printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-				}
-				else
-				{
-					int is_npt_update=0;
-					if ( strcmp(new_name_lsa->name_prefix->name,name_lsa->name_prefix->name) != 0 )
-					{
-						is_npt_update=1;
-						delete_npt_entry_by_router_and_name_prefix(new_name_lsa->header->orig_router->name,new_name_lsa->name_prefix->name);
-					}
-
-					// copying LSA content with header
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Name-LSA\n");
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting name lsa\n");
-					write_log_for_name_lsa(new_name_lsa);
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," name_lsa_end\n");					
-
-
-					free(new_name_lsa->header->orig_time);
-					new_name_lsa->header->orig_time=(char *)malloc(strlen(name_lsa->header->orig_time)+1);
-					memset(new_name_lsa->header->orig_time,0,strlen(name_lsa->header->orig_time)+1);
-					memcpy(new_name_lsa->header->orig_time,name_lsa->header->orig_time,strlen(name_lsa->header->orig_time)+1);
-				
-					new_name_lsa->header->isValid=name_lsa->header->isValid;
-
-					free(new_name_lsa->name_prefix->name);
-					free(new_name_lsa->name_prefix);
-					new_name_lsa->name_prefix=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-					new_name_lsa->name_prefix->name=(char *)malloc(name_lsa->name_prefix->length);
-					memcpy(new_name_lsa->name_prefix->name,name_lsa->name_prefix->name,name_lsa->name_prefix->length);
-					new_name_lsa->name_prefix->length=name_lsa->name_prefix->length;
-
-
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Name-LSA\n");
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Adding name lsa\n");
-					write_log_for_name_lsa(new_name_lsa);
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," name_lsa_end\n");
-
-					if ( nlsr->debugging )
-						printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-					set_new_lsdb_version();	
-
-					if ( nlsr->debugging )
-						printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-
-					if( is_npt_update == 1 )
-					{
-						//struct hashtb *face_list;
-						int num_next_hop=get_number_of_next_hop(new_name_lsa->header->orig_router->name);
-						if ( num_next_hop < 0 )
-						{
-							
-							int check=add_npt_entry(new_name_lsa->header->orig_router->name,new_name_lsa->name_prefix->name,NO_NEXT_HOP,NULL,NULL);
-							if ( check == HT_NEW_ENTRY )
-							{
-								if ( nlsr->debugging )
-									printf("Added in npt \n");
-								if ( nlsr->detailed_logging )
-									writeLogg(__FILE__,__FUNCTION__,__LINE__,"Added in npt \n");
-							}
-						}
-						else 
-						{
-							int *faces=malloc(num_next_hop*sizeof(int));
-							int *route_costs=malloc(num_next_hop*sizeof(int));			
-							int next_hop=get_next_hop(new_name_lsa->header->orig_router->name,faces,route_costs);
-							
-							if ( nlsr->debugging )
-							{
-								printf("Printing from install_name_lsa \n");
-								int j;
-								for(j=0;j<num_next_hop;j++)
-								printf("Face: %d Route Cost: %d \n",faces[j],route_costs[j]);
-							}
-							if ( nlsr->detailed_logging )
-							{
-								writeLogg(__FILE__,__FUNCTION__,__LINE__,"Printing from install_name_lsa \n");
-								int j;
-								for(j=0;j<num_next_hop;j++)
-									writeLogg(__FILE__,__FUNCTION__,__LINE__,"Face: %d Route Cost: %d \n",faces[j],route_costs[j]);
-							}
-
-							
-							int check=add_npt_entry(new_name_lsa->header->orig_router->name,new_name_lsa->name_prefix->name,next_hop,faces,route_costs);
-							if ( check == HT_NEW_ENTRY )
-							{
-								if ( nlsr->debugging )
-									printf("Added in npt \n");
-								if ( nlsr->detailed_logging )
-									writeLogg(__FILE__,__FUNCTION__,__LINE__,"Added in npt \n");
-							}
-							free(faces);
-							free(route_costs);
-							
-						}
-						
-					}
-				}
-			}
-		
-		}
-
-    		hashtb_end(e);
-
-		free(key);
-}
-
-void 
-write_log_for_name_lsa(struct nlsa *name_lsa)
-{
-	
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"-----------Name LSA Content---------------\n");
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Origination Router: %s\n",name_lsa->header->orig_router->name);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Origination Router Length:	%d\n",name_lsa->header->orig_router->length);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"	LS Type:	%d\n",name_lsa->header->ls_type);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"	LS Id:	%ld\n",name_lsa->header->ls_id);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Origination Time:	%s\n",name_lsa->header->orig_time);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Is Valid:	%d\n",name_lsa->header->isValid);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"	LSA Data			\n");
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"		Name Prefix: %s\n",name_lsa->name_prefix->name);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"		Name Prefix Length:	%d\n",name_lsa->name_prefix->length);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");	
-}
-
-void 
-print_name_lsa(struct nlsa *name_lsa)
-{
-
-	if ( nlsr->debugging )
-	{
-		printf("-----------Name LSA Content---------------\n");
-		printf("	Origination Router       :	%s\n",name_lsa->header->orig_router->name);
-		printf("	Origination Router Length:	%d\n",name_lsa->header->orig_router->length);
-		printf("	LS Type			 :	%d\n",name_lsa->header->ls_type);
-		printf("	LS Id			 :	%ld\n",name_lsa->header->ls_id);
-		printf("	Origination Time	 :	%s\n",name_lsa->header->orig_time);
-		printf("	Is Valid 		 :	%d\n",name_lsa->header->isValid);
-		printf("	LSA Data			\n");
-		printf("		Name Prefix:	 	:	%s\n",name_lsa->name_prefix->name);
-		printf("		Name Prefix Length	:	%d\n",name_lsa->name_prefix->length);
-
-		printf("\n");	
-	}
-}
-
-void
-print_name_lsdb(void)
-{
-	if ( nlsr->debugging )
-		printf("print_name_lsdb called \n");	
-	int i, name_lsdb_element;
-	struct nlsa *name_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->name_lsdb, e);
-	name_lsdb_element=hashtb_n(nlsr->lsdb->name_lsdb);
-
-	for(i=0;i<name_lsdb_element;i++)
-	{
-		if ( nlsr->debugging )
-			printf("-----------Name LSA (%d)---------------\n",i+1);
-		name_lsa=e->data;
-		print_name_lsa(name_lsa);	
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	if ( nlsr->debugging )
-		printf("\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-}
-
-
-void
-build_and_install_others_name_lsa(char *orig_router,int ls_type,long int ls_id,char *orig_time, int isValid,char *np)
-{
-	if ( nlsr->debugging )
-		printf("build_and_install_others_name_lsa called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_and_install_others_name_lsa called \n");
-
-	struct nlsa *name_lsa=(struct nlsa *)malloc(sizeof( struct nlsa ));
-	build_others_name_lsa(name_lsa,orig_router,ls_type,ls_id,orig_time, isValid,np);
-	print_name_lsa(name_lsa);
-	install_name_lsa(name_lsa);
-	print_name_lsdb();
-	print_npt();
-	
-	free(name_lsa->header->orig_router->name);
-	free(name_lsa->header->orig_router);
-	free(name_lsa->header);
-	free(name_lsa->name_prefix->name);
-	free(name_lsa->name_prefix);
-	free(name_lsa);
-	
-}
-
-void
-build_others_name_lsa(struct nlsa *name_lsa, char *orig_router,int ls_type,long int ls_id,char *orig_time, int isValid,char *np)
-{
-	if ( nlsr->debugging )
-		printf("build_others_name_lsa called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_others_name_lsa called \n");
-
-	name_lsa->header=(struct nlsa_header *)malloc(sizeof(struct nlsa_header ));
-	name_lsa->header->ls_type=LS_TYPE_NAME;
-
-	name_lsa->header->orig_time=(char *)malloc(strlen(orig_time)+1);
-	memset(name_lsa->header->orig_time,0,strlen(orig_time)+1);
-	memcpy(name_lsa->header->orig_time,orig_time,strlen(orig_time)+1);
-
-	name_lsa->header->ls_id=ls_id;
-	name_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	name_lsa->header->orig_router->name=(char *)malloc(strlen(orig_router)+1);
-	memset(name_lsa->header->orig_router->name,0,strlen(orig_router)+1);
-	memcpy(name_lsa->header->orig_router->name,orig_router,strlen(orig_router)+1);
-	name_lsa->header->orig_router->length=strlen(orig_router)+1;
-	name_lsa->header->isValid=isValid;
-
-	name_lsa->name_prefix=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	name_lsa->name_prefix->name=(char *)malloc(strlen(np)+1);
-	memset(name_lsa->name_prefix->name,0,strlen(np)+1);
-	memcpy(name_lsa->name_prefix->name,np,strlen(np)+1);
-	name_lsa->name_prefix->length=strlen(np)+1;
-}
-
-
-void 
-make_cor_lsa_key(char *key,struct clsa *cor_lsa)
-{
-	memcpy(key+strlen(key),cor_lsa->header->orig_router->name,cor_lsa->header->orig_router->length);
-	memcpy(key+strlen(key),"/",1);
-	char ls_type[2];
-	sprintf(ls_type,"%d",cor_lsa->header->ls_type);
-	memcpy(key+strlen(key),ls_type,strlen(ls_type));
-	key[strlen(key)]='\0';
-}
-
-
-void 
-make_adj_lsa_key(char *key,struct alsa *adj_lsa)
-{
-	memcpy(key+strlen(key),adj_lsa->header->orig_router->name,adj_lsa->header->orig_router->length);
-	memcpy(key+strlen(key),"/",1);
-	char ls_type[2];
-	sprintf(ls_type,"%d",adj_lsa->header->ls_type);
-	memcpy(key+strlen(key),ls_type,strlen(ls_type));
-	key[strlen(key)]='\0';
-}
-
-int
-build_and_install_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
-{
-	if(flags == CCN_SCHEDULE_CANCEL)
-	{
- 	 	return -1;
-	}
-
-	nlsr_lock();
-
-	if ( nlsr->debugging )
-		printf("build_and_install_adj_lsa called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_and_install_adj_lsa called \n");
-	
-	if ( nlsr->debugging )
-		printf("adj_build_flag = %d \n",nlsr->adj_build_flag);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"adj_build_flag = %d \n",nlsr->adj_build_flag);
-
-	if(nlsr->adj_build_flag > 0)
-	{
-		if ( nlsr->debugging )
-			printf("is_adj_lsa_build = %d \n",is_adj_lsa_build());
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"is_adj_lsa_build = %d \n",is_adj_lsa_build());
-
-		if ( is_adj_lsa_build()> 0)
-		{
-			struct alsa *adj_lsa=(struct alsa *)malloc(sizeof( struct alsa ));
-			build_adj_lsa(adj_lsa);
-			install_adj_lsa(adj_lsa);
-
-			char lst[2];
-			memset(lst,0,2);
-			sprintf(lst,"%d",LS_TYPE_ADJ);			
-
-			char *repo_key=(char *)malloc(strlen(nlsr->slice_prefix)+strlen(adj_lsa->header->orig_time)+strlen(adj_lsa->header->orig_router->name) + strlen(lst) + 5);
-			memset(repo_key, 0, strlen(nlsr->slice_prefix)+strlen(adj_lsa->header->orig_time)+strlen(adj_lsa->header->orig_router->name) + strlen(lst) + 5);	
-			make_adj_lsa_prefix_for_repo(repo_key, adj_lsa->header->orig_router->name,LS_TYPE_ADJ,adj_lsa->header->orig_time,nlsr->slice_prefix);
-		
-			if ( nlsr->debugging )
-				printf("Adj LSA Repo Key: %s \n",repo_key);
-
-			char *key=(char *)malloc(adj_lsa->header->orig_router->length+2+2);
-			memset(key,0,adj_lsa->header->orig_router->length+2+2);
-			make_adj_lsa_key(key,adj_lsa);
-			if ( nlsr->debugging )
-				printf("Adj LSA: %s \n",key);
-
-			struct name_prefix *lsaid=(struct name_prefix *)malloc(sizeof(struct name_prefix));
-			lsaid->name=(char *)malloc(strlen(key)+1);
-			memset(lsaid->name, 0, strlen(key)+1);
-			memcpy(lsaid->name,key,strlen(key));
-			lsaid->length=strlen(key)+1;
-
-		
-			write_adj_lsa_to_repo(repo_key, lsaid);
-
-			free(key);
-			free(repo_key);
-			free(lsaid->name);
-			free(lsaid);
-
-
-		
-			free(adj_lsa->header->orig_router->name);
-			free(adj_lsa->header->orig_router);
-			free(adj_lsa->header->orig_time);
-			free(adj_lsa->header);
-			free(adj_lsa->body);
-			free(adj_lsa);
-			nlsr->adj_build_flag=0;	
-			print_adj_lsdb();		
-		}
-		else
-		{
-			if ( nlsr->debugging )
-				printf("Can not build adj LSA now\n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Can not build adj LSA now\n");
-		}
-	}
-	nlsr->is_build_adj_lsa_sheduled=0;
-
-	nlsr_unlock();
-
-	return 0;
-}
-
-
-void
-build_adj_lsa(struct alsa * adj_lsa)
-{
-	if ( nlsr->debugging )
-		printf("build_adj_lsa called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_adj_lsa called  \n");
-
-	int no_link=no_active_nbr();
-	
-	adj_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
-	adj_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	adj_lsa->header->orig_router->name=(char *)malloc(strlen(nlsr->router_name)+1);
-	memset(adj_lsa->header->orig_router->name,0,strlen(nlsr->router_name)+1);
-	memcpy(adj_lsa->header->orig_router->name,nlsr->router_name,strlen(nlsr->router_name)+1);
-	adj_lsa->header->orig_router->length=strlen(nlsr->router_name)+1;
-
-	adj_lsa->header->ls_type=(unsigned)LS_TYPE_ADJ;	
-
-	char *time_stamp=(char *)malloc(20);
-	memset(time_stamp,0,20);
-	get_current_timestamp_micro(time_stamp);
-
-	adj_lsa->header->orig_time=(char *)malloc(strlen(time_stamp)+1); 
-	memset(adj_lsa->header->orig_time,0,strlen(time_stamp)+1);
-	memcpy(adj_lsa->header->orig_time,time_stamp,strlen(time_stamp)+1);	
-	free(time_stamp);
-
-	adj_lsa->no_link=no_link;
-
-
-	struct ccn_charbuf *c=ccn_charbuf_create();
-	get_active_nbr_adj_data(c);
-	char *data=ccn_charbuf_as_string(c);
-
-	adj_lsa->body=(char *)malloc(strlen(data)+1);
-	memset(adj_lsa->body,0,strlen(data)+1);
-	memcpy(adj_lsa->body,(char *)data,strlen(data)+1);
-	ccn_charbuf_destroy(&c);
-
-	nlsr->adj_build_count++;
-
-
-}
-
-
-void
-install_adj_lsa(struct alsa * adj_lsa)
-{
-
-	if ( nlsr->debugging )
-		printf("install_adj_lsa called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"install_adj_lsa called  \n");
-	
-
-	char *time_stamp=(char *)malloc(20);
-	memset(time_stamp,0,20);
-	get_current_timestamp_micro(time_stamp);
-
-
-		char *key=(char *)malloc(adj_lsa->header->orig_router->length+2+2);
-		memset(key,0,adj_lsa->header->orig_router->length+2);
-		make_adj_lsa_key(key,adj_lsa);
-
-		struct alsa *new_adj_lsa=(struct alsa*)malloc(sizeof(struct alsa ));
-
-		struct hashtb_enumerator ee;
-    		struct hashtb_enumerator *e = &ee; 	
-    		int res;
-
-   		hashtb_start(nlsr->lsdb->adj_lsdb, e);
-    		res = hashtb_seek(e, key, strlen(key), 0);
-
-
-
-		if(res == HT_NEW_ENTRY)
-		{
-			if ( adj_lsa->no_link > 0)
-			{
-				if ( nlsr->debugging )
-					printf("New ADJ LSA... Adding to LSDB\n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"New ADJ LSA... Adding to LSDB\n");
-				new_adj_lsa = e->data;
-
-				new_adj_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
-				new_adj_lsa->header->ls_type=adj_lsa->header->ls_type;
-				new_adj_lsa->header->orig_time=(char *)malloc(strlen(adj_lsa->header->orig_time)+1);
-				memcpy(new_adj_lsa->header->orig_time,adj_lsa->header->orig_time,strlen(adj_lsa->header->orig_time)+1);		
-
-				new_adj_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-				new_adj_lsa->header->orig_router->name=(char *)malloc(adj_lsa->header->orig_router->length);
-				memcpy(new_adj_lsa->header->orig_router->name,adj_lsa->header->orig_router->name,adj_lsa->header->orig_router->length);
-				new_adj_lsa->header->orig_router->length=adj_lsa->header->orig_router->length;
-
-				new_adj_lsa->no_link=adj_lsa->no_link;
-		
-				new_adj_lsa->body=(char *)malloc(strlen(adj_lsa->body)+1);
-				memset(new_adj_lsa->body,0,strlen(adj_lsa->body)+1);
-				memcpy(new_adj_lsa->body,adj_lsa->body,strlen(adj_lsa->body)+1);
-			
-				add_next_hop_router(new_adj_lsa->header->orig_router->name);
-				add_next_hop_from_lsa_adj_body(new_adj_lsa->body,new_adj_lsa->no_link);
-
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Adding adj lsa\n");
-				write_log_for_adj_lsa(new_adj_lsa);
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
-			}
-			else 
-			{
-				hashtb_delete(e);
-			}
-
-			if ( nlsr->debugging )
-				printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-			set_new_lsdb_version();	
-
-			if ( nlsr->debugging )
-				printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-		}
-		else if(res == HT_OLD_ENTRY)
-		{
-			new_adj_lsa = e->data;
-			if(strcmp(adj_lsa->header->orig_time,new_adj_lsa->header->orig_time)<=0)
-			{
-				if ( nlsr->debugging )
-					printf("Older/Duplicate Adj LSA. Discarded...\n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Older/Duplicate Adj LSA. Discarded...\n");
-			}
-			else
-			{
-
-				if ( adj_lsa->no_link > 0)
-				{				
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting adj lsa\n");
-					write_log_for_adj_lsa(new_adj_lsa);
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
-
-					free(new_adj_lsa->header->orig_time);
-					new_adj_lsa->header->orig_time=(char *)malloc(strlen(adj_lsa->header->orig_time)+1);
-					memcpy(new_adj_lsa->header->orig_time,adj_lsa->header->orig_time,strlen(adj_lsa->header->orig_time)+1);
-
-					new_adj_lsa->no_link=adj_lsa->no_link;
-				
-					new_adj_lsa->body=(char *)malloc(strlen(adj_lsa->body)+1);
-					memset(new_adj_lsa->body,0,strlen(adj_lsa->body)+1);
-					memcpy(new_adj_lsa->body,adj_lsa->body,strlen(adj_lsa->body)+1);
-
-					add_next_hop_from_lsa_adj_body(new_adj_lsa->body,new_adj_lsa->no_link);
-
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Adding adj lsa\n");
-					write_log_for_adj_lsa(new_adj_lsa);
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
-				}
-				else
-				{
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting adj lsa\n");
-					write_log_for_adj_lsa(new_adj_lsa);
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
-					
-					hashtb_delete(e);
-				}
-				
-				if ( nlsr->debugging )
-					printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-				set_new_lsdb_version();	
-
-				if ( nlsr->debugging )
-					printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-			}
-	
-		}
-	    	hashtb_end(e);
-
-		if ( !nlsr->is_route_calculation_scheduled )
-		{
-			nlsr->event_calculate_route = ccn_schedule_event(nlsr->sched, 1000000, &route_calculate, NULL, 0);
-			nlsr->is_route_calculation_scheduled=1;
-		}
-
-
-		free(key);
-
-	free(time_stamp);
-}
-
-void 
-write_log_for_adj_lsa_body(const char *body, int no_link)
-{
-	int i=0;
-	char *lsa_data=(char *)malloc(strlen(body)+1);
-	memset(	lsa_data,0,strlen(body)+1);
-	memcpy(lsa_data,body,strlen(body)+1);
-	char *sep="|";
-	char *rem;
-	char *rtr_id;
-	char *length;
-	char *face;
-	char *metric;
-
-	if(no_link >0 )
-	{
-		rtr_id=strtok_r(lsa_data,sep,&rem);
-		length=strtok_r(NULL,sep,&rem);
-		face=strtok_r(NULL,sep,&rem);
-		metric=strtok_r(NULL,sep,&rem);
-
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"		Link %d	 	\n",i+1);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"		Adjacent Router: %s	\n",rtr_id);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"		Adjacent Router Length: %s	\n",length);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"		Connecting Face: %s	\n",face);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"		Metric: %s	\n",metric);
-
-
-		for(i=1;i<no_link;i++)
-		{
-			rtr_id=strtok_r(NULL,sep,&rem);
-			length=strtok_r(NULL,sep,&rem);
-			face=strtok_r(NULL,sep,&rem);
-			metric=strtok_r(NULL,sep,&rem);
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"		Link %d	 	\n",i+1);
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"		Adjacent Router: %s	\n",rtr_id);
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"		Adjacent Router Length: %s	\n",length);
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"		Connecting Face: %s	\n",face);
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"		Metric: %s	\n",metric);
-
-		}
-	}
-
-	free(lsa_data);
-}
-
-
-void
-write_log_for_adj_lsa(struct alsa * adj_lsa)
-{
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"-----------Adj LSA Content---------------\n");
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Origination Router: %s\n",adj_lsa->header->orig_router->name);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Origination Router Length: %d\n",adj_lsa->header->orig_router->length);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"	LS Type:	%d\n",adj_lsa->header->ls_type);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Origination Time: %s\n",adj_lsa->header->orig_time);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Lsa Data:\n");
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"		No of Link: %d\n",adj_lsa->no_link);
-
-	write_log_for_adj_lsa_body(adj_lsa->body,adj_lsa->no_link);
-	
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-
-}
-
-void 
-print_adj_lsa_body(const char *body, int no_link)
-{
-	int i=0;
-	char *lsa_data=(char *)malloc(strlen(body)+1);
-	memset(	lsa_data,0,strlen(body)+1);
-	memcpy(lsa_data,body,strlen(body)+1);
-	char *sep="|";
-	char *rem;
-	char *rtr_id;
-	char *length;
-	char *face;
-	char *metric;
-
-	if(no_link >0 )
-	{
-		rtr_id=strtok_r(lsa_data,sep,&rem);
-		length=strtok_r(NULL,sep,&rem);
-		face=strtok_r(NULL,sep,&rem);
-		metric=strtok_r(NULL,sep,&rem);
-
-		if ( nlsr->debugging ) {
-			printf("		Link %d	 	\n",i+1);
-			printf("		Neighbor		 : %s	\n",rtr_id);
-			printf("		Neighbor Length		 : %s	\n",length);
-			printf("		Connecting Face		 : %s	\n",face);
-			printf("		Metric			 : %s	\n",metric);
-		}
-
-		for(i=1;i<no_link;i++)
-		{
-			rtr_id=strtok_r(NULL,sep,&rem);
-			length=strtok_r(NULL,sep,&rem);
-			face=strtok_r(NULL,sep,&rem);
-			metric=strtok_r(NULL,sep,&rem);
-			printf("		Link %d	 	\n",i+1);
-			printf("		Neighbor		 : %s	\n",rtr_id);
-			printf("		Neighbor Length		 : %s	\n",length);
-			printf("		Connecting Face		 : %s	\n",face);
-			printf("		Metric			 : %s	\n",metric);
-
-		}
-	}
-
-	free(lsa_data);
-}
-
-void
-print_adj_lsa(struct alsa * adj_lsa)
-{
-	if ( nlsr->debugging )
-	{
-		printf("-----------ADJ LSA Content---------------\n");
-		printf("	Origination Router       :	%s\n",adj_lsa->header->orig_router->name);
-		printf("	Origination Router Length:	%d\n",adj_lsa->header->orig_router->length);
-		printf("	LS Type			 :	%d\n",adj_lsa->header->ls_type);
-		printf("	Origination Time	 :	%s\n",adj_lsa->header->orig_time);
-		printf("	Lsa Data:\n");
-		printf("		No of Link	: %d\n",adj_lsa->no_link);
-
-		print_adj_lsa_body(adj_lsa->body,adj_lsa->no_link);
-		printf("\n");
-	}
-
-}
-
-void
-print_adj_lsdb(void)
-{
-	if ( nlsr->debugging )
-		printf("print_name_lsdb called \n");	
-	int i, adj_lsdb_element;
-	struct alsa *adj_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-	adj_lsdb_element=hashtb_n(nlsr->lsdb->adj_lsdb);
-
-	for(i=0;i<adj_lsdb_element;i++)
-	{
-		if ( nlsr->debugging )
-			printf("-----------Adj LSA (%d)---------------\n",i+1);
-		adj_lsa=e->data;
-		print_adj_lsa(adj_lsa);	
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	if ( nlsr->debugging )
-		printf("\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-}
-
-void 
-build_and_install_others_adj_lsa(char *orig_router,int ls_type,char *orig_time, int no_link,char *data)
-{
-	if ( nlsr->debugging )
-		printf("build_and_install_others_adj_lsa called \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_and_install_others_adj_lsa called \n");
-	struct alsa *adj_lsa=(struct alsa *)malloc(sizeof( struct alsa ));
-	build_others_adj_lsa(adj_lsa,orig_router,ls_type,orig_time,no_link,data);
-	install_adj_lsa(adj_lsa);
-	
-
-	free(adj_lsa->header->orig_router->name);
-	free(adj_lsa->header->orig_router);
-	free(adj_lsa->header->orig_time);
-	free(adj_lsa->header);
-	free(adj_lsa->body);
-	free(adj_lsa);
-
-	print_adj_lsdb();
-
-}
-
-
-void 
-build_others_adj_lsa(struct alsa *adj_lsa,char *orig_router,int ls_type,char *orig_time,int no_link,char *data)
-{
-	if ( nlsr->debugging )
-		printf("build_others_adj_lsa called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_others_adj_lsa called  \n");
-
-	/*Filling Up Header Data */
-	adj_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
-	adj_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	adj_lsa->header->orig_router->name=(char *)malloc(strlen(orig_router)+1);
-	memset(adj_lsa->header->orig_router->name,0,strlen(orig_router)+1);
-	memcpy(adj_lsa->header->orig_router->name,orig_router,strlen(orig_router)+1);
-
-	adj_lsa->header->orig_router->length=strlen(orig_router)+1;
-
-
-	adj_lsa->header->ls_type=(unsigned)LS_TYPE_ADJ;	
-
-	adj_lsa->header->orig_time=(char *)malloc(strlen(orig_time)+1);
-	memset(adj_lsa->header->orig_time,0,strlen(orig_time)+1);
-	memcpy(adj_lsa->header->orig_time,orig_time,strlen(orig_time)+1);
-
-	adj_lsa->no_link=no_link;
-
-	adj_lsa->body=(char *)malloc(strlen(data)+1);
-	memset(adj_lsa->body,0,strlen(data)+1);
-	memcpy(adj_lsa->body,(char *)data,strlen(data)+1);
-
-}
-
-
-long int
-get_name_lsdb_num_element(void)
-{
-	long int num_element;
-
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->name_lsdb, e);
-	num_element=hashtb_n(nlsr->lsdb->name_lsdb);
-	hashtb_end(e);
-
-	return num_element; 
-}
-
-long int
-get_adj_lsdb_num_element(void)
-{
-	long int num_element;
-
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-	num_element=hashtb_n(nlsr->lsdb->adj_lsdb);
-	hashtb_end(e);
-
-	return num_element; 
-}
-
-
-int 
-check_is_new_name_lsa(char *orig_router,char *lst,char *lsid,char *orig_time)
-{
-	int ret=0;
-	struct ccn_charbuf *key=ccn_charbuf_create();
-	ccn_charbuf_append_string(key,orig_router);
-	ccn_charbuf_append_string(key,"/");
-	ccn_charbuf_append_string(key,lst);
-	ccn_charbuf_append_string(key,"/");
-	ccn_charbuf_append_string(key,lsid);
-
-	int res;
-	struct nlsa *name_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->lsdb->name_lsdb, e);
-	res = hashtb_seek(e, ccn_charbuf_as_string(key), key->length, 0);
-
-	if( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-		ret=1;
-
-	}
-	else if(res == HT_OLD_ENTRY)
-	{
-		name_lsa=e->data;
-		if( strcmp ( orig_time , name_lsa->header->orig_time ) > 0 )
-		{
-			ret=1;
-		}
-	}
-
-	hashtb_end(e);
-
-	ccn_charbuf_destroy(&key);
-	
-	return ret;
-}
-
-int 
-check_is_new_adj_lsa(char *orig_router,char *lst,char *orig_time)
-{
-	int ret=0;
-	struct ccn_charbuf *key=ccn_charbuf_create();
-	ccn_charbuf_append_string(key,orig_router);
-	ccn_charbuf_append_string(key,"/");
-	ccn_charbuf_append_string(key,lst);
-
-	int res;
-	struct alsa *adj_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-	res = hashtb_seek(e, ccn_charbuf_as_string(key), key->length, 0);
-
-	if( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-		ret=1;
-
-	}
-	else if(res == HT_OLD_ENTRY)
-	{
-		adj_lsa=e->data;
-		if( strcmp ( orig_time , adj_lsa->header->orig_time ) > 0 )
-		{
-			ret=1;
-		}
-	}
-
-	hashtb_end(e);
-	
-	ccn_charbuf_destroy(&key);
-
-	return ret;
-}
-
-int 
-check_is_new_cor_lsa(char *orig_router,char *lst,char *orig_time)
-{
-	int ret=0;
-	struct ccn_charbuf *key=ccn_charbuf_create();
-	ccn_charbuf_append_string(key,orig_router);
-	ccn_charbuf_append_string(key,"/");
-	ccn_charbuf_append_string(key,lst);
-
-	int res;
-	struct clsa *cor_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->lsdb->cor_lsdb, e);
-	res = hashtb_seek(e, ccn_charbuf_as_string(key), key->length, 0);
-
-	if( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-		ret=1;
-
-	}
-	else if(res == HT_OLD_ENTRY)
-	{
-		cor_lsa=e->data;
-		if( strcmp ( orig_time , cor_lsa->header->orig_time ) > 0 )
-		{
-			ret=1;
-		}
-	}
-
-	hashtb_end(e);
-	
-	ccn_charbuf_destroy(&key);
-
-	return ret;
-}
-
-void 
-get_name_lsa_data(struct ccn_charbuf *lsa_data, struct name_prefix *lsaId)
-{
-	if ( nlsr->debugging )
-		printf("get_name_lsa_data called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_name_lsa_data called  \n");
-
-	struct nlsa *name_lsa=(struct nlsa*)malloc(sizeof(struct nlsa ));
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->name_lsdb, e);
-    	res = hashtb_seek(e, lsaId->name, lsaId->length-1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		name_lsa=e->data;
-		
-		if ( nlsr->debugging )
-			printf("NAME LSA found  \n");	
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Name LSA found  \n");
-
-		ccn_charbuf_append_string(lsa_data,name_lsa->header->orig_router->name);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_length=(char *)malloc(20);
-		memset(temp_length,0,20);
-		sprintf(temp_length,"%d",name_lsa->header->orig_router->length);
-		ccn_charbuf_append_string(lsa_data,temp_length);
-		free(temp_length);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_ltype=(char *)malloc(20);
-		memset(temp_ltype,0,20);
-		sprintf(temp_ltype,"%d",name_lsa->header->ls_type);
-		ccn_charbuf_append_string(lsa_data,temp_ltype);
-		free(temp_ltype);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_lsid=(char *)malloc(20);
-		memset(temp_lsid,0,20);
-		sprintf(temp_lsid,"%ld",name_lsa->header->ls_id);
-		ccn_charbuf_append_string(lsa_data,temp_lsid);
-		free(temp_lsid);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		ccn_charbuf_append_string(lsa_data,name_lsa->header->orig_time);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_valid=(char *)malloc(20);
-		memset(temp_valid,0,20);
-		sprintf(temp_valid,"%d",name_lsa->header->isValid);
-		ccn_charbuf_append_string(lsa_data,temp_valid);
-		free(temp_valid);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		ccn_charbuf_append_string(lsa_data,name_lsa->name_prefix->name);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_npl=(char *)malloc(20);
-		memset(temp_npl,0,20);
-		sprintf(temp_npl,"%d",name_lsa->name_prefix->length);
-		ccn_charbuf_append_string(lsa_data,temp_npl);
-		free(temp_npl);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-void 
-get_adj_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId)
-{
-	if ( nlsr->debugging )
-		printf("get_adj_lsa_data called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_adj_lsa_data called  \n");
-
-	struct alsa *adj_lsa=(struct alsa*)malloc(sizeof(struct alsa ));
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-    	res = hashtb_seek(e, lsaId->name, lsaId->length-1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		adj_lsa=e->data;
-
-		if ( nlsr->debugging )
-			printf("Adj LSA found  \n");	
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Adj LSA found  \n");
-
-		ccn_charbuf_append_string(lsa_data,adj_lsa->header->orig_router->name);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_length=(char *)malloc(20);
-		memset(temp_length,0,20);
-		sprintf(temp_length,"%d",adj_lsa->header->orig_router->length);
-		ccn_charbuf_append_string(lsa_data,temp_length);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(temp_length);
-
-		char *temp_ltype=(char *)malloc(20);
-		memset(temp_ltype,0,20);
-		sprintf(temp_ltype,"%d",adj_lsa->header->ls_type);
-		ccn_charbuf_append_string(lsa_data,temp_ltype);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(temp_ltype);
-
-		ccn_charbuf_append_string(lsa_data,adj_lsa->header->orig_time);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_nl=(char *)malloc(20);
-		memset(temp_nl,0,20);
-		sprintf(temp_nl,"%d",adj_lsa->no_link);
-		ccn_charbuf_append_string(lsa_data,temp_nl);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(temp_nl);
-
-		ccn_charbuf_append_string(lsa_data,adj_lsa->body);
-
-
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-void
-make_name_lsa_invalid(struct name_prefix *np,int ls_type, long int ls_id)
-{
-
-	if ( nlsr->debugging )
-		printf("make_name_lsa_invalid called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"make_name_lsa_invalid called  \n");
-
-
-	char lst[2];
-	memset(lst,0,2);
-	sprintf(lst,"%d",ls_type);	
-
-	char lsid[10];
-	memset(lsid,0,10);
-	sprintf(lsid,"%ld",ls_id);
-	
-	
-	char *key=(char *)malloc(strlen(np->name)+1+strlen(lst)+1+strlen(lsid)+1);
-	memset(key,0,strlen(np->name)+1+strlen(lst)+1+strlen(lsid)+1);
-
-
-	make_name_lsa_key(key, np->name,ls_type,ls_id);	
-	
-	if ( nlsr->debugging )
-		printf("Key:%s Length:%d\n",key,(int)strlen(key));
-
-	struct nlsa *nlsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-	 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->name_lsdb, e);
-    	res = hashtb_seek(e, key,strlen(key) , 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nlsa=e->data;
-	
-		nlsa->header->isValid=0;
-
-		writeLogg(__FILE__,__FUNCTION__,__LINE__," Name-LSA\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting name lsa\n");
-		write_log_for_name_lsa(nlsa);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__," name_lsa_end\n");
-
-		hashtb_delete(e);
-	}
-	else if( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-	}
-	hashtb_end(e);
-	
-	if ( nlsr->debugging )
-		printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-	set_new_lsdb_version();	
-
-	if ( nlsr->debugging )
-		printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-}
-
-int 
-delete_name_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
-{
-	
-	if ( nlsr->debugging )
-		printf("delete_name_lsa called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_name_lsa called  \n");
-	
-	if(flags == CCN_SCHEDULE_CANCEL)
-	{
- 	 	return -1;
-	}
-
-
-
-	nlsr_lock();
-
-	if ( nlsr->debugging )
-		printf("LSA Key: %s \n",(char *)ev->evdata);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSA Key: %s \n",(char *)ev->evdata);
-
-	struct nlsa *nlsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-	 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->name_lsdb, e);
-    	res = hashtb_seek(e, (char *)ev->evdata, strlen((char *)ev->evdata), 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nlsa=e->data;
-		delete_npt_entry_by_router_and_name_prefix(nlsa->header->orig_router->name, nlsa->name_prefix->name);
-
-		writeLogg(__FILE__,__FUNCTION__,__LINE__," Name-LSA\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting name lsa\n");
-		write_log_for_name_lsa(nlsa);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__," name_lsa_end\n");
-
-		hashtb_delete(e);
-	}
-	else if( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-	}
-	hashtb_end(e);
-	
-	if ( nlsr->debugging )
-		printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-	set_new_lsdb_version();	
-
-	if ( nlsr->debugging )
-		printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-	
-	nlsr_unlock();
-
-	return 0;
-}
-
-int 
-delete_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
-{
-	if ( nlsr->debugging )
-		printf("delete_adj_lsa called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_adj_lsa called  \n");
-	
-	if(flags == CCN_SCHEDULE_CANCEL)
-	{
- 	 	return -1;
-	}
-	nlsr_lock();
-
-	if ( nlsr->debugging )
-		printf("LSA Key: %s \n",(char *)ev->evdata);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSA Key: %s \n",(char *)ev->evdata);
-
-	struct alsa *alsa;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-    	res = hashtb_seek(e, (char *)ev->evdata, strlen((char *)ev->evdata), 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		alsa=e->data;
-		writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting adj lsa\n");
-		write_log_for_adj_lsa(alsa);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
-		
-		hashtb_delete(e);
-	}
-	else if( res == HT_OLD_ENTRY )
-	{
-		hashtb_delete(e);
-	}
-	hashtb_end(e);
-
-	if ( nlsr->debugging )
-		printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-	set_new_lsdb_version();	
-
-	if ( nlsr->debugging )
-		printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-
-	if ( !nlsr->is_route_calculation_scheduled)
-	{
-		nlsr->event_calculate_route = ccn_schedule_event(nlsr->sched, 1000000, &route_calculate, NULL, 0);
-		nlsr->is_route_calculation_scheduled=1;
-	}
-
-	nlsr_unlock();
-
-	return 0;
-}
-
-void
-refresh_name_lsdb(void)
-{
-	if ( nlsr->debugging )
-		printf("refresh_name_lsdb called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"refresh_name_lsdb called  \n");
-
-	char *time_stamp=(char *)malloc(20);
-	memset(time_stamp,0,20);
-	get_current_timestamp_micro(time_stamp);
-	
-	long int lsa_life_time;
-		
-	int i, name_lsdb_element;
-	struct nlsa *name_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->name_lsdb, e);
-	name_lsdb_element=hashtb_n(nlsr->lsdb->name_lsdb);
-
-	for(i=0;i<name_lsdb_element;i++)
-	{
-		name_lsa=e->data;
-
-		lsa_life_time=get_time_diff(time_stamp,name_lsa->header->orig_time);
-		if ( nlsr->debugging )
-			printf("LSA Life Time: %ld \n",lsa_life_time);	
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSA Life Time: %ld \n",lsa_life_time);
-		
-		if ( strcmp(name_lsa->header->orig_router->name,nlsr->router_name) == 0)
-		{
-			if ( lsa_life_time > nlsr->lsa_refresh_time )
-			{
-				if ( name_lsa->header->isValid == NAME_LSA_VALID )					
-				{
-					if ( nlsr->debugging )
-						printf("Own Name LSA need to be refrshed\n");
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Own Name LSA need to be refrshed\n");
-
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Name-LSA\n");
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting name lsa\n");
-					write_log_for_name_lsa(name_lsa);
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," name_lsa_end\n");
-					
-
-					char *current_time_stamp=(char *)malloc(20);
-					memset(current_time_stamp,0,20);
-					get_current_timestamp_micro(current_time_stamp);
-
-					free(name_lsa->header->orig_time);
-					name_lsa->header->orig_time=(char *)malloc(strlen(current_time_stamp)+1); //free 
-					memset(name_lsa->header->orig_time,0,strlen(current_time_stamp)+1);
-					memcpy(name_lsa->header->orig_time,current_time_stamp,strlen(current_time_stamp)+1);
-
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Name-LSA\n");
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Adding name lsa\n");
-					write_log_for_name_lsa(name_lsa);
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," name_lsa_end\n");
-	
-					free(current_time_stamp);
-				}
-				else 
-				{
-					char lst[2];
-					memset(lst,0,2);
-					sprintf(lst,"%d",name_lsa->header->ls_type);	
-
-					char lsid[10];
-					memset(lsid,0,10);
-					sprintf(lsid,"%ld",name_lsa->header->ls_id);
-	
-	
-					char *key=(char *)malloc(strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
-					memset(key,0,strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
-
-
-					make_name_lsa_key(key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id);	
-				
-					nlsr->event = ccn_schedule_event(nlsr->sched, 10, &delete_name_lsa, (void *)key, 0);
-				}
-
-				if ( nlsr->debugging )
-					printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-				set_new_lsdb_version();	
-
-				if ( nlsr->debugging )
-					printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-							
-
-				print_name_lsdb();
-			}	
-		}
-		else 
-		{
-			if ( lsa_life_time > nlsr->router_dead_interval )
-			{
-				if ( nlsr->debugging )
-				 	printf("Others Name LSA need to be deleted\n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Others Name LSA need to be deleted\n");
-
-				char lst[2];
-				memset(lst,0,2);
-				sprintf(lst,"%d",name_lsa->header->ls_type);	
-
-				char lsid[10];
-				memset(lsid,0,10);
-				sprintf(lsid,"%ld",name_lsa->header->ls_id);
-	
-	
-				char *key=(char *)malloc(strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
-				memset(key,0,strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
-
-
-				make_name_lsa_key(key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id);	
-				
-				nlsr->event = ccn_schedule_event(nlsr->sched, 10, &delete_name_lsa, (void *)key, 0);
-			}
-		}
-
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-	
-	free(time_stamp);
-
-	
-}
-
-void
-refresh_adj_lsdb(void)
-{
-
-	if ( nlsr->debugging )
-		printf("refresh_adj_lsdb called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"refresh_adj_lsdb called  \n");
-
-	char *time_stamp=(char *)malloc(20);
-	memset(time_stamp,0,20);
-	get_current_timestamp_micro(time_stamp);
-	
-	long int lsa_life_time;
-		
-	int i, adj_lsdb_element;
-	struct alsa *adj_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-	adj_lsdb_element=hashtb_n(nlsr->lsdb->adj_lsdb);
-
-	for(i=0;i<adj_lsdb_element;i++)
-	{
-		adj_lsa=e->data;
-
-		lsa_life_time=get_time_diff(time_stamp,adj_lsa->header->orig_time);	
-
-		if ( nlsr->debugging )
-			printf("LSA Life Time: %ld \n",lsa_life_time);	
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSA Life Time: %ld \n",lsa_life_time);		
-
-		if ( strcmp(adj_lsa->header->orig_router->name,nlsr->router_name) == 0)
-		{
-			if ( lsa_life_time > nlsr->lsa_refresh_time )
-			{
-				if ( nlsr->debugging )
-					printf("Own Adj LSA need to be refrshed\n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Own Adj LSA need to be refrshed\n");
-
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting adj lsa\n");
-				write_log_for_adj_lsa(adj_lsa);
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
-
-				char *current_time_stamp=(char *)malloc(20);
-				memset(current_time_stamp,0,20);
-				get_current_timestamp_micro(current_time_stamp);
-
-				free(adj_lsa->header->orig_time);
-				adj_lsa->header->orig_time=(char *)malloc(strlen(current_time_stamp)+1); //free 
-				memset(adj_lsa->header->orig_time,0,strlen(current_time_stamp)+1);
-				memcpy(adj_lsa->header->orig_time,current_time_stamp,strlen(current_time_stamp)+1);
-	
-				free(current_time_stamp);
-
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Adding adj lsa\n");
-				write_log_for_adj_lsa(adj_lsa);
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
-
-				if ( nlsr->debugging )
-					printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-				set_new_lsdb_version();	
-
-				if ( nlsr->debugging )
-					printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-				print_adj_lsdb();
-			}	
-		}
-		else 
-		{
-			if ( lsa_life_time > nlsr->router_dead_interval )
-			{
-
-				if ( nlsr->debugging )
-				 	printf("Others Adj LSA need to be deleted\n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Others Adj LSA need to be deleted\n");
-				
-				char *key=(char *)malloc(adj_lsa->header->orig_router->length+2+2);
-				memset(key,0,adj_lsa->header->orig_router->length+2);
-				make_adj_lsa_key(key,adj_lsa);
-				
-				nlsr->event = ccn_schedule_event(nlsr->sched, 10, &delete_adj_lsa, (void *)key, 0);
-			}
-		}
-
-		
-
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-	
-	free(time_stamp);
-}
-
-
-void
-refresh_cor_lsdb(void)
-{
-
-	if ( nlsr->debugging )
-		printf("refresh_cor_lsdb called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"refresh_cor_lsdb called  \n");
-
-	char *time_stamp=(char *)malloc(20);
-	memset(time_stamp,0,20);
-	get_current_timestamp_micro(time_stamp);
-	
-	long int lsa_life_time;
-		
-	int i, cor_lsdb_element;
-	struct clsa *cor_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->cor_lsdb, e);
-	cor_lsdb_element=hashtb_n(nlsr->lsdb->cor_lsdb);
-
-	for(i=0;i<cor_lsdb_element;i++)
-	{
-		cor_lsa=e->data;
-
-		lsa_life_time=get_time_diff(time_stamp,cor_lsa->header->orig_time);	
-
-		if ( nlsr->debugging )
-			printf("LSA Life Time: %ld \n",lsa_life_time);	
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSA Life Time: %ld \n",lsa_life_time);		
-
-		if ( strcmp(cor_lsa->header->orig_router->name,nlsr->router_name) == 0)
-		{
-			if ( lsa_life_time > nlsr->lsa_refresh_time )
-			{
-				if ( nlsr->debugging )
-					printf("Own Cor LSA need to be refrshed\n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Own Cor LSA need to be refrshed\n");
-
-				//writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
-				//writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting adj lsa\n");
-				//write_log_for_adj_lsa(adj_lsa);
-				//writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
-
-				char *current_time_stamp=(char *)malloc(20);
-				memset(current_time_stamp,0,20);
-				get_current_timestamp_micro(current_time_stamp);
-
-				free(cor_lsa->header->orig_time);
-				cor_lsa->header->orig_time=(char *)malloc(strlen(current_time_stamp)+1); //free 
-				memset(cor_lsa->header->orig_time,0,strlen(current_time_stamp)+1);
-				memcpy(cor_lsa->header->orig_time,current_time_stamp,strlen(current_time_stamp)+1);
-	
-				free(current_time_stamp);
-
-				//writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
-				//writeLogg(__FILE__,__FUNCTION__,__LINE__," Adding adj lsa\n");
-				//write_log_for_adj_lsa(adj_lsa);
-				//writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
-
-				if ( nlsr->debugging )
-					printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-				set_new_lsdb_version();	
-
-				if ( nlsr->debugging )
-					printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-				print_adj_lsdb();
-			}	
-		}
-		else 
-		{
-			if ( lsa_life_time > nlsr->router_dead_interval )
-			{
-
-				if ( nlsr->debugging )
-				 	printf("Others Adj LSA need to be deleted\n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Others Adj LSA need to be deleted\n");
-				
-				hashtb_delete(e);
-				i++;
-			}
-		}
-
-		
-
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-	
-	free(time_stamp);
-}
-
-int
-refresh_lsdb(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
-{
-	if(flags == CCN_SCHEDULE_CANCEL)
-	{
- 	 	return -1;
-	}
-
-	nlsr_lock();
-
-	if ( nlsr->debugging )
-		printf("refresh_lsdb called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"refresh_lsdb called\n");
-	
-	refresh_name_lsdb();
-	refresh_adj_lsdb();
-	refresh_cor_lsdb();
-
-	nlsr->event = ccn_schedule_event(nlsr->sched, 60000000, &refresh_lsdb, NULL, 0);
-	
-	nlsr_unlock();
-	return 0;
-}
-
-void
-write_adj_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id)
-{
-	if ( nlsr->debugging )
-		printf("write_adj_lsa_to_repo called\n");
-	if ( nlsr->debugging )
-		printf("Content Prefix: %s\n",repo_content_prefix);
-	
-	struct ccn_charbuf *lsa_data=ccn_charbuf_create();		
-	get_adj_lsa_data(lsa_data,lsa_id);
-	if ( nlsr->debugging )
-		printf("Adj LSA Data: %s \n",ccn_charbuf_as_string(lsa_data));	
-
-	write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_content_prefix);
-
-	ccn_charbuf_destroy(&lsa_data);
-}
-
-void
-write_name_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id)
-{
-	if ( nlsr->debugging )
-		printf("write_name_lsa_to_repo called\n");
-	if ( nlsr->debugging )
-		printf("Content Prefix: %s\n",repo_content_prefix);
-	
-	struct ccn_charbuf *lsa_data=ccn_charbuf_create();		
-	get_name_lsa_data(lsa_data,lsa_id);
-	
-	if ( nlsr->debugging )
-		printf("Name LSA Data: %s \n",ccn_charbuf_as_string(lsa_data));	
-
-	write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_content_prefix);
-
-	ccn_charbuf_destroy(&lsa_data);
-}
-
-
-void
-write_name_lsdb_to_repo(char *slice_prefix)
-{
-	int i, name_lsdb_element;
-
-	struct nlsa *name_lsa;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->name_lsdb, e);
-	name_lsdb_element=hashtb_n(nlsr->lsdb->name_lsdb);
-
-	for(i=0;i<name_lsdb_element;i++)
-	{
-		name_lsa=e->data;
-
-		char lst[2];
-		memset(lst,0,2);
-		sprintf(lst,"%d",name_lsa->header->ls_type);	
-
-		char lsid[10];
-		memset(lsid,0,10);
-		sprintf(lsid,"%ld",name_lsa->header->ls_id);
-	
-	
-		char *key=(char *)malloc(strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
-		memset(key,0,strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
-
-
-		make_name_lsa_key(key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id);
-		
-		if ( nlsr->debugging )
-			printf("Name LSA Key: %s \n",key);
-
-
-		char *repo_key=(char *)malloc(strlen(slice_prefix)+1+strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1+strlen(name_lsa->header->orig_time)+1);
-		memset(repo_key,0,strlen(slice_prefix)+1+strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1+strlen(name_lsa->header->orig_time)+1);	
-		make_name_lsa_prefix_for_repo(repo_key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id,name_lsa->header->orig_time,slice_prefix);
-		
-		if ( nlsr->debugging )
-			printf("Name LSA Repo Key: %s \n",repo_key);
-
-		struct name_prefix *lsaid=(struct name_prefix *)malloc(sizeof(struct name_prefix));
-		lsaid->name=(char *)malloc(strlen(key)+1);
-		memset(lsaid->name, 0, strlen(key)+1);
-		memcpy(lsaid->name,key,strlen(key));
-		lsaid->length=strlen(key)+1;
-
-		
-		write_name_lsa_to_repo(repo_key, lsaid);
-
-		free(key);
-		free(repo_key);
-		free(lsaid->name);
-		free(lsaid);
-
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-	
-
-}
-
-void
-print_cor_lsa(struct clsa *cor_lsa)
-{
-	if ( nlsr->debugging )
-	{
-		printf("-----------Cor LSA Content---------------\n");
-		printf("	Origination Router       :	%s\n",cor_lsa->header->orig_router->name);
-		printf("	Origination Router Length:	%d\n",cor_lsa->header->orig_router->length);
-		printf("	LS Type			 :	%d\n",cor_lsa->header->ls_type);
-		printf("	Origination Time	 :	%s\n",cor_lsa->header->orig_time);
-		printf("	LSA Data			\n");
-		printf("		Cor R:	 	:	%f\n",cor_lsa->cor_r);
-		printf("		Cor Theta	:	%f\n",cor_lsa->cor_theta);
-
-		printf("\n");	
-	}
-}
-
-void 
-print_cor_lsdb()
-{
-	
-	if ( nlsr->debugging )
-		printf("print_cor_lsdb called \n");	
-	
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-	int i=1;
-
-	for (hashtb_start(nlsr->lsdb->cor_lsdb, e); e->key != NULL; hashtb_next(e)) 
-	{
-		if ( nlsr->debugging )
-			printf("-----------Cor LSA (%d)---------------\n",i);	
-		struct clsa *cor_lsa=e->data;
-		print_cor_lsa(cor_lsa);
-		i++;
-  	}
-	hashtb_end(e);
-
-	if ( nlsr->debugging )
-		printf("\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-}
-
-void
-install_cor_lsa(struct clsa *cor_lsa)
-{
-	if ( nlsr->debugging )
-		printf("install_cor_lsa called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"install_cor_lsa called  \n");
-	
-
-	char *time_stamp=(char *)malloc(20);
-	memset(time_stamp,0,20);
-	get_current_timestamp_micro(time_stamp);
-
-
-	char *key=(char *)malloc(cor_lsa->header->orig_router->length+2+2);
-	memset(key,0,cor_lsa->header->orig_router->length+2);
-	make_cor_lsa_key(key,cor_lsa);
-
-	if ( nlsr->debugging )
-		printf("Cor LSA key: %s \n",key);
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->cor_lsdb, e);
-    	res = hashtb_seek(e, key, strlen(key), 0);
-
-	if ( res == HT_NEW_ENTRY )
-	{
-		if ( nlsr->debugging )
-			printf("New Cor LSA... \n");
-		
-		struct clsa *new_cor_lsa=(struct clsa *)malloc(sizeof( struct clsa ));
-		new_cor_lsa=e->data;
-		new_cor_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
-
-		new_cor_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-		new_cor_lsa->header->orig_router->name=(char *)malloc(strlen(cor_lsa->header->orig_router->name)+1);
-		memset(new_cor_lsa->header->orig_router->name,0,strlen(cor_lsa->header->orig_router->name)+1);
-		memcpy(new_cor_lsa->header->orig_router->name,cor_lsa->header->orig_router->name,strlen(cor_lsa->header->orig_router->name)+1);
-		new_cor_lsa->header->orig_router->length=cor_lsa->header->orig_router->length;
-
-		new_cor_lsa->header->orig_time=(char *)malloc(strlen(cor_lsa->header->orig_time)+1); //free 
-		memset(new_cor_lsa->header->orig_time,0,strlen(cor_lsa->header->orig_time)+1);
-		memcpy(new_cor_lsa->header->orig_time,cor_lsa->header->orig_time,strlen(cor_lsa->header->orig_time)+1);
-
-		new_cor_lsa->header->ls_type=cor_lsa->header->ls_type;
-
-		new_cor_lsa->cor_r=cor_lsa->cor_r;
-		new_cor_lsa->cor_theta=cor_lsa->cor_theta;
-	}
-	else if ( res == HT_OLD_ENTRY )
-	{	
-		if ( nlsr->debugging )
-			printf("Cor LSA exists (Old)... \n");
-	}
-	hashtb_end(e);
-
-	free(key);
-
-}
-
-void 
-build_cor_lsa(struct clsa *cor_lsa, double cor_r, double cor_theta)
-{
-	cor_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
-	cor_lsa->header->ls_type=LS_TYPE_COR;
-
-	char *time_stamp=(char *)malloc(20);
-	memset(time_stamp,0,20);
-	get_current_timestamp_micro(time_stamp);
-
-	cor_lsa->header->orig_time=(char *)malloc(strlen(time_stamp)+1); //free 
-	memset(cor_lsa->header->orig_time,0,strlen(time_stamp)+1);
-	memcpy(cor_lsa->header->orig_time,time_stamp,strlen(time_stamp)+1);
-	free(time_stamp);
-
-	cor_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	cor_lsa->header->orig_router->name=(char *)malloc(strlen(nlsr->router_name)+1);
-	memset(cor_lsa->header->orig_router->name,0,strlen(nlsr->router_name)+1);
-	memcpy(cor_lsa->header->orig_router->name,nlsr->router_name,strlen(nlsr->router_name)+1);
-	cor_lsa->header->orig_router->length=strlen(nlsr->router_name)+1;
-
-	cor_lsa->cor_r=cor_r;	
-	cor_lsa->cor_theta=cor_theta;
-
-}
-
-void 
-build_others_cor_lsa(struct clsa *cor_lsa,char *orig_router, int ls_type,char *orig_time, double cor_r, double cor_theta)
-{
-	cor_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
-	cor_lsa->header->ls_type=ls_type;
-
-	cor_lsa->header->orig_time=(char *)malloc(strlen(orig_time)+1); 
-	memset(cor_lsa->header->orig_time,0,strlen(orig_time)+1);
-	memcpy(cor_lsa->header->orig_time,orig_time,strlen(orig_time)+1);
-
-	cor_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	cor_lsa->header->orig_router->name=(char *)malloc(strlen(orig_router)+1);
-	memset(cor_lsa->header->orig_router->name,0,strlen(orig_router)+1);
-	memcpy(cor_lsa->header->orig_router->name,orig_router,strlen(orig_router)+1);
-	cor_lsa->header->orig_router->length=strlen(orig_router)+1;
-
-	cor_lsa->cor_r=cor_r;	
-	cor_lsa->cor_theta=cor_theta;
-
-}
-
-void
-build_and_install_others_cor_lsa(char *orig_router,int ls_type,char *orig_time, double cor_r, double cor_theta)
-{
-	struct clsa *cor_lsa=(struct clsa *)malloc(sizeof( struct clsa ));
-	build_others_cor_lsa(cor_lsa,orig_router,ls_type, orig_time, cor_r, cor_theta);
-	install_cor_lsa(cor_lsa);
-
-	print_cor_lsdb();
-
-	free(cor_lsa->header->orig_router);
-	free(cor_lsa->header->orig_time);
-	free(cor_lsa->header);
-	free(cor_lsa);
-
-}
-
-
-void 
-build_and_install_cor_lsa()
-{
-
-	
-
-	struct clsa *cor_lsa=(struct clsa *)malloc(sizeof( struct clsa ));
-	
-	build_cor_lsa(cor_lsa,nlsr->cor_r,nlsr->cor_theta);
-	install_cor_lsa(cor_lsa);
-
-	write_cor_lsa_to_repo(cor_lsa);
-
-	print_cor_lsdb();	
-
-	free(cor_lsa->header->orig_router);
-	free(cor_lsa->header->orig_time);
-	free(cor_lsa->header);
-	free(cor_lsa);
-	
-}
-
-void 
-get_cor_lsa_data(struct ccn_charbuf *lsa_data,char *cor_lsa_key)
-{
-	if ( nlsr->debugging )
-		printf("get_cor_lsa_data called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_adj_lsa_data called  \n");
-
-	struct clsa *cor_lsa=(struct clsa*)malloc(sizeof(struct clsa ));
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->cor_lsdb, e);
-    	res = hashtb_seek(e, cor_lsa_key, strlen(cor_lsa_key), 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		cor_lsa=e->data;
-
-		if ( nlsr->debugging )
-			printf("Cor LSA found  \n");	
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Cor LSA found  \n");
-
-		ccn_charbuf_append_string(lsa_data,cor_lsa->header->orig_router->name);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_length=(char *)malloc(20);
-		memset(temp_length,0,20);
-		sprintf(temp_length,"%d",cor_lsa->header->orig_router->length);
-		ccn_charbuf_append_string(lsa_data,temp_length);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(temp_length);
-
-		char *temp_ltype=(char *)malloc(20);
-		memset(temp_ltype,0,20);
-		sprintf(temp_ltype,"%d",cor_lsa->header->ls_type);
-		ccn_charbuf_append_string(lsa_data,temp_ltype);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(temp_ltype);
-
-		ccn_charbuf_append_string(lsa_data,cor_lsa->header->orig_time);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *cor_r=(char *)malloc(20);
-		memset(cor_r,0,20);
-		sprintf(cor_r,"%f",cor_lsa->cor_r);
-		ccn_charbuf_append_string(lsa_data,cor_r);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(cor_r);
-
-		char *cor_theta=(char *)malloc(20);
-		memset(cor_theta,0,20);
-		sprintf(cor_theta,"%f",cor_lsa->cor_theta);
-		ccn_charbuf_append_string(lsa_data,cor_theta);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(cor_theta);
-
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-void
-write_cor_lsa_to_repo(struct clsa *cor_lsa)
-{
-	
-
-	if ( nlsr->debugging )
-		printf("write_cor_lsa_to_repo called\n");
-	
-	
-	char *key=(char *)malloc(cor_lsa->header->orig_router->length+2+2);
-	memset(key,0,cor_lsa->header->orig_router->length+2+2);
-	make_cor_lsa_key(key,cor_lsa);
-	
-	struct ccn_charbuf *lsa_data=ccn_charbuf_create();
-	get_cor_lsa_data(lsa_data,key);
-	
-	if ( nlsr->debugging )
-		printf("Cor LSA Data: %s \n",ccn_charbuf_as_string(lsa_data));	
-	char *lst=(char *)malloc(20);
-	memset(lst,0,20);
-	sprintf(lst,"%d",cor_lsa->header->ls_type);
-	char *repo_key=(char *)malloc(strlen(nlsr->slice_prefix)+strlen(cor_lsa->header->orig_time)+strlen(cor_lsa->header->orig_router->name) + strlen(lst) + 5);
-	memset(repo_key, 0, strlen(nlsr->slice_prefix)+strlen(cor_lsa->header->orig_time)+strlen(cor_lsa->header->orig_router->name) + strlen(lst) + 5);	
-	make_cor_lsa_prefix_for_repo(repo_key, cor_lsa->header->orig_router->name,LS_TYPE_COR,cor_lsa->header->orig_time,nlsr->slice_prefix);
-		
-	if ( nlsr->debugging )
-		printf("Cor LSA Repo Key: %s \n",repo_key);	
-
-	write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_key);
-
-	
-		
-	free(lst);
-	free(key);
-	free(repo_key);
-	ccn_charbuf_destroy(&lsa_data);
-}
-
-void 
-make_cor_lsa_key_by_router_name(char *key,char *router_name)
-{
-	memcpy(key+strlen(key),router_name,strlen(router_name));
-	memcpy(key+strlen(key),"/",1);
-	char ls_type[2];
-	sprintf(ls_type,"%d",LS_TYPE_COR);
-	memcpy(key+strlen(key),ls_type,strlen(ls_type));
-	key[strlen(key)]='\0';
-}
-
-
-double 
-get_hyperbolic_r(char *router)
-{
-	double ret=-1.0;
-	char *cor_lsa_key=(char *)calloc(strlen(router)+4,sizeof(char));
-	make_cor_lsa_key_by_router_name(cor_lsa_key,router);
-
-	
-	struct clsa *cor_lsa;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->cor_lsdb, e);
-    	res = hashtb_seek(e, cor_lsa_key, strlen(cor_lsa_key), 0);
-
-	if ( res == HT_OLD_ENTRY)
-	{	
-		cor_lsa=e->data;
-		ret=cor_lsa->cor_r;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-	
-	free(cor_lsa_key);
-	return ret;
-}
-
-double 
-get_hyperbolic_theta(char *router)
-{
-		double ret=-1.0;
-	char *cor_lsa_key=(char *)calloc(strlen(router)+4,sizeof(char));
-	make_cor_lsa_key_by_router_name(cor_lsa_key,router);
-
-	struct clsa *cor_lsa;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->cor_lsdb, e);
-    	res = hashtb_seek(e, cor_lsa_key, strlen(cor_lsa_key), 0);
-
-	if ( res == HT_OLD_ENTRY)
-	{	
-		cor_lsa=e->data;
-		ret=cor_lsa->cor_theta;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-	
-	free(cor_lsa_key);
-	return ret;
-}
diff --git a/nlsr-sync-0.0/nlsr_lsdb.h b/nlsr-sync-0.0/nlsr_lsdb.h
deleted file mode 100755
index c67348e..0000000
--- a/nlsr-sync-0.0/nlsr_lsdb.h
+++ /dev/null
@@ -1,105 +0,0 @@
-#ifndef _NLSR_LSDB_H_
-#define _NLSR_LSDB_H_
-
-#define LS_TYPE_ADJ 1
-#define LS_TYPE_NAME 2
-#define LS_TYPE_COR 3
-
-struct link
-{
-	struct name_prefix *nbr;
-	int face;
-	int metric;
-};
-
-
-struct alsa_header 
-{
-	unsigned int ls_type;
-	char *orig_time;
-	struct name_prefix *orig_router;
-	
-};
-
-struct alsa
-{
-	struct alsa_header *header;	
-	int no_link;
-	struct link *links;
-	char * body;
-};
-
-struct nlsa_header
-{
-	unsigned int ls_type;
-	char *orig_time;
-	long int ls_id;
-	struct name_prefix *orig_router;
-	unsigned int isValid;
-
-};
-
-struct nlsa
-{
-	struct nlsa_header *header;
-	struct name_prefix *name_prefix;
-};
-
-struct clsa
-{
-	struct alsa_header *header;
-	double cor_r;
-	double cor_theta;
-};
-
-
-void set_new_lsdb_version(void);
-void build_and_install_name_lsas(void);
-void build_and_install_single_name_lsa(struct name_prefix *np);
-void build_name_lsa(struct nlsa *name_lsa, struct name_prefix *np);
-void install_name_lsa(struct nlsa *name_lsa);
-void print_name_lsa(struct nlsa *name_lsa);
-void write_log_for_name_lsa(struct nlsa *name_lsa);
-void print_name_lsdb(void);
-void build_and_install_others_name_lsa(char *orig_router,int ls_type,long int ls_id,char *orig_time, int isValid,char *np);
-void build_others_name_lsa(struct nlsa *name_lsa, char *orig_router,int ls_type,long int ls_id, char *orig_time, int isValid, char *np);
-void make_name_lsa_key(char *key, char *orig_router, int ls_type, long int ls_id);
-int refresh_lsdb(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
-
-int build_and_install_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
-void build_adj_lsa(struct alsa * adj_lsa);
-void install_adj_lsa(struct alsa * adj_lsa);
-void print_adj_lsa_body(const char *body, int no_link);
-void print_adj_lsa(struct alsa * adj_lsa);
-void write_log_for_adj_lsa(struct alsa * adj_lsa);
-void print_adj_lsdb(void);
-void make_adj_lsa_key(char *key,struct alsa *adj_lsa);
-void build_and_install_others_adj_lsa(char *orig_router,int ls_type,char *orig_time, int no_link,char *data);
-void build_others_adj_lsa(struct alsa *adj_lsa,char *orig_router,int ls_type,char *orig_time,int no_link,char *data);
-
-long int get_name_lsdb_num_element(void);
-long int get_adj_lsdb_num_element(void);
-
-int check_is_new_name_lsa(char *orig_router,char *lst,char *lsid,char *orig_time);
-int check_is_new_adj_lsa(char *orig_router,char *lst,char *orig_time);
-int check_is_new_cor_lsa(char *orig_router,char *lst,char *orig_time);
-
-void get_name_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId);
-void get_adj_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId);
-
-void make_name_lsa_invalid(struct name_prefix *np,int ls_type, long int ls_id);
-
-void build_and_install_cor_lsa();
-void print_cor_lsdb();
-
-void write_name_lsdb_to_repo(char *slice_prefix);
-void write_name_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id);
-void make_name_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, long int ls_id,char *orig_time,char *slice_prefix);
-void write_adj_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id);
-
-void write_cor_lsa_to_repo(struct clsa *cor_lsa);
-void build_and_install_others_cor_lsa(char *orig_router,int ls_type,char *orig_time, double cor_r, double cor_theta);
-double get_hyperbolic_r(char *router);
-double get_hyperbolic_theta(char *router);
-
-#endif
diff --git a/nlsr-sync-0.0/nlsr_ndn.c b/nlsr-sync-0.0/nlsr_ndn.c
deleted file mode 100755
index 258c954..0000000
--- a/nlsr-sync-0.0/nlsr_ndn.c
+++ /dev/null
@@ -1,726 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-#include "nlsr.h"
-#include "nlsr_ndn.h"
-#include "nlsr_npl.h"
-#include "nlsr_adl.h"
-#include "nlsr_lsdb.h"
-#include "utility.h"
-
-int
-appendLifetime(struct ccn_charbuf *cb, int lifetime) 
-{
-	unsigned char buf[sizeof(int32_t)];
-	int32_t dreck = lifetime << 12;
-	int pos = sizeof(int32_t);
-	int res = 0;
-	while (dreck > 0 && pos > 0) 
-	{
-		pos--;
-		buf[pos] = dreck & 255;
-		dreck = dreck >> 8;
-	}
-	res |= ccnb_append_tagged_blob(cb, CCN_DTAG_InterestLifetime, buf+pos, sizeof(buf)-pos);
-	return res;
-}
-
-
-void 
-get_nbr(struct name_prefix *nbr,struct ccn_closure *selfp, struct ccn_upcall_info *info)
-{
-	if ( nlsr->debugging )
-		printf("get_nbr called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_nbr called\n");
-
-	int res,i;
-	int nlsr_position=0;
-	int name_comps=(int)info->interest_comps->n;
-	int len=0;
-
-	for(i=0;i<name_comps;i++)
-	{
-		res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
-		if( res == 0)
-		{
-			nlsr_position=i;
-			break;
-		}	
-	}
-
-
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-	for(i=0;i<nlsr_position;i++)
-	{
-		res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,i,&comp_ptr1, &comp_size);
-		len+=1;
-		len+=(int)comp_size;	
-	}
-	len++;
-
-	char *neighbor=(char *)malloc(len);
-	memset(neighbor,0,len);
-
-	for(i=0; i<nlsr_position;i++)
-	{
-		res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,i,&comp_ptr1, &comp_size);
-		memcpy(neighbor+strlen(neighbor),"/",1);
-		memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,strlen((char *)comp_ptr1));
-
-	}
-
-	nbr->name=(char *)malloc(strlen(neighbor)+1);
-	memcpy(nbr->name,neighbor,strlen(neighbor)+1);
-	nbr->length=strlen(neighbor)+1;
-
-	if ( nlsr->debugging )
-		printf("Neighbor: %s Length: %d\n",nbr->name,nbr->length);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Neighbor: %s Length: %d\n",nbr->name,nbr->length);
-
-	
-
-}
-
-void 
-get_lsa_identifier(struct name_prefix *lsaId,struct ccn_closure *selfp, struct ccn_upcall_info *info, int offset)
-{
-
-	//printf("get_lsa_identifier called\n");
-
-	if ( nlsr->debugging )
-		printf("get_lsa_identifier called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_lsa_identifier called\n");
-	
-	int res,i;
-	int nlsr_position=0;
-	int name_comps=(int)info->interest_comps->n;
-	int len=0;
-
-	for(i=0;i<name_comps;i++)
-	{
-		res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
-		if( res == 0)
-		{
-			nlsr_position=i;
-			break;
-		}	
-	}
-
-
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-	for(i=nlsr_position+3+offset;i<info->interest_comps->n-1;i++)
-	{
-		res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,i,&comp_ptr1, &comp_size);
-		len+=1;
-		len+=(int)comp_size;	
-	}
-	len++;
-
-	char *neighbor=(char *)malloc(len);
-	memset(neighbor,0,len);
-
-	for(i=nlsr_position+3+offset; i<info->interest_comps->n-1;i++)
-	{
-		res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,i,&comp_ptr1, &comp_size);
-		memcpy(neighbor+strlen(neighbor),"/",1);
-		memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,strlen((char *)comp_ptr1));
-
-	}
-
-	lsaId->name=(char *)malloc(strlen(neighbor)+1);
-	memset(lsaId->name,0,strlen(neighbor)+1);
-	memcpy(lsaId->name,neighbor,strlen(neighbor)+1);
-	lsaId->length=strlen(neighbor)+1;
-
-	if ( nlsr->debugging )
-		printf("LSA Identifier: %s Length: %d\n",lsaId->name,lsaId->length-1);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSA Identifier: %s Length: %d\n",lsaId->name,lsaId->length-1);
-
-	//printf("LSA Identifier: %s Length: %d\n",lsaId->name,lsaId->length-1);
-
-
-}
-
-int 
-get_ls_type(struct ccn_closure *selfp, struct ccn_upcall_info *info)
-{
-	int res,i;
-	int nlsr_position=0;
-	int name_comps=(int)info->interest_comps->n;
-
-	int ret=0;
-
-	for(i=0;i<name_comps;i++)
-	{
-		res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
-		if( res == 0)
-		{
-			nlsr_position=i;
-			break;
-		}	
-	}
-
-
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-	res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,nlsr_position+2,&comp_ptr1, &comp_size);
-
-	ret=atoi((char *)comp_ptr1);
-
-	return ret;	
-
-}
-
-void 
-get_lsdb_version(char *lsdb_version,struct ccn_closure *selfp, struct ccn_upcall_info *info )
-{
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-	ccn_name_comp_get(info->content_ccnb, info->content_comps,info->content_comps->n-2,&comp_ptr1, &comp_size);
-	memcpy(lsdb_version,(char *)comp_ptr1,(int)comp_size);
-
-}
-
-
-/* Call back function registered in ccnd to get all interest coming to NLSR application */
-
-enum ccn_upcall_res 
-incoming_interest(struct ccn_closure *selfp,
-        enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
-{
-
-    nlsr_lock();    
-
-    switch (kind) {
-        case CCN_UPCALL_FINAL:
-            break;
-        case CCN_UPCALL_INTEREST:
-		// printing the name prefix for which it received interest
-		if ( nlsr->debugging )
-            		printf("Interest Received for name: "); 
-		if ( nlsr->detailed_logging )
-            		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Interest Received for name: ");
-		
-	    	struct ccn_charbuf*c;
-		c=ccn_charbuf_create();
-		ccn_uri_append(c,info->interest_ccnb,info->pi->offset[CCN_PI_E_Name],0);
-
-		if ( nlsr->debugging )
-			printf("%s\n",ccn_charbuf_as_string(c));
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"%s\n",ccn_charbuf_as_string(c));
-
-		ccn_charbuf_destroy(&c);
-
-		process_incoming_interest(selfp, info);
-		
-		break;
-
-        default:
-            break;
-    }
-
-     nlsr_unlock();
-
-    return CCN_UPCALL_RESULT_OK;
-}
-
-/* Function for processing incoming interest and reply with content/NACK content */
-
-void 
-process_incoming_interest(struct ccn_closure *selfp, struct ccn_upcall_info *info)
-{
-	if ( nlsr->debugging )
-		printf("process_incoming_interest called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_interest called \n");
-	
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-	int res,i;
-	int nlsr_position=0;
-	int name_comps=(int)info->interest_comps->n;
-
-	for(i=0;i<name_comps;i++)
-	{
-		res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
-		if( res == 0)
-		{
-			nlsr_position=i;
-			break;
-		}	
-	}
-
-	res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,nlsr_position+1,&comp_ptr1, &comp_size);
-
-
-	if(!strcmp((char *)comp_ptr1,"info"))
-	{
-		process_incoming_interest_info(selfp,info);
-	}
-
-}
-
-void 
-process_incoming_interest_info(struct ccn_closure *selfp, struct ccn_upcall_info *info)
-{
-	if ( nlsr->debugging )
-	{
-		printf("process_incoming_interest_info called \n");
-		printf("Sending Info Content back.....\n");
-	}
-	if ( nlsr->detailed_logging )
-	{
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_interest_info called \n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending Info Content back.....\n");
-	}
-	
-
-	int res;
-	struct ccn_charbuf *data=ccn_charbuf_create();
-    	struct ccn_charbuf *name=ccn_charbuf_create();
-    	struct ccn_signing_params sp=CCN_SIGNING_PARAMS_INIT;
-
-	res=ccn_charbuf_append(name, info->interest_ccnb + info->pi->offset[CCN_PI_B_Name],info->pi->offset[CCN_PI_E_Name] - info->pi->offset[CCN_PI_B_Name]);
-	if (res >= 0)
-	{
-		sp.template_ccnb=ccn_charbuf_create();
-		ccn_charbuf_append_tt(sp.template_ccnb,CCN_DTAG_SignedInfo, CCN_DTAG);
-		ccnb_tagged_putf(sp.template_ccnb, CCN_DTAG_FreshnessSeconds, "%ld", 10);
-       	 	sp.sp_flags |= CCN_SP_TEMPL_FRESHNESS;
-		ccn_charbuf_append_closer(sp.template_ccnb);
-
-
-		char *raw_data=(char *)malloc(20);
-		memset(raw_data,0,20);
-		sprintf(raw_data,"%s", nlsr->lsdb->lsdb_version);	
-
-		res= ccn_sign_content(nlsr->ccn, data, name, &sp, raw_data,strlen(raw_data)); 
-		if(res >= 0)
-		{
-			if ( nlsr->debugging )
-				printf("Signing info Content is successful \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Signing info Content is successful \n");
-
-		}
-    		res=ccn_put(nlsr->ccn,data->buf,data->length);		
-		if(res >= 0)
-		{
-			if ( nlsr->debugging )
-				printf("Sending Info Content is successful \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending info Content is successful \n");
-		}
-		
-
-
-		struct name_prefix *nbr=(struct name_prefix * )malloc(sizeof(struct name_prefix *));
-		get_lsa_identifier(nbr,selfp,info,-1);
-
-		if ( nlsr->debugging )
-			printf("Neighbor : %s Length : %d Status : %d\n",nbr->name,nbr->length,get_adjacent_status(nbr));
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Neighbor : %s Length : %d Status : %d\n",nbr->name,nbr->length,get_adjacent_status(nbr));		
-
-		//printf("Neighbor : %s Length : %d Status : %d\n",nbr->name,nbr->length,get_adjacent_status(nbr));
-
-
-		if( get_adjacent_status(nbr) == 0 && get_timed_out_number(nbr)>=nlsr->interest_retry )
-		{
-			update_adjacent_timed_out_zero_to_adl(nbr);
-			send_info_interest_to_neighbor(nbr);
-		}
-
-		free(nbr);
-		free(raw_data);
-		ccn_charbuf_destroy(&sp.template_ccnb);
-	}
-
-	ccn_charbuf_destroy(&data);
-	ccn_charbuf_destroy(&name);
-
-}
-
-
-/* Call back function registered in ccnd to get all content coming to NLSR application */
-
-enum ccn_upcall_res incoming_content(struct ccn_closure* selfp,
-        enum ccn_upcall_kind kind, struct ccn_upcall_info* info)
-{
-
-     nlsr_lock();
-
-    switch(kind) {
-        case CCN_UPCALL_FINAL:
-            break;
-        case CCN_UPCALL_CONTENT:
-		if ( nlsr->debugging )
-			printf("Content Received for Name: "); 
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Content Received for Name: ");
-    
-		struct ccn_charbuf*c;
-		c=ccn_charbuf_create();
-		ccn_uri_append(c,info->interest_ccnb,info->pi->offset[CCN_PI_E],0);
-		if ( nlsr->debugging )
-			printf("%s\n",ccn_charbuf_as_string(c));
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"%s\n",ccn_charbuf_as_string(c));
-
-		ccn_charbuf_destroy(&c);
-
-		process_incoming_content(selfp,info);
-
-	    break;
-        case CCN_UPCALL_INTEREST_TIMED_OUT:
-		//printf("Interest Timed Out Received for Name: ");
-		if ( nlsr->debugging )
-			printf("Interest Timed Out Received for Name:  "); 
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Interest Timed Out Received for Name: ");
-		
-		struct ccn_charbuf*ito;
-		ito=ccn_charbuf_create();
-		ccn_uri_append(ito,info->interest_ccnb,info->pi->offset[CCN_PI_E],0);
-
-		if ( nlsr->debugging )
-			printf("%s\n",ccn_charbuf_as_string(ito));
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"%s\n",ccn_charbuf_as_string(ito));
-
-		//printf("%s\n",ccn_charbuf_as_string(ito));
-		ccn_charbuf_destroy(&ito);
-
-		process_incoming_timed_out_interest(selfp,info);
-
-	    break;
-        default:
-            fprintf(stderr, "Unexpected response of kind %d\n", kind);
-	    if ( nlsr->debugging )
-		printf("Unexpected response of kind %d\n", kind);
-	    if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Unexpected response of kind %d\n", kind);
-	    break;
-    }
-    
-     nlsr_unlock();
-
-    return CCN_UPCALL_RESULT_OK;
-}
-
-
-void 
-process_incoming_content(struct ccn_closure *selfp, struct ccn_upcall_info* info)
-{
-	if ( nlsr->debugging )
-		printf("process_incoming_content called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_content called \n");
-
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-	int res,i;
-	int nlsr_position=0;
-	int name_comps=(int)info->interest_comps->n;
-
-	for(i=0;i<name_comps;i++)
-	{
-		res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
-		if( res == 0)
-		{
-			nlsr_position=i;
-			break;
-		}	
-	}
-
-	res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,nlsr_position+1,&comp_ptr1, &comp_size);
-
-
-	if(!strcmp((char *)comp_ptr1,"info"))
-	{
-		process_incoming_content_info(selfp,info);
-	}
-
-}
-
-
-void 
-process_incoming_content_info(struct ccn_closure *selfp, struct ccn_upcall_info* info)
-{
-	if ( nlsr->debugging )
-		printf("process_incoming_content_info called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_content_info called \n");
-
-	struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	get_nbr(nbr,selfp,info);
-
-	if ( nlsr->debugging )
-		printf("Info Content Received For Neighbor: %s Length:%d\n",nbr->name,nbr->length);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Info Content Received For Neighbor: %s Length:%d\n",nbr->name,nbr->length);
-
-
-	//const unsigned char *ptr;
-	//size_t length;
-	//ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E_Content]-info->pco->offset[CCN_PCO_B_Content], info->pco, &ptr, &length);
-
-	//long int interval=atoi((char *)ptr);
-
-
-
-	update_adjacent_timed_out_zero_to_adl(nbr);	
-	update_adjacent_status_to_adl(nbr,NBR_ACTIVE);
-	//update_lsdb_synch_interval_to_adl(nbr,interval);
-	print_adjacent_from_adl();
-
-
-
-	if(!nlsr->is_build_adj_lsa_sheduled)
-	{
-		if ( nlsr->debugging )
-			printf("Scheduling Build and Install Adj LSA...\n");
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Scheduling Build and Install Adj LSA...\n");
-		nlsr->event_build_adj_lsa = ccn_schedule_event(nlsr->sched, 100000, &build_and_install_adj_lsa, NULL, 0);
-		nlsr->is_build_adj_lsa_sheduled=1;		
-	}
-	else
-	{
-		if ( nlsr->debugging )
-			printf("Build and Install Adj LSA already scheduled\n");
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Build and Install Adj LSA already scheduled\n");
-	}
-
-
-	free(nbr);
-
-
-}
-
-
-
-
-void
-process_incoming_timed_out_interest(struct ccn_closure* selfp, struct ccn_upcall_info* info)
-{
-	
-
-	if ( nlsr->debugging )
-		printf("process_incoming_timed_out_interest called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_timed_out_interest called \n");
-
-	int res,i;
-	int nlsr_position=0;
-	int name_comps=(int)info->interest_comps->n;
-
-	for(i=0;i<name_comps;i++)
-	{
-		res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
-		if( res == 0)
-		{
-			nlsr_position=i;
-			break;
-		}	
-	}
-
-	if(ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,nlsr_position+1,"info") == 0)
-	{
-		process_incoming_timed_out_interest_info(selfp,info);
-	}
-}
-
-void
-process_incoming_timed_out_interest_info(struct ccn_closure* selfp, struct ccn_upcall_info* info)
-{
-	
-	if ( nlsr->debugging )
-		printf("process_incoming_timed_out_interest_info called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_timed_out_interest_info called \n");
-
-	struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	get_nbr(nbr,selfp,info);
-
-	if ( nlsr->debugging )
-		printf("Info Interest Timed Out for for Neighbor: %s Length:%d\n",nbr->name,nbr->length);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Info Interest Timed Out for for Neighbor: %s Length:%d\n",nbr->name,nbr->length);
-	
-
-
-	update_adjacent_timed_out_to_adl(nbr,1);
-	print_adjacent_from_adl();	
-	int timed_out=get_timed_out_number(nbr);
-
-	if ( nlsr->debugging )
-		printf("Neighbor: %s Info Interest Timed Out: %d times\n",nbr->name,timed_out);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Neighbor: %s Info Interest Timed Out: %d times\n",nbr->name,timed_out);
-
-
-	if(timed_out<nlsr->interest_retry && timed_out>0) // use configured variables 
-	{
-		send_info_interest_to_neighbor(nbr);
-	}
-	else
-	{		
-		update_adjacent_status_to_adl(nbr,NBR_DOWN);
-		if(!nlsr->is_build_adj_lsa_sheduled)
-		{
-			nlsr->event_build_adj_lsa = ccn_schedule_event(nlsr->sched, 1000, &build_and_install_adj_lsa, NULL, 0);
-			nlsr->is_build_adj_lsa_sheduled=1;		
-		}
-	}
-
-	free(nbr);
-
-
-}
-
-
-int
-send_info_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
-{
-	if(flags == CCN_SCHEDULE_CANCEL)
-	{
- 	 	return -1;
-	}
-
-         nlsr_lock();
-
-	if ( nlsr->debugging )
-		printf("send_info_interest called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"send_info_interest called \n");
-
-	if ( nlsr->debugging )
-		printf("\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-
-	int adl_element,i;
-	struct ndn_neighbor *nbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-
-	for(i=0;i<adl_element;i++)
-	{
-		nbr=e->data;
-		send_info_interest_to_neighbor(nbr->neighbor);
-		hashtb_next(e);		
-	}
-	hashtb_end(e);
-
-	 nlsr_unlock();
-
-	nlsr->event = ccn_schedule_event(nlsr->sched, 60000000, &send_info_interest, NULL, 0);
-
-	return 0;
-}
-
-void 
-send_info_interest_to_neighbor(struct name_prefix *nbr)
-{
-
-	if ( nlsr->debugging )
-		printf("send_info_interest_to_neighbor called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"send_info_interest_to_neighbor called \n");
-
-
-	int res;
-	char info_str[5];
-	char nlsr_str[5];
-	
-	memset(&nlsr_str,0,5);
-	sprintf(nlsr_str,"nlsr");
-	memset(&info_str,0,5);
-	sprintf(info_str,"info");
-	
-	
-	struct ccn_charbuf *name;	
-	name=ccn_charbuf_create();
-
-	char *int_name=(char *)malloc(strlen(nbr->name)+1+strlen(nlsr_str)+1+strlen(info_str)+strlen(nlsr->router_name)+1);
-	memset(int_name,0,strlen(nbr->name)+1+strlen(nlsr_str)+1+strlen(info_str)+strlen(nlsr->router_name)+1);
-	memcpy(int_name+strlen(int_name),nbr->name,strlen(nbr->name));
-	memcpy(int_name+strlen(int_name),"/",1);
-	memcpy(int_name+strlen(int_name),nlsr_str,strlen(nlsr_str));
-	memcpy(int_name+strlen(int_name),"/",1);
-	memcpy(int_name+strlen(int_name),info_str,strlen(info_str));
-	memcpy(int_name+strlen(int_name),nlsr->router_name,strlen(nlsr->router_name));
-	
-
-	res=ccn_name_from_uri(name,int_name);
-	if ( res >=0 )
-	{
-		/* adding InterestLifeTime and InterestScope filter */
-
-		struct ccn_charbuf *templ;
-		templ = ccn_charbuf_create();
-
-		ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
-		ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
-		ccn_charbuf_append_closer(templ); /* </Name> */
-		ccn_charbuf_append_tt(templ, CCN_DTAG_Scope, CCN_DTAG);
-		ccn_charbuf_append_tt(templ, 1, CCN_UDATA);
-		/* Adding InterestLifeTime and InterestScope filter done */		
-		ccn_charbuf_append(templ, "2", 1); //scope of interest: 2 (not further than next host)
-		ccn_charbuf_append_closer(templ); /* </Scope> */
-
-		appendLifetime(templ,nlsr->interest_resend_time);
-		unsigned int face_id=get_next_hop_face_from_adl(nbr->name);
-		ccnb_tagged_putf(templ, CCN_DTAG_FaceID, "%u", face_id);
-		ccn_charbuf_append_closer(templ); /* </Interest> */
-		
-	
-		if ( nlsr->debugging )
-			printf("Sending info interest on name prefix : %s through Face:%u\n",int_name,face_id);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending info interest on name prefix : %s through Face:%u\n",int_name,face_id);
-
-		res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
-
-		if ( res >= 0 )
-		{
-			if ( nlsr->debugging )
-				printf("Info interest sending Successfull .... \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Info interest sending Successfull .... \n");
-		}	
-		ccn_charbuf_destroy(&templ);
-	}
-	ccn_charbuf_destroy(&name);
-	free(int_name);
-
-}
diff --git a/nlsr-sync-0.0/nlsr_ndn.h b/nlsr-sync-0.0/nlsr_ndn.h
deleted file mode 100755
index 1e34284..0000000
--- a/nlsr-sync-0.0/nlsr_ndn.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _NLSR_NDN_H_
-#define _NLSR_NDN_H_
-
-int appendLifetime(struct ccn_charbuf *cb, int lifetime);
-void get_nbr(struct name_prefix *nbr,struct ccn_closure *selfp, struct ccn_upcall_info *info);
-void get_lsa_identifier(struct name_prefix *lsaId,struct ccn_closure *selfp, struct ccn_upcall_info *info,int offset);
-void get_lsdb_version(char *lsdb_version,struct ccn_closure *selfp, struct ccn_upcall_info *info );
-int get_ls_type(struct ccn_closure *selfp, struct ccn_upcall_info *info);
-
-enum ccn_upcall_res incoming_interest(struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info); 
-void process_incoming_interest(struct ccn_closure *selfp, struct ccn_upcall_info *info);
-void process_incoming_interest_info(struct ccn_closure *selfp, struct ccn_upcall_info *info);
-
-enum ccn_upcall_res incoming_content(struct ccn_closure* selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info* info);
-void process_incoming_content(struct ccn_closure *selfp, struct ccn_upcall_info* info);
-void process_incoming_content_info(struct ccn_closure *selfp, struct ccn_upcall_info* info);
-
-void process_incoming_timed_out_interest(struct ccn_closure* selfp, struct ccn_upcall_info* info);
-void process_incoming_timed_out_interest_info(struct ccn_closure* selfp, struct ccn_upcall_info* info);
-
-int send_info_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
-void send_info_interest_to_neighbor(struct name_prefix *nbr);
-
-
-#endif
diff --git a/nlsr-sync-0.0/nlsr_npl.c b/nlsr-sync-0.0/nlsr_npl.c
deleted file mode 100755
index a2e2271..0000000
--- a/nlsr-sync-0.0/nlsr_npl.c
+++ /dev/null
@@ -1,174 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-#include "nlsr.h"
-#include "nlsr_npl.h"
-#include "utility.h"
-
-
-void 
-add_name_to_npl(struct name_prefix *np)
-{
-	struct name_prefix_list_entry *npe=(struct name_prefix_list_entry *)malloc(sizeof(struct name_prefix_list_entry));
-	//struct name_prefix *hnp=(struct name_prefix *)malloc(sizeof(struct name_prefix )); //free
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->npl, e);
-    	res = hashtb_seek(e, np->name, np->length, 0);
-
-	if(res == HT_NEW_ENTRY)
-	{   
-		npe=e->data;
-		npe->np=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-		npe->np->length=np->length;
-		npe->np->name=(char *)malloc(np->length);
-		memcpy(npe->np->name,np->name,np->length);
-		npe->name_lsa_id=0;
-		//hnp = e->data;
-		//hnp->length=np->length;
-		//hnp->name=(char *)malloc(np->length); //free
-		//memcpy(hnp->name,np->name,np->length);
-	}
-    	
-	hashtb_end(e);
-
-}
-
-int  
-does_name_exist_in_npl(struct name_prefix *np)
-{
-	int ret=0;
-
-	//struct name_prefix_entry *npe;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->npl, e);
-    	res = hashtb_seek(e, np->name, np->length, 0);
-
-	if(res == HT_NEW_ENTRY)
-	{   
-		hashtb_delete(e);
-		ret=0;
-	}
-	else
-	{
-		ret=1;
-    	}
-	hashtb_end(e);
-
-	return ret;
-
-}
-
-
-long int  
-get_lsa_id_from_npl(struct name_prefix *np)
-{
-	int ret=0;
-
-	struct name_prefix_list_entry *npe;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->npl, e);
-    	res = hashtb_seek(e, np->name, np->length, 0);
-
-	if(res == HT_NEW_ENTRY)
-	{   
-		hashtb_delete(e);
-		ret=0;
-	}
-	else
-	{
-		npe=e->data;
-		ret=npe->name_lsa_id;
-    	}
-	hashtb_end(e);
-
-	return ret;
-
-}
-
-void
-print_name_prefix_from_npl(void)
-{
-	if ( nlsr->debugging )
-		printf("print_name_prefix_from_npl called \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_name_prefix_from_npl called\n");
-	int i, npl_element;
-	//struct name_prefix *np;
-	struct name_prefix_list_entry *npe;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npl, e);
-	npl_element=hashtb_n(nlsr->npl);
-
-	for(i=0;i<npl_element;i++)
-	{
-		npe=e->data;
-		if ( nlsr->debugging )
-			printf("Name Prefix: %s and Length: %d and LSA Id: %ld\n",npe->np->name,npe->np->length,npe->name_lsa_id);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Name Prefix: %s and Length: %d \n",npe->np->name,npe->np->length);	
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	if ( nlsr->debugging )
-		printf("\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-}
-
-void 
-update_nlsa_id_for_name_in_npl(struct name_prefix *np, long int nlsa_id)
-{
-	struct name_prefix_list_entry *npe;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->npl, e);
-    	res = hashtb_seek(e, np->name, np->length, 0);
-
-	if(res == HT_OLD_ENTRY)
-	{   
-		npe=e->data;
-		npe->name_lsa_id=nlsa_id;
-	}
-	else
-	{
-		hashtb_delete(e);	
-	}
-    	
-	hashtb_end(e);
-}
-
diff --git a/nlsr-sync-0.0/nlsr_npl.h b/nlsr-sync-0.0/nlsr_npl.h
deleted file mode 100755
index 4fce119..0000000
--- a/nlsr-sync-0.0/nlsr_npl.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _NLSR_NPL_H_
-#define _NLSR_NPL_H_
-
-struct name_prefix_list_entry
-{
-	struct name_prefix *np;
-	long int name_lsa_id;
-};
-
-void add_name_to_npl(struct name_prefix *np);
-void print_name_prefix_from_npl(void);
-int does_name_exist_in_npl(struct name_prefix *np);
-void update_nlsa_id_for_name_in_npl(struct name_prefix *np, long int nlsa_id);
-long int get_lsa_id_from_npl(struct name_prefix *np);
-#endif
diff --git a/nlsr-sync-0.0/nlsr_npt.c b/nlsr-sync-0.0/nlsr_npt.c
deleted file mode 100755
index fb167f5..0000000
--- a/nlsr-sync-0.0/nlsr_npt.c
+++ /dev/null
@@ -1,1088 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <sys/types.h>
-#include <signal.h>
-
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-#include "nlsr.h"
-#include "nlsr_npt.h"
-#include "nlsr_fib.h"
-#include "nlsr_route.h"
-#include "nlsr_adl.h"
-#include "utility.h"
-
-int
-add_npt_entry(char *orig_router, char *name_prefix, int num_face, int *faces, int *route_costs)
-{
-	if ( strcmp(orig_router,nlsr->router_name)== 0)
-	{
-		return -1;
-	}
-
-	struct npt_entry *ne=(struct npt_entry*)malloc(sizeof(struct npt_entry ));
-	
-	int res,res_nle,res_fle;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    
-
-   	hashtb_start(nlsr->npt, e);
-    	res = hashtb_seek(e, orig_router, strlen(orig_router), 0);
-
-	if(res == HT_NEW_ENTRY)
-	{
-		ne=e->data;
-
-		ne->orig_router=(char *)malloc(strlen(orig_router)+1);
-		memset(ne->orig_router,0,strlen(orig_router)+1);
-		memcpy(ne->orig_router,orig_router,strlen(orig_router));
-
-	
-		
-
-		struct hashtb_param param_nle = {0};
-		ne->name_list= hashtb_create(sizeof(struct name_list_entry ), &param_nle);
-
-		struct hashtb_enumerator eenle;
-    		struct hashtb_enumerator *enle = &eenle;
-
-		hashtb_start(ne->name_list, enle);
-		res_nle = hashtb_seek(enle, name_prefix, strlen(name_prefix), 0);
-
-		if(res_nle == HT_NEW_ENTRY )
-		{
-			struct name_list_entry *nle=(struct name_list_entry *)malloc(sizeof(struct name_list_entry));
-			nle=enle->data;
-			nle->name=(char *)malloc(strlen(name_prefix)+1);
-			memset(nle->name,0,strlen(name_prefix)+1);
-			memcpy(nle->name,name_prefix,strlen(name_prefix));
-
-			
-
-		}
-		hashtb_end(enle);
-
-		struct hashtb_param param_fle = {0};
-		ne->face_list=hashtb_create(sizeof(struct face_list_entry), &param_fle);
-
-		if ( num_face > 0 )
-		{
-			struct hashtb_enumerator eef;
-    			struct hashtb_enumerator *ef = &eef;
-    	
-    			hashtb_start(ne->face_list, ef);
-			int i;						
-
-			for ( i=0; i < num_face ; i++)
-			{
-				int face=faces[i];
-				if ( face != NO_FACE && face != ZERO_FACE)
-				{
-					res_fle = hashtb_seek(ef, &face, sizeof(face), 0);
-				
-					if ( res_fle == HT_NEW_ENTRY )
-					{
-						struct face_list_entry *fle=(struct face_list_entry *)malloc(sizeof(struct face_list_entry));
-						fle=ef->data;
-						fle->next_hop_face=face;
-						fle->route_cost=route_costs[i];
-					}
-				}
-		
-			}
-			hashtb_end(ef);
-		}
-		
-	}
-	else if (res == HT_OLD_ENTRY)
-	{
-		free(ne);
-		struct npt_entry *one;
-
-		one=e->data;
-		
-		struct hashtb_enumerator eenle;
-    		struct hashtb_enumerator *enle = &eenle;
-
-		hashtb_start(one->name_list, enle);
-		res_nle = hashtb_seek(enle, name_prefix, strlen(name_prefix), 0);
-
-		if(res_nle == HT_NEW_ENTRY )
-		{
-			struct name_list_entry *nle=(struct name_list_entry *)malloc(sizeof(struct name_list_entry));
-			nle=enle->data;
-			nle->name=(char *)malloc(strlen(name_prefix)+1);
-			memset(nle->name,0,strlen(name_prefix)+1);
-			memcpy(nle->name,name_prefix,strlen(name_prefix));
-		}
-		else if(res_nle == HT_OLD_ENTRY )
-		{
-			
-		}
-		hashtb_end(enle);
-
-		if ( num_face > 0 )
-		{
-			struct hashtb_enumerator eef;
-    			struct hashtb_enumerator *ef = &eef;
-    	
-    			hashtb_start(one->face_list, ef);
-			int i;						
-
-			for ( i=0; i< num_face ; i ++)
-			{
-				int face=faces[i];
-				if ( face != NO_FACE && face != ZERO_FACE)
-				{
-					res_fle = hashtb_seek(ef, &face, sizeof(face), 0);
-				
-					if ( res_fle == HT_NEW_ENTRY )
-					{
-						struct face_list_entry *fle=(struct face_list_entry *)malloc(sizeof(struct face_list_entry));
-						fle=ef->data;
-						fle->next_hop_face=face;
-						fle->route_cost=route_costs[i];
-					}
-				}
-			}
-			hashtb_end(ef);
-		}
-	
-
-	}
-	hashtb_end(e);
-
-	update_ccnd_fib_for_orig_router(orig_router);
-
-	return res;
-}
-
-void 
-update_ccnd_fib_for_orig_router(char *orig_router)
-{
-
-	if ( nlsr->debugging )
-	{
-		printf("update_ccnd_fib_for_orig_router called\n");
-	}
-
-	int res;	
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    
-
-   	hashtb_start(nlsr->npt, e);
-    	res = hashtb_seek(e, orig_router, strlen(orig_router), 0);
-
-	if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-	else if ( res == HT_OLD_ENTRY )
-	{
-		struct npt_entry *ne;
-		ne=e->data;
-		int num_face=hashtb_n(ne->face_list);
-		int last_face,first_face;
-
-		int *faces=(int *)malloc(num_face*sizeof(int));
-		int *route_costs=(int *)malloc(num_face*sizeof(int));
-		
-		get_all_faces_for_orig_router_from_npt(orig_router,faces,route_costs,num_face);
-		sort_faces_by_distance(faces,route_costs,0,num_face);
-		
-		if ( nlsr->debugging )
-		{
-			int m;
-			for ( m =0 ; m< num_face ; m++)
-			{
-				printf("Dest_router: %s Next_Hop_Face: %d Route_cost: %d \n",orig_router,faces[m],route_costs[m]);
-			}
-		}
-
-		last_face=0;
-		if ( nlsr->max_faces_per_prefix == 0) // add all faces available in routing table
-		{
-			first_face=num_face-1;
-		}
-		else if( nlsr->max_faces_per_prefix > 0)
-		{
-			if ( nlsr->max_faces_per_prefix >= num_face)
-			{
-				first_face=num_face-1;
-			}
-			else if ( nlsr->max_faces_per_prefix < num_face)
-			{
-				first_face=nlsr->max_faces_per_prefix-1;
-			}
-	
-		}
-
-		int i,j, nl_element;
-		struct name_list_entry *nle;		
-		struct hashtb_enumerator eenle;
-    		struct hashtb_enumerator *enle = &eenle;
-
-		hashtb_start(ne->name_list, enle);
-		nl_element=hashtb_n(ne->name_list);	
-
-		for (i=0;i<nl_element;i++)
-		{
-			nle=enle->data;
-			
-			for( j=first_face; j>= last_face; j--)
-			{
-				if ( nlsr->debugging )
-				{
-					printf("Possible FIB Entry name: %s face: %d route cost: %d \n",nle->name,faces[j],route_costs[j]);
-				}
-				if ( is_active_neighbor(orig_router) == 0 )
-				{
-					if ( nlsr->debugging )
-						printf("Adding face: Name:%s Face: %d\n",nle->name,faces[j]);	
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Adding face: Name:%s Face: %d\n",nle->name,faces[j]);
-					add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_REG, faces[j]);	
-				}
-				else 
-				{
-					if ( j == last_face &&  is_active_neighbor(nle->name)==0)
-					{
-						if ( nlsr->debugging )
-							printf("Adding face: Name:%s Face: %d\n",nle->name,faces[j]);	
-						if ( nlsr->detailed_logging )
-							writeLogg(__FILE__,__FUNCTION__,__LINE__,"Adding face: Name:%s Face: %d\n",nle->name,faces[j]);
-						add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_REG, faces[j]);
-					}
-				}
-			}
-			
-			
-			hashtb_next(enle);
-		}
-		hashtb_end(enle);
-		
-
-
-		free(faces);
-		free(route_costs);
-
-	}
-	hashtb_end(e);
-
-}
-
-int 
-delete_npt_entry_by_router_and_name_prefix(char *orig_router, char *name_prefix)
-{
-	if ( strcmp(orig_router,nlsr->router_name)== 0)
-	{
-		return -1;
-	}
-
-	struct npt_entry *ne;
-	
-	int res,res_nle;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    
-
-   	hashtb_start(nlsr->npt, e);
-    	res = hashtb_seek(e, orig_router, strlen(orig_router), 0);
-
-	if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-		return -1;
-	}
-	else if (res == HT_OLD_ENTRY)
-	{
-		ne=e->data;
-
-		struct hashtb_enumerator eenle;
-    		struct hashtb_enumerator *enle = &eenle;
-
-		hashtb_start(ne->name_list, enle);
-		res_nle = hashtb_seek(enle, name_prefix, strlen(name_prefix), 0);
-
-		if(res_nle == HT_NEW_ENTRY )
-		{
-			hashtb_delete(enle);
-		}
-		else if(res_nle == HT_OLD_ENTRY )
-		{
-			struct name_list_entry *nle;
-
-			nle=enle->data;
-	
-			int j;
-			int num_face=hashtb_n(ne->face_list);
-			int last_face,first_face;
-
-			int *faces=(int *)malloc(num_face*sizeof(int));
-			int *route_costs=(int *)malloc(num_face*sizeof(int));
-		
-			get_all_faces_for_orig_router_from_npt(orig_router,faces,route_costs,num_face);
-			sort_faces_by_distance(faces,route_costs,0,num_face);
-		
-
-			last_face=0;
-			if ( nlsr->max_faces_per_prefix == 0) // add all faces available in routing table
-			{
-				first_face=num_face-1;
-			}
-			else if( nlsr->max_faces_per_prefix > 0)
-			{
-				if ( nlsr->max_faces_per_prefix >= num_face)
-				{
-					first_face=num_face-1;
-				}
-				else if ( nlsr->max_faces_per_prefix < num_face)
-				{
-					first_face=nlsr->max_faces_per_prefix-1;
-				}
-	
-			}
-			for( j=first_face; j>= last_face; j--)
-			{
-
-				if ( is_active_neighbor(orig_router) == 0 )
-				{
-					if ( nlsr->debugging )
-						printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);	
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
-					add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]);	
-				}
-				else 
-				{
-					if ( j == last_face && is_active_neighbor(nle->name)==0)
-					{
-						if ( nlsr->debugging )
-							printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);	
-						if ( nlsr->detailed_logging )
-							writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
-						add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]);
-					}
-				}
-				
-			}
-			
-		}
-
-		hashtb_end(enle);
-	}
-	
-	hashtb_end(e);
-
-	return 0;
-}
-
-void 
-print_npt(void)
-{
-
-	if ( nlsr->debugging )
-	{
-		printf("\n");
-		printf("print_npt called\n");
-	}
-	if ( nlsr->detailed_logging )
-	{
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_npt called\n");
-	}
-	int i, npt_element;
-	
-	struct npt_entry *ne;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npt, e);
-	npt_element=hashtb_n(nlsr->npt);
-
-	for(i=0;i<npt_element;i++)
-	{
-		if ( nlsr->debugging )
-		{
-			printf("\n");
-			printf("----------NPT ENTRY %d------------------\n",i+1);
-		}
-		if ( nlsr->detailed_logging )
-		{
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"----------NPT ENTRY %d------------------\n",i+1);
-		}
-		ne=e->data;
-		if ( nlsr->debugging )
-			printf(" Origination Router: %s \n",ne->orig_router);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__," Origination Router: %s \n",ne->orig_router);
-		
-		int j, nl_element,face_list_element;
-		struct name_list_entry *nle;		
-		struct hashtb_enumerator eenle;
-    		struct hashtb_enumerator *enle = &eenle;
-
-		hashtb_start(ne->name_list, enle);
-		nl_element=hashtb_n(ne->name_list);	
-
-		for (j=0;j<nl_element;j++)
-		{
-			nle=enle->data;
-			if ( nlsr->debugging )
-				printf(" Name Prefix: %s \n",nle->name);
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Name Prefix: %s \n",nle->name);
-			hashtb_next(enle);
-		}
-		hashtb_end(enle);
-
-		struct face_list_entry *fle;
-
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(ne->face_list, ef);
-		face_list_element=hashtb_n(ne->face_list);
-		if ( face_list_element <= 0 )
-		{
-			if ( nlsr->debugging )
-				printf(" 	Face: No Face \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: No Face \n");
-			
-		}
-		else
-		{
-			for(j=0;j<face_list_element;j++)
-			{
-				fle=ef->data;
-				if ( nlsr->debugging )
-					printf(" 	Face: %d Route_Cost: %f \n",fle->next_hop_face,fle->route_cost);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: %d Route_Cost: %d \n",fle->next_hop_face,fle->route_cost);
-				hashtb_next(ef);	
-			}
-		}
-		hashtb_end(ef);
-		
-			
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	if ( nlsr->debugging )
-		printf("\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-}
-
-void
-delete_orig_router_from_npt(char *orig_router)
-{
-	int res,num_face,num_prefix;
-	struct npt_entry *ne;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npt, e);
-	res = hashtb_seek(e, orig_router, strlen(orig_router), 0);
-
-	if ( res == HT_OLD_ENTRY )
-	{
-		ne=e->data;
-		num_prefix=hashtb_n(ne->name_list);
-		if ( num_prefix > 0 )
-		{
-			num_face=hashtb_n(ne->face_list);
-			
-			if ( num_face > 0  )
-			{
-				int j, nl_element;
-				struct name_list_entry *nle;		
-				struct hashtb_enumerator eenle;
-    				struct hashtb_enumerator *enle = &eenle;
-
-				hashtb_start(ne->name_list, enle);
-				nl_element=hashtb_n(ne->name_list);	
-
-				for (j=0;j<nl_element;j++)
-				{
-					nle=enle->data;
-					delete_npt_entry_by_router_and_name_prefix(ne->orig_router,nle->name);		
-					hashtb_next(enle);
-				}
-				hashtb_end(enle);				
-
-			} 
-
-		}
-		hashtb_destroy(&ne->name_list);
-		hashtb_destroy(&ne->face_list);
-		hashtb_delete(e);		
-	}
-	else if ( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-	}
-	hashtb_end(e);	
-}
-
-
-void
-add_face_to_npt_by_face_id(char *dest_router, int face_id, int route_cost)
-{
-	if ( nlsr->debugging )
-	{
-		printf("add_face_to_npt_by_face_id called\n");
-		printf("Dest Router: %s Face: %d Route_cost: %d \n",dest_router, face_id, route_cost);
-	}
-	if ( nlsr->detailed_logging )
-	{
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"add_face_to_npt_by_face_id called\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Dest Router: %s Face: %d Route_cost: %d \n",dest_router, face_id, route_cost);
-	}
-
-	
-	int res,res1;
-	struct npt_entry *ne;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npt, e);
-	res = hashtb_seek(e, dest_router, strlen(dest_router), 0);
-
-	if ( res == HT_OLD_ENTRY )
-	{
-		if ( nlsr->debugging )
-			printf("Dest Router Found \n");
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Dest Router Found \n");
-	
-		ne=e->data;
-		
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(ne->face_list, ef);
-		res1=hashtb_seek(ef, &face_id, sizeof(face_id), 0);
-
-		if ( res1 == HT_OLD_ENTRY )
-		{
-			if ( nlsr->debugging )
-				printf("Face Found \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Face Found \n");
-			struct face_list_entry *fle;
-			fle=ef->data;
-			fle->next_hop_face=face_id;
-			fle->route_cost=route_cost;
-		}
-		else if ( res1 == HT_NEW_ENTRY )
-		{
-			if ( nlsr->debugging )
-				printf("Face Not Found \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Face Not Found \n");
-			struct face_list_entry *fle=(struct face_list_entry *)malloc(sizeof(struct face_list_entry));
-			fle=ef->data;
-			fle->next_hop_face=face_id;
-			fle->route_cost=route_cost;
-
-			
-
-
-		}
-		hashtb_end(ef);
-	}
-	else if (res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-	
-	hashtb_end(e);
-}
-
-
-void
-add_new_fib_entries_to_npt(void)
-{
-	if ( nlsr->debugging )
-		printf("add_new_fib_entries_to_npt called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"add_new_fib_entries_to_npt called\n");
-	int i,j, rt_element,face_list_element;
-	
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	rt_element=hashtb_n(nlsr->routing_table);
-
-	for(i=0;i<rt_element;i++)
-	{
-		rte=e->data;
-
-		struct face_list_entry *fle;
-
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(rte->face_list, ef);
-		face_list_element=hashtb_n(rte->face_list);
-		if ( face_list_element <= 0 )
-		{
-			if ( nlsr->debugging )
-				printf(" Face: No Face \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Face: No Face \n");
-		}
-		else
-		{
-			for(j=0;j<face_list_element;j++)
-			{
-				fle=ef->data;
-				add_face_to_npt_by_face_id(rte->dest_router,fle->next_hop_face,fle->route_cost);
-				hashtb_next(ef);	
-			}
-		}
-		hashtb_end(ef);
-
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-
-void
-delete_face_from_npt_by_face_id(char *dest_router, int face_id)
-{
-	if ( nlsr->debugging )
-		printf("delete_face_from_npt_by_face_id\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_face_from_npt_by_face_id\n");
-
-	int res,res1;
-	struct npt_entry *ne;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npt, e);
-	res = hashtb_seek(e, dest_router, strlen(dest_router), 0);
-
-	if ( res == HT_OLD_ENTRY )
-	{
-		ne=e->data;
-		
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(ne->face_list, ef);
-		res1=hashtb_seek(ef, &face_id, sizeof(face_id), 0);
-		if ( res1 == HT_OLD_ENTRY )
-		{
-			hashtb_delete(ef);
-		}
-		else if ( res1 == HT_NEW_ENTRY )
-		{
-			hashtb_delete(ef);
-		}
-		hashtb_end(ef);
-	}
-	else if (res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-	
-	hashtb_end(e);
-}
-
-
-void 
-clean_old_fib_entries_from_npt(void)
-{
-	
-	
-	if ( nlsr->debugging )
-		printf("clean_old_fib_entries_from_npt called\n\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"clean_old_fib_entries_from_npt called\n\n");
-	int i, npt_element;
-	
-	struct npt_entry *ne;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npt, e);
-	npt_element=hashtb_n(nlsr->npt);
-
-	for(i=0;i<npt_element;i++)
-	{
-		ne=e->data;
-		
-		int j,k, nl_element,face_list_element;
-		struct face_list_entry *fle;
-
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(ne->face_list, ef);
-		face_list_element=hashtb_n(ne->face_list);
-		if ( face_list_element <= 0 )
-		{
-			if ( nlsr->debugging )
-				printf(" Face: No Face \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: No Face \n");
-			
-		}
-		else
-		{
-			for(j=0;j<face_list_element;j++)
-			{
-				fle=ef->data;
-				int check=does_face_exist_for_router(ne->orig_router,fle->next_hop_face);
-				if ( check == 0 )
-				{
-					struct name_list_entry *nle;		
-					struct hashtb_enumerator eenle;
-    					struct hashtb_enumerator *enle = &eenle;
-
-					hashtb_start(ne->name_list, enle);
-					nl_element=hashtb_n(ne->name_list);	
-
-					for (k=0;k<nl_element;k++)
-					{
-						nle=enle->data;
-						if( is_neighbor(nle->name) == 0 )
-						{
-							if ( nlsr->debugging )
-								printf("Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);
-							if ( nlsr->detailed_logging )
-								writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);		
-							add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, fle->next_hop_face);
-						}						
-		
-
-						hashtb_next(enle);
-					}
-					hashtb_end(enle);
-
-
-					hashtb_delete(ef);
-					j++;
-						
-				}
-				else 
-				{
-					struct name_list_entry *nle;		
-					struct hashtb_enumerator eenle;
-    					struct hashtb_enumerator *enle = &eenle;
-
-					hashtb_start(ne->name_list, enle);
-					nl_element=hashtb_n(ne->name_list);	
-
-					for (k=0;k<nl_element;k++)
-					{
-						nle=enle->data;
-						if(  is_active_neighbor(ne->orig_router) && get_next_hop_face_from_adl(	ne->orig_router ) != fle->next_hop_face )
-						{
-							if ( nlsr->debugging )
-								printf("Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);
-							if ( nlsr->detailed_logging )
-								writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);		
-							add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, fle->next_hop_face);
-						}						
-		
-
-						hashtb_next(enle);
-					}
-					hashtb_end(enle);
-					
-					hashtb_next(ef);
-				}	
-			}
-		}
-		hashtb_end(ef);
-		
-			
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-void
-update_npt_with_new_route(void)
-{
-	if ( nlsr->debugging )
-		printf("update_npt_with_new_route called\n");
-		
-	clean_old_fib_entries_from_npt();
-	print_npt();
-	add_new_fib_entries_to_npt();
-	print_npt();	
-
-	int i, npt_element;
-	
-	struct npt_entry *ne;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npt, e);
-	npt_element=hashtb_n(nlsr->npt);
-
-	for(i=0;i<npt_element;i++)
-	{
-	
-		ne=e->data;
-		update_ccnd_fib_for_orig_router(ne->orig_router);
-		hashtb_next(e);
-	}
-	
-	hashtb_end(e);
-}
-
-
-
-void 
-sort_faces_by_distance(int *faces,int *route_costs,int start,int element)
-{
-	int i,j;
-	int temp_cost;
-	int temp_face;
-
-	for ( i=start ; i < element ; i ++) 
-	{
-		for( j=i+1; j<element; j ++)
-		{
-			if (route_costs[j] < route_costs[i] )
-			{
-				temp_cost=route_costs[j];
-				route_costs[j]=route_costs[i];
-				route_costs[i]=temp_cost;
-
-				temp_face=faces[j];
-				faces[j]=faces[i];
-				faces[i]=temp_face;
-			}
-		}
-	}
-	
-}
-
-void
-get_all_faces_for_orig_router_from_npt(char *orig_router, int *faces, int *route_costs, int num_faces)
-{
-
-	int res,face_list_element,j;	
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    
-
-   	hashtb_start(nlsr->npt, e);
-    	res = hashtb_seek(e, orig_router, strlen(orig_router), 0);
-
-	if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-	else if ( res == HT_OLD_ENTRY )
-	{
-		struct npt_entry *ne;
-		ne=e->data;
-		
-		struct face_list_entry *fle;
-
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(ne->face_list, ef);
-		face_list_element=hashtb_n(ne->face_list);
-		for(j=0;j<face_list_element;j++)
-		{
-			fle=ef->data;
-			faces[j]=fle->next_hop_face;
-			route_costs[j]=fle->route_cost;
-			hashtb_next(ef);	
-		}
-		hashtb_end(ef);
-		
-
-	}
-	hashtb_end(e);
-
-}
-
-void 
-destroy_faces_by_orig_router(char *orig_router)
-{
-
-	int res;	
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    
-
-   	hashtb_start(nlsr->npt, e);
-    	res = hashtb_seek(e, orig_router, strlen(orig_router), 0);
-
-	if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-	else if ( res == HT_OLD_ENTRY )
-	{
-		struct npt_entry *ne;
-		ne=e->data;
-		int num_face=hashtb_n(ne->face_list);
-		int last_face,first_face;
-
-		int *faces=(int *)malloc(num_face*sizeof(int));
-		int *route_costs=(int *)malloc(num_face*sizeof(int));
-		
-		get_all_faces_for_orig_router_from_npt(orig_router,faces,route_costs,num_face);
-		sort_faces_by_distance(faces,route_costs,0,num_face);
-		
-		/*
-		first_face=num_face-1;		
-	
-		if ( nlsr->multi_path_face_num == 0 )
-		{
-			last_face=first_face;
-		}
-		else 
-		{
-			if ( num_face <= nlsr->multi_path_face_num)
-			{
-				last_face=0;
-			}
-			else if ( nlsr->multi_path_face_num == 0)
-			{
-				last_face=num_face-nlsr->multi_path_face_num;
-			}
-		}
-		*/
-
-		last_face=0;
-		if ( nlsr->max_faces_per_prefix == 0) // add all faces available in routing table
-		{
-			first_face=num_face-1;
-		}
-		else if( nlsr->max_faces_per_prefix > 0)
-		{
-			if ( nlsr->max_faces_per_prefix >= num_face)
-			{
-				first_face=num_face-1;
-			}
-			else if ( nlsr->max_faces_per_prefix < num_face)
-			{
-				first_face=nlsr->max_faces_per_prefix-1;
-			}
-	
-		}
-
-		int i,j, nl_element;
-		struct name_list_entry *nle;		
-		struct hashtb_enumerator eenle;
-    		struct hashtb_enumerator *enle = &eenle;
-
-		hashtb_start(ne->name_list, enle);
-		nl_element=hashtb_n(ne->name_list);	
-
-		for (i=0;i<nl_element;i++)
-		{
-			nle=enle->data;
-			
-			for( j=first_face; j>= last_face; j--)
-			{
-				if ( is_active_neighbor(orig_router) == 0 )
-				{
-					if ( nlsr->debugging )
-						printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
-					add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]);	
-				}
-				else 
-				{
-					if ( j == last_face && is_active_neighbor(nle->name)==0)
-					{
-						if ( nlsr->debugging )
-							printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
-						if ( nlsr->detailed_logging )
-							writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
-						add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j]);
-					}
-				}
-			}
-
-			hashtb_next(enle);
-		}
-		hashtb_end(enle);
-		
-
-
-		free(faces);
-		free(route_costs);
-
-	}
-	hashtb_end(e);
-
-}
-
-void 
-destroy_all_face_by_nlsr(void)
-{
-	int i, npt_element;
-	
-	struct npt_entry *ne;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npt, e);
-	npt_element=hashtb_n(nlsr->npt);
-
-	for(i=0;i<npt_element;i++)
-	{
-		ne=e->data;
-		destroy_faces_by_orig_router(ne->orig_router);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	if ( nlsr->debugging )
-		printf("\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-}
diff --git a/nlsr-sync-0.0/nlsr_npt.h b/nlsr-sync-0.0/nlsr_npt.h
deleted file mode 100755
index d339ede..0000000
--- a/nlsr-sync-0.0/nlsr_npt.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef _NLSR_NPT_H_
-#define _NLSR_NPT_H_
-
-#define NO_FACE -12345
-#define ZERO_FACE 0
-
-struct npt_entry
-{
-	char *orig_router;
-	struct hashtb *name_list;
-	//int next_hop_face;
-	struct hashtb *face_list;
-};
-
-struct name_list_entry
-{
-	char *name;
-};
-
-
-int add_npt_entry(char *orig_router, char *name_prefix, int num_face, int *faces, int *route_costs);
-int delete_npt_entry_by_router_and_name_prefix(char *orig_router, char *name_prefix);
-void print_npt(void);
-void delete_orig_router_from_npt(char *orig_router);
-void update_npt_with_new_route(void);
-void destroy_all_face_by_nlsr(void);
-void sort_faces_by_distance(int *faces,int *route_costs,int start,int element);
-void update_ccnd_fib_for_orig_router(char *orig_router);
-void get_all_faces_for_orig_router_from_npt(char *orig_router, int *faces, int *route_costs, int num_faces);
-
-#endif
diff --git a/nlsr-sync-0.0/nlsr_route.c b/nlsr-sync-0.0/nlsr_route.c
deleted file mode 100755
index 573fcf9..0000000
--- a/nlsr-sync-0.0/nlsr_route.c
+++ /dev/null
@@ -1,1367 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <sys/types.h>
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-
-#include "nlsr.h"
-#include "nlsr_route.h"
-#include "nlsr_lsdb.h"
-#include "nlsr_npt.h"
-#include "nlsr_adl.h"
-#include "nlsr_fib.h"
-#include "utility.h"
-
-int
-route_calculate(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
-{
-
-	if(flags == CCN_SCHEDULE_CANCEL)
-	{
- 	 	return -1;
-	}
-
-	nlsr_lock();
-
-	if ( nlsr->debugging )
-		printf("route_calculate called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"route_calculate called\n");
-
-	if( ! nlsr->is_build_adj_lsa_sheduled )
-	{
-		/* Calculate Route here */
-		print_routing_table();
-		print_npt();		
-
-		struct hashtb_param param_me = {0};
-		nlsr->map = hashtb_create(sizeof(struct map_entry), &param_me);
-		nlsr->rev_map = hashtb_create(sizeof(struct map_entry), &param_me);
-		make_map();
-		assign_mapping_number();		
-		print_map();
-		print_rev_map();
-
-		do_old_routing_table_updates();
-		clear_old_routing_table();	
-		print_routing_table();
-		print_npt();
-
-		int i;
-		int **adj_matrix;
-		int map_element=hashtb_n(nlsr->map);
-		adj_matrix=malloc(map_element * sizeof(int *));
-		for(i = 0; i < map_element; i++)
-		{
-			adj_matrix[i] = malloc(map_element * sizeof(int));
-		}
-		make_adj_matrix(adj_matrix,map_element);
-		if ( nlsr->debugging )
-			print_adj_matrix(adj_matrix,map_element);
-
-		long int source=get_mapping_no(nlsr->router_name);
-		int num_link=get_no_link_from_adj_matrix(adj_matrix, map_element ,source);
-
-		if ( nlsr->is_hyperbolic_calc == 1)
-		{
-			long int *links=(long int *)malloc(num_link*sizeof(long int));
-			long int *link_costs=(long int *)malloc(num_link*sizeof(long int));
-			get_links_from_adj_matrix(adj_matrix, map_element , links, link_costs, source);
-
-			struct hashtb_enumerator ee;
-			struct hashtb_enumerator *e = &ee;
-			for (hashtb_start(nlsr->rev_map, e); e->key != NULL; hashtb_next(e)) 
-			{
-				struct map_entry *me=e->data;
-				if ( me->mapping != source )
-				{
-					long int *faces=(long int *)calloc(num_link,sizeof(long int));
-					double *nbr_dist=(double *)calloc(num_link,sizeof(double));
-					double *nbr_to_dest=(double *)calloc(num_link,sizeof(double));
-					for ( i=0 ; i < num_link; i++)
-					{
-						int face=get_next_hop_face_from_adl(get_router_from_rev_map(links[i]));
-						double dist_to_nbr=get_hyperbolic_distance(source,links[i]);
-						double dist_to_dest_from_nbr=get_hyperbolic_distance(links[i],me->mapping);
-						faces[i]=face;
-						nbr_dist[i]=dist_to_nbr;
-						nbr_to_dest[i]=	dist_to_dest_from_nbr;	
-
-						
-					}
-					sort_hyperbolic_route(nbr_to_dest,nbr_dist, faces,0,num_link);
-					if (nlsr->max_faces_per_prefix == 0 )
-					{
-						for ( i=0 ; i < num_link; i++)
-						{
-							update_routing_table_with_new_hyperbolic_route(me->mapping,faces[i],nbr_to_dest[i]);
-						}				
-					}
-					else if ( nlsr->max_faces_per_prefix > 0 )
-					{
-						if ( num_link <= nlsr->max_faces_per_prefix )
-						{
-							for ( i=0 ; i < num_link; i++)
-							{
-								update_routing_table_with_new_hyperbolic_route(me->mapping,faces[i],nbr_to_dest[i]);
-							}
-						}
-						else if (num_link > nlsr->max_faces_per_prefix)
-						{
-							for ( i=0 ; i < nlsr->max_faces_per_prefix; i++)
-							{
-								update_routing_table_with_new_hyperbolic_route(me->mapping,faces[i],nbr_to_dest[i]);
-							}
-						}
-
-					}
-					free(faces);
-					free(nbr_dist);
-					free(nbr_to_dest);
-				}
-			}
-			hashtb_end(e);
-
-			
-			free(links);
-			free(link_costs);
-		}
-		else if (nlsr->is_hyperbolic_calc == 0 )
-		{
-
-			long int *parent=(long int *)malloc(map_element * sizeof(long int));
-			long int *dist=(long int *)malloc(map_element * sizeof(long int));
-			
-		
-			if ( (num_link == 0) || (nlsr->max_faces_per_prefix == 1 ) )
-			{	
-				calculate_path(adj_matrix,parent,dist, map_element, source);		
-				print_all_path_from_source(parent,source);
-				print_all_next_hop(parent,source);		
-				update_routing_table_with_new_route(parent, dist,source);
-			}
-			else if ( (num_link != 0) && (nlsr->max_faces_per_prefix == 0 || nlsr->max_faces_per_prefix > 1 ) )
-			{
-				long int *links=(long int *)malloc(num_link*sizeof(long int));
-				long int *link_costs=(long int *)malloc(num_link*sizeof(long int));
-				get_links_from_adj_matrix(adj_matrix, map_element , links, link_costs, source);
-				for ( i=0 ; i < num_link; i++)
-				{
-					adjust_adj_matrix(adj_matrix, map_element,source,links[i],link_costs[i]);
-					calculate_path(adj_matrix,parent,dist, map_element, source);		
-					print_all_path_from_source(parent,source);
-					print_all_next_hop(parent,source);		
-					update_routing_table_with_new_route(parent, dist,source);
-				}
-
-				free(links);
-				free(link_costs);
-			}
-			free(parent);
-			free(dist);
-		}
-		
-		print_routing_table();
-		print_npt();
-
-		update_npt_with_new_route();
-
-		print_routing_table();
-		print_npt();
-
-
-		for(i = 0; i < map_element; i++)
-		{
-			free(adj_matrix[i]);
-		}
-		
-		free(adj_matrix);
-		hashtb_destroy(&nlsr->map);
-		hashtb_destroy(&nlsr->rev_map);
-		
-	}
-	nlsr->is_route_calculation_scheduled=0;
-
-	nlsr_unlock();
-
-	return 0;
-}
-
-void 
-calculate_path(int **adj_matrix, long int *parent,long int *dist ,long int V, long int S)
-{
-	int i;
-	long int v,u;
-	//long int *dist=(long int *)malloc(V * sizeof(long int));
-	long int *Q=(long int *)malloc(V * sizeof(long int));
-	long int head=0;
-	/* Initiate the Parent */
-	for (i = 0 ; i < V; i++)
-	{
-		parent[i]=EMPTY_PARENT;
-		dist[i]=INF_DISTANCE;
-		Q[i]=i;
-	} 
-
-	if ( S != NO_MAPPING_NUM )
-	{
-		dist[S]=0;
-		sort_queue_by_distance(Q,dist,head,V);
-
-		while (head < V )
-		{
-			u=Q[head];
-			if(dist[u] == INF_DISTANCE)
-			{
-				break;
-			}
-
-			for(v=0 ; v <V; v++)
-			{
-				if( adj_matrix[u][v] > 0 ) //
-				{
-					if ( is_not_explored(Q,v,head+1,V) )
-					{
-					
-						if( dist[u] + adj_matrix[u][v] <  dist[v])
-						{
-							dist[v]=dist[u] + adj_matrix[u][v] ;
-							parent[v]=u;
-						}	
-
-					}
-
-				}
-
-			}
-
-			head++;
-			sort_queue_by_distance(Q,dist,head,V);
-		}
-	}
-	free(Q);	
-}
-
-void
-print_all_path_from_source(long int *parent,long int source)
-{
-	int i, map_element;
-	struct map_entry *me;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->map, e);
-	map_element=hashtb_n(nlsr->map);
-
-	if ( source != NO_MAPPING_NUM)
-	{
-		for(i=0;i<map_element;i++)
-		{
-			me=e->data;
-			if(me->mapping != source)
-			{
-				
-				if ( nlsr->debugging )
-				{
-					print_path(parent,(long int)me->mapping);
-					printf("\n");
-				}
-				if ( nlsr->detailed_logging )
-				{
-					print_path(parent,(long int)me->mapping);
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-				}
-				
-			}
-			hashtb_next(e);		
-		}
-	}
-	hashtb_end(e);
-
-}
-
-void 
-print_all_next_hop(long int *parent,long int source)
-{
-	int i, map_element;
-	struct map_entry *me;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->map, e);
-	map_element=hashtb_n(nlsr->map);
-
-	for(i=0;i<map_element;i++)
-	{
-		me=e->data;
-		if(me->mapping != source)
-		{
-			if ( nlsr->debugging )
-				printf("Dest: %d Next Hop: %ld\n",me->mapping,get_next_hop_from_calculation(parent,me->mapping,source));
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Dest: %d Next Hop: %ld\n",me->mapping,get_next_hop_from_calculation(parent,me->mapping,source));
-		}
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-long int
-get_next_hop_from_calculation(long int *parent, long int dest,long int source)
-{
-	long int next_hop;
-	while ( parent[dest] != EMPTY_PARENT )
-	{
-		next_hop=dest;
-		dest=parent[dest];
-
-	}
-
-	if ( dest != source )
-	{
-		next_hop=NO_NEXT_HOP;	
-	}
-	
-	return next_hop;
-	
-}
-
-void
-print_path(long int *parent, long int dest)
-{
-	if (parent[dest] != EMPTY_PARENT )
-		print_path(parent,parent[dest]);
-
-	if ( nlsr->debugging )
-		printf(" %ld",dest);
-}
-
-int 
-is_not_explored(long int *Q, long int u,long int start, long int element)
-{
-	int ret=0;
-	long int i;
-	for(i=start; i< element; i++)
-	{
-		if ( Q[i] == u )
-		{
-			ret=1;
-			break;
-		}
-	}
-	return ret;
-}
-
-void 
-sort_queue_by_distance(long int *Q,long int *dist,long int start,long int element)
-{
-	long int i,j;
-	long int temp_u;
-
-	for ( i=start ; i < element ; i ++) 
-	{
-		for( j=i+1; j<element; j ++)
-		{
-			if (dist[Q[j]] < dist[Q[i]])
-			{
-				temp_u=Q[j];
-				Q[j]=Q[i];
-				Q[i]=temp_u;
-			}
-		}
-	}
-	
-}
-
-void 
-sort_hyperbolic_route(double *dist_dest,double *dist_nbr, long int *faces,long int start,long int element)
-{
-	long int i,j;
-	double temp_dist;
-	long int temp_face;
-
-	for ( i=start ; i < element ; i ++) 
-	{
-		for( j=i+1; j<element; j ++)
-		{
-			if (dist_dest[i] < dist_dest[j])
-			{
-				temp_dist=dist_dest[j];
-				dist_dest[j]=dist_dest[i];
-				dist_dest[i]=temp_dist;
-
-				temp_dist=dist_nbr[j];
-				dist_nbr[j]=dist_nbr[i];
-				dist_nbr[i]=temp_dist;
-
-				temp_face=faces[j];
-				faces[j]=faces[i];
-				faces[i]=temp_face;
-			}
-			if ( (dist_dest[i] == dist_dest[j]) && (dist_nbr[i] < dist_nbr[j]) )
-			{
-				temp_dist=dist_dest[j];
-				dist_dest[j]=dist_dest[i];
-				dist_dest[i]=temp_dist;
-
-				temp_dist=dist_nbr[j];
-				dist_nbr[j]=dist_nbr[i];
-				dist_nbr[i]=temp_dist;
-
-				temp_face=faces[j];
-				faces[j]=faces[i];
-				faces[i]=temp_face;
-			}
-		}
-	}
-	
-}
-
-void
-print_map(void)
-{
-	int i, map_element;
-	struct map_entry *me;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->map, e);
-	map_element=hashtb_n(nlsr->map);
-
-	for(i=0;i<map_element;i++)
-	{
-		me=e->data;
-		if ( nlsr->debugging )
-			printf("Router: %s Mapping Number: %d \n",me->router,me->mapping);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Router: %s Mapping Number: %d \n",me->router,me->mapping);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-}
-
-
-void
-assign_mapping_number(void)
-{
-	int i, map_element;
-	struct map_entry *me;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->map, e);
-	map_element=hashtb_n(nlsr->map);
-
-	for(i=0;i<map_element;i++)
-	{
-		me=e->data;
-		me->mapping=i;
-		add_rev_map_entry(i,me->router);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-}
-
-void 
-make_map(void)
-{
-	
-
-	int i, adj_lsdb_element;
-	struct alsa *adj_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-	adj_lsdb_element=hashtb_n(nlsr->lsdb->adj_lsdb);
-
-	add_map_entry(nlsr->router_name);
-
-	for(i=0;i<adj_lsdb_element;i++)
-	{
-		adj_lsa=e->data;
-		add_adj_data_to_map(adj_lsa->header->orig_router->name,adj_lsa->body,adj_lsa->no_link);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-void 
-add_map_entry(char *router)
-{
-
-	struct map_entry *me=(struct map_entry*)malloc(sizeof(struct map_entry ));
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->map, e);
-    	res = hashtb_seek(e, router, strlen(router), 0);
-
-	if(res == HT_NEW_ENTRY)
-	{
-		me=e->data;
-		me->router=(char *)malloc(strlen(router)+1);
-		memset(me->router,0,strlen(router)+1);
-		memcpy(me->router,router,strlen(router));
-		me->mapping=0;
-	}
-
-	hashtb_end(e);
-	
-}
-
-
-void 
-add_adj_data_to_map(char *orig_router, char *body, int no_link)
-{
-	add_map_entry(orig_router);
-	
-	int i=0;
-	char *lsa_data=(char *)malloc(strlen(body)+1);
-	memset(	lsa_data,0,strlen(body)+1);
-	memcpy(lsa_data,body,strlen(body)+1);
-	char *sep="|";
-	char *rem;
-	char *rtr_id;
-	char *length;
-	char *face;
-	char *metric;
-	
-	if(no_link >0 )
-	{
-		rtr_id=strtok_r(lsa_data,sep,&rem);
-		length=strtok_r(NULL,sep,&rem);
-		face=strtok_r(NULL,sep,&rem);
-		metric=strtok_r(NULL,sep,&rem);
-
-		add_map_entry(rtr_id);
-
-		for(i=1;i<no_link;i++)
-		{
-			rtr_id=strtok_r(NULL,sep,&rem);
-			length=strtok_r(NULL,sep,&rem);
-			face=strtok_r(NULL,sep,&rem);
-			metric=strtok_r(NULL,sep,&rem);
-
-			add_map_entry(rtr_id);
-
-		}
-	}
-	
-	free(lsa_data);
-}
-
-int 
-get_mapping_no(char *router)
-{
-	struct map_entry *me;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-	int ret;
-
-	int n = hashtb_n(nlsr->map);
-
-	if ( n < 1)
-	{
-		return NO_MAPPING_NUM;
-	}
-
-   	hashtb_start(nlsr->map, e);
-    	res = hashtb_seek(e, router, strlen(router), 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		me=e->data;
-		ret=me->mapping;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-		ret=NO_MAPPING_NUM;
-	}
-
-	hashtb_end(e);	
-
-	return ret;
-
-}
-
-
-void 
-add_rev_map_entry(long int mapping_number, char *router)
-{
-
-	struct map_entry *me=(struct map_entry*)malloc(sizeof(struct map_entry ));
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->rev_map, e);
-    	res = hashtb_seek(e, &mapping_number, sizeof(mapping_number), 0);
-
-	if(res == HT_NEW_ENTRY)
-	{
-		me=e->data;
-		me->router=(char *)malloc(strlen(router)+1);
-		memset(me->router,0,strlen(router)+1);
-		memcpy(me->router,router,strlen(router));
-		me->mapping=mapping_number;
-	}
-
-	hashtb_end(e);
-	
-}
-
-
-
-char * 
-get_router_from_rev_map(long int mapping_number)
-{
-
-	struct map_entry *me;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->rev_map, e);
-    	res = hashtb_seek(e, &mapping_number, sizeof(mapping_number), 0);
-
-	if(res == HT_OLD_ENTRY)
-	{
-		me=e->data;
-		hashtb_end(e);
-		return me->router;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-		hashtb_end(e);
-	}
-	
-	return NULL;
-}
-
-void
-print_rev_map(void)
-{
-	int i, map_element;
-	struct map_entry *me;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->map, e);
-	map_element=hashtb_n(nlsr->map);
-
-	for(i=0;i<map_element;i++)
-	{
-		me=e->data;
-		if ( nlsr->debugging )
-			printf("Mapping Number: %d Router: %s  \n",me->mapping,me->router);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Mapping Number: %d Router: %s  \n",me->mapping,me->router);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-}
-
-
-void
-assign_adj_matrix_for_lsa(struct alsa *adj_lsa, int **adj_matrix)
-{
-	int mapping_orig_router=get_mapping_no(adj_lsa->header->orig_router->name);
-	int mapping_nbr_router;
-
-	int i;
-	char *lsa_data=(char *)malloc(strlen(adj_lsa->body)+1);
-	memset(	lsa_data,0,strlen(adj_lsa->body)+1);
-	memcpy(lsa_data,adj_lsa->body,strlen(adj_lsa->body)+1);
-	char *sep="|";
-	char *rem;
-	char *rtr_id;
-	char *length;
-	char *face;
-	char *metric;
-	
-	if(adj_lsa->no_link >0 )
-	{
-		rtr_id=strtok_r(lsa_data,sep,&rem);
-		length=strtok_r(NULL,sep,&rem);
-		face=strtok_r(NULL,sep,&rem);
-		metric=strtok_r(NULL,sep,&rem);
-
-		mapping_nbr_router=get_mapping_no(rtr_id);
-		adj_matrix[mapping_orig_router][mapping_nbr_router]=atoi(metric);
-
-		for(i=1;i<adj_lsa->no_link;i++)
-		{
-			rtr_id=strtok_r(NULL,sep,&rem);
-			length=strtok_r(NULL,sep,&rem);
-			face=strtok_r(NULL,sep,&rem);
-			metric=strtok_r(NULL,sep,&rem);
-
-			mapping_nbr_router=get_mapping_no(rtr_id);
-			adj_matrix[mapping_orig_router][mapping_nbr_router]=atoi(metric);
-
-		}
-	}
-	
-	free(lsa_data);
-}
-
-void 
-make_adj_matrix(int **adj_matrix,int map_element)
-{
-
-	init_adj_matrix(adj_matrix,map_element);
-
-	int i, adj_lsdb_element;
-	struct alsa *adj_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-	adj_lsdb_element=hashtb_n(nlsr->lsdb->adj_lsdb);
-
-	for(i=0;i<adj_lsdb_element;i++)
-	{
-		adj_lsa=e->data;
-		assign_adj_matrix_for_lsa(adj_lsa,adj_matrix);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-void 
-init_adj_matrix(int **adj_matrix,int map_element)
-{
-	int i, j;
-	for(i=0;i<map_element;i++)
-		for(j=0;j<map_element;j++)
-			adj_matrix[i][j]=0;
-}
-
-void print_adj_matrix(int **adj_matrix, int map_element)
-{
-	int i, j;
-	for(i=0;i<map_element;i++)
-	{
-		for(j=0;j<map_element;j++)
-			printf("%d ",adj_matrix[i][j]);
-		printf("\n");
-	}
-}
-
-
-int 
-get_no_link_from_adj_matrix(int **adj_matrix,long int V, long int S)
-{
-	int no_link=0;
-	int i;
-
-	for(i=0;i<V;i++)
-	{	
-		if ( adj_matrix[S][i] > 0 )
-		{
-			no_link++;
-		}
-	}
-	return no_link;
-}
-
-void 
-get_links_from_adj_matrix(int **adj_matrix, long int V ,long int *links, long int *link_costs,long int S)
-{
-	int i,j;
-	j=0;
-	for (i=0; i <V; i++)
-	{
-		if ( adj_matrix[S][i] > 0 )
-		{
-			links[j]=i;
-			link_costs[j]=adj_matrix[S][i];
-			j++;
-		}
-	}
-}
-
-void adjust_adj_matrix(int **adj_matrix, long int V, long int S, long int link,long int link_cost)
-{
-	int i;
-	for ( i = 0; i < V; i++ )
-	{
-		if ( i == link )
-		{
-			adj_matrix[S][i]=link_cost;
-		}
-		else 
-		{
-			adj_matrix[S][i]=0;
-		}
-	}
-
-}
-
-int 
-get_number_of_next_hop(char *dest_router)
-{
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res,ret;
-
-   	hashtb_start(nlsr->routing_table, e);
-    	res = hashtb_seek(e, dest_router, strlen(dest_router), 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		rte=e->data;
-		ret=hashtb_n(rte->face_list);
-		//nhl=rte->face_list;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-		ret=NO_NEXT_HOP;
-	}
-
-	hashtb_end(e);	
-
-	return ret;
-}
-
-
-int 
-get_next_hop(char *dest_router,int *faces, int *route_costs)
-{
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res,ret;
-
-   	hashtb_start(nlsr->routing_table, e);
-    	res = hashtb_seek(e, dest_router, strlen(dest_router), 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		rte=e->data;
-		ret=hashtb_n(rte->face_list);
-		//nhl=rte->face_list;
-		int j,face_list_element;
-		struct face_list_entry *fle;
-
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(rte->face_list, ef);
-		face_list_element=hashtb_n(rte->face_list);
-		for(j=0;j<face_list_element;j++)
-		{
-			fle=ef->data;
-			//printf(" 	Face: %d Route_Cost: %d \n",fle->next_hop_face,fle->route_cost);
-			faces[j]=fle->next_hop_face;
-			route_costs[j]=fle->route_cost;
-			hashtb_next(ef);	
-		}
-		hashtb_end(ef);
-		
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-		ret=NO_NEXT_HOP;
-	}
-
-	hashtb_end(e);	
-
-	return ret;
-}
-
-void
-add_next_hop_router(char *dest_router)
-{
-	if ( strcmp(dest_router,nlsr->router_name)== 0)
-	{
-		return ;
-	}
-
-	struct routing_table_entry *rte=(struct routing_table_entry *)malloc(sizeof(struct routing_table_entry));
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->routing_table, e);
-    	res = hashtb_seek(e, dest_router, strlen(dest_router), 0);
-
-	if( res == HT_NEW_ENTRY )
-	{
-		rte=e->data;
-		rte->dest_router=(char *)malloc(strlen(dest_router)+1);
-		memset(rte->dest_router,0,strlen(dest_router)+1);
-		memcpy(rte->dest_router,dest_router,strlen(dest_router));
-		//rte->next_hop_face=NO_NEXT_HOP;
-		struct hashtb_param param_fle = {0};
-		rte->face_list=hashtb_create(sizeof(struct face_list_entry), &param_fle);
-
-		add_npt_entry(dest_router, dest_router, 0, NULL, NULL);
-	}
-	hashtb_end(e);
-
-}
-
-void 
-add_next_hop_from_lsa_adj_body(char *body, int no_link)
-{
-
-	int i=0;
-	char *lsa_data=(char *)malloc(strlen(body)+1);
-	memset(	lsa_data,0,strlen(body)+1);
-	memcpy(lsa_data,body,strlen(body)+1);
-	char *sep="|";
-	char *rem;
-	char *rtr_id;
-	char *length;
-	char *face;
-	char *metric;
-
-	if(no_link >0 )
-	{
-		rtr_id=strtok_r(lsa_data,sep,&rem);
-		length=strtok_r(NULL,sep,&rem);
-		face=strtok_r(NULL,sep,&rem);
-		metric=strtok_r(NULL,sep,&rem);
-
-
-		add_next_hop_router(rtr_id);
-
-		for(i=1;i<no_link;i++)
-		{
-			rtr_id=strtok_r(NULL,sep,&rem);
-			length=strtok_r(NULL,sep,&rem);
-			face=strtok_r(NULL,sep,&rem);
-			metric=strtok_r(NULL,sep,&rem);
-
-			add_next_hop_router(rtr_id);
-	
-		}
-	}
-
-	free(lsa_data);
-
-
-}
-
-void 
-update_routing_table(char * dest_router,int next_hop_face, int route_cost)
-{
-	if ( nlsr->debugging )
-	{
-		printf("update_routing_table called \n");
-		printf("Dest Router: %s Next Hop face: %d Route Cost: %d \n",dest_router,next_hop_face,route_cost);
-	}
-
-	int res,res1;
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	res = hashtb_seek(e, dest_router, strlen(dest_router), 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		rte=e->data;
-
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(rte->face_list, ef);
-		res1 = hashtb_seek(ef, &next_hop_face, sizeof(next_hop_face), 0);	
-		if( res1 == HT_NEW_ENTRY)
-		{
-			struct face_list_entry *fle=(struct face_list_entry *)malloc(sizeof(struct face_list_entry));
-			fle=ef->data;
-			fle->next_hop_face=next_hop_face;
-			fle->route_cost=route_cost;						
-		}
-		else if ( res1 == HT_OLD_ENTRY )
-		{
-			struct face_list_entry *fle;
-			fle=ef->data;
-			fle->route_cost=route_cost;
-		}
-		hashtb_end(ef);
-	}
-	else if ( res == HT_OLD_ENTRY )
-	{
-		hashtb_delete(e);
-	}
-	
-	hashtb_end(e);
-	
-}
-
-void 
-print_routing_table(void)
-{
-	if ( nlsr->debugging )
-		printf("print_routing_table called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_routing_table called\n");
-	int i,j, rt_element,face_list_element;
-	
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	rt_element=hashtb_n(nlsr->routing_table);
-
-	for(i=0;i<rt_element;i++)
-	{
-		if ( nlsr->debugging )
-			printf("----------Routing Table Entry %d------------------\n",i+1);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"----------Routing Table Entry %d------------------\n",i+1);
-		
-		rte=e->data;
-
-		if ( nlsr->debugging )
-			printf(" Destination Router: %s \n",rte->dest_router);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__," Destination Router: %s \n",rte->dest_router);
-
-		
-		//rte->next_hop_face == NO_NEXT_HOP ? printf(" Next Hop Face: NO_NEXT_HOP \n") : printf(" Next Hop Face: %d \n", rte->next_hop_face);
-
-		struct face_list_entry *fle;
-
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(rte->face_list, ef);
-		face_list_element=hashtb_n(rte->face_list);
-		if ( face_list_element <= 0 )
-		{
-			if ( nlsr->debugging )
-				printf(" 	Face: No Face \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: No Face \n");
-		}
-		else
-		{
-			for(j=0;j<face_list_element;j++)
-			{
-				fle=ef->data;
-				if ( nlsr->debugging )
-					printf(" 	Face: %d Route_Cost: %f \n",fle->next_hop_face,fle->route_cost);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: %d Route_Cost: %d \n",fle->next_hop_face,fle->route_cost);
-				hashtb_next(ef);	
-			}
-		}
-		hashtb_end(ef);
-
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	if ( nlsr->debugging )
-		printf("\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-}
-
-
-int
-delete_empty_rte(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
-{
-	if ( nlsr->debugging )
-	{
-		printf("delete_empty_rte called\n");
-		printf("Router: %s \n",(char *)ev->evdata);
-	}
-	if ( nlsr->detailed_logging )
-	{
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_empty_rte called\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Router: %s \n",(char *)ev->evdata);
-	}
-	
-	if(flags == CCN_SCHEDULE_CANCEL)
-	{
- 	 	return -1;
-	}
-
-	nlsr_lock();
-	int res;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	res = hashtb_seek(e, (char *)ev->evdata, strlen((char *)ev->evdata), 0);
-	
-	if ( res == HT_OLD_ENTRY )
-	{
-		hashtb_delete(e);
-	}
-	else if ( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-	}
-
-	print_routing_table();
-
-	nlsr_unlock();
-	
-	return 0;
-}
-
-void 
-clear_old_routing_table(void)
-{
-	if ( nlsr->debugging )
-		printf("clear_old_routing_table called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"clear_old_routing_table called\n");
-	int i,rt_element;
-	
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	rt_element=hashtb_n(nlsr->routing_table);
-
-	for(i=0;i<rt_element;i++)
-	{
-		rte=e->data;
-		hashtb_destroy(&rte->face_list);
-		struct hashtb_param param_fle = {0};
-		rte->face_list=hashtb_create(sizeof(struct face_list_entry), &param_fle);
-
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);	
-}
-
-
-void 
-do_old_routing_table_updates(void)
-{
-	if ( nlsr->debugging )
-		printf("do_old_routing_table_updates called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"do_old_routing_table_updates called\n");
-	
-	int i, rt_element;
-	int mapping_no;	
-
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	rt_element=hashtb_n(nlsr->routing_table);
-
-	for(i=0;i<rt_element;i++)
-	{
-		rte=e->data;
-		mapping_no=get_mapping_no(rte->dest_router);
-		if ( mapping_no == NO_MAPPING_NUM)
-		{		
-			delete_orig_router_from_npt(rte->dest_router);
-			char *router=(char *)malloc(strlen(rte->dest_router)+1);
-			memset(router,0,strlen(rte->dest_router)+1);
-			memcpy(router,rte->dest_router,strlen(rte->dest_router)+1);
-			nlsr->event = ccn_schedule_event(nlsr->sched, 1, &delete_empty_rte, (void *)router , 0);
-		}
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);	
-}
-
-void 
-update_routing_table_with_new_hyperbolic_route(long int dest_router_rev_map_index, long int face, double nbr_to_dest_dist)
-{
-	if ( nlsr->debugging )
-		printf("update_routing_table_with_new_hyperbolic_route called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_routing_table_with_new_hyperbolic_route called\n");
-	
-	char *orig_router=get_router_from_rev_map(dest_router_rev_map_index);
-
-	if (face != NO_NEXT_HOP && face != NO_FACE )
-	{
-		update_routing_table(orig_router,face,nbr_to_dest_dist);
-		if ( nlsr->debugging )
-			printf ("Orig_router: %s Next Hop Face: %ld \n",orig_router,face);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Orig_router: %s Next Hop Face: %ld \n",orig_router,face);
-					
-	}
-	
-
-}
-
-
-void 
-update_routing_table_with_new_route(long int *parent, long int *dist,long int source)
-{
-	if ( nlsr->debugging )
-		printf("update_routing_table_with_new_route called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_routing_table_with_new_route called\n");
-	int i, map_element;
-	struct map_entry *me;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->rev_map, e);
-	map_element=hashtb_n(nlsr->rev_map);
-
-	for(i=0;i<map_element;i++)
-	{
-		me=e->data;
-		if(me->mapping != source)
-		{
-			
-			char *orig_router=get_router_from_rev_map(me->mapping);
-			if (orig_router != NULL )
-			{
-				int next_hop_router_num=get_next_hop_from_calculation(parent,me->mapping,source);
-				if ( next_hop_router_num == NO_NEXT_HOP )
-				{
-					if ( nlsr->debugging )
-						printf ("Orig_router: %s Next Hop Face: %d \n",orig_router,NO_FACE);
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Orig_router: %s Next Hop Face: %d \n",orig_router,NO_FACE);
-				}
-				else 
-				{
-					char *next_hop_router=get_router_from_rev_map(next_hop_router_num);
-					int next_hop_face=get_next_hop_face_from_adl(next_hop_router);
-					update_routing_table(orig_router,next_hop_face,dist[me->mapping]);
-					if ( nlsr->debugging )
-						printf ("Orig_router: %s Next Hop Face: %d \n",orig_router,next_hop_face);
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Orig_router: %s Next Hop Face: %d \n",orig_router,next_hop_face);
-					
-
-				}
-			}
-		}
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-}
-
-int 
-does_face_exist_for_router(char *dest_router, int face_id)
-{
-	if (nlsr->debugging)
-	{
-		printf("does_face_exist_for_router called\n");
-		printf("Dest Router: %s and Face id: %d \n",dest_router, face_id);
-	}
-
-	int ret=0;
-
-	int res;
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	res = hashtb_seek(e, dest_router, strlen(dest_router), 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		rte=e->data;
-		unsigned *v;
-		v = hashtb_lookup(rte->face_list, &face_id, sizeof(face_id));
-		if (v != NULL)
-			ret = 1;
-	}
-	else
-	{
-		hashtb_delete(e);
-	} 
-	
-	hashtb_end(e);
-
-	return ret;
-}
-
-double 
-get_hyperbolic_distance(long int source, long int dest)
-{
-	double distance;
-	char *src_router=get_router_from_rev_map(source);
-	char *dest_router=get_router_from_rev_map(dest);
-
-	double src_r=get_hyperbolic_r(src_router);
-	double src_theta=get_hyperbolic_r(src_router);	
-
-	double dest_r=get_hyperbolic_r(dest_router);
-	double dest_theta=get_hyperbolic_r(dest_router);
-	if ( src_r != -1 && dest_r != -1 )
-	{
-		distance=acosh(cosh(src_r)*cosh(dest_r)-sinh(src_r)*sinh(dest_r)*cos(src_theta-dest_theta));
-	}
-	else 
-	{
-		distance= -1.0;
-	}
-	
-	return distance;
-}
diff --git a/nlsr-sync-0.0/nlsr_route.h b/nlsr-sync-0.0/nlsr_route.h
deleted file mode 100755
index b6dff03..0000000
--- a/nlsr-sync-0.0/nlsr_route.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef _NLSR_ROUTE_H_
-#define _NLSR_ROUTE_H_
-
-#define EMPTY_PARENT -12345
-#define INF_DISTANCE 2147483647
-
-#define NO_NEXT_HOP -12345
-#define NO_MAPPING_NUM -1
-
-struct map_entry
-{
-	char *router;
-	int mapping;
-};
-
-
-struct routing_table_entry
-{
-	char *dest_router;
-	//int next_hop_face;
-	struct hashtb *face_list;
-};
-
-struct face_list_entry
-{
-	int next_hop_face;
-	double route_cost;
-};
-
-int route_calculate(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
-void make_map(void);
-void add_map_entry(char *router);
-void add_adj_data_to_map(char *orig_router, char *body, int no_link);
-void print_map(void);
-void assign_mapping_number(void);
-void make_adj_matrix(int **adj_matrix,int map_element);
-void init_adj_matrix(int **adj_matrix,int map_element);
-void print_adj_matrix(int **adj_matrix, int map_element);
-int get_mapping_no(char *router);
-void calculate_path(int **adj_matrix, long int *parent,long int *dist, long int V, long int S);
-void sort_queue_by_distance(long int *Q,long int *dist,long int start,long int element);
-int is_not_explored(long int *Q, long int u,long int start, long int element);
-void print_path(long int *parent, long int dest);
-void print_all_path_from_source(long int *parent,long int source);
-void add_rev_map_entry(long int mapping_number, char *router);
-void print_rev_map(void);
-char * get_router_from_rev_map(long int mapping_number);
-int get_no_link_from_adj_matrix(int **adj_matrix,long int V, long int S);
-void get_links_from_adj_matrix(int **adj_matrix, long int V ,long int *links, long int *link_costs,long int S);
-void adjust_adj_matrix(int **adj_matrix, long int V, long int S, long int link,long int link_cost);
-
-/* Routing Table Relates function */
-
-int get_next_hop(char *dest_router,int *faces, int *route_costs);
-int get_number_of_next_hop(char *dest_router);
-void add_next_hop_router(char *dest_router);
-void add_next_hop_from_lsa_adj_body(char *body, int no_link);
-void print_routing_table(void);
-void do_old_routing_table_updates(void);
-void clear_old_routing_table(void);
-void update_routing_table_with_new_route(long int *parent,long int *dist, long int source);
-
-long int get_next_hop_from_calculation(long int *parent, long int dest,long int source);
-void print_all_next_hop(long int *parent,long int source);
-int does_face_exist_for_router(char *dest_router, int face_id);
-
-double get_hyperbolic_distance(long int source, long int dest);
-void sort_hyperbolic_route(double *dist_dest,double *dist_nbr, long int *faces,long int start,long int element);
-void update_routing_table_with_new_hyperbolic_route(long int dest_router_rev_map_index, long int face, double nbr_to_dest_dist);
-
-#endif
diff --git a/nlsr-sync-0.0/nlsr_sync.c b/nlsr-sync-0.0/nlsr_sync.c
deleted file mode 100644
index 52f9ca4..0000000
--- a/nlsr-sync-0.0/nlsr_sync.c
+++ /dev/null
@@ -1,759 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <assert.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-#include <ccn/sync.h>
-#include <ccn/seqwriter.h>
-
-#include "nlsr.h"
-#include "nlsr_sync.h"
-#include "nlsr_lsdb.h"
-#include "utility.h"
-
-
-char *
-hex_string(unsigned char *s, size_t l)
-{
-    const char *hex_digits = "0123456789abcdef";
-    char *r;
-    int i;
-    r = calloc(1, 1 + 2 * l);
-    for (i = 0; i < l; i++) {
-        r[2*i] = hex_digits[(s[i]>>4) & 0xf];
-        r[1+2*i] = hex_digits[s[i] & 0xf];
-    }
-    return(r);
-}
-
-int
-sync_cb(struct ccns_name_closure *nc,
-        struct ccn_charbuf *lhash,
-        struct ccn_charbuf *rhash,
-        struct ccn_charbuf *name)
-{
-    char *hexL;
-    char *hexR;
-    int res;
-    struct ccn_charbuf *uri = ccn_charbuf_create();
-    if (lhash == NULL || lhash->length == 0) {
-        hexL = strdup("none");
-    } else
-        hexL = hex_string(lhash->buf, lhash->length);
-    if (rhash == NULL || rhash->length == 0) {
-        hexR = strdup("none");
-    } else
-        hexR = hex_string(rhash->buf, rhash->length);
-    if (name != NULL)
-        ccn_uri_append(uri, name->buf, name->length, 1);
-    else
-        ccn_charbuf_append_string(uri, "(null)");
-
-  
-    if ( nlsr->debugging )
-	printf("Response from sync in the name: %s \n",ccn_charbuf_as_string(uri));	
-
-    fflush(stdout);
-    free(hexL);
-    free(hexR);
-    ccn_charbuf_destroy(&uri);
-
-
-	//--Doing our thing from here
- 	struct ccn_indexbuf cid={0};
-
-    	struct ccn_indexbuf *components=&cid;
-    	ccn_name_split (name, components);
-    	//ccn_name_chop(name,components,-3);
-	//process_content_from_sync(name,components);
-
-	struct ccn_charbuf *content_name = ccn_charbuf_create();
-	ccn_name_init(content_name);
-	res = ccn_name_append_components(content_name, name->buf, components->buf[0], components->buf[components->n - 1]);
-
-	struct ccn_indexbuf cid1={0};
-    	struct ccn_indexbuf *components1=&cid1;
-    	res=ccn_name_split (content_name, components1);
-	if ( nlsr->debugging )
-		printf("Number of components in name = %d \n",res);
-	ccn_name_chop(content_name,components1,-3);
-	process_content_from_sync(content_name,components1);
-	ccn_charbuf_destroy(&content_name);
-
-  return(0);
-}
-
-
-int 
-get_lsa_position(struct ccn_charbuf * ccnb, struct ccn_indexbuf *comps)
-{
-
-	
-	
-	int res,i;
-	int lsa_position=0; 	 	
-	int name_comps=(int)comps->n;
-
-	for(i=0;i<name_comps;i++)
-	{
-		res=ccn_name_comp_strcmp(ccnb->buf,comps,i,"LSA");
-		if( res == 0)
-		{
-			lsa_position=i;
-			break;
-		}	
-	}
-
-	return lsa_position;
-
-}
-
-void 
-get_name_part(struct name_prefix *name_part,struct ccn_charbuf * interest_ccnb, struct ccn_indexbuf *interest_comps, int offset)
-{
-
-	
-	
-	int res,i;
-	int lsa_position=0;
-	int len=0;
-
-	
-	struct ccn_indexbuf cid={0};
-    	struct ccn_indexbuf *components=&cid;
-	struct ccn_charbuf *name=ccn_charbuf_create();
-	ccn_name_from_uri(name,nlsr->slice_prefix);
-    	ccn_name_split (name, components);
-	lsa_position=components->n-2;
-
-    	ccn_charbuf_destroy(&name);
-	
-
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-	for(i=lsa_position+1+offset;i<interest_comps->n-1;i++)
-	{
-		res=ccn_name_comp_get(interest_ccnb->buf, interest_comps,i,&comp_ptr1, &comp_size);
-		len+=1;
-		len+=(int)comp_size;	
-	}
-	len++;
-
-	char *neighbor=(char *)malloc(len);
-	memset(neighbor,0,len);
-
-	for(i=lsa_position+1+offset; i<interest_comps->n-1;i++)
-	{
-		res=ccn_name_comp_get(interest_ccnb->buf, interest_comps,i,&comp_ptr1, &comp_size);
-		memcpy(neighbor+strlen(neighbor),"/",1);
-		memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,strlen((char *)comp_ptr1));
-
-	}
-
-	name_part->name=(char *)malloc(strlen(neighbor)+1);
-	memset(name_part->name,0,strlen(neighbor)+1);
-	memcpy(name_part->name,neighbor,strlen(neighbor)+1);
-	name_part->length=strlen(neighbor)+1;
-
-	// Add 01/31/2013
-	free(neighbor);
-}
-
-void 
-get_host_name_from_command_string(struct name_prefix *name_part,char *nbr_name_uri, int offset)
-{
-
-	
-	
-	int res,i;
-	int len=0;
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-
-	struct ccn_charbuf *name=ccn_charbuf_create();
-	name = ccn_charbuf_create();
-    	res = ccn_name_from_uri(name,nbr_name_uri);
-    	if (res < 0) {
-        	fprintf(stderr, "Bad ccn URI: %s\n", nbr_name_uri);
-        	exit(1);
-    	}	
-
-	struct ccn_indexbuf cid={0};
-
-    	struct ccn_indexbuf *components=&cid;
-    	ccn_name_split (name, components);
-
-	for(i=components->n-2;i> (0+offset);i--)
-	{
-		res=ccn_name_comp_get(name->buf, components,i,&comp_ptr1, &comp_size);
-		len+=1;
-		len+=(int)comp_size;	
-	}
-	len++;
-
-	char *neighbor=(char *)malloc(len);
-	memset(neighbor,0,len);
-
-	for(i=components->n-2;i> (0+offset);i--)
-	{
-		res=ccn_name_comp_get(name->buf, components,i,&comp_ptr1, &comp_size);
-		if ( i != components->n-2)
-		memcpy(neighbor+strlen(neighbor),".",1);
-		memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,strlen((char *)comp_ptr1));
-
-	}
-
-	name_part->name=(char *)malloc(strlen(neighbor)+1);
-	memset(name_part->name,0,strlen(neighbor)+1);
-	memcpy(name_part->name,neighbor,strlen(neighbor)+1);
-	name_part->length=strlen(neighbor)+1;
-
-	// 01/31/2013
-	free(neighbor);
-	ccn_charbuf_destroy(&name);
-}
-
-
-
-void 
-get_content_by_content_name(char *content_name, unsigned char **content_data)
-{
-
-	struct ccn_charbuf *name = NULL;
-	struct ccn_charbuf *templ = NULL;
-	struct ccn_charbuf *resultbuf = NULL;
-	struct ccn_parsed_ContentObject pcobuf = { 0 };
-	int res;
-	int allow_stale = 0;
-	int content_only = 1;
-	int scope = -1;
-	const unsigned char *ptr; 
-	size_t length;
-	int resolve_version = CCN_V_HIGHEST;
-	int timeout_ms = 3000;
-	const unsigned lifetime_default = CCN_INTEREST_LIFETIME_SEC << 12;
-	unsigned lifetime_l12 = lifetime_default;
-	int get_flags = 0;
-
-	name = ccn_charbuf_create();
-	res = ccn_name_from_uri(name,content_name);
-	if (res < 0) {
-		fprintf(stderr, "Bad ccn URI: %s\n", content_name);
-		exit(1);
-	}
-
-	if (allow_stale || lifetime_l12 != lifetime_default || scope != -1) {
-		templ = ccn_charbuf_create();
-		ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
-		ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
-		ccn_charbuf_append_closer(templ); /* </Name> */
-		if (allow_stale) {
-			ccn_charbuf_append_tt(templ, CCN_DTAG_AnswerOriginKind, CCN_DTAG);
-			ccnb_append_number(templ,
-					CCN_AOK_DEFAULT | CCN_AOK_STALE);
-			ccn_charbuf_append_closer(templ); /* </AnswerOriginKind> */
-		}
-		if (scope != -1) {
-			ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
-		}
-		if (lifetime_l12 != lifetime_default) {
-			/*
-			 * Choose the interest lifetime so there are at least 3
-			 * expressions (in the unsatisfied case).
-			 */
-			unsigned char buf[3] = { 0 };
-			int i;
-			for (i = sizeof(buf) - 1; i >= 0; i--, lifetime_l12 >>= 8)
-				buf[i] = lifetime_l12 & 0xff;
-			ccnb_append_tagged_blob(templ, CCN_DTAG_InterestLifetime, buf, sizeof(buf));
-		}
-		ccn_charbuf_append_closer(templ); /* </Interest> */
-	}
-	resultbuf = ccn_charbuf_create();
-	if (resolve_version != 0) {
-		res = ccn_resolve_version(nlsr->ccn, name, resolve_version, 500);
-		if (res >= 0) {
-			ccn_uri_append(resultbuf, name->buf, name->length, 1);
-			resultbuf->length = 0;
-		}
-	}
-	res = ccn_get(nlsr->ccn, name, templ, timeout_ms, resultbuf, &pcobuf, NULL, get_flags);
-	if (res >= 0) {
-		ptr = resultbuf->buf;
-		length = resultbuf->length;
-		if (content_only){
-			ccn_content_get_value(ptr, length, &pcobuf, &ptr, &length);
-			*content_data = (unsigned char *) calloc(length, sizeof(char *));
-			memcpy (*content_data, ptr, length);
-		}
-	}
-	ccn_charbuf_destroy(&resultbuf);
-	ccn_charbuf_destroy(&templ);
-	ccn_charbuf_destroy(&name);   
-}
-
-void 
-process_incoming_sync_content_lsa( unsigned char *content_data)
-{
-
-
-	if ( nlsr->debugging )
-		printf("process_incoming_sync_content_lsa called \n");	
-
-	char *sep="|";
-	char *rem;
-	char *orig_router;
-	char *orl;
-	int orig_router_length;
-	char *lst;
-	int ls_type;
-	char *lsid;
-	long int ls_id;
-	char *isvld;
-	int isValid;
-	char *num_link;
-	int no_link;
-	char *np;
-	char *np_length;
-	int name_length;
-	char *data;
-	char *orig_time;
-
-	
-	if ( nlsr->debugging )
-		printf("LSA Data \n");
-
-	if( strlen((char *)content_data ) > 0 )
-	{
-
-		orig_router=strtok_r((char *)content_data,sep,&rem);
-		orl=strtok_r(NULL,sep,&rem);
-		orig_router_length=atoi(orl);
-
-		if ( nlsr->debugging )
-		{
-			printf("	Orig Router Name  : %s\n",orig_router);
-			printf("	Orig Router Length: %d\n",orig_router_length);
-		}
-
-		lst=strtok_r(NULL,sep,&rem);		
-		ls_type=atoi(lst);
-
-		if ( nlsr->debugging )
-			printf("	LS Type  : %d\n",ls_type);
-
-		if ( ls_type == LS_TYPE_NAME )
-		{
-			lsid=strtok_r(NULL,sep,&rem);
-			ls_id=atoi(lsid);
-			orig_time=strtok_r(NULL,sep,&rem);
-			isvld=strtok_r(NULL,sep,&rem);
-			isValid=atoi(isvld);
-			np=strtok_r(NULL,sep,&rem);
-			np_length=strtok_r(NULL,sep,&rem);
-			name_length=atoi(np_length);
-			if ( nlsr->debugging )
-			{
-				printf("	LS ID  : %ld\n",ls_id);
-				printf("	isValid  : %d\n",isValid);
-				printf("	Name Prefix : %s\n",np);
-				printf("	Orig Time   : %s\n",orig_time);
-				printf("	Name Prefix length: %d\n",name_length);
-			}
-
-			build_and_install_others_name_lsa(orig_router,ls_type,ls_id,orig_time,isValid,np);
-
-			print_name_lsdb();
-
-		}
-		else if ( ls_type == LS_TYPE_ADJ )
-		{
-			orig_time=strtok_r(NULL,sep,&rem);
-			num_link=strtok_r(NULL,sep,&rem);
-			no_link=atoi(num_link);
-			data=rem;
-
-			if ( nlsr->debugging )
-			{
-				printf("	Orig Time   : %s\n",orig_time);
-				printf("	No Link  : %d\n",no_link);
-				printf("	Data  : %s\n",data);
-			}
-			build_and_install_others_adj_lsa(orig_router,ls_type,orig_time,no_link,data);
-		}
-		else if ( ls_type == LS_TYPE_COR )
-		{
-			orig_time=strtok_r(NULL,sep,&rem);
-			char *cor_r=strtok_r(NULL,sep,&rem);
-			char *cor_theta=strtok_r(NULL,sep,&rem);
-
-			double r, theta;
-			r=strtof(cor_r,NULL);
-			theta=strtof(cor_theta,NULL);
-
-			if ( nlsr->debugging )
-			{
-				printf("	Orig Time   : %s\n",orig_time);
-				printf("	Cor R	    : %f\n",r);
-				printf("	Cor Theta   : %f\n",theta);
-			}
-			build_and_install_others_cor_lsa(orig_router,ls_type,orig_time, (double)r, (double)theta);	
-		}
-		
-	}
-}
-
-void
-process_content_from_sync(struct ccn_charbuf *content_name, struct ccn_indexbuf *components)
-{
-	int lsa_position;
-	int res;
-	size_t comp_size;
-	const unsigned char *lst;
-	const unsigned char *lsid;
-	const unsigned char *origtime;
-
-	int ls_type;
-	long int ls_id=0;
-
-	unsigned char *content_data = NULL;
-
-	char *time_stamp=(char *)malloc(20);
-	memset(time_stamp,0,20);
-	get_current_timestamp_micro(time_stamp);
-
-	struct ccn_charbuf *uri = ccn_charbuf_create();
-	ccn_uri_append(uri, content_name->buf, content_name->length, 0);	
-
-	struct name_prefix *orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix));
-	
-
-	struct ccn_indexbuf cid={0};
-    	struct ccn_indexbuf *temp_components=&cid;
-	struct ccn_charbuf *name=ccn_charbuf_create();
-	ccn_name_from_uri(name,nlsr->slice_prefix);
-    	ccn_name_split (name, temp_components);
-	lsa_position=temp_components->n-2;
-    	ccn_charbuf_destroy(&name);
-
-
-	//res=ccn_name_comp_get(content_name->buf, components,lsa_position+1,&lst, &comp_size);
-	res=ccn_name_comp_get(content_name->buf, components,components->n-2-1,&lst, &comp_size);	
-	ls_type=atoi((char *)lst);
-	
-	if(ls_type == LS_TYPE_NAME)
-	{
-		
-		res=ccn_name_comp_get(content_name->buf, components,components->n-2-2,&lsid, &comp_size);
-		ls_id=atoi((char *)lsid);
-		res=ccn_name_comp_get(content_name->buf, components,components->n-2,&origtime, &comp_size);
-		ccn_name_chop(content_name,components,-3);
-		get_name_part(orig_router,content_name,components,0);
-	
-		if ( nlsr->debugging )
-			printf("Orig Router: %s Ls Type: %d Ls id: %ld Orig Time: %s\n",orig_router->name,ls_type,ls_id,origtime);
-
-		int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
-
-		if ( (strcmp((char *)orig_router,nlsr->router_name) == 0 && lsa_life_time < nlsr->lsa_refresh_time) || (strcmp((char *)orig_router,nlsr->router_name) != 0 && lsa_life_time < nlsr->router_dead_interval) )
-		{
-			int is_new_name_lsa=check_is_new_name_lsa(orig_router->name,(char *)lst,(char *)lsid,(char *)origtime);
-			if ( is_new_name_lsa == 1 )
-			{
-				if ( nlsr->debugging )
-					printf("New NAME LSA.....\n");	
-				get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
-				if ( nlsr->debugging )
-					printf("Content Data: %s \n",content_data);
-				process_incoming_sync_content_lsa(content_data);
-			}
-			else 
-			{
-				if ( nlsr->debugging )
-					printf("Name LSA / Newer Name LSA already xists in LSDB\n");
-				get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
-				
-				if ( nlsr->debugging )
-					printf("Content Data: %s \n",content_data);
-			}
-		}
-		else 
-		{
-			if ( nlsr->debugging )
-				printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
-		}
-	}
-	else if(ls_type == LS_TYPE_ADJ)
-	{
-		res=ccn_name_comp_get(content_name->buf, components,components->n-2,&origtime, &comp_size);
-		ccn_name_chop(content_name,components,-2);
-		get_name_part(orig_router,content_name,components,0);
-		
-		if ( nlsr->debugging )
-			printf("Orig Router: %s Ls Type: %d Orig Time: %s\n",orig_router->name,ls_type,origtime);		
-
-		int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
-		if ( (strcmp((char *)orig_router,nlsr->router_name) == 0 && lsa_life_time < nlsr->lsa_refresh_time) || (strcmp((char *)orig_router,nlsr->router_name) != 0 && lsa_life_time < nlsr->router_dead_interval) )	
-		{
-			int is_new_adj_lsa=check_is_new_adj_lsa(orig_router->name,(char *)lst,(char *)origtime);
-			if ( is_new_adj_lsa == 1 )
-			{
-				if ( nlsr->debugging )
-					printf("New Adj LSA.....\n");	
-				get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
-				
-				if ( nlsr->debugging )
-					printf("Content Data: %s \n",content_data);
-				process_incoming_sync_content_lsa(content_data);			
-			}
-			else
-			{
-				if ( nlsr->debugging )
-					printf("Adj LSA / Newer Adj LSA already exists in LSDB\n");
-				get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
-				if ( nlsr->debugging )
-					printf("Content Data: %s \n",content_data);
-			}
-		}
-		else 
-		{
-			if ( nlsr->debugging )
-				printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
-		}
-	}
-	else if(ls_type == LS_TYPE_COR)
-	{
-		res=ccn_name_comp_get(content_name->buf, components,components->n-2,&origtime, &comp_size);
-		ccn_name_chop(content_name,components,-2);
-		get_name_part(orig_router,content_name,components,0);
-		
-		if ( nlsr->debugging )
-			printf("Orig Router: %s Ls Type: %d Orig Time: %s\n",orig_router->name,ls_type,origtime);
-
-		int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
-		if ( (strcmp((char *)orig_router,nlsr->router_name) == 0 && lsa_life_time < nlsr->lsa_refresh_time) || (strcmp((char *)orig_router,nlsr->router_name) != 0 && lsa_life_time < nlsr->router_dead_interval) )	
-		{
-			int is_new_cor_lsa=check_is_new_cor_lsa(orig_router->name,(char *)lst,(char *)origtime);
-			if ( is_new_cor_lsa == 1 )
-			{
-				if ( nlsr->debugging )
-					printf("New Cor LSA.....\n");	
-				get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
-				
-				if ( nlsr->debugging )
-					printf("Content Data: %s \n",content_data);
-				process_incoming_sync_content_lsa(content_data);			
-			}
-			else
-			{
-				if ( nlsr->debugging )
-					printf("Cor LSA / Newer Cor LSA already exists in LSDB\n");
-				get_content_by_content_name(ccn_charbuf_as_string(uri), &content_data);
-				if ( nlsr->debugging )
-					printf("Content Data: %s \n",content_data);
-			}
-		}
-		else 
-		{
-			if ( nlsr->debugging )
-				printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
-		}
-
-	}
-
-	if (content_data != NULL)
-		free(content_data);
-	ccn_charbuf_destroy(&uri);
-	//01/31/2013	
-	free(time_stamp);
-}
-
-void
-sync_monitor(char *topo_prefix, char *slice_prefix)
-{
-
-    static struct ccns_name_closure nc={0};	
-
-    nlsr->closure = &nc;
-    struct ccn_charbuf *prefix = ccn_charbuf_create();
-    struct ccn_charbuf *roothash = NULL;
-    struct ccn_charbuf *topo = ccn_charbuf_create(); 
-    nlsr->slice = ccns_slice_create();
-    ccn_charbuf_reset(prefix);
-    ccn_charbuf_reset(topo);
- 
-    ccn_charbuf_reset(prefix);
-    ccn_name_from_uri(prefix, slice_prefix);
-            
-    ccn_charbuf_reset(topo);
-    ccn_name_from_uri(topo, topo_prefix);
-    
-
-    ccns_slice_set_topo_prefix(nlsr->slice, topo, prefix);
-    nlsr->closure->callback = &sync_cb;
-    nlsr->ccns = ccns_open(nlsr->ccn, nlsr->slice, nlsr->closure, roothash, NULL);
-
-    //01/31/2013
-    ccn_charbuf_destroy(&prefix);
-    ccn_charbuf_destroy(&topo);
-}
-
-struct ccn_charbuf *
-make_template(int scope)
-{
-    struct ccn_charbuf *templ = NULL;
-    templ = ccn_charbuf_create();
-    ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
-    ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
-    ccn_charbuf_append_closer(templ); /* </Name> */
-    if (0 <= scope && scope <= 2)
-        ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
-    ccn_charbuf_append_closer(templ); /* </Interest> */
-    return(templ);
-}
-
-int
-write_data_to_repo(char *data, char *name_prefix)
-{
-	if ( nlsr->debugging )
-	{
-		printf("write_data_to_repo called\n");
-		printf("Content Name: %s \n",name_prefix);
-		printf("Content Data: %s \n",data);
-	}
-
-	struct ccn *temp_ccn;
-	temp_ccn=ccn_create();
-	int ccn_fd=ccn_connect(temp_ccn, NULL);
-	if(ccn_fd == -1)
-	{
-		fprintf(stderr,"Could not connect to ccnd for Data Writing\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Could not connect to ccnd for Data Writing\n");
-		return -1;
-	}
-    struct ccn_charbuf *name = NULL;
-    struct ccn_seqwriter *w = NULL;
-    int blocksize = 4096;
-    int freshness = -1;
-    int torepo = 1;
-    int scope = 1;
-    int res;
-    size_t blockread;
-    struct ccn_charbuf *templ;
-    
-    name = ccn_charbuf_create();
-    res = ccn_name_from_uri(name, name_prefix);
-    if (res < 0) {
-        fprintf(stderr, "bad CCN URI: %s\n",name_prefix);
-	return -1;
-    }
-  
-    
-    w = ccn_seqw_create(temp_ccn, name);
-    if (w == NULL) {
-        fprintf(stderr, "ccn_seqw_create failed\n");
-	return -1;
-    }
-    ccn_seqw_set_block_limits(w, blocksize, blocksize);
-    if (freshness > -1)
-        ccn_seqw_set_freshness(w, freshness);
-    if (torepo) {
-        struct ccn_charbuf *name_v = ccn_charbuf_create();
-        ccn_seqw_get_name(w, name_v);
-        ccn_name_from_uri(name_v, "%C1.R.sw");
-        ccn_name_append_nonce(name_v);
-        templ = make_template(scope);
-        res = ccn_get(temp_ccn, name_v, templ, 60000, NULL, NULL, NULL, 0);
-        ccn_charbuf_destroy(&templ);
-        ccn_charbuf_destroy(&name_v);
-        if (res < 0) {
-            fprintf(stderr, "No response from repository\n");
-	    return -1;
-        }
-    }
-
-
-
-
-	blockread = 0;
-
-
-	blockread=strlen(data);
-
-	if (blockread > 0) {
-		ccn_run(temp_ccn, 100);
-		res = ccn_seqw_write(w, data, blockread);	
-        	while (res == -1) {
-            		ccn_run(temp_ccn, 100);
-	       		res = ccn_seqw_write(w, data, blockread);
-           	}
-    	}
-
-    ccn_seqw_close(w);
-    ccn_run(temp_ccn, 100);
-    ccn_charbuf_destroy(&name);
-    ccn_destroy(&temp_ccn);
-
-	return 0;
-}
-
-
-int
-create_sync_slice(char *topo_prefix, char *slice_prefix)
-{
-    int res;
-    struct ccns_slice *slice;
-    struct ccn_charbuf *prefix = ccn_charbuf_create();
-    struct ccn_charbuf *topo = ccn_charbuf_create();
-    struct ccn_charbuf *clause = ccn_charbuf_create();
-    struct ccn_charbuf *slice_name = ccn_charbuf_create();
-    struct ccn_charbuf *slice_uri = ccn_charbuf_create();
-    
-    if (prefix == NULL || topo == NULL || clause == NULL ||
-        slice_name == NULL || slice_uri == NULL) {
-        fprintf(stderr, "Unable to allocate required memory.\n");
-	return -1;
-    }
-    
-    
-    slice = ccns_slice_create();
-    
-    ccn_charbuf_reset(topo);
-    ccn_name_from_uri(topo, topo_prefix);
-    ccn_charbuf_reset(prefix);
-    ccn_name_from_uri(prefix,slice_prefix );
-    ccns_slice_set_topo_prefix(slice, topo, prefix);
- 
-  
-    res = ccns_write_slice(nlsr->ccn, slice, slice_name);
- 
-    //01/31/2013
-    ccns_slice_destroy(&slice);
-    ccn_charbuf_destroy(&prefix);
-    ccn_charbuf_destroy(&topo);
-    ccn_charbuf_destroy(&clause);
-    ccn_charbuf_destroy(&slice_name);
-    ccn_charbuf_destroy(&slice_uri);
-
-    return 0;
-}
-
diff --git a/nlsr-sync-0.0/nlsr_sync.h b/nlsr-sync-0.0/nlsr_sync.h
deleted file mode 100644
index 68fc767..0000000
--- a/nlsr-sync-0.0/nlsr_sync.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _NLSR_SYNC_H_
-#define _NLSR_SYNC_H_
-
-void sync_monitor(char *topo_prefix, char *slice_prefix);
-int write_data_to_repo(char *data,char *name_prefix);
-int create_sync_slice(char *topo_prefix, char *slice_prefix);
-void get_host_name_from_command_string(struct name_prefix *name_part,char *nbr_name_uri, int offset);
-void process_content_from_sync(struct ccn_charbuf *content_name, struct ccn_indexbuf *components);
-
-#endif
diff --git a/nlsr-sync-0.0/nlsrc.c b/nlsr-sync-0.0/nlsrc.c
deleted file mode 100755
index 91a1523..0000000
--- a/nlsr-sync-0.0/nlsrc.c
+++ /dev/null
@@ -1,109 +0,0 @@
-//1. Make the necessary includes and set up the variables:
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <sys/un.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-#include <getopt.h>
-
-struct option longopts[] =
-{
-    { "server_ip",    required_argument, NULL, 's'},
-    { "server_port",    required_argument, NULL, 'p'},
-    { 0 }
-};
-
-static int 
-usage(char *progname)
-{
-	printf("Usage: %s [OPTIONS...]\n\
-        NLSR API client....\n\
-        nlsrc -s server_ip -p server_port add|del name|neighbor name_prefix [faceX] \n\
-        option -- description\n\n\
-        add|del -- specify whether you want to add or delete.\n\
-        name|neighbor -- specify whether you are adding a name or a neighbor.\n\
-        name_prefix -- name of the prefix for the name|neighbor.\n\
-        faceX -- face ID for neighbor if the third argument is neighbor.\n\n\
-        Examples:\n\
-        1) nlsrc -s 127.0.0.1 -p 9696 add name /ndn/memphis.edu/test \n", progname);
-
-    	exit(1);
-}
-
-int main(int argc, char *argv[])
-{
-	int sockfd;
-	int len;
-	struct sockaddr_in address;
-	int result;
-	int bytesSent;
-	char *server_address, *server_port;	
-
-	int command_len=0;
-	int i;
-
-	if (argc < 8)
-                usage(argv[0]);
-
-        if (strcmp(argv[6], "neighbor") == 0 && argc < 9)
-                usage(argv[0]);
-
-        if (strcmp(argv[6], "name") != 0 && strcmp(argv[6], "neighbor") != 0)
-                usage(argv[0]);
-
-	while ((result = getopt_long(argc, argv, "s:p:", longopts, 0)) != -1) 
-	{
-        	switch (result) 
-		{
-			case 's':
-				server_address = optarg;
-				break;
-			case 'p':
-				server_port = optarg;
-				break;
-		}
-    	}	
-
-
-	char recv_buffer[1024];
-	bzero(recv_buffer,1024);
-
-	for(i=5;i<argc;i++)
-		command_len+=(strlen(argv[i])+1);
-	char *command=malloc(command_len);
-	memset(command, 0, command_len);
-	for(i=5;i<argc;i++)
-	{
-		memcpy(command+strlen(command),argv[i],strlen(argv[i]));
-		if ( i < argc-1 )
-			memcpy(command+strlen(command)," ",1);	
-	}
-
-	sockfd = socket(AF_INET, SOCK_STREAM, 0);
-	//address.sun_family = AF_UNIX;
-	//strcpy(address.sun_path, "/tmp/nlsr_api_server_socket");
-	address.sin_family = AF_INET;
-	address.sin_addr.s_addr = inet_addr(server_address);
-	address.sin_port = htons(atoi(server_port));
-
-	len = sizeof(address);
-	result = connect(sockfd, (struct sockaddr *)&address, len);
-	if(result == -1) 
-	{
-		perror("oops nlsrc ");
-		exit(1);
-	}
-	printf("Command to send: %s \n",command);
-	bytesSent=send(sockfd, command, strlen(command),0);
-	printf("Command len: %d, Bytes sent: %d \n",(int)strlen(command), bytesSent);
-	recv(sockfd, recv_buffer, 1024, 0);
-	printf("%s\n",recv_buffer);
-	free(command);
-	close(sockfd);
-	exit(0);
-}
diff --git a/nlsr-sync-0.0/pollux.conf b/nlsr-sync-0.0/pollux.conf
deleted file mode 100755
index faaa597..0000000
--- a/nlsr-sync-0.0/pollux.conf
+++ /dev/null
@@ -1,18 +0,0 @@
-#----configuration file for macbook----------
-#
-router-name /ndn/memphis.edu/cs/pollux
-ccnneighbor /ndn/memphis.edu/cs/sirius
-ccnname /ndn/memphis.edu/cs/pollux/name1
-#------lsdb-synch-interval-----
-lsdb-synch-interval 350
-interest-retry 2 
-interest-resend-time 5
-lsa-refresh-time 600
-router-dead-interval 900
-multi-path-face-num 2 
-#debug on
-
-topo-prefix /ndn/memphis.edu/nlsr/
-slice-prefix /ndn/memphis.edu/nlsr/LSA/
-
-logdir mylog/ 
diff --git a/nlsr-sync-0.0/simulation.h b/nlsr-sync-0.0/simulation.h
deleted file mode 100755
index 76c4861..0000000
--- a/nlsr-sync-0.0/simulation.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _SIMULATION_H_
-#define _SIMULATION_H_
-
-
-
-
-
-#endif
diff --git a/nlsr-sync-0.0/todo.txt b/nlsr-sync-0.0/todo.txt
deleted file mode 100755
index 77fccea..0000000
--- a/nlsr-sync-0.0/todo.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-To Do:
-
-1. Add commenting facility in .conf file -- done, commenting character # or !
-2. Adding configuration command of lsa-refresh-time and router-dead-interval  --- done
-3. Adding trailing "/" remover from the commands if has any -- done 
-4. Multi Path Route Calculation
-5. Writing Log so that need minimal change to status page script
-6. Adding a fib entry for origination router itself 
-6. Providing api to add/delete link/name prefix
diff --git a/nlsr-sync-0.0/transfer.sh b/nlsr-sync-0.0/transfer.sh
deleted file mode 100755
index e616d20..0000000
--- a/nlsr-sync-0.0/transfer.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-scp * mhoque@pollux.cs.memphis.edu:/home/mhoque/NLSR2.0/
-
-scp * mhoque@mira.cs.memphis.edu:/home/mhoque/NLSR2.0/
-
-scp * mhoque@castor.cs.memphis.edu:/home/mhoque/NLSR2.0/
diff --git a/nlsr-sync-0.0/utility.c b/nlsr-sync-0.0/utility.c
deleted file mode 100755
index cf7452a..0000000
--- a/nlsr-sync-0.0/utility.c
+++ /dev/null
@@ -1,276 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include<ctype.h>
-#include<stdarg.h>
-#include <sys/types.h>
-#include <pwd.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include<sys/socket.h>
-#include<arpa/inet.h>
-#include<errno.h>
-#include<netdb.h>
-#include <time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-
-#include "utility.h"
-
-
-char * getLocalTimeStamp(void)
-{
-	char *timestamp = (char *)malloc(sizeof(char) * 16);
-	time_t ltime;
-	ltime=time(NULL);
-	struct tm *tm;
-	tm=localtime(&ltime);
-  
-	sprintf(timestamp, "%04d%02d%02d%02d%02d%02d", tm->tm_year+1900, tm->tm_mon+1, 
-		tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
-
-	return timestamp;
-}
-
-char * getGmTimeStamp(void)
-{
-	char *timestamp = (char *)malloc(sizeof(char) * 16);
-	time_t gtime;
-	gtime=time(NULL);
-	struct tm *tm;
-	tm=gmtime(&gtime);
-  
-	sprintf(timestamp, "%04d%02d%02d%02d%02d%02d", tm->tm_year+1900, tm->tm_mon+1, 
-		tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
-
-	return timestamp;
-}
-
-
-
-
-long int 
-get_current_time_sec(void)
-{
-	struct timeval now;
-	gettimeofday(&now,NULL);
-	return now.tv_sec;
-}
-
-
-void
-get_current_timestamp_micro(char * microSec)
-{
-	struct timeval now; 
-	gettimeofday(&now, NULL);
-	sprintf(microSec,"%ld%06ld",now.tv_sec,(long int)now.tv_usec);
-}
-
-
-long int
-get_time_diff(const char *time1, const char *time2)
-{
-	long int diff_secs;
-
-	long int time1_in_sec,	time2_in_sec;
-
-	char *time1_sec=(char *)malloc(strlen(time1)-6+1);
-	memset(time1_sec,0,strlen(time1)-6+1);
-	memcpy(time1_sec,time1,strlen(time1)-6);
-
-	char *time2_sec=(char *)malloc(strlen(time2)-6+1);
-	memset(time2_sec,0,strlen(time2)-6+1);
-	memcpy(time2_sec,time2,strlen(time2)-6);
-
-	time1_in_sec=strtol(time1_sec,NULL,10);
-	time2_in_sec=strtol(time2_sec,NULL,10);
-
-	diff_secs=time1_in_sec-time2_in_sec;
-
-	free(time1_sec);
-	free(time2_sec);
-
-	return diff_secs;
-}
-
-
-void  
-startLogging(char *loggingDir)
-{
-	struct passwd pd;
-	struct passwd* pwdptr=&pd;
-	struct passwd* tempPwdPtr;
-	char *pwdbuffer;
-	int  pwdlinelen = 200;
-	char *logDir;
-	char *logFileName;
-	char *ret;
-	char *logExt;
-	char *defaultLogDir;	
-	int status;
-	struct stat st;
-	int isLogDirExists=0;
-	char *time=getLocalTimeStamp();
-
-	pwdbuffer=(char *)malloc(sizeof(char)*200);
-	memset(pwdbuffer,0,200);		
-	logDir=(char *)malloc(sizeof(char)*200);
-	memset(logDir,0,200);
-	logFileName=(char *)malloc(sizeof(char)*200);
-	memset(logFileName,0,200);
-	logExt=(char *)malloc(sizeof(char)*5);
-	memset(logExt,0,5);
-	defaultLogDir=(char *)malloc(sizeof(char)*10);
-	memset(defaultLogDir,0,10);
-
-	memcpy(logExt,".log",4);
-	logExt[4]='\0';
-	memcpy(defaultLogDir,"/nlsrLog",9);
-	defaultLogDir[9]='\0';
-
-	if(loggingDir!=NULL)
- 	{
-		if( stat( loggingDir, &st)==0)
-		{
-			if ( st.st_mode & S_IFDIR )
-			{
-				if( st.st_mode & S_IWUSR)
-				{
-					isLogDirExists=1;
-					memcpy(logDir,loggingDir,strlen(loggingDir)+1);
-				}
-				else printf("User do not have write permission to %s \n",loggingDir);
-			}
-			else printf("Provided path for %s is not a directory!!\n",loggingDir);
-    		}
-  		else printf("Log directory: %s does not exists\n",loggingDir);
-	} 
-  
-	if(isLogDirExists == 0)
-  	{
-		if ((getpwuid_r(getuid(),pwdptr,pwdbuffer,pwdlinelen,&tempPwdPtr))!=0)
-     			perror("getpwuid_r() error.");
-  		else
-  		{
-			memcpy(logDir,pd.pw_dir,strlen(pd.pw_dir)+1);	
-			memcpy(logDir+strlen(logDir),defaultLogDir,strlen(defaultLogDir)+1);	
-			if(stat(logDir,&st) != 0)
-				status = mkdir(logDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);	
-		}
-	}	
- 	memcpy(logFileName,logDir,strlen(logDir)+1);	
-	if( logDir[strlen(logDir)-1]!='/')
-	{
-		memcpy(logFileName+strlen(logFileName),"/",1);
-		memcpy(logFileName+strlen(logFileName),"\0",1);	
-	}	
-	memcpy(logFileName+strlen(logFileName),time,strlen(time)+1);	
-	memcpy(logFileName+strlen(logFileName),logExt,strlen(logExt)+1);	
-	ret=(char *)malloc(strlen(logFileName)+1);
-	memset(ret,0,strlen(logFileName)+1);
-       	memcpy(ret,logFileName,strlen(logFileName)+1); 
-
-	setenv("NLSR_LOG_FILE",ret,1);
-
-	free(time);	
-	free(logDir);
-	free(logFileName);	
-	free(pwdbuffer);	
-	free(logExt);
-	free(defaultLogDir);
-	free(ret);	
-}
-
-
-void 
-writeLogg(const char *source_file, const char *function, const int line, const char *format, ...)
-{
-	char *file=getenv("NLSR_LOG_FILE");	
-	if (file != NULL)
-	{
-		FILE *fp = fopen(file, "a");
-
-		if (fp != NULL)
-		{            
-			struct timeval t;
-			gettimeofday(&t, NULL);
-			fprintf(fp,"%ld.%06u - %s, %s, %d :",(long)t.tv_sec , (unsigned)t.tv_usec , source_file , function , line);        
-			va_list args;
-			va_start(args, format);
-			vfprintf(fp, format, args);
-			fclose(fp);
-			va_end(args);	
-		}
-    	}
-}
-
-
-struct sockaddr_in *
-get_ip_from_hostname(char *hostname )
-{
- 
-
-    struct addrinfo hints, *servinfo, *p;
-    int res; 
-    struct sockaddr_in * ip;
-    memset(&hints, 0, sizeof hints);
-    hints.ai_family = AF_UNSPEC;
-    hints.ai_socktype = SOCK_STREAM;
-
-    if ( (res = getaddrinfo( hostname , "9696", &hints , &servinfo)) != 0)
-    {
-        fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(res));
-        return NULL;
-    }
-    int i=0;
-    for(p = servinfo; p != NULL; p = p->ai_next)
-    {
-        ip = (struct sockaddr_in *) p->ai_addr;
-	i++;
-   
-    }
-    freeaddrinfo(servinfo);
-    return ip;
-
-
-}
-
-
-
-int 
-get_ip_from_hostname_02(char * hostname , char* ip)
-{
-    struct hostent *he;
-    struct in_addr **addr_list;
-    int i;
-    if ( (he = gethostbyname( hostname ) ) == NULL)
-    {
-        herror("gethostbyname");
-        return 1;
-    }
-    addr_list = (struct in_addr **) he->h_addr_list;
-    for(i = 0; addr_list[i] != NULL; i++)
-    {
-        strcpy(ip , inet_ntoa(*addr_list[i]) );
-        return 0;
-    }
-    return 1;
-}
-
-
-
diff --git a/nlsr-sync-0.0/utility.h b/nlsr-sync-0.0/utility.h
deleted file mode 100755
index f90c281..0000000
--- a/nlsr-sync-0.0/utility.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _UTILITY_H_
-#define _UTILITY_H_
-
-char * getLocalTimeStamp(void);
-char * getGmTimeStamp(void);
-long int get_current_time_sec(void);
-void get_current_timestamp_micro(char * microSec);
-long int get_time_diff(const char *time1, const char *time2);
-
-void startLogging(char *loggingDir);
-void writeLogg(const char *source_file, const char *function, const int line, const char *format, ...);
-struct sockaddr_in * get_ip_from_hostname(char *hostname);
-int get_ip_from_hostname_02(char * hostname , char* ip);
-#endif
diff --git a/nlsr.c b/nlsr.c
index f71e4ae..df637b7 100644
--- a/nlsr.c
+++ b/nlsr.c
@@ -26,6 +26,8 @@
 #include <ccn/signing.h>
 #include <ccn/schedule.h>
 #include <ccn/hashtb.h>
+#include <ccn/sync.h>
+#include <ccn/seqwriter.h>
 
 #include "nlsr.h"
 #include "nlsr_ndn.h"
@@ -35,6 +37,9 @@
 #include "nlsr_adl.h"
 #include "nlsr_npt.h"
 #include "nlsr_route.h"
+#include "nlsr_sync.h"
+#include "nlsr_face.h"
+#include "nlsr_fib.h"
 
 
 #define ON_ERROR_DESTROY(resval) \
@@ -153,7 +158,12 @@
 	}
 	char *rem;
 	const char *sep=" \t\n";
-	char *rtr_name,*face;
+	char *rtr_name;
+	char *nbr_ip_addr;
+	int is_ip_configured=0;
+	//char *face;
+	char *ip_addr=(char *)malloc(13);
+	memset(ip_addr,0,13);
 
 	rtr_name=strtok_r(command,sep,&rem);
 	if(rtr_name==NULL)
@@ -161,35 +171,41 @@
 		printf(" Wrong Command Format ( ccnneighbor router_name faceX)\n");
 		return;
 	}
-
-	face=strtok_r(NULL,sep,&rem);
-	if(face==NULL)
-	{
-		printf(" Wrong Command Format ( ccnneighbor router_name faceX)\n");
-		return;
-	}
-
-	printf("Router: %s face: %s\n",rtr_name,face);
-	int face_id;
-	int res;
-	res=sscanf(face,"face%d",&face_id);
-
-	if(res != 1 )
-	{
-		printf(" Wrong Command Format ( ccnneighbor router_name faceX) where X is integer\n");
-		return;
-	}
 	if ( rtr_name[strlen(rtr_name)-1] == '/' )
 	{
 		rtr_name[strlen(rtr_name)-1]='\0';
 	}
+
+	if (rem != NULL )
+	{
+		nbr_ip_addr=strtok_r(NULL,sep,&rem);
+		is_ip_configured=1;
+	}
 	struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
 	nbr->name=(char *)malloc(strlen(rtr_name)+1);
 	memset(nbr->name,0,strlen(rtr_name)+1);
 	memcpy(nbr->name,rtr_name,strlen(rtr_name)+1);
 	nbr->length=strlen(rtr_name)+1;
 
-	add_nbr_to_adl(nbr,face_id);
+	
+	if ( !is_ip_configured )
+	{
+		struct name_prefix *nbr_name=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
+		get_host_name_from_command_string(nbr_name,nbr->name,0);
+		printf("Hostname of neighbor: %s ",nbr_name->name);
+		get_ip_from_hostname_02(nbr_name->name,ip_addr);
+		printf("IP Address: %s \n",ip_addr);
+		free(nbr_name->name);
+		free(nbr_name);
+	}
+	else
+	{
+		memcpy(ip_addr,nbr_ip_addr,strlen(nbr_ip_addr));
+		printf("Name of neighbor: %s ",nbr->name);
+		printf("IP Address: %s \n",ip_addr);
+	}
+	add_nbr_to_adl(nbr,0,ip_addr);
+	
 
 	free(nbr->name);
 	free(nbr);
@@ -262,6 +278,7 @@
 
 }
 
+/*
 void 
 process_command_lsdb_synch_interval(char *command)
 {
@@ -289,7 +306,7 @@
 	}
 
 }
-
+*/
 
 void 
 process_command_interest_retry(char *command)
@@ -368,9 +385,13 @@
 	}
 
 	seconds=atoi(secs);
-	if ( seconds >= 240 && seconds <= 3600 )
+	if ( seconds >= 240)
 	{
 		nlsr->lsa_refresh_time=seconds;
+		if ( nlsr->router_dead_interval < nlsr->lsa_refresh_time * 2 )
+		{
+			nlsr->router_dead_interval=2*nlsr->lsa_refresh_time;
+		}
 	}
 
 }
@@ -396,19 +417,23 @@
 	}
 
 	seconds=atoi(secs);
-	if ( seconds >= 360 && seconds <= 5400 )
+	if ( seconds >= 480 )
 	{
 		nlsr->router_dead_interval=seconds;
+		if ( nlsr->router_dead_interval < nlsr->lsa_refresh_time * 2 )
+		{
+			nlsr->router_dead_interval=2*nlsr->lsa_refresh_time;
+		}
 	}
 
 }
 
 void 
-process_command_multi_path_face_num(char *command)
+process_command_max_faces_per_prefix(char *command)
 {
 	if(command==NULL)
 	{
-		printf(" Wrong Command Format ( multi-path-face-num n )\n");
+		printf(" Wrong Command Format ( max-faces-per-prefix n )\n");
 		return;
 	}
 	char *rem;
@@ -419,14 +444,14 @@
 	num=strtok_r(command,sep,&rem);
 	if(num==NULL)
 	{
-		printf(" Wrong Command Format ( multi-path-face-num n)\n");
+		printf(" Wrong Command Format ( max-faces-per-prefix n)\n");
 		return;
 	}
 
 	number=atoi(num);
 	if ( number >= 0 && number <= 60 )
 	{
-		nlsr->multi_path_face_num=number;
+		nlsr->max_faces_per_prefix=number;
 	}
 
 }
@@ -505,6 +530,159 @@
 	}
 }
 
+
+void 
+process_command_topo_prefix(char *command)
+{
+	if(command==NULL)
+	{
+		printf(" Wrong Command Format ( topo-prefix )\n");
+		return;
+	}
+	char *rem;
+	const char *sep=" \t\n";
+	char *topo_prefix;
+
+	topo_prefix=strtok_r(command,sep,&rem);
+	if(topo_prefix==NULL)
+	{
+		printf(" Wrong Command Format (  topo-prefix /name/prefix  )\n");
+		return;
+	}
+	else
+	{
+		if( nlsr->topo_prefix != NULL)	
+			free(nlsr->topo_prefix);
+		if ( topo_prefix[strlen(topo_prefix)-1] == '/' )
+			topo_prefix[strlen(topo_prefix)-1]='\0';
+
+		nlsr->topo_prefix=(char *)malloc(strlen(topo_prefix)+1);
+		memset(nlsr->topo_prefix,0,strlen(topo_prefix)+1);
+		puts(topo_prefix);
+		memcpy(nlsr->topo_prefix,topo_prefix,strlen(topo_prefix));
+
+	}
+}
+
+
+void 
+process_command_slice_prefix(char *command)
+{
+	if(command==NULL)
+	{
+		printf(" Wrong Command Format ( slice-prefix /name/prefix )\n");
+		return;
+	}
+	char *rem;
+	const char *sep=" \t\n";
+	char *slice_prefix;
+
+	slice_prefix=strtok_r(command,sep,&rem);
+	if(slice_prefix==NULL)
+	{
+		printf(" Wrong Command Format (  slice-prefix /name/prefix  )\n");
+		return;
+	}
+	else
+	{
+		if ( nlsr->slice_prefix != NULL)
+			free(nlsr->slice_prefix);
+		if ( slice_prefix[strlen(slice_prefix)-1] == '/' )
+			slice_prefix[strlen(slice_prefix)-1]='\0';
+
+		nlsr->slice_prefix=(char *)malloc(strlen(slice_prefix)+1);
+		memset(nlsr->slice_prefix,0,strlen(slice_prefix)+1);
+		memcpy(nlsr->slice_prefix,slice_prefix,strlen(slice_prefix));
+	}
+}
+
+void 
+process_command_hyperbolic_routing(char *command)
+{
+	if(command==NULL)
+	{
+		printf(" Wrong Command Format ( hyperbolic-routing on)\n");
+		return;
+	}
+	char *rem;
+	const char *sep=" \t\n";
+	char *on_off;
+
+	on_off=strtok_r(command,sep,&rem);
+	if(on_off==NULL)
+	{
+		printf(" Wrong Command Format ( hyperbolic-routing on )\n");
+		return;
+	}
+	
+	if ( strcmp(on_off,"ON") == 0 || strcmp(on_off,"on") == 0 )
+	{
+		nlsr->is_hyperbolic_calc=1;
+	}
+}
+
+void
+process_command_hyperbolic_cordinate(char *command)
+{
+	if(command==NULL)
+	{
+		printf(" Wrong Command Format ( hyperbolic r 0 )\n");
+		return;
+	}
+
+	char *rem;
+	const char *sep=" \t\n\r";
+	char *radious;
+	char *theta;
+
+	radious=strtok_r(command,sep,&rem);
+	if (radious == NULL )
+	{
+		printf(" Wrong Command Format ( hyperbolic r 0 )\n");
+		return;
+	}
+
+	theta=strtok_r(NULL,sep,&rem);
+	if (theta == NULL )
+	{
+		printf(" Wrong Command Format ( hyperbolic r 0 )\n");
+		return;
+	}
+
+	nlsr->cor_r=strtof(radious,NULL);
+	nlsr->cor_theta=strtof(theta,NULL);
+
+}
+
+void 
+process_command_tunnel_type(char *command)
+{
+	if(command==NULL)
+	{
+		printf(" Wrong Command Format ( tunnel-type udp/tcp)\n");
+		return;
+	}
+	char *rem;
+	const char *sep=" \t\n";
+	char *on_off;
+
+	on_off=strtok_r(command,sep,&rem);
+	if(on_off==NULL)
+	{
+		printf(" Wrong Command Format ( tunnel-type udp/tcp )\n");
+		return;
+	}
+	
+	if ( strcmp(on_off,"TCP") == 0 || strcmp(on_off,"tcp") == 0 )
+	{
+		nlsr->tunnel_type=IPPROTO_TCP;
+	}
+	else if ( strcmp(on_off,"UDP") == 0 || strcmp(on_off,"udp") == 0 )
+	{
+		nlsr->tunnel_type=IPPROTO_UDP;
+	}
+}
+
 void 
 process_conf_command(char *command)
 {
@@ -529,10 +707,10 @@
 	{
 		process_command_ccnname(remainder);
 	}
-	else if(!strcmp(cmd_type,"lsdb-synch-interval") )
+	/*else if(!strcmp(cmd_type,"lsdb-synch-interval") )
 	{
 		process_command_lsdb_synch_interval(remainder);
-	}
+	}*/
 	else if(!strcmp(cmd_type,"interest-retry") )
 	{
 		process_command_interest_retry(remainder);
@@ -549,9 +727,9 @@
 	{
 		process_command_router_dead_interval(remainder);
 	}
-	else if(!strcmp(cmd_type,"multi-path-face-num") )
+	else if(!strcmp(cmd_type,"max-faces-per-prefix") )
 	{
-		process_command_multi_path_face_num(remainder);
+		process_command_max_faces_per_prefix(remainder);
 	}
 	else if(!strcmp(cmd_type,"logdir") )
 	{
@@ -565,6 +743,26 @@
 	{
 			process_command_debug(remainder);
 	}
+	else if(!strcmp(cmd_type,"topo-prefix") )
+	{
+			process_command_topo_prefix(remainder);
+	}
+	else if(!strcmp(cmd_type,"slice-prefix") )
+	{
+			process_command_slice_prefix(remainder);
+	}
+	else if(!strcmp(cmd_type,"hyperbolic-cordinate") )
+	{
+		process_command_hyperbolic_cordinate(remainder);
+	}
+	else if(!strcmp(cmd_type,"hyperbolic-routing") )
+	{
+		process_command_hyperbolic_routing(remainder);
+	}
+	else if(!strcmp(cmd_type,"tunnel-type") )
+	{
+		process_command_tunnel_type(remainder);
+	}
 	else 
 	{
 		printf("Wrong configuration Command %s \n",cmd_type);
@@ -601,14 +799,68 @@
 	return 0;
 }
 
+
+void
+add_faces_for_nbrs(void)
+{	
+	int i, adl_element;
+	struct ndn_neighbor *nbr;
+
+	struct hashtb_enumerator ee;
+    	struct hashtb_enumerator *e = &ee;
+    	
+    	hashtb_start(nlsr->adl, e);
+	adl_element=hashtb_n(nlsr->adl);
+
+	for(i=0;i<adl_element;i++)
+	{
+		nbr=e->data;
+		int face_id=add_ccn_face(nlsr->ccn, (const char *)nbr->neighbor->name, (const char *)nbr->ip_address, 9695,nlsr->tunnel_type);
+		update_face_to_adl_for_nbr(nbr->neighbor->name, face_id);		
+		add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->topo_prefix, OP_REG, face_id);
+		add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->slice_prefix, OP_REG, face_id);
+		hashtb_next(e);		
+	}
+
+	hashtb_end(e);
+
+}
+
+void
+destroy_faces_for_nbrs(void)
+{	
+	int i, adl_element;
+	struct ndn_neighbor *nbr;
+
+	struct hashtb_enumerator ee;
+    	struct hashtb_enumerator *e = &ee;
+    	
+    	hashtb_start(nlsr->adl, e);
+	adl_element=hashtb_n(nlsr->adl);
+
+	for(i=0;i<adl_element;i++)
+	{
+		nbr=e->data;
+		if ( nbr->face > 0 )
+		{	
+			add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->topo_prefix, OP_UNREG, nbr->face);
+			add_delete_ccn_face_by_face_id(nlsr->ccn,(const char *)nbr->neighbor->name,OP_UNREG,nbr->face);
+			add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->slice_prefix, OP_UNREG, nbr->face);
+		}
+		hashtb_next(e);		
+	}
+
+	hashtb_end(e);
+
+}
+
 char *
 process_api_client_command(char *command)
 {
 	char *msg;
 	msg=(char *)malloc(100);	
-	memset(msg,100,0);
-	//strcpy(msg,"Action Carried Out for NLSR Api Client");
-
+	memset(msg,0,100);
+	
 	const char *sep=" \t\n";
 	char *rem=NULL;
 	char *cmd_type=NULL;
@@ -686,6 +938,10 @@
 			else
 			{
 				update_adjacent_status_to_adl(np,NBR_DOWN);
+				int face_id=get_next_hop_face_from_adl(np->name);
+				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)np->name, OP_UNREG, face_id);
+				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->topo_prefix, OP_UNREG, face_id);
+				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->slice_prefix, OP_UNREG, face_id);
 				delete_nbr_from_adl(np);
 				if(!nlsr->is_build_adj_lsa_sheduled)
 				{
@@ -700,8 +956,23 @@
 			res=is_neighbor(np->name);
 			if ( res == 0 )
 			{
-				add_nbr_to_adl(np,face_id);
+				struct name_prefix *nbr_name=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
+				get_host_name_from_command_string(nbr_name,np->name,0);
+				printf("Hostname of neighbor: %s ",nbr_name->name);
+
+				char *ip_addr=(char *)malloc(13);
+				memset(ip_addr,0,13);
+				get_ip_from_hostname_02(nbr_name->name,ip_addr);
+				printf("IP Address: %s \n",ip_addr);
+				int face_id=add_ccn_face(nlsr->ccn, (const char *)nbr_name->name, (const char *)ip_addr, 9695,nlsr->tunnel_type);
+				update_face_to_adl_for_nbr(nbr_name->name, face_id);		
+				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->topo_prefix, OP_REG, face_id);
+				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->slice_prefix, OP_REG, face_id);				
+
+				add_nbr_to_adl(np,face_id,ip_addr);
+
 				sprintf(msg,"Neighbor %s has been added to adjacency list.",name);
+
 			}
 			else
 			{
@@ -718,18 +989,16 @@
 nlsr_api_server_poll(long int time_out_micro_sec, int ccn_fd)
 {
 	struct timeval timeout;
-	if ( time_out_micro_sec < 0 )
+	if (time_out_micro_sec< 500000 && time_out_micro_sec> 0 )
 	{
-		timeout.tv_sec=1;
-		timeout.tv_usec=0;
+		timeout.tv_sec=0;
+		timeout.tv_usec=time_out_micro_sec;
 	}
-	else
+	else 
 	{
-		time_out_micro_sec=(long int)time_out_micro_sec*0.4;
-		timeout.tv_sec=time_out_micro_sec / 1000000;
-		timeout.tv_usec=time_out_micro_sec % 1000000;
+		timeout.tv_sec = 0;
+		timeout.tv_usec = 500000;
 	}
-
 	
 	int fd;
 	int nread;
@@ -744,7 +1013,7 @@
 	testfds=nlsr->readfds;
 	result = select(FD_SETSIZE, &testfds, NULL,NULL, &timeout);
 	
-	for(fd = 0; fd < FD_SETSIZE; fd++) 
+	for(fd = 0; fd < FD_SETSIZE && result > 0; fd++) 
 	{
 		if(FD_ISSET(fd,&testfds)) 
 		{
@@ -754,14 +1023,13 @@
 			}			
 			else if(fd == nlsr->nlsr_api_server_sock_fd)
 			{
-				printf("Setting up socket....\n");
 				client_len = sizeof(client_address);
 				client_sockfd = accept(nlsr->nlsr_api_server_sock_fd,(struct sockaddr *)&client_address, &client_len);
 				FD_SET(client_sockfd, &nlsr->readfds);
 			}
 			else
 			{   
-				printf("Else...\n");		
+					
 				ioctl(fd, FIONREAD, &nread);
 				if(nread == 0) 
 				{
@@ -771,7 +1039,7 @@
 				else 
 				{
 					recv(fd, recv_buffer, 1024, 0);
-					printf("Test Received Data from NLSR API cleint: %s \n",recv_buffer);
+					printf("Received Data from NLSR API cleint: %s \n",recv_buffer);
 					char *msg=process_api_client_command(recv_buffer);
 					send(fd, msg, strlen(msg),0);
 					free(msg);
@@ -785,6 +1053,23 @@
 	return 0;
 }
 
+int
+check_config_validity()
+{
+	if (nlsr->router_name == NULL )
+	{
+		fprintf(stderr,"Router name has not been configured :(\n");
+		return -1;
+	}
+	if ( nlsr->is_hyperbolic_calc == 1 && (nlsr->cor_r == -1.0 && nlsr->cor_theta== -1.0) ) 	
+	{
+		fprintf(stderr,"Hyperbolic codinate has not been defined :(\n");
+		return -1;
+	}
+	
+	return 0;
+}
+
 void 
 nlsr_destroy( void )
 {
@@ -795,7 +1080,7 @@
 	writeLogg(__FILE__,__FUNCTION__,__LINE__,"Freeing Allocated Memory....\n");	
 	/* Destroying all face created by nlsr in CCND */
 	destroy_all_face_by_nlsr();	
-
+	destroy_faces_for_nbrs();
 	/* Destroying every hash table attached to each neighbor in ADL before destorying ADL */	
 	hashtb_destroy(&nlsr->npl);
 	hashtb_destroy(&nlsr->adl);	
@@ -803,7 +1088,7 @@
 	hashtb_destroy(&nlsr->lsdb->adj_lsdb);
 	hashtb_destroy(&nlsr->pit_alsa);
 
-	//To Do: has to destroy the face_list one by one 	
+		
 
 	hashtb_destroy(&nlsr->routing_table);
 
@@ -826,6 +1111,11 @@
 	hashtb_destroy(&nlsr->npt);
 
 
+	ccns_close(&nlsr->ccns, NULL, NULL);
+	ccns_slice_destroy(&nlsr->slice);
+
+
+
 	close(nlsr->nlsr_api_server_sock_fd);	
 
 	ccn_schedule_destroy(&nlsr->sched);
@@ -844,6 +1134,7 @@
 }
 
 
+
 void
 init_api_server(int ccn_fd)
 {
@@ -863,13 +1154,11 @@
        	}
 
 	server_address.sin_family = AF_INET;
-	//server_address.sin_addr.s_addr = inet_addr("127.0.0.1");
 	server_address.sin_addr.s_addr = INADDR_ANY;
 	server_address.sin_port = htons(nlsr->api_port);
 
 	server_len = sizeof(server_address);
 	bind(server_sockfd, (struct sockaddr *)&server_address, server_len);
-	//printf("port number %d\n", ntohs(server_address.sin_port));
 	listen(server_sockfd, 100);
 	FD_ZERO(&nlsr->readfds);
 	FD_SET(server_sockfd, &nlsr->readfds);
@@ -919,13 +1208,15 @@
 	memset(time_stamp,0,20);
 	get_current_timestamp_micro(time_stamp);
 	nlsr->lsdb->lsdb_version=(char *)malloc(strlen(time_stamp)+1);
-	memset(nlsr->lsdb->lsdb_version,'0',strlen(time_stamp));
+	memset(nlsr->lsdb->lsdb_version,0,strlen(time_stamp));
 	free(time_stamp);
 	
 	struct hashtb_param param_adj_lsdb = {0};
 	nlsr->lsdb->adj_lsdb = hashtb_create(sizeof(struct alsa), &param_adj_lsdb);
 	struct hashtb_param param_name_lsdb = {0};
 	nlsr->lsdb->name_lsdb = hashtb_create(sizeof(struct nlsa), &param_name_lsdb);
+	struct hashtb_param param_cor_lsdb = {0};
+	nlsr->lsdb->cor_lsdb = hashtb_create(sizeof(struct clsa), &param_cor_lsdb);
 	
 	
 
@@ -941,16 +1232,30 @@
 	nlsr->detailed_logging=0;
 	nlsr->debugging=0;
 
-	nlsr->lsdb_synch_interval = LSDB_SYNCH_INTERVAL;
+	//nlsr->lsdb_synch_interval = LSDB_SYNCH_INTERVAL;
 	nlsr->interest_retry = INTEREST_RETRY;
 	nlsr->interest_resend_time = INTEREST_RESEND_TIME;
 	nlsr->lsa_refresh_time=LSA_REFRESH_TIME;
 	nlsr->router_dead_interval=ROUTER_DEAD_INTERVAL;
-	nlsr->multi_path_face_num=MULTI_PATH_FACE_NUM;
+	nlsr->max_faces_per_prefix=MAX_FACES_PER_PREFIX;
 	nlsr->semaphor=NLSR_UNLOCKED;
 
 	nlsr->api_port=API_PORT;
 
+	nlsr->topo_prefix=(char *)malloc(strlen("/ndn/routing/nlsr")+1);
+	memset(nlsr->topo_prefix,0,strlen("/ndn/routing/nlsr")+1);
+	memcpy(nlsr->topo_prefix,"/ndn/routing/nlsr",strlen("/ndn/routing/nlsr"));
+
+	nlsr->slice_prefix=(char *)malloc(strlen("/ndn/routing/nlsr/LSA")+1);
+	memset(nlsr->slice_prefix, 0, strlen("/ndn/routing/nlsr/LSA")+1);
+	memcpy(nlsr->slice_prefix,"/ndn/routing/nlsr/LSA",strlen("/ndn/routing/nlsr/LSA"));
+
+	nlsr->is_hyperbolic_calc=0;
+	nlsr->cor_r=-1.0;
+	nlsr->cor_theta=-1.0;
+
+	nlsr->tunnel_type=IPPROTO_UDP;
+
 	return 0;
 }
 
@@ -991,8 +1296,14 @@
 		nlsr->api_port=port;
 
 	readConfigFile(config_file);
+
+	ON_ERROR_DESTROY(check_config_validity());
+
+	print_adjacent_from_adl();
+
 	if ( daemon_mode == 1 )
 	{
+		nlsr->debugging=0;
 		daemonize_nlsr();
 	}
 	
@@ -1008,7 +1319,14 @@
 	}
 
 	init_api_server(ccn_fd);
-	
+
+	res=create_sync_slice(nlsr->topo_prefix, nlsr->slice_prefix);
+	if(res<0)
+	{
+		fprintf(stderr, "Can not create slice for prefix %s\n",nlsr->slice_prefix);
+		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Can not create slice for prefix %s\n",nlsr->slice_prefix);
+		ON_ERROR_DESTROY(res);
+	}
 	struct ccn_charbuf *router_prefix;	
 	router_prefix=ccn_charbuf_create(); 
 	res=ccn_name_from_uri(router_prefix,nlsr->router_name);		
@@ -1037,10 +1355,20 @@
 		printf("lsdb_version: %s\n",nlsr->lsdb->lsdb_version);
 	writeLogg(__FILE__,__FUNCTION__,__LINE__,"lsdb_version: %s\n",nlsr->lsdb->lsdb_version);
 
+	add_faces_for_nbrs();
 	print_name_prefix_from_npl();
 	print_adjacent_from_adl();
-	build_and_install_name_lsas();
-	print_name_lsdb();	
+	build_and_install_name_lsas();	
+
+	sync_monitor(nlsr->topo_prefix,nlsr->slice_prefix);
+
+
+	print_name_lsdb();
+	if ( nlsr->cor_r != -1.0 && nlsr->cor_theta != -1.0)
+	{
+		build_and_install_cor_lsa();
+	}
+	write_name_lsdb_to_repo(nlsr->slice_prefix);
 
 	nlsr->sched = ccn_schedule_create(nlsr, &ndn_rtr_ticker);
 	nlsr->event_send_info_interest = ccn_schedule_event(nlsr->sched, 1, &send_info_interest, NULL, 0);
@@ -1059,7 +1387,7 @@
 			}
 			if(nlsr->ccn != NULL)
 			{
-        			res = ccn_run(nlsr->ccn, 0);
+        			res = ccn_run(nlsr->ccn, 1);
 			}
 			if (!(nlsr->sched && nlsr->ccn))
 			{	      
diff --git a/nlsr.conf b/nlsr.conf
index 193bafc..ced844f 100644
--- a/nlsr.conf
+++ b/nlsr.conf
@@ -1,6 +1,6 @@
 router-name /ndn/memphis.edu/netlab/macbook
-ccnneighbor /ndn/memphis.edu/netlab/mira face14 10
-ccnneighbor /ndn/memphis.edu/netlab/castor face16 8
+ccnneighbor /ndn/memphis.edu/netlab/pollux face2 10
+ccnneighbor /ndn/memphis.edu/netlab/castor face3 8
 ccnname /ndn/memphis.edu/netlab/macbook/name1
 ccnname /ndn/memphis.edu/netlab/macbook/test
 lsdb-synch-interval 310
diff --git a/nlsr.h b/nlsr.h
index a53cc2b..681973b 100644
--- a/nlsr.h
+++ b/nlsr.h
@@ -9,14 +9,14 @@
 #define NLSR_UNLOCKED 0
 #define LSA_REFRESH_TIME 1800
 #define ROUTER_DEAD_INTERVAL 3600
-#define MULTI_PATH_FACE_NUM 0
+#define MAX_FACES_PER_PREFIX 0
 
 #define LINK_METRIC 10
 
 #define NAME_LSA_VALID 1
 #define NAME_LSA_INVALID 0
 
-#define API_PORT 9696
+#define API_PORT 9999
 
 
 struct name_prefix
@@ -29,6 +29,8 @@
 {
 	struct hashtb *name_lsdb;
 	struct hashtb *adj_lsdb;
+	struct hashtb *cor_lsdb;
+	
 	char *lsdb_version;
 };
 
@@ -43,6 +45,12 @@
 
 	struct ccn_closure in_interest;
 	struct ccn_closure in_content;
+
+	struct ccns_name_closure *closure;
+
+	struct ccns_slice *slice;
+    	struct ccns_handle *ccns;
+
 	struct ccn_schedule *sched;
     	struct ccn_scheduled_event *event;
 	struct ccn_scheduled_event *event_send_lsdb_interest;
@@ -59,6 +67,7 @@
 	struct hashtb *npt;
 	struct hashtb *routing_table;
 
+
 	struct linkStateDatabase *lsdb;
 
 	struct ccn *ccn;
@@ -74,12 +83,13 @@
 	int is_send_lsdb_interest_scheduled;
 	int is_route_calculation_scheduled;
 
-	long int lsdb_synch_interval;
+	//long int lsdb_synch_interval;
 	int interest_retry;
 	long int interest_resend_time;
 	long int lsa_refresh_time;
 	long int router_dead_interval;
-	long int multi_path_face_num;
+	//long int multi_path_face_num;
+	long int max_faces_per_prefix;
 	char *logDir;
 	int detailed_logging;
 	int debugging;
@@ -89,6 +99,16 @@
 	int nlsr_api_server_sock_fd;
 	fd_set readfds;
 	int api_port;
+
+	char *topo_prefix;
+	char *slice_prefix;
+
+	int is_hyperbolic_calc;
+	double cor_r;
+	double cor_theta;
+
+	int tunnel_type;
+	
 	
 };
 
diff --git a/nlsr_adl.c b/nlsr_adl.c
index 54d8954..042466a 100644
--- a/nlsr_adl.c
+++ b/nlsr_adl.c
@@ -8,6 +8,10 @@
 #include <assert.h>
 #ifdef HAVE_CONFIG_H
 #include <config.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 #endif
 
 
@@ -25,7 +29,7 @@
 #include "nlsr_npt.h"
 
 void 
-add_nbr_to_adl(struct name_prefix *new_nbr,int face)
+add_nbr_to_adl(struct name_prefix *new_nbr,int face,char *ip)
 {
 	struct ndn_neighbor *nbr=(struct ndn_neighbor *)malloc(sizeof(struct ndn_neighbor )); //free
 
@@ -54,6 +58,9 @@
 		nbr->metric=LINK_METRIC;
 		nbr->is_lsdb_send_interest_scheduled=0;
 		
+		nbr->ip_address=(char *)malloc(13);
+		memset(nbr->ip_address,0,13);
+		memcpy(nbr->ip_address,ip,strlen(ip));
 
 		char *time_stamp=(char *)malloc(20);
 		get_current_timestamp_micro(time_stamp);
@@ -81,6 +88,7 @@
 		printf("--------Neighbor---------------------------\n");
 		printf("	Neighbor: %s \n",nbr->neighbor->name);
 		printf("	Length  : %d \n",nbr->neighbor->length);
+		printf("	Ip Address: %s \n",nbr->ip_address);
 		printf("	Face    : %d \n",nbr->face);
 		printf("	Metric    : %d \n",nbr->metric);
 		printf("	Status  : %d \n",nbr->status);
@@ -310,23 +318,17 @@
 
 	hashtb_start(nlsr->adl, e);
 
-	//printf("Neighbor: %s , Length: %d \n",nbr->name, nbr->length);
-
 	res = hashtb_seek(e, nbr->name, nbr->length, 0);
 
 	if( res == HT_OLD_ENTRY )
 	{
-		//printf("Old Neighbor\n");
 		nnbr=e->data;
 		nnbr->lsdb_interest_timed_out += increment;
-		//printf("lsdb_interest_timed_out: %d \n",nnbr->lsdb_interest_timed_out);
 	}
 	else if(res == HT_NEW_ENTRY)
 	{
 		hashtb_delete(e);
-	}
-
-	//print_adjacent_from_adl();		
+	}		
 	hashtb_end(e);
 }
 
@@ -891,6 +893,32 @@
 	return connecting_face;
 }
 
+void
+update_face_to_adl_for_nbr(char *nbr, int face)
+{
+	int res;
+	struct ndn_neighbor *nnbr;
+
+	struct hashtb_enumerator ee;
+    	struct hashtb_enumerator *e = &ee;
+
+	hashtb_start(nlsr->adl, e);
+	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
+
+	if( res == HT_OLD_ENTRY )
+	{
+		nnbr=e->data;
+		nnbr->face=face;
+		
+	}
+	else if(res == HT_NEW_ENTRY)
+	{
+		hashtb_delete(e);
+	}
+
+	hashtb_end(e);
+}
+
 int 
 is_neighbor(char *nbr)
 {
@@ -917,3 +945,34 @@
 	return ret;
 }
 
+int 
+is_active_neighbor(char *nbr)
+{
+	int ret=0;
+
+	int res;
+	struct hashtb_enumerator ee;
+    	struct hashtb_enumerator *e = &ee;
+
+	hashtb_start(nlsr->adl, e);
+	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
+
+	if( res == HT_OLD_ENTRY )
+	{
+		struct ndn_neighbor *nnbr;
+		nnbr=e->data;
+		if (nnbr->status == NBR_ACTIVE )
+		{
+			ret=1;	
+		}
+	}
+	else if(res == HT_NEW_ENTRY)
+	{
+		hashtb_delete(e);
+	}
+
+	hashtb_end(e);
+
+	return ret;
+}
+
diff --git a/nlsr_adl.h b/nlsr_adl.h
index 5e9fa5a..1eb74d6 100644
--- a/nlsr_adl.h
+++ b/nlsr_adl.h
@@ -11,6 +11,7 @@
 	int status;
 	char * last_lsdb_version;
 	char * last_info_version;
+	char *ip_address;
 	int info_interest_timed_out;
 	int lsdb_interest_timed_out;
 	int lsdb_random_time_component;
@@ -20,7 +21,7 @@
 	int metric;
 };
 
-void add_nbr_to_adl(struct name_prefix *new_nbr,int face);
+void add_nbr_to_adl(struct name_prefix *new_nbr,int face,char *ip);
 void delete_nbr_from_adl(struct name_prefix *nbr);
 void print_adjacent(struct ndn_neighbor *nbr);
 void print_adjacent_from_adl(void);
@@ -48,4 +49,6 @@
 void adjust_adjacent_last_lsdb_requested_to_adl(char *nbr, long int sec);
 int get_next_hop_face_from_adl(char *nbr);
 int is_neighbor(char *nbr);
+int is_active_neighbor(char *nbr);
+void update_face_to_adl_for_nbr(char *nbr, int face);
 #endif
diff --git a/nlsr_fib.c b/nlsr_fib.c
index e89e80d..6ef81cb 100644
--- a/nlsr_fib.c
+++ b/nlsr_fib.c
@@ -15,6 +15,7 @@
 #include <ccn/charbuf.h>
 
 #include "nlsr_fib.h"
+#include "nlsr.h"
 
 
 static void 
@@ -71,7 +72,7 @@
 	forwarding_entry->ccnd_id_size =ccnd_id_size;
 	forwarding_entry->faceid = faceid;
 	forwarding_entry->flags = -1;
-	forwarding_entry->lifetime = (~0U) >> 1;
+	forwarding_entry->lifetime = 2100;
 
 	prefixreg = ccn_charbuf_create();
 	ccnb_append_forwarding_entry(prefixreg, forwarding_entry);
@@ -181,6 +182,12 @@
 int 
 add_delete_ccn_face_by_face_id(struct ccn *h, const char *uri, int operation, int faceid)
 {
+	if ( nlsr->debugging )
+	{
+		printf("add_delete_ccn_face_by_face_id called\n");
+		printf("Uri: %s  Face: %d Operation: %s \n",(char *)uri , faceid, operation == OP_REG ? "Registration" : "Unregistration");
+	}
+
 	struct ccn_charbuf *prefix;
 	struct ccn_charbuf *local_scope_template = ccn_charbuf_create();
 	struct ccn_charbuf *no_name = ccn_charbuf_create();
diff --git a/nlsr_lsdb.c b/nlsr_lsdb.c
index bec9869..e465457 100644
--- a/nlsr_lsdb.c
+++ b/nlsr_lsdb.c
@@ -25,11 +25,11 @@
 #include "nlsr_adl.h"
 #include "nlsr_route.h"
 #include "nlsr_npt.h"
+#include "nlsr_sync.h"
 
 void
 set_new_lsdb_version(void)
 {
-	
 	char *time_stamp=(char *)malloc(20);
 	memset(time_stamp,0,20);
 	get_current_timestamp_micro(time_stamp);
@@ -47,9 +47,6 @@
 make_name_lsa_key(char *key, char *orig_router, int ls_type, long int ls_id)
 {
 	
-	
-	//printf("Orig Router: %s LS Type: %d LS Id: %ld\n",orig_router,ls_type,ls_id);
-
 	char lst[2];
 	memset(lst,0,2);
 	sprintf(lst,"%d",ls_type);	
@@ -63,9 +60,39 @@
 	memcpy(key+strlen(key),lst,strlen(lst));
 	memcpy(key+strlen(key),"/",1);
 	memcpy(key+strlen(key),lsid,strlen(lsid));
-
-	//printf("Key: %s\n",key);
 	
+	if ( nlsr->debugging )
+		printf("name LSA Key: %s\n", key);
+}
+
+
+void 
+make_name_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, long int ls_id,char *orig_time,char *slice_prefix)
+{
+	sprintf(key,"%s%s/lsType.%d/lsId.%ld/%s",slice_prefix, orig_router, ls_type, ls_id, orig_time);
+	
+	if ( nlsr->debugging )
+		printf("Name LSA prefix for repo content: %s\n",key);
+}
+
+void 
+make_adj_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, char *orig_time,char *slice_prefix)
+{
+		
+	sprintf(key,"%s%s/lsType.%d/%s",slice_prefix,orig_router,ls_type, orig_time );	
+
+	if ( nlsr->debugging )
+		printf("Name LSA prefix for repo content:%s\n",key);	
+}
+
+void 
+make_cor_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, char *orig_time,char *slice_prefix)
+{
+		
+	sprintf(key,"%s%s/lsType.%d/%s",slice_prefix,orig_router,ls_type, orig_time );	
+
+	if ( nlsr->debugging )
+		printf("Cor LSA prefix for repo content:%s\n",key);	
 }
 
 void 
@@ -77,7 +104,6 @@
 		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_and_install_name_lsas called\n");
 
 	int i, npl_element;
-	//struct name_prefix *np;
 	struct name_prefix_list_entry *npe;
 
 	struct hashtb_enumerator ee;
@@ -173,9 +199,6 @@
 	char *time_stamp=(char *)malloc(20);
 	memset(time_stamp,0,20);
 	get_current_timestamp_micro(time_stamp);
-	//long int lsa_life_time=get_time_diff(time_stamp,name_lsa->header->orig_time);
-
-	//printf("time difference: %ld \n",lsa_life_time);
 	
 
 		char lst[2];
@@ -452,7 +475,6 @@
 							int check=add_npt_entry(new_name_lsa->header->orig_router->name,new_name_lsa->name_prefix->name,next_hop,faces,route_costs);
 							if ( check == HT_NEW_ENTRY )
 							{
-								//printf("Added in npt \n");
 								if ( nlsr->debugging )
 									printf("Added in npt \n");
 								if ( nlsr->detailed_logging )
@@ -599,6 +621,16 @@
 }
 
 
+void 
+make_cor_lsa_key(char *key,struct clsa *cor_lsa)
+{
+	memcpy(key+strlen(key),cor_lsa->header->orig_router->name,cor_lsa->header->orig_router->length);
+	memcpy(key+strlen(key),"/",1);
+	char ls_type[2];
+	sprintf(ls_type,"%d",cor_lsa->header->ls_type);
+	memcpy(key+strlen(key),ls_type,strlen(ls_type));
+	key[strlen(key)]='\0';
+}
 
 
 void 
@@ -645,6 +677,39 @@
 			build_adj_lsa(adj_lsa);
 			install_adj_lsa(adj_lsa);
 
+			char lst[2];
+			memset(lst,0,2);
+			sprintf(lst,"%d",LS_TYPE_ADJ);			
+
+			char *repo_key=(char *)malloc(strlen(nlsr->slice_prefix)+strlen(adj_lsa->header->orig_time)+strlen(adj_lsa->header->orig_router->name) + strlen(lst) + 5+15);
+			memset(repo_key, 0, strlen(nlsr->slice_prefix)+strlen(adj_lsa->header->orig_time)+strlen(adj_lsa->header->orig_router->name) + strlen(lst) + 5+15);	
+			make_adj_lsa_prefix_for_repo(repo_key, adj_lsa->header->orig_router->name,LS_TYPE_ADJ,adj_lsa->header->orig_time,nlsr->slice_prefix);
+		
+			if ( nlsr->debugging )
+				printf("Adj LSA Repo Key: %s \n",repo_key);
+
+			char *key=(char *)malloc(adj_lsa->header->orig_router->length+2+2);
+			memset(key,0,adj_lsa->header->orig_router->length+2+2);
+			make_adj_lsa_key(key,adj_lsa);
+			if ( nlsr->debugging )
+				printf("Adj LSA: %s \n",key);
+
+			struct name_prefix *lsaid=(struct name_prefix *)malloc(sizeof(struct name_prefix));
+			lsaid->name=(char *)malloc(strlen(key)+1);
+			memset(lsaid->name, 0, strlen(key)+1);
+			memcpy(lsaid->name,key,strlen(key));
+			lsaid->length=strlen(key)+1;
+
+		
+			write_adj_lsa_to_repo(repo_key, lsaid);
+
+			free(key);
+			free(repo_key);
+			free(lsaid->name);
+			free(lsaid);
+
+
+		
 			free(adj_lsa->header->orig_router->name);
 			free(adj_lsa->header->orig_router);
 			free(adj_lsa->header->orig_time);
@@ -680,9 +745,6 @@
 
 	int no_link=no_active_nbr();
 	
-	//printf("Number of link in Adjacent LSA: %d\n",no_link);
-
-	/*Filling Up Header Data */
 	adj_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
 	adj_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
 	adj_lsa->header->orig_router->name=(char *)malloc(strlen(nlsr->router_name)+1);
@@ -701,9 +763,6 @@
 	memcpy(adj_lsa->header->orig_time,time_stamp,strlen(time_stamp)+1);	
 	free(time_stamp);
 
-
-	/* Filling Up Body Data */
-
 	adj_lsa->no_link=no_link;
 
 
@@ -716,14 +775,6 @@
 	memcpy(adj_lsa->body,(char *)data,strlen(data)+1);
 	ccn_charbuf_destroy(&c);
 
-
-
-	if( !nlsr->is_send_lsdb_interest_scheduled )
-	{	
-		nlsr->event_send_lsdb_interest= ccn_schedule_event(nlsr->sched, 1000, &send_lsdb_interest, NULL, 0);
-		nlsr->is_send_lsdb_interest_scheduled=1;
-	}
-
 	nlsr->adj_build_count++;
 
 
@@ -743,15 +794,11 @@
 	char *time_stamp=(char *)malloc(20);
 	memset(time_stamp,0,20);
 	get_current_timestamp_micro(time_stamp);
-	//long int lsa_life_time=get_time_diff(time_stamp,adj_lsa->header->orig_time);
-
-	//printf("time difference: %ld \n",lsa_life_time);
 
 
 		char *key=(char *)malloc(adj_lsa->header->orig_router->length+2+2);
 		memset(key,0,adj_lsa->header->orig_router->length+2);
 		make_adj_lsa_key(key,adj_lsa);
-		//printf("Adjacent LSA key: %s \n",key);
 
 		struct alsa *new_adj_lsa=(struct alsa*)malloc(sizeof(struct alsa ));
 
@@ -831,8 +878,6 @@
 
 				if ( adj_lsa->no_link > 0)
 				{				
-					//new_adj_lsa = e->data;
-
 					writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
 					writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting adj lsa\n");
 					write_log_for_adj_lsa(new_adj_lsa);
@@ -978,12 +1023,13 @@
 		face=strtok_r(NULL,sep,&rem);
 		metric=strtok_r(NULL,sep,&rem);
 
-		printf("		Link %d	 	\n",i+1);
-		printf("		Neighbor		 : %s	\n",rtr_id);
-		printf("		Neighbor Length		 : %s	\n",length);
-		printf("		Connecting Face		 : %s	\n",face);
-		printf("		Metric			 : %s	\n",metric);
-
+		if ( nlsr->debugging ) {
+			printf("		Link %d	 	\n",i+1);
+			printf("		Neighbor		 : %s	\n",rtr_id);
+			printf("		Neighbor Length		 : %s	\n",length);
+			printf("		Connecting Face		 : %s	\n",face);
+			printf("		Metric			 : %s	\n",metric);
+		}
 
 		for(i=1;i<no_link;i++)
 		{
@@ -1062,7 +1108,6 @@
 		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_and_install_others_adj_lsa called \n");
 	struct alsa *adj_lsa=(struct alsa *)malloc(sizeof( struct alsa ));
 	build_others_adj_lsa(adj_lsa,orig_router,ls_type,orig_time,no_link,data);
-	//print_adj_lsa(adj_lsa);
 	install_adj_lsa(adj_lsa);
 	
 
@@ -1081,7 +1126,6 @@
 void 
 build_others_adj_lsa(struct alsa *adj_lsa,char *orig_router,int ls_type,char *orig_time,int no_link,char *data)
 {
-	//printf("build_others_adj_lsa called \n");
 	if ( nlsr->debugging )
 		printf("build_others_adj_lsa called  \n");	
 	if ( nlsr->detailed_logging )
@@ -1144,130 +1188,6 @@
 	return num_element; 
 }
 
-void 
-get_name_lsdb_summary(struct ccn_charbuf *name_lsdb_data)
-{
-	//printf("get_name_lsdb_summary called \n");
-	if ( nlsr->debugging )
-		printf("get_name_lsdb_summary called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_name_lsdb_summary called  \n");
-	
-	int i, name_lsdb_element;
-
-	struct nlsa *name_lsa;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->name_lsdb, e);
-	name_lsdb_element=hashtb_n(nlsr->lsdb->name_lsdb);
-
-	for(i=0;i<name_lsdb_element;i++)
-	{
-		name_lsa=e->data;
-
-		ccn_charbuf_append_string(name_lsdb_data,name_lsa->header->orig_router->name);
-		ccn_charbuf_append_string(name_lsdb_data,"|");
-
-		char *lst=(char *)malloc(20);
-		memset(lst,0,20);
-		sprintf(lst,"%d",name_lsa->header->ls_type);
-		ccn_charbuf_append_string(name_lsdb_data,lst);
-		free(lst);
-		ccn_charbuf_append_string(name_lsdb_data,"|");
-
-		char *lsid=(char *)malloc(20);
-		memset(lsid,0,20);
-		sprintf(lsid,"%ld",name_lsa->header->ls_id);
-		ccn_charbuf_append_string(name_lsdb_data,lsid);
-		free(lsid);
-		ccn_charbuf_append_string(name_lsdb_data,"|");
-
-		ccn_charbuf_append_string(name_lsdb_data,name_lsa->header->orig_time);
-		ccn_charbuf_append_string(name_lsdb_data,"|");
-
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-
-void 
-get_adj_lsdb_summary(struct ccn_charbuf *adj_lsdb_data)
-{
-	if ( nlsr->debugging )
-		printf("get_adj_lsdb_summary called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_adj_lsdb_summary called  \n");
-	int i, adj_lsdb_element;
-	struct alsa *adj_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-	adj_lsdb_element=hashtb_n(nlsr->lsdb->adj_lsdb);
-
-	for(i=0;i<adj_lsdb_element;i++)
-	{
-		adj_lsa=e->data;
-
-		ccn_charbuf_append_string(adj_lsdb_data,adj_lsa->header->orig_router->name);
-		ccn_charbuf_append_string(adj_lsdb_data,"|");
-		
-		char *lst=(char *)malloc(20);
-		memset(lst,0,20);
-		sprintf(lst,"%d",adj_lsa->header->ls_type);
-		ccn_charbuf_append_string(adj_lsdb_data,lst);
-		free(lst);
-		ccn_charbuf_append_string(adj_lsdb_data,"|");
-
-		ccn_charbuf_append_string(adj_lsdb_data,adj_lsa->header->orig_time);
-		ccn_charbuf_append_string(adj_lsdb_data,"|");
-
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-}
-
-
-void 
-get_lsdb_summary(struct ccn_charbuf *lsdb_data)
-{
-	struct ccn_charbuf *name_lsdb_data=ccn_charbuf_create();
-	struct ccn_charbuf *adj_lsdb_data=ccn_charbuf_create();
-
-	get_name_lsdb_summary(name_lsdb_data);
-	get_adj_lsdb_summary(adj_lsdb_data);
-
-	long int num_lsa=get_name_lsdb_num_element() + get_adj_lsdb_num_element();
-	char *num_element=(char *)malloc(15);
-	memset(num_element,0,15);
-	sprintf(num_element,"%ld",num_lsa);
-
-	if( num_lsa > 0)
-	{
-		ccn_charbuf_append_string(lsdb_data,num_element);
-		ccn_charbuf_append_string(lsdb_data,"|");
-	}
-	if(name_lsdb_data->length>0)
-	{
-		char *data1=ccn_charbuf_as_string(name_lsdb_data);
-		ccn_charbuf_append_string(lsdb_data,(char *)data1);
-	}
-	if(adj_lsdb_data->length>0)
-	{
-		char *data2=ccn_charbuf_as_string(adj_lsdb_data);
-		ccn_charbuf_append_string(lsdb_data,(char *)data2);
-	}
-	ccn_charbuf_destroy(&name_lsdb_data);
-	ccn_charbuf_destroy(&adj_lsdb_data);
-	free(num_element);
-
-}
 
 int 
 check_is_new_name_lsa(char *orig_router,char *lst,char *lsid,char *orig_time)
@@ -1351,10 +1271,49 @@
 	return ret;
 }
 
+int 
+check_is_new_cor_lsa(char *orig_router,char *lst,char *orig_time)
+{
+	int ret=0;
+	struct ccn_charbuf *key=ccn_charbuf_create();
+	ccn_charbuf_append_string(key,orig_router);
+	ccn_charbuf_append_string(key,"/");
+	ccn_charbuf_append_string(key,lst);
+
+	int res;
+	struct clsa *cor_lsa;
+
+	struct hashtb_enumerator ee;
+    	struct hashtb_enumerator *e = &ee;
+
+	hashtb_start(nlsr->lsdb->cor_lsdb, e);
+	res = hashtb_seek(e, ccn_charbuf_as_string(key), key->length, 0);
+
+	if( res == HT_NEW_ENTRY )
+	{
+		hashtb_delete(e);
+		ret=1;
+
+	}
+	else if(res == HT_OLD_ENTRY)
+	{
+		cor_lsa=e->data;
+		if( strcmp ( orig_time , cor_lsa->header->orig_time ) > 0 )
+		{
+			ret=1;
+		}
+	}
+
+	hashtb_end(e);
+	
+	ccn_charbuf_destroy(&key);
+
+	return ret;
+}
+
 void 
 get_name_lsa_data(struct ccn_charbuf *lsa_data, struct name_prefix *lsaId)
 {
-	//printf("get_name_lsa_data called \n");
 	if ( nlsr->debugging )
 		printf("get_name_lsa_data called  \n");	
 	if ( nlsr->detailed_logging )
@@ -1372,8 +1331,7 @@
 	if( res == HT_OLD_ENTRY )
 	{
 		name_lsa=e->data;
-		//printf("NAME LSA found\n");
-
+		
 		if ( nlsr->debugging )
 			printf("NAME LSA found  \n");	
 		if ( nlsr->detailed_logging )
@@ -1452,7 +1410,6 @@
 	if( res == HT_OLD_ENTRY )
 	{
 		adj_lsa=e->data;
-		//printf("Adj LSA found\n");
 
 		if ( nlsr->debugging )
 			printf("Adj LSA found  \n");	
@@ -1466,15 +1423,15 @@
 		memset(temp_length,0,20);
 		sprintf(temp_length,"%d",adj_lsa->header->orig_router->length);
 		ccn_charbuf_append_string(lsa_data,temp_length);
-		free(temp_length);
 		ccn_charbuf_append_string(lsa_data,"|");
+		free(temp_length);
 
 		char *temp_ltype=(char *)malloc(20);
 		memset(temp_ltype,0,20);
 		sprintf(temp_ltype,"%d",adj_lsa->header->ls_type);
 		ccn_charbuf_append_string(lsa_data,temp_ltype);
-		free(temp_ltype);
 		ccn_charbuf_append_string(lsa_data,"|");
+		free(temp_ltype);
 
 		ccn_charbuf_append_string(lsa_data,adj_lsa->header->orig_time);
 		ccn_charbuf_append_string(lsa_data,"|");
@@ -1483,8 +1440,8 @@
 		memset(temp_nl,0,20);
 		sprintf(temp_nl,"%d",adj_lsa->no_link);
 		ccn_charbuf_append_string(lsa_data,temp_nl);
-		free(temp_nl);
 		ccn_charbuf_append_string(lsa_data,"|");
+		free(temp_nl);
 
 		ccn_charbuf_append_string(lsa_data,adj_lsa->body);
 
@@ -1522,7 +1479,9 @@
 
 
 	make_name_lsa_key(key, np->name,ls_type,ls_id);	
-	printf("Key:%s Length:%d\n",key,(int)strlen(key));
+	
+	if ( nlsr->debugging )
+		printf("Key:%s Length:%d\n",key,(int)strlen(key));
 
 	struct nlsa *nlsa;
 
@@ -1570,8 +1529,7 @@
 int 
 delete_name_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
 {
-	//printf("delete_name_lsa called \n");
-
+	
 	if ( nlsr->debugging )
 		printf("delete_name_lsa called  \n");	
 	if ( nlsr->detailed_logging )
@@ -1631,8 +1589,6 @@
 	if ( nlsr->detailed_logging )
 		writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
 	
-	//print_name_lsdb();
-	
 	nlsr_unlock();
 
 	return 0;
@@ -1641,8 +1597,6 @@
 int 
 delete_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
 {
-	//printf("delete_adj_lsa called \n");
-
 	if ( nlsr->debugging )
 		printf("delete_adj_lsa called  \n");	
 	if ( nlsr->detailed_logging )
@@ -1654,8 +1608,6 @@
 	}
 	nlsr_lock();
 
-	//printf("LSA Key: %s \n",(char *)ev->evdata);
-
 	if ( nlsr->debugging )
 		printf("LSA Key: %s \n",(char *)ev->evdata);
 	if ( nlsr->detailed_logging )
@@ -1704,8 +1656,6 @@
 		nlsr->is_route_calculation_scheduled=1;
 	}
 
-	//print_adj_lsdb();
-
 	nlsr_unlock();
 
 	return 0;
@@ -1714,15 +1664,11 @@
 void
 refresh_name_lsdb(void)
 {
-	//printf("refresh_name_lsdb called \n");
-
 	if ( nlsr->debugging )
 		printf("refresh_name_lsdb called  \n");	
 	if ( nlsr->detailed_logging )
 		writeLogg(__FILE__,__FUNCTION__,__LINE__,"refresh_name_lsdb called  \n");
 
-	//int lsa_change_count=0;
-
 	char *time_stamp=(char *)malloc(20);
 	memset(time_stamp,0,20);
 	get_current_timestamp_micro(time_stamp);
@@ -1797,7 +1743,6 @@
 
 
 					make_name_lsa_key(key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id);	
-					//printf("Key:%s Length:%d\n",key,(int)strlen(key));
 				
 					nlsr->event = ccn_schedule_event(nlsr->sched, 10, &delete_name_lsa, (void *)key, 0);
 				}
@@ -1817,7 +1762,6 @@
 							
 
 				print_name_lsdb();
-				//lsa_change_count++;
 			}	
 		}
 		else 
@@ -1843,10 +1787,8 @@
 
 
 				make_name_lsa_key(key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id);	
-				//printf("Key:%s Length:%d\n",key,(int)strlen(key));
 				
 				nlsr->event = ccn_schedule_event(nlsr->sched, 10, &delete_name_lsa, (void *)key, 0);
-				//lsa_change_count++;
 			}
 		}
 
@@ -1863,7 +1805,6 @@
 void
 refresh_adj_lsdb(void)
 {
-	//printf("refresh_adj_lsdb called \n");
 
 	if ( nlsr->debugging )
 		printf("refresh_adj_lsdb called  \n");	
@@ -1889,8 +1830,7 @@
 	{
 		adj_lsa=e->data;
 
-		lsa_life_time=get_time_diff(time_stamp,adj_lsa->header->orig_time);
-		//printf("LSA Life Time: %ld \n",lsa_life_time);	
+		lsa_life_time=get_time_diff(time_stamp,adj_lsa->header->orig_time);	
 
 		if ( nlsr->debugging )
 			printf("LSA Life Time: %ld \n",lsa_life_time);	
@@ -1901,7 +1841,6 @@
 		{
 			if ( lsa_life_time > nlsr->lsa_refresh_time )
 			{
-				//printf("Own Adj LSA need to be refrshed\n");
 				if ( nlsr->debugging )
 					printf("Own Adj LSA need to be refrshed\n");
 				if ( nlsr->detailed_logging )
@@ -1947,7 +1886,6 @@
 		{
 			if ( lsa_life_time > nlsr->router_dead_interval )
 			{
-				//printf("Others Adj LSA need to be deleted\n");
 
 				if ( nlsr->debugging )
 				 	printf("Others Adj LSA need to be deleted\n");
@@ -1957,7 +1895,7 @@
 				char *key=(char *)malloc(adj_lsa->header->orig_router->length+2+2);
 				memset(key,0,adj_lsa->header->orig_router->length+2);
 				make_adj_lsa_key(key,adj_lsa);
-				//printf("Adjacent LSA key: %s \n",key);				
+				
 				nlsr->event = ccn_schedule_event(nlsr->sched, 10, &delete_adj_lsa, (void *)key, 0);
 			}
 		}
@@ -1972,6 +1910,112 @@
 	free(time_stamp);
 }
 
+
+void
+refresh_cor_lsdb(void)
+{
+
+	if ( nlsr->debugging )
+		printf("refresh_cor_lsdb called  \n");	
+	if ( nlsr->detailed_logging )
+		writeLogg(__FILE__,__FUNCTION__,__LINE__,"refresh_cor_lsdb called  \n");
+
+	char *time_stamp=(char *)malloc(20);
+	memset(time_stamp,0,20);
+	get_current_timestamp_micro(time_stamp);
+	
+	long int lsa_life_time;
+		
+	int i, cor_lsdb_element;
+	struct clsa *cor_lsa;
+
+	struct hashtb_enumerator ee;
+    	struct hashtb_enumerator *e = &ee;
+    	
+    	hashtb_start(nlsr->lsdb->cor_lsdb, e);
+	cor_lsdb_element=hashtb_n(nlsr->lsdb->cor_lsdb);
+
+	for(i=0;i<cor_lsdb_element;i++)
+	{
+		cor_lsa=e->data;
+
+		lsa_life_time=get_time_diff(time_stamp,cor_lsa->header->orig_time);	
+
+		if ( nlsr->debugging )
+			printf("LSA Life Time: %ld \n",lsa_life_time);	
+		if ( nlsr->detailed_logging )
+			writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSA Life Time: %ld \n",lsa_life_time);		
+
+		if ( strcmp(cor_lsa->header->orig_router->name,nlsr->router_name) == 0)
+		{
+			if ( lsa_life_time > nlsr->lsa_refresh_time )
+			{
+				if ( nlsr->debugging )
+					printf("Own Cor LSA need to be refrshed\n");
+				if ( nlsr->detailed_logging )
+					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Own Cor LSA need to be refrshed\n");
+
+				//writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
+				//writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting adj lsa\n");
+				//write_log_for_adj_lsa(adj_lsa);
+				//writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
+
+				char *current_time_stamp=(char *)malloc(20);
+				memset(current_time_stamp,0,20);
+				get_current_timestamp_micro(current_time_stamp);
+
+				free(cor_lsa->header->orig_time);
+				cor_lsa->header->orig_time=(char *)malloc(strlen(current_time_stamp)+1); //free 
+				memset(cor_lsa->header->orig_time,0,strlen(current_time_stamp)+1);
+				memcpy(cor_lsa->header->orig_time,current_time_stamp,strlen(current_time_stamp)+1);
+	
+				free(current_time_stamp);
+
+				//writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
+				//writeLogg(__FILE__,__FUNCTION__,__LINE__," Adding adj lsa\n");
+				//write_log_for_adj_lsa(adj_lsa);
+				//writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
+
+				if ( nlsr->debugging )
+					printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
+				if ( nlsr->detailed_logging )
+					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
+
+				set_new_lsdb_version();	
+
+				if ( nlsr->debugging )
+					printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
+				if ( nlsr->detailed_logging )
+					writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
+
+				print_adj_lsdb();
+			}	
+		}
+		else 
+		{
+			if ( lsa_life_time > nlsr->router_dead_interval )
+			{
+
+				if ( nlsr->debugging )
+				 	printf("Others Adj LSA need to be deleted\n");
+				if ( nlsr->detailed_logging )
+					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Others Adj LSA need to be deleted\n");
+				
+				hashtb_delete(e);
+				i++;
+			}
+		}
+
+		
+
+		hashtb_next(e);		
+	}
+
+	hashtb_end(e);
+	
+	free(time_stamp);
+}
+
 int
 refresh_lsdb(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
 {
@@ -1982,8 +2026,6 @@
 
 	nlsr_lock();
 
-	//printf("refresh_lsdb called \n");
-
 	if ( nlsr->debugging )
 		printf("refresh_lsdb called\n");
 	if ( nlsr->detailed_logging )
@@ -1991,9 +2033,489 @@
 	
 	refresh_name_lsdb();
 	refresh_adj_lsdb();
+	refresh_cor_lsdb();
 
 	nlsr->event = ccn_schedule_event(nlsr->sched, 60000000, &refresh_lsdb, NULL, 0);
 	
 	nlsr_unlock();
 	return 0;
 }
+
+void
+write_adj_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id)
+{
+	if ( nlsr->debugging )
+		printf("write_adj_lsa_to_repo called\n");
+	if ( nlsr->debugging )
+		printf("Content Prefix: %s\n",repo_content_prefix);
+	
+	struct ccn_charbuf *lsa_data=ccn_charbuf_create();		
+	get_adj_lsa_data(lsa_data,lsa_id);
+	if ( nlsr->debugging )
+		printf("Adj LSA Data: %s \n",ccn_charbuf_as_string(lsa_data));	
+
+	write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_content_prefix);
+
+	ccn_charbuf_destroy(&lsa_data);
+}
+
+void
+write_name_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id)
+{
+	if ( nlsr->debugging )
+		printf("write_name_lsa_to_repo called\n");
+	if ( nlsr->debugging )
+		printf("Content Prefix: %s\n",repo_content_prefix);
+	
+	struct ccn_charbuf *lsa_data=ccn_charbuf_create();		
+	get_name_lsa_data(lsa_data,lsa_id);
+	
+	if ( nlsr->debugging )
+		printf("Name LSA Data: %s \n",ccn_charbuf_as_string(lsa_data));	
+
+	write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_content_prefix);
+
+	ccn_charbuf_destroy(&lsa_data);
+}
+
+
+void
+write_name_lsdb_to_repo(char *slice_prefix)
+{
+	int i, name_lsdb_element;
+
+	struct nlsa *name_lsa;
+	struct hashtb_enumerator ee;
+    	struct hashtb_enumerator *e = &ee;
+    	
+    	hashtb_start(nlsr->lsdb->name_lsdb, e);
+	name_lsdb_element=hashtb_n(nlsr->lsdb->name_lsdb);
+
+	for(i=0;i<name_lsdb_element;i++)
+	{
+		name_lsa=e->data;
+
+		char lst[2];
+		memset(lst,0,2);
+		sprintf(lst,"%d",name_lsa->header->ls_type);	
+
+		char lsid[10];
+		memset(lsid,0,10);
+		sprintf(lsid,"%ld",name_lsa->header->ls_id);
+	
+	
+		char *key=(char *)malloc(strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
+		memset(key,0,strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
+
+
+		make_name_lsa_key(key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id);
+		
+		if ( nlsr->debugging )
+			printf("Name LSA Key: %s \n",key);
+
+
+		char *repo_key=(char *)malloc(strlen(slice_prefix)+1+strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1+strlen(name_lsa->header->orig_time)+1+15);
+		memset(repo_key,0,strlen(slice_prefix)+1+strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1+strlen(name_lsa->header->orig_time)+1+15);	
+		make_name_lsa_prefix_for_repo(repo_key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id,name_lsa->header->orig_time,slice_prefix);
+		
+		if ( nlsr->debugging )
+			printf("Name LSA Repo Key: %s \n",repo_key);
+
+		struct name_prefix *lsaid=(struct name_prefix *)malloc(sizeof(struct name_prefix));
+		lsaid->name=(char *)malloc(strlen(key)+1);
+		memset(lsaid->name, 0, strlen(key)+1);
+		memcpy(lsaid->name,key,strlen(key));
+		lsaid->length=strlen(key)+1;
+
+		
+		write_name_lsa_to_repo(repo_key, lsaid);
+
+		free(key);
+		free(repo_key);
+		free(lsaid->name);
+		free(lsaid);
+
+		hashtb_next(e);		
+	}
+
+	hashtb_end(e);
+	
+
+}
+
+void
+print_cor_lsa(struct clsa *cor_lsa)
+{
+	if ( nlsr->debugging )
+	{
+		printf("-----------Cor LSA Content---------------\n");
+		printf("	Origination Router       :	%s\n",cor_lsa->header->orig_router->name);
+		printf("	Origination Router Length:	%d\n",cor_lsa->header->orig_router->length);
+		printf("	LS Type			 :	%d\n",cor_lsa->header->ls_type);
+		printf("	Origination Time	 :	%s\n",cor_lsa->header->orig_time);
+		printf("	LSA Data			\n");
+		printf("		Cor R:	 	:	%f\n",cor_lsa->cor_r);
+		printf("		Cor Theta	:	%f\n",cor_lsa->cor_theta);
+
+		printf("\n");	
+	}
+}
+
+void 
+print_cor_lsdb()
+{
+	
+	if ( nlsr->debugging )
+		printf("print_cor_lsdb called \n");	
+	
+	struct hashtb_enumerator ee;
+    	struct hashtb_enumerator *e = &ee;
+    	
+	int i=1;
+
+	for (hashtb_start(nlsr->lsdb->cor_lsdb, e); e->key != NULL; hashtb_next(e)) 
+	{
+		if ( nlsr->debugging )
+			printf("-----------Cor LSA (%d)---------------\n",i);	
+		struct clsa *cor_lsa=e->data;
+		print_cor_lsa(cor_lsa);
+		i++;
+  	}
+	hashtb_end(e);
+
+	if ( nlsr->debugging )
+		printf("\n");
+	if ( nlsr->detailed_logging )
+		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
+}
+
+void
+install_cor_lsa(struct clsa *cor_lsa)
+{
+	if ( nlsr->debugging )
+		printf("install_cor_lsa called \n");
+	if ( nlsr->detailed_logging )
+		writeLogg(__FILE__,__FUNCTION__,__LINE__,"install_cor_lsa called  \n");
+	
+
+	char *time_stamp=(char *)malloc(20);
+	memset(time_stamp,0,20);
+	get_current_timestamp_micro(time_stamp);
+
+
+	char *key=(char *)malloc(cor_lsa->header->orig_router->length+2+2);
+	memset(key,0,cor_lsa->header->orig_router->length+2);
+	make_cor_lsa_key(key,cor_lsa);
+
+	if ( nlsr->debugging )
+		printf("Cor LSA key: %s \n",key);
+
+	struct hashtb_enumerator ee;
+    	struct hashtb_enumerator *e = &ee; 	
+    	int res;
+
+   	hashtb_start(nlsr->lsdb->cor_lsdb, e);
+    	res = hashtb_seek(e, key, strlen(key), 0);
+
+	if ( res == HT_NEW_ENTRY )
+	{
+		if ( nlsr->debugging )
+			printf("New Cor LSA... \n");
+		
+		struct clsa *new_cor_lsa=(struct clsa *)malloc(sizeof( struct clsa ));
+		new_cor_lsa=e->data;
+		new_cor_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
+
+		new_cor_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
+		new_cor_lsa->header->orig_router->name=(char *)malloc(strlen(cor_lsa->header->orig_router->name)+1);
+		memset(new_cor_lsa->header->orig_router->name,0,strlen(cor_lsa->header->orig_router->name)+1);
+		memcpy(new_cor_lsa->header->orig_router->name,cor_lsa->header->orig_router->name,strlen(cor_lsa->header->orig_router->name)+1);
+		new_cor_lsa->header->orig_router->length=cor_lsa->header->orig_router->length;
+
+		new_cor_lsa->header->orig_time=(char *)malloc(strlen(cor_lsa->header->orig_time)+1); //free 
+		memset(new_cor_lsa->header->orig_time,0,strlen(cor_lsa->header->orig_time)+1);
+		memcpy(new_cor_lsa->header->orig_time,cor_lsa->header->orig_time,strlen(cor_lsa->header->orig_time)+1);
+
+		new_cor_lsa->header->ls_type=cor_lsa->header->ls_type;
+
+		new_cor_lsa->cor_r=cor_lsa->cor_r;
+		new_cor_lsa->cor_theta=cor_lsa->cor_theta;
+	}
+	else if ( res == HT_OLD_ENTRY )
+	{	
+		if ( nlsr->debugging )
+			printf("Cor LSA exists (Old)... \n");
+	}
+	hashtb_end(e);
+
+	free(key);
+
+}
+
+void 
+build_cor_lsa(struct clsa *cor_lsa, double cor_r, double cor_theta)
+{
+	cor_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
+	cor_lsa->header->ls_type=LS_TYPE_COR;
+
+	char *time_stamp=(char *)malloc(20);
+	memset(time_stamp,0,20);
+	get_current_timestamp_micro(time_stamp);
+
+	cor_lsa->header->orig_time=(char *)malloc(strlen(time_stamp)+1); //free 
+	memset(cor_lsa->header->orig_time,0,strlen(time_stamp)+1);
+	memcpy(cor_lsa->header->orig_time,time_stamp,strlen(time_stamp)+1);
+	free(time_stamp);
+
+	cor_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
+	cor_lsa->header->orig_router->name=(char *)malloc(strlen(nlsr->router_name)+1);
+	memset(cor_lsa->header->orig_router->name,0,strlen(nlsr->router_name)+1);
+	memcpy(cor_lsa->header->orig_router->name,nlsr->router_name,strlen(nlsr->router_name)+1);
+	cor_lsa->header->orig_router->length=strlen(nlsr->router_name)+1;
+
+	cor_lsa->cor_r=cor_r;	
+	cor_lsa->cor_theta=cor_theta;
+
+}
+
+void 
+build_others_cor_lsa(struct clsa *cor_lsa,char *orig_router, int ls_type,char *orig_time, double cor_r, double cor_theta)
+{
+	cor_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
+	cor_lsa->header->ls_type=ls_type;
+
+	cor_lsa->header->orig_time=(char *)malloc(strlen(orig_time)+1); 
+	memset(cor_lsa->header->orig_time,0,strlen(orig_time)+1);
+	memcpy(cor_lsa->header->orig_time,orig_time,strlen(orig_time)+1);
+
+	cor_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
+	cor_lsa->header->orig_router->name=(char *)malloc(strlen(orig_router)+1);
+	memset(cor_lsa->header->orig_router->name,0,strlen(orig_router)+1);
+	memcpy(cor_lsa->header->orig_router->name,orig_router,strlen(orig_router)+1);
+	cor_lsa->header->orig_router->length=strlen(orig_router)+1;
+
+	cor_lsa->cor_r=cor_r;	
+	cor_lsa->cor_theta=cor_theta;
+
+}
+
+void
+build_and_install_others_cor_lsa(char *orig_router,int ls_type,char *orig_time, double cor_r, double cor_theta)
+{
+	struct clsa *cor_lsa=(struct clsa *)malloc(sizeof( struct clsa ));
+	build_others_cor_lsa(cor_lsa,orig_router,ls_type, orig_time, cor_r, cor_theta);
+	install_cor_lsa(cor_lsa);
+
+	print_cor_lsdb();
+
+	free(cor_lsa->header->orig_router);
+	free(cor_lsa->header->orig_time);
+	free(cor_lsa->header);
+	free(cor_lsa);
+
+}
+
+
+void 
+build_and_install_cor_lsa()
+{
+
+	
+
+	struct clsa *cor_lsa=(struct clsa *)malloc(sizeof( struct clsa ));
+	
+	build_cor_lsa(cor_lsa,nlsr->cor_r,nlsr->cor_theta);
+	install_cor_lsa(cor_lsa);
+
+	write_cor_lsa_to_repo(cor_lsa);
+
+	print_cor_lsdb();	
+
+	free(cor_lsa->header->orig_router);
+	free(cor_lsa->header->orig_time);
+	free(cor_lsa->header);
+	free(cor_lsa);
+	
+}
+
+void 
+get_cor_lsa_data(struct ccn_charbuf *lsa_data,char *cor_lsa_key)
+{
+	if ( nlsr->debugging )
+		printf("get_cor_lsa_data called  \n");	
+	if ( nlsr->detailed_logging )
+		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_adj_lsa_data called  \n");
+
+	struct clsa *cor_lsa=(struct clsa*)malloc(sizeof(struct clsa ));
+
+	struct hashtb_enumerator ee;
+    	struct hashtb_enumerator *e = &ee; 	
+    	int res;
+
+   	hashtb_start(nlsr->lsdb->cor_lsdb, e);
+    	res = hashtb_seek(e, cor_lsa_key, strlen(cor_lsa_key), 0);
+
+	if( res == HT_OLD_ENTRY )
+	{
+		cor_lsa=e->data;
+
+		if ( nlsr->debugging )
+			printf("Cor LSA found  \n");	
+		if ( nlsr->detailed_logging )
+			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Cor LSA found  \n");
+
+		ccn_charbuf_append_string(lsa_data,cor_lsa->header->orig_router->name);
+		ccn_charbuf_append_string(lsa_data,"|");
+
+		char *temp_length=(char *)malloc(20);
+		memset(temp_length,0,20);
+		sprintf(temp_length,"%d",cor_lsa->header->orig_router->length);
+		ccn_charbuf_append_string(lsa_data,temp_length);
+		ccn_charbuf_append_string(lsa_data,"|");
+		free(temp_length);
+
+		char *temp_ltype=(char *)malloc(20);
+		memset(temp_ltype,0,20);
+		sprintf(temp_ltype,"%d",cor_lsa->header->ls_type);
+		ccn_charbuf_append_string(lsa_data,temp_ltype);
+		ccn_charbuf_append_string(lsa_data,"|");
+		free(temp_ltype);
+
+		ccn_charbuf_append_string(lsa_data,cor_lsa->header->orig_time);
+		ccn_charbuf_append_string(lsa_data,"|");
+
+		char *cor_r=(char *)malloc(20);
+		memset(cor_r,0,20);
+		sprintf(cor_r,"%f",cor_lsa->cor_r);
+		ccn_charbuf_append_string(lsa_data,cor_r);
+		ccn_charbuf_append_string(lsa_data,"|");
+		free(cor_r);
+
+		char *cor_theta=(char *)malloc(20);
+		memset(cor_theta,0,20);
+		sprintf(cor_theta,"%f",cor_lsa->cor_theta);
+		ccn_charbuf_append_string(lsa_data,cor_theta);
+		ccn_charbuf_append_string(lsa_data,"|");
+		free(cor_theta);
+
+	}
+	else if(res == HT_NEW_ENTRY)
+	{
+		hashtb_delete(e);
+	}
+
+	hashtb_end(e);
+}
+
+void
+write_cor_lsa_to_repo(struct clsa *cor_lsa)
+{
+	
+
+	if ( nlsr->debugging )
+		printf("write_cor_lsa_to_repo called\n");
+	
+	
+	char *key=(char *)malloc(cor_lsa->header->orig_router->length+2+2);
+	memset(key,0,cor_lsa->header->orig_router->length+2+2);
+	make_cor_lsa_key(key,cor_lsa);
+	
+	struct ccn_charbuf *lsa_data=ccn_charbuf_create();
+	get_cor_lsa_data(lsa_data,key);
+	
+	if ( nlsr->debugging )
+		printf("Cor LSA Data: %s \n",ccn_charbuf_as_string(lsa_data));	
+	char *lst=(char *)malloc(20);
+	memset(lst,0,20);
+	sprintf(lst,"%d",cor_lsa->header->ls_type);
+	char *repo_key=(char *)malloc(strlen(nlsr->slice_prefix)+strlen(cor_lsa->header->orig_time)+strlen(cor_lsa->header->orig_router->name) + strlen(lst) + 5+15);
+	memset(repo_key, 0, strlen(nlsr->slice_prefix)+strlen(cor_lsa->header->orig_time)+strlen(cor_lsa->header->orig_router->name) + strlen(lst) + 5+15);	
+	make_cor_lsa_prefix_for_repo(repo_key, cor_lsa->header->orig_router->name,LS_TYPE_COR,cor_lsa->header->orig_time,nlsr->slice_prefix);
+		
+	if ( nlsr->debugging )
+		printf("Cor LSA Repo Key: %s \n",repo_key);	
+
+	write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_key);
+
+	
+		
+	free(lst);
+	free(key);
+	free(repo_key);
+	ccn_charbuf_destroy(&lsa_data);
+}
+
+void 
+make_cor_lsa_key_by_router_name(char *key,char *router_name)
+{
+	memcpy(key+strlen(key),router_name,strlen(router_name));
+	memcpy(key+strlen(key),"/",1);
+	char ls_type[2];
+	sprintf(ls_type,"%d",LS_TYPE_COR);
+	memcpy(key+strlen(key),ls_type,strlen(ls_type));
+	key[strlen(key)]='\0';
+}
+
+
+double 
+get_hyperbolic_r(char *router)
+{
+	double ret=-1.0;
+	char *cor_lsa_key=(char *)calloc(strlen(router)+4,sizeof(char));
+	make_cor_lsa_key_by_router_name(cor_lsa_key,router);
+
+	
+	struct clsa *cor_lsa;
+	struct hashtb_enumerator ee;
+    	struct hashtb_enumerator *e = &ee; 	
+    	int res;
+
+   	hashtb_start(nlsr->lsdb->cor_lsdb, e);
+    	res = hashtb_seek(e, cor_lsa_key, strlen(cor_lsa_key), 0);
+
+	if ( res == HT_OLD_ENTRY)
+	{	
+		cor_lsa=e->data;
+		ret=cor_lsa->cor_r;
+	}
+	else if(res == HT_NEW_ENTRY)
+	{
+		hashtb_delete(e);
+	}
+
+	hashtb_end(e);
+	
+	free(cor_lsa_key);
+	return ret;
+}
+
+double 
+get_hyperbolic_theta(char *router)
+{
+		double ret=-1.0;
+	char *cor_lsa_key=(char *)calloc(strlen(router)+4,sizeof(char));
+	make_cor_lsa_key_by_router_name(cor_lsa_key,router);
+
+	struct clsa *cor_lsa;
+	struct hashtb_enumerator ee;
+    	struct hashtb_enumerator *e = &ee; 	
+    	int res;
+
+   	hashtb_start(nlsr->lsdb->cor_lsdb, e);
+    	res = hashtb_seek(e, cor_lsa_key, strlen(cor_lsa_key), 0);
+
+	if ( res == HT_OLD_ENTRY)
+	{	
+		cor_lsa=e->data;
+		ret=cor_lsa->cor_theta;
+	}
+	else if(res == HT_NEW_ENTRY)
+	{
+		hashtb_delete(e);
+	}
+
+	hashtb_end(e);
+	
+	free(cor_lsa_key);
+	return ret;
+}
diff --git a/nlsr_lsdb.h b/nlsr_lsdb.h
index 0383954..c67348e 100644
--- a/nlsr_lsdb.h
+++ b/nlsr_lsdb.h
@@ -3,6 +3,7 @@
 
 #define LS_TYPE_ADJ 1
 #define LS_TYPE_NAME 2
+#define LS_TYPE_COR 3
 
 struct link
 {
@@ -44,6 +45,13 @@
 	struct name_prefix *name_prefix;
 };
 
+struct clsa
+{
+	struct alsa_header *header;
+	double cor_r;
+	double cor_theta;
+};
+
 
 void set_new_lsdb_version(void);
 void build_and_install_name_lsas(void);
@@ -72,16 +80,26 @@
 long int get_name_lsdb_num_element(void);
 long int get_adj_lsdb_num_element(void);
 
-void get_name_lsdb_summary(struct ccn_charbuf *name_lsdb_data);
-void get_adj_lsdb_summary(struct ccn_charbuf *adj_lsdb_data);
-void get_lsdb_summary(struct ccn_charbuf *lsdb_data);
-
 int check_is_new_name_lsa(char *orig_router,char *lst,char *lsid,char *orig_time);
 int check_is_new_adj_lsa(char *orig_router,char *lst,char *orig_time);
+int check_is_new_cor_lsa(char *orig_router,char *lst,char *orig_time);
 
 void get_name_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId);
 void get_adj_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId);
 
 void make_name_lsa_invalid(struct name_prefix *np,int ls_type, long int ls_id);
 
+void build_and_install_cor_lsa();
+void print_cor_lsdb();
+
+void write_name_lsdb_to_repo(char *slice_prefix);
+void write_name_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id);
+void make_name_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, long int ls_id,char *orig_time,char *slice_prefix);
+void write_adj_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id);
+
+void write_cor_lsa_to_repo(struct clsa *cor_lsa);
+void build_and_install_others_cor_lsa(char *orig_router,int ls_type,char *orig_time, double cor_r, double cor_theta);
+double get_hyperbolic_r(char *router);
+double get_hyperbolic_theta(char *router);
+
 #endif
diff --git a/nlsr_ndn.c b/nlsr_ndn.c
index 9af0a05..258c954 100644
--- a/nlsr_ndn.c
+++ b/nlsr_ndn.c
@@ -275,20 +275,12 @@
 
 	res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,nlsr_position+1,&comp_ptr1, &comp_size);
 
-	//printf("Det= %s \n",comp_ptr1);
 
 	if(!strcmp((char *)comp_ptr1,"info"))
 	{
 		process_incoming_interest_info(selfp,info);
 	}
-	if(!strcmp((char *)comp_ptr1,"lsdb"))
-	{
-		process_incoming_interest_lsdb(selfp,info);
-	}
-	if(!strcmp((char *)comp_ptr1,"lsa"))
-	{
-		process_incoming_interest_lsa(selfp,info);
-	}
+
 }
 
 void 
@@ -321,9 +313,9 @@
 		ccn_charbuf_append_closer(sp.template_ccnb);
 
 
-		char *raw_data=(char *)malloc(16);
-		memset(raw_data,0,16);
-		sprintf(raw_data,"%ld", nlsr->lsdb_synch_interval);	
+		char *raw_data=(char *)malloc(20);
+		memset(raw_data,0,20);
+		sprintf(raw_data,"%s", nlsr->lsdb->lsdb_version);	
 
 		res= ccn_sign_content(nlsr->ccn, data, name, &sp, raw_data,strlen(raw_data)); 
 		if(res >= 0)
@@ -373,264 +365,6 @@
 }
 
 
-void 
-process_incoming_interest_lsdb(struct ccn_closure *selfp, struct ccn_upcall_info *info)
-{
-	//printf("process_incoming_interest_lsdb called \n");
-
-	if ( nlsr->debugging )
-		printf("process_incoming_interest_lsdb called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_interest_lsdb called \n");
-	
-
-	int l,res;
-	const unsigned char *exclbase;
-	size_t size;
-	struct ccn_buf_decoder decoder;
-	struct ccn_buf_decoder *d;
-	const unsigned char *comp;
-	int dbcmp=0;
-
-	l = info->pi->offset[CCN_PI_E_Exclude] - info->pi->offset[CCN_PI_B_Exclude];
-	if (l > 0) 
-	{
-		comp = NULL;
-		size = 0;
-		exclbase = info->interest_ccnb + info->pi->offset[CCN_PI_B_Exclude];
-		d = ccn_buf_decoder_start(&decoder, exclbase, l);
-		if (ccn_buf_match_dtag(d, CCN_DTAG_Exclude)) 
-		{
-			ccn_buf_advance(d);
-			if (ccn_buf_match_dtag(d, CCN_DTAG_Any))
-				ccn_buf_advance_past_element(d);
-			if (ccn_buf_match_dtag(d, CCN_DTAG_Component)) 
-			{
-				ccn_buf_advance(d);
-				ccn_buf_match_blob(d, &comp, &size);
-				ccn_buf_check_close(d);			
-
-
-			}
-			ccn_buf_check_close(d);
-		}
-		if (comp != NULL)
-		{
-			if ( nlsr->debugging )
-			{
-				printf("LSDB Version in Exclusion Filter is %s\n",comp);
-				printf("LSDB Version of own NLSR is: %s \n",nlsr->lsdb->lsdb_version);
-			}
-			if ( nlsr->detailed_logging )
-			{
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSDB Version in Exclusion Filter is %s\n",comp);
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSDB Version of own NLSR is: %s \n",nlsr->lsdb->lsdb_version);
-			}
-			dbcmp=strcmp(nlsr->lsdb->lsdb_version,(char *)comp);
-		}
-		/* Now comp points to the start of your potential number, and size is its length */
-	}
-	else
-	{
-		if ( nlsr->debugging )
-			printf("LSDB Version in Exclusion Filter is: None Added\n");
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSDB Version in Exclusion Filter is: None Added\n");
-		dbcmp=1;		
-
-	}
-
-	struct ccn_charbuf *data=ccn_charbuf_create();
-	struct ccn_charbuf *name=ccn_charbuf_create();
-	struct ccn_signing_params sp=CCN_SIGNING_PARAMS_INIT;
-	
-	ccn_charbuf_append(name, info->interest_ccnb + info->pi->offset[CCN_PI_B_Name],info->pi->offset[CCN_PI_E_Name] - info->pi->offset[CCN_PI_B_Name]);
-
-	sp.template_ccnb=ccn_charbuf_create();
-	ccn_charbuf_append_tt(sp.template_ccnb,CCN_DTAG_SignedInfo, CCN_DTAG);
-	ccnb_tagged_putf(sp.template_ccnb, CCN_DTAG_FreshnessSeconds, "%ld", 10);
-        sp.sp_flags |= CCN_SP_TEMPL_FRESHNESS;
-        ccn_charbuf_append_closer(sp.template_ccnb);
-
-
-	if(dbcmp>0)
-	{
-		if ( nlsr->debugging )
-		{
-			printf("Has Updated Database than Neighbor\n");
-			printf("Sending LSDB Summary of Updated LSDB Content...\n");			
-		}
-		if ( nlsr->detailed_logging )
-		{
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Has Updated Database than Neighbor\n");
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending LSDB Summary of Updated LSDB Content...\n");	
-		}
-		ccn_name_append_str(name,nlsr->lsdb->lsdb_version);
-
-		struct ccn_charbuf *lsdb_data=ccn_charbuf_create();
-		get_lsdb_summary(lsdb_data);
-
-		char *raw_data=ccn_charbuf_as_string(lsdb_data);
-
-		//printf("Content Data to be sent: %s \n",raw_data);		
-
-		if( nlsr->is_build_adj_lsa_sheduled == 1 || strlen((char *)raw_data) == 0 )
-		{
-			 res= ccn_sign_content(nlsr->ccn, data, name, &sp, "WAIT" , strlen("WAIT"));
-		}
-		else
-		{
-			res= ccn_sign_content(nlsr->ccn, data, name, &sp, raw_data , strlen(raw_data));
-		}
-
-		if(res >= 0)
-		{
-			if ( nlsr->debugging )
-				printf("Signing LSDB Summary of Updated LSDB Content is successful  \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Signing LSDB Summary of Updated LSDB Content is successful  \n");
-		}		
-
-	    	res=ccn_put(nlsr->ccn,data->buf,data->length);
-
-		if(res >= 0)
-		{
-			if ( nlsr->debugging )
-				printf("Sending LSDB Summary of Updated LSDB Content is successful  \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending LSDB Summary of Updated LSDB Content is successful  \n");
-		}
-		
-		ccn_charbuf_destroy(&lsdb_data);
-	}
-	else
-	{
-		if ( nlsr->debugging )
-		{
-			printf("Does not have Updated Database than Neighbor\n");		
-			printf("Sending NACK Content.....\n");	
-		}
-		if ( nlsr->detailed_logging )
-		{
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Does not have Updated Database than Neighbor\n");		
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending NACK Content.....\n");
-		}
-
-		res= ccn_sign_content(nlsr->ccn, data, name, &sp, "NACK", strlen("NACK")); 
-
-		if(res >= 0)
-		{
-			if ( nlsr->debugging )
-				printf("Signing NACK Content is successful  \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Signing NACK Content is successful  \n");
-		}
-
-	    	res=ccn_put(nlsr->ccn,data->buf,data->length);
-
-		if(res >= 0)
-		{
-			if ( nlsr->debugging )
-				printf("Sending NACK Content is successful  \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending NACK Content is successful  \n");
-		}
-
-		
-	}
-
-	ccn_charbuf_destroy(&data);
-	ccn_charbuf_destroy(&name);
-	ccn_charbuf_destroy(&sp.template_ccnb);
-
-
-}
-
-
-void 
-process_incoming_interest_lsa(struct ccn_closure *selfp, struct ccn_upcall_info *info)
-{
-	if ( nlsr->debugging )
-		printf("process_incoming_interest_lsa called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_interest_lsa called \n");
-
-	int res;
-
-	struct name_prefix *lsaId=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	get_lsa_identifier(lsaId,selfp,info,0);
-
-	//printf("LSA Identifier: %s Length: %d\n",lsaId->name,lsaId->length);
-	int ls_type=get_ls_type(selfp, info);
-
-	struct ccn_charbuf *lsa_data=ccn_charbuf_create();
-
-	if ( ls_type == LS_TYPE_NAME )
-	{
-		if ( nlsr->debugging )
-			printf("Interest Received for NAME LSA \n");
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Interest Received for NAME LSA \n");
-		get_name_lsa_data(lsa_data,lsaId);
-	}
-	else if ( ls_type == LS_TYPE_ADJ )
-	{
-		if ( nlsr->debugging )
-			printf("Interest Received for ADJ LSA \n");
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Interest Received for ADJ LSA \n");
-		get_adj_lsa_data(lsa_data,lsaId);
-	}
-
-	char *rdata=ccn_charbuf_as_string(lsa_data);
-	char *raw_data=(char *)malloc(strlen(rdata)+1);
-	memset(raw_data,0,strlen(rdata)+1);
-	memcpy(raw_data,(char *)rdata,strlen(rdata)+1);
-	//printf("Content Data to be sent: %s\n",raw_data);
-
-	struct ccn_charbuf *data=ccn_charbuf_create();
-	struct ccn_charbuf *name=ccn_charbuf_create();
-	struct ccn_signing_params sp=CCN_SIGNING_PARAMS_INIT;
-
-	ccn_charbuf_append(name, info->interest_ccnb + info->pi->offset[CCN_PI_B_Name],info->pi->offset[CCN_PI_E_Name] - info->pi->offset[CCN_PI_B_Name]); 
-
-	sp.template_ccnb=ccn_charbuf_create();
-	ccn_charbuf_append_tt(sp.template_ccnb,CCN_DTAG_SignedInfo, CCN_DTAG);
-	ccnb_tagged_putf(sp.template_ccnb, CCN_DTAG_FreshnessSeconds, "%ld", 10);
-        sp.sp_flags |= CCN_SP_TEMPL_FRESHNESS;
-        ccn_charbuf_append_closer(sp.template_ccnb);
-
-	res= ccn_sign_content(nlsr->ccn, data, name, &sp, raw_data , strlen(raw_data)); 
-
-	if(res >= 0)
-	{
-		if ( nlsr->debugging )
-			printf("Signing LSA Content is successful  \n");
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Signing LSA Content is successful  \n");
-	}
-
-	res=ccn_put(nlsr->ccn,data->buf,data->length);
-
-	if(res >= 0)
-	{
-		if ( nlsr->debugging )
-			printf("Sending LSA Content is successful  \n");
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending LSA Content is successful  \n");
-	}
-
-
-
-	ccn_charbuf_destroy(&data);
-	ccn_charbuf_destroy(&name);
-	ccn_charbuf_destroy(&sp.template_ccnb);
-	ccn_charbuf_destroy(&lsa_data);
-
-	free(raw_data);
-	free(lsaId);
-}
-
 /* Call back function registered in ccnd to get all content coming to NLSR application */
 
 enum ccn_upcall_res incoming_content(struct ccn_closure* selfp,
@@ -701,7 +435,6 @@
 void 
 process_incoming_content(struct ccn_closure *selfp, struct ccn_upcall_info* info)
 {
-	//printf("process_incoming_content called \n");
 	if ( nlsr->debugging )
 		printf("process_incoming_content called \n");
 	if ( nlsr->detailed_logging )
@@ -725,20 +458,11 @@
 
 	res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,nlsr_position+1,&comp_ptr1, &comp_size);
 
-	//printf("Det= %s \n",comp_ptr1);
 
 	if(!strcmp((char *)comp_ptr1,"info"))
 	{
 		process_incoming_content_info(selfp,info);
 	}
-	if(!strcmp((char *)comp_ptr1,"lsdb"))
-	{
-		process_incoming_content_lsdb(selfp,info);
-	}
-	if(!strcmp((char *)comp_ptr1,"lsa"))
-	{
-		process_incoming_content_lsa(selfp,info);
-	}
 
 }
 
@@ -746,7 +470,6 @@
 void 
 process_incoming_content_info(struct ccn_closure *selfp, struct ccn_upcall_info* info)
 {
-	//printf("process_incoming_content_info called \n");
 	if ( nlsr->debugging )
 		printf("process_incoming_content_info called \n");
 	if ( nlsr->detailed_logging )
@@ -761,18 +484,17 @@
 		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Info Content Received For Neighbor: %s Length:%d\n",nbr->name,nbr->length);
 
 
-	const unsigned char *ptr;
-	size_t length;
-	ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E_Content]-info->pco->offset[CCN_PCO_B_Content], info->pco, &ptr, &length);
-	//printf("Content data: %s\n",ptr);
+	//const unsigned char *ptr;
+	//size_t length;
+	//ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E_Content]-info->pco->offset[CCN_PCO_B_Content], info->pco, &ptr, &length);
 
-	long int interval=atoi((char *)ptr);
+	//long int interval=atoi((char *)ptr);
 
 
 
 	update_adjacent_timed_out_zero_to_adl(nbr);	
 	update_adjacent_status_to_adl(nbr,NBR_ACTIVE);
-	update_lsdb_synch_interval_to_adl(nbr,interval);
+	//update_lsdb_synch_interval_to_adl(nbr,interval);
 	print_adjacent_from_adl();
 
 
@@ -801,257 +523,6 @@
 }
 
 
-void 
-process_incoming_content_lsdb(struct ccn_closure *selfp, struct ccn_upcall_info* info)
-{
-	if ( nlsr->debugging )
-		printf("process_incoming_content_lsdb called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_content_lsdb called \n");
-
-	const unsigned char *ptr;
-	size_t length;
-	ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E_Content]-info->pco->offset[CCN_PCO_B_Content], info->pco, &ptr, &length);
-	//printf("Content data: %s\n",ptr);
-
-	if( (strcmp("NACK",(char *)ptr) != 0 ) && (strcmp("WAIT",(char *)ptr) != 0 ) )
-	{
-		struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-		get_nbr(nbr,selfp,info);
-
-		char *nl;
-		int num_element;
-		int i;
-		char *rem;
-		const char *sep="|";
-		char *orig_router;
-		char *lst;
-		int ls_type;
-		char *lsid;
-		long int ls_id;
-		char *orig_time;
-
-		nl=strtok_r((char *)ptr,sep,&rem);
-		num_element=atoi(nl);		
-
-		for(i = 0 ; i < num_element ; i++)
-		{
-			orig_router=strtok_r(NULL,sep,&rem);
-			lst=strtok_r(NULL,sep,&rem);
-			ls_type=atoi(lst);
-
-			if ( nlsr->debugging )
-				printf("Orig Router: %s ls Type: %d",orig_router,ls_type);
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Orig Router: %s ls Type: %d",orig_router,ls_type);
-		
-
-			if(ls_type == LS_TYPE_NAME)
-			{
-				lsid=strtok_r(NULL,sep,&rem);
-				ls_id=atoi(lsid);
-				orig_time=strtok_r(NULL,sep,&rem);
-
-				if ( nlsr->debugging )
-					printf(" LS Id: %ld  Orig Time: %s\n",ls_id ,orig_time);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," LS Id: %ld  Orig Time: %s\n",ls_id ,orig_time);
-
-				
-				int is_new_name_lsa=check_is_new_name_lsa(orig_router,lst,lsid,orig_time);
-				if ( is_new_name_lsa == 1 )
-				{
-					if ( nlsr->debugging )
-						printf("New NAME LSA.....\n");
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"New NAME LSA.....\n");
-					
-					send_interest_for_name_lsa(nbr,orig_router,lst,lsid);	
-				}
-				else 
-				{
-					if ( nlsr->debugging )
-						printf("Name LSA already exists in LSDB\n");
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Name LSA already exists in LSDB\n");
-					
-				}
-			}
-			else
-			{
-				orig_time=strtok_r(NULL,sep,&rem);
-
-				if ( nlsr->debugging )
-					printf(" Orig Time: %s\n",orig_time);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Orig Time: %s\n",orig_time);
-				
-
-				int is_new_adj_lsa=check_is_new_adj_lsa(orig_router,lst,orig_time);
-				if ( is_new_adj_lsa == 1 )
-				{
-					if ( nlsr->debugging )
-						printf("New Adj LSA.....\n");
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Adj LSA.....\n");
-					send_interest_for_adj_lsa(nbr,orig_router,lst);
-				}
-				else
-				{
-					if ( nlsr->debugging )
-						printf("Adj LSA already exists in LSDB\n");
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Adj LSA already exists in LSDB\n");
-				}
-			}
-
-		}
-
-		char *lsdb_version=(char *)malloc(20);
-		memset(lsdb_version,0,20);
-		get_lsdb_version(lsdb_version,selfp,info);
-
-		if ( nlsr->debugging )
-			printf("Old LSDB Version of Neighbor: %s is :%s\n",nbr->name,get_nbr_lsdb_version(nbr->name));
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old LSDB Version of Neighbor: %s is :%s\n",nbr->name,get_nbr_lsdb_version(nbr->name));
-
-		update_adjacent_lsdb_version_to_adl(nbr,lsdb_version);
-		
-		if ( nlsr->debugging )
-			printf("New LSDB Version of Neighbor: %s is :%s\n",nbr->name,get_nbr_lsdb_version(nbr->name));
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"New LSDB Version of Neighbor: %s is :%s\n",nbr->name,get_nbr_lsdb_version(nbr->name));
-
-		update_lsdb_interest_timed_out_zero_to_adl(nbr);
-
-		free(lsdb_version);
-		free(nbr);	
-	}
-	else if (strcmp("WAIT",(char *)ptr) == 0)
-	{
-		struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-		get_nbr(nbr,selfp,info);
-		long int interval=get_lsdb_synch_interval(nbr->name);
-		adjust_adjacent_last_lsdb_requested_to_adl(nbr->name,(long int)interval/2);
-
-		update_lsdb_interest_timed_out_zero_to_adl(nbr);
-		free(nbr);
-	}
-	else 
-	{
-		
-		if ( nlsr->debugging )
-			printf("NACK Content Received\n");
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"NACK Content Received\n");
-		struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-		get_nbr(nbr,selfp,info);
-		update_lsdb_interest_timed_out_zero_to_adl(nbr);
-		free(nbr);
-	}
-}
-
-
-void 
-process_incoming_content_lsa(struct ccn_closure *selfp, struct ccn_upcall_info* info)
-{
-	
-
-	if ( nlsr->debugging )
-		printf("process_incoming_content_lsa called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_content_lsa called \n");	
-
-	char *sep="|";
-	char *rem;
-	char *orig_router;
-	char *orl;
-	int orig_router_length;
-	char *lst;
-	int ls_type;
-	char *lsid;
-	long int ls_id;
-	char *isvld;
-	int isValid;
-	char *num_link;
-	int no_link;
-	char *np;
-	char *np_length;
-	int name_length;
-	char *data;
-	char *orig_time;
-
-	const unsigned char *ptr;
-	size_t length;
-	ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E_Content]-info->pco->offset[CCN_PCO_B_Content], info->pco, &ptr, &length);
-	//printf("Content data Received: %s\n",ptr);
-
-	
-
-	
-	if ( nlsr->debugging )
-		printf("LSA Data \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSA Data\n");	
-
-	if( strlen((char *) ptr ) > 0 )
-	{
-
-		orig_router=strtok_r((char *)ptr,sep,&rem);
-		orl=strtok_r(NULL,sep,&rem);
-		orig_router_length=atoi(orl);
-
-		if ( nlsr->debugging )
-		{
-			printf("	Orig Router Name  : %s\n",orig_router);
-			printf("	Orig Router Length: %d\n",orig_router_length);
-		}
-
-		lst=strtok_r(NULL,sep,&rem);		
-		ls_type=atoi(lst);
-
-		if ( nlsr->debugging )
-			printf("	LS Type  : %d\n",ls_type);
-
-		if ( ls_type == LS_TYPE_NAME )
-		{
-			lsid=strtok_r(NULL,sep,&rem);
-			ls_id=atoi(lsid);
-			orig_time=strtok_r(NULL,sep,&rem);
-			isvld=strtok_r(NULL,sep,&rem);
-			isValid=atoi(isvld);
-			np=strtok_r(NULL,sep,&rem);
-			np_length=strtok_r(NULL,sep,&rem);
-			name_length=atoi(np_length);
-			if ( nlsr->debugging )
-			{
-				printf("	LS ID  : %ld\n",ls_id);
-				printf("	isValid  : %d\n",isValid);
-				printf("	Name Prefix : %s\n",np);
-				printf("	Orig Time   : %s\n",orig_time);
-				printf("	Name Prefix length: %d\n",name_length);
-			}
-
-			build_and_install_others_name_lsa(orig_router,ls_type,ls_id,orig_time,isValid,np);
-
-		}
-		else if ( ls_type == LS_TYPE_ADJ )
-		{
-			orig_time=strtok_r(NULL,sep,&rem);
-			num_link=strtok_r(NULL,sep,&rem);
-			no_link=atoi(num_link);
-			data=rem;
-
-			if ( nlsr->debugging )
-			{
-				printf("	No Link  : %d\n",no_link);
-				printf("	Data  : %s\n",data);
-			}
-			build_and_install_others_adj_lsa(orig_router,ls_type,orig_time,no_link,data);
-		}
-	}
-}
 
 
 void
@@ -1082,14 +553,6 @@
 	{
 		process_incoming_timed_out_interest_info(selfp,info);
 	}
-	if(ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,nlsr_position+1,"lsdb") == 0)
-	{
-		process_incoming_timed_out_interest_lsdb(selfp,info);
-	}
-	if(ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,nlsr_position+1,"lsa") == 0)
-	{
-		process_incoming_timed_out_interest_lsa(selfp,info);
-	}
 }
 
 void
@@ -1140,56 +603,6 @@
 
 }
 
-void
-process_incoming_timed_out_interest_lsdb(struct ccn_closure* selfp, struct ccn_upcall_info* info)
-{
-	if ( nlsr->debugging )
-		printf("process_incoming_timed_out_interest_lsdb called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_timed_out_interest_lsdb called \n");
-
-	struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	get_nbr(nbr,selfp,info);
-
-	if ( nlsr->debugging )
-		printf("LSDB Interest Timed Out for for Neighbor: %s Length:%d\n",nbr->name,nbr->length);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSDB Interest Timed Out for for Neighbor: %s Length:%d\n",nbr->name,nbr->length);
-	
-
-	update_lsdb_interest_timed_out_to_adl(nbr,1);
-
-	int interst_timed_out_num=get_lsdb_interest_timed_out_number(nbr);
-
-	if ( nlsr->debugging )
-		printf("Interest Timed out number : %d Interest Retry: %d \n",interst_timed_out_num,nlsr->interest_retry);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Interest Timed out number : %d Interest Retry: %d \n",interst_timed_out_num,nlsr->interest_retry);
-
-	
-
-	if( interst_timed_out_num >= nlsr->interest_retry )
-	{
-		update_adjacent_status_to_adl(nbr,NBR_DOWN);
-		if(!nlsr->is_build_adj_lsa_sheduled)
-		{
-			nlsr->event_build_adj_lsa = ccn_schedule_event(nlsr->sched, 1000, &build_and_install_adj_lsa, NULL, 0);
-			nlsr->is_build_adj_lsa_sheduled=1;		
-		}
-	}
-	free(nbr->name);
-	free(nbr);
-}
-
-void
-process_incoming_timed_out_interest_lsa(struct ccn_closure* selfp, struct ccn_upcall_info* info)
-{
-	if ( nlsr->debugging )
-		printf("process_incoming_timed_out_interest_lsa called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_timed_out_interest_lsa called \n");
-	
-}
 
 int
 send_info_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
@@ -1281,17 +694,20 @@
 		ccn_charbuf_append_closer(templ); /* </Name> */
 		ccn_charbuf_append_tt(templ, CCN_DTAG_Scope, CCN_DTAG);
 		ccn_charbuf_append_tt(templ, 1, CCN_UDATA);
+		/* Adding InterestLifeTime and InterestScope filter done */		
 		ccn_charbuf_append(templ, "2", 1); //scope of interest: 2 (not further than next host)
 		ccn_charbuf_append_closer(templ); /* </Scope> */
 
 		appendLifetime(templ,nlsr->interest_resend_time);
+		unsigned int face_id=get_next_hop_face_from_adl(nbr->name);
+		ccnb_tagged_putf(templ, CCN_DTAG_FaceID, "%u", face_id);
 		ccn_charbuf_append_closer(templ); /* </Interest> */
-		/* Adding InterestLifeTime and InterestScope filter done */
+		
 	
 		if ( nlsr->debugging )
-			printf("Sending info interest on name prefix : %s \n",int_name);
+			printf("Sending info interest on name prefix : %s through Face:%u\n",int_name,face_id);
 		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending info interest on name prefix : %s \n",int_name);
+			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending info interest on name prefix : %s through Face:%u\n",int_name,face_id);
 
 		res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
 
@@ -1308,306 +724,3 @@
 	free(int_name);
 
 }
-
-
-int 
-send_lsdb_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
-{
-	if ( nlsr->debugging )
-		printf("send_lsdb_interest called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"send_lsdb_interest called \n");	
-
-	if(flags == CCN_SCHEDULE_CANCEL)
-	{
- 	 	return -1;
-	}
-
-	 nlsr_lock();
-
-	int i, adl_element;
-	struct ndn_neighbor *nbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-
-	for(i=0;i<adl_element;i++)
-	{
-		nbr=e->data;
-
-		if(nbr->status == NBR_ACTIVE)
-		{	
-			if(nbr->is_lsdb_send_interest_scheduled == 0)
-			{
-				long int time_diff=get_nbr_time_diff_lsdb_req(nbr->neighbor->name);
-				if ( nlsr->debugging )
-					printf("Time since last time LSDB requested : %ld Seconds for Neighbor: %s \n",time_diff,nbr->neighbor->name);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Time since last time LSDB requested : %ld Seconds for Neighbor: %s \n",time_diff,nbr->neighbor->name);	
-						
-
-				if( time_diff >= ( get_lsdb_synch_interval(nbr->neighbor->name) + get_nbr_random_time_component(nbr->neighbor->name) ) )
-				{
-					nbr->is_lsdb_send_interest_scheduled=1;
-					send_lsdb_interest_to_nbr(nbr->neighbor);
-				}
-			}
-		}
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-	nlsr->event_send_lsdb_interest= ccn_schedule_event(nlsr->sched, 30000000, &send_lsdb_interest, NULL, 0);
-
-	 nlsr_unlock();
-
-	return 0;
-}
-
-void 
-send_lsdb_interest_to_nbr(struct name_prefix *nbr)
-{
-	if ( nlsr->debugging )
-		printf("send_lsdb_interest_to_nbr called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"send_lsdb_interest_to_nbr called \n");
-
-	char *last_lsdb_version=get_nbr_lsdb_version(nbr->name);
-
-	if(last_lsdb_version !=NULL)
-	{
-		
-
-		if ( nlsr->debugging )
-			printf("Last LSDB Version: %s \n",last_lsdb_version);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Last LSDB Version: %s \n",last_lsdb_version);
-
-		struct ccn_charbuf *name;
-		int res;
-		char lsdb_str[5];
-		char nlsr_str[5];
-
-		memset(&nlsr_str,0,5);
-		sprintf(nlsr_str,"nlsr");
-		memset(&lsdb_str,0,5);
-		sprintf(lsdb_str,"lsdb");		
-		//make and send interest with exclusion filter as last_lsdb_version
-		if ( nlsr->debugging )
-			printf("Sending interest for name prefix:%s/%s/%s\n",nbr->name,nlsr_str,lsdb_str);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending interest for name prefix:%s/%s/%s\n",nbr->name,nlsr_str,lsdb_str);
-			
-		name=ccn_charbuf_create();
-		res=ccn_name_from_uri(name,nbr->name);
-
-		if( res >= 0)
-		{
-			ccn_name_append_str(name,nlsr_str);
-			ccn_name_append_str(name,lsdb_str);
-			/* adding Exclusion filter */
-
-			struct ccn_charbuf *templ;
-			templ = ccn_charbuf_create();
-
-			struct ccn_charbuf *c;
-			c = ccn_charbuf_create();
-
-
-			ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
-			ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
-			ccn_charbuf_append_closer(templ); /* </Name> */
-			ccn_charbuf_append_tt(templ, CCN_DTAG_Exclude, CCN_DTAG);
-			ccnb_tagged_putf(templ, CCN_DTAG_Any, "");
-			ccn_charbuf_reset(c);
-			ccn_charbuf_putf(c, "%s", last_lsdb_version);
-			
-			ccnb_append_tagged_blob(templ, CCN_DTAG_Component, c->buf, c->length);
-			ccn_charbuf_append_closer(templ); /* </Exclude> */
-			ccn_charbuf_append_tt(templ, CCN_DTAG_Scope, CCN_DTAG);
-			ccn_charbuf_append_tt(templ, 1, CCN_UDATA);
-			ccn_charbuf_append(templ, "2", 1);
-			ccn_charbuf_append_closer(templ); /* </Scope> */
-
-			appendLifetime(templ,nlsr->interest_resend_time);
-
-			ccn_charbuf_append_closer(templ); /* </Interest> */
-
-
-			/* Adding Exclusion filter done */
-
-			res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
-
-			if ( res >= 0 )
-			{
-				if ( nlsr->debugging )
-					printf("Interest sending Successfull .... \n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Interest sending Successfull .... \n");	
-				update_adjacent_last_lsdb_requested_to_adl(nbr->name,get_current_time_sec());
-
-			}
-			ccn_charbuf_destroy(&c);
-			ccn_charbuf_destroy(&templ);
-		}
-		ccn_charbuf_destroy(&name);
-	}	
-	set_is_lsdb_send_interest_scheduled_to_zero(nbr->name);
-}
-
-void 
-send_interest_for_name_lsa(struct name_prefix *nbr, char *orig_router, char *ls_type, char *ls_id)
-{
-	if ( nlsr->debugging )
-		printf("send_interest_for_name_lsa called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"send_interest_for_name_lsa called\n");
-
-	int res;
-	char lsa_str[5];
-	char nlsr_str[5];
-
-	memset(&nlsr_str,0,5);
-	sprintf(nlsr_str,"nlsr");
-	memset(&lsa_str,0,5);
-	sprintf(lsa_str,"lsa");
-
-	char *int_name=(char *)malloc(nbr->length + strlen(ls_type)+strlen(orig_router)+strlen(nlsr_str)+strlen(lsa_str)+3);
-	memset(int_name,0,nbr->length +strlen(ls_type)+ strlen(orig_router)+strlen(nlsr_str)+strlen(lsa_str)+3);
-
-	memcpy(int_name+strlen(int_name),nbr->name,nbr->length);
-	memcpy(int_name+strlen(int_name),"/",1);
-	memcpy(int_name+strlen(int_name),nlsr_str,strlen(nlsr_str));
-	memcpy(int_name+strlen(int_name),"/",1);
-	memcpy(int_name+strlen(int_name),lsa_str,strlen(lsa_str));
-	memcpy(int_name+strlen(int_name),"/",1);
-	memcpy(int_name+strlen(int_name),ls_type,strlen(ls_type));
-	memcpy(int_name+strlen(int_name),orig_router,strlen(orig_router));
-
-
-	struct ccn_charbuf *name;	
-	name=ccn_charbuf_create();
-
-
-	res=ccn_name_from_uri(name,int_name);
-	ccn_name_append_str(name,ls_type);
-	ccn_name_append_str(name,ls_id);
-
-
-	/* adding InterestLifeTime and InterestScope filter */
-
-	struct ccn_charbuf *templ;
-	templ = ccn_charbuf_create();
-
-	ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
-	ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
-	ccn_charbuf_append_closer(templ); /* </Name> */
-	//ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
-	ccn_charbuf_append_tt(templ, CCN_DTAG_Scope, CCN_DTAG);
-	ccn_charbuf_append_tt(templ, 1, CCN_UDATA);
-	ccn_charbuf_append(templ, "2", 1); //scope of interest: 2 (not further than next host)
-	ccn_charbuf_append_closer(templ); /* </Scope> */
-
-	appendLifetime(templ,nlsr->interest_resend_time);
-	ccn_charbuf_append_closer(templ); /* </Interest> */
-	/* Adding InterestLifeTime and InterestScope filter done */
-
-	if ( nlsr->debugging )
-		printf("Sending NAME LSA interest on name prefix : %s/%s/%s\n",int_name,ls_type,ls_id);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending NAME LSA interest on name prefix : %s/%s/%s\n",int_name,ls_type,ls_id);
-
-
-	res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
-
-	if ( res >= 0 )
-	{
-		if ( nlsr->debugging )
-			printf("NAME LSA interest sending Successfull .... \n");
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"NAME LSA interest sending Successfull .... \n");
-	
-	}	
-	ccn_charbuf_destroy(&templ);
-	ccn_charbuf_destroy(&name);
-	free(int_name);
-
-
-}
-
-void 
-send_interest_for_adj_lsa(struct name_prefix *nbr, char *orig_router, char *ls_type)
-{
-	if ( nlsr->debugging )
-		printf("send_interest_for_name_lsa called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"send_interest_for_name_lsa called\n");
-
-	int res;
-	char lsa_str[5];
-	char nlsr_str[5];
-
-	memset(&nlsr_str,0,5);
-	sprintf(nlsr_str,"nlsr");
-	memset(&lsa_str,0,5);
-	sprintf(lsa_str,"lsa");
-
-	char *int_name=(char *)malloc(nbr->length + strlen(ls_type)+strlen(orig_router)+strlen(nlsr_str)+strlen(lsa_str)+3+strlen(ls_type)+1);
-	memset(int_name,0,nbr->length +strlen(ls_type)+ strlen(orig_router)+strlen(nlsr_str)+strlen(lsa_str)+3+strlen(ls_type)+1);
-
-	memcpy(int_name+strlen(int_name),nbr->name,nbr->length);
-	memcpy(int_name+strlen(int_name),"/",1);
-	memcpy(int_name+strlen(int_name),nlsr_str,strlen(nlsr_str));
-	memcpy(int_name+strlen(int_name),"/",1);
-	memcpy(int_name+strlen(int_name),lsa_str,strlen(lsa_str));
-	memcpy(int_name+strlen(int_name),"/",1);
-	memcpy(int_name+strlen(int_name),ls_type,strlen(ls_type));
-	memcpy(int_name+strlen(int_name),orig_router,strlen(orig_router));
-	memcpy(int_name+strlen(int_name),"/",1);
-	memcpy(int_name+strlen(int_name),ls_type,strlen(ls_type));
-
-	struct ccn_charbuf *name;	
-	name=ccn_charbuf_create();
-
-
-	ccn_name_from_uri(name,int_name);
-	
-	/* adding InterestLifeTime and InterestScope filter */
-
-	struct ccn_charbuf *templ;
-	templ = ccn_charbuf_create();
-
-	ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
-	ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
-	ccn_charbuf_append_closer(templ); /* </Name> */
-	ccn_charbuf_append_tt(templ, CCN_DTAG_Scope, CCN_DTAG);
-	ccn_charbuf_append_tt(templ, 1, CCN_UDATA);
-	ccn_charbuf_append(templ, "2", 1); //scope of interest: 2 (not further than next host)
-	ccn_charbuf_append_closer(templ); /* </Scope> */
-
-	appendLifetime(templ,nlsr->interest_resend_time);
-	ccn_charbuf_append_closer(templ); /* </Interest> */
-	/* Adding InterestLifeTime and InterestScope filter done */
-
-	if ( nlsr->debugging )
-		printf("Sending ADJ LSA interest on name prefix : %s\n",int_name);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending ADJ LSA interest on name prefix : %s\n",int_name);
-
-	res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
-
-	if ( res >= 0 )
-	{
-		if ( nlsr->debugging )
-			printf("ADJ LSA interest sending Successfull .... \n");	
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"ADJ LSA interest sending Successfull .... \n");	
-	}
-	
-	ccn_charbuf_destroy(&templ);
-	ccn_charbuf_destroy(&name);
-	free(int_name);
-}
diff --git a/nlsr_ndn.h b/nlsr_ndn.h
index 1feab1e..1e34284 100644
--- a/nlsr_ndn.h
+++ b/nlsr_ndn.h
@@ -7,31 +7,19 @@
 void get_lsdb_version(char *lsdb_version,struct ccn_closure *selfp, struct ccn_upcall_info *info );
 int get_ls_type(struct ccn_closure *selfp, struct ccn_upcall_info *info);
 
-enum ccn_upcall_res incoming_interest(struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info);
- 
+enum ccn_upcall_res incoming_interest(struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info); 
 void process_incoming_interest(struct ccn_closure *selfp, struct ccn_upcall_info *info);
 void process_incoming_interest_info(struct ccn_closure *selfp, struct ccn_upcall_info *info);
-void process_incoming_interest_lsdb(struct ccn_closure *selfp, struct ccn_upcall_info *info);
-void process_incoming_interest_lsa(struct ccn_closure *selfp, struct ccn_upcall_info *info);
-
 
 enum ccn_upcall_res incoming_content(struct ccn_closure* selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info* info);
 void process_incoming_content(struct ccn_closure *selfp, struct ccn_upcall_info* info);
 void process_incoming_content_info(struct ccn_closure *selfp, struct ccn_upcall_info* info);
-void process_incoming_content_lsdb(struct ccn_closure *selfp, struct ccn_upcall_info* info);
-void process_incoming_content_lsa(struct ccn_closure *selfp, struct ccn_upcall_info* info);
 
 void process_incoming_timed_out_interest(struct ccn_closure* selfp, struct ccn_upcall_info* info);
 void process_incoming_timed_out_interest_info(struct ccn_closure* selfp, struct ccn_upcall_info* info);
-void process_incoming_timed_out_interest_lsdb(struct ccn_closure* selfp, struct ccn_upcall_info* info);
-void process_incoming_timed_out_interest_lsa(struct ccn_closure* selfp, struct ccn_upcall_info* info);
 
 int send_info_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
 void send_info_interest_to_neighbor(struct name_prefix *nbr);
 
-int send_lsdb_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
-void send_lsdb_interest_to_nbr(struct name_prefix *nbr);
-void send_interest_for_name_lsa(struct name_prefix *nbr, char *orig_router, char *ls_type, char *ls_id);
-void send_interest_for_adj_lsa(struct name_prefix *nbr, char *orig_router, char *ls_type);
 
 #endif
diff --git a/nlsr_npt.c b/nlsr_npt.c
index e3c8483..fb167f5 100644
--- a/nlsr_npt.c
+++ b/nlsr_npt.c
@@ -177,6 +177,11 @@
 update_ccnd_fib_for_orig_router(char *orig_router)
 {
 
+	if ( nlsr->debugging )
+	{
+		printf("update_ccnd_fib_for_orig_router called\n");
+	}
+
 	int res;	
 	struct hashtb_enumerator ee;
     	struct hashtb_enumerator *e = &ee; 	
@@ -202,23 +207,31 @@
 		get_all_faces_for_orig_router_from_npt(orig_router,faces,route_costs,num_face);
 		sort_faces_by_distance(faces,route_costs,0,num_face);
 		
-
-		first_face=num_face-1;		
-	
-		if ( nlsr->multi_path_face_num == 0 )
+		if ( nlsr->debugging )
 		{
-			last_face=first_face;
+			int m;
+			for ( m =0 ; m< num_face ; m++)
+			{
+				printf("Dest_router: %s Next_Hop_Face: %d Route_cost: %d \n",orig_router,faces[m],route_costs[m]);
+			}
 		}
-		else 
+
+		last_face=0;
+		if ( nlsr->max_faces_per_prefix == 0) // add all faces available in routing table
 		{
-			if ( num_face <= nlsr->multi_path_face_num)
+			first_face=num_face-1;
+		}
+		else if( nlsr->max_faces_per_prefix > 0)
+		{
+			if ( nlsr->max_faces_per_prefix >= num_face)
 			{
-				last_face=0;
+				first_face=num_face-1;
 			}
-			else if ( nlsr->multi_path_face_num == 0)
+			else if ( nlsr->max_faces_per_prefix < num_face)
 			{
-				last_face=num_face-nlsr->multi_path_face_num;
+				first_face=nlsr->max_faces_per_prefix-1;
 			}
+	
 		}
 
 		int i,j, nl_element;
@@ -235,30 +248,26 @@
 			
 			for( j=first_face; j>= last_face; j--)
 			{
-				//printf("Adding face: Name:%s Face: %d\n",nle->name,faces[j]);
-				//printf("Orig Router: %s \n",orig_router);
-				//printf("Name Prefix: %s \n",nle->name);
-				//printf("Is neighbor Orig Router: %d \n",is_neighbor(orig_router));
-				//printf("Is neighbor Name Prefix: %d \n",is_neighbor(nle->name));
-
-				if ( is_neighbor(orig_router) == 0 )
+				if ( nlsr->debugging )
+				{
+					printf("Possible FIB Entry name: %s face: %d route cost: %d \n",nle->name,faces[j],route_costs[j]);
+				}
+				if ( is_active_neighbor(orig_router) == 0 )
 				{
 					if ( nlsr->debugging )
 						printf("Adding face: Name:%s Face: %d\n",nle->name,faces[j]);	
 					if ( nlsr->detailed_logging )
 						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Adding face: Name:%s Face: %d\n",nle->name,faces[j]);
-					//printf("Adding face: Name:%s Face: %d\n",nle->name,faces[j]);
 					add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_REG, faces[j]);	
 				}
 				else 
 				{
-					if ( j == last_face && is_neighbor(nle->name)==0)
+					if ( j == last_face &&  is_active_neighbor(nle->name)==0)
 					{
 						if ( nlsr->debugging )
 							printf("Adding face: Name:%s Face: %d\n",nle->name,faces[j]);	
 						if ( nlsr->detailed_logging )
 							writeLogg(__FILE__,__FUNCTION__,__LINE__,"Adding face: Name:%s Face: %d\n",nle->name,faces[j]);
-						//printf("Adding face: Name:%s Face: %d\n",nle->name,faces[j]);
 						add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_REG, faces[j]);
 					}
 				}
@@ -333,28 +342,27 @@
 			sort_faces_by_distance(faces,route_costs,0,num_face);
 		
 
-			first_face=num_face-1;		
-	
-			if ( nlsr->multi_path_face_num == 0 )
+			last_face=0;
+			if ( nlsr->max_faces_per_prefix == 0) // add all faces available in routing table
 			{
-				last_face=first_face;
+				first_face=num_face-1;
 			}
-			else 
+			else if( nlsr->max_faces_per_prefix > 0)
 			{
-				if ( num_face <= nlsr->multi_path_face_num)
+				if ( nlsr->max_faces_per_prefix >= num_face)
 				{
-					last_face=0;
+					first_face=num_face-1;
 				}
-				else if ( nlsr->multi_path_face_num == 0)
+				else if ( nlsr->max_faces_per_prefix < num_face)
 				{
-					last_face=num_face-nlsr->multi_path_face_num;
+					first_face=nlsr->max_faces_per_prefix-1;
 				}
-			}			
-
+	
+			}
 			for( j=first_face; j>= last_face; j--)
 			{
 
-				if ( is_neighbor(orig_router) == 0 )
+				if ( is_active_neighbor(orig_router) == 0 )
 				{
 					if ( nlsr->debugging )
 						printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);	
@@ -364,7 +372,7 @@
 				}
 				else 
 				{
-					if ( j == last_face && is_neighbor(nle->name)==0)
+					if ( j == last_face && is_active_neighbor(nle->name)==0)
 					{
 						if ( nlsr->debugging )
 							printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);	
@@ -376,10 +384,6 @@
 				
 			}
 			
-			
-			
-
-			//hashtb_delete(enle); has to delete later
 		}
 
 		hashtb_end(enle);
@@ -431,7 +435,6 @@
 			printf(" Origination Router: %s \n",ne->orig_router);
 		if ( nlsr->detailed_logging )
 			writeLogg(__FILE__,__FUNCTION__,__LINE__," Origination Router: %s \n",ne->orig_router);
-		//ne->next_hop_face == NO_FACE ? printf(" Next Hop Face: NO_NEXT_HOP \n") : printf(" Next Hop Face: %d \n", ne->next_hop_face);
 		
 		int j, nl_element,face_list_element;
 		struct name_list_entry *nle;		
@@ -473,7 +476,7 @@
 			{
 				fle=ef->data;
 				if ( nlsr->debugging )
-					printf(" 	Face: %d Route_Cost: %d \n",fle->next_hop_face,fle->route_cost);
+					printf(" 	Face: %d Route_Cost: %f \n",fle->next_hop_face,fle->route_cost);
 				if ( nlsr->detailed_logging )
 					writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: %d Route_Cost: %d \n",fle->next_hop_face,fle->route_cost);
 				hashtb_next(ef);	
@@ -591,7 +594,7 @@
 				printf("Face Found \n");
 			if ( nlsr->detailed_logging )
 				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Face Found \n");
-			struct face_list_entry *fle;//=(struct face_list_entry *)malloc(sizeof(struct face_list_entry));
+			struct face_list_entry *fle;
 			fle=ef->data;
 			fle->next_hop_face=face_id;
 			fle->route_cost=route_cost;
@@ -606,7 +609,10 @@
 			fle=ef->data;
 			fle->next_hop_face=face_id;
 			fle->route_cost=route_cost;
-			//hashtb_delete(ef);
+
+			
+
+
 		}
 		hashtb_end(ef);
 	}
@@ -650,9 +656,9 @@
 		if ( face_list_element <= 0 )
 		{
 			if ( nlsr->debugging )
-				printf(" 	Face: No Face \n");
+				printf(" Face: No Face \n");
 			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: No Face \n");
+				writeLogg(__FILE__,__FUNCTION__,__LINE__," Face: No Face \n");
 		}
 		else
 		{
@@ -699,7 +705,6 @@
     	
     		hashtb_start(ne->face_list, ef);
 		res1=hashtb_seek(ef, &face_id, sizeof(face_id), 0);
-
 		if ( res1 == HT_OLD_ENTRY )
 		{
 			hashtb_delete(ef);
@@ -718,53 +723,6 @@
 	hashtb_end(e);
 }
 
-int
-delete_old_face_from_npt(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
-{
-	if(flags == CCN_SCHEDULE_CANCEL)
-	{
- 	 	return -1;
-	}
-	
-	nlsr_lock();
-
-	if ( nlsr->debugging )
-		printf("delete_old_face_from_npt\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_old_face_from_npt\n");
-	
-	if ( ev->evdata != NULL )
-	{		
-		if ( nlsr->debugging )
-			printf("Event Data: %s \n",(char *)ev->evdata);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Event Data: %s \n",(char *)ev->evdata);
-		char *sep="|";
-		char *rem;
-		char *orig_router;
-		char *faceid;
-		int face_id;
-
-		char *face_data=(char *)malloc(strlen((char *)ev->evdata)+1);
-		memset(face_data,0,strlen((char *)ev->evdata)+1);
-		memcpy(face_data+strlen(face_data),(char *)ev->evdata,strlen((char *)ev->evdata));
-
-		orig_router=strtok_r(face_data,sep,&rem);
-		faceid=strtok_r(NULL,sep,&rem);
-		face_id=atoi(faceid);
-
-		if ( nlsr->debugging )
-			printf("Orig Router: %s Face: %d \n",orig_router,face_id);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Orig Router: %s Face: %d \n",orig_router,face_id);
-
-		delete_face_from_npt_by_face_id(orig_router,face_id);		
-	}
-
-	nlsr_unlock();
-	
-	return 0;
-}
 
 void 
 clean_old_fib_entries_from_npt(void)
@@ -800,7 +758,7 @@
 		if ( face_list_element <= 0 )
 		{
 			if ( nlsr->debugging )
-				printf(" 	Face: No Face \n");
+				printf(" Face: No Face \n");
 			if ( nlsr->detailed_logging )
 				writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: No Face \n");
 			
@@ -823,17 +781,12 @@
 					for (k=0;k<nl_element;k++)
 					{
 						nle=enle->data;
-
-						//delete all the fib entries here
-
-						//printf("Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);
-
 						if( is_neighbor(nle->name) == 0 )
 						{
 							if ( nlsr->debugging )
 								printf("Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);
 							if ( nlsr->detailed_logging )
-								writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);
+								writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);		
 							add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, fle->next_hop_face);
 						}						
 		
@@ -842,20 +795,39 @@
 					}
 					hashtb_end(enle);
 
-					char faceid[20];
-					memset(faceid,0,20);
-					sprintf(faceid,"%d",fle->next_hop_face);
-					char *evdata=(char *)malloc(strlen(ne->orig_router)+strlen(faceid)+2);
-					memset(evdata,0,strlen(ne->orig_router)+strlen(faceid)+2);					
-					memcpy(evdata+strlen(evdata),ne->orig_router,strlen(ne->orig_router));	
-					memcpy(evdata+strlen(evdata),"|",1);
-					memcpy(evdata+strlen(evdata),faceid,strlen(faceid));					
-	
-					nlsr->event = ccn_schedule_event(nlsr->sched, 1, &delete_old_face_from_npt, (void *)evdata, 0);					
-					
+
+					hashtb_delete(ef);
+					j++;
+						
 				}
-				
-				hashtb_next(ef);	
+				else 
+				{
+					struct name_list_entry *nle;		
+					struct hashtb_enumerator eenle;
+    					struct hashtb_enumerator *enle = &eenle;
+
+					hashtb_start(ne->name_list, enle);
+					nl_element=hashtb_n(ne->name_list);	
+
+					for (k=0;k<nl_element;k++)
+					{
+						nle=enle->data;
+						if(  is_active_neighbor(ne->orig_router) && get_next_hop_face_from_adl(	ne->orig_router ) != fle->next_hop_face )
+						{
+							if ( nlsr->debugging )
+								printf("Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);
+							if ( nlsr->detailed_logging )
+								writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);		
+							add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, fle->next_hop_face);
+						}						
+		
+
+						hashtb_next(enle);
+					}
+					hashtb_end(enle);
+					
+					hashtb_next(ef);
+				}	
 			}
 		}
 		hashtb_end(ef);
@@ -871,9 +843,14 @@
 void
 update_npt_with_new_route(void)
 {
+	if ( nlsr->debugging )
+		printf("update_npt_with_new_route called\n");
+		
 	clean_old_fib_entries_from_npt();
+	print_npt();
 	add_new_fib_entries_to_npt();
-	
+	print_npt();	
+
 	int i, npt_element;
 	
 	struct npt_entry *ne;
@@ -995,7 +972,7 @@
 		get_all_faces_for_orig_router_from_npt(orig_router,faces,route_costs,num_face);
 		sort_faces_by_distance(faces,route_costs,0,num_face);
 		
-
+		/*
 		first_face=num_face-1;		
 	
 		if ( nlsr->multi_path_face_num == 0 )
@@ -1013,6 +990,25 @@
 				last_face=num_face-nlsr->multi_path_face_num;
 			}
 		}
+		*/
+
+		last_face=0;
+		if ( nlsr->max_faces_per_prefix == 0) // add all faces available in routing table
+		{
+			first_face=num_face-1;
+		}
+		else if( nlsr->max_faces_per_prefix > 0)
+		{
+			if ( nlsr->max_faces_per_prefix >= num_face)
+			{
+				first_face=num_face-1;
+			}
+			else if ( nlsr->max_faces_per_prefix < num_face)
+			{
+				first_face=nlsr->max_faces_per_prefix-1;
+			}
+	
+		}
 
 		int i,j, nl_element;
 		struct name_list_entry *nle;		
@@ -1028,7 +1024,7 @@
 			
 			for( j=first_face; j>= last_face; j--)
 			{
-				if ( is_neighbor(orig_router) == 0 )
+				if ( is_active_neighbor(orig_router) == 0 )
 				{
 					if ( nlsr->debugging )
 						printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
@@ -1038,7 +1034,7 @@
 				}
 				else 
 				{
-					if ( j == last_face && is_neighbor(nle->name)==0)
+					if ( j == last_face && is_active_neighbor(nle->name)==0)
 					{
 						if ( nlsr->debugging )
 							printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
diff --git a/nlsr_npt.h b/nlsr_npt.h
index 587c8be..d339ede 100644
--- a/nlsr_npt.h
+++ b/nlsr_npt.h
@@ -22,7 +22,6 @@
 int delete_npt_entry_by_router_and_name_prefix(char *orig_router, char *name_prefix);
 void print_npt(void);
 void delete_orig_router_from_npt(char *orig_router);
-//void update_npt_with_new_route(char * orig_router,int next_hop_face);
 void update_npt_with_new_route(void);
 void destroy_all_face_by_nlsr(void);
 void sort_faces_by_distance(int *faces,int *route_costs,int start,int element);
diff --git a/nlsr_route.c b/nlsr_route.c
index 8537b2e..573fcf9 100644
--- a/nlsr_route.c
+++ b/nlsr_route.c
@@ -1,6 +1,7 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <getopt.h>
 #include <sys/time.h>
@@ -75,47 +76,121 @@
 			print_adj_matrix(adj_matrix,map_element);
 
 		long int source=get_mapping_no(nlsr->router_name);
-		long int *parent=(long int *)malloc(map_element * sizeof(long int));
-		long int *dist=(long int *)malloc(map_element * sizeof(long int));
-
 		int num_link=get_no_link_from_adj_matrix(adj_matrix, map_element ,source);
-		
-		if ( (num_link == 0) || (nlsr->multi_path_face_num <= 1 ) )
-		{	
-			calculate_path(adj_matrix,parent,dist, map_element, source);		
-			print_all_path_from_source(parent,source);
-			print_all_next_hop(parent,source);		
-			update_routing_table_with_new_route(parent, dist,source);
-		}
-		else if ( (num_link != 0) && (nlsr->multi_path_face_num > 1 ) )
+
+		if ( nlsr->is_hyperbolic_calc == 1)
 		{
 			long int *links=(long int *)malloc(num_link*sizeof(long int));
 			long int *link_costs=(long int *)malloc(num_link*sizeof(long int));
 			get_links_from_adj_matrix(adj_matrix, map_element , links, link_costs, source);
-			for ( i=0 ; i < num_link; i++)
+
+			struct hashtb_enumerator ee;
+			struct hashtb_enumerator *e = &ee;
+			for (hashtb_start(nlsr->rev_map, e); e->key != NULL; hashtb_next(e)) 
 			{
-				adjust_adj_matrix(adj_matrix, map_element,source,links[i],link_costs[i]);
+				struct map_entry *me=e->data;
+				if ( me->mapping != source )
+				{
+					long int *faces=(long int *)calloc(num_link,sizeof(long int));
+					double *nbr_dist=(double *)calloc(num_link,sizeof(double));
+					double *nbr_to_dest=(double *)calloc(num_link,sizeof(double));
+					for ( i=0 ; i < num_link; i++)
+					{
+						int face=get_next_hop_face_from_adl(get_router_from_rev_map(links[i]));
+						double dist_to_nbr=get_hyperbolic_distance(source,links[i]);
+						double dist_to_dest_from_nbr=get_hyperbolic_distance(links[i],me->mapping);
+						faces[i]=face;
+						nbr_dist[i]=dist_to_nbr;
+						nbr_to_dest[i]=	dist_to_dest_from_nbr;	
+
+						
+					}
+					sort_hyperbolic_route(nbr_to_dest,nbr_dist, faces,0,num_link);
+					if (nlsr->max_faces_per_prefix == 0 )
+					{
+						for ( i=0 ; i < num_link; i++)
+						{
+							update_routing_table_with_new_hyperbolic_route(me->mapping,faces[i],nbr_to_dest[i]);
+						}				
+					}
+					else if ( nlsr->max_faces_per_prefix > 0 )
+					{
+						if ( num_link <= nlsr->max_faces_per_prefix )
+						{
+							for ( i=0 ; i < num_link; i++)
+							{
+								update_routing_table_with_new_hyperbolic_route(me->mapping,faces[i],nbr_to_dest[i]);
+							}
+						}
+						else if (num_link > nlsr->max_faces_per_prefix)
+						{
+							for ( i=0 ; i < nlsr->max_faces_per_prefix; i++)
+							{
+								update_routing_table_with_new_hyperbolic_route(me->mapping,faces[i],nbr_to_dest[i]);
+							}
+						}
+
+					}
+					free(faces);
+					free(nbr_dist);
+					free(nbr_to_dest);
+				}
+			}
+			hashtb_end(e);
+
+			
+			free(links);
+			free(link_costs);
+		}
+		else if (nlsr->is_hyperbolic_calc == 0 )
+		{
+
+			long int *parent=(long int *)malloc(map_element * sizeof(long int));
+			long int *dist=(long int *)malloc(map_element * sizeof(long int));
+			
+		
+			if ( (num_link == 0) || (nlsr->max_faces_per_prefix == 1 ) )
+			{	
 				calculate_path(adj_matrix,parent,dist, map_element, source);		
 				print_all_path_from_source(parent,source);
 				print_all_next_hop(parent,source);		
 				update_routing_table_with_new_route(parent, dist,source);
 			}
+			else if ( (num_link != 0) && (nlsr->max_faces_per_prefix == 0 || nlsr->max_faces_per_prefix > 1 ) )
+			{
+				long int *links=(long int *)malloc(num_link*sizeof(long int));
+				long int *link_costs=(long int *)malloc(num_link*sizeof(long int));
+				get_links_from_adj_matrix(adj_matrix, map_element , links, link_costs, source);
+				for ( i=0 ; i < num_link; i++)
+				{
+					adjust_adj_matrix(adj_matrix, map_element,source,links[i],link_costs[i]);
+					calculate_path(adj_matrix,parent,dist, map_element, source);		
+					print_all_path_from_source(parent,source);
+					print_all_next_hop(parent,source);		
+					update_routing_table_with_new_route(parent, dist,source);
+				}
 
-			free(links);
-			free(link_costs);
+				free(links);
+				free(link_costs);
+			}
+			free(parent);
+			free(dist);
 		}
+		
+		print_routing_table();
+		print_npt();
 
 		update_npt_with_new_route();
 
 		print_routing_table();
 		print_npt();
 
+
 		for(i = 0; i < map_element; i++)
 		{
 			free(adj_matrix[i]);
 		}
-		free(parent);
-		free(dist);
+		
 		free(adj_matrix);
 		hashtb_destroy(&nlsr->map);
 		hashtb_destroy(&nlsr->rev_map);
@@ -136,7 +211,7 @@
 	//long int *dist=(long int *)malloc(V * sizeof(long int));
 	long int *Q=(long int *)malloc(V * sizeof(long int));
 	long int head=0;
-	/* Initial the Parent */
+	/* Initiate the Parent */
 	for (i = 0 ; i < V; i++)
 	{
 		parent[i]=EMPTY_PARENT;
@@ -180,8 +255,7 @@
 			sort_queue_by_distance(Q,dist,head,V);
 		}
 	}
-	free(Q);
-	//free(dist);	
+	free(Q);	
 }
 
 void
@@ -277,7 +351,9 @@
 {
 	if (parent[dest] != EMPTY_PARENT )
 		print_path(parent,parent[dest]);
-	printf(" %ld",dest);
+
+	if ( nlsr->debugging )
+		printf(" %ld",dest);
 }
 
 int 
@@ -317,6 +393,50 @@
 	
 }
 
+void 
+sort_hyperbolic_route(double *dist_dest,double *dist_nbr, long int *faces,long int start,long int element)
+{
+	long int i,j;
+	double temp_dist;
+	long int temp_face;
+
+	for ( i=start ; i < element ; i ++) 
+	{
+		for( j=i+1; j<element; j ++)
+		{
+			if (dist_dest[i] < dist_dest[j])
+			{
+				temp_dist=dist_dest[j];
+				dist_dest[j]=dist_dest[i];
+				dist_dest[i]=temp_dist;
+
+				temp_dist=dist_nbr[j];
+				dist_nbr[j]=dist_nbr[i];
+				dist_nbr[i]=temp_dist;
+
+				temp_face=faces[j];
+				faces[j]=faces[i];
+				faces[i]=temp_face;
+			}
+			if ( (dist_dest[i] == dist_dest[j]) && (dist_nbr[i] < dist_nbr[j]) )
+			{
+				temp_dist=dist_dest[j];
+				dist_dest[j]=dist_dest[i];
+				dist_dest[i]=temp_dist;
+
+				temp_dist=dist_nbr[j];
+				dist_nbr[j]=dist_nbr[i];
+				dist_nbr[i]=temp_dist;
+
+				temp_face=faces[j];
+				faces[j]=faces[i];
+				faces[i]=temp_face;
+			}
+		}
+	}
+	
+}
+
 void
 print_map(void)
 {
@@ -874,6 +994,12 @@
 void 
 update_routing_table(char * dest_router,int next_hop_face, int route_cost)
 {
+	if ( nlsr->debugging )
+	{
+		printf("update_routing_table called \n");
+		printf("Dest Router: %s Next Hop face: %d Route Cost: %d \n",dest_router,next_hop_face,route_cost);
+	}
+
 	int res,res1;
 	struct routing_table_entry *rte;
 
@@ -906,20 +1032,6 @@
 			fle->route_cost=route_cost;
 		}
 		hashtb_end(ef);
-		
-		/*
-		//updating the face for the router prefix itself
-		if ( (rte->next_hop_face != NO_FACE  || rte->next_hop_face != NO_NEXT_HOP ) && is_neighbor(dest_router)==0 )
-		{
-			add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)dest_router, OP_UNREG, rte->next_hop_face);
-		}
-		if ( (next_hop_face != NO_FACE  || next_hop_face != NO_NEXT_HOP ) && is_neighbor(dest_router)==0 )
-		{
-			add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)dest_router, OP_REG, next_hop_face);
-		}
-
-		rte->next_hop_face=next_hop_face;
-		*/
 	}
 	else if ( res == HT_OLD_ENTRY )
 	{
@@ -984,7 +1096,7 @@
 			{
 				fle=ef->data;
 				if ( nlsr->debugging )
-					printf(" 	Face: %d Route_Cost: %d \n",fle->next_hop_face,fle->route_cost);
+					printf(" 	Face: %d Route_Cost: %f \n",fle->next_hop_face,fle->route_cost);
 				if ( nlsr->detailed_logging )
 					writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: %d Route_Cost: %d \n",fle->next_hop_face,fle->route_cost);
 				hashtb_next(ef);	
@@ -1016,13 +1128,14 @@
 	{
 		writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_empty_rte called\n");
 		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Router: %s \n",(char *)ev->evdata);
-		//writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_routing_table called\n");
 	}
 	
 	if(flags == CCN_SCHEDULE_CANCEL)
 	{
  	 	return -1;
 	}
+
+	nlsr_lock();
 	int res;
 	struct hashtb_enumerator ee;
     	struct hashtb_enumerator *e = &ee;
@@ -1040,6 +1153,8 @@
 	}
 
 	print_routing_table();
+
+	nlsr_unlock();
 	
 	return 0;
 }
@@ -1112,6 +1227,28 @@
 	hashtb_end(e);	
 }
 
+void 
+update_routing_table_with_new_hyperbolic_route(long int dest_router_rev_map_index, long int face, double nbr_to_dest_dist)
+{
+	if ( nlsr->debugging )
+		printf("update_routing_table_with_new_hyperbolic_route called\n");
+	if ( nlsr->detailed_logging )
+		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_routing_table_with_new_hyperbolic_route called\n");
+	
+	char *orig_router=get_router_from_rev_map(dest_router_rev_map_index);
+
+	if (face != NO_NEXT_HOP && face != NO_FACE )
+	{
+		update_routing_table(orig_router,face,nbr_to_dest_dist);
+		if ( nlsr->debugging )
+			printf ("Orig_router: %s Next Hop Face: %ld \n",orig_router,face);
+		if ( nlsr->detailed_logging )
+			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Orig_router: %s Next Hop Face: %ld \n",orig_router,face);
+					
+	}
+	
+
+}
 
 
 void 
@@ -1140,10 +1277,8 @@
 			if (orig_router != NULL )
 			{
 				int next_hop_router_num=get_next_hop_from_calculation(parent,me->mapping,source);
-				//printf(" Next hop router Num: %d ",next_hop_router_num);
 				if ( next_hop_router_num == NO_NEXT_HOP )
 				{
-					//update_npt_with_new_route(orig_router,NO_FACE);
 					if ( nlsr->debugging )
 						printf ("Orig_router: %s Next Hop Face: %d \n",orig_router,NO_FACE);
 					if ( nlsr->detailed_logging )
@@ -1152,9 +1287,7 @@
 				else 
 				{
 					char *next_hop_router=get_router_from_rev_map(next_hop_router_num);
-					//printf("Next hop router name: %s \n",next_hop_router);
 					int next_hop_face=get_next_hop_face_from_adl(next_hop_router);
-					//update_npt_with_new_route(orig_router,next_hop_face);
 					update_routing_table(orig_router,next_hop_face,dist[me->mapping]);
 					if ( nlsr->debugging )
 						printf ("Orig_router: %s Next Hop Face: %d \n",orig_router,next_hop_face);
@@ -1174,9 +1307,15 @@
 int 
 does_face_exist_for_router(char *dest_router, int face_id)
 {
+	if (nlsr->debugging)
+	{
+		printf("does_face_exist_for_router called\n");
+		printf("Dest Router: %s and Face id: %d \n",dest_router, face_id);
+	}
+
 	int ret=0;
 
-	int res,res1;
+	int res;
 	struct routing_table_entry *rte;
 
 	struct hashtb_enumerator ee;
@@ -1188,22 +1327,12 @@
 	if( res == HT_OLD_ENTRY )
 	{
 		rte=e->data;
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(rte->face_list, ef);
-		res1 = hashtb_seek(ef, &face_id, sizeof(face_id), 0);	
-		if( res1 == HT_OLD_ENTRY)
-		{
-			ret=1;									
-		}
-		else if ( res1 == HT_OLD_ENTRY )
-		{
-			hashtb_delete(ef);
-		}
-		hashtb_end(ef);
+		unsigned *v;
+		v = hashtb_lookup(rte->face_list, &face_id, sizeof(face_id));
+		if (v != NULL)
+			ret = 1;
 	}
-	else if( res == HT_NEW_ENTRY )
+	else
 	{
 		hashtb_delete(e);
 	} 
@@ -1212,3 +1341,27 @@
 
 	return ret;
 }
+
+double 
+get_hyperbolic_distance(long int source, long int dest)
+{
+	double distance;
+	char *src_router=get_router_from_rev_map(source);
+	char *dest_router=get_router_from_rev_map(dest);
+
+	double src_r=get_hyperbolic_r(src_router);
+	double src_theta=get_hyperbolic_r(src_router);	
+
+	double dest_r=get_hyperbolic_r(dest_router);
+	double dest_theta=get_hyperbolic_r(dest_router);
+	if ( src_r != -1 && dest_r != -1 )
+	{
+		distance=acosh(cosh(src_r)*cosh(dest_r)-sinh(src_r)*sinh(dest_r)*cos(src_theta-dest_theta));
+	}
+	else 
+	{
+		distance= -1.0;
+	}
+	
+	return distance;
+}
diff --git a/nlsr_route.h b/nlsr_route.h
index b0eef14..b6dff03 100644
--- a/nlsr_route.h
+++ b/nlsr_route.h
@@ -24,7 +24,7 @@
 struct face_list_entry
 {
 	int next_hop_face;
-	int route_cost;
+	double route_cost;
 };
 
 int route_calculate(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
@@ -64,4 +64,8 @@
 void print_all_next_hop(long int *parent,long int source);
 int does_face_exist_for_router(char *dest_router, int face_id);
 
+double get_hyperbolic_distance(long int source, long int dest);
+void sort_hyperbolic_route(double *dist_dest,double *dist_nbr, long int *faces,long int start,long int element);
+void update_routing_table_with_new_hyperbolic_route(long int dest_router_rev_map_index, long int face, double nbr_to_dest_dist);
+
 #endif
diff --git a/nlsrc.c b/nlsrc.c
index 5e35b8c..91a1523 100755
--- a/nlsrc.c
+++ b/nlsrc.c
@@ -21,18 +21,18 @@
 static int 
 usage(char *progname)
 {
-    printf("Usage: %s [OPTIONS...]\n\
-	NLSR API client....\n\
-	nlsrc -s server_ip -p server_port add|del name|neighbor name_prefix [faceX] \n\
-	option -- description\n\n\
-	add|del -- specify whether you want to add or delete.\n\
-	name|neighbor -- specify whether you are adding a name or a neighbor.\n\
-	name_prefix -- name of the prefix for the name|neighbor.\n\
-	faceX -- face ID for neighbor if the third argument is neighbor.\n\n\
-	Examples:\n\
-	1) nlsrc -s 127.0.0.1 -p 9696 add name /ndn/memphis.edu/test \n", progname);
+	printf("Usage: %s [OPTIONS...]\n\
+        NLSR API client....\n\
+        nlsrc -s server_ip -p server_port add|del name|neighbor name_prefix [faceX] \n\
+        option -- description\n\n\
+        add|del -- specify whether you want to add or delete.\n\
+        name|neighbor -- specify whether you are adding a name or a neighbor.\n\
+        name_prefix -- name of the prefix for the name|neighbor.\n\
+        faceX -- face ID for neighbor if the third argument is neighbor.\n\n\
+        Examples:\n\
+        1) nlsrc -s 127.0.0.1 -p 9696 add name /ndn/memphis.edu/test \n", progname);
 
-    exit(1);
+    	exit(1);
 }
 
 int main(int argc, char *argv[])
@@ -41,20 +41,20 @@
 	int len;
 	struct sockaddr_in address;
 	int result;
-	int byteSend;
+	int bytesSent;
 	char *server_address, *server_port;	
 
-	int command_len = 0;
+	int command_len=0;
 	int i;
 
 	if (argc < 8)
-		usage(argv[0]);
+                usage(argv[0]);
 
-	if (strcmp(argv[6], "neighbor") == 0 && argc < 9)
-		usage(argv[0]);
+        if (strcmp(argv[6], "neighbor") == 0 && argc < 9)
+                usage(argv[0]);
 
-	if (strcmp(argv[6], "name") != 0 && strcmp(argv[6], "neighbor") != 0)
-		usage(argv[0]);
+        if (strcmp(argv[6], "name") != 0 && strcmp(argv[6], "neighbor") != 0)
+                usage(argv[0]);
 
 	while ((result = getopt_long(argc, argv, "s:p:", longopts, 0)) != -1) 
 	{
@@ -73,17 +73,14 @@
 	char recv_buffer[1024];
 	bzero(recv_buffer,1024);
 
-	for(i = 5; i < argc; i++)
-		command_len += (strlen(argv[i]) + 1);
-
-	char *command = malloc(command_len);
-	memset(command, 0, command_len + 1);
-
-	for(i = 5; i < argc; i++)
+	for(i=5;i<argc;i++)
+		command_len+=(strlen(argv[i])+1);
+	char *command=malloc(command_len);
+	memset(command, 0, command_len);
+	for(i=5;i<argc;i++)
 	{
-		memcpy(command+strlen(command), argv[i], strlen(argv[i]));
-		
-		if (i < argc - 1)
+		memcpy(command+strlen(command),argv[i],strlen(argv[i]));
+		if ( i < argc-1 )
 			memcpy(command+strlen(command)," ",1);	
 	}
 
@@ -96,21 +93,17 @@
 
 	len = sizeof(address);
 	result = connect(sockfd, (struct sockaddr *)&address, len);
-	
 	if(result == -1) 
 	{
 		perror("oops nlsrc ");
 		exit(1);
 	}
-
 	printf("Command to send: %s \n",command);
-	byteSend=send(sockfd, command, strlen(command),0);
-
+	bytesSent=send(sockfd, command, strlen(command),0);
+	printf("Command len: %d, Bytes sent: %d \n",(int)strlen(command), bytesSent);
 	recv(sockfd, recv_buffer, 1024, 0);
 	printf("%s\n",recv_buffer);
-
 	free(command);
 	close(sockfd);
-
-	return 0;
+	exit(0);
 }
diff --git a/pollux.conf b/pollux.conf
index 495378e..faaa597 100644
--- a/pollux.conf
+++ b/pollux.conf
@@ -1,10 +1,18 @@
-router-name /ndn/memphis.edu/netlab/pollux
-ccnneighbor /ndn/memphis.edu/netlab/macbook face2 10
-ccnneighbor /ndn/memphis.edu/netlab/castor face3 8
-ccnname /ndn/memphis.edu/netlab/pollux/name1
-ccnname /ndn/memphis.edu/netlab/pollux/test
-lsdb-synch-interval 320
-interest-retry 3 
+#----configuration file for macbook----------
+#
+router-name /ndn/memphis.edu/cs/pollux
+ccnneighbor /ndn/memphis.edu/cs/sirius
+ccnname /ndn/memphis.edu/cs/pollux/name1
+#------lsdb-synch-interval-----
+lsdb-synch-interval 350
+interest-retry 2 
 interest-resend-time 5
+lsa-refresh-time 600
+router-dead-interval 900
+multi-path-face-num 2 
+#debug on
 
+topo-prefix /ndn/memphis.edu/nlsr/
+slice-prefix /ndn/memphis.edu/nlsr/LSA/
 
+logdir mylog/ 
diff --git a/utility.c b/utility.c
index b136c67..cf7452a 100644
--- a/utility.c
+++ b/utility.c
@@ -10,6 +10,10 @@
 #include <errno.h>
 #include <sys/stat.h>
 #include <sys/time.h>
+#include<sys/socket.h>
+#include<arpa/inet.h>
+#include<errno.h>
+#include<netdb.h>
 #include <time.h>
 #include <assert.h>
 #ifdef HAVE_CONFIG_H
@@ -17,6 +21,7 @@
 #endif
 
 
+
 #include <ccn/ccn.h>
 #include <ccn/uri.h>
 #include <ccn/keystore.h>
@@ -214,3 +219,58 @@
     	}
 }
 
+
+struct sockaddr_in *
+get_ip_from_hostname(char *hostname )
+{
+ 
+
+    struct addrinfo hints, *servinfo, *p;
+    int res; 
+    struct sockaddr_in * ip;
+    memset(&hints, 0, sizeof hints);
+    hints.ai_family = AF_UNSPEC;
+    hints.ai_socktype = SOCK_STREAM;
+
+    if ( (res = getaddrinfo( hostname , "9696", &hints , &servinfo)) != 0)
+    {
+        fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(res));
+        return NULL;
+    }
+    int i=0;
+    for(p = servinfo; p != NULL; p = p->ai_next)
+    {
+        ip = (struct sockaddr_in *) p->ai_addr;
+	i++;
+   
+    }
+    freeaddrinfo(servinfo);
+    return ip;
+
+
+}
+
+
+
+int 
+get_ip_from_hostname_02(char * hostname , char* ip)
+{
+    struct hostent *he;
+    struct in_addr **addr_list;
+    int i;
+    if ( (he = gethostbyname( hostname ) ) == NULL)
+    {
+        herror("gethostbyname");
+        return 1;
+    }
+    addr_list = (struct in_addr **) he->h_addr_list;
+    for(i = 0; addr_list[i] != NULL; i++)
+    {
+        strcpy(ip , inet_ntoa(*addr_list[i]) );
+        return 0;
+    }
+    return 1;
+}
+
+
+
diff --git a/utility.h b/utility.h
index 6ae550a..f90c281 100644
--- a/utility.h
+++ b/utility.h
@@ -9,4 +9,6 @@
 
 void startLogging(char *loggingDir);
 void writeLogg(const char *source_file, const char *function, const int line, const char *format, ...);
+struct sockaddr_in * get_ip_from_hostname(char *hostname);
+int get_ip_from_hostname_02(char * hostname , char* ip);
 #endif
