diff --git a/nlsr-sync-0.0/1 b/nlsr-sync-0.0/1
new file mode 100755
index 0000000..dfc274e
--- /dev/null
+++ b/nlsr-sync-0.0/1
@@ -0,0 +1,8 @@
+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
new file mode 100755
index 0000000..d92ec7c
--- /dev/null
+++ b/nlsr-sync-0.0/Makefile
@@ -0,0 +1,34 @@
+CC = cc
+CFLAGS = -g -Wall -Wpointer-arith -Wreturn-type -Wstrict-prototypes
+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 utility.c
+NLSRC_SRCS=nlsrc.c
+
+all: $(PROGRAMS)
+
+nlsr: $(NLSR_SRCS)
+	$(CC) $(CFLAGS) $(NLSR_SRCS) -o nlsr $(LIBS) -lm
+
+nlsrc: $(NLSRC_SRCS)
+	$(CC) $(CFLAGS) $(NLSRC_SRCS) -o nlsrc $(LIBS) -lm
+
+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 $(PROGRAMS).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
new file mode 100755
index 0000000..c9070c6
--- /dev/null
+++ b/nlsr-sync-0.0/NLSR_Design.docx
Binary files differ
diff --git a/nlsr-sync-0.0/NLSR_Timing_Diagram.odg b/nlsr-sync-0.0/NLSR_Timing_Diagram.odg
new file mode 100755
index 0000000..820b307
--- /dev/null
+++ b/nlsr-sync-0.0/NLSR_Timing_Diagram.odg
Binary files differ
diff --git a/nlsr-sync-0.0/README.md b/nlsr-sync-0.0/README.md
new file mode 100755
index 0000000..18880a1
--- /dev/null
+++ b/nlsr-sync-0.0/README.md
@@ -0,0 +1,111 @@
+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/macbook.conf b/nlsr-sync-0.0/macbook.conf
new file mode 100755
index 0000000..19b6c30
--- /dev/null
+++ b/nlsr-sync-0.0/macbook.conf
@@ -0,0 +1,17 @@
+#----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/
+#------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
+
+logdir /Users/akmhoque/NLSR2.0
diff --git a/nlsr-sync-0.0/nlsr.c b/nlsr-sync-0.0/nlsr.c
new file mode 100755
index 0000000..e3b43ae
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr.c
@@ -0,0 +1,1099 @@
+#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"
+
+
+#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,*face;
+
+	rtr_name=strtok_r(command,sep,&rem);
+	if(rtr_name==NULL)
+	{
+		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';
+	}
+	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);
+
+	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 && seconds <= 3600 )
+	{
+		nlsr->lsa_refresh_time=seconds;
+	}
+
+}
+
+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 >= 360 && seconds <= 5400 )
+	{
+		nlsr->router_dead_interval=seconds;
+	}
+
+}
+
+void 
+process_command_multi_path_face_num(char *command)
+{
+	if(command==NULL)
+	{
+		printf(" Wrong Command Format ( multi-path-face-num 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 ( multi-path-face-num n)\n");
+		return;
+	}
+
+	number=atoi(num);
+	if ( number >= 0 && number <= 60 )
+	{
+		nlsr->multi_path_face_num=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_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,"multi-path-face-num") )
+	{
+		process_command_multi_path_face_num(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 
+	{
+		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;
+}
+
+char *
+process_api_client_command(char *command)
+{
+	char *msg;
+	msg=(char *)malloc(100);	
+	memset(msg,100,0);
+	
+	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);
+				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 )
+			{
+				add_nbr_to_adl(np,face_id);
+				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 < 0 )
+	{
+		timeout.tv_sec=1;
+		timeout.tv_usec=0;
+	}
+	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;
+	}
+
+	
+	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; 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;
+}
+
+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();	
+
+	/* 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);
+
+	//To Do: has to destroy the face_list one by one 	
+
+	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 = inet_addr("127.0.0.1");
+	server_address.sin_port = 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);
+	
+	
+
+
+	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->multi_path_face_num=MULTI_PATH_FACE_NUM;
+	nlsr->semaphor=NLSR_UNLOCKED;
+
+	nlsr->api_port=API_PORT;
+
+	//create_sync_slice();
+
+	nlsr->topo_prefix=(char *)malloc(strlen("/ndn/routing/nlsr")+1);
+	memset(nlsr->topo_prefix,strlen("/ndn/routing/nlsr")+1,0);
+	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,strlen("/ndn/routing/nlsr/LSA")+1,0);
+	memcpy(nlsr->slice_prefix,"/ndn/routing/nlsr/LSA",strlen("/ndn/routing/nlsr/LSA"));
+
+	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);
+	if ( daemon_mode == 1 )
+	{
+		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);
+
+	create_sync_slice(nlsr->topo_prefix, nlsr->slice_prefix);	
+
+	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);
+
+	print_name_prefix_from_npl();
+	print_adjacent_from_adl();
+	build_and_install_name_lsas();
+	print_name_lsdb();	
+
+	sync_monitor(nlsr->topo_prefix,nlsr->slice_prefix);
+
+	write_name_lsdb_to_repo(nlsr->slice_prefix);
+
+	//write_data_to_repo();
+
+	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, 0);
+			}
+			if (!(nlsr->sched && nlsr->ccn))
+			{	      
+				break;
+			}
+		}
+
+	}
+	
+
+	return 0;
+}
+
diff --git a/nlsr-sync-0.0/nlsr.conf b/nlsr-sync-0.0/nlsr.conf
new file mode 100755
index 0000000..ced844f
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr.conf
@@ -0,0 +1,10 @@
+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
new file mode 100755
index 0000000..095e128
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr.h
@@ -0,0 +1,121 @@
+#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 MULTI_PATH_FACE_NUM 0
+
+#define LINK_METRIC 10
+
+#define NAME_LSA_VALID 1
+#define NAME_LSA_INVALID 0
+
+#define API_PORT 9696
+
+
+struct name_prefix
+{
+	char *name;
+	int length;
+};
+
+struct linkStateDatabase
+{
+	struct hashtb *name_lsdb;
+	struct hashtb *adj_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;
+	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;
+	
+};
+
+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
new file mode 100755
index 0000000..54d8954
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_adl.c
@@ -0,0 +1,919 @@
+#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>
+#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)
+{
+	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;
+		
+
+		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("	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);
+
+	//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);
+}
+
+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;
+}
+
+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;
+}
+
diff --git a/nlsr-sync-0.0/nlsr_adl.h b/nlsr-sync-0.0/nlsr_adl.h
new file mode 100755
index 0000000..5e9fa5a
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_adl.h
@@ -0,0 +1,51 @@
+#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;
+	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);
+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);
+#endif
diff --git a/nlsr-sync-0.0/nlsr_fib.c b/nlsr-sync-0.0/nlsr_fib.c
new file mode 100755
index 0000000..e89e80d
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_fib.c
@@ -0,0 +1,224 @@
+#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"
+
+
+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 = (~0U) >> 1;
+
+	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)
+{
+	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
new file mode 100755
index 0000000..ce5e6d1
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_fib.h
@@ -0,0 +1,11 @@
+#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
new file mode 100755
index 0000000..d6d24ae
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_lsdb.c
@@ -0,0 +1,2099 @@
+#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));
+
+}
+
+
+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)
+{
+	
+	
+	//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);	
+
+	char lsid[10];
+	memset(lsid,0,10);
+	sprintf(lsid,"%ld",ls_id);
+	memcpy(key+strlen(key),slice_prefix,strlen(slice_prefix));
+	memcpy(key+strlen(key),"/",1);
+	memcpy(key+strlen(key),lst,strlen(lst));
+	memcpy(key+strlen(key),"/",1);
+	memcpy(key+strlen(key),lsid,strlen(lsid));
+	memcpy(key+strlen(key),"/",1);
+	memcpy(key+strlen(key),orig_time,strlen(orig_time));
+	memcpy(key+strlen(key),orig_router,strlen(orig_router));
+	
+	//printf("Key: %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 *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;
+		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);
+	//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];
+		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 )
+							{
+								//printf("Added in npt \n");
+								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_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);
+
+			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();
+	
+	//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);
+	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);
+
+
+	/* Filling Up Body Data */
+
+	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);
+
+
+
+	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++;
+
+
+}
+
+
+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);
+	//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 ));
+
+		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)
+				{				
+					//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);
+					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);
+
+		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);
+	//print_adj_lsa(adj_lsa);
+	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)
+{
+	//printf("build_others_adj_lsa called \n");
+	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; 
+}
+
+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)
+{
+	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;
+}
+
+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 )
+		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;
+		//printf("NAME LSA found\n");
+
+		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;
+		//printf("Adj LSA found\n");
+
+		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);
+		free(temp_length);
+		ccn_charbuf_append_string(lsa_data,"|");
+
+		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,"|");
+
+		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);
+		free(temp_nl);
+		ccn_charbuf_append_string(lsa_data,"|");
+
+		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);	
+	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)
+{
+	//printf("delete_name_lsa called \n");
+
+	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);
+	
+	//print_name_lsdb();
+	
+	nlsr_unlock();
+
+	return 0;
+}
+
+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 )
+		writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_adj_lsa called  \n");
+	
+	if(flags == CCN_SCHEDULE_CANCEL)
+	{
+ 	 	return -1;
+	}
+	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 )
+		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;
+	}
+
+	//print_adj_lsdb();
+
+	nlsr_unlock();
+
+	return 0;
+}
+
+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);
+	
+	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);	
+					//printf("Key:%s Length:%d\n",key,(int)strlen(key));
+				
+					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();
+				//lsa_change_count++;
+			}	
+		}
+		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);	
+				//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++;
+			}
+		}
+
+		hashtb_next(e);		
+	}
+
+	hashtb_end(e);
+	
+	free(time_stamp);
+
+	
+}
+
+void
+refresh_adj_lsdb(void)
+{
+	//printf("refresh_adj_lsdb called \n");
+
+	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);
+		//printf("LSA Life Time: %ld \n",lsa_life_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 )
+			{
+				//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 )
+					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 )
+			{
+				//printf("Others Adj LSA need to be deleted\n");
+
+				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);
+				//printf("Adjacent LSA key: %s \n",key);				
+				nlsr->event = ccn_schedule_event(nlsr->sched, 10, &delete_adj_lsa, (void *)key, 0);
+			}
+		}
+
+		
+
+		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();
+
+	//printf("refresh_lsdb called \n");
+
+	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();
+
+	nlsr->event = ccn_schedule_event(nlsr->sched, 60000000, &refresh_lsdb, NULL, 0);
+	
+	nlsr_unlock();
+	return 0;
+}
+
+void
+write_name_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id)
+{
+	printf("Content Preifx: %s\n",repo_content_prefix);
+
+	
+	struct ccn_charbuf *lsa_data=ccn_charbuf_create();		
+	get_name_lsa_data(lsa_data,lsa_id);
+	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);
+		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);
+		
+		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,strlen(key)+1,0);
+		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);
+	
+
+}
diff --git a/nlsr-sync-0.0/nlsr_lsdb.h b/nlsr-sync-0.0/nlsr_lsdb.h
new file mode 100755
index 0000000..4e8a8d1
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_lsdb.h
@@ -0,0 +1,91 @@
+#ifndef _NLSR_LSDB_H_
+#define _NLSR_LSDB_H_
+
+#define LS_TYPE_ADJ 1
+#define LS_TYPE_NAME 2
+
+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;
+};
+
+
+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);
+
+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);
+
+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 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);
+
+#endif
diff --git a/nlsr-sync-0.0/nlsr_ndn.c b/nlsr-sync-0.0/nlsr_ndn.c
new file mode 100755
index 0000000..9af0a05
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_ndn.c
@@ -0,0 +1,1613 @@
+#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);
+
+	//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 
+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(16);
+		memset(raw_data,0,16);
+		sprintf(raw_data,"%ld", nlsr->lsdb_synch_interval);	
+
+		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);
+
+}
+
+
+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,
+        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)
+{
+	//printf("process_incoming_content called \n");
+	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);
+
+	//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);
+	}
+
+}
+
+
+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 )
+		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);
+	//printf("Content data: %s\n",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);
+	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_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
+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);
+	}
+	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
+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);
+
+
+}
+
+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)
+{
+	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);
+		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 info interest on name prefix : %s \n",int_name);
+		if ( nlsr->detailed_logging )
+			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending info 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("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);
+
+}
+
+
+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-sync-0.0/nlsr_ndn.h b/nlsr-sync-0.0/nlsr_ndn.h
new file mode 100755
index 0000000..1feab1e
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_ndn.h
@@ -0,0 +1,37 @@
+#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);
+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-sync-0.0/nlsr_npl.c b/nlsr-sync-0.0/nlsr_npl.c
new file mode 100755
index 0000000..a2e2271
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_npl.c
@@ -0,0 +1,174 @@
+#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
new file mode 100755
index 0000000..4fce119
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_npl.h
@@ -0,0 +1,15 @@
+#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
new file mode 100755
index 0000000..e3c8483
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_npt.c
@@ -0,0 +1,1092 @@
+#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)
+{
+
+	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;
+			}
+		}
+
+		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--)
+			{
+				//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("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 ( 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]);
+					}
+				}
+			}
+			
+			
+			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);
+		
+
+			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;
+				}
+			}			
+
+			for( j=first_face; j>= last_face; j--)
+			{
+
+				if ( is_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_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_delete(enle); has to delete later
+		}
+
+		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);
+		//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;		
+		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: %d \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;//=(struct face_list_entry *)malloc(sizeof(struct face_list_entry));
+			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_delete(ef);
+		}
+		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);
+}
+
+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)
+{
+	
+	
+	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;
+
+						//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);
+							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);
+
+					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_next(ef);	
+			}
+		}
+		hashtb_end(ef);
+		
+			
+		hashtb_next(e);		
+	}
+
+	hashtb_end(e);
+
+}
+
+void
+update_npt_with_new_route(void)
+{
+	clean_old_fib_entries_from_npt();
+	add_new_fib_entries_to_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;
+			}
+		}
+
+		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_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_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
new file mode 100755
index 0000000..587c8be
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_npt.h
@@ -0,0 +1,32 @@
+#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(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);
+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
new file mode 100755
index 0000000..8537b2e
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_route.c
@@ -0,0 +1,1214 @@
+#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 <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);
+		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 ) )
+		{
+			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);
+		}
+
+		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);
+		
+	}
+	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;
+	/* Initial 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);
+	//free(dist);	
+}
+
+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]);
+	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
+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)
+{
+	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);
+		
+		/*
+		//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 )
+	{
+		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: %d \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);
+		//writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_routing_table called\n");
+	}
+	
+	if(flags == CCN_SCHEDULE_CANCEL)
+	{
+ 	 	return -1;
+	}
+	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();
+	
+	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_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);
+				//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 )
+						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);
+					//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);
+					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)
+{
+	int ret=0;
+
+	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, &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);
+	}
+	else if( res == HT_NEW_ENTRY )
+	{
+		hashtb_delete(e);
+	} 
+	
+	hashtb_end(e);
+
+	return ret;
+}
diff --git a/nlsr-sync-0.0/nlsr_route.h b/nlsr-sync-0.0/nlsr_route.h
new file mode 100755
index 0000000..b0eef14
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_route.h
@@ -0,0 +1,67 @@
+#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;
+	int 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);
+
+#endif
diff --git a/nlsr-sync-0.0/nlsr_sync.c b/nlsr-sync-0.0/nlsr_sync.c
new file mode 100644
index 0000000..3839f67
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_sync.c
@@ -0,0 +1,422 @@
+#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"
+
+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;
+
+	lsa_position=get_lsa_position(interest_ccnb,interest_comps);
+
+	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;
+
+	
+}
+
+
+char *
+get_content_by_content_name(char *content_name)
+{
+
+    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);
+            //fprintf(stderr, "== %s\n",ccn_charbuf_as_string(resultbuf));
+            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);
+    }
+    ccn_charbuf_destroy(&resultbuf);
+    ccn_charbuf_destroy(&templ);
+    ccn_charbuf_destroy(&name);   
+	return (char *)ptr;
+}
+
+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;
+
+	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));
+	
+	lsa_position=get_lsa_position(content_name, components);
+
+	res=ccn_name_comp_get(content_name->buf, components,lsa_position+1,&lst, &comp_size);
+	
+	printf("Ls Type: %s\n",lst);
+	ls_type=atoi((char *)lst);
+	if(ls_type == LS_TYPE_NAME)
+	{
+		res=ccn_name_comp_get(content_name->buf, components,lsa_position+2,&lsid, &comp_size);
+		ls_id=atoi((char *)lsid);
+		res=ccn_name_comp_get(content_name->buf, components,lsa_position+3,&origtime, &comp_size);
+		get_name_part(orig_router,content_name,components,3);
+		printf("Ls ID: %s\nOrig Time: %s\nOrig Router: %s\n",lsid,origtime,orig_router->name);
+
+		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 )
+		{
+			printf("New NAME LSA.....\n");	
+			char *content_data=get_content_by_content_name(ccn_charbuf_as_string(uri));
+			printf("Content Data: %s \n",content_data);
+		}
+		else 
+		{
+			printf("Name LSA / Newer Name LSA already xists in LSDB\n");
+			char *content_data=get_content_by_content_name(ccn_charbuf_as_string(uri));
+			printf("Content Data: %s \n",content_data);
+		}
+	}
+	else if(ls_type == LS_TYPE_ADJ)
+	{
+		res=ccn_name_comp_get(content_name->buf, components,lsa_position+2,&origtime, &comp_size);
+		get_name_part(orig_router,content_name,components,2);
+		printf("Orig Time: %s\nOrig Router: %s\n",origtime,orig_router->name);
+	
+		int is_new_adj_lsa=check_is_new_adj_lsa(orig_router->name,(char *)lst,(char *)origtime);
+		if ( is_new_adj_lsa == 1 )
+		{
+			printf("New Adj LSA.....\n");	
+			char *content_data=get_content_by_content_name(ccn_charbuf_as_string(uri));
+			printf("Content Data: %s \n",content_data);			
+		}
+		else
+		{
+
+			printf("Adj LSA / Newer Adj LSA already exists in LSDB\n");
+			char *content_data=get_content_by_content_name(ccn_charbuf_as_string(uri));
+			printf("Content Data: %s \n",content_data);
+		}
+
+	}
+
+	ccn_charbuf_destroy(&uri);
+
+}
+
+int
+sync_callback(struct ccns_name_closure *nc,
+        struct ccn_charbuf *lhash,
+        struct ccn_charbuf *rhash,
+        struct ccn_charbuf *name)
+{
+
+
+    	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);
+
+    	return(0);
+}
+
+
+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_callback;
+    nlsr->ccns = ccns_open(nlsr->ccn, nlsr->slice, nlsr->closure, roothash, NULL);
+
+}
+
+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);
+}
+
+void
+write_data_to_repo(char *data, char *name_prefix)
+{
+
+    struct ccn_charbuf *name = NULL;
+    struct ccn_seqwriter *w = NULL;
+    int blocksize = 1024;
+    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);
+        exit(1);
+    }
+  
+    
+    w = ccn_seqw_create(nlsr->ccn, name);
+    if (w == NULL) {
+        fprintf(stderr, "ccn_seqw_create failed\n");
+        exit(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(nlsr->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");
+            exit(1);
+        }
+    }
+
+
+
+
+	blockread = 0;
+	//struct ccn_charbuf *buf=ccn_charbuf_create();
+	//get_name_lsdb_summary(buf);	
+	//blockread=buf->length;
+
+	blockread=strlen(data);
+
+	if (blockread > 0) {
+        	//res = ccn_seqw_write(w, ccn_charbuf_as_string(buf), blockread);
+		res = ccn_seqw_write(w, data, blockread);	
+        while (res == -1) {
+            ccn_run(nlsr->ccn, 100);
+            	//res = ccn_seqw_write(w, ccn_charbuf_as_string(buf), blockread);
+	       res = ccn_seqw_write(w, data, blockread);
+           }
+    	}
+
+	
+	ccn_run(nlsr->ccn, 1);
+   
+    ccn_seqw_close(w);
+    //ccn_charbuf_destroy(&buf);
+    ccn_charbuf_destroy(&name);
+}
+
+
+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");
+        exit(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);
+  
+    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
new file mode 100644
index 0000000..5fe9a52
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_sync.h
@@ -0,0 +1,8 @@
+#ifndef _NLSR_SYNC_H_
+#define _NLSR_SYNC_H_
+
+void sync_monitor(char *topo_prefix, char *slice_prefix);
+void write_data_to_repo(char *data,char *name_prefix);
+int create_sync_slice(char *topo_prefix, char *slice_prefix);
+
+#endif
diff --git a/nlsr-sync-0.0/nlsrc.c b/nlsr-sync-0.0/nlsrc.c
new file mode 100755
index 0000000..44ce2ad
--- /dev/null
+++ b/nlsr-sync-0.0/nlsrc.c
@@ -0,0 +1,101 @@
+//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\
+	add/del, -- adding/deleting operation\n\
+	name/neighbor, -- Operation for name/neighbor\n\
+	name_name, -- Name prefix for name/neighbor\n\
+	faceX, -- Face Id for neighbor if third argument is neighbor\n", progname);
+
+    exit(1);
+}
+
+int main(int argc, char *argv[])
+{
+	int sockfd;
+	int len;
+	struct sockaddr_in address;
+	int result;
+	int byteSend;
+	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]);
+
+	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,command_len+1,0);
+	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 = 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);
+	byteSend=send(sockfd, command, strlen(command),0);
+	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
new file mode 100755
index 0000000..495378e
--- /dev/null
+++ b/nlsr-sync-0.0/pollux.conf
@@ -0,0 +1,10 @@
+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 
+interest-resend-time 5
+
+
diff --git a/nlsr-sync-0.0/simulation.h b/nlsr-sync-0.0/simulation.h
new file mode 100755
index 0000000..76c4861
--- /dev/null
+++ b/nlsr-sync-0.0/simulation.h
@@ -0,0 +1,8 @@
+#ifndef _SIMULATION_H_
+#define _SIMULATION_H_
+
+
+
+
+
+#endif
diff --git a/nlsr-sync-0.0/todo.txt b/nlsr-sync-0.0/todo.txt
new file mode 100755
index 0000000..77fccea
--- /dev/null
+++ b/nlsr-sync-0.0/todo.txt
@@ -0,0 +1,9 @@
+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
new file mode 100755
index 0000000..e616d20
--- /dev/null
+++ b/nlsr-sync-0.0/transfer.sh
@@ -0,0 +1,5 @@
+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
new file mode 100755
index 0000000..b136c67
--- /dev/null
+++ b/nlsr-sync-0.0/utility.c
@@ -0,0 +1,216 @@
+#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 <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);	
+		}
+    	}
+}
+
diff --git a/nlsr-sync-0.0/utility.h b/nlsr-sync-0.0/utility.h
new file mode 100755
index 0000000..6ae550a
--- /dev/null
+++ b/nlsr-sync-0.0/utility.h
@@ -0,0 +1,12 @@
+#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, ...);
+#endif
