Clean UP old code
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 8eaca94..0000000
--- a/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-CC = gcc
-CFLAGS = -Wall -gdwarf-2 -g3 
-LIBS = -lccn -lccnsync -lcrypto 
-
-PROGRAMS = nlsrc nlsr
-INSTALL_PATH=/usr/local/bin/
-
-NLSR_SRCS=nlsr.c nlsr_ndn.c nlsr_npl.c  nlsr_adl.c nlsr_lsdb.c nlsr_route.c nlsr_npt.c nlsr_fib.c nlsr_sync.c  nlsr_face.c nlsr_km.c nlsr_km_util.c utility.c
-NLSRC_SRCS=nlsrc.c
-
-all: $(PROGRAMS)
-
-nlsr: $(NLSR_SRCS)
-	$(CC) $(CFLAGS) $(NLSR_SRCS) $(LIBS) -lm -o nlsr
-
-nlsrc: $(NLSRC_SRCS)
-	$(CC) $(CFLAGS) $(NLSRC_SRCS) $(LIBS) -lm -o nlsrc
-
-install: $(PROGRAMS)
-	cp $(PROGRAMS) $(INSTALL_PATH)
-	cd $(INSTALL_PATH); chown root:0 $(PROGRAMS); chmod 755 $(PROGRAMS)
-
-uninstall:
-	cd $(INSTALL_PATH); rm -f $(PROGRAMS)
-
-clean:
-	rm -f *.o
-	rm -f $(PROGRAMS)
-	rm -rf *.dSYM
-
-.c.o:
-	$(CC) $(CFLAGS) -c $<
-
-.PHONY: all clean
diff --git a/README b/README
deleted file mode 100644
index b22aa44..0000000
--- a/README
+++ /dev/null
@@ -1,126 +0,0 @@
-Installation:
-
-1: Getting NLSR: 
-
-https://github.com/NDN-Routing/NLSR0.0
-
-2: run make to compile. 
-
-3: Start ccnx daemon (ccnd) and Repo (ccnr).
-
-4: Add '/ndn/keys' route to your neighboring testbed nodes. 
-This can be done by adding routes in your ccnd.conf to all neigbors,
-e.g.
-	add /ndn/keys udp 10.0.XX.XX 
-	add /ndn/keys udp 10.0.YY.YY ...  
-	add	/ndn/keys udp 10.0.ZZ.ZZ
-
-5: Create your keys and publish them through repo. Please have
-	a look at https://github.com/named-data/ndn-testbed-key-suite for details. 
-
-6: create a nlsr configuration file, have a look at
-	macbook.conf and 'Configuration Parameters' section  for details 
-
-7: start nlsr 
-
-
-Configuration Parameter: 
-
-1. router-name </name/prefix/of/the/router> 
-It is a required configuration parameter that is used to set the router name.
-Name prefix of the router must start with `/ndn' and followed by a strict
-hierarchical order of name components up to the hostname of the router. For
-e.g. if router has a hostname host.dept.org.edu pollux.cs.memphis.edu then the
-router name can be `/ndn/org.edu/dept/host..
-
-2. ccnneighbor </name/prefix/of/neighbor> [neighbor_ip_addrr] 
-This parameter is used to configure the neighboring router. Name prefix of a
-neighbor must start with `/ndn. and followed by a strict hierarchical order of
-name component as mentioned for router-name. If a router has a neighbor having
-hostname `neighbor.dept.org.edu' then configuration command would be
-`ccnneighbor /ndn/org.edu/dept/neighbor. The optional parameter,
-[neighbor_ip_addrr], can be provided for explicitly connecting to a given 
-IP. This is useful if there is no entry of the hostname in the DNS. 
-
-3. ccnname </name/prefix/to/be/advertised> 
-ccnname is used to advertise the name prefix of the services hosted by the
-router. Name prefix must follow the ccnx naming convention.
-
-4. topo-prefix <name/prefix/of/repo/topo> 
-It is used to configure the topological prefix of the `sync. slice created for
-nlsr in a repo. Prefix must follow the ccnx naming convention. Default value
-for topo prefix is `/ndn/routing/nlsr'
-
-5. slice-prefix <name/prefix/of/repo/slice>
-This parameter is used to set the sync's slice prefix. All nlsr nodes `must'
-have the same slice prefix and must follow the ccnx naming convention. Default
-value for slice prefix is `/ndn/routing/nlsr/LSA'
-
-6. lsa-refresh-time <sec> 
-It is the time in seconds, after which router will refresh its LSAs. Default
-value = 1800 sec, Min = 240 sec
-
-7. router-dead-interval <sec> 
-It is the time after which router will consider its neighbor dead if it does
-not hear anything for that amount of time. If an LSA generated by neighbor has
-a lifetime greater than router-dead-interval then router will simply discard
-the LSA and update name prefix table, routing table and ccnd FIB accordingly.
-Default value = 3600 sec, Min = 360 sec.
-
-8. interest-retry <number> 
-interest-retry is maximum number of times a router will send same interest if
-the interest is timed out. Default = 3, Min =1 and Max = 10
-
-9. interest-resend-time <sec>
-When an interest is timed out, NLSR waits for `interest-resend-time. before
-sending another interest. The interest is retransmitted up to the value of
-`interest-retry.. If the interest doesn.t get satisfied during this time the
-neighbor will be considered as dead. Default value = 15 sec, Min = 1 sec, Max =
-60 sec 
-
-10. max-faces-per-prefix <number>
-By default NLSR calculates and add faces for all available faces to a prefix.
-Number of faces can be restricted with this parameter, if this is configured
-NLSR will add <number> or faces per prefixes in ccnd FIB.
-
-11. debug <on/off> 
-Enable nlsr debugging by printing out detail messages on the standard output.
-By default it is off. 
-
-12. logdir </directory/for/logging/> 
-NLSR will start writing log in logdir folder. If logdir is not configured NLSR
-will create a log directory name nlsrLog in user home directory and write log
-into that folder.
-
-13. tunnel-type <udp | tcp> 
-This is used to specify the tunnel type that NLSR should create for building an
-overlay network. By default NLSR creates udp tunnels.
-
-**Following Commands are only required for hyperbolic routing**
-
-14. hyperbolic-routing <on|dry_run> 
-This option enables hyperbolic routing. With option on, link state routing
-doesn't work while with dry_run option route is calculated by Link State 
-routing and hyperbolic routes are just recorded only in log file.Following 
-field is required if hyperbolic routing is on. 
-
-15. hyperbolic-cordinate <radius> <theta> 
-Polar coordinates of a node in a form of radius and theta. Currently, calculation 
-of the polar coordinates is an offline process and done by 
-the operator of a site. 
-
-** Hyperbolic Commands End here **
-
-16. keystore-path </path/to/keystore/file name(.ccnx_keystore)>
-Path to the keystore. The keystore folder is usually created  by
-ccninitkeystore. Keys in this folder will be used by NLSR to sign the packets. 
-
-17. root-key-prefix </key/prefix>   
-Name prefix of the root key; the site key should be signed by this key.  
-e.g. root-key-prefix /ndn/keys
-
-18. site-name </name/prefix/of/site> 
-Name of the site of which this router is a part. 
-
-19. network </name/of/network>
-Name of the networks router belongs to 
diff --git a/key_setup.sh b/key_setup.sh
deleted file mode 100755
index 85a83f7..0000000
--- a/key_setup.sh
+++ /dev/null
@@ -1,75 +0,0 @@
-#Use this script to setup your keys. 
-#!/bin/bash
-
-EXPECTED_ARGS=3 #site, operator, router
-E_BADARGS=65
-if [ $# -ne $EXPECTED_ARGS ]
-then
-  echo "Usage: `basename $0` <site name> <operator name> <router name>"
-  echo "Example: `basename $0` memphis.edu user1 memphis.edu/cs/rtr1 (full router name without /ndn/ prefix" 
-  exit $E_BADARGS
-fi
-
-
-RESULT=`ps -a | sed -n /ccnr/p`
-
-if [ "${RESULT:-null}" = null ]; then
-  echo "ccnr not running, quitting"
-  exit
-fi
-
-
-KSUITE=${HOME}/ndn-testbed-key-suite
-echo $KSUITE
-if [ ! -d ${KSUITE} ]; then
-    echo "This script requires key signing suite available at:"
-	echo "git://github.com/named-data/ndn-testbed-key-suite.git"
-	echo "If you already have it, set the variable KSUITE of the script accordingly"
-	exit
-fi
-
-SITE=$1
-OP=$2
-RTR=$3
-
-if [ ! -d ${SITE}_key ]; then
-	mkdir ${SITE}_key
-	ccninitkeystore ${SITE}_key
-fi
-
-if [ ! -d ${OP}_key ]; then
-	mkdir ${OP}_key
-	ccninitkeystore ${OP}_key
-fi
-
-if [ ! -d "router_key" ]; then
-	mkdir router_key
-	ccninitkeystore router_key
-fi
-
-if [ ! -d "nlsr_key" ]; then
-	mkdir nlsr_key
-	ccninitkeystore nlsr_key
-fi
-
-
-
-
-$KSUITE/bin/ndn-extract-public-key.sh -i ${SITE}_key/.ccnx/.ccnx_keystore -o ${SITE}_key/$SITE.pem
-$KSUITE/bin/ndn-extract-public-key.sh -i ${OP}_key/.ccnx/.ccnx_keystore -o ${OP}_key/$OP.pem
-$KSUITE/bin/ndn-extract-public-key.sh -i router_key/.ccnx/.ccnx_keystore -o router_key/router.pem
-$KSUITE/bin/ndn-extract-public-key.sh -i nlsr_key/.ccnx/.ccnx_keystore -o nlsr_key/nlsr.pem
-
-.$KSUITE/sign.sh -s
-
-#signing operator key
-echo "$KSUITE/bin/ndn-publish-key.sh -i "$OP" -a "$SITE" -f ${OP}_key/$OP.pem -F ${SITE}_key/.ccnx/ -P /ndn/keys/$SITE -p /ndn/keys/$SITE/%C1.O.N.Start/$OP -x 365"
-$KSUITE/bin/ndn-publish-key.sh -i "$OP" -a "$SITE" -f ${OP}_key/$OP.pem -F ${SITE}_key/.ccnx/ -P /ndn/keys/$SITE -p /ndn/keys/$SITE/%C1.O.N.Start/$OP -x 365
-
-#signing routing key
-echo "$KSUITE/bin/ndn-publish-key.sh -i "$RTR" -a "$SITE" -f router_key/router.pem -F ${OP}_key/.ccnx/ -P /ndn/keys/$SITE/%C1.O.N.Start/$OP -p /ndn/keys/$SITE/%C1.R.N.Start/ndn/$RTR -x 365"
-$KSUITE/bin/ndn-publish-key.sh -i "$RTR" -a "$SITE" -f router_key/router.pem -F ${OP}_key/.ccnx/ -P /ndn/keys/$SITE/%C1.O.N.Start/$OP -p /ndn/keys/$SITE/%C1.R.N.Start/ndn/$RTR -x 365
-
-#signing nlsr key
-echo "$KSUITE/bin/ndn-publish-key.sh -i "NLSR" -a "$RTR" -f nlsr_key/nlsr.pem  -F router_key/.ccnx/ -P /ndn/keys/$SITE/%C1.R.N.Start/ndn/$SITE/$RTR -p /ndn/keys/$SITE/%C1.R.N.Start/ndn/$RTR/nlsr -x 365"
-$KSUITE/bin/ndn-publish-key.sh -i "NLSR" -a "$RTR" -f nlsr_key/nlsr.pem  -F router_key/.ccnx/ -P /ndn/keys/$SITE/%C1.R.N.Start/ndn/$SITE/$RTR -p /ndn/keys/$SITE/%C1.R.N.Start/ndn/$RTR/nlsr -x 365
diff --git a/macbook.conf b/macbook.conf
deleted file mode 100644
index efe4f59..0000000
--- a/macbook.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-#----configuration file for macbook----------
-#
-router-name /ndn/memphis.edu/cs/pollux
-ccnneighbor /ndn/memphis.edu/cs/gemeni
-ccnneighbor /ndn/memphis.edu/cs/altair
-#ccnneighbor /ndn/memphis.edu/cs/pollux 141.225.11.132
-ccnname /ndn/memphis.edu/macbook/patterson
-ccnname /ndn/memphis.edu/macbook/houston/
-#------lsdb-synch-interval-----
-#lsdb-synch-interval 350
-interest-retry 2 
-interest-resend-time 5
-lsa-refresh-time 600
-router-dead-interval 900
-max-faces-per-prefix 1 
-debug on
-#hyperbolic-routing on
-hyperbolic-cordinate 1234.0 0.875
-tunnel-type udp
-
-keystore-path /Users/akmhoque/CCN_KEY/nlsr_key_store/.ccnx/.ccnx_keystore
-root-key-prefix /ndn/keys
-site-name memphis.edu
-
-topo-prefix /ndn/routing/nlsr/
-slice-prefix /ndn/routing/nlsr/LSA
-
-logdir /Users/akmhoque/NLSR2.0
diff --git a/nlsr.c b/nlsr.c
deleted file mode 100644
index e4183ee..0000000
--- a/nlsr.c
+++ /dev/null
@@ -1,1505 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <assert.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-#include <ccn/sync.h>
-#include <ccn/seqwriter.h>
-#include <ccn/ccn_private.h>
-
-#include "nlsr.h"
-#include "nlsr_ndn.h"
-#include "nlsr_lsdb.h"
-#include "utility.h"
-#include "nlsr_npl.h"
-#include "nlsr_adl.h"
-#include "nlsr_npt.h"
-#include "nlsr_route.h"
-#include "nlsr_sync.h"
-#include "nlsr_face.h"
-#include "nlsr_fib.h"
-#include "nlsr_km.h"
-
-
-#define ON_ERROR_DESTROY(resval) \
-{           \
-	if ((resval) < 0) { \
-		nlsr_destroy(); \
-		exit(1);\
-	} \
-}
-
-
-#define ON_ERROR_EXIT(resval) \
-{           \
-	if ((resval) < 0) { \
-		exit(1); \
-	} \
-}
-
-struct option longopts[] =
-{
-	{ "daemon",      no_argument,       NULL, 'd'},
-	{ "config_file", required_argument, NULL, 'f'},
-	{ "api_port",    required_argument, NULL, 'p'},
-	{ "help",        no_argument,       NULL, 'h'},
-	{ 0 }
-};
-
-	static int 
-usage(char *progname)
-{
-
-	printf("Usage: %s [OPTIONS...]\n\
-			NDN routing....\n\
-			-d, --daemon        Run in daemon mode\n\
-			-f, --config_file   Specify configuration file name\n\
-			-p, --api_port      port where api client will connect\n\
-			-h, --help          Display this help message\n", progname);
-
-	exit(1);
-}
-
-void ndn_rtr_gettime(const struct ccn_gettime *self, struct ccn_timeval *result)
-{
-	struct timeval now = {0};
-	gettimeofday(&now, 0);
-	result->s = now.tv_sec;
-	result->micros = now.tv_usec;
-}
-
-static struct ccn_gettime ndn_rtr_ticker = {
-	"timer",
-	&ndn_rtr_gettime,
-	1000000,
-	NULL
-};
-
-	void
-nlsr_lock(void)
-{
-	nlsr->semaphor=NLSR_LOCKED;
-}
-
-	void
-nlsr_unlock(void)
-{
-	nlsr->semaphor=NLSR_UNLOCKED;
-}
-
-	void 
-nlsr_stop_signal_handler(int sig)
-{
-	signal(sig, SIG_IGN);
-	nlsr_destroy();
-	exit(0);	
-}
-
-	void  
-daemonize_nlsr(void)
-{
-	//int ret;
-	pid_t process_id = 0;
-	pid_t sid = 0;
-	process_id = fork();
-	if (process_id < 0)
-	{
-		printf("Daemonization failed!\n");
-		ON_ERROR_DESTROY(process_id);
-	}
-	if (process_id > 0)
-	{
-		printf("Process daemonized. Process id: %d \n", process_id);
-		//ret=process_id;
-		exit(0);
-	}
-
-	umask(0);
-	sid = setsid();
-	if(sid < 0)
-	{
-		ON_ERROR_DESTROY(sid);		
-	}
-
-	chdir("/");	
-	//close(STDIN_FILENO);
-	//close(STDOUT_FILENO);
-	//close(STDERR_FILENO);
-}
-
-	void 
-process_command_ccnneighbor(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( ccnneighbor router_name faceX)\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *rtr_name;
-	char *nbr_ip_addr;
-	int is_ip_configured=0;
-	char *ip_addr=(char *)calloc(20,sizeof(char));
-
-	rtr_name=strtok_r(command,sep,&rem);
-	if(rtr_name==NULL)
-	{
-		printf(" Wrong Command Format ( ccnneighbor router_name faceX)\n");
-		return;
-	}
-	if ( rtr_name[strlen(rtr_name)-1] == '/' )
-	{
-		rtr_name[strlen(rtr_name)-1]='\0';
-	}
-
-	if (rem != NULL )
-	{
-		nbr_ip_addr=strtok_r(NULL,sep,&rem);
-		if ( nbr_ip_addr != NULL)
-			is_ip_configured=1;
-	}
-	struct name_prefix *nbr=(struct name_prefix *)calloc(1,sizeof(struct name_prefix ));
-	nbr->name=(char *)calloc(strlen(rtr_name)+1,sizeof(char));
-	memcpy(nbr->name,rtr_name,strlen(rtr_name)+1);
-	nbr->length=strlen(rtr_name)+1;
-
-
-	if ( !is_ip_configured )
-	{
-		struct name_prefix *nbr_name=(struct name_prefix *)calloc(1,sizeof(struct name_prefix ));
-		get_host_name_from_command_string(nbr_name,nbr->name,0);
-		if ( nlsr->debugging)
-			printf("Hostname of neighbor: %s ",nbr_name->name);
-		get_ip_from_hostname_02(nbr_name->name,ip_addr);
-		if ( nlsr->debugging)
-			printf("IP Address: %s \n",ip_addr);
-		free(nbr_name->name);
-		free(nbr_name);
-	}
-	else
-	{
-		memcpy(ip_addr,nbr_ip_addr,strlen(nbr_ip_addr)+1);
-		if (nlsr->debugging)
-		{
-			printf("Name of neighbor: %s ",nbr->name);
-			printf("IP Address: %s \n",ip_addr);
-		}
-	}
-	add_nbr_to_adl(nbr,0,ip_addr);
-
-	free(ip_addr);
-	free(nbr->name);
-	free(nbr);
-}
-
-	void 
-process_command_ccnname(char *command)
-{
-
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( ccnname /name/prefix)\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *name;
-	name=strtok_r(command,sep,&rem);
-	if(name==NULL)
-	{
-		printf(" Wrong Command Format ( ccnname /name/prefix/ )\n");
-		return;
-	}
-
-	printf("Name Prefix: %s \n",name);
-
-	if ( name[strlen(name)-1] == '/' )
-		name[strlen(name)-1]='\0';
-
-	struct name_prefix *np=(struct name_prefix *)calloc(1,sizeof(struct name_prefix ));
-	np->name=(char *)calloc(strlen(name)+1,sizeof(char));
-	//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 *)calloc(strlen(rtr_name)+1,sizeof(char));
-	//memset(nlsr->router_name,0,strlen(rtr_name)+1);
-	memcpy(nlsr->router_name,rtr_name,strlen(rtr_name)+1);
-
-
-}
-
-
-	void 
-process_command_interest_retry(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( interest-retry number )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *retry;
-	long int retry_number;
-
-	retry=strtok_r(command,sep,&rem);
-	if(retry==NULL)
-	{
-		printf(" Wrong Command Format ( interest-retry number)\n");
-		return;
-	}
-
-	retry_number=atoi(retry);
-	if ( retry_number >= 1 && retry_number<=10 )
-	{
-		nlsr->interest_retry=retry_number;
-	}
-
-}
-
-	void 
-process_command_interest_resend_time(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( interest-resend-time secs )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *secs;
-	long int seconds;
-
-	secs=strtok_r(command,sep,&rem);
-	if(secs==NULL)
-	{
-		printf(" Wrong Command Format ( interest-resend-time secs)\n");
-		return;
-	}
-
-	seconds=atoi(secs);
-	if ( seconds <= 60 && seconds >= 1 )
-	{
-		nlsr->interest_resend_time=seconds;
-	}
-}
-
-
-	void 
-process_command_lsa_refresh_time(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( lsa-refresh-time secs )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *secs;
-	long int seconds;
-
-	secs=strtok_r(command,sep,&rem);
-	if(secs==NULL)
-	{
-		printf(" Wrong Command Format ( lsa-refresh-time secs)\n");
-		return;
-	}
-
-	seconds=atoi(secs);
-	if ( seconds >= 240)
-	{
-		nlsr->lsa_refresh_time=seconds;
-		if ( nlsr->router_dead_interval < nlsr->lsa_refresh_time * 2 )
-		{
-			nlsr->router_dead_interval=2*nlsr->lsa_refresh_time;
-		}
-	}
-
-}
-
-	void 
-process_command_router_dead_interval(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( router-dead-interval secs )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *secs;
-	long int seconds;
-
-	secs=strtok_r(command,sep,&rem);
-	if(secs==NULL)
-	{
-		printf(" Wrong Command Format ( router-dead-interval secs)\n");
-		return;
-	}
-
-	seconds=atoi(secs);
-	if ( seconds >= 480 )
-	{
-		nlsr->router_dead_interval=seconds;
-		if ( nlsr->router_dead_interval < nlsr->lsa_refresh_time * 2 )
-		{
-			nlsr->router_dead_interval=2*nlsr->lsa_refresh_time;
-		}
-	}
-
-}
-
-	void 
-process_command_max_faces_per_prefix(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( max-faces-per-prefix n )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *num;
-	long int number;
-
-	num=strtok_r(command,sep,&rem);
-	if(num==NULL)
-	{
-		printf(" Wrong Command Format ( max-faces-per-prefix n)\n");
-		return;
-	}
-
-	number=atoi(num);
-	if ( number >= 0 && number <= 60 )
-	{
-		nlsr->max_faces_per_prefix=number;
-	}
-
-}
-
-	void 
-process_command_logdir(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( logdir /path/to/logdir )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *dir;
-
-	dir=strtok_r(command,sep,&rem);
-	if(dir==NULL)
-	{
-		printf(" Wrong Command Format ( logdir /path/to/logdir/ )\n");
-		return;
-	}
-	//if ( nlsr->logDir)
-		//free(nlsr->logDir);
-	nlsr->logDir=(char *)calloc(strlen(dir)+1,sizeof(char));
-	memcpy(nlsr->logDir,dir,strlen(dir)+1);
-}
-
-	void 
-process_command_detailed_log(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( detailed-log on/off )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *on_off;
-
-	on_off=strtok_r(command,sep,&rem);
-	if(on_off==NULL)
-	{
-		printf(" Wrong Command Format ( detailed-log on/off )\n");
-		return;
-	}
-
-	if ( strcmp(on_off,"ON") == 0  || strcmp(on_off,"on") == 0)
-	{
-		nlsr->detailed_logging=1;
-	}
-}
-
-	void 
-process_command_debug(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( debug on/off )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *on_off;
-
-	on_off=strtok_r(command,sep,&rem);
-	if(on_off==NULL)
-	{
-		printf(" Wrong Command Format ( debug on/off )\n");
-		return;
-	}
-
-	if ( strcmp(on_off,"ON") == 0 || strcmp(on_off,"on") == 0 )
-	{
-		nlsr->debugging=1;
-	}
-}
-
-
-	void 
-process_command_topo_prefix(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( topo-prefix )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *topo_prefix;
-
-	topo_prefix=strtok_r(command,sep,&rem);
-	if(topo_prefix==NULL)
-	{
-		printf(" Wrong Command Format (  topo-prefix /name/prefix  )\n");
-		return;
-	}
-	else
-	{
-		if( nlsr->topo_prefix != NULL)	
-			free(nlsr->topo_prefix);
-		if ( topo_prefix[strlen(topo_prefix)-1] == '/' )
-			topo_prefix[strlen(topo_prefix)-1]='\0';
-		//if(nlsr->topo_prefix)
-			//free(nlsr->topo_prefix);
-		nlsr->topo_prefix=(char *)calloc(strlen(topo_prefix)+1,sizeof(char));
-		memcpy(nlsr->topo_prefix,topo_prefix,strlen(topo_prefix)+1);
-		printf ("Topo prefix is: %s\n", nlsr->topo_prefix);
-	}
-}
-
-
-	void 
-process_command_slice_prefix(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( slice-prefix /name/prefix )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *slice_prefix;
-
-	slice_prefix=strtok_r(command,sep,&rem);
-	if(slice_prefix==NULL)
-	{
-		printf(" Wrong Command Format (  slice-prefix /name/prefix  )\n");
-		return;
-	}
-	else
-	{
-		if ( nlsr->slice_prefix != NULL)
-			free(nlsr->slice_prefix);
-		if ( slice_prefix[strlen(slice_prefix)-1] == '/' )
-			slice_prefix[strlen(slice_prefix)-1]='\0';
-		nlsr->slice_prefix=(char *)calloc(strlen(slice_prefix)+1,sizeof(char));
-		memcpy(nlsr->slice_prefix,slice_prefix,strlen(slice_prefix)+1);
-		printf("Slice prefix: %s \n",nlsr->slice_prefix);
-	}
-}
-
-
-	void 
-process_command_root_key_prefix(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( root-key-prefix /name/prefix )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *root_key_prefix;
-
-	root_key_prefix=strtok_r(command,sep,&rem);
-	if(root_key_prefix==NULL)
-	{
-		printf(" Wrong Command Format (  root-key-prefix /name/prefix  )\n");
-		return;
-	}
-	else
-	{
-		if ( nlsr->root_key_prefix != NULL)
-			free(nlsr->root_key_prefix);
-		if ( root_key_prefix[strlen(root_key_prefix)-1] == '/' )
-			root_key_prefix[strlen(root_key_prefix)-1]='\0';
-		nlsr->root_key_prefix=(char *)calloc(strlen(root_key_prefix)+1,sizeof(char));
-		memcpy(nlsr->root_key_prefix,root_key_prefix,strlen(root_key_prefix)+1);
-		printf("Root key prefix: %s \n",nlsr->root_key_prefix);
-	}
-}
-
-	void 
-process_command_hyperbolic_routing(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( hyperbolic-routing on)\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *on_off;
-
-	on_off=strtok_r(command,sep,&rem);
-	if(on_off==NULL)
-	{
-		printf(" Wrong Command Format ( hyperbolic-routing on )\n");
-		return;
-	}
-
-	if ( strcmp(on_off,"ON") == 0 || strcmp(on_off,"on") == 0 )
-	{
-		nlsr->is_hyperbolic_calc=1;
-	}
-}
-
-	void
-process_command_hyperbolic_cordinate(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( hyperbolic r 0 )\n");
-		return;
-	}
-
-	char *rem;
-	const char *sep=" \t\n\r";
-	char *radious;
-	char *theta;
-
-	radious=strtok_r(command,sep,&rem);
-	if (radious == NULL )
-	{
-		printf(" Wrong Command Format ( hyperbolic r 0 )\n");
-		return;
-	}
-
-	theta=strtok_r(NULL,sep,&rem);
-	if (theta == NULL )
-	{
-		printf(" Wrong Command Format ( hyperbolic r 0 )\n");
-		return;
-	}
-
-	nlsr->cor_r=strtof(radious,NULL);
-	nlsr->cor_theta=strtof(theta,NULL);
-
-}
-
-	void 
-process_command_tunnel_type(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( tunnel-type udp/tcp)\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *on_off;
-
-	on_off=strtok_r(command,sep,&rem);
-	if(on_off==NULL)
-	{
-		printf(" Wrong Command Format ( tunnel-type udp/tcp )\n");
-		return;
-	}
-
-	if ( strcmp(on_off,"TCP") == 0 || strcmp(on_off,"tcp") == 0 )
-	{
-		nlsr->tunnel_type=IPPROTO_TCP;
-	}
-	else if ( strcmp(on_off,"UDP") == 0 || strcmp(on_off,"udp") == 0 )
-	{
-		nlsr->tunnel_type=IPPROTO_UDP;
-	}
-}
-
-void 
-process_command_keystore_passphrase(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( keystore-passphrase passphrase )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *passphrase;
-
-	passphrase=strtok_r(command,sep,&rem);
-	if(passphrase==NULL)
-	{
-		printf(" Wrong Command Format ( keystore-passphrase passphrase )\n");
-		return;
-	}
-
-	if( nlsr->keystore_passphrase)
-		free(nlsr->keystore_passphrase);
-	nlsr->keystore_passphrase=(char *)calloc(strlen(passphrase)+1,sizeof(char));
-	memcpy(nlsr->keystore_passphrase,passphrase,strlen(passphrase));
-
-	
-}
-
-
-void 
-process_command_keystore_path(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( keystore-path path/to/.ccnx_keystore )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *path;
-
-	path=strtok_r(command,sep,&rem);
-	if(path==NULL)
-	{
-		printf(" Wrong Command Format ( keystore-path path/to/.ccnx_keystore )\n");
-		return;
-	}
-
-	if( nlsr->keystore_path)
-		free(nlsr->keystore_path);
-	nlsr->keystore_path=(char *)calloc(strlen(path)+1,sizeof(char));
-	memcpy(nlsr->keystore_path,path,strlen(path));
-	
-}
-
-
-
-void 
-process_command_site_name(char *command)
-{
-	if(command==NULL)
-	{
-		printf(" Wrong Command Format ( site-name site/name/prefix )\n");
-		return;
-	}
-	char *rem;
-	const char *sep=" \t\n";
-	char *site_name;
-
-	site_name=strtok_r(command,sep,&rem);
-	if(site_name==NULL)
-	{
-		printf(" Wrong Command Format ( site-name site/name/prefix )\n");
-		return;
-	}
-
-	if( nlsr->site_name)
-		free(nlsr->site_name);
-
-	if ( site_name[strlen(site_name)-1] == '/' )
-			site_name[strlen(site_name)-1]='\0';
-
-	nlsr->site_name=(char *)calloc(strlen(site_name)+1,sizeof(char));
-	memcpy(nlsr->site_name,site_name,strlen(site_name));
-	printf("Site Name prefix: %s \n",nlsr->site_name);
-	
-}
-
-
-	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,"interest-retry") )
-	{
-		process_command_interest_retry(remainder);
-	}
-	else if(!strcmp(cmd_type,"interest-resend-time") )
-	{
-		process_command_interest_resend_time(remainder);
-	}
-	else if(!strcmp(cmd_type,"lsa-refresh-time") )
-	{
-		process_command_lsa_refresh_time(remainder);
-	}
-	else if(!strcmp(cmd_type,"router-dead-interval") )
-	{
-		process_command_router_dead_interval(remainder);
-	}
-	else if(!strcmp(cmd_type,"max-faces-per-prefix") )
-	{
-		process_command_max_faces_per_prefix(remainder);
-	}
-	else if(!strcmp(cmd_type,"logdir") )
-	{
-		process_command_logdir(remainder);
-	}
-	else if(!strcmp(cmd_type,"detailed-log") )
-	{
-		process_command_detailed_log(remainder);
-	}
-	else if(!strcmp(cmd_type,"debug") )
-	{
-		process_command_debug(remainder);
-	}
-	else if(!strcmp(cmd_type,"topo-prefix") )
-	{
-		process_command_topo_prefix(remainder);
-	}
-	else if(!strcmp(cmd_type,"slice-prefix") )
-	{
-		process_command_slice_prefix(remainder);
-	}
-	else if(!strcmp(cmd_type,"hyperbolic-cordinate") )
-	{
-		process_command_hyperbolic_cordinate(remainder);
-	}
-	else if(!strcmp(cmd_type,"hyperbolic-routing") )
-	{
-		process_command_hyperbolic_routing(remainder);
-	}
-	else if(!strcmp(cmd_type,"tunnel-type") )
-	{
-		process_command_tunnel_type(remainder);
-	}
-	else if(!strcmp(cmd_type,"site-name") )
-	{
-		process_command_site_name(remainder);
-	}
-	else if(!strcmp(cmd_type,"keystore-path") )
-	{
-		process_command_keystore_path(remainder);
-	}
-	else if(!strcmp(cmd_type,"keystore-passphrase") )
-	{
-		process_command_keystore_passphrase(remainder);	
-	}
-	else if(!strcmp(cmd_type,"root-key-prefix") )
-	{
-		process_command_root_key_prefix(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");
-		return -1;	
-	}
-
-	while(fgets((char *)buf, sizeof(buf), cfg))
-	{
-		len=strlen(buf);
-		if(buf[len-1] == '\n')
-			buf[len-1]='\0';
-		if ( buf[0] != '#' && buf[0] != '!') 
-			process_conf_command(buf);	
-	}
-
-	fclose(cfg);
-
-	return 0;
-}
-
-
-	void
-add_faces_for_nbrs(void)
-{	
-	int i, adl_element;
-	struct ndn_neighbor *nbr;
-
-	struct hashtb_enumerator ee;
-	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-
-	for(i=0;i<adl_element;i++)
-	{
-		nbr=e->data;
-		int face_id=add_ccn_face(nlsr->ccn, (const char *)nbr->neighbor->name, 
-				(const char *)nbr->ip_address, 9695,nlsr->tunnel_type);
-		update_face_to_adl_for_nbr(nbr->neighbor->name, face_id);		
-		add_delete_ccn_face_by_face_id(nlsr->ccn,
-				(const char *)nlsr->topo_prefix, OP_REG, face_id,(~0U) >> 1);
-		add_delete_ccn_face_by_face_id(nlsr->ccn, 
-				(const char *)nlsr->slice_prefix, OP_REG, face_id,(~0U) >> 1);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-	void
-destroy_faces_for_nbrs(void)
-{	
-	int i, adl_element;
-	struct ndn_neighbor *nbr;
-
-	struct hashtb_enumerator ee;
-	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-
-	for(i=0;i<adl_element;i++)
-	{
-		nbr=e->data;
-		if ( nbr->face > 0 )
-		{	
-			add_delete_ccn_face_by_face_id(nlsr->ccn, 
-					(const char *)nlsr->topo_prefix, OP_UNREG, nbr->face,(~0U) >> 1);
-			add_delete_ccn_face_by_face_id(nlsr->ccn, 
-					(const char *)nbr->neighbor->name,OP_UNREG,nbr->face,(~0U) >> 1);
-			add_delete_ccn_face_by_face_id(nlsr->ccn, 
-					(const char *)nlsr->slice_prefix, OP_UNREG, nbr->face,(~0U) >> 1);
-		}
-		hashtb_next(e);		
-	}
-	hashtb_end(e);
-}
-
-
-char *
-process_api_client_command(char *command)
-{
-	char *msg;
-	msg=(char *)malloc(100);	
-	memset(msg,0,100);
-
-	const char *sep=" \t\n";
-	char *rem=NULL;
-	char *cmd_type=NULL;
-	char *op_type=NULL;
-	char *name=NULL;
-	char *face=NULL;
-	int face_id;
-	int res;
-
-	op_type=strtok_r(command,sep,&rem);
-	cmd_type=strtok_r(NULL,sep,&rem);
-	name=strtok_r(NULL,sep,&rem);
-	if ( name[strlen(name)-1] == '/' )
-		name[strlen(name)-1]='\0';
-
-	struct name_prefix *np=(struct name_prefix *) calloc (1, 
-			sizeof(struct name_prefix ));
-	np->name = (char *) calloc (strlen(name)+1,sizeof(char));
-	memcpy(np->name,name,strlen(name)+1);
-	np->length=strlen(name)+1;
-
-	if ( strcmp(cmd_type,"name")!= 0 )
-	{
-		face=strtok_r(NULL,sep,&rem);
-		sscanf(face,"face%d",&face_id);
-	}
-
-	if ( strcmp(cmd_type,"name")== 0 )
-	{
-		if ( strcmp(op_type,"del") == 0 ) 
-		{
-			res=does_name_exist_in_npl(np);
-			if ( res == 0)
-			{
-				sprintf(msg,"Name %s does not exist !!",name);
-			}
-			else
-			{
-				long int ls_id=get_lsa_id_from_npl(np);
-				if ( ls_id != 0 )
-				{
-					make_name_lsa_invalid(np,LS_TYPE_NAME,ls_id);
-					sprintf(msg,"Name %s has been deleted and Advertised.",name);
-				}
-				else 
-				{
-					sprintf(msg,"Name %s does not have an Name LSA yet !!",name);
-				}
-			}			
-		}
-		else if ( strcmp(op_type,"add") == 0 )
-		{
-			res=does_name_exist_in_npl(np);
-			if ( res == 0)
-			{
-				add_name_to_npl(np);
-				build_and_install_single_name_lsa(np);
-				sprintf(msg,"Name %s has been added to advertise.",name);
-			}
-			else
-			{
-				sprintf(msg,"Name %s has already been advertised from this router !!",name);
-			}
-		} 
-	}
-	else if ( strcmp(cmd_type,"neighbor") == 0 )
-	{
-		if ( strcmp(op_type,"del") == 0 ) 
-		{
-			res=is_neighbor(np->name);
-			if ( res == 0)
-			{
-				sprintf(msg,"Neighbor %s does not exist !!",name);
-			}
-			else
-			{
-				update_adjacent_status_to_adl(np,NBR_DOWN);
-				int face_id=get_next_hop_face_from_adl(np->name);
-				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)np->name, OP_UNREG, face_id,(~0U) >> 1);
-				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->topo_prefix, OP_UNREG, face_id,(~0U) >> 1);
-				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->slice_prefix, OP_UNREG, face_id,(~0U) >> 1);
-				delete_nbr_from_adl(np);
-				if(!nlsr->is_build_adj_lsa_sheduled)
-				{
-					nlsr->event_build_adj_lsa = ccn_schedule_event(nlsr->sched, 1000, &build_and_install_adj_lsa, NULL, 0);
-					nlsr->is_build_adj_lsa_sheduled=1;		
-				}
-				sprintf(msg,"Neighbor %s has been deleted from adjacency list.",name);	
-			}
-		}
-		else if ( strcmp(op_type,"add") == 0 )
-		{
-			res=is_neighbor(np->name);
-			if ( res == 0 )
-			{
-				struct name_prefix *nbr_name=(struct name_prefix *)calloc(1,sizeof(struct name_prefix ));
-				get_host_name_from_command_string(nbr_name,np->name,0);
-				printf("Hostname of neighbor: %s ",nbr_name->name);
-
-				char *ip_addr=(char *)calloc(20,sizeof(char));
-				//memset(ip_addr,0,20);
-				get_ip_from_hostname_02(nbr_name->name,ip_addr);
-				printf("IP Address: %s \n",ip_addr);
-				int face_id=add_ccn_face(nlsr->ccn, (const char *)nbr_name->name, (const char *)ip_addr, 9695,nlsr->tunnel_type);
-				update_face_to_adl_for_nbr(nbr_name->name, face_id);		
-				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->topo_prefix, OP_REG, face_id,(~0U) >> 1);
-				add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nlsr->slice_prefix, OP_REG, face_id,(~0U) >> 1);				
-
-				add_nbr_to_adl(np,face_id,ip_addr);
-
-				sprintf(msg,"Neighbor %s has been added to adjacency list.",name);
-				free(ip_addr);
-
-			}
-			else
-			{
-				sprintf(msg,"Neighbor %s already exists in adjacency list.",name);
-			}
-		}
-	}
-
-
-	return msg;
-}
-
-	int
-nlsr_api_server_poll(long int time_out_micro_sec, int ccn_fd)
-{
-	struct timeval timeout;
-	if (time_out_micro_sec< 500000 && time_out_micro_sec> 0 )
-	{
-		timeout.tv_sec=0;
-		timeout.tv_usec=time_out_micro_sec;
-	}
-	else 
-	{
-		timeout.tv_sec = 0;
-		timeout.tv_usec = 500000;
-	}
-
-	int fd;
-	int nread;
-	int result;
-	fd_set testfds;
-	unsigned int client_len;
-	int client_sockfd;
-	char recv_buffer[1024];
-	bzero(recv_buffer,1024);
-	struct sockaddr_in client_address;
-
-	testfds=nlsr->readfds;
-	result = select(FD_SETSIZE, &testfds, NULL,NULL, &timeout);
-
-	for(fd = 0; fd < FD_SETSIZE && result > 0; fd++) 
-	{
-		if(FD_ISSET(fd,&testfds)) 
-		{
-			if ( fd == ccn_fd )
-			{
-				return 0;
-			}			
-			else if(fd == nlsr->nlsr_api_server_sock_fd)
-			{
-				client_len = sizeof(client_address);
-				client_sockfd = accept(nlsr->nlsr_api_server_sock_fd,(struct sockaddr *)&client_address, &client_len);
-				FD_SET(client_sockfd, &nlsr->readfds);
-			}
-			else
-			{   
-
-				ioctl(fd, FIONREAD, &nread);
-				if(nread == 0) 
-				{
-					close(fd);
-					FD_CLR(fd, &nlsr->readfds);
-				}
-				else 
-				{
-					recv(fd, recv_buffer, 1024, 0);
-					printf("Received Data from NLSR API cleint: %s \n",recv_buffer);
-					char *msg=process_api_client_command(recv_buffer);
-					send(fd, msg, strlen(msg),0);
-					free(msg);
-					close(fd);
-					FD_CLR(fd, &nlsr->readfds);
-				}
-			}
-		}
-	}
-
-	return 0;
-}
-
-	int
-check_config_validity()
-{
-	if (nlsr->router_name == NULL )
-	{
-		fprintf(stderr,"Router name has not been configured :(\n");
-		return -1;
-	}
-	if ( nlsr->is_hyperbolic_calc == 1 && (nlsr->cor_r == -1.0 && nlsr->cor_theta== -1.0) ) 	
-	{
-		fprintf(stderr,"Hyperbolic codinate has not been defined :(\n");
-		return -1;
-	}
-	if (nlsr->site_name == NULL )
-	{
-		fprintf(stderr,"Site name has not been configured :(\n");
-		return -1;
-	}
-
-	return 0;
-}
-
-	void 
-nlsr_destroy( void )
-{
-	if ( nlsr->debugging )
-	{
-		printf("Freeing Allocated Memory....\n");
-	}	
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"Freeing Allocated Memory....\n");	
-	
-	/* Destroying all face created by nlsr in CCND */
-	destroy_all_face_by_nlsr();	
-	destroy_faces_for_nbrs();
-	
-
-	destroy_adl();
-	destroy_npl();
-	destroy_lsdb();	
-	destroy_npt();
-	destroy_routing_table();
-	destroy_keys();
-
-	if ( nlsr->slice != NULL ) 
-		ccns_slice_destroy(&nlsr->slice);
-	if ( nlsr->ccns != NULL )
-		ccns_close(&nlsr->ccns, NULL, NULL);
-	if (nlsr->closure != NULL )
-		free(nlsr->closure);
-
-	close(nlsr->nlsr_api_server_sock_fd);
-
-	ccn_destroy(&nlsr->ccn);
-
-	free(nlsr->root_key_prefix);
-	free(nlsr->keystore_path);
-	free(nlsr->keystore_passphrase);
-	if( nlsr->site_name )
-		free(nlsr->site_name);
-
-	free(nlsr->router_name);
-
-
-	free(nlsr->slice_prefix);
-	free(nlsr->topo_prefix);
-	free(nlsr->logDir);
-
-	if ( nlsr->debugging )
-	{
-		printf("Finished freeing allocated memory\n");
-	}
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"Finished freeing allocated memory\n");
-
-	free(nlsr);
-
-}
-
-
-
-	void
-init_api_server(int ccn_fd)
-{
-	int server_sockfd;
-	int server_len;
-	struct sockaddr_in server_address;
-	unsigned int yes=1;	
-
-	server_sockfd = socket(AF_INET, SOCK_STREAM, 0);
-
-	int flags = fcntl(server_sockfd, F_GETFL, 0);
-	fcntl(server_sockfd, F_SETFL, O_NONBLOCK|flags);
-
-	if (setsockopt(server_sockfd,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(yes)) < 0) 
-	{
-		ON_ERROR_DESTROY(-1);
-	}
-
-	server_address.sin_family = AF_INET;
-	server_address.sin_addr.s_addr = INADDR_ANY;
-	server_address.sin_port = htons(nlsr->api_port);
-
-	server_len = sizeof(server_address);
-	bind(server_sockfd, (struct sockaddr *)&server_address, server_len);
-	listen(server_sockfd, 100);
-	FD_ZERO(&nlsr->readfds);
-	FD_SET(server_sockfd, &nlsr->readfds);
-	FD_SET(ccn_fd, &nlsr->readfds);
-	nlsr->nlsr_api_server_sock_fd=server_sockfd;
-}
-
-	int 
-init_nlsr(void)
-{
-	if (signal(SIGQUIT, nlsr_stop_signal_handler ) == SIG_ERR) 
-	{
-		perror("SIGQUIT install error\n");
-		return -1;
-	}
-	if (signal(SIGTERM, nlsr_stop_signal_handler ) == SIG_ERR) 
-	{
-		perror("SIGTERM install error\n");
-		return -1;
-	}
-	if (signal(SIGINT, nlsr_stop_signal_handler ) == SIG_ERR)
-	{
-		perror("SIGTERM install error\n");
-		return -1;
-	}
-
-	nlsr=(struct nlsr *)calloc(1,sizeof(struct nlsr));
-
-	nlsr->adl= hashtb_create(sizeof(struct ndn_neighbor), NULL);
-	nlsr->npl = hashtb_create(sizeof(struct name_prefix_list_entry), NULL);
-	nlsr->npt = hashtb_create(sizeof(struct npt_entry), NULL);
-	nlsr->routing_table = hashtb_create(sizeof(struct routing_table_entry), NULL);
-	nlsr->keys = hashtb_create(sizeof(struct nlsr_key), NULL);
-
-	nlsr->lsdb=(struct linkStateDatabase *)malloc(sizeof(struct linkStateDatabase));
-	nlsr->lsdb->adj_lsdb = hashtb_create(sizeof(struct alsa), NULL);
-	nlsr->lsdb->name_lsdb = hashtb_create(sizeof(struct nlsa), NULL);
-	nlsr->lsdb->cor_lsdb = hashtb_create(sizeof(struct clsa), NULL);
-
-
-
-	nlsr->lsdb->lsdb_version=get_current_timestamp_micro_v2();
-
-	nlsr->in_interest.p = &incoming_interest;
-	nlsr->in_content.p = &incoming_content;
-
-	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->isStrictHierchicalKeyCheck=1;
-
-	nlsr->interest_retry = INTEREST_RETRY;
-	nlsr->interest_resend_time = INTEREST_RESEND_TIME;
-	nlsr->lsa_refresh_time=LSA_REFRESH_TIME;
-	nlsr->router_dead_interval=ROUTER_DEAD_INTERVAL;
-	nlsr->max_faces_per_prefix=MAX_FACES_PER_PREFIX;
-	nlsr->semaphor=NLSR_UNLOCKED;
-
-	nlsr->api_port=API_PORT;
-
-	nlsr->topo_prefix=(char *)calloc(strlen("/ndn/routing/nlsr")+1,sizeof(char));
-	memcpy(nlsr->topo_prefix,"/ndn/routing/nlsr",strlen("/ndn/routing/nlsr"));
-
-	nlsr->slice_prefix=(char *)calloc(strlen("/ndn/routing/nlsr/LSA")+1,sizeof(char));
-	memcpy(nlsr->slice_prefix,"/ndn/routing/nlsr/LSA",strlen("/ndn/routing/nlsr/LSA"));
-
-	nlsr->is_hyperbolic_calc=0;
-	nlsr->cor_r=-1.0;
-	nlsr->cor_theta=-1.0;
-
-	nlsr->tunnel_type=IPPROTO_UDP;
-
-	nlsr->root_key_prefix=(char *)calloc(strlen("/ndn/keys")+1,sizeof(char));
-	memcpy(nlsr->root_key_prefix,"/ndn/keys",strlen("/ndn/keys"));
-	nlsr->keystore_path=get_current_user_default_keystore();
-	nlsr->keystore_passphrase=(char *)calloc(strlen("Th1s1sn0t8g00dp8ssw0rd.")+1
-																,sizeof(char));
-	memcpy(nlsr->keystore_passphrase,"Th1s1sn0t8g00dp8ssw0rd.",
-											strlen("Th1s1sn0t8g00dp8ssw0rd."));
-
-	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;
-
-	ON_ERROR_DESTROY(readConfigFile(config_file));
-
-	ON_ERROR_DESTROY(check_config_validity());
-
-	print_adjacent_from_adl();
-
-	if ( daemon_mode == 1 )
-	{
-		nlsr->debugging=0;
-		daemonize_nlsr();
-	}
-
-	startLogging(nlsr->logDir);
-
-	nlsr->ccn=ccn_create();
-	int ccn_fd=ccn_connect(nlsr->ccn, NULL);
-
-	if(ccn_fd == -1)
-	{
-		fprintf(stderr,"Could not connect to ccnd\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Could not connect to ccnd\n");
-		ON_ERROR_DESTROY(-1);
-	}
-
-	init_api_server(ccn_fd);
-
-	res=create_sync_slice(nlsr->topo_prefix, nlsr->slice_prefix);
-
-	if(res<0)
-	{
-		fprintf(stderr, "Can not create slice for prefix %s\n",
-				nlsr->slice_prefix);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Can not create slice for" 
-				"prefix %s\n",nlsr->slice_prefix);
-		ON_ERROR_DESTROY(res);
-	}
-	
-	struct ccn_charbuf *router_prefix;	
-	
-	router_prefix=ccn_charbuf_create(); 
-	res=ccn_name_from_uri(router_prefix,nlsr->router_name);		
-	if(res<0)
-	{
-		fprintf(stderr, "Bad ccn URI: %s\n",nlsr->router_name);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,
-				"Bad ccn URI: %s\n", nlsr->router_name);
-		ON_ERROR_DESTROY(res);
-	}
-
-	ccn_name_append_str(router_prefix,"nlsr");
-	nlsr->in_interest.data=nlsr->router_name;
-	res=ccn_set_interest_filter(nlsr->ccn,router_prefix,&nlsr->in_interest);
-	if ( res < 0 )
-	{
-		fprintf(stderr,"Failed to register interest for router\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,
-				"Failed to register interest for router\n");
-		ON_ERROR_DESTROY(res);
-	}
-	ccn_charbuf_destroy(&router_prefix);
-
-	if ( nlsr->debugging )
-		printf("Router Name : %s\n",nlsr->router_name);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"Router Name : %s\n",nlsr->router_name);
-	if ( nlsr->debugging )
-		printf("lsdb_version: %s\n",nlsr->lsdb->lsdb_version);
-	writeLogg(__FILE__,__FUNCTION__,__LINE__,"lsdb_version: %s\n",nlsr->lsdb->lsdb_version);
-
-	add_faces_for_nbrs();
-	print_name_prefix_from_npl();
-	print_adjacent_from_adl();
-	build_and_install_name_lsas();	
-
-	print_name_lsdb();
-	if ( nlsr->cor_r != -1.0 && nlsr->cor_theta != -1.0)
-	{
-		build_and_install_cor_lsa();
-	}
-	write_name_lsdb_to_repo(nlsr->slice_prefix);
-
-	nlsr->sched = ccn_schedule_create(nlsr, &ndn_rtr_ticker);
-	ccn_set_schedule(nlsr->ccn,nlsr->sched);
-	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);
-
-	res=sync_monitor(nlsr->topo_prefix,nlsr->slice_prefix);
-	ON_ERROR_DESTROY(res);
-
-	while(1)
-	{	
-		if ( nlsr->semaphor == NLSR_UNLOCKED  )
-		{
-			if( nlsr->sched != NULL )
-			{
-				long int micro_sec=ccn_schedule_run(nlsr->sched);
-				res=nlsr_api_server_poll(micro_sec,ccn_fd);
-				ON_ERROR_DESTROY(res);
-			}
-			if(nlsr->ccn != NULL)
-			{
-				res = ccn_run(nlsr->ccn, 1);
-			}
-			if (!(nlsr->sched && nlsr->ccn))
-			{	      
-				break;
-			}
-		}
-
-	}
-	return 0;
-}
-
diff --git a/nlsr.conf b/nlsr.conf
deleted file mode 100644
index ced844f..0000000
--- a/nlsr.conf
+++ /dev/null
@@ -1,10 +0,0 @@
-router-name /ndn/memphis.edu/netlab/macbook
-ccnneighbor /ndn/memphis.edu/netlab/pollux face2 10
-ccnneighbor /ndn/memphis.edu/netlab/castor face3 8
-ccnname /ndn/memphis.edu/netlab/macbook/name1
-ccnname /ndn/memphis.edu/netlab/macbook/test
-lsdb-synch-interval 310
-interest-retry 4
-interest-resend-time 5
-
-
diff --git a/nlsr.h b/nlsr.h
deleted file mode 100644
index ea815ee..0000000
--- a/nlsr.h
+++ /dev/null
@@ -1,136 +0,0 @@
-#ifndef _NLSR_H_
-#define _NLSR_H_
-
-
-#define LSDB_SYNCH_INTERVAL 300
-#define INTEREST_RETRY 3
-#define INTEREST_RESEND_TIME 15
-#define NLSR_LOCKED 1
-#define NLSR_UNLOCKED 0
-#define LSA_REFRESH_TIME 1800
-#define ROUTER_DEAD_INTERVAL 3600
-#define MAX_FACES_PER_PREFIX 0
-
-#define LINK_METRIC 10
-
-#define NAME_LSA_VALID 1
-#define NAME_LSA_INVALID 0
-
-#define API_PORT 9999
-
-
-struct name_prefix
-{
-	char *name;
-	int length;
-};
-
-struct linkStateDatabase
-{
-	struct hashtb *name_lsdb;
-	struct hashtb *adj_lsdb;
-	struct hashtb *cor_lsdb;
-	
-	char *lsdb_version;
-};
-
-struct pending_interest
-{
-	char *int_name;
-	int timed_out;
-};
-
-struct nlsr
-{
-
-	struct ccn_closure in_interest;
-	struct ccn_closure in_content;
-
-	struct ccns_name_closure *closure;
-	struct ccns_slice *slice;
-    	struct ccns_handle *ccns;
-
-	struct ccn_schedule *sched;
-    	struct ccn_scheduled_event *event;
-	struct ccn_scheduled_event *event_send_info_interest;
-	struct ccn_scheduled_event *event_send_lsdb_interest;
-	struct ccn_scheduled_event *event_build_adj_lsa;
-	struct ccn_scheduled_event *event_calculate_route;
-
-	struct hashtb *adl;
-	struct hashtb *npl;
-	struct hashtb *map;
-	struct hashtb *rev_map;
-	struct hashtb *npt;
-	struct hashtb *routing_table;
-	struct hashtb *keys;
-
-
-	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;
-
-	int interest_retry;
-	long int interest_resend_time;
-	long int lsa_refresh_time;
-	long int router_dead_interval;
-	
-	long int max_faces_per_prefix;
-	char *logDir;
-	int detailed_logging;
-	int debugging;
-
-	int semaphor;
-
-	int nlsr_api_server_sock_fd;
-	fd_set readfds;
-	int api_port;
-
-	char *topo_prefix;
-	char *slice_prefix;
-
-	char *root_key_prefix;
-	char *keystore_path;
-	char *keystore_passphrase;
-	char *site_name;
-
-	int is_hyperbolic_calc;
-	double cor_r;
-	double cor_theta;
-
-	int isStrictHierchicalKeyCheck;
-
-	int tunnel_type;
-	
-	
-};
-
-struct nlsr *nlsr;
-
-void process_command_ccnneighbor(char *command);
-void process_command_ccnname(char *command);
-void process_command_lsdb_synch_interval(char *command);
-void process_command_interest_retry(char *command);
-void process_command_interest_resend_time(char *command);
-void process_conf_command(char *command);
-int readConfigFile(const char *filename);
-
-void nlsr_lock(void);
-void nlsr_unlock(void);
-
-int init_nlsr(void);
-void nlsr_destroy( void );
-void nlsr_stop_signal_handler(int sig);
-
-#endif
diff --git a/nlsr_adl.c b/nlsr_adl.c
deleted file mode 100644
index 4eedf40..0000000
--- a/nlsr_adl.c
+++ /dev/null
@@ -1,769 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include<math.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#endif
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-#include "nlsr.h"
-#include "nlsr_npl.h"
-#include "nlsr_adl.h"
-#include "utility.h"
-#include "nlsr_npt.h"
-
-void 
-add_nbr_to_adl(struct name_prefix *new_nbr,int face,char *ip)
-{
-	struct ndn_neighbor *nbr;
-
-	struct 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 ));
-		nbr->neighbor->name=(char *)malloc(new_nbr->length);
-		memcpy(nbr->neighbor->name,new_nbr->name,new_nbr->length);
-		nbr->neighbor->length=new_nbr->length;
-		nbr->face=face;
-		nbr->status=NBR_DOWN;
-		nbr->info_interest_timed_out=0;
-		nbr->lsdb_interest_timed_out=0;
-		nbr->lsdb_random_time_component=(int)(LSDB_SYNCH_INTERVAL/2);
-		nbr->lsdb_synch_interval=LSDB_SYNCH_INTERVAL;
-		nbr->metric=LINK_METRIC;
-		nbr->is_lsdb_send_interest_scheduled=0;
-		
-		nbr->ip_address=(char *)calloc(strlen(ip)+1,sizeof(char));
-		memcpy(nbr->ip_address,ip,strlen(ip)+1);
-
-		char *time_stamp=(char *)malloc(20);
-		get_current_timestamp_micro(time_stamp);
-		nbr->last_lsdb_version=(char *)calloc(strlen(time_stamp)+1,sizeof(char));
-		memcpy(nbr->last_lsdb_version,"0000000000000000",16);
-		nbr->last_info_version=(char *)calloc(strlen(time_stamp)+1,sizeof(char));
-		memcpy(nbr->last_info_version,"0000000000000000",16);
-		free(time_stamp);		
-
-		nbr->last_lsdb_requested=0;
-	}
-
-    	hashtb_end(e);
-}
-
-
-void 
-print_adjacent(struct ndn_neighbor *nbr)
-{
-	if ( nlsr->debugging )
-	{
-		printf("print_adjacent called\n");
-		printf("--------Neighbor---------------------------\n");
-		printf("	Neighbor: %s \n",nbr->neighbor->name);
-		printf("	Length  : %d \n",nbr->neighbor->length);
-		printf("	Ip Address: %s \n",nbr->ip_address);
-		printf("	Face    : %d \n",nbr->face);
-		printf("	Metric    : %d \n",nbr->metric);
-		printf("	Status  : %d \n",nbr->status);
-		printf("	LSDB Version: %s \n",nbr->last_lsdb_version);
-		printf("	Info Version: %s \n",nbr->last_info_version);
-		printf("	Info Interest Timed Out : %d \n",nbr->info_interest_timed_out);
-		printf("	LSDB Interest Timed Out : %d \n",nbr->lsdb_interest_timed_out);
-		printf("	LSDB Synch Interval     : %ld \n",nbr->lsdb_synch_interval);
-		printf("	LSDB Random Time comp   : %d \n",nbr->lsdb_random_time_component);
-		printf("	Las Time LSDB Requested: %ld \n",nbr->last_lsdb_requested);
-		printf("	IS_lsdb_send_interest_scheduled : %d \n",nbr->is_lsdb_send_interest_scheduled);
-
-		printf("\n");
-	}
-
-	if ( nlsr->detailed_logging )
-	{
-		
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_adjacent called\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"--------Neighbor---------------------------\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Neighbor: %s \n",nbr->neighbor->name);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Length  : %d \n",nbr->neighbor->length);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Face    : %d \n",nbr->face);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Metric    : %d \n",nbr->metric);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Status  : %d \n",nbr->status);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	LSDB Version: %s \n",nbr->last_lsdb_version);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Info Version: %s \n",nbr->last_info_version);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Info Interest Timed Out : %d \n",nbr->info_interest_timed_out);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	LSDB Interest Timed Out : %d \n",nbr->lsdb_interest_timed_out);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	LSDB Synch Interval     : %ld \n",nbr->lsdb_synch_interval);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	LSDB Random Time comp   : %d \n",nbr->lsdb_random_time_component);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	Las Time LSDB Requested: %ld \n",nbr->last_lsdb_requested);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"	IS_lsdb_send_interest_scheduled : %d \n",nbr->is_lsdb_send_interest_scheduled);
-
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-	}
-
-}
-
-void
-print_adjacent_from_adl(void)
-{
-	if ( nlsr->debugging )
-		printf("print_adjacent_from_adl called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_adjacent_from_adl called \n");		
-	
-	int i, adl_element;
-	struct ndn_neighbor *nbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-
-	for(i=0;i<adl_element;i++)
-	{
-		nbr=e->data;
-		print_adjacent(nbr);	
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-int 
-get_adjacent_status(struct name_prefix *nbr)
-{
-
-	if ( nlsr->debugging )
-		printf("get_adjacent_status called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_adjacent_status called \n");
-
-	int res;
-	int status=-1;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-	if (res == HT_OLD_ENTRY)
-	{
-		nnbr=e->data;
-		status=nnbr->status;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return status;
-
-}
-
-int 
-get_timed_out_number(struct name_prefix *nbr)
-{
-
-	if ( nlsr->debugging )
-		printf("get_timed_out_number called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_timed_out_number called \n");
-
-
-	int res,ret=-1;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		ret=nnbr->info_interest_timed_out;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return ret;	
-}
-
-int 
-get_lsdb_interest_timed_out_number(struct name_prefix *nbr)
-{
-
-	if ( nlsr->debugging )
-		printf("get_lsdb_interest_timed_out_number called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_lsdb_interest_timed_out_number called \n");
-
-	int res,ret=-1;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		ret=nnbr->lsdb_interest_timed_out;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return ret;	
-}
-
-void 
-update_adjacent_timed_out_to_adl(struct name_prefix *nbr, int increment)
-{
-	if ( nlsr->debugging )
-		printf("update_adjacent_timed_out_to_adl called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_timed_out_to_adl called \n");
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		nnbr->info_interest_timed_out += increment;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-void 
-update_adjacent_timed_out_zero_to_adl(struct name_prefix *nbr)
-{
-	if ( nlsr->debugging )
-		printf("update_adjacent_timed_out_zero_to_adl called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_timed_out_zero_to_adl called \n");
-	
-	int time_out_number=get_timed_out_number(nbr);
-	update_adjacent_timed_out_to_adl(nbr,-time_out_number);
-
-}
-
-
-void 
-update_lsdb_interest_timed_out_to_adl(struct name_prefix *nbr, int increment)
-{
-	if ( nlsr->debugging )
-		printf("update_lsdb_interest_timed_out_to_adl called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_lsdb_interest_timed_out_to_adl called \n");
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-
-	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		nnbr->lsdb_interest_timed_out += increment;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}		
-	hashtb_end(e);
-}
-
-void 
-update_lsdb_interest_timed_out_zero_to_adl(struct name_prefix *nbr)
-{
-	if ( nlsr->debugging )
-		printf("update_adjacent_timed_out_zero_to_adl called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_timed_out_zero_to_adl called\n");
-	
-	int time_out_number=get_lsdb_interest_timed_out_number(nbr);
-	update_lsdb_interest_timed_out_to_adl(nbr,-time_out_number);
-
-}
-
-void 
-update_adjacent_status_to_adl(struct name_prefix *nbr, int status)
-{
-	if ( nlsr->debugging )
-		printf("update_adjacent_status_to_adl called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_adjacent_status_to_adl called \n");
-
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-   	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-
-	if (res == HT_OLD_ENTRY)
-	{
-		nnbr=e->data;
-		if ( nnbr->status!=status )
-		{
-			nnbr->status=status;
-			nlsr->adj_build_flag++;
-		}
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-
-void 
-delete_nbr_from_adl(struct name_prefix *nbr)
-{
-	if ( nlsr->debugging )
-		printf("delete_nbr_from_adl called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_nbr_from_adl called \n");
-
-	int res;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-   	res = hashtb_seek(e, nbr->name, nbr->length, 0);
-
-
-	if (res == HT_OLD_ENTRY)
-	{
-		struct ndn_neighbor *nbr=e->data;
-		/*free(nbr->neighbor->name);
-		free(nbr->neighbor);
-		free(nbr->last_lsdb_version);
-		free(nbr->last_info_version);
-		free(nbr->ip_address);
-		*/
-		destroy_nbr_component(nbr);
-		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_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);
-}
-
-
-int 
-get_next_hop_face_from_adl(char *nbr)
-{
-	int res;
-	int connecting_face=NO_FACE;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		connecting_face=nnbr->face;
-		
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-	return connecting_face;
-}
-
-void
-update_face_to_adl_for_nbr(char *nbr, int face)
-{
-	int res;
-	struct ndn_neighbor *nnbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nnbr=e->data;
-		nnbr->face=face;
-		
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-int 
-is_neighbor(char *nbr)
-{
-	int ret=0;
-
-	int res;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		ret=1;	
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return ret;
-}
-
-int 
-is_active_neighbor(char *nbr)
-{
-	int ret=0;
-
-	int res;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->adl, e);
-	res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		struct ndn_neighbor *nnbr;
-		nnbr=e->data;
-		if (nnbr->status == NBR_ACTIVE )
-		{
-			ret=1;	
-		}
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-
-	return ret;
-}
-
-
-void 
-get_host_name_from_command_string(struct name_prefix *name_part,
-												char *nbr_name_uri, int offset)
-{
-
-	
-	
-	int res,i;
-	int len=0;
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-
-	struct ccn_charbuf *name=ccn_charbuf_create();
-    	res = ccn_name_from_uri(name,nbr_name_uri);
-    	if (res < 0) {
-        	fprintf(stderr, "Bad ccn URI: %s\n", nbr_name_uri);
-        	exit(1);
-    	}	
-
-	//struct ccn_indexbuf cid={0};
-
-    	//struct ccn_indexbuf *components=&cid;
-	struct ccn_indexbuf *components=ccn_indexbuf_create();
-    	ccn_name_split (name, components);
-
-	for(i=components->n-2;i> (0+offset);i--)
-	{
-		res=ccn_name_comp_get(name->buf, components,i,&comp_ptr1, &comp_size);
-		len+=1;
-		len+=(int)comp_size;	
-	}
-	len++;
-
-	char *neighbor=(char *)malloc(len);
-	memset(neighbor,0,len);
-
-	for(i=components->n-2;i> (0+offset);i--)
-	{
-		res=ccn_name_comp_get(name->buf, components,i,&comp_ptr1, &comp_size);
-		if ( i != components->n-2)
-		memcpy(neighbor+strlen(neighbor),".",1);
-		memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,
-													strlen((char *)comp_ptr1));
-
-	}
-
-	name_part->name=(char *)calloc(strlen(neighbor)+1,sizeof(char));
-	memcpy(name_part->name,neighbor,strlen(neighbor)+1);
-	name_part->length=strlen(neighbor)+1;
-
-	// 01/31/2013
-	free(neighbor);
-	ccn_charbuf_destroy(&name);
-	ccn_indexbuf_destroy(&components);
-}
-
-
-void
-destroy_nbr_component(struct ndn_neighbor *nbr)
-{
-	if ( nbr->neighbor->name )
-		free(nbr->neighbor->name);
-	if ( nbr->neighbor )
-		free(nbr->neighbor);
-	if ( nbr->last_lsdb_version)
-		free(nbr->last_lsdb_version);
-	if ( nbr->last_info_version)
-		free(nbr->last_info_version);
-	if ( nbr->ip_address)
-		free(nbr->ip_address);
-}
-
-void
-destroy_adl(void)
-{	
-	int i, adl_element;
-	struct ndn_neighbor *nbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-
-	for(i=0;i<adl_element;i++)
-	{
-		nbr=e->data;
-		destroy_nbr_component(nbr);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-	
-	if( nlsr->adl )
-		hashtb_destroy(&nlsr->adl);
-
-}
-
-
diff --git a/nlsr_adl.h b/nlsr_adl.h
deleted file mode 100644
index c3bdac7..0000000
--- a/nlsr_adl.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef _NLSR_ADL_H_
-#define _NLSR_ADL_H_
-
-#define NBR_DOWN 0
-#define NBR_ACTIVE 1
-
-struct ndn_neighbor
-{
-	struct name_prefix *neighbor;
-	int face;
-	int status;
-	char * last_lsdb_version;
-	char * last_info_version;
-	char *ip_address;
-	int info_interest_timed_out;
-	int lsdb_interest_timed_out;
-	int lsdb_random_time_component;
-	long int lsdb_synch_interval;
-	long int last_lsdb_requested;
-	int is_lsdb_send_interest_scheduled;
-	int metric;
-};
-
-void add_nbr_to_adl(struct name_prefix *new_nbr,int face,char *ip);
-void delete_nbr_from_adl(struct name_prefix *nbr);
-void print_adjacent(struct ndn_neighbor *nbr);
-void print_adjacent_from_adl(void);
-int get_adjacent_status(struct name_prefix *nbr);
-int get_timed_out_number(struct name_prefix *nbr);
-int get_lsdb_interest_timed_out_number(struct name_prefix *nbr);
-void update_adjacent_timed_out_to_adl(struct name_prefix *nbr, int increment);
-void update_adjacent_timed_out_zero_to_adl(struct name_prefix *nbr);
-void update_lsdb_interest_timed_out_to_adl(struct name_prefix *nbr, int increment);
-void update_lsdb_interest_timed_out_zero_to_adl(struct name_prefix *nbr);
-void update_adjacent_status_to_adl(struct name_prefix *nbr, int status);
-void update_lsdb_synch_interval_to_adl(struct name_prefix *nbr, long int interval);
-int no_active_nbr(void);
-int is_adj_lsa_build(void);
-void get_active_nbr_adj_data(struct ccn_charbuf *c);
-long int get_nbr_time_diff_lsdb_req(char *nbr);
-long int get_nbr_last_lsdb_requested(char *nbr);
-long int get_nbr_last_lsdb_requested(char *nbr);
-long int get_lsdb_synch_interval(char *nbr);
-int get_nbr_random_time_component(char *nbr);
-char * get_nbr_lsdb_version(char *nbr);
-void update_adjacent_last_lsdb_requested_to_adl(char *nbr, long int timestamp);
-void set_is_lsdb_send_interest_scheduled_to_zero(char *nbr);
-void update_adjacent_lsdb_version_to_adl(struct name_prefix *nbr, char *version);
-void adjust_adjacent_last_lsdb_requested_to_adl(char *nbr, long int sec);
-int get_next_hop_face_from_adl(char *nbr);
-int is_neighbor(char *nbr);
-int is_active_neighbor(char *nbr);
-void update_face_to_adl_for_nbr(char *nbr, int face);
-
-void get_host_name_from_command_string(struct name_prefix *name_part,char *nbr_name_uri, int offset);
-void destroy_nbr_component(struct ndn_neighbor *nbr);
-void destroy_adl(void);
-#endif
diff --git a/nlsr_face.c b/nlsr_face.c
deleted file mode 100644
index 6a7e48c..0000000
--- a/nlsr_face.c
+++ /dev/null
@@ -1,410 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <string.h>
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/face_mgmt.h>
-#include <ccn/reg_mgmt.h>
-#include <ccn/charbuf.h>
-
-
-
-#include "nlsr_face.h"
-
-static void 
-ccn_fib_warn(int lineno, const char *format, ...)
-{
-	struct timeval t;
-	va_list ap;
-	va_start(ap, format);
-	gettimeofday(&t, NULL);
-	fprintf(stderr, "%d.%06d ccn_fib[%d]:%d: ", (int)t.tv_sec, (unsigned)t.tv_usec, (int)getpid(), lineno);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-}
-
-static void 
-ccn_fib_fatal(int lineno, const char *format, ...)
-{
-	struct timeval t;
-	va_list ap;
-	va_start(ap, format);
-	gettimeofday(&t, NULL);
-	fprintf(stderr, "%d.%06d ccn_fib[%d]:%d: ", (int)t.tv_sec, (unsigned)t.tv_usec, (int)getpid(), lineno);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	exit(1);
-}
-
-#define ON_ERROR_EXIT(resval, msg) on_error_exit((resval), __LINE__, msg)
-
-static void 
-on_error_exit(int res, int lineno, const char *msg)
-{
-	if (res >= 0)
-		return;
-	ccn_fib_fatal(lineno, "fatal error, res = %d, %s\n", res, msg);
-}
-
-#define ON_ERROR_CLEANUP(resval) \
-{           \
-    if ((resval) < 0) { \
-        ccn_fib_warn (__LINE__, "OnError cleanup\n"); \
-        goto cleanup; \
-    } \
-}
-
-#define ON_NULL_CLEANUP(resval) \
-{           \
-    if ((resval) == NULL) { \
-        ccn_fib_warn(__LINE__, "OnNull cleanup\n"); \
-        goto cleanup; \
-    } \
-}
-
-
-/**
- * 
- * Bind a prefix to a face
- *
- */
-static int 
-register_unregister_prefix(struct ccn *h, struct ccn_charbuf *local_scope_template,
-        struct ccn_charbuf *no_name, struct ccn_charbuf *name_prefix,
-        struct ccn_face_instance *face_instance, int operation)
-{
-	struct ccn_charbuf *temp = NULL;
-	struct ccn_charbuf *resultbuf = NULL;
-	struct ccn_charbuf *signed_info = NULL;
-	struct ccn_charbuf *name = NULL;
-	struct ccn_charbuf *prefixreg = NULL;
-	struct ccn_parsed_ContentObject pcobuf = {0};
-	struct ccn_forwarding_entry forwarding_entry_storage = {0};
-	struct ccn_forwarding_entry *forwarding_entry = &forwarding_entry_storage;
-	struct ccn_forwarding_entry *new_forwarding_entry;
-	const unsigned char *ptr = NULL;
-	size_t length = 0;
-	int res;
-
-	/* Register or unregister the prefix */
-	forwarding_entry->action = (operation == OP_REG) ? "prefixreg" : "unreg";
-	forwarding_entry->name_prefix = name_prefix;
-	forwarding_entry->ccnd_id = face_instance->ccnd_id;
-	forwarding_entry->ccnd_id_size = face_instance->ccnd_id_size;
-	forwarding_entry->faceid = face_instance->faceid;
-	forwarding_entry->flags = -1;
-	forwarding_entry->lifetime = (~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, face_instance->ccnd_id, face_instance->ccnd_id_size);
-	ccn_name_append_str(name, (operation == OP_REG) ? "prefixreg" : "unreg");
-	ccn_name_append(name, temp->buf, temp->length);
-
-	/* send Interest, get Data */
-	res = ccn_get(h, name, local_scope_template, 1000, resultbuf, &pcobuf, NULL, 0);
-	ON_ERROR_CLEANUP(res);
-
-	res = ccn_content_get_value(resultbuf->buf, resultbuf->length, &pcobuf, &ptr, &length);
-	ON_ERROR_CLEANUP(res);
-    
-	/* extract new forwarding entry from Data */
-	new_forwarding_entry = ccn_forwarding_entry_parse(ptr, length);
-	ON_NULL_CLEANUP(new_forwarding_entry);
-
-	res = new_forwarding_entry->faceid;
-
-	ccn_forwarding_entry_destroy(&new_forwarding_entry);
-	ccn_charbuf_destroy(&signed_info);
-	ccn_charbuf_destroy(&temp);
-	ccn_charbuf_destroy(&resultbuf);
-	ccn_charbuf_destroy(&name);
-	ccn_charbuf_destroy(&prefixreg);
-
-	return res;
-
-	cleanup:
-		ccn_forwarding_entry_destroy(&new_forwarding_entry);
-		ccn_charbuf_destroy(&signed_info);
-		ccn_charbuf_destroy(&temp);
-		ccn_charbuf_destroy(&resultbuf);
-		ccn_charbuf_destroy(&name);
-		ccn_charbuf_destroy(&prefixreg);
-
-	return -1;
-}
-
-/**
- *
- * Create new face by sending out a request Interest
- * The actual new face instance is returned
- * 
- */
-static 
-struct ccn_face_instance *create_face(struct ccn *h, struct ccn_charbuf *local_scope_template,
-        struct ccn_charbuf *no_name, struct ccn_face_instance *face_instance)
-{
-	struct ccn_charbuf *newface = NULL;
-	struct ccn_charbuf *signed_info = NULL;
-	struct ccn_charbuf *temp = NULL;
-	struct ccn_charbuf *name = NULL;
-	struct ccn_charbuf *resultbuf = NULL;
-	struct ccn_parsed_ContentObject pcobuf = {0};
-	struct ccn_face_instance *new_face_instance = NULL;
-	const unsigned char *ptr = NULL;
-	size_t length = 0;
-	int res = 0;
-
-	/* Encode the given face instance */
-	newface = ccn_charbuf_create();
-	ccnb_append_face_instance(newface, face_instance);
-
-	temp = ccn_charbuf_create();
-	res = ccn_sign_content(h, temp, no_name, NULL, newface->buf, newface->length);
-	resultbuf = ccn_charbuf_create();
-
-	/* Construct the Interest name that will create the face */
-	name = ccn_charbuf_create();
-	ccn_name_init(name);
-	ccn_name_append_str(name, "ccnx");
-	ccn_name_append(name, face_instance->ccnd_id, face_instance->ccnd_id_size);
-	ccn_name_append_str(name, face_instance->action);
-	ccn_name_append(name, temp->buf, temp->length);
-
-	/* send Interest to retrieve Data that contains the newly created face */
-	res = ccn_get(h, name, local_scope_template, 1000, resultbuf, &pcobuf, NULL, 0);
-	ON_ERROR_CLEANUP(res);
-
-	/* decode Data to get the actual face instance */
-	res = ccn_content_get_value(resultbuf->buf, resultbuf->length, &pcobuf, &ptr, &length);
-	ON_ERROR_CLEANUP(res);
-
-	new_face_instance = ccn_face_instance_parse(ptr, length);
-
-	ccn_charbuf_destroy(&newface);
-	ccn_charbuf_destroy(&signed_info);
-	ccn_charbuf_destroy(&temp);
-	ccn_charbuf_destroy(&resultbuf);
-	ccn_charbuf_destroy(&name);
-
-	return new_face_instance;
-
-	cleanup:
-		ccn_charbuf_destroy(&newface);
-		ccn_charbuf_destroy(&signed_info);
-		ccn_charbuf_destroy(&temp);
-		ccn_charbuf_destroy(&resultbuf);
-		ccn_charbuf_destroy(&name);
-
-	return NULL;
-}
-
-/**
- *
- * Get ccnd id
- *
- */
-static int 
-get_ccndid(struct ccn *h, struct ccn_charbuf *local_scope_template,
-        unsigned char *ccndid)
-{
-	struct ccn_charbuf *name = NULL;
-	struct ccn_charbuf *resultbuf = NULL;
-	struct ccn_parsed_ContentObject pcobuf = {0};
-	char ccndid_uri[] = "ccnx:/%C1.M.S.localhost/%C1.M.SRV/ccnd/KEY";
-	const unsigned char *ccndid_result;
-	static size_t ccndid_result_size;
-	int res;
-
-	name = ccn_charbuf_create();
-	resultbuf = ccn_charbuf_create();
-
-	res = ccn_name_from_uri(name, ccndid_uri);
-	ON_ERROR_EXIT(res, "Unable to parse service locator URI for ccnd key\n");
-
-	/* get Data */
-	res = ccn_get(h, name, local_scope_template, 4500, resultbuf, &pcobuf, NULL, 0);
-	ON_ERROR_EXIT(res, "Unable to get key from ccnd\n");
-
-	/* extract from Data */
-	res = ccn_ref_tagged_BLOB(CCN_DTAG_PublisherPublicKeyDigest,
-            resultbuf->buf,
-            pcobuf.offset[CCN_PCO_B_PublisherPublicKeyDigest],
-            pcobuf.offset[CCN_PCO_E_PublisherPublicKeyDigest],
-            &ccndid_result, &ccndid_result_size);
-	ON_ERROR_EXIT(res, "Unable to parse ccnd response for ccnd id\n");
-
-	memcpy((void *)ccndid, ccndid_result, ccndid_result_size);
-
-	ccn_charbuf_destroy(&name);
-	ccn_charbuf_destroy(&resultbuf);
-
-	return (ccndid_result_size);
-}
-
-/**
- * Construct a new face instance based on the given address and port
- * This face instance is only used to send new face request
- */
-static struct 
-ccn_face_instance *construct_face(const unsigned char *ccndid, size_t ccndid_size,
-        const char *address, const char *port, unsigned int tunnel_proto)
-{
-	struct ccn_face_instance *fi = calloc(1, sizeof(*fi));
-	char rhostnamebuf[NI_MAXHOST];
-	char rhostportbuf[NI_MAXSERV];
-	struct addrinfo hints = {.ai_family = AF_UNSPEC, .ai_flags = (AI_ADDRCONFIG),
-        .ai_socktype = SOCK_DGRAM};
-	struct addrinfo *raddrinfo = NULL;
-	struct ccn_charbuf *store = ccn_charbuf_create();
-	int host_off = -1;
-	int port_off = -1;
-	int res;
-
-	res = getaddrinfo(address, port, &hints, &raddrinfo);
-	if (res != 0 || raddrinfo == NULL) 
-	{
-		fprintf(stderr, "Error: getaddrinfo\n");
-		return NULL;
-	}
-
-	res = getnameinfo(raddrinfo->ai_addr, raddrinfo->ai_addrlen,
-            rhostnamebuf, sizeof(rhostnamebuf),
-            rhostportbuf, sizeof(rhostportbuf),
-            NI_NUMERICHOST | NI_NUMERICSERV);
-	freeaddrinfo(raddrinfo);	
-	if (res != 0) 
-	{
-		fprintf(stderr, "Error: getnameinfo\n");
-		return NULL;
-	}
-
-	fi->store = store;
-	fi->descr.ipproto = tunnel_proto;
-	fi->descr.mcast_ttl = CCN_FIB_MCASTTTL;
-	fi->lifetime = CCN_FIB_LIFETIME;
-
-	ccn_charbuf_append(store, "newface", strlen("newface") + 1);
-	host_off = store->length;
-	ccn_charbuf_append(store, rhostnamebuf, strlen(rhostnamebuf) + 1);
-	port_off = store->length;
-	ccn_charbuf_append(store, rhostportbuf, strlen(rhostportbuf) + 1);
-
-	char *b = (char *)store->buf;
-	fi->action = b;
-	fi->descr.address = b + host_off;
-	fi->descr.port = b + port_off;
-	fi->descr.source_address = NULL;
-	fi->ccnd_id = ccndid;
-	fi->ccnd_id_size = ccndid_size;
-
-	return fi;
-}
-
-/**
- * initialize local data
- */
-static void 
-init_data(struct ccn_charbuf *local_scope_template,
-        struct ccn_charbuf *no_name)
-{
-	ccn_charbuf_append_tt(local_scope_template, CCN_DTAG_Interest, CCN_DTAG);
-	ccn_charbuf_append_tt(local_scope_template, CCN_DTAG_Name, CCN_DTAG);
-	ccn_charbuf_append_closer(local_scope_template);    /* </Name> */
-	ccnb_tagged_putf(local_scope_template, CCN_DTAG_Scope, "1");
-	ccn_charbuf_append_closer(local_scope_template);    /* </Interest> */
-
-	ccn_name_init(no_name);
-}
-
-static int 
-add_delete_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int p, int operation,unsigned int tunnel_proto)
-{
-	struct ccn_charbuf *prefix;
-	char port[6];
-	struct ccn_charbuf *local_scope_template = ccn_charbuf_create();
-	struct ccn_charbuf *no_name = ccn_charbuf_create();
-	unsigned char ccndid_storage[32] = {0};
-	unsigned char *ccndid = ccndid_storage;
-	size_t ccndid_size = 0;
-	struct ccn_face_instance *fi;
-	struct ccn_face_instance *nfi;
-	int res;
-
-	prefix = ccn_charbuf_create();
-	res = ccn_name_from_uri(prefix, uri);
-	ON_ERROR_CLEANUP(res);
-	memset(port, 0, 6);
-	sprintf(port, "%d", p);
-
-	init_data(local_scope_template, no_name);
-
-	ccndid_size = get_ccndid(h, local_scope_template, ccndid);
-	if (ccndid_size != sizeof(ccndid_storage))
- 	{
-		fprintf(stderr, "Incorrect size for ccnd id in response\n");
-		ON_ERROR_CLEANUP(-1);
-	}
-
-	/* construct a face instance for new face request */
-	fi = construct_face(ccndid, ccndid_size, address, port,tunnel_proto);
-	ON_NULL_CLEANUP(fi);
-
-	/* send new face request to actually create a new face */
-	nfi = create_face(h, local_scope_template, no_name, fi);
-	ON_NULL_CLEANUP(nfi);
-
-
-	res = register_unregister_prefix(h, local_scope_template, no_name, prefix, nfi, operation);
-	ON_ERROR_CLEANUP(res);
-
-	int faceid=nfi->faceid;
-
-	ccn_charbuf_destroy(&local_scope_template);
-	ccn_charbuf_destroy(&no_name);
-	ccn_face_instance_destroy(&fi);
-	ccn_face_instance_destroy(&nfi);
-	ccn_charbuf_destroy(&prefix);
-
-	
-	return faceid;
-
-	cleanup:
-		ccn_charbuf_destroy(&prefix);
-		ccn_charbuf_destroy(&local_scope_template);
-		ccn_charbuf_destroy(&no_name);
-		ccn_face_instance_destroy(&fi);
-		ccn_face_instance_destroy(&nfi);
-
-	return -1;
-}
-
-
-int 
-add_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port, unsigned int tunnel_proto)
-{
-	return add_delete_ccn_face(h, uri, address, port, OP_REG,tunnel_proto);
-}
-
-
-int 
-delete_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port,unsigned int tunnel_proto)
-{
-	return add_delete_ccn_face(h, uri, address, port, OP_UNREG,tunnel_proto);
-}
-
diff --git a/nlsr_face.h b/nlsr_face.h
deleted file mode 100644
index d50ea09..0000000
--- a/nlsr_face.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _NLSR_FACE_H_
-#define _NLSR_FACE_H_
-
-#define CCN_FIB_LIFETIME ((~0U) >> 1)
-#define CCN_FIB_MCASTTTL (-1)
-#define OP_REG  0
-#define OP_UNREG 1
-
-int add_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port,unsigned int tunnel_proto);
-int delete_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port,unsigned int tunnel_proto);
-
-#endif
diff --git a/nlsr_fib.c b/nlsr_fib.c
deleted file mode 100644
index 25532b4..0000000
--- a/nlsr_fib.c
+++ /dev/null
@@ -1,236 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <string.h>
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/face_mgmt.h>
-#include <ccn/reg_mgmt.h>
-#include <ccn/charbuf.h>
-
-#include "nlsr_fib.h"
-#include "nlsr.h"
-
-
-static void 
-ccn_fib_warn(int lineno, const char *format, ...)
-{
-	struct timeval t;
-	va_list ap;
-	va_start(ap, format);
-	gettimeofday(&t, NULL);
-	fprintf(stderr, "%d.%06d ccn_fib[%d]:%d: ", (int)t.tv_sec, (unsigned)t.tv_usec, (int)getpid(), lineno);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-}
-
-#define ON_ERROR_CLEANUP(resval) \
-{           \
-    if ((resval) < 0) { \
-        ccn_fib_warn (__LINE__, "OnError cleanup\n"); \
-        goto cleanup; \
-    } \
-}
-
-#define ON_NULL_CLEANUP(resval) \
-{           \
-    if ((resval) == NULL) { \
-        ccn_fib_warn(__LINE__, "OnNull cleanup\n"); \
-        goto cleanup; \
-    } \
-}
-
-
-
-static int 
-register_unregister_prefix(struct ccn *h, struct ccn_charbuf *local_scope_template,
-        struct ccn_charbuf *no_name, struct ccn_charbuf *name_prefix,
-		const unsigned char *ccndid, size_t ccnd_id_size, int faceid, 
-		int operation, long int lifetime)
-{
-	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 = lifetime;
-
-	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:
-		if ( signed_info )
-			ccn_charbuf_destroy(&signed_info);
-		if ( temp )
-			ccn_charbuf_destroy(&temp);
-		if ( resultbuf )
-			ccn_charbuf_destroy(&resultbuf);
-		ccn_charbuf_destroy(&name);
-		if ( prefixreg )
-			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, long int lifetime)
-{
-	if ( nlsr->debugging )
-	{
-		printf("add_delete_ccn_face_by_face_id called\n");
-		printf("Uri: %s  Face: %d Operation: %s \n",(char *)uri , faceid, operation == OP_REG ? "Registration" : "Unregistration");
-	}
-
-	struct ccn_charbuf *prefix;
-	struct ccn_charbuf *local_scope_template = ccn_charbuf_create();
-	struct ccn_charbuf *no_name = ccn_charbuf_create();
-	unsigned char ccndid_storage[32] = {0};
-	unsigned char *ccndid = ccndid_storage;
-	size_t ccndid_size = 0;
-	int res;
-
-	prefix = ccn_charbuf_create();
-	res = ccn_name_from_uri(prefix, uri);
-	ON_ERROR_CLEANUP(res);
-
-
-	init_data(local_scope_template, no_name);
-
-	ccndid_size = get_ccndid(h, local_scope_template, ccndid);
-	if (ccndid_size != sizeof(ccndid_storage))
- 	{
-		fprintf(stderr, "Incorrect size for ccnd id in response\n");
-		ON_ERROR_CLEANUP(-1);
-	}
-
-	res = register_unregister_prefix(h, local_scope_template, no_name, prefix,ccndid, ccndid_size,faceid, operation,lifetime);
-	
-	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_fib.h b/nlsr_fib.h
deleted file mode 100644
index 544a943..0000000
--- a/nlsr_fib.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _NLSR_FIB_H_
-#define _NLSR_FIB_H_
-
-#define CCN_FIB_LIFETIME ((~0U) >> 1)
-#define CCN_FIB_MCASTTTL (-1)
-#define OP_REG  0
-#define OP_UNREG 1
-
-int add_delete_ccn_face_by_face_id(struct ccn *h, const char *uri, int operation,
- int faceid, long int lifetime);
-
-#endif
diff --git a/nlsr_km.c b/nlsr_km.c
deleted file mode 100644
index 9c93872..0000000
--- a/nlsr_km.c
+++ /dev/null
@@ -1,564 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include <unistd.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_km.h"
-#include "nlsr_km_util.h"
-#include "utility.h"
-
-int
-sign_content_with_user_defined_keystore(struct ccn_charbuf *content_name,
-										struct ccn_charbuf *resultbuf,
-										const void *data,
-										size_t data_size,
-										char *keystore_path,
-										char *keystore_passphrase,
-										char *key_repo_name,
-										char *site_name,
-										char *router_name,
-										long int freshness){
-	
-	if ( nlsr->debugging )
-		printf("sign_content_with_user_defined_keystore called\n");
-
-	
-	int res;
-
-
-	struct ccn_charbuf * pubid_out=ccn_charbuf_create();
-	struct ccn_charbuf * keyname;
-
-	
-	struct ccn_keystore *keystore = NULL;
-	keystore=ccn_keystore_create();
-	res=ccn_keystore_init(keystore, keystore_path,keystore_passphrase );
-	if ( res < 0 ){
-		if ( nlsr->debugging )
-			printf("Error in initiating keystore :(\n");
-		ccn_keystore_destroy(&keystore);
-		return -1;
-	}
-	
-
-	res=ccn_load_private_key	(nlsr->ccn,
-							keystore_path,
-							keystore_passphrase,
-							pubid_out);
-
-	if(res < 0 ){
-		if ( nlsr->debugging )
-			printf("Error in loading keystore :( \n");
-		ccn_charbuf_destroy(&pubid_out);
-		return -1;
-	}
-
-	char *baseuri=(char *)calloc(strlen(key_repo_name)+strlen(site_name)+
-				  strlen(router_name)+strlen("/%C1.R.N.Start")+5,sizeof(char));
-	memcpy(baseuri,key_repo_name,strlen(key_repo_name)+1);
-	if ( site_name[0] != '/')
-		memcpy(baseuri+strlen(baseuri),"/",1);
-	memcpy(baseuri+strlen(baseuri),site_name,strlen(site_name)+1);
-	memcpy(baseuri+strlen(baseuri),"/%C1.R.N.Start",strlen("/%C1.R.N.Start"));
-	memcpy(baseuri+strlen(baseuri),router_name,strlen(router_name)+1);
-	baseuri[strlen(baseuri)]='\0';
-	
-
-	keyname=ccn_charbuf_create();
-	if(keyname == NULL ){
-		ccn_charbuf_destroy(&pubid_out);
-		free(baseuri);
-		return -1;
-	}
-	ccn_name_from_uri(keyname,baseuri);
-	if ( res < 0 ){
-		if ( nlsr->debugging )
-			printf("Bad URI format: %s\n",baseuri);
-		ccn_charbuf_destroy(&pubid_out);
-		ccn_charbuf_destroy(&keyname);
-		free(baseuri);
-		return -1;		
-	}
-	
-	ccn_name_append_str(keyname,"nlsr");
-	struct ccn_charbuf *keyid = ccn_charbuf_create();
-	ccn_charbuf_append_value(keyid, CCN_MARKER_CONTROL, 1);
-	ccn_charbuf_append_string(keyid, ".M.K");
-	ccn_charbuf_append_value(keyid, 0, 1);
-	ccn_charbuf_append_charbuf(keyid, pubid_out);
-	ccn_name_append(keyname, keyid->buf, keyid->length);
-	
-	
-
-	struct ccn_charbuf *uri = ccn_charbuf_create();
-	ccn_uri_append(uri, keyname->buf, keyname->length, 0);
-	if ( nlsr->debugging )
-		printf("Key Name Included when processing content: %s\n", ccn_charbuf_as_string(uri));
-	ccn_charbuf_destroy(&uri);	
-
-	struct ccn_signing_params sp = CCN_SIGNING_PARAMS_INIT;
-	sp.type = CCN_CONTENT_DATA;
- 	sp.template_ccnb = ccn_charbuf_create();
-  	ccn_charbuf_append_tt(sp.template_ccnb, CCN_DTAG_SignedInfo, CCN_DTAG);
-	ccn_charbuf_append_tt(sp.template_ccnb, CCN_DTAG_KeyLocator, CCN_DTAG);
-  	ccn_charbuf_append_tt(sp.template_ccnb, CCN_DTAG_KeyName, CCN_DTAG);
-  	ccn_charbuf_append(sp.template_ccnb, keyname->buf, keyname->length); 
-	ccn_charbuf_append_closer(sp.template_ccnb); // KeyName closer
-  	ccn_charbuf_append_closer(sp.template_ccnb); // KeyLocator closer
-  	ccn_charbuf_append_closer(sp.template_ccnb); // SignedInfo closer
-
-	
-	sp.sp_flags |= CCN_SP_TEMPL_KEY_LOCATOR;
-	sp.sp_flags |= CCN_SP_FINAL_BLOCK;
-	sp.freshness = freshness;
-
-
-	if (pubid_out->length != sizeof(sp.pubid)){
-		if ( nlsr->debugging )
-			printf("Size of pubid and sp.pubid is not equal");
-		ccn_charbuf_destroy(&keyname);
-		ccn_charbuf_destroy(&pubid_out);
-		free(baseuri);
-		return -1;
-	}
-	
-	memcpy(sp.pubid, pubid_out->buf, pubid_out->length);
-	
-
-
-	res=ccn_sign_content(nlsr->ccn,resultbuf,content_name,&sp,data,data_size);
-	if( res < 0 ){
-		if ( nlsr->debugging )
-			printf("Content signing error \n");
-		ccn_charbuf_destroy(&sp.template_ccnb);
-		ccn_charbuf_destroy(&keyid);
-		ccn_charbuf_destroy(&keyname);
-		ccn_charbuf_destroy(&pubid_out);
-		free(baseuri);
- 		return -1;
-	}
-
-	ccn_keystore_destroy(&keystore);
-	ccn_charbuf_destroy(&sp.template_ccnb);
-	ccn_charbuf_destroy(&keyid);
-	ccn_charbuf_destroy(&keyname);
-	ccn_charbuf_destroy(&pubid_out);
-	
-	free(baseuri);
- 	return 0;
-}
-
-
-char * 
-get_orig_router_from_lsa_name(struct ccn_charbuf * content_name)
-{
-	int start=0;
-
-	size_t comp_size;
-	const unsigned char *second_last_comp;
-	char *second_comp_type;
-	char *sep=".";
-	char *rem;
-
-	struct ccn_indexbuf *components=ccn_indexbuf_create();
-	struct ccn_charbuf *name=ccn_charbuf_create();
-	ccn_name_from_uri(name,nlsr->slice_prefix);
-	ccn_name_split (name, components);
-	start=components->n-2;
-	ccn_charbuf_destroy(&name);
-	ccn_indexbuf_destroy(&components);
-
-	struct ccn_indexbuf *comps=ccn_indexbuf_create();
-	ccn_name_split (content_name, comps);
-	ccn_name_comp_get( content_name->buf, comps, 
-					  comps->n-1-2, &second_last_comp, &comp_size);
-
-	second_comp_type=strtok_r((char *)second_last_comp, sep, &rem);
-	if ( strcmp( second_comp_type, "lsId" ) == 0 ){
-		ccn_name_chop(content_name,comps,-3);
-	}
-	else{
-		ccn_name_chop(content_name,comps,-2);
-	}
-	
-
-	struct ccn_charbuf *temp=ccn_charbuf_create();
-	ccn_name_init(temp);	
-	ccn_name_append_components( temp,	content_name->buf,
-								comps->buf[start+1], 
-								comps->buf[comps->n - 1]);
-
-	struct ccn_charbuf *temp1=ccn_charbuf_create();
-	ccn_uri_append(temp1, temp->buf, temp->length, 0);
-
-	char *orig_router=(char *)calloc(strlen(ccn_charbuf_as_string(temp1))+1,
-																sizeof(char));
-	memcpy(orig_router,ccn_charbuf_as_string(temp1),
-										strlen(ccn_charbuf_as_string(temp1)));
-	orig_router[strlen(orig_router)]='\0';
-	
-	ccn_charbuf_destroy(&temp);
-	ccn_charbuf_destroy(&temp1);
-	ccn_indexbuf_destroy(&comps);
-	return orig_router;
-	
-
-}
-
-
-char * 
-get_orig_router_from_info_content_name(struct ccn_charbuf * content_name)
-{
-	int start,end;
-
-	start=0;
-
-	struct ccn_indexbuf *comps=ccn_indexbuf_create();
-	ccn_name_split (content_name, comps);
-
-	end=check_for_name_component_in_name(content_name,comps,"nlsr");
-
-
-	struct ccn_charbuf *temp=ccn_charbuf_create();
-	ccn_name_init(temp);	
-	ccn_name_append_components( temp,	content_name->buf,
-								comps->buf[start], 
-								comps->buf[end]);
-
-	struct ccn_charbuf *temp1=ccn_charbuf_create();
-	ccn_uri_append(temp1, temp->buf, temp->length, 0);
-
-	char *orig_router=(char *)calloc(strlen(ccn_charbuf_as_string(temp1))+1,
-																sizeof(char));
-	memcpy(orig_router,ccn_charbuf_as_string(temp1),
-										strlen(ccn_charbuf_as_string(temp1)));
-	orig_router[strlen(orig_router)]='\0';
-	
-	ccn_charbuf_destroy(&temp);
-	ccn_charbuf_destroy(&temp1);
-	ccn_indexbuf_destroy(&comps);
-	return orig_router;
-	
-
-}
-
-
-int 
-check_key_name_hierarchy(const unsigned char *ccnb, 
-										struct ccn_parsed_ContentObject *pco,
-										int key_type, int content_type){
-	if ( nlsr->debugging )
-		printf("check_key_name_hierarchy called\n");	
-	if (key_type == UNKNOWN_KEY ){
-		return 1;
-	}
-	//int res;
-	struct ccn_charbuf *key_name=get_key_name(ccnb, pco);
-
-	struct ccn_charbuf *key_uri = ccn_charbuf_create();
-	ccn_uri_append(key_uri, key_name->buf, key_name->length, 0);
-	if ( nlsr->debugging )
-		printf("Key Name: %s\n",ccn_charbuf_as_string(key_uri));
-	ccn_charbuf_destroy(&key_uri);
-
-	struct ccn_charbuf *content_name=ccn_charbuf_create();
-	ccn_charbuf_append(content_name, ccnb + pco->offset[CCN_PCO_B_Name],
-			pco->offset[CCN_PCO_E_Name] - pco->offset[CCN_PCO_B_Name]);
-
-	struct ccn_charbuf *content_uri = ccn_charbuf_create();
-	ccn_uri_append(content_uri, content_name->buf, content_name->length, 0);
-	if ( nlsr->debugging )
-		printf("Content Name: %s\n",ccn_charbuf_as_string(content_uri));
-	ccn_charbuf_destroy(&content_uri);
-	
-	if ( key_type == NLSR_KEY){
-		char *orig_router_key_name=get_orig_router_from_key_name(key_name,0,0);
-		char *orig_router_content_name;
-		if ( content_type == 1 ){
-			orig_router_content_name=get_orig_router_from_lsa_name(content_name);
-		}
-		else if ( content_type == 0 ){
-			orig_router_content_name=get_orig_router_from_info_content_name(content_name);
-		}
-		if ( nlsr->debugging ){
-			printf("Orig Router (Key Name):%s\n",orig_router_key_name);
-			printf("Orig Router (Content Name):%s\n",orig_router_content_name);
-		}
-
-		if (strcmp(orig_router_key_name,orig_router_content_name) == 0 ){
-			free(orig_router_key_name);
-			free(orig_router_content_name);
-			ccn_charbuf_destroy(&key_name);
-			ccn_charbuf_destroy(&content_name);
-			return 1;
-		}
-	}
-
-	if ( key_type == ROUTING_KEY){
-		char *orig_router_key_name=get_orig_router_from_key_name(key_name,1,0);
-		char *orig_router_content_name=get_orig_router_from_key_name(content_name,1,1);
-		if ( nlsr->debugging ){
-			printf("Orig Router (Key Name):%s\n",orig_router_key_name);
-			printf("Orig Router (Content Name):%s\n",orig_router_content_name);
-		}
-		
-		if (strcmp(orig_router_key_name,orig_router_content_name) == 0 ){
-			free(orig_router_key_name);
-			free(orig_router_content_name);
-			ccn_charbuf_destroy(&key_name);
-			ccn_charbuf_destroy(&content_name);
-			return 1;
-		}
-	}
-	if ( key_type == OPERATOR_KEY){
-		struct ccn_indexbuf *key_name_comps;
-		key_name_comps = ccn_indexbuf_create();
-		ccn_name_split(key_name, key_name_comps);
-		int last_indx=check_for_tag_component_in_name(key_name,key_name_comps,"O.N.Start");
-		char *site_key_prefix_key=get_name_segments_from_name(key_name,0,last_indx);
-		if ( nlsr->debugging )	
-			printf("Site key prefix(key Name):%s\n",site_key_prefix_key);
-		ccn_indexbuf_destroy(&key_name_comps);
-
-		struct ccn_indexbuf *content_name_comps;
-		content_name_comps = ccn_indexbuf_create();
-		ccn_name_split(content_name, content_name_comps);
-		int last_indx_rtr=check_for_tag_component_in_name(content_name,content_name_comps,"R.N.Start");
-		char *site_key_prefix_content=get_name_segments_from_name(key_name,0,last_indx_rtr);
-		if ( nlsr->debugging )
-			printf("Site key prefix(Content Name):%s\n",site_key_prefix_content);
-		ccn_indexbuf_destroy(&content_name_comps);
-
-		if( strcmp(site_key_prefix_key,site_key_prefix_content) == 0 ){
-			free(site_key_prefix_key);
-			free(site_key_prefix_content);
-			ccn_charbuf_destroy(&key_name);
-			ccn_charbuf_destroy(&content_name);
-			return 1;
-		}
-
-	}
-
-	if ( key_type == SITE_KEY){
-		struct ccn_indexbuf *key_name_comps;
-		key_name_comps = ccn_indexbuf_create();
-		ccn_name_split(key_name, key_name_comps);
-		int last_indx=check_for_tag_component_in_name(key_name,key_name_comps,"M.K");
-		char *site_key_prefix_key=get_name_segments_from_name(key_name,0,last_indx);
-		if ( nlsr->debugging )
-			printf("Site key prefix(key Name):%s\n",site_key_prefix_key);
-		ccn_indexbuf_destroy(&key_name_comps);
-
-		struct ccn_indexbuf *content_name_comps;
-		content_name_comps = ccn_indexbuf_create();
-		ccn_name_split(content_name, content_name_comps);
-		int last_indx_rtr=check_for_tag_component_in_name(content_name,content_name_comps,"O.N.Start");
-		char *site_key_prefix_content=get_name_segments_from_name(key_name,0,last_indx_rtr);
-		if ( nlsr->debugging )
-			printf("Site key prefix(Content Name):%s\n",site_key_prefix_content);
-		ccn_indexbuf_destroy(&content_name_comps);
-
-		if( strcmp(site_key_prefix_key,site_key_prefix_content) == 0 ){
-			free(site_key_prefix_key);
-			free(site_key_prefix_content);
-			ccn_charbuf_destroy(&key_name);
-			ccn_charbuf_destroy(&content_name);
-			return 1;
-		}
-
-	}
-	
-	if ( key_type == ROOT_KEY){
-		ccn_charbuf_destroy(&key_name);
-		ccn_charbuf_destroy(&content_name);
-		return 1;
-	}
-
-	ccn_charbuf_destroy(&key_name);
-	ccn_charbuf_destroy(&content_name);
-	return 0;
-}
-
-int 
-verify_key(const unsigned char *ccnb, 
-		struct ccn_parsed_ContentObject *pco,
-		int content_type){
-	if ( nlsr->debugging )
-		printf("verify key called\n");
-	int ret=-1;
-	
-	if ( contain_key_name(ccnb, pco) == 1){
-		
-		struct ccn_charbuf *key_name=get_key_name(ccnb, pco);
-		struct ccn_charbuf *key_uri = ccn_charbuf_create();
-		ccn_uri_append(key_uri, key_name->buf, key_name->length, 0);
-		if ( nlsr->debugging )
-			printf("Key Name from Incoming Content: %s\n",ccn_charbuf_as_string(key_uri));
-		int key_type=get_key_type_from_key_name(key_name);
-		if ( nlsr->debugging )		
-			printf("Key Type: %d \n",key_type);
-
-		struct ccn_charbuf *result = ccn_charbuf_create();
-		struct ccn_parsed_ContentObject temp_pco = {0};
-		int get_flags = 0;
-		get_flags |= CCN_GET_NOKEYWAIT;
-		int counter = 0;
-		while(ccn_get(nlsr->ccn, key_name, NULL, 500, result, &temp_pco, NULL, 
-										get_flags) < 0 && counter < 3) counter++;
-
-		int chk_verify=ccn_verify_content(nlsr->ccn,ccnb,pco);		
-
-		if ( chk_verify == 0 ){
-			if ( nlsr->debugging )
-				printf("Content verification Successful :)\n");
-
-			if ( counter == 3){
-				if ( nlsr->debugging )
-					printf("Could not retrieve key by name !!!\n");
-			}
-			else{
-				if ( key_type == ROOT_KEY ){
-					ret=0;
-				}
-				else{
-					if ( nlsr->isStrictHierchicalKeyCheck ){
-						int key_name_test=check_key_name_hierarchy(ccnb,
-																	pco,
-																	key_type,
-																	content_type);
-						if ( key_name_test == 1){
-							ret=verify_key(result->buf,&temp_pco,content_type);
-						}
-					}
-					else{ 
-						ret=verify_key(result->buf,&temp_pco,content_type);
-					}
-				}
-			}
-		}
-		ccn_charbuf_destroy(&result);
-		ccn_charbuf_destroy(&key_uri);
-		ccn_charbuf_destroy(&key_name);
-		return ret;
-	}
-
-	return ret;
-}
-
-void
-destroy_keys(void)
-{	
-	int i, key_element;
-	struct nlsr_key *key;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->keys, e);
-	key_element=hashtb_n(nlsr->keys);
-
-	for(i=0;i<key_element;i++)
-	{
-		key=e->data;
-		free(key->key_name);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-	
-	if( nlsr->keys )
-		hashtb_destroy(&nlsr->keys);
-
-}
-
-void
-print_keys(void){
-
-	if ( nlsr->debugging )
-		printf("print_keys called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_keys called \n");		
-	
-	int i, key_element;
-	struct nlsr_key *key;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->keys, e);
-	key_element=hashtb_n(nlsr->keys);
-
-	for(i=0;i<key_element;i++)
-	{
-		key=e->data;
-		
-		if ( nlsr->debugging )
-			printf("Key : %s \n",key->key_name);
-			
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-int
-does_key_exist(char *keyname){
-	if (nlsr->debugging)
-	{
-		printf("does_key_exist called\n");
-		printf("Keyname : %s \n",keyname);
-	}
-
-	int ret=0;
-
-	unsigned *v;
-	v = hashtb_lookup(nlsr->keys, keyname, strlen(keyname));
-	if (v != NULL){
-		ret = 1;
-		if (nlsr->debugging)
-			printf("Key Found\n");
-	}
-	
-	return ret;
-}
-
-void
-add_key(char *keyname){
-	if (nlsr->debugging)
-	{
-		printf("add_key called\n");
-		printf("Keyname : %s \n",keyname);
-	}
-
-	struct nlsr_key *key;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->keys, e);
-    	res = hashtb_seek(e, keyname, strlen(keyname), 0);
-
-	if(res == HT_NEW_ENTRY )
-	{
-		key=e->data;
-		key->key_name=(char *)calloc(strlen(keyname)+1,sizeof(char));
-		memcpy(key->key_name,keyname,strlen(keyname)+1);
-	}
-
-	if (nlsr->debugging)
-		print_keys();
-}
diff --git a/nlsr_km.h b/nlsr_km.h
deleted file mode 100644
index cfaa0d5..0000000
--- a/nlsr_km.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef _NLSR_KM_H_
-#define _NLSR_KM_H_
-
-enum key_type{
-	ROOT_KEY, //0
-	SITE_KEY, //1
-	OPERATOR_KEY,//2
-	ROUTING_KEY,//3
-	NLSR_KEY,//4
-	UNKNOWN_KEY//5
-};
-
-
-struct nlsr_key{
-	char *key_name;
-};
-
-
-int
-sign_content_with_user_defined_keystore(struct ccn_charbuf *content_name,
-										struct ccn_charbuf *resultbuf,
-										const void *data,
-										size_t data_size,
-										char *keystore_path,
-										char *keystore_passphrase,
-										char *key_repo_name,
-										char *site_name,
-										char *router_name,
-										long int freshness);
-
-int	contain_key_name(const unsigned char *ccnb, 
-					struct ccn_parsed_ContentObject *pco);
-struct ccn_charbuf * get_key_name(const unsigned char *ccnb, 
-					struct ccn_parsed_ContentObject *pco);
-
-int verify_key(const unsigned char *ccnb, 
-				struct ccn_parsed_ContentObject *pco,
-				int content_type);
-
-void add_key(char *keyname);
-int does_key_exist(char *keyname);
-
-void destroy_keys(void);
-
-#endif
diff --git a/nlsr_km_util.c b/nlsr_km_util.c
deleted file mode 100644
index 94b3816..0000000
--- a/nlsr_km_util.c
+++ /dev/null
@@ -1,265 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include <unistd.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_km_util.h"
-#include "nlsr_km.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;
-}
-
-int
-contain_key_name(const unsigned char *ccnb, struct ccn_parsed_ContentObject *pco) 
-{
-	if (pco->offset[CCN_PCO_B_KeyLocator] == pco->offset[CCN_PCO_E_KeyLocator])
-		return -1;
-
-	struct ccn_buf_decoder decoder;
-	struct ccn_buf_decoder *d;
-	d = ccn_buf_decoder_start(&decoder, ccnb + 
-		pco->offset[CCN_PCO_B_Key_Certificate_KeyName], 
-		pco->offset[CCN_PCO_E_Key_Certificate_KeyName] - 
-		pco->offset[CCN_PCO_B_Key_Certificate_KeyName]);
-	if (ccn_buf_match_dtag(d, CCN_DTAG_KeyName))
-		return 1;
-
-	return -1;
-}
-
-struct ccn_charbuf *
-get_key_name(const unsigned char *ccnb, struct ccn_parsed_ContentObject *pco) 
-{
-	struct ccn_charbuf *key_name = ccn_charbuf_create();
-	ccn_charbuf_append(key_name, ccnb + pco->offset[CCN_PCO_B_KeyName_Name], 
-	pco->offset[CCN_PCO_E_KeyName_Name] - pco->offset[CCN_PCO_B_KeyName_Name]);
-
-	return key_name;
-}
-
-
-int
-check_for_name_component_in_name(const struct ccn_charbuf *name, 
-								const struct ccn_indexbuf *indx,
-								const char *component){
-	
-	int res,i;
-	int result_position=0;
-	int name_comps=(int)indx->n;
-
-	for(i=0;i<name_comps;i++){
-		res=ccn_name_comp_strcmp(name->buf,indx,i,component);
-		if( res == 0){
-			
-				result_position=i;
-				break;
-		}	
-	}
-
-	return result_position;
-}
-
-
-int
-check_for_tag_component_in_name(const struct ccn_charbuf *name, 
-								const struct ccn_indexbuf *indx,
-								const char *component){
-	
-	int res,i;
-	int result_position=0;
-	int name_comps=(int)indx->n;
-
-	for(i=0;i<name_comps;i++){
-		const unsigned char *comp_ptr;
-		size_t comp_size;
-		res=ccn_name_comp_get(name->buf, indx,i,&comp_ptr, &comp_size);
-		if( res == 0){
-			if ( strstr((char *)comp_ptr,component) != NULL ){
-				result_position=i;
-				break;
-			}
-		}	
-	}
-
-	return result_position;
-}
-
-enum key_type
-get_key_type_from_key_name(struct ccn_charbuf *keyname)
-{
-	if ( nlsr->debugging )	
-		printf("get_key_type_from_key_name called\n");
-
-	int res;
-	int return_key=UNKNOWN_KEY;	
-
-	struct ccn_indexbuf *indx=ccn_indexbuf_create();
-	if ( indx == NULL ){
-		if ( nlsr->debugging )
-			printf("Error in creating index for key name \n");
-		return UNKNOWN_KEY;
-	}
-
-	res=ccn_name_split(keyname,indx);
-	if ( res < 0 ){
-		if ( nlsr->debugging )
-			printf("Error in parsing key name \n");
-		ccn_indexbuf_destroy(&indx);
-		return UNKNOWN_KEY;
-	}
-	else if ( res == 3){
-		int chk_ndn=check_for_name_component_in_name(keyname,indx,"ndn");
-		int chk_key=check_for_name_component_in_name(keyname,indx,"keys");
-		if ( chk_ndn == 0 && chk_key == 1)
-			return_key=ROOT_KEY;
-	}
-	else{
-		int check_op,check_rt;
-		check_op=check_for_tag_component_in_name(keyname,indx,
-													 "O.N.Start");
-		check_rt=check_for_tag_component_in_name(keyname,indx,
-													 "R.N.Start");
-		if ( check_op > 0){
-			return_key=OPERATOR_KEY;
-		}
-		else if(check_rt >0){
-			int check_nlsr;
-			check_nlsr=check_for_name_component_in_name(keyname,indx,
-													 "nlsr");
-			if ( check_rt > 0 ){
-				if ( check_nlsr > 0){
-					return_key=NLSR_KEY;
-				}
-				else{
-					return_key=ROUTING_KEY;
-				}
-			}
-		}
-		else if ( check_rt == 0 && check_op == 0 && res > 3){
-			return_key=SITE_KEY;
-		}
-	}
-
-	ccn_indexbuf_destroy(&indx);
-	return return_key;
-}
-
-
-char *
-get_name_segments_from_name(struct ccn_charbuf *name, int start_indx, int end_indx) 
-{
-	int res;	
-	struct ccn_indexbuf *name_comps;
-	struct ccn_charbuf *orig_router;
-	char *name_seg=NULL;
-
-	name_comps = ccn_indexbuf_create();
-	res = ccn_name_split(name, name_comps);
-	if ( res < 0 ){
-		ccn_indexbuf_destroy(&name_comps);
-		return name_seg;
-	}
-	else{		
-		orig_router=ccn_charbuf_create();
-		ccn_name_init(orig_router);	
-		ccn_name_append_components(orig_router,name->buf,
-										name_comps->buf[start_indx], 
-										name_comps->buf[end_indx]);
-		struct ccn_charbuf *temp1=ccn_charbuf_create();
-		ccn_uri_append(temp1, orig_router->buf, orig_router->length, 0);
-
-		name_seg=(char *)calloc(strlen(ccn_charbuf_as_string(temp1))+1,
-																sizeof(char));
-		memcpy(name_seg,ccn_charbuf_as_string(temp1),
-										strlen(ccn_charbuf_as_string(temp1)));
-		name_seg[strlen(name_seg)]='\0';
-		ccn_charbuf_destroy(&orig_router);
-		ccn_charbuf_destroy(&temp1);
-		
-	}	
-
-	ccn_indexbuf_destroy(&name_comps);
-	return name_seg;
-}
-
-
-char *
-get_orig_router_from_key_name(struct ccn_charbuf *name, int more, int type) 
-{
-	int res;	
-	struct ccn_indexbuf *name_comps;
-	struct ccn_charbuf *orig_router;
-	char *router=NULL;
-
-	name_comps = ccn_indexbuf_create();
-	res = ccn_name_split(name, name_comps);
-	if ( res < 0 ){
-		ccn_indexbuf_destroy(&name_comps);
-		return router;
-	}
-	else{
-		res=ccn_name_chop(name, name_comps, -(2-more));
-		if ( more > 0 && type==1)
-		res=ccn_name_chop(name, name_comps, -3);
-		if ( res < 0 ){
-			ccn_indexbuf_destroy(&name_comps);
-			return NULL;
-		}
-		else{
-			res=check_for_tag_component_in_name(name,name_comps,"R.N.Start");
-			if ( res > 0 ){
-				orig_router=ccn_charbuf_create();
-				ccn_name_init(orig_router);	
-				ccn_name_append_components(orig_router,name->buf,
-										name_comps->buf[res+1], 
-										name_comps->buf[name_comps->n - 1]);
-				struct ccn_charbuf *temp1=ccn_charbuf_create();
-				ccn_uri_append(temp1, orig_router->buf, orig_router->length, 0);
-
-				router=(char *)calloc(strlen(ccn_charbuf_as_string(temp1))+1,
-																sizeof(char));
-				memcpy(router,ccn_charbuf_as_string(temp1),
-										strlen(ccn_charbuf_as_string(temp1)));
-				router[strlen(router)]='\0';
-				ccn_charbuf_destroy(&temp1);
-				ccn_charbuf_destroy(&orig_router);
-			}
-			else{
-				ccn_indexbuf_destroy(&name_comps);
-				return NULL;
-			}
-		}
-	}	
-
-	ccn_indexbuf_destroy(&name_comps);
-	return router;
-}
-
diff --git a/nlsr_km_util.h b/nlsr_km_util.h
deleted file mode 100644
index 750cbe9..0000000
--- a/nlsr_km_util.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _NLSR_KM_UTIL_H_
-#define _NLSR_KM_UTIL_H_
-
-int
-contain_key_name(const unsigned char *ccnb, 
-				struct ccn_parsed_ContentObject *pco);
-
-struct ccn_charbuf *
-get_key_name(const unsigned char *ccnb, 
-				struct ccn_parsed_ContentObject *pco);
-
-int
-check_for_name_component_in_name(const struct ccn_charbuf *name, 
-								const struct ccn_indexbuf *indx,
-								const char *component);
-int
-check_for_tag_component_in_name(const struct ccn_charbuf *name, 
-								const struct ccn_indexbuf *indx,
-								const char *component);
-enum key_type
-get_key_type_from_key_name(struct ccn_charbuf *keyname); 
-
-
-int
-appendLifetime(struct ccn_charbuf *cb, int lifetime);
-
-char * 
-get_orig_router_from_key_name(struct ccn_charbuf *name, int more, int type);
-
-
-
-char *
-get_name_segments_from_name(struct ccn_charbuf *name, 
-							int start_indx, int end_indx);
-
-#endif
diff --git a/nlsr_lsdb.c b/nlsr_lsdb.c
deleted file mode 100644
index dd96b57..0000000
--- a/nlsr_lsdb.c
+++ /dev/null
@@ -1,2862 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-#include "nlsr.h"
-#include "nlsr_ndn.h"
-#include "nlsr_lsdb.h"
-#include "utility.h"
-#include "nlsr_npl.h"
-#include "nlsr_adl.h"
-#include "nlsr_route.h"
-#include "nlsr_npt.h"
-#include "nlsr_sync.h"
-
-/**
-* LSDB version is updated to last updated timestamp
-*/
-
-void
-set_new_lsdb_version(void)
-{
-	free(nlsr->lsdb->lsdb_version);
-	nlsr->lsdb->lsdb_version=get_current_timestamp_micro_v2();
-}
-
-/**
-* Make key for storing Name LSA in Name LSDB
-*/
-
-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,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));
-	key[strlen(key)]='\0';	
-
-	if ( nlsr->debugging )
-		printf("name LSA Key: %s\n", key);
-}
-
-
-/**
-* Make content name prefix for Name LSA to store in repo
-*/
-
-void 
-make_name_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, 
-							long int ls_id,char *orig_time,char *slice_prefix)
-{
-	sprintf(key,"%s%s/lsType.%d/lsId.%ld/%s",slice_prefix, orig_router, ls_type,
-															 ls_id, orig_time);
-	key[strlen(key)]='\0';
-	if ( nlsr->debugging )
-		printf("Name LSA prefix for repo content: %s\n",key);
-}
-
-/**
-* Make content name prefix for Adj LSA to store in repo
-*/
-
-void 
-make_adj_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, 
-											char *orig_time,char *slice_prefix)
-{
-		
-	sprintf(key,"%s%s/lsType.%d/%s",slice_prefix,orig_router,ls_type, orig_time );	
-	key[strlen(key)]='\0';
-	if ( nlsr->debugging )
-		printf("Name LSA prefix for repo content:%s\n",key);	
-}
-
-/**
-* Make content name prefix for Cor LSA to store in repo
-*/
-
-void 
-make_cor_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, 
-											char *orig_time,char *slice_prefix)
-{
-		
-	sprintf(key,"%s%s/lsType.%d/%s",slice_prefix,orig_router,ls_type, orig_time );	
-	key[strlen(key)]='\0';
-	if ( nlsr->debugging )
-		printf("Cor LSA prefix for repo content:%s\n",key);	
-}
-
-
-
-void
-destroy_name_lsa_component(struct nlsa * name_lsa)
-{
-	if ( name_lsa->header->orig_router->name )
-		free(name_lsa->header->orig_router->name);
-	if ( name_lsa->header->orig_router )
-		free(name_lsa->header->orig_router);
-	if ( name_lsa->header->orig_time )
-		free(name_lsa->header->orig_time);
-	if ( name_lsa->header ) 
-		free(name_lsa->header);
-
-	if ( name_lsa->name_prefix->name )
-		free(name_lsa->name_prefix->name);
-	if ( name_lsa->name_prefix )
-		free(name_lsa->name_prefix);
-}
-
-void
-destroy_name_lsa(struct nlsa * name_lsa)
-{
-	destroy_name_lsa_component(name_lsa);
-	if ( name_lsa )
-		free(name_lsa);
-}
-
-void
-destroy_adj_lsa_component(struct alsa * adj_lsa)
-{
-	if ( adj_lsa->header->orig_router->name )
-		free(adj_lsa->header->orig_router->name);
-	if ( adj_lsa->header->orig_router )
-		free(adj_lsa->header->orig_router);
-	if ( adj_lsa->header->orig_time )
-		free(adj_lsa->header->orig_time);
-	if ( adj_lsa->header ) 
-		free(adj_lsa->header);
-
-	if ( adj_lsa->body )
-		free(adj_lsa->body);
-}
-
-void 
-destroy_adj_lsa(struct alsa * adj_lsa)
-{
-	
-	destroy_adj_lsa_component(adj_lsa);
-	if ( adj_lsa )
-		free(adj_lsa);
-}
-
-void
-destroy_cor_lsa_component(struct clsa * cor_lsa)
-{
-	if ( cor_lsa->header->orig_router->name )
-		free(cor_lsa->header->orig_router->name);
-	if ( cor_lsa->header->orig_router )
-		free(cor_lsa->header->orig_router);
-	if ( cor_lsa->header->orig_time )
-		free(cor_lsa->header->orig_time);
-	if ( cor_lsa->header ) 
-		free(cor_lsa->header);
-}
-
-void 
-destroy_cor_lsa(struct clsa * cor_lsa)
-{
-	
-	destroy_cor_lsa_component(cor_lsa);
-	if ( cor_lsa )
-		free(cor_lsa);
-}
-
-/**
-* Build name lsa for all name prefixes in Name Prefix List (NPL). Intsall Name
-* LSA in Name LSDB for router itself.
-*/
-
-
-void 
-build_and_install_name_lsas(void)
-{
-	if ( nlsr->debugging )
-		printf("build_and_install_name_lsas called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_and_install_name_lsas "
-																	"called\n");
-
-	int i, npl_element;
-	struct name_prefix_list_entry *npe;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npl, e);
-	npl_element=hashtb_n(nlsr->npl);
-
-	for(i=0;i<npl_element;i++)
-	{
-		npe=e->data;
-		struct nlsa *name_lsa=(struct nlsa *)malloc(sizeof( struct nlsa ));
-		build_name_lsa(name_lsa,npe->np);
-		
-		install_name_lsa(name_lsa);
-		update_nlsa_id_for_name_in_npl(npe->np,name_lsa->header->ls_id);
-		destroy_name_lsa(name_lsa);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);	
-	
-	print_name_prefix_from_npl();
-
-}
-
-/**
-* Build and Install one Name LSA Use ful for API
-*/
-
-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);
-	destroy_name_lsa(name_lsa);
-	print_name_prefix_from_npl();
-
-}
-
-/**
-* Build Name LSA for own router from name_prefix np and fill up the name_lsa
-*/
-
-
-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=get_current_timestamp_micro_v2();
-	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 *)calloc(1,
-													sizeof(struct name_prefix ));
-	name_lsa->header->orig_router->name=(char *)calloc(
-										strlen(nlsr->router_name)+1,sizeof(char));
-	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 *)calloc(np->length,sizeof(char));
-	memcpy(name_lsa->name_prefix->name,np->name,np->length);
-	name_lsa->name_prefix->length=np->length;
-
-}
-
-/**
-* install name lsa into lsdb
-*/
-
-void 
-install_name_lsa(struct nlsa *name_lsa)
-{
-
-	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 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 ( name_lsa->header->isValid == 1 )
-			{
-			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 *)calloc(1,
-												sizeof(struct nlsa_header ));
-			new_name_lsa->header->ls_type=name_lsa->header->ls_type;
-
-			new_name_lsa->header->orig_time=(char *)calloc(
-							strlen(name_lsa->header->orig_time)+1,sizeof(char));
-			//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 *)calloc(1,
-													sizeof(struct name_prefix ));
-			new_name_lsa->header->orig_router->name=(char *)calloc(
-							name_lsa->header->orig_router->length,sizeof(char));
-			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 *)calloc(1,
-												sizeof(struct name_prefix ));
-			new_name_lsa->name_prefix->name=(char *)calloc(
-									name_lsa->name_prefix->length,sizeof(char));
-			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 ins"
-															"tall_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 
-			{
-				hashtb_delete(e);
-			}
-
-		}
-		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. Di"
-																"scarded...\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 De"
-									"leted from LSDB\n",
-											name_lsa->header->orig_router->name);
-						if ( nlsr->detailed_logging )
-							writeLogg(__FILE__,__FUNCTION__,__LINE__,"isValid b"
-							"it 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));
-				
-					new_name_lsa->header->isValid=name_lsa->header->isValid;
-
-					free(new_name_lsa->name_prefix->name);
-					free(new_name_lsa->name_prefix);
-					new_name_lsa->name_prefix=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-					new_name_lsa->name_prefix->name=(char *)malloc(name_lsa->name_prefix->length);
-					memcpy(new_name_lsa->name_prefix->name,name_lsa->name_prefix->name,name_lsa->name_prefix->length);
-					new_name_lsa->name_prefix->length=name_lsa->name_prefix->length;
-
-
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Name-LSA\n");
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Adding name lsa\n");
-					write_log_for_name_lsa(new_name_lsa);
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," name_lsa_end\n");
-
-					if ( nlsr->debugging )
-						printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-					set_new_lsdb_version();	
-
-					if ( nlsr->debugging )
-						printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-
-					if( is_npt_update == 1 )
-					{
-						//struct hashtb *face_list;
-						int num_next_hop=get_number_of_next_hop(new_name_lsa->header->orig_router->name);
-						if ( num_next_hop < 0 )
-						{
-							
-							int check=add_npt_entry(new_name_lsa->header->orig_router->name,new_name_lsa->name_prefix->name,NO_NEXT_HOP,NULL,NULL);
-							if ( check == HT_NEW_ENTRY )
-							{
-								if ( nlsr->debugging )
-									printf("Added in npt \n");
-								if ( nlsr->detailed_logging )
-									writeLogg(__FILE__,__FUNCTION__,__LINE__,"Added in npt \n");
-							}
-						}
-						else 
-						{
-							int *faces=malloc(num_next_hop*sizeof(int));
-							int *route_costs=malloc(num_next_hop*sizeof(int));			
-							int next_hop=get_next_hop(new_name_lsa->header->orig_router->name,faces,route_costs);
-							
-							if ( nlsr->debugging )
-							{
-								printf("Printing from install_name_lsa \n");
-								int j;
-								for(j=0;j<num_next_hop;j++)
-								printf("Face: %d Route Cost: %d \n",faces[j],route_costs[j]);
-							}
-							if ( nlsr->detailed_logging )
-							{
-								writeLogg(__FILE__,__FUNCTION__,__LINE__,"Printing from install_name_lsa \n");
-								int j;
-								for(j=0;j<num_next_hop;j++)
-									writeLogg(__FILE__,__FUNCTION__,__LINE__,"Face: %d Route Cost: %d \n",faces[j],route_costs[j]);
-							}
-
-							
-							int check=add_npt_entry(new_name_lsa->header->orig_router->name,new_name_lsa->name_prefix->name,next_hop,faces,route_costs);
-							if ( check == HT_NEW_ENTRY )
-							{
-								if ( nlsr->debugging )
-									printf("Added in npt \n");
-								if ( nlsr->detailed_logging )
-									writeLogg(__FILE__,__FUNCTION__,__LINE__,"Added in npt \n");
-							}
-							free(faces);
-							free(route_costs);
-							
-						}
-						
-					}
-				}
-			}
-		
-		}
-
-    		hashtb_end(e);
-
-		free(key);
-}
-
-/**
-* Write log for name LSA
-*/
-
-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");
-}
-
-/**
-* Build and install name LSA by the parameter provided
-*/
-
-
-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();
-	
-	destroy_name_lsa(name_lsa);
-	
-}
-
-/**
-* Build name LSA by the parameter provided
-*/
-
-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 *)calloc(1,sizeof(struct nlsa_header ));
-	name_lsa->header->ls_type=LS_TYPE_NAME;
-
-	name_lsa->header->orig_time=(char *)calloc(strlen(orig_time)+1,sizeof(char));
-	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 *)calloc(1,sizeof(struct name_prefix ));
-	name_lsa->header->orig_router->name=(char *)calloc(strlen(orig_router)+1,sizeof(char));
-	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 *)calloc(1,sizeof(struct name_prefix ));
-	name_lsa->name_prefix->name=(char *)calloc(strlen(np)+1,sizeof(char));
-	memcpy(name_lsa->name_prefix->name,np,strlen(np)+1);
-	name_lsa->name_prefix->length=strlen(np)+1;
-}
-
-
-void 
-make_cor_lsa_key(char *key,struct clsa *cor_lsa)
-{
-	memcpy(key+strlen(key),cor_lsa->header->orig_router->name,cor_lsa->header->orig_router->length);
-	memcpy(key+strlen(key),"/",1);
-	char ls_type[2];
-	sprintf(ls_type,"%d",cor_lsa->header->ls_type);
-	memcpy(key+strlen(key),ls_type,strlen(ls_type));
-	key[strlen(key)]='\0';
-}
-
-
-void 
-make_adj_lsa_key(char *key,struct alsa *adj_lsa)
-{
-	memcpy(key+strlen(key),adj_lsa->header->orig_router->name,adj_lsa->header->orig_router->length);
-	memcpy(key+strlen(key),"/",1);
-	char ls_type[2];
-	sprintf(ls_type,"%d",adj_lsa->header->ls_type);
-	memcpy(key+strlen(key),ls_type,strlen(ls_type));
-	key[strlen(key)]='\0';
-}
-
-int
-build_and_install_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
-{
-	if(flags == CCN_SCHEDULE_CANCEL)
-	{
- 	 	return -1;
-	}
-
-	nlsr_lock();
-
-	if ( nlsr->debugging )
-		printf("build_and_install_adj_lsa called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_and_install_adj_lsa called \n");
-	
-	if ( nlsr->debugging )
-		printf("adj_build_flag = %d \n",nlsr->adj_build_flag);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"adj_build_flag = %d \n",nlsr->adj_build_flag);
-
-	if(nlsr->adj_build_flag > 0)
-	{
-		if ( nlsr->debugging )
-			printf("is_adj_lsa_build = %d \n",is_adj_lsa_build());
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"is_adj_lsa_build = %d \n",is_adj_lsa_build());
-
-		if ( is_adj_lsa_build()> 0)
-		{
-			struct alsa *adj_lsa=(struct alsa *)malloc(sizeof( struct alsa ));
-			build_adj_lsa(adj_lsa);
-			install_adj_lsa(adj_lsa);
-
-			char lst[2];
-			memset(lst,0,2);
-			sprintf(lst,"%d",LS_TYPE_ADJ);			
-
-			char *repo_key=(char *)calloc(strlen(nlsr->slice_prefix)+strlen(adj_lsa->header->orig_time)+strlen(adj_lsa->header->orig_router->name) + strlen(lst) + 5+15,sizeof(char));
-				make_adj_lsa_prefix_for_repo(repo_key, adj_lsa->header->orig_router->name,LS_TYPE_ADJ,adj_lsa->header->orig_time,nlsr->slice_prefix);
-		
-			if ( nlsr->debugging )
-				printf("Adj LSA Repo Key: %s \n",repo_key);
-
-			char *key=(char *)calloc(adj_lsa->header->orig_router->length+5,sizeof(char));
-			make_adj_lsa_key(key,adj_lsa);
-			if ( nlsr->debugging )
-				printf("Adj LSA: %s \n",key);
-
-			struct name_prefix *lsaid=(struct name_prefix *)calloc(1,sizeof(struct name_prefix));
-			lsaid->name=(char *)calloc(strlen(key)+1,sizeof(char));
-			memcpy(lsaid->name,key,strlen(key)+1);
-			lsaid->length=strlen(key)+1;
-
-		
-			write_adj_lsa_to_repo(repo_key, lsaid);
-
-			free(key);
-			free(repo_key);
-			free(lsaid->name);
-			free(lsaid);
-
-			destroy_adj_lsa(adj_lsa);
-
-			nlsr->adj_build_flag=0;	
-			print_adj_lsdb();		
-		}
-		else
-		{
-			if ( nlsr->debugging )
-				printf("Can not build adj LSA now\n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Can not build adj LSA now\n");
-		}
-	}
-	nlsr->is_build_adj_lsa_sheduled=0;
-
-	nlsr_unlock();
-
-	return 0;
-}
-
-
-void
-build_adj_lsa(struct alsa * adj_lsa)
-{
-	if ( nlsr->debugging )
-		printf("build_adj_lsa called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_adj_lsa called  \n");
-
-	int no_link=no_active_nbr();
-	
-	adj_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
-	adj_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	adj_lsa->header->orig_router->name=(char *)malloc(strlen(nlsr->router_name)+1);
-	memset(adj_lsa->header->orig_router->name,0,strlen(nlsr->router_name)+1);
-	memcpy(adj_lsa->header->orig_router->name,nlsr->router_name,strlen(nlsr->router_name)+1);
-	adj_lsa->header->orig_router->length=strlen(nlsr->router_name)+1;
-
-	adj_lsa->header->ls_type=(unsigned)LS_TYPE_ADJ;	
-
-
-	char *time_stamp=get_current_timestamp_micro_v2();
-	adj_lsa->header->orig_time=(char *)malloc(strlen(time_stamp)+1); 
-	memset(adj_lsa->header->orig_time,0,strlen(time_stamp)+1);
-	memcpy(adj_lsa->header->orig_time,time_stamp,strlen(time_stamp)+1);	
-	free(time_stamp);
-
-	adj_lsa->no_link=no_link;
-
-
-	struct ccn_charbuf *c=ccn_charbuf_create();
-	get_active_nbr_adj_data(c);
-	char *data=ccn_charbuf_as_string(c);
-
-	adj_lsa->body=(char *)calloc(strlen(data)+1,sizeof(char));
-	//memset(adj_lsa->body,0,strlen(data)+1);
-	memcpy(adj_lsa->body,(char *)data,strlen(data)+1);
-	data[strlen(data)]='\0';
-	ccn_charbuf_destroy(&c);
-
-	nlsr->adj_build_count++;
-
-
-}
-
-
-void
-install_adj_lsa(struct alsa * adj_lsa)
-{
-
-	if ( nlsr->debugging )
-		printf("install_adj_lsa called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"install_adj_lsa called  \n");
-	
-
-
-
-		char *key=(char *)calloc(adj_lsa->header->orig_router->length+4,sizeof(char));
-		make_adj_lsa_key(key,adj_lsa);
-
-		struct alsa *new_adj_lsa;
-
-		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 *)calloc(1,sizeof(struct alsa_header ));
-				new_adj_lsa->header->ls_type=adj_lsa->header->ls_type;
-				new_adj_lsa->header->orig_time=(char *)calloc(strlen(adj_lsa->header->orig_time)+1,sizeof(char));
-				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 *)calloc(1,sizeof(struct name_prefix ));
-				new_adj_lsa->header->orig_router->name=(char *)calloc(adj_lsa->header->orig_router->length,sizeof(char));
-				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 *)calloc(strlen(adj_lsa->body)+1,sizeof(char));
-				memcpy(new_adj_lsa->body,adj_lsa->body,strlen(adj_lsa->body)+1);
-			
-				add_next_hop_router(new_adj_lsa->header->orig_router->name);
-				add_next_hop_from_lsa_adj_body(new_adj_lsa->body,new_adj_lsa->no_link);
-
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Adding adj lsa\n");
-				write_log_for_adj_lsa(new_adj_lsa);
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
-			}
-			else 
-			{
-				hashtb_delete(e);
-			}
-
-			if ( nlsr->debugging )
-				printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-			set_new_lsdb_version();	
-
-			if ( nlsr->debugging )
-				printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-		}
-		else if(res == HT_OLD_ENTRY)
-		{
-			new_adj_lsa = e->data;
-			if(strcmp(adj_lsa->header->orig_time,new_adj_lsa->header->orig_time)<=0)
-			{
-				if ( nlsr->debugging )
-					printf("Older/Duplicate Adj LSA. Discarded...\n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Older/Duplicate Adj LSA. Discarded...\n");
-			}
-			else
-			{
-
-				if ( adj_lsa->no_link > 0)
-				{				
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting adj lsa\n");
-					write_log_for_adj_lsa(new_adj_lsa);
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
-
-					free(new_adj_lsa->header->orig_time);
-					new_adj_lsa->header->orig_time=(char *)calloc(strlen(adj_lsa->header->orig_time)+1,sizeof(char));
-					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;
-					if ( new_adj_lsa->body != NULL )
-						free(new_adj_lsa->body);
-					new_adj_lsa->body=(char *)calloc(strlen(adj_lsa->body)+1,sizeof(char));
-					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 *)calloc(strlen(body)+1,sizeof(char));
-	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);
-
-		}
-	}
-
-	if(lsa_data)
-		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 *)calloc(strlen(body)+1,sizeof(char));
-	//memset(	lsa_data,0,strlen(body)+1);
-	memcpy(lsa_data,body,strlen(body)+1);
-	char *sep="|";
-	char *rem;
-	char *rtr_id;
-	char *length;
-	//char *face;
-	char *metric;
-
-	if(no_link >0 )
-	{
-		rtr_id=strtok_r(lsa_data,sep,&rem);
-		length=strtok_r(NULL,sep,&rem);
-		//face=strtok_r(NULL,sep,&rem);
-		metric=strtok_r(NULL,sep,&rem);
-
-		if ( nlsr->debugging ) {
-			printf("		Link %d	 	\n",i+1);
-			printf("		Neighbor		 : %s	\n",rtr_id);
-			printf("		Neighbor Length		 : %s	\n",length);
-			//printf("		Connecting Face		 : %s	\n",face);
-			printf("		Metric			 : %s	\n",metric);
-		}
-
-		for(i=1;i<no_link;i++)
-		{
-			rtr_id=strtok_r(NULL,sep,&rem);
-			length=strtok_r(NULL,sep,&rem);
-			//face=strtok_r(NULL,sep,&rem);
-			metric=strtok_r(NULL,sep,&rem);
-			printf("		Link %d	 	\n",i+1);
-			printf("		Neighbor		 : %s	\n",rtr_id);
-			printf("		Neighbor Length		 : %s	\n",length);
-			//printf("		Connecting Face		 : %s	\n",face);
-			printf("		Metric			 : %s	\n",metric);
-
-		}
-	}
-
-	if( lsa_data )
-		free(lsa_data);
-}
-
-void
-print_adj_lsa(struct alsa * adj_lsa)
-{
-	if ( nlsr->debugging )
-	{
-		printf("-----------ADJ LSA Content---------------\n");
-		printf("	Origination Router       :	%s\n",adj_lsa->header->orig_router->name);
-		printf("	Origination Router Length:	%d\n",adj_lsa->header->orig_router->length);
-		printf("	LS Type			 :	%d\n",adj_lsa->header->ls_type);
-		printf("	Origination Time	 :	%s\n",adj_lsa->header->orig_time);
-		printf("	Lsa Data:\n");
-		printf("		No of Link	: %d\n",adj_lsa->no_link);
-
-		print_adj_lsa_body(adj_lsa->body,adj_lsa->no_link);
-		printf("\n");
-	}
-
-}
-
-void
-print_adj_lsdb(void)
-{
-	if ( nlsr->debugging )
-		printf("print_name_lsdb called \n");	
-	int i, adj_lsdb_element;
-	struct alsa *adj_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-	adj_lsdb_element=hashtb_n(nlsr->lsdb->adj_lsdb);
-
-	for(i=0;i<adj_lsdb_element;i++)
-	{
-		if ( nlsr->debugging )
-			printf("-----------Adj LSA (%d)---------------\n",i+1);
-		adj_lsa=e->data;
-		print_adj_lsa(adj_lsa);	
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	if ( nlsr->debugging )
-		printf("\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-}
-
-void 
-build_and_install_others_adj_lsa(char *orig_router,int ls_type,char *orig_time, int no_link,char *data)
-{
-	if ( nlsr->debugging )
-		printf("build_and_install_others_adj_lsa called \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_and_install_others_adj_lsa called \n");
-	struct alsa *adj_lsa=(struct alsa *)malloc(sizeof( struct alsa ));
-	build_others_adj_lsa(adj_lsa,orig_router,ls_type,orig_time,no_link,data);
-	install_adj_lsa(adj_lsa);
-	
-	destroy_adj_lsa(adj_lsa);
-
-	print_adj_lsdb();
-
-}
-
-
-void 
-build_others_adj_lsa(struct alsa *adj_lsa,char *orig_router,int ls_type,char *orig_time,int no_link,char *data)
-{
-	if ( nlsr->debugging )
-		printf("build_others_adj_lsa called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"build_others_adj_lsa called  \n");
-
-	/*Filling Up Header Data */
-	adj_lsa->header=(struct alsa_header *)calloc(1,sizeof(struct alsa_header ));
-	adj_lsa->header->orig_router=(struct name_prefix *)calloc(1,sizeof(struct name_prefix ));
-	adj_lsa->header->orig_router->name=(char *)calloc(strlen(orig_router)+1,sizeof(char));
-	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 *)calloc(strlen(orig_time)+1,sizeof(char));
-	memcpy(adj_lsa->header->orig_time,orig_time,strlen(orig_time)+1);
-
-	adj_lsa->no_link=no_link;
-
-	adj_lsa->body=(char *)calloc(strlen(data)+1,sizeof(char));
-	memcpy(adj_lsa->body,(char *)data,strlen(data)+1);
-
-}
-
-
-long int
-get_name_lsdb_num_element(void)
-{
-	long int num_element;
-
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->name_lsdb, e);
-	num_element=hashtb_n(nlsr->lsdb->name_lsdb);
-	hashtb_end(e);
-
-	return num_element; 
-}
-
-long int
-get_adj_lsdb_num_element(void)
-{
-	long int num_element;
-
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-	num_element=hashtb_n(nlsr->lsdb->adj_lsdb);
-	hashtb_end(e);
-
-	return num_element; 
-}
-
-
-int 
-check_is_new_name_lsa(char *orig_router,char *lst,char *lsid,char *orig_time)
-{
-	int ret=0;
-	struct ccn_charbuf *key=ccn_charbuf_create();
-	ccn_charbuf_append_string(key,orig_router);
-	ccn_charbuf_append_string(key,"/");
-	ccn_charbuf_append_string(key,lst);
-	ccn_charbuf_append_string(key,"/");
-	ccn_charbuf_append_string(key,lsid);
-
-	int res;
-	struct nlsa *name_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->lsdb->name_lsdb, e);
-	res = hashtb_seek(e, ccn_charbuf_as_string(key), key->length, 0);
-
-	if( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-		ret=1;
-
-	}
-	else if(res == HT_OLD_ENTRY)
-	{
-		name_lsa=e->data;
-		if( strcmp ( orig_time , name_lsa->header->orig_time ) > 0 )
-		{
-			ret=1;
-		}
-	}
-
-	hashtb_end(e);
-
-	ccn_charbuf_destroy(&key);
-	
-	return ret;
-}
-
-int 
-check_is_new_adj_lsa(char *orig_router,char *lst,char *orig_time)
-{
-	int ret=0;
-	struct ccn_charbuf *key=ccn_charbuf_create();
-	ccn_charbuf_append_string(key,orig_router);
-	ccn_charbuf_append_string(key,"/");
-	ccn_charbuf_append_string(key,lst);
-
-	int res;
-	struct alsa *adj_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-	res = hashtb_seek(e, ccn_charbuf_as_string(key), key->length, 0);
-
-	if( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-		ret=1;
-
-	}
-	else if(res == HT_OLD_ENTRY)
-	{
-		adj_lsa=e->data;
-		if( strcmp ( orig_time , adj_lsa->header->orig_time ) > 0 )
-		{
-			ret=1;
-		}
-	}
-
-	hashtb_end(e);
-	
-	ccn_charbuf_destroy(&key);
-
-	return ret;
-}
-
-int 
-check_is_new_cor_lsa(char *orig_router,char *lst,char *orig_time)
-{
-	int ret=0;
-	struct ccn_charbuf *key=ccn_charbuf_create();
-	ccn_charbuf_append_string(key,orig_router);
-	ccn_charbuf_append_string(key,"/");
-	ccn_charbuf_append_string(key,lst);
-
-	int res;
-	struct clsa *cor_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-
-	hashtb_start(nlsr->lsdb->cor_lsdb, e);
-	res = hashtb_seek(e, ccn_charbuf_as_string(key), key->length, 0);
-
-	if( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-		ret=1;
-
-	}
-	else if(res == HT_OLD_ENTRY)
-	{
-		cor_lsa=e->data;
-		if( strcmp ( orig_time , cor_lsa->header->orig_time ) > 0 )
-		{
-			ret=1;
-		}
-	}
-
-	hashtb_end(e);
-	
-	ccn_charbuf_destroy(&key);
-
-	return ret;
-}
-
-void 
-get_name_lsa_data(struct ccn_charbuf *lsa_data, struct name_prefix *lsaId)
-{
-	if ( nlsr->debugging )
-		printf("get_name_lsa_data called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_name_lsa_data called  \n");
-
-	struct nlsa *name_lsa;//=(struct nlsa*)malloc(sizeof(struct nlsa ));
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->name_lsdb, e);
-    	res = hashtb_seek(e, lsaId->name, lsaId->length-1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		name_lsa=e->data;
-		
-		if ( nlsr->debugging )
-			printf("NAME LSA found  \n");	
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Name LSA found  \n");
-
-		ccn_charbuf_append_string(lsa_data,name_lsa->header->orig_router->name);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_length=(char *)malloc(20);
-		memset(temp_length,0,20);
-		sprintf(temp_length,"%d",name_lsa->header->orig_router->length);
-		ccn_charbuf_append_string(lsa_data,temp_length);
-		free(temp_length);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_ltype=(char *)malloc(20);
-		memset(temp_ltype,0,20);
-		sprintf(temp_ltype,"%d",name_lsa->header->ls_type);
-		ccn_charbuf_append_string(lsa_data,temp_ltype);
-		free(temp_ltype);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_lsid=(char *)malloc(20);
-		memset(temp_lsid,0,20);
-		sprintf(temp_lsid,"%ld",name_lsa->header->ls_id);
-		ccn_charbuf_append_string(lsa_data,temp_lsid);
-		free(temp_lsid);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		ccn_charbuf_append_string(lsa_data,name_lsa->header->orig_time);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_valid=(char *)malloc(20);
-		memset(temp_valid,0,20);
-		sprintf(temp_valid,"%d",name_lsa->header->isValid);
-		ccn_charbuf_append_string(lsa_data,temp_valid);
-		free(temp_valid);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		ccn_charbuf_append_string(lsa_data,name_lsa->name_prefix->name);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_npl=(char *)malloc(20);
-		memset(temp_npl,0,20);
-		sprintf(temp_npl,"%d",name_lsa->name_prefix->length);
-		ccn_charbuf_append_string(lsa_data,temp_npl);
-		free(temp_npl);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-void 
-get_adj_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId)
-{
-	if ( nlsr->debugging )
-		printf("get_adj_lsa_data called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_adj_lsa_data called  \n");
-
-	struct alsa *adj_lsa;//=(struct alsa*)malloc(sizeof(struct alsa ));
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-    	res = hashtb_seek(e, lsaId->name, lsaId->length-1, 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		adj_lsa=e->data;
-
-		if ( nlsr->debugging )
-			printf("Adj LSA found  \n");	
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Adj LSA found  \n");
-
-		ccn_charbuf_append_string(lsa_data,adj_lsa->header->orig_router->name);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_length=(char *)malloc(20);
-		memset(temp_length,0,20);
-		sprintf(temp_length,"%d",adj_lsa->header->orig_router->length);
-		ccn_charbuf_append_string(lsa_data,temp_length);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(temp_length);
-
-		char *temp_ltype=(char *)malloc(20);
-		memset(temp_ltype,0,20);
-		sprintf(temp_ltype,"%d",adj_lsa->header->ls_type);
-		ccn_charbuf_append_string(lsa_data,temp_ltype);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(temp_ltype);
-
-		ccn_charbuf_append_string(lsa_data,adj_lsa->header->orig_time);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_nl=(char *)malloc(20);
-		memset(temp_nl,0,20);
-		sprintf(temp_nl,"%d",adj_lsa->no_link);
-		ccn_charbuf_append_string(lsa_data,temp_nl);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(temp_nl);
-
-		ccn_charbuf_append_string(lsa_data,adj_lsa->body);
-
-
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-void
-make_name_lsa_invalid(struct name_prefix *np,int ls_type, long int ls_id)
-{
-
-	if ( nlsr->debugging )
-		printf("make_name_lsa_invalid called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"make_name_lsa_invalid called  \n");
-
-
-	char lst[2];
-	memset(lst,0,2);
-	sprintf(lst,"%d",ls_type);	
-
-	char lsid[10];
-	memset(lsid,0,10);
-	sprintf(lsid,"%ld",ls_id);
-	
-	
-	char *key=(char *)malloc(strlen(np->name)+1+strlen(lst)+1+strlen(lsid)+1);
-	memset(key,0,strlen(np->name)+1+strlen(lst)+1+strlen(lsid)+1);
-
-
-	make_name_lsa_key(key, np->name,ls_type,ls_id);	
-	
-	if ( nlsr->debugging )
-		printf("Key:%s Length:%d\n",key,(int)strlen(key));
-
-	struct nlsa *nlsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-	 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->name_lsdb, e);
-    	res = hashtb_seek(e, key,strlen(key) , 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		nlsa=e->data;
-	
-		nlsa->header->isValid=0;
-
-		writeLogg(__FILE__,__FUNCTION__,__LINE__," Name-LSA\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting name lsa\n");
-		write_log_for_name_lsa(nlsa);
-		writeLogg(__FILE__,__FUNCTION__,__LINE__," name_lsa_end\n");
-
-		hashtb_delete(e);
-	}
-	else if( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-	}
-	hashtb_end(e);
-	
-	if ( nlsr->debugging )
-		printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-	set_new_lsdb_version();	
-
-	if ( nlsr->debugging )
-		printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-}
-
-
-int
-delete_name_lsa(char *orig_router, char *name_prefix)
-{
-	
-	if ( nlsr->debugging )
-		printf("delete_name_lsa called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_name_lsa called  \n");
-
-		delete_npt_entry_by_router_and_name_prefix(orig_router, name_prefix);
-	
-	
-	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);
-	
-
-	return 0;
-}
-
-
-int delete_adj_lsa()
-{
-	
-	if ( nlsr->debugging )
-		printf("delete_adj_lsa called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_adj_lsa called  \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 ( !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;
-	}
-
-	return 0;
-}
-
-void
-refresh_name_lsdb(void)
-{
-	if ( nlsr->debugging )
-		printf("refresh_name_lsdb called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"refresh_name_lsdb called  \n");
-
-	char *time_stamp=get_current_timestamp_micro_v2();
-	
-	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=get_current_timestamp_micro_v2();
-
-					free(name_lsa->header->orig_time);
-					name_lsa->header->orig_time=(char *)calloc(strlen(current_time_stamp)+1,sizeof(char));
-					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);
-
-					char lst[2];
-					memset(lst,0,2);
-					sprintf(lst,"%d",name_lsa->header->ls_type);	
-
-					char lsid[10];
-					memset(lsid,0,10);
-					sprintf(lsid,"%ld",name_lsa->header->ls_id);
-
-					char *key=(char *)malloc(strlen(name_lsa->header->orig_router->name)
-								+1+strlen(lst)+1+strlen(lsid)+1);
-					memset(key,0,strlen(name_lsa->header->orig_router->name)+1+
-										strlen(lst)+1+strlen(lsid)+1);
-
-
-					make_name_lsa_key(key, name_lsa->header->orig_router->name,
-								name_lsa->header->ls_type,name_lsa->header->ls_id);
-		
-					if ( nlsr->debugging )
-							printf("Name LSA Key: %s \n",key);
-
-
-					char *repo_key=(char *)calloc(strlen(nlsr->slice_prefix)+1+
-									strlen(name_lsa->header->orig_router->name)
-									+1+strlen(lst)+1+strlen(lsid)+1+
-									strlen(name_lsa->header->orig_time)+16,
-									sizeof(char));	
-					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,
-											nlsr->slice_prefix);
-		
-					if ( nlsr->debugging )
-							printf("Name LSA Repo Key: %s \n",repo_key);
-
-					struct name_prefix *lsaid=(struct name_prefix *)
-											calloc(1,sizeof(struct name_prefix));
-					lsaid->name=(char *)calloc(strlen(key)+1,sizeof(char));
-					memcpy(lsaid->name,key,strlen(key)+1);
-					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);
-				}
-				else 
-				{	
-					delete_name_lsa(name_lsa->header->orig_router->name, name_lsa->name_prefix->name);
-					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");
-
-					destroy_name_lsa_component(name_lsa);
-
-					hashtb_delete(e);
-					i++;
-				}
-
-				if ( nlsr->debugging )
-					printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-				set_new_lsdb_version();	
-
-				if ( nlsr->debugging )
-					printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
-
-							
-
-				print_name_lsdb();
-			}
-			else 
-			{
-				hashtb_next(e);
-			}	
-		}
-		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");
-
-				delete_name_lsa(name_lsa->header->orig_router->name, name_lsa->name_prefix->name);
-				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");
-
-				destroy_name_lsa_component(name_lsa);
-				hashtb_delete(e);
-				i++;
-			}
-			else 
-			{
-				hashtb_next(e);
-			}
-		}
-	}
-
-	hashtb_end(e);
-	
-	free(time_stamp);
-
-	
-}
-
-void
-refresh_adj_lsdb(void)
-{
-
-	if ( nlsr->debugging )
-		printf("refresh_adj_lsdb called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"refresh_adj_lsdb called  \n");
-	
-	char *time_stamp=get_current_timestamp_micro_v2();
-
-	long int lsa_life_time;
-		
-	int i, adj_lsdb_element;
-	struct alsa *adj_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-	adj_lsdb_element=hashtb_n(nlsr->lsdb->adj_lsdb);
-
-	for(i=0;i<adj_lsdb_element;i++)
-	{
-		adj_lsa=e->data;
-
-		lsa_life_time=get_time_diff(time_stamp,adj_lsa->header->orig_time);	
-
-		if ( nlsr->debugging )
-			printf("LSA Life Time: %ld \n",lsa_life_time);	
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSA Life Time: %ld \n",lsa_life_time);		
-
-		if ( strcmp(adj_lsa->header->orig_router->name,nlsr->router_name) == 0)
-		{
-			if ( lsa_life_time > nlsr->lsa_refresh_time )
-			{
-				if ( nlsr->debugging )
-					printf("Own Adj LSA need to be refrshed\n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Own Adj LSA need to be refrshed\n");
-
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Adj-LSA\n");
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Deleting adj lsa\n");
-				write_log_for_adj_lsa(adj_lsa);
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," adj_lsa_end\n");
-
-				char *current_time_stamp=get_current_timestamp_micro_v2();
-
-				free(adj_lsa->header->orig_time);
-				adj_lsa->header->orig_time=(char *)calloc(strlen(current_time_stamp)+1,sizeof(char));
-				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);
-
-
-				char lst[2];
-				memset(lst,0,2);
-				sprintf(lst,"%d",LS_TYPE_ADJ);			
-
-				char *repo_key=(char *)calloc(strlen(nlsr->slice_prefix)+
-								strlen(adj_lsa->header->orig_time)+
-								strlen(adj_lsa->header->orig_router->name) 
-								+ strlen(lst) + 5+15,sizeof(char));
-				make_adj_lsa_prefix_for_repo(repo_key, 
-								adj_lsa->header->orig_router->name,LS_TYPE_ADJ,
-								adj_lsa->header->orig_time,nlsr->slice_prefix);
-		
-				if ( nlsr->debugging )
-					printf("Adj LSA Repo Key: %s \n",repo_key);
-
-				char *key=(char *)calloc(adj_lsa->header->orig_router->length+5,
-																	sizeof(char));
-				make_adj_lsa_key(key,adj_lsa);
-				if ( nlsr->debugging )
-					printf("Adj LSA Key: %s \n",key);
-
-				struct name_prefix *lsaid=(struct name_prefix *)
-											calloc(1,sizeof(struct name_prefix));
-				lsaid->name=(char *)calloc(strlen(key)+1,sizeof(char));
-				memcpy(lsaid->name,key,strlen(key)+1);
-				lsaid->length=strlen(key)+1;
-
-		
-				write_adj_lsa_to_repo(repo_key, lsaid);
-
-				free(key);
-				free(repo_key);
-				free(lsaid->name);
-				free(lsaid);
-
-
-
-
-
-
-				print_adj_lsdb();
-				
-				
-			}	
-			
-			hashtb_next(e);
-		}
-		else 
-		{
-			if ( lsa_life_time > nlsr->router_dead_interval )
-			{
-
-				if ( nlsr->debugging )
-				 	printf("Others Adj LSA need to be deleted\n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Others Adj LSA need to be deleted\n");
-				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");
-				delete_adj_lsa();
-
-				destroy_adj_lsa_component(adj_lsa);
-				hashtb_delete(e);
-				i++;
-				
-			}
-			else
-			{
-				hashtb_next(e);
-			}
-		}
-	
-	}
-
-	hashtb_end(e);
-	
-	free(time_stamp);
-}
-
-
-void
-refresh_cor_lsdb(void)
-{
-
-	if ( nlsr->debugging )
-		printf("refresh_cor_lsdb called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"refresh_cor_lsdb called  \n");
-
-	char *time_stamp=get_current_timestamp_micro_v2();
-
-	long int lsa_life_time;
-		
-	int i, cor_lsdb_element;
-	struct clsa *cor_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->cor_lsdb, e);
-	cor_lsdb_element=hashtb_n(nlsr->lsdb->cor_lsdb);
-
-	for(i=0;i<cor_lsdb_element;i++)
-	{
-		cor_lsa=e->data;
-
-		lsa_life_time=get_time_diff(time_stamp,cor_lsa->header->orig_time);	
-
-		if ( nlsr->debugging )
-			printf("LSA Life Time: %ld \n",lsa_life_time);	
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"LSA Life Time: %ld \n",lsa_life_time);		
-
-		if ( strcmp(cor_lsa->header->orig_router->name,nlsr->router_name) == 0)
-		{
-			if ( lsa_life_time > nlsr->lsa_refresh_time )
-			{
-				if ( nlsr->debugging )
-					printf("Own Cor LSA need to be refrshed\n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Own Cor LSA need to be refrshed\n");
-
-				char *current_time_stamp=get_current_timestamp_micro_v2();
-
-				free(cor_lsa->header->orig_time);
-				cor_lsa->header->orig_time=(char *)malloc(strlen(current_time_stamp)+1); //free 
-				memset(cor_lsa->header->orig_time,0,strlen(current_time_stamp)+1);
-				memcpy(cor_lsa->header->orig_time,current_time_stamp,strlen(current_time_stamp)+1);
-	
-				free(current_time_stamp);
-
-				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();
-			}
-
-			hashtb_next(e);		
-		}
-		else 
-		{
-			if ( lsa_life_time > nlsr->router_dead_interval )
-			{
-
-				if ( nlsr->debugging )
-				 	printf("Others Adj LSA need to be deleted\n");
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"Others Adj LSA need to be deleted\n");
-								
-				destroy_cor_lsa_component(cor_lsa);
-				hashtb_delete(e);
-				i++;
-			}
-			else 
-			{
-				hashtb_next(e);	
-			}
-		}
-
-		
-	
-	}
-
-	hashtb_end(e);
-	
-	free(time_stamp);
-}
-
-int
-refresh_lsdb(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
-{
-	if(flags == CCN_SCHEDULE_CANCEL)
-	{
- 	 	return -1;
-	}
-
-	nlsr_lock();
-
-	if ( nlsr->debugging )
-		printf("refresh_lsdb called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"refresh_lsdb called\n");
-	
-	refresh_name_lsdb();
-	refresh_adj_lsdb();
-
-	nlsr->event = ccn_schedule_event(nlsr->sched, 60000000, &refresh_lsdb, NULL, 0);
-	
-	nlsr_unlock();
-	return 0;
-}
-
-void
-write_adj_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id)
-{
-	if ( nlsr->debugging )
-		printf("write_adj_lsa_to_repo called\n");
-	if ( nlsr->debugging )
-		printf("Content Prefix: %s\n",repo_content_prefix);
-	
-	struct ccn_charbuf *lsa_data=ccn_charbuf_create();		
-	get_adj_lsa_data(lsa_data,lsa_id);
-	if ( nlsr->debugging )
-		printf("Adj LSA Data: %s \n",ccn_charbuf_as_string(lsa_data));
-
-	//char *data;
-	//data=ccn_charbuf_as_string(lsa_data);
-	//data[strlen(data)]='\0';
-
-	//write_data_to_repo(data, repo_content_prefix);
-
-	write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_content_prefix);
-
-	ccn_charbuf_destroy(&lsa_data);
-}
-
-void
-write_name_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id)
-{
-	if ( nlsr->debugging )
-		printf("write_name_lsa_to_repo called\n");
-	if ( nlsr->debugging )
-		printf("Content Prefix: %s\n",repo_content_prefix);
-	
-	struct ccn_charbuf *lsa_data=ccn_charbuf_create();		
-	get_name_lsa_data(lsa_data,lsa_id);
-	
-	if ( nlsr->debugging )
-		printf("Name LSA Data: %s \n",ccn_charbuf_as_string(lsa_data));	
-
-	//char *data;
-	//data=ccn_charbuf_as_string(lsa_data);
-	//data[strlen(data)]='\0';
-
-	//write_data_to_repo(data, repo_content_prefix);
-
-	write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_content_prefix);
-
-	ccn_charbuf_destroy(&lsa_data);
-}
-
-
-void
-write_name_lsdb_to_repo(char *slice_prefix)
-{
-	int i, name_lsdb_element;
-
-	struct nlsa *name_lsa;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->name_lsdb, e);
-	name_lsdb_element=hashtb_n(nlsr->lsdb->name_lsdb);
-
-	for(i=0;i<name_lsdb_element;i++)
-	{
-		name_lsa=e->data;
-
-		char lst[2];
-		memset(lst,0,2);
-		sprintf(lst,"%d",name_lsa->header->ls_type);	
-
-		char lsid[10];
-		memset(lsid,0,10);
-		sprintf(lsid,"%ld",name_lsa->header->ls_id);
-	
-	
-		char *key=(char *)malloc(strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
-		memset(key,0,strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
-
-
-		make_name_lsa_key(key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id);
-		
-		if ( nlsr->debugging )
-			printf("Name LSA Key: %s \n",key);
-
-
-		char *repo_key=(char *)calloc(strlen(slice_prefix)+1+strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1+strlen(name_lsa->header->orig_time)+16,sizeof(char));	
-		make_name_lsa_prefix_for_repo(repo_key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id,name_lsa->header->orig_time,slice_prefix);
-		
-		if ( nlsr->debugging )
-			printf("Name LSA Repo Key: %s \n",repo_key);
-
-		struct name_prefix *lsaid=(struct name_prefix *)calloc(1,sizeof(struct name_prefix));
-		lsaid->name=(char *)calloc(strlen(key)+1,sizeof(char));
-		memcpy(lsaid->name,key,strlen(key)+1);
-		lsaid->length=strlen(key)+1;
-
-		
-		write_name_lsa_to_repo(repo_key, lsaid);
-
-		free(key);
-		free(repo_key);
-		free(lsaid->name);
-		free(lsaid);
-
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-	
-
-}
-
-void
-print_cor_lsa(struct clsa *cor_lsa)
-{
-	if ( nlsr->debugging )
-	{
-		printf("-----------Cor LSA Content---------------\n");
-		printf("	Origination Router       :	%s\n",cor_lsa->header->orig_router->name);
-		printf("	Origination Router Length:	%d\n",cor_lsa->header->orig_router->length);
-		printf("	LS Type			 :	%d\n",cor_lsa->header->ls_type);
-		printf("	Origination Time	 :	%s\n",cor_lsa->header->orig_time);
-		printf("	LSA Data			\n");
-		printf("		Cor R:	 	:	%f\n",cor_lsa->cor_r);
-		printf("		Cor Theta	:	%f\n",cor_lsa->cor_theta);
-
-		printf("\n");	
-	}
-}
-
-void 
-print_cor_lsdb()
-{
-	
-	if ( nlsr->debugging )
-		printf("print_cor_lsdb called \n");	
-	
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-	int i=1;
-
-	for (hashtb_start(nlsr->lsdb->cor_lsdb, e); e->key != NULL; hashtb_next(e)) 
-	{
-		if ( nlsr->debugging )
-			printf("-----------Cor LSA (%d)---------------\n",i);	
-		struct clsa *cor_lsa=e->data;
-		print_cor_lsa(cor_lsa);
-		i++;
-  	}
-	hashtb_end(e);
-
-	if ( nlsr->debugging )
-		printf("\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-}
-
-void
-install_cor_lsa(struct clsa *cor_lsa)
-{
-	if ( nlsr->debugging )
-		printf("install_cor_lsa called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"install_cor_lsa called  \n");
-	
-
-	//char *time_stamp=(char *)malloc(20);
-	//memset(time_stamp,0,20);
-	//get_current_timestamp_micro(time_stamp);
-
-
-	char *key=(char *)malloc(cor_lsa->header->orig_router->length+4);
-	memset(key,0,cor_lsa->header->orig_router->length+4);
-	make_cor_lsa_key(key,cor_lsa);
-
-	if ( nlsr->debugging )
-		printf("Cor LSA key: %s \n",key);
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->cor_lsdb, e);
-    	res = hashtb_seek(e, key, strlen(key), 0);
-
-	if ( res == HT_NEW_ENTRY )
-	{
-		if ( nlsr->debugging )
-			printf("New Cor LSA... \n");
-		
-		struct clsa *new_cor_lsa;//=(struct clsa *)malloc(sizeof( struct clsa ));
-		new_cor_lsa=e->data;
-		new_cor_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
-
-		new_cor_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-		new_cor_lsa->header->orig_router->name=(char *)malloc(strlen(cor_lsa->header->orig_router->name)+1);
-		//memset(new_cor_lsa->header->orig_router->name,0,strlen(cor_lsa->header->orig_router->name)+1);
-		memcpy(new_cor_lsa->header->orig_router->name,cor_lsa->header->orig_router->name,strlen(cor_lsa->header->orig_router->name)+1);
-		new_cor_lsa->header->orig_router->length=cor_lsa->header->orig_router->length;
-
-		new_cor_lsa->header->orig_time=(char *)calloc(strlen(cor_lsa->header->orig_time)+1,sizeof(char)); //free 
-		//memset(new_cor_lsa->header->orig_time,0,strlen(cor_lsa->header->orig_time)+1);
-		memcpy(new_cor_lsa->header->orig_time,cor_lsa->header->orig_time,strlen(cor_lsa->header->orig_time)+1);
-		//new_cor_lsa->header->orig_time=get_current_timestamp_micro_v2();
-
-		new_cor_lsa->header->ls_type=cor_lsa->header->ls_type;
-
-		new_cor_lsa->cor_r=cor_lsa->cor_r;
-		new_cor_lsa->cor_theta=cor_lsa->cor_theta;
-	}
-	else if ( res == HT_OLD_ENTRY )
-	{	
-		if ( nlsr->debugging )
-			printf("Cor LSA exists (Old)... \n");
-	}
-	hashtb_end(e);
-
-	free(key);
-
-}
-
-void 
-build_cor_lsa(struct clsa *cor_lsa, double cor_r, double cor_theta)
-{
-	cor_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
-	cor_lsa->header->ls_type=LS_TYPE_COR;
-
-	char *time_stamp=get_current_timestamp_micro_v2();
-	cor_lsa->header->orig_time=(char *)malloc(strlen(time_stamp)+1); //free 
-	memset(cor_lsa->header->orig_time,0,strlen(time_stamp)+1);
-	memcpy(cor_lsa->header->orig_time,time_stamp,strlen(time_stamp)+1);
-	free(time_stamp);
-
-	cor_lsa->header->orig_router=(struct name_prefix *)calloc(1,sizeof(struct name_prefix ));
-	cor_lsa->header->orig_router->name=(char *)calloc(strlen(nlsr->router_name)+1,sizeof(char));
-	memset(cor_lsa->header->orig_router->name,0,strlen(nlsr->router_name)+1);
-	memcpy(cor_lsa->header->orig_router->name,nlsr->router_name,strlen(nlsr->router_name)+1);
-	cor_lsa->header->orig_router->length=strlen(nlsr->router_name)+1;
-
-	cor_lsa->cor_r=cor_r;	
-	cor_lsa->cor_theta=cor_theta;
-
-}
-
-void 
-build_others_cor_lsa(struct clsa *cor_lsa,char *orig_router, int ls_type,char *orig_time, double cor_r, double cor_theta)
-{
-	cor_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
-	cor_lsa->header->ls_type=ls_type;
-
-	cor_lsa->header->orig_time=(char *)malloc(strlen(orig_time)+1); 
-	memset(cor_lsa->header->orig_time,0,strlen(orig_time)+1);
-	memcpy(cor_lsa->header->orig_time,orig_time,strlen(orig_time));
-
-	cor_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	cor_lsa->header->orig_router->name=(char *)malloc(strlen(orig_router)+1);
-	memset(cor_lsa->header->orig_router->name,0,strlen(orig_router)+1);
-	memcpy(cor_lsa->header->orig_router->name,orig_router,strlen(orig_router));
-	cor_lsa->header->orig_router->length=strlen(orig_router)+1;
-
-	cor_lsa->cor_r=cor_r;	
-	cor_lsa->cor_theta=cor_theta;
-
-}
-
-void
-build_and_install_others_cor_lsa(char *orig_router,int ls_type,char *orig_time, double cor_r, double cor_theta)
-{
-	struct clsa *cor_lsa=(struct clsa *)malloc(sizeof( struct clsa ));
-	build_others_cor_lsa(cor_lsa,orig_router,ls_type, orig_time, cor_r, cor_theta);
-	install_cor_lsa(cor_lsa);
-
-	print_cor_lsdb();
-	
-	destroy_cor_lsa(cor_lsa);
-}
-
-
-void 
-build_and_install_cor_lsa()
-{
-
-	
-
-	struct clsa *cor_lsa=(struct clsa *)malloc(sizeof( struct clsa ));
-	
-	build_cor_lsa(cor_lsa,nlsr->cor_r,nlsr->cor_theta);
-	install_cor_lsa(cor_lsa);
-
-	write_cor_lsa_to_repo(cor_lsa);
-	destroy_cor_lsa(cor_lsa);
-
-	print_cor_lsdb();	
-	
-}
-
-void 
-get_cor_lsa_data(struct ccn_charbuf *lsa_data,char *cor_lsa_key)
-{
-	if ( nlsr->debugging )
-		printf("get_cor_lsa_data called  \n");	
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_adj_lsa_data called  \n");
-
-	struct clsa *cor_lsa;//=(struct clsa*)malloc(sizeof(struct clsa ));
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->cor_lsdb, e);
-    	res = hashtb_seek(e, cor_lsa_key, strlen(cor_lsa_key), 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		cor_lsa=e->data;
-
-		if ( nlsr->debugging )
-			printf("Cor LSA found  \n");	
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Cor LSA found  \n");
-
-		ccn_charbuf_append_string(lsa_data,cor_lsa->header->orig_router->name);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *temp_length=(char *)malloc(20);
-		memset(temp_length,0,20);
-		sprintf(temp_length,"%d",cor_lsa->header->orig_router->length);
-		ccn_charbuf_append_string(lsa_data,temp_length);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(temp_length);
-
-		char *temp_ltype=(char *)malloc(20);
-		memset(temp_ltype,0,20);
-		sprintf(temp_ltype,"%d",cor_lsa->header->ls_type);
-		ccn_charbuf_append_string(lsa_data,temp_ltype);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(temp_ltype);
-
-		ccn_charbuf_append_string(lsa_data,cor_lsa->header->orig_time);
-		ccn_charbuf_append_string(lsa_data,"|");
-
-		char *cor_r=(char *)malloc(20);
-		memset(cor_r,0,20);
-		sprintf(cor_r,"%f",cor_lsa->cor_r);
-		ccn_charbuf_append_string(lsa_data,cor_r);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(cor_r);
-
-		char *cor_theta=(char *)malloc(20);
-		memset(cor_theta,0,20);
-		sprintf(cor_theta,"%f",cor_lsa->cor_theta);
-		ccn_charbuf_append_string(lsa_data,cor_theta);
-		ccn_charbuf_append_string(lsa_data,"|");
-		free(cor_theta);
-
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-}
-
-void
-write_cor_lsa_to_repo(struct clsa *cor_lsa)
-{
-	
-
-	if ( nlsr->debugging )
-		printf("write_cor_lsa_to_repo called\n");
-	
-	
-	char *key=(char *)calloc(cor_lsa->header->orig_router->length+4,sizeof(char));
-	make_cor_lsa_key(key,cor_lsa);
-	
-	struct ccn_charbuf *lsa_data=ccn_charbuf_create();
-	get_cor_lsa_data(lsa_data,key);
-
-	if ( nlsr->debugging )
-		printf("Cor LSA Data: %s \n",ccn_charbuf_as_string(lsa_data));	
-
-	char *lst=(char *)malloc(20);
-	memset(lst,0,20);
-	sprintf(lst,"%d",cor_lsa->header->ls_type);
-	char *repo_key=(char *)calloc(strlen(nlsr->slice_prefix)+strlen(cor_lsa->header->orig_time)+strlen(cor_lsa->header->orig_router->name) + strlen(lst) + 20,sizeof(char));
-	make_cor_lsa_prefix_for_repo(repo_key, cor_lsa->header->orig_router->name,LS_TYPE_COR,cor_lsa->header->orig_time,nlsr->slice_prefix);
-		
-	if ( nlsr->debugging )
-		printf("Cor LSA Repo Key: %s \n",repo_key);	
-
-	//char *data;
-	//data=ccn_charbuf_as_string(lsa_data);
-	//data[strlen(data)]='\0';
-
-	//write_data_to_repo(data, repo_content_prefix);
-
-	write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_key);
-
-
-	
-		
-	free(lst);
-	free(key);
-	free(repo_key);
-	ccn_charbuf_destroy(&lsa_data);
-}
-
-void 
-make_cor_lsa_key_by_router_name(char *key,char *router_name)
-{
-	memcpy(key+strlen(key),router_name,strlen(router_name));
-	memcpy(key+strlen(key),"/",1);
-	char ls_type[2];
-	sprintf(ls_type,"%d",LS_TYPE_COR);
-	memcpy(key+strlen(key),ls_type,strlen(ls_type));
-	key[strlen(key)]='\0';
-}
-
-
-double 
-get_hyperbolic_r(char *router)
-{
-	double ret=-1.0;
-	char *cor_lsa_key=(char *)calloc(strlen(router)+4,sizeof(char));
-	make_cor_lsa_key_by_router_name(cor_lsa_key,router);
-
-	
-	struct clsa *cor_lsa;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->cor_lsdb, e);
-    	res = hashtb_seek(e, cor_lsa_key, strlen(cor_lsa_key), 0);
-
-	if ( res == HT_OLD_ENTRY)
-	{	
-		cor_lsa=e->data;
-		ret=cor_lsa->cor_r;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-	
-	free(cor_lsa_key);
-	return ret;
-}
-
-double 
-get_hyperbolic_theta(char *router)
-{
-	double ret=-1.0;
-	char *cor_lsa_key=(char *)calloc(strlen(router)+4,sizeof(char));
-	make_cor_lsa_key_by_router_name(cor_lsa_key,router);
-
-	struct clsa *cor_lsa;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->lsdb->cor_lsdb, e);
-    	res = hashtb_seek(e, cor_lsa_key, strlen(cor_lsa_key), 0);
-
-	if ( res == HT_OLD_ENTRY)
-	{	
-		cor_lsa=e->data;
-		ret=cor_lsa->cor_theta;
-	}
-	else if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-
-	hashtb_end(e);
-	
-	free(cor_lsa_key);
-	return ret;
-}
-
-
-void
-destroy_name_lsdb(void)
-{
-	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;
-		destroy_name_lsa_component(name_lsa);	
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	if ( nlsr->lsdb->name_lsdb )
-		hashtb_destroy(&nlsr->lsdb->name_lsdb);
-}
-
-void
-destroy_adj_lsdb(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);
-
-	for(i=0;i<adj_lsdb_element;i++)
-	{
-		adj_lsa=e->data;
-		destroy_adj_lsa_component(adj_lsa);	
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-	if(nlsr->lsdb->adj_lsdb	)
-		hashtb_destroy(&nlsr->lsdb->adj_lsdb);
-}
-
-void
-destroy_cor_lsdb(void)
-{
-	int i, cor_lsdb_element;
-	struct clsa *cor_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->cor_lsdb, e);
-	cor_lsdb_element=hashtb_n(nlsr->lsdb->cor_lsdb);
-
-	for(i=0;i<cor_lsdb_element;i++)
-	{
-		cor_lsa=e->data;
-		destroy_cor_lsa_component(cor_lsa);	
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-	if(nlsr->lsdb->cor_lsdb	)
-		hashtb_destroy(&nlsr->lsdb->cor_lsdb);
-}
-
-
-
-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);
-
-}
-
-void
-destroy_lsdb(void)
-{
-	destroy_name_lsdb();
-	destroy_adj_lsdb();
-	destroy_cor_lsdb();
-	
-	if ( nlsr->lsdb->lsdb_version )
-		free(nlsr->lsdb->lsdb_version);
-	if ( nlsr->lsdb )
-		free(nlsr->lsdb);
-}
diff --git a/nlsr_lsdb.h b/nlsr_lsdb.h
deleted file mode 100644
index 94e84af..0000000
--- a/nlsr_lsdb.h
+++ /dev/null
@@ -1,110 +0,0 @@
-#ifndef _NLSR_LSDB_H_
-#define _NLSR_LSDB_H_
-
-#define LS_TYPE_ADJ 1
-#define LS_TYPE_NAME 2
-#define LS_TYPE_COR 3
-
-struct link
-{
-	struct name_prefix *nbr;
-	int face;
-	int metric;
-};
-
-
-struct alsa_header 
-{
-	unsigned int ls_type;
-	char *orig_time;
-	struct name_prefix *orig_router;
-	
-};
-
-struct alsa
-{
-	struct alsa_header *header;	
-	int no_link;
-	struct link *links;
-	char * body;
-};
-
-struct nlsa_header
-{
-	unsigned int ls_type;
-	char *orig_time;
-	long int ls_id;
-	struct name_prefix *orig_router;
-	unsigned int isValid;
-
-};
-
-struct nlsa
-{
-	struct nlsa_header *header;
-	struct name_prefix *name_prefix;
-};
-
-struct clsa
-{
-	struct alsa_header *header;
-	double cor_r;
-	double cor_theta;
-};
-
-
-void set_new_lsdb_version(void);
-void build_and_install_name_lsas(void);
-void build_and_install_single_name_lsa(struct name_prefix *np);
-void build_name_lsa(struct nlsa *name_lsa, struct name_prefix *np);
-void install_name_lsa(struct nlsa *name_lsa);
-void print_name_lsa(struct nlsa *name_lsa);
-void write_log_for_name_lsa(struct nlsa *name_lsa);
-void print_name_lsdb(void);
-void build_and_install_others_name_lsa(char *orig_router,int ls_type,long int ls_id,char *orig_time, int isValid,char *np);
-void build_others_name_lsa(struct nlsa *name_lsa, char *orig_router,int ls_type,long int ls_id, char *orig_time, int isValid, char *np);
-void make_name_lsa_key(char *key, char *orig_router, int ls_type, long int ls_id);
-int refresh_lsdb(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
-
-int build_and_install_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
-void build_adj_lsa(struct alsa * adj_lsa);
-void install_adj_lsa(struct alsa * adj_lsa);
-void print_adj_lsa_body(const char *body, int no_link);
-void print_adj_lsa(struct alsa * adj_lsa);
-void write_log_for_adj_lsa(struct alsa * adj_lsa);
-void print_adj_lsdb(void);
-void make_adj_lsa_key(char *key,struct alsa *adj_lsa);
-void build_and_install_others_adj_lsa(char *orig_router,int ls_type,char *orig_time, int no_link,char *data);
-void build_others_adj_lsa(struct alsa *adj_lsa,char *orig_router,int ls_type,char *orig_time,int no_link,char *data);
-
-long int get_name_lsdb_num_element(void);
-long int get_adj_lsdb_num_element(void);
-
-int check_is_new_name_lsa(char *orig_router,char *lst,char *lsid,char *orig_time);
-int check_is_new_adj_lsa(char *orig_router,char *lst,char *orig_time);
-int check_is_new_cor_lsa(char *orig_router,char *lst,char *orig_time);
-
-void get_name_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId);
-void get_adj_lsa_data(struct ccn_charbuf *lsa_data,struct name_prefix *lsaId);
-
-void make_name_lsa_invalid(struct name_prefix *np,int ls_type, long int ls_id);
-
-void build_and_install_cor_lsa();
-void print_cor_lsdb();
-
-void write_name_lsdb_to_repo(char *slice_prefix);
-void write_name_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id);
-void make_name_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, long int ls_id,char *orig_time,char *slice_prefix);
-void write_adj_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id);
-
-void write_cor_lsa_to_repo(struct clsa *cor_lsa);
-void build_and_install_others_cor_lsa(char *orig_router,int ls_type,char *orig_time, double cor_r, double cor_theta);
-double get_hyperbolic_r(char *router);
-double get_hyperbolic_theta(char *router);
-
-void destroy_lsdb(void);
-
-void 
-get_lsdb_summary(struct ccn_charbuf *lsdb_data);
-
-#endif
diff --git a/nlsr_ndn.c b/nlsr_ndn.c
deleted file mode 100644
index 096c8a2..0000000
--- a/nlsr_ndn.c
+++ /dev/null
@@ -1,1301 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-#include "nlsr.h"
-#include "nlsr_ndn.h"
-#include "nlsr_npl.h"
-#include "nlsr_adl.h"
-#include "nlsr_lsdb.h"
-#include "utility.h"
-#include "nlsr_km.h"
-#include "nlsr_km_util.h"
-
-
-
-/**
-* get neighbor name prefix from interest/content name and put into nbr
-*/
-
-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 *)calloc(strlen(neighbor)+1,sizeof(char));
-	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);
-	free(neighbor);
-}
-
-/**
-*	Retrieve LSA identifier from content name
-*/
-
-void 
-get_lsa_identifier(struct name_prefix *lsaId,struct ccn_closure *selfp, 
-									struct ccn_upcall_info *info, int offset)
-{
-
-	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 *)calloc(len,sizeof(char));
-
-	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 *)calloc(strlen(neighbor)+1,sizeof(char));
-	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);
-
-	free(neighbor);
-}
-
-
-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;	
-
-}
-
-/** 
-* Call back function registered in ccnd to get all interest coming to NLSR 
-* application 
-*/
-
-enum ccn_upcall_res 
-incoming_interest(struct ccn_closure *selfp,
-        enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
-{
-
-    nlsr_lock();    
-
-    switch (kind) {
-        case CCN_UPCALL_FINAL:
-            break;
-        case CCN_UPCALL_INTEREST:
-		// printing the name prefix for which it received interest
-		if ( nlsr->debugging )
-            		printf("Interest Received for name: "); 
-		if ( nlsr->detailed_logging )
-            		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Interest Received for name: ");
-		
-	    	struct ccn_charbuf*c;
-		c=ccn_charbuf_create();
-		ccn_uri_append(c,info->interest_ccnb,info->pi->offset[CCN_PI_E_Name],0);
-
-		if ( nlsr->debugging )
-			printf("%s\n",ccn_charbuf_as_string(c));
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"%s\n",ccn_charbuf_as_string(c));
-
-		ccn_charbuf_destroy(&c);
-
-		process_incoming_interest(selfp, info);
-		
-		break;
-
-        default:
-            break;
-    }
-
-     nlsr_unlock();
-
-    return CCN_UPCALL_RESULT_OK;
-}
-
-/**
-* Function for processing incoming interest and reply with content/NACK content 
-*/
-
-void 
-process_incoming_interest(struct ccn_closure *selfp, struct ccn_upcall_info *info)
-{
-	if ( nlsr->debugging )
-		printf("process_incoming_interest called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_interest called \n");
-	
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-	int res,i;
-	int nlsr_position=0;
-	int name_comps=(int)info->interest_comps->n;
-
-	for(i=0;i<name_comps;i++)
-	{
-		res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
-		if( res == 0)
-		{
-			nlsr_position=i;
-			break;
-		}	
-	}
-
-	res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,nlsr_position+1,
-								&comp_ptr1, &comp_size);
-
-
-	if(!strcmp((char *)comp_ptr1,"info"))
-	{
-		process_incoming_interest_info(selfp,info);
-	}
-	if(!strcmp((char *)comp_ptr1,"lsdb"))
-	{
-		process_incoming_interest_lsdb(selfp,info);
-	}
-	if(!strcmp((char *)comp_ptr1,"lsa"))
-	{
-		process_incoming_interest_lsa(selfp,info);
-	}
-
-}
-
-/**
-* Processes incoming interest for "info" interest. Send back reply content back,
-* if interest comes from a neighbor with status down, NLSR will send "info"
-* ineterst to that neighbor
-*/
-
-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();
-    	
-
-	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)
-	{
-		
-		/*
-		struct ccn_charbuf *pubid = ccn_charbuf_create();
-		struct ccn_charbuf *pubkey = ccn_charbuf_create();
-
-		//pubid is the digest_result pubkey is result
-		ccn_get_public_key(nlsr->ccn, NULL, pubid, pubkey);
-		*/
-		
-
-		struct ccn_signing_params sp=CCN_SIGNING_PARAMS_INIT;
-		sp.template_ccnb=ccn_charbuf_create();		
-				
-		ccn_charbuf_append_tt(sp.template_ccnb,CCN_DTAG_SignedInfo, CCN_DTAG);
-		ccnb_tagged_putf(sp.template_ccnb, CCN_DTAG_FreshnessSeconds, "%ld", 10);
-       	 	sp.sp_flags |= CCN_SP_TEMPL_FRESHNESS;
-		ccn_charbuf_append_closer(sp.template_ccnb);
-		
-		/*
-		char *raw_data=(char *)malloc(20);
-		memset(raw_data,0,20);
-		sprintf(raw_data,"%s", nlsr->lsdb->lsdb_version);
-		*/	
-
-		struct ccn_charbuf *resultbuf=ccn_charbuf_create();
-
-		/*
-		res=sign_content_with_user_defined_keystore(name,
-											resultbuf,
-											"info",
-											strlen("info"),
-											nlsr->keystore_path,
-											nlsr->keystore_passphrase,
-											nlsr->root_key_prefix,
-											nlsr->site_name,
-											nlsr->router_name,
-											10);
-	
-		*/
-		res= ccn_sign_content(nlsr->ccn, resultbuf, name, &sp, "info",strlen("info")); 
-		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,resultbuf->buf,resultbuf->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));		
-
-
-		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);
-		}
-
-		if ( nbr->name != NULL )
-			free(nbr->name);
-		if ( nbr != NULL )
-			free(nbr);
-		ccn_charbuf_destroy(&resultbuf);
-	}
-
-	//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 Receiv"
-															"ed 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));
-			ccn_charbuf_destroy(&ito);
-
-			process_incoming_timed_out_interest(selfp,info);
-
-	    break;
-
-		case CCN_UPCALL_CONTENT_UNVERIFIED:
-			if ( nlsr->debugging )
-				printf("Unverified Content Received ..Waiting for verification\n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Unverified Content"
-										" Received ..Waiting for verification\n");
-			//return CCN_UPCALL_RESULT_VERIFY;
-			process_incoming_content(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;
-}
-
-/**
-* process any incoming content to NLSR from ccnd
-*/
-
-void 
-process_incoming_content(struct ccn_closure *selfp, struct ccn_upcall_info* info)
-{
-	if ( nlsr->debugging )
-		printf("process_incoming_content called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_content called \n");
-
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-	int res,i;
-	int nlsr_position=0;
-	int name_comps=(int)info->interest_comps->n;
-
-	for(i=0;i<name_comps;i++)
-	{
-		res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
-		if( res == 0)
-		{
-			nlsr_position=i;
-			break;
-		}	
-	}
-
-	res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,
-										nlsr_position+1,&comp_ptr1, &comp_size);
-
-
-	if(!strcmp((char *)comp_ptr1,"info"))
-	{
-		process_incoming_content_info(selfp,info);
-	}
-
-}
-
-/**
-* process any incoming "info" content to NLSR from ccnd
-*/
-
-void 
-process_incoming_content_info(struct ccn_closure *selfp, 
-												struct ccn_upcall_info* info)
-{
-	if ( nlsr->debugging )
-		printf("process_incoming_content_info called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"process_incoming_content_info"
-																" called \n");
-
-	struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
-	get_nbr(nbr,selfp,info);
-
-	if ( nlsr->debugging )
-		printf("Info Content Received For Neighbor: %s Length:%d\n",nbr->name,
-																nbr->length);
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Info Content Received For Nei"
-								"ghbor: %s Length:%d\n",nbr->name,nbr->length);
-
-	
-	/*
-	if ( contain_key_name(info->content_ccnb, info->pco) == 1){
-		int res_verify=-1;
-		int key_exists=0;
-		struct ccn_charbuf *key_name=get_key_name(info->content_ccnb, info->pco);
-		struct ccn_charbuf *key_uri = ccn_charbuf_create();
-		ccn_uri_append(key_uri, key_name->buf, key_name->length, 0);
-		key_exists=does_key_exist(ccn_charbuf_as_string(key_uri));
-		int key_type=get_key_type_from_key_name(key_name);
-
-		if ( res_verify == 1 && key_type == NLSR_KEY ){				
-			res_verify=0;
-		}
-		else{
-			res_verify=verify_key(info->content_ccnb,info->pco,0);
-		}
-						
-		//int res_verify=verify_key(info->content_ccnb,info->pco,0);
-
-		if ( res_verify != 0 ){
-			if ( nlsr->debugging )
-				printf("Error in verfiying keys !! :( \n");
-			ccn_charbuf_destroy(&key_name);
-			ccn_charbuf_destroy(&key_uri);
-		}
-		else{
-			if ( key_exists == 0 )
-				add_key(ccn_charbuf_as_string(key_uri));
-			ccn_charbuf_destroy(&key_name);
-			ccn_charbuf_destroy(&key_uri);
-			if ( nlsr->debugging )
-				printf("Key verification is successful :)\n");
-			update_adjacent_timed_out_zero_to_adl(nbr);	
-			update_adjacent_status_to_adl(nbr,NBR_ACTIVE);
-			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");
-			}
-
-		}	
-	}
-	*/
-	
-					update_adjacent_timed_out_zero_to_adl(nbr);	
-					update_adjacent_status_to_adl(nbr,NBR_ACTIVE);
-					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");
-					}
-
-	
-	if ( nbr->name != NULL )
-		free(nbr->name);
-	if ( nbr != NULL )
-		free(nbr);
-
-
-}
-
-/**
-* process any incoming interest timed out content to NLSR from ccnd
-*/
-
-
-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_int"
-															"erest 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);
-	}
-}
-
-/**
-* process any incoming "info" interest timed out content to NLSR from ccnd
-*/
-
-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_int"
-														"erest_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"
-							" 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;		
-		}
-	}
-
-	if ( nbr->name != NULL )
-		free(nbr->name);
-	if ( nbr != NULL )
-		free(nbr);
-
-
-}
-
-/**
-* send "info" interest to each and every neighbor in ADL and also schedule for 
-* itself for periodical sending of "info" interest
-*/
-
-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;
-}
-
-
-/**
-* send "info" interest neighbor nbr 
-*
-*/
-
-void 
-send_info_interest_to_neighbor(struct name_prefix *nbr)
-{
-
-	if ( nlsr->debugging )
-		printf("send_info_interest_to_neighbor called \n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"send_info_interest_to_neighbor"
-																" called \n");
-
-
-	int res;
-	char info_str[5];
-	char nlsr_str[5];
-	
-	memset(&nlsr_str,0,5);
-	sprintf(nlsr_str,"nlsr");
-	memset(&info_str,0,5);
-	sprintf(info_str,"info");
-	
-	
-	struct ccn_charbuf *name;	
-	name=ccn_charbuf_create();
-
-	char *int_name=(char *)malloc(strlen(nbr->name)+1+strlen(nlsr_str)+1+
-						strlen(info_str)+strlen(nlsr->router_name)+1);
-	memset(int_name,0,strlen(nbr->name)+1+strlen(nlsr_str)+1+strlen(info_str)+
-												strlen(nlsr->router_name)+1);
-	memcpy(int_name+strlen(int_name),nbr->name,strlen(nbr->name));
-	memcpy(int_name+strlen(int_name),"/",1);
-	memcpy(int_name+strlen(int_name),nlsr_str,strlen(nlsr_str));
-	memcpy(int_name+strlen(int_name),"/",1);
-	memcpy(int_name+strlen(int_name),info_str,strlen(info_str));
-	memcpy(int_name+strlen(int_name),nlsr->router_name,strlen(nlsr->router_name));
-	
-
-	res=ccn_name_from_uri(name,int_name);
-	if ( res >=0 )
-	{
-		/* adding InterestLifeTime and InterestScope filter */
-
-		struct ccn_charbuf *templ;
-		templ = ccn_charbuf_create();
-
-		ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
-		ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
-		ccn_charbuf_append_closer(templ); /* </Name> */
-		ccn_charbuf_append_tt(templ, CCN_DTAG_Scope, CCN_DTAG);
-		ccn_charbuf_append_tt(templ, 1, CCN_UDATA);
-		/* Adding InterestLifeTime and InterestScope filter done */		
-		ccn_charbuf_append(templ, "2", 1); //scope of interest: 2 
-											//(not further than next host)
-		ccn_charbuf_append_closer(templ); /* </Scope> */
-
-		appendLifetime(templ,nlsr->interest_resend_time);
-		unsigned int face_id=get_next_hop_face_from_adl(nbr->name);
-		ccnb_tagged_putf(templ, CCN_DTAG_FaceID, "%u", face_id);
-		ccn_charbuf_append_closer(templ); /* </Interest> */
-		
-	
-		if ( nlsr->debugging )
-			printf("Sending info interest on name prefix : %s through Face:%u\n"
-															,int_name,face_id);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Sending info interest on"
-						 "name prefix : %s through Face:%u\n",int_name,face_id);
-
-		res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
-
-		if ( res >= 0 )
-		{
-			if ( nlsr->debugging )
-				printf("Info interest sending Successfull .... \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Info" 
-					"interest sending Successfull .... \n");
-		}	
-		ccn_charbuf_destroy(&templ);
-	}
-
-	ccn_charbuf_destroy(&name);
-	free(int_name);
-}
-
-
-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);
-	*/
-}
-
-
-
-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;
-
-}
-
-
diff --git a/nlsr_ndn.h b/nlsr_ndn.h
deleted file mode 100644
index 5d81208..0000000
--- a/nlsr_ndn.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef _NLSR_NDN_H_
-#define _NLSR_NDN_H_
-
-int appendLifetime(struct ccn_charbuf *cb, int lifetime);
-void get_nbr(struct name_prefix *nbr,struct ccn_closure *selfp, struct ccn_upcall_info *info);
-void get_lsa_identifier(struct name_prefix *lsaId,struct ccn_closure *selfp, struct ccn_upcall_info *info,int offset);
-//void get_lsdb_version(char *lsdb_version,struct ccn_closure *selfp, struct ccn_upcall_info *info );
-//int get_ls_type(struct ccn_closure *selfp, struct ccn_upcall_info *info);
-
-enum ccn_upcall_res incoming_interest(struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info); 
-void process_incoming_interest(struct ccn_closure *selfp, struct ccn_upcall_info *info);
-void process_incoming_interest_info(struct ccn_closure *selfp, struct ccn_upcall_info *info);
-
-enum ccn_upcall_res incoming_content(struct ccn_closure* selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info* info);
-void process_incoming_content(struct ccn_closure *selfp, struct ccn_upcall_info* info);
-void process_incoming_content_info(struct ccn_closure *selfp, struct ccn_upcall_info* info);
-
-void process_incoming_timed_out_interest(struct ccn_closure* selfp, struct ccn_upcall_info* info);
-void process_incoming_timed_out_interest_info(struct ccn_closure* selfp, struct ccn_upcall_info* info);
-
-int send_info_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
-void send_info_interest_to_neighbor(struct name_prefix *nbr);
-
-
-
-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);
-
-int send_lsdb_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
-
-#endif
diff --git a/nlsr_npl.c b/nlsr_npl.c
deleted file mode 100644
index 5c36699..0000000
--- a/nlsr_npl.c
+++ /dev/null
@@ -1,199 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-#include "nlsr.h"
-#include "nlsr_npl.h"
-#include "utility.h"
-
-
-
-void 
-add_name_to_npl(struct name_prefix *np)
-{
-	struct name_prefix_list_entry *npe;
-	struct 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 *)calloc(1,sizeof(struct name_prefix ));
-		npe->np->length=np->length;
-		npe->np->name=(char *)calloc(np->length,sizeof(char));
-		memcpy(npe->np->name,np->name,np->length);
-		npe->name_lsa_id=0;
-	}
-    	
-	hashtb_end(e);
-
-}
-
-int  
-does_name_exist_in_npl(struct name_prefix *np)
-{
-	int ret=0;
-	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);
-}
-
-void
-destroy_npl_entry_component(struct name_prefix_list_entry *npe)
-{
-	if (npe->np->name)
-		free(npe->np->name);
-	if(npe->np)
-		free(npe->np);
-}
-
-void
-destroy_npl(void)
-{
-	int i, npl_element;
-	struct name_prefix_list_entry *npe;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npl, e);
-	npl_element=hashtb_n(nlsr->npl);
-
-	for(i=0;i<npl_element;i++)
-	{
-		npe=e->data;
-		destroy_npl_entry_component(npe);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	if ( nlsr->npl)
-		hashtb_destroy(&nlsr->npl);
-}
diff --git a/nlsr_npl.h b/nlsr_npl.h
deleted file mode 100644
index 865bfcd..0000000
--- a/nlsr_npl.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _NLSR_NPL_H_
-#define _NLSR_NPL_H_
-
-struct name_prefix_list_entry
-{
-	struct name_prefix *np;
-	long int name_lsa_id;
-};
-
-void add_name_to_npl(struct name_prefix *np);
-void print_name_prefix_from_npl(void);
-int does_name_exist_in_npl(struct name_prefix *np);
-void update_nlsa_id_for_name_in_npl(struct name_prefix *np, long int nlsa_id);
-long int get_lsa_id_from_npl(struct name_prefix *np);
-void destroy_npl(void);
-void destroy_npl_entry_component(struct name_prefix_list_entry *npe);
-#endif
diff --git a/nlsr_npt.c b/nlsr_npt.c
deleted file mode 100644
index 00b1c42..0000000
--- a/nlsr_npt.c
+++ /dev/null
@@ -1,1152 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <sys/types.h>
-#include <signal.h>
-
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-#include "nlsr.h"
-#include "nlsr_npt.h"
-#include "nlsr_fib.h"
-#include "nlsr_route.h"
-#include "nlsr_adl.h"
-#include "utility.h"
-
-int
-add_npt_entry(char *orig_router, char *name_prefix, int num_face, int *faces, int *route_costs)
-{
-	if ( strcmp(orig_router,nlsr->router_name)== 0)
-	{
-		return -1;
-	}
-
-	struct npt_entry *ne;//=(struct npt_entry*)calloc(1,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 *)calloc(strlen(orig_router)+1,sizeof(char));
-		memcpy(ne->orig_router,orig_router,strlen(orig_router)+1);
-
-	
-		
-
-		//struct hashtb_param param_nle = {0};
-		ne->name_list= hashtb_create(sizeof(struct name_list_entry ),NULL);
-
-		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 *)calloc(1,sizeof(struct name_list_entry));
-			nle=enle->data;
-			nle->name=(char *)calloc(strlen(name_prefix)+1,sizeof(char));
-			//memset(nle->name,0,strlen(name_prefix)+1);
-			memcpy(nle->name,name_prefix,strlen(name_prefix)+1);
-
-			
-
-		}
-		hashtb_end(enle);
-
-		//struct hashtb_param param_fle = {0};
-		ne->face_list=hashtb_create(sizeof(struct face_list_entry), NULL);
-
-		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 *)calloc(1,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)
-	{
-		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 *)calloc(1,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 *)calloc(1,sizeof(struct face_list_entry));
-						fle=ef->data;
-						fle->next_hop_face=face;
-						fle->route_cost=route_costs[i];
-					}
-				}
-			}
-			hashtb_end(ef);
-		}
-	
-
-	}
-	hashtb_end(e);
-
-	update_ccnd_fib_for_orig_router(orig_router);
-
-	return res;
-}
-
-void 
-update_ccnd_fib_for_orig_router(char *orig_router)
-{
-
-	if ( nlsr->debugging )
-	{
-		printf("update_ccnd_fib_for_orig_router called\n");
-	}
-
-	int res;	
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    
-
-   	hashtb_start(nlsr->npt, e);
-    	res = hashtb_seek(e, orig_router, strlen(orig_router), 0);
-
-	if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-	else if ( res == HT_OLD_ENTRY )
-	{
-		struct npt_entry *ne;
-		ne=e->data;
-		int num_face=hashtb_n(ne->face_list);
-		int last_face,first_face;
-
-		int *faces=(int *)malloc(num_face*sizeof(int));
-		int *route_costs=(int *)malloc(num_face*sizeof(int));
-		
-		get_all_faces_for_orig_router_from_npt(orig_router,faces,route_costs,num_face);
-		sort_faces_by_distance(faces,route_costs,0,num_face);
-		
-		if ( nlsr->debugging )
-		{
-			int m;
-			for ( m =0 ; m< num_face ; m++)
-			{
-				printf("Dest_router: %s Next_Hop_Face: %d Route_cost: %d \n",orig_router,faces[m],route_costs[m]);
-			}
-		}
-
-		last_face=0;
-		if ( nlsr->max_faces_per_prefix == 0) // add all faces available in routing table
-		{
-			first_face=num_face-1;
-		}
-		else if( nlsr->max_faces_per_prefix > 0)
-		{
-			if ( nlsr->max_faces_per_prefix >= num_face)
-			{
-				first_face=num_face-1;
-			}
-			else if ( nlsr->max_faces_per_prefix < num_face)
-			{
-				first_face=nlsr->max_faces_per_prefix-1;
-			}
-	
-		}
-
-		int i,j, nl_element;
-		struct name_list_entry *nle;		
-		struct hashtb_enumerator eenle;
-    		struct hashtb_enumerator *enle = &eenle;
-
-		hashtb_start(ne->name_list, enle);
-		nl_element=hashtb_n(ne->name_list);
-		
-		for (i=0;i<nl_element;i++)
-		{
-			nle=enle->data;
-			
-			for( j=num_face-1; j>= 0; j--)
-			{
-
-				if ( !( is_neighbor(nle->name) == 1 && get_next_hop_face_from_adl(nle->name) == faces[j] ) )
-				{
-					add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j],nlsr->router_dead_interval);
-				}
-			}
-			
-			
-			hashtb_next(enle);
-		}
-		hashtb_end(enle);
-		
-
-		if ( nlsr->debugging )
-		{
-			printf("First Face Index: %d Last Face Index: %d\n",first_face,last_face);
-		}
-
-		hashtb_start(ne->name_list, enle);
-		nl_element=hashtb_n(ne->name_list);	
-
-		for (i=0;i<nl_element;i++)
-		{
-			nle=enle->data;
-			
-			for( j=first_face; j>= last_face; j--)
-			{
-				if ( nlsr->debugging )
-				{
-					printf("Possible FIB Entry name: %s face: %d route cost: %d \n",nle->name,faces[j],route_costs[j]);
-				}
-				if ( is_active_neighbor(orig_router) == 0 )
-				{
-					if ( nlsr->debugging )
-						printf("Adding face: Name:%s Face: %d\n",nle->name,faces[j]);	
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Adding face: Name:%s Face: %d\n",nle->name,faces[j]);
-					add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_REG, faces[j],nlsr->router_dead_interval);	
-				}
-				else 
-				{
-					if ( j == last_face &&  is_active_neighbor(nle->name)==0)
-					{
-						if ( nlsr->debugging )
-							printf("Adding face: Name:%s Face: %d\n",nle->name,faces[j]);	
-						if ( nlsr->detailed_logging )
-							writeLogg(__FILE__,__FUNCTION__,__LINE__,"Adding face: Name:%s Face: %d\n",nle->name,faces[j]);
-						add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_REG, faces[j],nlsr->router_dead_interval);
-					}
-				}
-			}
-			
-			
-			hashtb_next(enle);
-		}
-		hashtb_end(enle);
-		
-
-
-		free(faces);
-		free(route_costs);
-
-	}
-	hashtb_end(e);
-
-}
-
-int 
-delete_npt_entry_by_router_and_name_prefix(char *orig_router, char *name_prefix)
-{
-	if ( strcmp(orig_router,nlsr->router_name)== 0)
-	{
-		return -1;
-	}
-
-	struct npt_entry *ne;
-	
-	int res,res_nle;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    
-
-   	hashtb_start(nlsr->npt, e);
-    	res = hashtb_seek(e, orig_router, strlen(orig_router), 0);
-
-	if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-		return -1;
-	}
-	else if (res == HT_OLD_ENTRY)
-	{
-		ne=e->data;
-
-		struct hashtb_enumerator eenle;
-    		struct hashtb_enumerator *enle = &eenle;
-
-		hashtb_start(ne->name_list, enle);
-		res_nle = hashtb_seek(enle, name_prefix, strlen(name_prefix), 0);
-
-		if(res_nle == HT_NEW_ENTRY )
-		{
-			hashtb_delete(enle);
-		}
-		else if(res_nle == HT_OLD_ENTRY )
-		{
-			struct name_list_entry *nle;
-
-			nle=enle->data;
-	
-			int j;
-			int num_face=hashtb_n(ne->face_list);
-			int last_face,first_face;
-
-			int *faces=(int *)malloc(num_face*sizeof(int));
-			int *route_costs=(int *)malloc(num_face*sizeof(int));
-		
-			get_all_faces_for_orig_router_from_npt(orig_router,faces,route_costs,num_face);
-			sort_faces_by_distance(faces,route_costs,0,num_face);
-		
-
-			last_face=0;
-			if ( nlsr->max_faces_per_prefix == 0) // add all faces available in routing table
-			{
-				first_face=num_face-1;
-			}
-			else if( nlsr->max_faces_per_prefix > 0)
-			{
-				if ( nlsr->max_faces_per_prefix >= num_face)
-				{
-					first_face=num_face-1;
-				}
-				else if ( nlsr->max_faces_per_prefix < num_face)
-				{
-					first_face=nlsr->max_faces_per_prefix-1;
-				}
-	
-			}
-			for( j=first_face; j>= last_face; j--)
-			{
-
-				if ( is_active_neighbor(orig_router) == 0 )
-				{
-					if ( nlsr->debugging )
-						printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);	
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
-					add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j],nlsr->router_dead_interval);	
-				}
-				else 
-				{
-					if ( j == last_face && is_active_neighbor(nle->name)==0)
-					{
-						if ( nlsr->debugging )
-							printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);	
-						if ( nlsr->detailed_logging )
-							writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
-						add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j],nlsr->router_dead_interval);
-					}
-				}
-				
-			}
-			
-		}
-
-		hashtb_end(enle);
-	}
-	
-	hashtb_end(e);
-
-	return 0;
-}
-
-void 
-print_npt(void)
-{
-
-	if ( nlsr->debugging )
-	{
-		printf("\n");
-		printf("print_npt called\n");
-	}
-	if ( nlsr->detailed_logging )
-	{
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_npt called\n");
-	}
-	int i, npt_element;
-	
-	struct npt_entry *ne;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npt, e);
-	npt_element=hashtb_n(nlsr->npt);
-
-	for(i=0;i<npt_element;i++)
-	{
-		if ( nlsr->debugging )
-		{
-			printf("\n");
-			printf("----------NPT ENTRY %d------------------\n",i+1);
-		}
-		if ( nlsr->detailed_logging )
-		{
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"----------NPT ENTRY %d------------------\n",i+1);
-		}
-		ne=e->data;
-		if ( nlsr->debugging )
-			printf(" Origination Router: %s \n",ne->orig_router);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__," Origination Router: %s \n",ne->orig_router);
-		
-		int j, nl_element,face_list_element;
-		struct name_list_entry *nle;		
-		struct hashtb_enumerator eenle;
-    		struct hashtb_enumerator *enle = &eenle;
-
-		hashtb_start(ne->name_list, enle);
-		nl_element=hashtb_n(ne->name_list);	
-
-		for (j=0;j<nl_element;j++)
-		{
-			nle=enle->data;
-			if ( nlsr->debugging )
-				printf(" Name Prefix: %s \n",nle->name);
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Name Prefix: %s \n",nle->name);
-			hashtb_next(enle);
-		}
-		hashtb_end(enle);
-
-		struct face_list_entry *fle;
-
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(ne->face_list, ef);
-		face_list_element=hashtb_n(ne->face_list);
-		if ( face_list_element <= 0 )
-		{
-			if ( nlsr->debugging )
-				printf(" 	Face: No Face \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: No Face \n");
-			
-		}
-		else
-		{
-			for(j=0;j<face_list_element;j++)
-			{
-				fle=ef->data;
-				if ( nlsr->debugging )
-					printf(" 	Face: %d Route_Cost: %f \n",fle->next_hop_face,fle->route_cost);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: %d Route_Cost: %d \n",fle->next_hop_face,fle->route_cost);
-				hashtb_next(ef);	
-			}
-		}
-		hashtb_end(ef);
-		
-			
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	if ( nlsr->debugging )
-		printf("\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-}
-
-void
-delete_orig_router_from_npt(char *orig_router)
-{
-	int res,num_face,num_prefix;
-	struct npt_entry *ne;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npt, e);
-	res = hashtb_seek(e, orig_router, strlen(orig_router), 0);
-
-	if ( res == HT_OLD_ENTRY )
-	{
-		ne=e->data;
-		num_prefix=hashtb_n(ne->name_list);
-		if ( num_prefix > 0 )
-		{
-			num_face=hashtb_n(ne->face_list);
-			
-			if ( num_face > 0  )
-			{
-				int j, nl_element;
-				struct name_list_entry *nle;		
-				struct hashtb_enumerator eenle;
-    				struct hashtb_enumerator *enle = &eenle;
-
-				hashtb_start(ne->name_list, enle);
-				nl_element=hashtb_n(ne->name_list);	
-
-				for (j=0;j<nl_element;j++)
-				{
-					nle=enle->data;
-					delete_npt_entry_by_router_and_name_prefix(ne->orig_router,nle->name);		
-					hashtb_next(enle);
-				}
-				hashtb_end(enle);				
-
-			} 
-
-		}
-		//hashtb_destroy(&ne->name_list);
-		//hashtb_destroy(&ne->face_list);
-		free(ne->orig_router);
-		destroy_name_list(ne->name_list);
-		destroy_face_list(ne->face_list);
-		hashtb_delete(e);		
-	}
-	else if ( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-	}
-	hashtb_end(e);	
-}
-
-
-void
-add_face_to_npt_by_face_id(char *dest_router, int face_id, int route_cost)
-{
-	if ( nlsr->debugging )
-	{
-		printf("add_face_to_npt_by_face_id called\n");
-		printf("Dest Router: %s Face: %d Route_cost: %d \n",dest_router, face_id, route_cost);
-	}
-	if ( nlsr->detailed_logging )
-	{
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"add_face_to_npt_by_face_id called\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Dest Router: %s Face: %d Route_cost: %d \n",dest_router, face_id, route_cost);
-	}
-
-	
-	int res,res1;
-	struct npt_entry *ne;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npt, e);
-	res = hashtb_seek(e, dest_router, strlen(dest_router), 0);
-
-	if ( res == HT_OLD_ENTRY )
-	{
-		if ( nlsr->debugging )
-			printf("Dest Router Found \n");
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Dest Router Found \n");
-	
-		ne=e->data;
-		
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(ne->face_list, ef);
-		res1=hashtb_seek(ef, &face_id, sizeof(face_id), 0);
-
-		if ( res1 == HT_OLD_ENTRY )
-		{
-			if ( nlsr->debugging )
-				printf("Face Found \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Face Found \n");
-			struct face_list_entry *fle;
-			fle=ef->data;
-			fle->next_hop_face=face_id;
-			fle->route_cost=route_cost;
-		}
-		else if ( res1 == HT_NEW_ENTRY )
-		{
-			if ( nlsr->debugging )
-				printf("Face Not Found \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Face Not Found \n");
-			struct face_list_entry *fle;//=(struct face_list_entry *)malloc(sizeof(struct face_list_entry));
-			fle=ef->data;
-			fle->next_hop_face=face_id;
-			fle->route_cost=route_cost;
-
-			
-
-
-		}
-		hashtb_end(ef);
-	}
-	else if (res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-	
-	hashtb_end(e);
-}
-
-
-void
-add_new_fib_entries_to_npt(void)
-{
-	if ( nlsr->debugging )
-		printf("add_new_fib_entries_to_npt called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"add_new_fib_entries_to_npt called\n");
-	int i,j, rt_element,face_list_element;
-	
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	rt_element=hashtb_n(nlsr->routing_table);
-
-	for(i=0;i<rt_element;i++)
-	{
-		rte=e->data;
-
-		struct face_list_entry *fle;
-
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(rte->face_list, ef);
-		face_list_element=hashtb_n(rte->face_list);
-		if ( face_list_element <= 0 )
-		{
-			if ( nlsr->debugging )
-				printf(" Face: No Face \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," Face: No Face \n");
-		}
-		else
-		{
-			for(j=0;j<face_list_element;j++)
-			{
-				fle=ef->data;
-				add_face_to_npt_by_face_id(rte->dest_router,fle->next_hop_face,fle->route_cost);
-				hashtb_next(ef);	
-			}
-		}
-		hashtb_end(ef);
-
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-
-void
-delete_face_from_npt_by_face_id(char *dest_router, int face_id)
-{
-	if ( nlsr->debugging )
-		printf("delete_face_from_npt_by_face_id\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_face_from_npt_by_face_id\n");
-
-	int res,res1;
-	struct npt_entry *ne;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npt, e);
-	res = hashtb_seek(e, dest_router, strlen(dest_router), 0);
-
-	if ( res == HT_OLD_ENTRY )
-	{
-		ne=e->data;
-		
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(ne->face_list, ef);
-		res1=hashtb_seek(ef, &face_id, sizeof(face_id), 0);
-		if ( res1 == HT_OLD_ENTRY )
-		{
-			
-			hashtb_delete(ef);
-		}
-		else if ( res1 == HT_NEW_ENTRY )
-		{
-			hashtb_delete(ef);
-		}
-		hashtb_end(ef);
-	}
-	else if (res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-	
-	hashtb_end(e);
-}
-
-
-void 
-clean_old_fib_entries_from_npt(void)
-{
-	
-	
-	if ( nlsr->debugging )
-		printf("clean_old_fib_entries_from_npt called\n\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"clean_old_fib_entries_from_npt called\n\n");
-	int i, npt_element;
-	
-	struct npt_entry *ne;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npt, e);
-	npt_element=hashtb_n(nlsr->npt);
-
-	for(i=0;i<npt_element;i++)
-	{
-		ne=e->data;
-		
-		int j,k, nl_element,face_list_element;
-		struct face_list_entry *fle;
-
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(ne->face_list, ef);
-		face_list_element=hashtb_n(ne->face_list);
-		if ( face_list_element <= 0 )
-		{
-			if ( nlsr->debugging )
-				printf(" Face: No Face \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: No Face \n");
-			
-		}
-		else
-		{
-			for(j=0;j<face_list_element;j++)
-			{
-				fle=ef->data;
-				int check=does_face_exist_for_router(ne->orig_router,fle->next_hop_face);
-				if ( check == 0 )
-				{
-					struct name_list_entry *nle;		
-					struct hashtb_enumerator eenle;
-    					struct hashtb_enumerator *enle = &eenle;
-
-					hashtb_start(ne->name_list, enle);
-					nl_element=hashtb_n(ne->name_list);	
-
-					for (k=0;k<nl_element;k++)
-					{
-						nle=enle->data;
-						if( is_neighbor(nle->name) == 0 )
-						{
-							if ( nlsr->debugging )
-								printf("Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);
-							if ( nlsr->detailed_logging )
-								writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);		
-							add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, fle->next_hop_face,nlsr->router_dead_interval);
-						}						
-		
-
-						hashtb_next(enle);
-					}
-					hashtb_end(enle);
-
-
-					hashtb_delete(ef);
-					j++;
-						
-				}
-				else 
-				{
-					struct name_list_entry *nle;		
-					struct hashtb_enumerator eenle;
-    					struct hashtb_enumerator *enle = &eenle;
-
-					hashtb_start(ne->name_list, enle);
-					nl_element=hashtb_n(ne->name_list);	
-
-					for (k=0;k<nl_element;k++)
-					{
-						nle=enle->data;
-						if(  is_active_neighbor(ne->orig_router) && get_next_hop_face_from_adl(	ne->orig_router ) != fle->next_hop_face )
-						{
-							if ( nlsr->debugging )
-								printf("Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);
-							if ( nlsr->detailed_logging )
-								writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,fle->next_hop_face);		
-							add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, fle->next_hop_face,nlsr->router_dead_interval);
-						}						
-		
-
-						hashtb_next(enle);
-					}
-					hashtb_end(enle);
-					
-					hashtb_next(ef);
-				}	
-			}
-		}
-		hashtb_end(ef);
-		
-			
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-void
-update_npt_with_new_route(void)
-{
-	if ( nlsr->debugging )
-		printf("update_npt_with_new_route called\n");
-		
-	clean_old_fib_entries_from_npt();
-	print_npt();
-	add_new_fib_entries_to_npt();
-	print_npt();	
-
-	int i, npt_element;
-	
-	struct npt_entry *ne;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->npt, e);
-	npt_element=hashtb_n(nlsr->npt);
-
-	for(i=0;i<npt_element;i++)
-	{
-	
-		ne=e->data;
-		update_ccnd_fib_for_orig_router(ne->orig_router);
-		hashtb_next(e);
-	}
-	
-	hashtb_end(e);
-}
-
-
-
-void 
-sort_faces_by_distance(int *faces,int *route_costs,int start,int element)
-{
-	int i,j;
-	int temp_cost;
-	int temp_face;
-
-	for ( i=start ; i < element ; i ++) 
-	{
-		for( j=i+1; j<element; j ++)
-		{
-			if (route_costs[j] < route_costs[i] )
-			{
-				temp_cost=route_costs[j];
-				route_costs[j]=route_costs[i];
-				route_costs[i]=temp_cost;
-
-				temp_face=faces[j];
-				faces[j]=faces[i];
-				faces[i]=temp_face;
-			}
-		}
-	}
-	
-}
-
-void
-get_all_faces_for_orig_router_from_npt(char *orig_router, int *faces, int *route_costs, int num_faces)
-{
-
-	int res,face_list_element,j;	
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    
-
-   	hashtb_start(nlsr->npt, e);
-    	res = hashtb_seek(e, orig_router, strlen(orig_router), 0);
-
-	if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-	else if ( res == HT_OLD_ENTRY )
-	{
-		struct npt_entry *ne;
-		ne=e->data;
-		
-		struct face_list_entry *fle;
-
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(ne->face_list, ef);
-		face_list_element=hashtb_n(ne->face_list);
-		for(j=0;j<face_list_element;j++)
-		{
-			fle=ef->data;
-			faces[j]=fle->next_hop_face;
-			route_costs[j]=fle->route_cost;
-			hashtb_next(ef);	
-		}
-		hashtb_end(ef);
-		
-
-	}
-	hashtb_end(e);
-
-}
-
-void 
-destroy_faces_by_orig_router(char *orig_router)
-{
-
-	int res;	
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    
-
-   	hashtb_start(nlsr->npt, e);
-    	res = hashtb_seek(e, orig_router, strlen(orig_router), 0);
-
-	if(res == HT_NEW_ENTRY)
-	{
-		hashtb_delete(e);
-	}
-	else if ( res == HT_OLD_ENTRY )
-	{
-		struct npt_entry *ne;
-		ne=e->data;
-		int num_face=hashtb_n(ne->face_list);
-		int last_face,first_face;
-
-		int *faces=(int *)malloc(num_face*sizeof(int));
-		int *route_costs=(int *)malloc(num_face*sizeof(int));
-		
-		get_all_faces_for_orig_router_from_npt(orig_router,faces,route_costs,num_face);
-		sort_faces_by_distance(faces,route_costs,0,num_face);
-		last_face=0;
-		if ( nlsr->max_faces_per_prefix == 0)
-		{
-			first_face=num_face-1;
-		}
-		else if( nlsr->max_faces_per_prefix > 0)
-		{
-			if ( nlsr->max_faces_per_prefix >= num_face)
-			{
-				first_face=num_face-1;
-			}
-			else if ( nlsr->max_faces_per_prefix < num_face)
-			{
-				first_face=nlsr->max_faces_per_prefix-1;
-			}
-	
-		}
-
-		int i,j, nl_element;
-		struct name_list_entry *nle;		
-		struct hashtb_enumerator eenle;
-    		struct hashtb_enumerator *enle = &eenle;
-
-		hashtb_start(ne->name_list, enle);
-		nl_element=hashtb_n(ne->name_list);	
-
-		for (i=0;i<nl_element;i++)
-		{
-			nle=enle->data;
-			
-			for( j=first_face; j>= last_face; j--)
-			{
-				if ( is_active_neighbor(orig_router) == 0 )
-				{
-					if ( nlsr->debugging )
-						printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
-					add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j],nlsr->router_dead_interval);	
-				}
-				else 
-				{
-					if ( j == last_face && is_active_neighbor(nle->name)==0)
-					{
-						if ( nlsr->debugging )
-							printf("Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
-						if ( nlsr->detailed_logging )
-							writeLogg(__FILE__,__FUNCTION__,__LINE__,"Deleting face: Name:%s Face: %d\n",nle->name,faces[j]);
-						add_delete_ccn_face_by_face_id(nlsr->ccn, (const char *)nle->name, OP_UNREG, faces[j],nlsr->router_dead_interval);
-					}
-				}
-			}
-
-			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");
-}
-
-void
-destroy_name_list(struct hashtb *name_list)
-{
-	int j,nl_element;
-	struct name_list_entry *nle;		
-	struct hashtb_enumerator eenle;
-    	struct hashtb_enumerator *enle = &eenle;
-
-	hashtb_start(name_list, enle);
-	nl_element=hashtb_n(name_list);	
-
-	for (j=0;j<nl_element;j++)
-	{
-		nle=enle->data;
-		free(nle->name);
-		hashtb_next(enle);
-	}
-	hashtb_end(enle);
-
-	hashtb_destroy(&name_list);	
-}
-
-void
-destroy_face_list(struct hashtb *face_list)
-{
-	hashtb_destroy(&face_list);
-}
-
-void 
-destroy_npt(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;
-		free(ne->orig_router);
-		destroy_name_list(ne->name_list);
-		destroy_face_list(ne->face_list);	
-		hashtb_next(e);		
-	}
-	hashtb_end(e);
-
-	hashtb_destroy(&nlsr->npt);
-}
-
diff --git a/nlsr_npt.h b/nlsr_npt.h
deleted file mode 100644
index ecb6bda..0000000
--- a/nlsr_npt.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _NLSR_NPT_H_
-#define _NLSR_NPT_H_
-
-#define NO_FACE -12345
-#define ZERO_FACE 0
-
-struct npt_entry
-{
-	char *orig_router;
-	struct hashtb *name_list;
-	struct hashtb *face_list;
-};
-
-struct name_list_entry
-{
-	char *name;
-};
-
-
-int add_npt_entry(char *orig_router, char *name_prefix, int num_face, int *faces, int *route_costs);
-int delete_npt_entry_by_router_and_name_prefix(char *orig_router, char *name_prefix);
-void print_npt(void);
-void delete_orig_router_from_npt(char *orig_router);
-void update_npt_with_new_route(void);
-void destroy_all_face_by_nlsr(void);
-void sort_faces_by_distance(int *faces,int *route_costs,int start,int element);
-void update_ccnd_fib_for_orig_router(char *orig_router);
-void get_all_faces_for_orig_router_from_npt(char *orig_router, int *faces, int *route_costs, int num_faces);
-void destroy_name_list(struct hashtb *name_list);
-void destroy_face_list(struct hashtb *face_list);
-void destroy_npt(void);
-
-#endif
diff --git a/nlsr_route.c b/nlsr_route.c
deleted file mode 100644
index cea17bb..0000000
--- a/nlsr_route.c
+++ /dev/null
@@ -1,1489 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <sys/types.h>
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-
-#include "nlsr.h"
-#include "nlsr_route.h"
-#include "nlsr_lsdb.h"
-#include "nlsr_npt.h"
-#include "nlsr_adl.h"
-#include "nlsr_fib.h"
-#include "utility.h"
-
-int
-route_calculate(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
-{
-
-	if(flags == CCN_SCHEDULE_CANCEL)
-	{
- 	 	return -1;
-	}
-
-	nlsr_lock();
-
-	if ( nlsr->debugging )
-		printf("route_calculate called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"route_calculate called\n");
-
-	if( ! nlsr->is_build_adj_lsa_sheduled )
-	{
-		/* Calculate Route here */
-		print_routing_table();
-		print_npt();	
-		nlsr->map = hashtb_create(sizeof(struct map_entry), NULL);
-		nlsr->rev_map = hashtb_create(sizeof(struct map_entry), NULL);
-		make_map();
-		assign_mapping_number();		
-		print_map();
-		print_rev_map();
-
-		do_old_routing_table_updates();
-		clear_old_routing_table();	
-		print_routing_table();
-		print_npt();
-
-		int i;
-		int **adj_matrix;
-		int map_element=hashtb_n(nlsr->map);
-		adj_matrix=malloc(map_element * sizeof(int *));
-		for(i = 0; i < map_element; i++)
-		{
-			adj_matrix[i] = malloc(map_element * sizeof(int));
-		}
-		make_adj_matrix(adj_matrix,map_element);
-		if ( nlsr->debugging )
-			print_adj_matrix(adj_matrix,map_element);
-
-		long int source=get_mapping_no(nlsr->router_name);
-		int num_link=get_no_link_from_adj_matrix(adj_matrix, map_element ,source);
-
-		if ( nlsr->is_hyperbolic_calc == 1)
-		{
-			long int *links=(long int *)malloc(num_link*sizeof(long int));
-			long int *link_costs=(long int *)malloc(num_link*sizeof(long int));
-			get_links_from_adj_matrix(adj_matrix, map_element , links, link_costs, source);
-
-			struct hashtb_enumerator ee;
-			struct hashtb_enumerator *e = &ee;
-			for (hashtb_start(nlsr->rev_map, e); e->key != NULL; hashtb_next(e)) 
-			{
-				struct map_entry *me=e->data;
-				if ( me->mapping != source )
-				{
-					long int *faces=(long int *)calloc(num_link,sizeof(long int));
-					double *nbr_dist=(double *)calloc(num_link,sizeof(double));
-					double *nbr_to_dest=(double *)calloc(num_link,sizeof(double));
-					for ( i=0 ; i < num_link; i++)
-					{
-						int face=get_next_hop_face_from_adl(get_router_from_rev_map(links[i]));
-						double dist_to_nbr=get_hyperbolic_distance(source,links[i]);
-						double dist_to_dest_from_nbr=get_hyperbolic_distance(links[i],me->mapping);
-						faces[i]=face;
-						nbr_dist[i]=dist_to_nbr;
-						nbr_to_dest[i]=	dist_to_dest_from_nbr;	
-
-						
-					}
-					sort_hyperbolic_route(nbr_to_dest,nbr_dist, faces,0,num_link);
-					if (nlsr->max_faces_per_prefix == 0 )
-					{
-						for ( i=0 ; i < num_link; i++)
-						{
-							update_routing_table_with_new_hyperbolic_route(me->mapping,faces[i],nbr_to_dest[i]);
-						}				
-					}
-					else if ( nlsr->max_faces_per_prefix > 0 )
-					{
-						if ( num_link <= nlsr->max_faces_per_prefix )
-						{
-							for ( i=0 ; i < num_link; i++)
-							{
-								update_routing_table_with_new_hyperbolic_route(me->mapping,faces[i],nbr_to_dest[i]);
-							}
-						}
-						else if (num_link > nlsr->max_faces_per_prefix)
-						{
-							for ( i=0 ; i < nlsr->max_faces_per_prefix; i++)
-							{
-								update_routing_table_with_new_hyperbolic_route(me->mapping,faces[i],nbr_to_dest[i]);
-							}
-						}
-
-					}
-					free(faces);
-					free(nbr_dist);
-					free(nbr_to_dest);
-				}
-			}
-			hashtb_end(e);
-
-			
-			free(links);
-			free(link_costs);
-		}
-		else if (nlsr->is_hyperbolic_calc == 0 )
-		{
-
-			long int *parent=(long int *)malloc(map_element * sizeof(long int));
-			long int *dist=(long int *)malloc(map_element * sizeof(long int));
-			
-		
-			if ( (num_link == 0) || (nlsr->max_faces_per_prefix == 1 ) )
-			{	
-				calculate_path(adj_matrix,parent,dist, map_element, source);		
-				print_all_path_from_source(parent,source);
-				print_all_next_hop(parent,source);		
-				update_routing_table_with_new_route(parent, dist,source);
-			}
-			else if ( (num_link != 0) && (nlsr->max_faces_per_prefix == 0 || nlsr->max_faces_per_prefix > 1 ) )
-			{
-				long int *links=(long int *)malloc(num_link*sizeof(long int));
-				long int *link_costs=(long int *)malloc(num_link*sizeof(long int));
-				get_links_from_adj_matrix(adj_matrix, map_element , links, link_costs, source);
-				for ( i=0 ; i < num_link; i++)
-				{
-					adjust_adj_matrix(adj_matrix, map_element,source,links[i],link_costs[i]);
-					calculate_path(adj_matrix,parent,dist, map_element, source);		
-					print_all_path_from_source(parent,source);
-					print_all_next_hop(parent,source);		
-					update_routing_table_with_new_route(parent, dist,source);
-				}
-
-				free(links);
-				free(link_costs);
-			}
-			free(parent);
-			free(dist);
-		}
-		
-		print_routing_table();
-		print_npt();
-
-		update_npt_with_new_route();
-
-		print_routing_table();
-		print_npt();
-
-
-		for(i = 0; i < map_element; i++)
-		{
-			free(adj_matrix[i]);
-		}
-		
-		free(adj_matrix);
-		destroy_map();
-		destroy_rev_map();
-		
-	}
-	nlsr->is_route_calculation_scheduled=0;
-
-	nlsr_unlock();
-
-	return 0;
-}
-
-void 
-calculate_path(int **adj_matrix, long int *parent,long int *dist ,long int V, long int S)
-{
-	int i;
-	long int v,u;
-	//long int *dist=(long int *)malloc(V * sizeof(long int));
-	long int *Q=(long int *)malloc(V * sizeof(long int));
-	long int head=0;
-	/* Initiate the Parent */
-	for (i = 0 ; i < V; i++)
-	{
-		parent[i]=EMPTY_PARENT;
-		dist[i]=INF_DISTANCE;
-		Q[i]=i;
-	} 
-
-	if ( S != NO_MAPPING_NUM )
-	{
-		dist[S]=0;
-		sort_queue_by_distance(Q,dist,head,V);
-
-		while (head < V )
-		{
-			u=Q[head];
-			if(dist[u] == INF_DISTANCE)
-			{
-				break;
-			}
-
-			for(v=0 ; v <V; v++)
-			{
-				if( adj_matrix[u][v] > 0 ) //
-				{
-					if ( is_not_explored(Q,v,head+1,V) )
-					{
-					
-						if( dist[u] + adj_matrix[u][v] <  dist[v])
-						{
-							dist[v]=dist[u] + adj_matrix[u][v] ;
-							parent[v]=u;
-						}	
-
-					}
-
-				}
-
-			}
-
-			head++;
-			sort_queue_by_distance(Q,dist,head,V);
-		}
-	}
-	free(Q);	
-}
-
-void
-print_all_path_from_source(long int *parent,long int source)
-{
-	int i, map_element;
-	struct map_entry *me;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->map, e);
-	map_element=hashtb_n(nlsr->map);
-
-	if ( source != NO_MAPPING_NUM)
-	{
-		for(i=0;i<map_element;i++)
-		{
-			me=e->data;
-			if(me->mapping != source)
-			{
-				
-				if ( nlsr->debugging )
-				{
-					print_path(parent,(long int)me->mapping);
-					printf("\n");
-				}
-				if ( nlsr->detailed_logging )
-				{
-					print_path(parent,(long int)me->mapping);
-					writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-				}
-				
-			}
-			hashtb_next(e);		
-		}
-	}
-	hashtb_end(e);
-
-}
-
-void 
-print_all_next_hop(long int *parent,long int source)
-{
-	int i, map_element;
-	struct map_entry *me;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->map, e);
-	map_element=hashtb_n(nlsr->map);
-
-	for(i=0;i<map_element;i++)
-	{
-		me=e->data;
-		if(me->mapping != source)
-		{
-			if ( nlsr->debugging )
-				printf("Dest: %d Next Hop: %ld\n",me->mapping,get_next_hop_from_calculation(parent,me->mapping,source));
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__,"Dest: %d Next Hop: %ld\n",me->mapping,get_next_hop_from_calculation(parent,me->mapping,source));
-		}
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-long int
-get_next_hop_from_calculation(long int *parent, long int dest,long int source)
-{
-	long int next_hop;
-	while ( parent[dest] != EMPTY_PARENT )
-	{
-		next_hop=dest;
-		dest=parent[dest];
-
-	}
-
-	if ( dest != source )
-	{
-		next_hop=NO_NEXT_HOP;	
-	}
-	
-	return next_hop;
-	
-}
-
-void
-print_path(long int *parent, long int dest)
-{
-	if (parent[dest] != EMPTY_PARENT )
-		print_path(parent,parent[dest]);
-
-	if ( nlsr->debugging )
-		printf(" %ld",dest);
-}
-
-int 
-is_not_explored(long int *Q, long int u,long int start, long int element)
-{
-	int ret=0;
-	long int i;
-	for(i=start; i< element; i++)
-	{
-		if ( Q[i] == u )
-		{
-			ret=1;
-			break;
-		}
-	}
-	return ret;
-}
-
-void 
-sort_queue_by_distance(long int *Q,long int *dist,long int start,long int element)
-{
-	long int i,j;
-	long int temp_u;
-
-	for ( i=start ; i < element ; i ++) 
-	{
-		for( j=i+1; j<element; j ++)
-		{
-			if (dist[Q[j]] < dist[Q[i]])
-			{
-				temp_u=Q[j];
-				Q[j]=Q[i];
-				Q[i]=temp_u;
-			}
-		}
-	}
-	
-}
-
-void 
-sort_hyperbolic_route(double *dist_dest,double *dist_nbr, long int *faces,long int start,long int element)
-{
-	long int i,j;
-	double temp_dist;
-	long int temp_face;
-
-	for ( i=start ; i < element ; i ++) 
-	{
-		for( j=i+1; j<element; j ++)
-		{
-			if (dist_dest[i] < dist_dest[j])
-			{
-				temp_dist=dist_dest[j];
-				dist_dest[j]=dist_dest[i];
-				dist_dest[i]=temp_dist;
-
-				temp_dist=dist_nbr[j];
-				dist_nbr[j]=dist_nbr[i];
-				dist_nbr[i]=temp_dist;
-
-				temp_face=faces[j];
-				faces[j]=faces[i];
-				faces[i]=temp_face;
-			}
-			if ( (dist_dest[i] == dist_dest[j]) && (dist_nbr[i] < dist_nbr[j]) )
-			{
-				temp_dist=dist_dest[j];
-				dist_dest[j]=dist_dest[i];
-				dist_dest[i]=temp_dist;
-
-				temp_dist=dist_nbr[j];
-				dist_nbr[j]=dist_nbr[i];
-				dist_nbr[i]=temp_dist;
-
-				temp_face=faces[j];
-				faces[j]=faces[i];
-				faces[i]=temp_face;
-			}
-		}
-	}
-	
-}
-
-void
-print_map(void)
-{
-	int i, map_element;
-	struct map_entry *me;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->map, e);
-	map_element=hashtb_n(nlsr->map);
-
-	for(i=0;i<map_element;i++)
-	{
-		me=e->data;
-		if ( nlsr->debugging )
-			printf("Router: %s Mapping Number: %d \n",me->router,me->mapping);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Router: %s Mapping Number: %d \n",me->router,me->mapping);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-}
-
-
-void
-assign_mapping_number(void)
-{
-	int i, map_element;
-	struct map_entry *me;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->map, e);
-	map_element=hashtb_n(nlsr->map);
-
-	for(i=0;i<map_element;i++)
-	{
-		me=e->data;
-		me->mapping=i;
-		add_rev_map_entry(i,me->router);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-}
-
-void 
-make_map(void)
-{
-	
-
-	int i, adj_lsdb_element;
-	struct alsa *adj_lsa;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
-	adj_lsdb_element=hashtb_n(nlsr->lsdb->adj_lsdb);
-
-	add_map_entry(nlsr->router_name);
-
-	for(i=0;i<adj_lsdb_element;i++)
-	{
-		adj_lsa=e->data;
-		add_adj_data_to_map(adj_lsa->header->orig_router->name,adj_lsa->body,adj_lsa->no_link);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-}
-
-void 
-add_map_entry(char *router)
-{
-
-	struct map_entry *me;//=(struct map_entry*)malloc(sizeof(struct map_entry ));
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee; 	
-    	int res;
-
-   	hashtb_start(nlsr->map, e);
-    	res = hashtb_seek(e, router, strlen(router), 0);
-
-	if(res == HT_NEW_ENTRY)
-	{
-		me=e->data;
-		me->router=(char *)malloc(strlen(router)+1);
-		memset(me->router,0,strlen(router)+1);
-		memcpy(me->router,router,strlen(router));
-		me->mapping=0;
-	}
-
-	hashtb_end(e);
-	
-}
-
-
-void 
-add_adj_data_to_map(char *orig_router, char *body, int no_link)
-{
-	add_map_entry(orig_router);
-	
-	int i=0;
-	char *lsa_data=(char *)malloc(strlen(body)+1);
-	memset(	lsa_data,0,strlen(body)+1);
-	memcpy(lsa_data,body,strlen(body)+1);
-	char *sep="|";
-	char *rem;
-	char *rtr_id;
-	char *length;
-	//char *face;
-	char *metric;
-	
-	if(no_link >0 )
-	{
-		rtr_id=strtok_r(lsa_data,sep,&rem);
-		length=strtok_r(NULL,sep,&rem);
-		//face=strtok_r(NULL,sep,&rem);
-		metric=strtok_r(NULL,sep,&rem);
-
-		if ( !nlsr->debugging && nlsr->debugging)
-		{
-			printf("Metric: %s Length:%s\n",metric,length);
-		}
-		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);
-			if ( !nlsr->debugging && nlsr->debugging)
-			{
-				printf("Metric: %s Length:%s\n",metric,length);
-			}
-
-			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);
-	
-		if ( !nlsr->debugging && nlsr->debugging)
-		{
-				printf("Metric: %s Length:%s\n",metric,length);
-		}
-
-		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);
-
-			if ( !nlsr->debugging && nlsr->debugging)
-			{
-				printf("Metric: %s Length:%s\n",metric,length);
-			}
-
-			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);
-		if ( !nlsr->debugging && nlsr->debugging)
-		{
-			printf("Metric: %s Length:%s\n",metric,length);
-		}
-
-
-		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);
-			if ( !nlsr->debugging && nlsr->debugging)
-			{
-				printf("Metric: %s Length:%s\n",metric,length);
-			}
-
-			add_next_hop_router(rtr_id);
-	
-		}
-	}
-
-	free(lsa_data);
-
-
-}
-
-void 
-update_routing_table(char * dest_router,int next_hop_face, int route_cost)
-{
-	if ( nlsr->debugging )
-	{
-		printf("update_routing_table called \n");
-		printf("Dest Router: %s Next Hop face: %d Route Cost: %d \n",dest_router,next_hop_face,route_cost);
-	}
-
-	int res,res1;
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	res = hashtb_seek(e, dest_router, strlen(dest_router), 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		rte=e->data;
-
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(rte->face_list, ef);
-		res1 = hashtb_seek(ef, &next_hop_face, sizeof(next_hop_face), 0);	
-		if( res1 == HT_NEW_ENTRY)
-		{
-			struct face_list_entry *fle;
-			fle=ef->data;
-			fle->next_hop_face=next_hop_face;
-			fle->route_cost=route_cost;						
-		}
-		else if ( res1 == HT_OLD_ENTRY )
-		{
-			struct face_list_entry *fle;
-			fle=ef->data;
-			fle->route_cost=route_cost;
-		}
-		hashtb_end(ef);
-	}
-	else if ( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-	}
-	
-	hashtb_end(e);
-	
-}
-
-void 
-print_routing_table(void)
-{
-	if ( nlsr->debugging )
-		printf("print_routing_table called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"print_routing_table called\n");
-	int i,j, rt_element,face_list_element;
-	
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	rt_element=hashtb_n(nlsr->routing_table);
-
-	for(i=0;i<rt_element;i++)
-	{
-		if ( nlsr->debugging )
-			printf("----------Routing Table Entry %d------------------\n",i+1);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"----------Routing Table Entry %d------------------\n",i+1);
-		
-		rte=e->data;
-
-		if ( nlsr->debugging )
-			printf(" Destination Router: %s \n",rte->dest_router);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__," Destination Router: %s \n",rte->dest_router);
-
-		
-		//rte->next_hop_face == NO_NEXT_HOP ? printf(" Next Hop Face: NO_NEXT_HOP \n") : printf(" Next Hop Face: %d \n", rte->next_hop_face);
-
-		struct face_list_entry *fle;
-
-		struct hashtb_enumerator eef;
-    		struct hashtb_enumerator *ef = &eef;
-    	
-    		hashtb_start(rte->face_list, ef);
-		face_list_element=hashtb_n(rte->face_list);
-		if ( face_list_element <= 0 )
-		{
-			if ( nlsr->debugging )
-				printf(" 	Face: No Face \n");
-			if ( nlsr->detailed_logging )
-				writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: No Face \n");
-		}
-		else
-		{
-			for(j=0;j<face_list_element;j++)
-			{
-				fle=ef->data;
-				if ( nlsr->debugging )
-					printf(" 	Face: %d Route_Cost: %f \n",fle->next_hop_face,fle->route_cost);
-				if ( nlsr->detailed_logging )
-					writeLogg(__FILE__,__FUNCTION__,__LINE__," 	Face: %d Route_Cost: %d \n",fle->next_hop_face,fle->route_cost);
-				hashtb_next(ef);	
-			}
-		}
-		hashtb_end(ef);
-
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	if ( nlsr->debugging )
-		printf("\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"\n");
-}
-
-/*
-int
-delete_empty_rte(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
-{
-	if ( nlsr->debugging )
-	{
-		printf("delete_empty_rte called\n");
-		printf("Router: %s \n",(char *)ev->evdata);
-	}
-	if ( nlsr->detailed_logging )
-	{
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"delete_empty_rte called\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"Router: %s \n",(char *)ev->evdata);
-	}
-	
-	if(flags == CCN_SCHEDULE_CANCEL)
-	{
- 	 	return -1;
-	}
-
-	nlsr_lock();
-	int res;
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	res = hashtb_seek(e, (char *)ev->evdata, strlen((char *)ev->evdata), 0);
-	
-	if ( res == HT_OLD_ENTRY )
-	{
-		hashtb_delete(e);
-	}
-	else if ( res == HT_NEW_ENTRY )
-	{
-		hashtb_delete(e);
-	}
-
-	print_routing_table();
-
-	nlsr_unlock();
-	
-	return 0;
-}
-*/
-
-void 
-clear_old_routing_table(void)
-{
-	if ( nlsr->debugging )
-		printf("clear_old_routing_table called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"clear_old_routing_table called\n");
-	int i,rt_element;
-	
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	rt_element=hashtb_n(nlsr->routing_table);
-
-	for(i=0;i<rt_element;i++)
-	{
-		rte=e->data;
-		hashtb_destroy(&rte->face_list);
-		struct hashtb_param param_fle = {0};
-		rte->face_list=hashtb_create(sizeof(struct face_list_entry), &param_fle);
-
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);	
-}
-
-
-void 
-do_old_routing_table_updates(void)
-{
-	if ( nlsr->debugging )
-		printf("do_old_routing_table_updates called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"do_old_routing_table_updates called\n");
-	
-	int i, rt_element;
-	int mapping_no;	
-
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	rt_element=hashtb_n(nlsr->routing_table);
-
-	for(i=0;i<rt_element;i++)
-	{
-		rte=e->data;
-		mapping_no=get_mapping_no(rte->dest_router);
-		if ( mapping_no == NO_MAPPING_NUM)
-		{		
-			delete_orig_router_from_npt(rte->dest_router);
-			/*
-			char *router=(char *)malloc(strlen(rte->dest_router)+1);
-			memset(router,0,strlen(rte->dest_router)+1);
-			memcpy(router,rte->dest_router,strlen(rte->dest_router)+1);
-			nlsr->event = ccn_schedule_event(nlsr->sched, 1, &delete_empty_rte, (void *)router , 0);
-			*/
-			destroy_routing_table_entry_comp(rte);
-			hashtb_delete(e);
-			i++;
-		}
-		else
-		{
-			hashtb_next(e);
-		}		
-	}
-
-	hashtb_end(e);	
-}
-
-void 
-update_routing_table_with_new_hyperbolic_route(long int dest_router_rev_map_index, long int face, double nbr_to_dest_dist)
-{
-	if ( nlsr->debugging )
-		printf("update_routing_table_with_new_hyperbolic_route called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_routing_table_with_new_hyperbolic_route called\n");
-	
-	char *orig_router=get_router_from_rev_map(dest_router_rev_map_index);
-
-	if (face != NO_NEXT_HOP && face != NO_FACE )
-	{
-		update_routing_table(orig_router,face,nbr_to_dest_dist);
-		if ( nlsr->debugging )
-			printf ("Orig_router: %s Next Hop Face: %ld \n",orig_router,face);
-		if ( nlsr->detailed_logging )
-			writeLogg(__FILE__,__FUNCTION__,__LINE__,"Orig_router: %s Next Hop Face: %ld \n",orig_router,face);
-					
-	}
-	
-
-}
-
-
-void 
-update_routing_table_with_new_route(long int *parent, long int *dist,long int source)
-{
-	if ( nlsr->debugging )
-		printf("update_routing_table_with_new_route called\n");
-	if ( nlsr->detailed_logging )
-		writeLogg(__FILE__,__FUNCTION__,__LINE__,"update_routing_table_with_new_route called\n");
-	int i, map_element;
-	struct map_entry *me;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->rev_map, e);
-	map_element=hashtb_n(nlsr->rev_map);
-
-	for(i=0;i<map_element;i++)
-	{
-		me=e->data;
-		if(me->mapping != source)
-		{
-			
-			char *orig_router=get_router_from_rev_map(me->mapping);
-			if (orig_router != NULL )
-			{
-				int next_hop_router_num=get_next_hop_from_calculation(parent,me->mapping,source);
-				if ( next_hop_router_num == NO_NEXT_HOP )
-				{
-					if ( nlsr->debugging )
-						printf ("Orig_router: %s Next Hop Face: %d \n",orig_router,NO_FACE);
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Orig_router: %s Next Hop Face: %d \n",orig_router,NO_FACE);
-				}
-				else 
-				{
-					char *next_hop_router=get_router_from_rev_map(next_hop_router_num);
-					int next_hop_face=get_next_hop_face_from_adl(next_hop_router);
-					update_routing_table(orig_router,next_hop_face,dist[me->mapping]);
-					if ( nlsr->debugging )
-						printf ("Orig_router: %s Next Hop Face: %d \n",orig_router,next_hop_face);
-					if ( nlsr->detailed_logging )
-						writeLogg(__FILE__,__FUNCTION__,__LINE__,"Orig_router: %s Next Hop Face: %d \n",orig_router,next_hop_face);
-					
-
-				}
-			}
-		}
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-}
-
-int 
-does_face_exist_for_router(char *dest_router, int face_id)
-{
-	if (nlsr->debugging)
-	{
-		printf("does_face_exist_for_router called\n");
-		printf("Dest Router: %s and Face id: %d \n",dest_router, face_id);
-	}
-
-	int ret=0;
-
-	int res;
-	struct routing_table_entry *rte;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->routing_table, e);
-	res = hashtb_seek(e, dest_router, strlen(dest_router), 0);
-
-	if( res == HT_OLD_ENTRY )
-	{
-		rte=e->data;
-		unsigned *v;
-		v = hashtb_lookup(rte->face_list, &face_id, sizeof(face_id));
-		if (v != NULL)
-			ret = 1;
-	}
-	else
-	{
-		hashtb_delete(e);
-	} 
-	
-	hashtb_end(e);
-
-	return ret;
-}
-
-double 
-get_hyperbolic_distance(long int source, long int dest)
-{
-	double distance;
-	char *src_router=get_router_from_rev_map(source);
-	char *dest_router=get_router_from_rev_map(dest);
-
-	double src_r=get_hyperbolic_r(src_router);
-	double src_theta=get_hyperbolic_r(src_router);	
-
-	double dest_r=get_hyperbolic_r(dest_router);
-	double dest_theta=get_hyperbolic_r(dest_router);
-	if ( src_r != -1 && dest_r != -1 )
-	{
-		distance=acosh(cosh(src_r)*cosh(dest_r)-sinh(src_r)*sinh(dest_r)*cos(src_theta-dest_theta));
-	}
-	else 
-	{
-		distance= -1.0;
-	}
-	
-	return distance;
-}
-
-void
-destroy_routing_table_entry_comp(struct routing_table_entry *rte)
-{
-
-	free(rte->dest_router);
-	hashtb_destroy(&rte->face_list);	
-		
-}
-
-void
-destroy_routing_table_entry(struct routing_table_entry *rte)
-{
-
-	destroy_routing_table_entry_comp(rte);
-	free(rte);
-}
-
-void
-destroy_routing_table(void)
-{
-	int i, rt_element;
-	struct hashtb_enumerator ee;
-	struct hashtb_enumerator *e = &ee;
-
-	struct routing_table_entry *rte;
-	hashtb_start(nlsr->routing_table, e);
-	rt_element=hashtb_n(nlsr->routing_table);
-	for(i=0;i<rt_element;i++)
-	{
-		rte=e->data;
-		free(rte->dest_router);
-		hashtb_destroy(&rte->face_list);	
-		hashtb_next(e);		
-	}	
-	hashtb_end(e);
-	hashtb_destroy(&nlsr->routing_table);
-
-}
-
-void
-destroy_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;
-		free(me->router);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	hashtb_destroy(&nlsr->map);
-
-}
-
-void
-destroy_rev_map(void)
-{
-	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;
-		free(me->router);
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	hashtb_destroy(&nlsr->rev_map);
-}
diff --git a/nlsr_route.h b/nlsr_route.h
deleted file mode 100644
index 1a3d70d..0000000
--- a/nlsr_route.h
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef _NLSR_ROUTE_H_
-#define _NLSR_ROUTE_H_
-
-#define EMPTY_PARENT -12345
-#define INF_DISTANCE 2147483647
-
-#define NO_NEXT_HOP -12345
-#define NO_MAPPING_NUM -1
-
-struct map_entry
-{
-	char *router;
-	int mapping;
-};
-
-
-struct routing_table_entry
-{
-	char *dest_router;
-	struct hashtb *face_list;
-};
-
-struct face_list_entry
-{
-	int next_hop_face;
-	double route_cost;
-};
-
-int route_calculate(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags);
-void make_map(void);
-void add_map_entry(char *router);
-void add_adj_data_to_map(char *orig_router, char *body, int no_link);
-void print_map(void);
-void assign_mapping_number(void);
-void make_adj_matrix(int **adj_matrix,int map_element);
-void init_adj_matrix(int **adj_matrix,int map_element);
-void print_adj_matrix(int **adj_matrix, int map_element);
-int get_mapping_no(char *router);
-void calculate_path(int **adj_matrix, long int *parent,long int *dist, long int V, long int S);
-void sort_queue_by_distance(long int *Q,long int *dist,long int start,long int element);
-int is_not_explored(long int *Q, long int u,long int start, long int element);
-void print_path(long int *parent, long int dest);
-void print_all_path_from_source(long int *parent,long int source);
-void add_rev_map_entry(long int mapping_number, char *router);
-void print_rev_map(void);
-char * get_router_from_rev_map(long int mapping_number);
-int get_no_link_from_adj_matrix(int **adj_matrix,long int V, long int S);
-void get_links_from_adj_matrix(int **adj_matrix, long int V ,long int *links, long int *link_costs,long int S);
-void adjust_adj_matrix(int **adj_matrix, long int V, long int S, long int link,long int link_cost);
-
-/* Routing Table Relates function */
-
-int get_next_hop(char *dest_router,int *faces, int *route_costs);
-int get_number_of_next_hop(char *dest_router);
-void add_next_hop_router(char *dest_router);
-void add_next_hop_from_lsa_adj_body(char *body, int no_link);
-void print_routing_table(void);
-void do_old_routing_table_updates(void);
-void clear_old_routing_table(void);
-void update_routing_table_with_new_route(long int *parent,long int *dist, long int source);
-
-long int get_next_hop_from_calculation(long int *parent, long int dest,long int source);
-void print_all_next_hop(long int *parent,long int source);
-int does_face_exist_for_router(char *dest_router, int face_id);
-
-double get_hyperbolic_distance(long int source, long int dest);
-void sort_hyperbolic_route(double *dist_dest,double *dist_nbr, long int *faces,long int start,long int element);
-void update_routing_table_with_new_hyperbolic_route(long int dest_router_rev_map_index, long int face, double nbr_to_dest_dist);
-
-void destroy_routing_table_entry_comp(struct routing_table_entry *rte);
-void destroy_routing_table_entry(struct routing_table_entry *rte);
-void destroy_routing_table(void);
-void destroy_map(void);
-void destroy_rev_map(void);
-
-#endif
diff --git a/nlsr_sync.c b/nlsr_sync.c
deleted file mode 100644
index c68e3bc..0000000
--- a/nlsr_sync.c
+++ /dev/null
@@ -1,874 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <assert.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-#include <ccn/sync.h>
-#include <ccn/seqwriter.h>
-
-#include "nlsr.h"
-#include "nlsr_sync.h"
-#include "nlsr_lsdb.h"
-#include "utility.h"
-#include "nlsr_km.h"
-#include "nlsr_km_util.h"
-
-
-char *
-hex_string(unsigned char *s, size_t l)
-{
-	const char *hex_digits = "0123456789abcdef";
-	char *r;
-	int i;
-	r = calloc(1, 1 + 2 * l);
-	for (i = 0; i < l; i++) {
-		r[2*i] = hex_digits[(s[i]>>4) & 0xf];
-		r[1+2*i] = hex_digits[s[i] & 0xf];
-	}
-	return(r);
-}
-
-/**
-* call back function from sync. Receive notification of updates in sync.
-* This function calls process_content_from_sync to handle incoming content
-* from sync.
-*/
-
-int
-sync_cb(struct ccns_name_closure *nc,
-		struct ccn_charbuf *lhash,
-		struct ccn_charbuf *rhash,
-		struct ccn_charbuf *name)
-{
-	nlsr_lock();
-	int res;
-	struct ccn_charbuf *content_name; 
-	struct ccn_indexbuf *content_comps;
-	struct ccn_indexbuf *name_comps;
-	
-	content_comps = ccn_indexbuf_create();
-	res = ccn_name_split(name, content_comps);
-	if ( res < 0 )
-		return 0;
-	
-	if (content_comps->n < 2)
-		return 0;
-
-	content_name = ccn_charbuf_create();
-	ccn_name_init(content_name);
-	
-	res = ccn_name_append_components( content_name,	name->buf,
-			content_comps->buf[0], content_comps->buf[content_comps->n - 1]);
-
-	if ( res < 0)
-		return 0;
-
-	// for debugging
-	struct ccn_charbuf *temp=ccn_charbuf_create();
-	ccn_uri_append(temp, content_name->buf, content_name->length, 0);
-	if ( nlsr->debugging )
-		printf("Name before chopping: %s \n",ccn_charbuf_as_string(temp));
-	ccn_charbuf_destroy(&temp);
-
-	name_comps = ccn_indexbuf_create();
-	res=ccn_name_split (content_name, name_comps);
-	if (res < 0)
-		return 0;		
-
-	if ( nlsr->debugging )
-	{
-		printf("Number of components in name = %d \n",res);
-		printf("Number of components in name as indexbuf->n = %d \n",
-				(int)name_comps->n);
-	}
-
-	ccn_name_chop(content_name, name_comps, -3);
-	if ( nlsr->debugging )
-		printf("Number of components in name as indexbuf->n after chopping= %d \n"
-				, (int)name_comps->n);	
-
-	//for debugging 
-	struct ccn_charbuf *temp1=ccn_charbuf_create();
-	ccn_uri_append(temp1, content_name->buf, content_name->length, 0);
-	if ( nlsr->debugging )
-		printf("Name after chopping: %s \n",ccn_charbuf_as_string(temp1));
-	ccn_charbuf_destroy(&temp1);
-
-	//main method that processes contents from the sync
-	process_content_from_sync(content_name, name_comps);
-	
-	ccn_charbuf_destroy(&content_name);
-	ccn_indexbuf_destroy(&content_comps);
-	ccn_indexbuf_destroy(&name_comps);
-
-	nlsr_unlock();
-	return(0);
-}
-
-
-/**
-* this function retrieve part of name from interest name and put it in name_part
-*/
-
-void
-get_name_part(struct name_prefix *name_part,struct ccn_charbuf * interest_ccnb, 
-		struct ccn_indexbuf *interest_comps, int offset)
-{
-	int lsa_position=0;
-	
-	struct ccn_indexbuf *components=ccn_indexbuf_create();
-	struct ccn_charbuf *name=ccn_charbuf_create();
-	ccn_name_from_uri(name,nlsr->slice_prefix);
-	ccn_name_split (name, components);
-	lsa_position=components->n-2;
-	ccn_charbuf_destroy(&name);
-
-	struct ccn_charbuf *temp=ccn_charbuf_create();
-	ccn_name_init(temp);	
-	ccn_name_append_components( temp,	interest_ccnb->buf,
-								interest_comps->buf[lsa_position+1], 
-								interest_comps->buf[interest_comps->n - 1]);
-
-	struct ccn_charbuf *temp1=ccn_charbuf_create();
-	ccn_uri_append(temp1, temp->buf, temp->length, 0);
-
-	name_part->name=(char *)calloc(strlen(ccn_charbuf_as_string(temp1))+1,
-																sizeof(char));
-	memcpy(name_part->name,ccn_charbuf_as_string(temp1),
-										strlen(ccn_charbuf_as_string(temp1)));
-	name_part->name[strlen(ccn_charbuf_as_string(temp1))]='\0';
-	name_part->length=strlen(ccn_charbuf_as_string(temp1))+1;
-
-	ccn_charbuf_destroy(&temp1);
-	ccn_charbuf_destroy(&temp);
-	ccn_indexbuf_destroy(&components);
-
-	if ( nlsr->debugging )
-		printf("Name Part: %s \n",name_part->name);
-	
-}
-
-
-/**
-* Get content value by content name and put the content value in content_data
-*/
-
-
-int 
-get_content_by_content_name(char *content_name, unsigned char **content_data,
-							char *orig_router)
-{
-	
-	int ret=-1;
-	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 = 1;
-	int content_only = 1;
-	int scope = -1;
-	const unsigned char *ptr,*ptr_in; 
-	size_t length,length_in;
-	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);
-		ccn_charbuf_destroy(&name);
-		return ret;
-	}
-
-	if (allow_stale || lifetime_l12 != lifetime_default || scope != -1) {
-		templ = ccn_charbuf_create();
-		ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
-		ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
-		ccn_charbuf_append_closer(templ); /* </Name> */
-		if (allow_stale) {
-			ccn_charbuf_append_tt(templ, CCN_DTAG_AnswerOriginKind, CCN_DTAG);
-			ccnb_append_number(templ,
-					CCN_AOK_DEFAULT | CCN_AOK_STALE);
-			ccn_charbuf_append_closer(templ); /* </AnswerOriginKind> */
-		}
-		if (scope != -1) {
-			ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
-		}
-		if (lifetime_l12 != lifetime_default) {
-			/*
-			 * Choose the interest lifetime so there are at least 3
-			 * expressions (in the unsatisfied case).
-			 */
-			unsigned char buf[3] = { 0 };
-			int i;
-			for (i = sizeof(buf) - 1; i >= 0; i--, lifetime_l12 >>= 8)
-				buf[i] = lifetime_l12 & 0xff;
-			ccnb_append_tagged_blob(templ, CCN_DTAG_InterestLifetime, buf, 
-					sizeof(buf));
-		}
-		ccn_charbuf_append_closer(templ); /* </Interest> */
-	}
-	resultbuf = ccn_charbuf_create();
-	if (resolve_version != 0) {
-		res = ccn_resolve_version(nlsr->ccn, name, resolve_version, 500);
-		if (res >= 0) {
-			ccn_uri_append(resultbuf, name->buf, name->length, 1);
-			resultbuf->length = 0;
-		}
-	}
-	res = ccn_get(nlsr->ccn, name, templ, timeout_ms, resultbuf, &pcobuf, NULL, 
-			get_flags);
-	if (res >= 0) {
-		ptr = resultbuf->buf;
-		length = resultbuf->length;
-		if (content_only){
-			ccn_content_get_value(ptr, length, &pcobuf, &ptr, &length);
-			struct ccn_parsed_ContentObject pcobuf1 = { 0 };
-			int chk_cont=ccn_parse_ContentObject(ptr,length,&pcobuf1,NULL);
-			if ( nlsr->debugging )	
-				printf("Content Parsing result: %d\n",chk_cont); 
-			if ( contain_key_name(ptr, &pcobuf1) == 1){
-				int res_verify=-1;
-				int key_exists=0;
-				struct ccn_charbuf *key_name=get_key_name(ptr, &pcobuf1);
-				struct ccn_charbuf *key_uri = ccn_charbuf_create();
-				ccn_uri_append(key_uri, key_name->buf, key_name->length, 0);
-				key_exists=does_key_exist(ccn_charbuf_as_string(key_uri));
-				int key_type=get_key_type_from_key_name(key_name);
-
-				if ( key_exists == 1 && key_type == NLSR_KEY ){				
-					res_verify=0;
-				}
-				else{
-					res_verify=verify_key(ptr,&pcobuf1,1);
-				}
-
-				if ( res_verify != 0 ){
-					if ( nlsr->debugging )
-						printf("Error in verfiying keys !! :( \n");
-					ccn_charbuf_destroy(&key_name);
-					ccn_charbuf_destroy(&key_uri);
-				}
-				else{
-					if ( key_exists == 0 )
-						add_key(ccn_charbuf_as_string(key_uri));
-					ccn_charbuf_destroy(&key_name);
-					ccn_charbuf_destroy(&key_uri);
-					if ( nlsr->debugging )
-						printf("Key verification is successful :)\n");
-					ptr_in=ptr;
-					length_in=length;
-					ccn_content_get_value(ptr_in, length_in, &pcobuf1, 
-															&ptr_in, &length_in);
-					*content_data = (unsigned char *) calloc(length_in+1, 
-																sizeof(char *));
-					memcpy (*content_data, ptr_in, length_in);
-					ret=0;
-				}
-			}
-		}
-	}
-
-	ccn_charbuf_destroy(&resultbuf);
-	ccn_charbuf_destroy(&templ);
-	ccn_charbuf_destroy(&name);
-
-	return ret;   
-}
-
-/**
-* Handle incoming lsa content, Calls functions to install lsa into lsdb
-*/
-
-void 
-process_incoming_sync_content_lsa( unsigned char *content_data)
-{
-
-
-	if ( nlsr->debugging )
-		printf("process_incoming_sync_content_lsa called \n");	
-
-	char *sep="|";
-	char *rem;
-	char *orig_router;
-	char *orl;
-	int orig_router_length;
-	char *lst;
-	int ls_type;
-	char *lsid;
-	long int ls_id;
-	char *isvld;
-	int isValid;
-	char *num_link;
-	int no_link;
-	char *np;
-	char *np_length;
-	int name_length;
-	char *data;
-	char *orig_time;
-
-
-	if ( nlsr->debugging )
-		printf("LSA Data \n");
-
-	if( strlen((char *)content_data ) > 0 )
-	{
-
-		orig_router=strtok_r((char *)content_data,sep,&rem);
-		orl=strtok_r(NULL,sep,&rem);
-		orig_router_length=atoi(orl);
-
-		if ( nlsr->debugging )
-		{
-			printf("	Orig Router Name  : %s\n",orig_router);
-			printf("	Orig Router Length: %d\n",orig_router_length);
-		}
-
-		lst=strtok_r(NULL,sep,&rem);		
-		ls_type=atoi(lst);
-
-		if ( nlsr->debugging )
-			printf("	LS Type  : %d\n",ls_type);
-
-		if ( ls_type == LS_TYPE_NAME )
-		{
-			lsid=strtok_r(NULL,sep,&rem);
-			ls_id=atoi(lsid);
-			orig_time=strtok_r(NULL,sep,&rem);
-			isvld=strtok_r(NULL,sep,&rem);
-			isValid=atoi(isvld);
-			np=strtok_r(NULL,sep,&rem);
-			np_length=strtok_r(NULL,sep,&rem);
-			name_length=atoi(np_length);
-			if ( nlsr->debugging )
-			{
-				printf("	LS ID  : %ld\n",ls_id);
-				printf("	isValid  : %d\n",isValid);
-				printf("	Name Prefix : %s\n",np);
-				printf("	Orig Time   : %s\n",orig_time);
-				printf("	Name Prefix length: %d\n",name_length);
-			}
-
-			build_and_install_others_name_lsa(orig_router,ls_type,ls_id,
-														orig_time,isValid,np);
-
-			print_name_lsdb();
-
-		}
-		else if ( ls_type == LS_TYPE_ADJ )
-		{
-			orig_time=strtok_r(NULL,sep,&rem);
-			num_link=strtok_r(NULL,sep,&rem);
-			no_link=atoi(num_link);
-			data=rem;
-
-			if ( nlsr->debugging )
-			{
-				printf("	Orig Time   : %s\n",orig_time);
-				printf("	No Link  : %d\n",no_link);
-				printf("	Data  : %s\n",data);
-			}
-			build_and_install_others_adj_lsa(orig_router,ls_type,orig_time,
-																no_link,data);
-		}
-		else if ( ls_type == LS_TYPE_COR )
-		{
-			orig_time=strtok_r(NULL,sep,&rem);
-			char *cor_r=strtok_r(NULL,sep,&rem);
-			char *cor_theta=strtok_r(NULL,sep,&rem);
-
-			double r, theta;
-			r=strtod(cor_r,NULL);
-			theta=strtod(cor_theta,NULL);
-
-			if ( nlsr->debugging )
-			{
-				printf("	Orig Time   : %s\n",orig_time);
-				printf("	Cor R	    : %f\n",r);
-				printf("	Cor Theta   : %f\n",theta);
-			}
-			build_and_install_others_cor_lsa(orig_router,ls_type,orig_time, 
-													(double)r, (double)theta);	
-		}
-
-	}
-}
-
-/**
-* Check LSA whether its new. If new retrieve the LSA content and call 
-* process_incoming_sync_content_lsa with content_data
-*/
-
-void
-process_content_from_sync (struct ccn_charbuf *content_name, 
-								struct ccn_indexbuf *components)
-{
-	if (nlsr->debugging)
-		printf("process_content_from_sync called \n");
-	size_t comp_size;
-	char *lst;
-	char *lsid;
-	const unsigned char *second_last_comp;
-	const unsigned char *third_last_comp;
-	const unsigned char *origtime;
-	char *sep=".";
-	char *rem;
-	char *second_comp_type;
-
-	int ls_type;
-	long int ls_id=0;
-
-	unsigned char *content_data = NULL;
-
-	char *time_stamp=get_current_timestamp_micro_v2();
-
-	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 *)
-								calloc( 1, sizeof(struct name_prefix));
-
-	ccn_name_comp_get( content_name->buf, components, 
-					  components->n-1-2, &second_last_comp, &comp_size);
-	
-	if (nlsr->debugging)
-		printf("2nd Last Component: %s \n", second_last_comp);
-
-	second_comp_type=strtok_r((char *)second_last_comp, sep, &rem);
-	if (second_comp_type == NULL || rem == NULL)
-	{
-		printf ("Error: unable to tokenize the string: %s, calling exit()\n",
-													(char *)second_last_comp); 
-		exit(0);
-	}
-
-	if ( strcmp( second_comp_type, "lsId" ) == 0 )
-	{	
-		lsid=rem;
-		ls_id=atoi(rem);
-		ccn_name_comp_get(content_name->buf, components,components->n-2-2,
-												&third_last_comp, &comp_size);
-		lst=strtok_r((char *)third_last_comp,sep,&rem);
-		lst=rem;
-		ls_type=atoi(lst);
-		ccn_name_comp_get(content_name->buf, components,components->n-2,
-														&origtime, &comp_size);
-		ccn_name_chop(content_name,components,-3);
-		get_name_part(orig_router,content_name,components,0);
-
-		if ( nlsr->debugging )
-			printf("Orig Router: %s Ls Type: %d Ls id: %ld Orig Time: %s\n",
-									orig_router->name,ls_type,ls_id,origtime);
-
-		int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
-		if ( nlsr->debugging )
-			printf("LSA Life time: %d\n",lsa_life_time);
-
-		if ( strcmp(orig_router->name,nlsr->router_name) != 0 
-				&& (lsa_life_time < nlsr->router_dead_interval) )
-		{
-			int is_new_name_lsa=check_is_new_name_lsa(orig_router->name,
-									(char *)lst,(char *)lsid,(char *)origtime);
-			if ( is_new_name_lsa == 1 )
-			{
-				if ( nlsr->debugging )
-					printf("New NAME LSA.....\n");	
-				int chk_con=get_content_by_content_name(ccn_charbuf_as_string(uri), 
-												&content_data,orig_router->name);
-				if ( chk_con == 0 ){
-					if ( nlsr->debugging )
-						printf("Content Data: %s \n",content_data);
-					process_incoming_sync_content_lsa(content_data);
-				}
-				else{
-					if ( nlsr->debugging )
-						printf("Verification failed. No content given back\n");
-				}
-			}
-			else 
-			{
-				if ( nlsr->debugging )
-					printf("Name LSA / Newer Name LSA already xists in LSDB\n");
-				int chk_con=get_content_by_content_name(ccn_charbuf_as_string(uri)
-											, &content_data,orig_router->name);
-
-				if ( chk_con == 0 ){
-					if ( nlsr->debugging )
-						printf("Content Data: %s \n",content_data);
-					process_incoming_sync_content_lsa(content_data);
-				}
-				else{
-					if ( nlsr->debugging )
-						printf("Verification failed. No content given back\n");
-				}
-			}
-		}
-		else 
-		{
-			if ( nlsr->debugging )
-				printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
-		}
-	}
-	else
-	{
-		ls_type=atoi(rem);
-		lst=rem;
-		if(ls_type == LS_TYPE_ADJ)
-		{
-			ccn_name_comp_get(content_name->buf, components,components->n-2, 
-														&origtime, &comp_size);
-			ccn_name_chop(content_name,components,-2);
-			get_name_part(orig_router,content_name,components,0);
-
-			if ( nlsr->debugging )
-				printf("Orig Router: %s Ls Type: %d Orig Time: %s\n",
-											orig_router->name,ls_type,origtime);
-
-			int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
-			if ( nlsr->debugging )
-				printf("LSA Life time: %d\n",lsa_life_time);
-
-			if ( strcmp(orig_router->name,nlsr->router_name) != 0 
-				&& (lsa_life_time < nlsr->router_dead_interval) )
-			{
-				int is_new_adj_lsa = check_is_new_adj_lsa( orig_router->name, 
-													(char *)lst, (char *)origtime);
-				if ( is_new_adj_lsa == 1 )
-				{
-					if ( nlsr->debugging )
-						printf("New Adj LSA.....\n");	
-					int chk_con=get_content_by_content_name(ccn_charbuf_as_string(uri), 
-												&content_data,orig_router->name);
-
-					if ( chk_con == 0 ){
-						if ( nlsr->debugging )
-							printf("Content Data: %s \n",content_data);
-						process_incoming_sync_content_lsa(content_data);
-					}
-					else{
-						if ( nlsr->debugging )
-							printf("Verification failed. No content given back\n");
-					}		
-				}
-				else
-				{
-					if ( nlsr->debugging )
-						printf("Adj LSA / Newer Adj LSA already exists in LSDB\n");
-					int chk_con=get_content_by_content_name(ccn_charbuf_as_string(uri), 
-												&content_data,orig_router->name);
-					if ( chk_con == 0 ){
-						if ( nlsr->debugging )
-							printf("Content Data: %s \n",content_data);
-						process_incoming_sync_content_lsa(content_data);
-					}
-					else{
-						if ( nlsr->debugging )
-							printf("Verification failed. No content given back\n");
-					}
-				}
-			}
-			else 
-			{
-				if ( nlsr->debugging )
-					printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
-			}
-		}
-		else if(ls_type == LS_TYPE_COR)
-		{
-			ccn_name_comp_get(content_name->buf, components, components->n-2, 
-														&origtime, &comp_size);
-			ccn_name_chop(content_name,components,-2);
-			get_name_part(orig_router,content_name,components,0);
-
-			if ( nlsr->debugging )
-				printf("Orig Router: %s Ls Type: %d Orig Time: %s\n", 
-											orig_router->name,ls_type,origtime);
-
-			int lsa_life_time=get_time_diff(time_stamp,(char *)origtime);
-			if ( nlsr->debugging )
-				printf("LSA Life time: %d\n",lsa_life_time);
-
-			if ( strcmp(orig_router->name,nlsr->router_name) != 0 
-				&& (lsa_life_time < nlsr->router_dead_interval) )	
-			{
-				int is_new_cor_lsa=check_is_new_cor_lsa( orig_router->name, 
-												(char *)lst,(char *) origtime);
-				if ( is_new_cor_lsa == 1 )
-				{
-					if ( nlsr->debugging )
-						printf("New Cor LSA.....\n");	
-					int chk_con=get_content_by_content_name(ccn_charbuf_as_string(uri), 
-																&content_data,
-															orig_router->name);
-
-					if ( chk_con == 0 ){
-						if ( nlsr->debugging )
-							printf("Content Data: %s \n",content_data);
-						process_incoming_sync_content_lsa(content_data);
-					}
-					else{
-						if ( nlsr->debugging )
-							printf("Verification failed. No content given back\n");
-					}		
-				}
-				else
-				{
-					if ( nlsr->debugging )
-						printf("Cor LSA / Newer Cor LSA already exists in LSDB\n");
-					int chk_con=get_content_by_content_name(ccn_charbuf_as_string(uri), 
-												&content_data,orig_router->name);
-					if ( chk_con == 0 ){
-						if ( nlsr->debugging )
-							printf("Content Data: %s \n",content_data);
-						process_incoming_sync_content_lsa(content_data);
-					}
-					else{
-						if ( nlsr->debugging )
-							printf("Verification failed. No content given back\n");
-					}
-				}
-			}
-			else 
-			{	
-				if ( nlsr->debugging )
-					printf("Lsa is older than Router LSA refresh time/ Dead Interval\n");
-			}
-
-		}
-	}
-
-	if(content_data)
-		free(content_data);
-
-	if (orig_router->name)
-		free(orig_router->name);
-	if (orig_router)
-		free(orig_router);
-	ccn_charbuf_destroy(&uri);
-	//01/31/2013	
-	free(time_stamp);
-}
-
-/**
-* This function performs same functionality as ccnsyncwatch
-*/
-
-
-int
-sync_monitor(char *topo_prefix, char *slice_prefix)
-{
-
-	struct ccn_charbuf *prefix = ccn_charbuf_create();
-	struct ccn_charbuf *topo = ccn_charbuf_create(); 
-	
-	nlsr->closure=(struct ccns_name_closure *) 
-						calloc(1,sizeof(struct ccns_name_closure)); // leak
-
-	nlsr->slice = ccns_slice_create();
-
-	ccn_charbuf_reset(prefix);
-	ccn_name_from_uri(prefix, slice_prefix);
-
-	ccn_charbuf_reset(topo);
-	ccn_name_from_uri(topo, topo_prefix);
-
-	ccns_slice_set_topo_prefix(nlsr->slice, topo, prefix);
-	nlsr->closure->callback = &sync_cb;
-	nlsr->ccns = ccns_open(nlsr->ccn, nlsr->slice, nlsr->closure, NULL, NULL);
-
-	ccn_charbuf_destroy(&prefix);
-	ccn_charbuf_destroy(&topo);
-	return 0;
-}
-
-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);
-}
-
-/**
-* Write signed data to repo
-*/
-
-
-int
-write_data_to_repo(char *data, char *name_prefix)
-{
-
-	nlsr_lock();
-	if ( nlsr->debugging )
-	{
-		printf("write_data_to_repo called\n");
-		printf("Content Name: %s \n",name_prefix);
-		printf("Content Data: %s \n",data);
-	}
-
-	struct ccn *temp_ccn;
-	temp_ccn=ccn_create();
-	int ccn_fd=ccn_connect(temp_ccn, NULL);
-	if(ccn_fd == -1)
-	{
-		fprintf(stderr,"Could not connect to ccnd for Data Writing\n");
-		writeLogg(__FILE__,__FUNCTION__,__LINE__, 
-						"Could not connect to ccnd for Data Writing\n");
-		return -1;
-	}
-
-	struct ccn_charbuf *name = NULL;
-	struct ccn_seqwriter *w = NULL;
-	int blocksize = 4096;
-	int freshness = -1;
-	int scope = 1;
-	int res;
-	size_t blockread;
-	struct ccn_charbuf *templ;
-
-	name = ccn_charbuf_create();
-	res = ccn_name_from_uri(name, name_prefix);
-	if (res < 0) {
-		fprintf(stderr, "bad CCN URI: %s\n",name_prefix);
-		return -1;
-	}
-
-	w = ccn_seqw_create(temp_ccn, name);
-	if (w == NULL) {
-		fprintf(stderr, "ccn_seqw_create failed\n");
-		return -1;
-	}
-	ccn_seqw_set_block_limits(w, blocksize, blocksize);
-	if (freshness > -1)
-		ccn_seqw_set_freshness(w, freshness);
-
-	struct ccn_charbuf *name_v = ccn_charbuf_create();
-	ccn_seqw_get_name(w, name_v);
-	ccn_name_from_uri(name_v, "%C1.R.sw");
-	ccn_name_append_nonce(name_v);
-	templ = make_template(scope);
-	res = ccn_get(temp_ccn, name_v, templ, 60000, NULL, NULL, NULL, 0);
-	ccn_charbuf_destroy(&templ);
-	ccn_charbuf_destroy(&name_v);
-	if (res < 0) {
-		fprintf(stderr, "No response from repository\n");
-		return -1;
-	}
-
-	struct ccn_charbuf *resultbuf=ccn_charbuf_create();
-
-	sign_content_with_user_defined_keystore(name,
-										resultbuf,
-										data,
-										strlen(data),
-										nlsr->keystore_path,
-										nlsr->keystore_passphrase,
-										nlsr->root_key_prefix,
-										nlsr->site_name,
-										nlsr->router_name,
-										60);	
-
-
-	blockread=resultbuf->length;
-
-	if (blockread > 0) {
-		res = ccn_seqw_write(w, resultbuf->buf, resultbuf->length);	
-		while (res == -1) {
-			ccn_run(temp_ccn,1);
-			res = ccn_seqw_write(w, resultbuf->buf, resultbuf->length);	
-		}
-	}
-
-	ccn_seqw_close(w);
-	ccn_run(temp_ccn, 1);
-	ccn_charbuf_destroy(&name);
-	ccn_destroy(&temp_ccn);
-	ccn_charbuf_destroy(&resultbuf);
-
-	nlsr_unlock();
-	return 0;
-}
-
-/**
-*	Create slice for sync/repo
-*/
-
-
-int
-create_sync_slice(char *topo_prefix, char *slice_prefix)
-{
-	int res;
-	struct ccn *handle; 
-	struct ccns_slice *slice;
-	struct ccn_charbuf *prefix = ccn_charbuf_create();
-	struct ccn_charbuf *topo = ccn_charbuf_create();
-	struct ccn_charbuf *clause = ccn_charbuf_create();
-	struct ccn_charbuf *slice_name = ccn_charbuf_create();
-	struct ccn_charbuf *slice_uri = ccn_charbuf_create();
-
-	if (prefix == NULL || topo == NULL || clause == NULL ||
-			slice_name == NULL || slice_uri == NULL) {
-		fprintf(stderr, "Unable to allocate required memory.\n");
-		return -1;
-	}
-
-	handle = ccn_create();
-	res = ccn_connect(handle, NULL);
-	if (0 > res) {
-		fprintf(stderr, "Unable to connect to ccnd.\n");
-		return -1;
-	}    
-
-	slice = ccns_slice_create();
-
-	ccn_charbuf_reset(topo);
-	ccn_name_from_uri(topo, topo_prefix);
-	ccn_charbuf_reset(prefix);
-	ccn_name_from_uri(prefix,slice_prefix );
-	ccns_slice_set_topo_prefix(slice, topo, prefix);
-
-
-	res = ccns_write_slice(handle, slice, slice_name);
-
-	//01/31/2013
-	ccns_slice_destroy(&slice);
-	ccn_destroy(&handle);
-	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.h b/nlsr_sync.h
deleted file mode 100644
index 860489c..0000000
--- a/nlsr_sync.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _NLSR_SYNC_H_
-#define _NLSR_SYNC_H_
-
-struct ccn_charbuf * make_template(int scope);
-int sync_monitor(char *topo_prefix, char *slice_prefix);
-int write_data_to_repo(char *data,char *name_prefix);
-int create_sync_slice(char *topo_prefix, char *slice_prefix);
-void process_content_from_sync(struct ccn_charbuf *content_name, struct ccn_indexbuf *components);
-
-#endif
diff --git a/nlsrc.1 b/nlsrc.1
deleted file mode 100644
index caf7e52..0000000
--- a/nlsrc.1
+++ /dev/null
@@ -1,26 +0,0 @@
-.TH NLSRC 1 "JANUARY 2013" Linux "nlsrc Manual"
-.SH NAME 
-nlsrc \- allows the addition or removal of names and/or neighbors while nlsr is running
-.SH SYNOPSIS
-.B nlsrc -s
-.I  server
-.B -p
-.I  port
-.B add|del name|neighbor prefix
-.SH DESCRIPTION
-.B nlsrc
- allows operators to add or remove names or neighbors while nlsr is running. Names and neighbors can be modified on the localhost or from a remote host. 
-.SH OPTIONS
-.IP -s server
-specifies the server you would like to make changes to
-.IP -p port
-specifies the port you are connecting to on the server, default port is 9696
-.IP add|del
-specifies whether you are performing an add or delete operation
-.IP name|neighbor
-specifies whether you are modifying a name or a neighbor
-.IP prefix
-specifies the prefix for the name or neighbor
-.SH AUTHOR
-A K M Mahmudul Hoque
- 
diff --git a/nlsrc.c b/nlsrc.c
deleted file mode 100755
index 91a1523..0000000
--- a/nlsrc.c
+++ /dev/null
@@ -1,109 +0,0 @@
-//1. Make the necessary includes and set up the variables:
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <sys/un.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-#include <getopt.h>
-
-struct option longopts[] =
-{
-    { "server_ip",    required_argument, NULL, 's'},
-    { "server_port",    required_argument, NULL, 'p'},
-    { 0 }
-};
-
-static int 
-usage(char *progname)
-{
-	printf("Usage: %s [OPTIONS...]\n\
-        NLSR API client....\n\
-        nlsrc -s server_ip -p server_port add|del name|neighbor name_prefix [faceX] \n\
-        option -- description\n\n\
-        add|del -- specify whether you want to add or delete.\n\
-        name|neighbor -- specify whether you are adding a name or a neighbor.\n\
-        name_prefix -- name of the prefix for the name|neighbor.\n\
-        faceX -- face ID for neighbor if the third argument is neighbor.\n\n\
-        Examples:\n\
-        1) nlsrc -s 127.0.0.1 -p 9696 add name /ndn/memphis.edu/test \n", progname);
-
-    	exit(1);
-}
-
-int main(int argc, char *argv[])
-{
-	int sockfd;
-	int len;
-	struct sockaddr_in address;
-	int result;
-	int bytesSent;
-	char *server_address, *server_port;	
-
-	int command_len=0;
-	int i;
-
-	if (argc < 8)
-                usage(argv[0]);
-
-        if (strcmp(argv[6], "neighbor") == 0 && argc < 9)
-                usage(argv[0]);
-
-        if (strcmp(argv[6], "name") != 0 && strcmp(argv[6], "neighbor") != 0)
-                usage(argv[0]);
-
-	while ((result = getopt_long(argc, argv, "s:p:", longopts, 0)) != -1) 
-	{
-        	switch (result) 
-		{
-			case 's':
-				server_address = optarg;
-				break;
-			case 'p':
-				server_port = optarg;
-				break;
-		}
-    	}	
-
-
-	char recv_buffer[1024];
-	bzero(recv_buffer,1024);
-
-	for(i=5;i<argc;i++)
-		command_len+=(strlen(argv[i])+1);
-	char *command=malloc(command_len);
-	memset(command, 0, command_len);
-	for(i=5;i<argc;i++)
-	{
-		memcpy(command+strlen(command),argv[i],strlen(argv[i]));
-		if ( i < argc-1 )
-			memcpy(command+strlen(command)," ",1);	
-	}
-
-	sockfd = socket(AF_INET, SOCK_STREAM, 0);
-	//address.sun_family = AF_UNIX;
-	//strcpy(address.sun_path, "/tmp/nlsr_api_server_socket");
-	address.sin_family = AF_INET;
-	address.sin_addr.s_addr = inet_addr(server_address);
-	address.sin_port = htons(atoi(server_port));
-
-	len = sizeof(address);
-	result = connect(sockfd, (struct sockaddr *)&address, len);
-	if(result == -1) 
-	{
-		perror("oops nlsrc ");
-		exit(1);
-	}
-	printf("Command to send: %s \n",command);
-	bytesSent=send(sockfd, command, strlen(command),0);
-	printf("Command len: %d, Bytes sent: %d \n",(int)strlen(command), bytesSent);
-	recv(sockfd, recv_buffer, 1024, 0);
-	printf("%s\n",recv_buffer);
-	free(command);
-	close(sockfd);
-	exit(0);
-}
diff --git a/utility.c b/utility.c
deleted file mode 100644
index 51afa86..0000000
--- a/utility.c
+++ /dev/null
@@ -1,349 +0,0 @@
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include<ctype.h>
-#include<stdarg.h>
-#include <sys/types.h>
-#include <pwd.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include<sys/socket.h>
-#include<arpa/inet.h>
-#include<errno.h>
-#include<netdb.h>
-#include <time.h>
-#include <assert.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-
-#include <ccn/ccn.h>
-#include <ccn/uri.h>
-#include <ccn/keystore.h>
-#include <ccn/signing.h>
-#include <ccn/schedule.h>
-#include <ccn/hashtb.h>
-
-
-#include "utility.h"
-
-
-char * getLocalTimeStamp(void)
-{
-	char *timestamp = (char *)malloc(sizeof(char) * 20);
-	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) * 20);
-	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;
-}
-
-
-int
-get_width_of_number(long int number)
-{
-	int i=0;
-	while(number>0)
-	{
-		i++;
-		number/=10;
-	}
-	return i;
-}
-
-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);
-}
-
-char *
-get_current_timestamp_micro_v2(void)
-{
-	struct timeval now; 
-	gettimeofday(&now, NULL);
-	//sprintf(microSec,"%ld%06ld",now.tv_sec,(long int)now.tv_usec);
-	char *microSec=(char *)calloc(get_width_of_number(now.tv_sec)+7,sizeof(char));
-	sprintf(microSec,"%ld%06ld",now.tv_sec,(long int)now.tv_usec);
-	microSec[strlen(microSec)]='\0';	
-
-	return microSec;
-}
-
-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;	
-	struct stat st;
-	int isLogDirExists=0;
-	char *time=getLocalTimeStamp();
-
-	pwdbuffer=(char *)calloc(200,sizeof(char));		
-	logDir=(char *)calloc(200,sizeof(char));
-	logFileName=(char *)calloc(200,sizeof(char));
-	logExt=(char *)calloc(5,sizeof(char));
-	defaultLogDir=(char *)calloc(10,sizeof(char));
-
-	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)
-				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);	
-}
-
-
-char *
-get_current_user_home(void){
-
-	const char *homeDir = getenv("HOME");
-
-    if (!homeDir ) {
-        struct passwd* pwd = getpwuid(getuid());
-        if (pwd)
-           homeDir = pwd->pw_dir;
-    }
-    
-	char *home=(char *)calloc(strlen(homeDir)+1,sizeof(char));
-	memcpy(home,homeDir,strlen(homeDir)+1);
-
-	return home;
-}
-
-
-char * 
-get_current_user_default_keystore(void){
-
-	char *home=get_current_user_home();
-	char *def_keystore=(char *)calloc(strlen(home)+strlen("/.ccnx") + 
-						strlen("/.ccnx_keystore")+1,sizeof(char));
-	memcpy(def_keystore,home,strlen(home));
-	memcpy(def_keystore+strlen(def_keystore),"/.ccnx/.ccnx_keystore",
-			strlen("/.ccnx/.ccnx_keystore"));
-	def_keystore[strlen(def_keystore)]='\0';
-	free(home);
-
-	return def_keystore;
-}
-
-void 
-writeLogg(const char *source_file, const char *function, const int line, const char *format, ...)
-{
-	char *file=getenv("NLSR_LOG_FILE");	
-	if (file != NULL)
-	{
-		FILE *fp = fopen(file, "a");
-
-		if (fp != NULL)
-		{            
-			struct timeval t;
-			gettimeofday(&t, NULL);
-			fprintf(fp,"%ld.%06u - %s, %s, %d :",(long)t.tv_sec , (unsigned)t.tv_usec , source_file , function , line);        
-			va_list args;
-			va_start(args, format);
-			vfprintf(fp, format, args);
-			fclose(fp);
-			va_end(args);	
-		}
-    	}
-}
-
-
-struct sockaddr_in *
-get_ip_from_hostname(char *hostname )
-{
- 
-
-    struct addrinfo hints, *servinfo, *p;
-    int res; 
-    struct sockaddr_in * ip;
-    memset(&hints, 0, sizeof hints);
-    hints.ai_family = AF_UNSPEC;
-    hints.ai_socktype = SOCK_STREAM;
-
-    if ( (res = getaddrinfo( hostname , "9696", &hints , &servinfo)) != 0)
-    {
-        fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(res));
-        return NULL;
-    }
-    int i=0;
-    for(p = servinfo; p != NULL; p = p->ai_next)
-    {
-        ip = (struct sockaddr_in *) p->ai_addr;
-	i++;
-   
-    }
-    freeaddrinfo(servinfo);
-    return ip;
-
-
-}
-
-
-
-int 
-get_ip_from_hostname_02(char * hostname , char* ip)
-{
-    struct hostent *he;
-    struct in_addr **addr_list;
-    int i;
-    if ( (he = gethostbyname( hostname ) ) == NULL)
-    {
-        herror("gethostbyname");
-        return 1;
-    }
-    addr_list = (struct in_addr **) he->h_addr_list;
-    for(i = 0; addr_list[i] != NULL; i++)
-    {
-        strcpy(ip , inet_ntoa(*addr_list[i]) );
-		ip[strlen(ip)]='\0';
-        return 0;
-    }
-    return -1;
-}
-
-
-int 
-add_ccn_uri_name(struct ccn_charbuf *res_name, struct ccn_charbuf *add){
-
-	int i, res;
-	struct ccn_indexbuf *idx=ccn_indexbuf_create();
-	res=ccn_name_split(add,idx);	
-	if ( res < 0 ){
-		ccn_indexbuf_destroy(&idx);
-		return -1;
-	}
-
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-	for(i=0;i<idx->n-1;i++){
-		ccn_name_comp_get(add->buf,idx,i,&comp_ptr1, &comp_size);
-		ccn_name_append_str(res_name,(char *)comp_ptr1);
-	}
-	ccn_indexbuf_destroy(&idx);
-
-	return 0;
-
-}
-
-
diff --git a/utility.h b/utility.h
deleted file mode 100644
index dc935da..0000000
--- a/utility.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _UTILITY_H_
-#define _UTILITY_H_
-
-char * getLocalTimeStamp(void);
-char * getGmTimeStamp(void);
-long int get_current_time_sec(void);
-void get_current_timestamp_micro(char * microSec);
-long int get_time_diff(const char *time1, const char *time2);
-
-void startLogging(char *loggingDir);
-void writeLogg(const char *source_file, const char *function, const int line, const char *format, ...);
-struct sockaddr_in * get_ip_from_hostname(char *hostname);
-int get_ip_from_hostname_02(char * hostname , char* ip);
-char * get_current_timestamp_micro_v2(void);
-char * get_current_user_home(void);
-char * get_current_user_default_keystore(void);
-
-int add_ccn_uri_name(struct ccn_charbuf *res_name, struct ccn_charbuf *add);
-
-#endif