3rd Update
diff --git a/nlsr.c b/nlsr.c
new file mode 100644
index 0000000..76bbb8a
--- /dev/null
+++ b/nlsr.c
@@ -0,0 +1,273 @@
+#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 "utility.h"
+
+
+struct option longopts[] =
+{
+    { "daemon",      no_argument,       NULL, 'd'},
+    { "config_file", required_argument, NULL, 'f'},
+    { "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\
+	-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 
+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;
+	}
+	nlsr->router_name=(char *)malloc(strlen(rtr_name)+1);
+	memcpy(nlsr->router_name,rtr_name,strlen(rtr_name)+1);	
+	printf("Router Name: %s\n",nlsr->router_name);
+}
+
+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_prefix;
+	name_prefix=strtok_r(command,sep,&rem);
+	if(name_prefix==NULL)
+	{
+		printf(" Wrong Command Format ( ccnname /name/prefix/ )\n");
+		return;
+	}
+
+	printf("Name Prefix: %s \n",name_prefix);
+}
+
+void 
+process_command_ccnneighbor(char *command)
+{
+	if(command==NULL)
+	{
+		printf(" Wrong Command Format ( ccnneighbor router_id faceX)\n");
+		return;
+	}
+	char *rem;
+	const char *sep=" \t\n";
+	char *rtr_id,*face;
+
+	rtr_id=strtok_r(command,sep,&rem);
+	if(rtr_id==NULL)
+	{
+		printf(" Wrong Command Format ( ccnneighbor router_id faceX)\n");
+		return;
+	}
+
+	face=strtok_r(NULL,sep,&rem);
+	if(face==NULL)
+	{
+		printf(" Wrong Command Format ( ccnneighbor router_id faceX)\n");
+		return;
+	}
+
+	printf("Router: %s face: %s\n",rtr_id,face);
+
+}
+
+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
+	{
+		printf("Wrong configuration Command %s \n",cmd_type);
+	}
+}
+
+int 
+readConfigFile(const char *filename)
+{
+	FILE *cfg;
+	char buf[1024];
+	int len;
+
+	cfg=fopen(filename, "r");
+
+	if(cfg == NULL)
+	{
+		printf("\nConfiguration File does not exists\n");
+		exit(1);	
+	}
+
+	while(fgets((char *)buf, sizeof(buf), cfg))
+	{
+		len=strlen(buf);
+		if(buf[len-1] == '\n')
+		buf[len-1]='\0';
+		process_conf_command(buf);	
+	}
+
+	fclose(cfg);
+
+	return 0;
+}
+
+int 
+main(int argc, char *argv[])
+{
+    	int res;
+    	char *config_file;
+	int daemon_mode;
+	struct hashtb_param param_adl = {0};
+	struct hashtb_param param_npl = {0};
+	
+	nlsr=(struct nlsr *)malloc(sizeof(struct nlsr));
+
+	nlsr->adl=hashtb_create(200, &param_adl);
+	nlsr->npl = hashtb_create(200, &param_npl);
+	nlsr->in_interest.p = &incoming_interest;
+	nlsr->in_content.p = &incoming_content;
+	nlsr->is_synch_init=1;
+
+	struct ccn_charbuf *router_prefix;	
+    	
+	while ((res = getopt_long(argc, argv, "df:h", longopts, 0)) != -1) 
+	{
+        	switch (res) 
+		{
+			case 'd':
+				daemon_mode = 1;
+				break;
+			case 'f':
+				config_file = optarg;
+				break;
+			case 'h':
+			default:
+				usage(argv[0]);
+		}
+    	}
+
+	readConfigFile(config_file);
+
+	nlsr->ccn=ccn_create();
+	if(ccn_connect(nlsr->ccn, NULL) == -1)
+		{
+			fprintf(stderr,"Could not connect to ccnd\n");
+			exit(1);
+		}	
+	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);
+			exit(1);
+		}
+
+	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");
+			exit(1);
+		}
+
+	nlsr->sched = ccn_schedule_create(nlsr, &ndn_rtr_ticker);
+
+	while(1)
+	{
+		ccn_schedule_run(nlsr->sched);
+        	res = ccn_run(nlsr->ccn, 500);
+
+	}
+
+	
+	
+	hashtb_destroy(&nlsr->adl);
+	hashtb_destroy(&nlsr->npl);
+	ccn_schedule_destroy(&nlsr->sched);
+	ccn_destroy(&nlsr->ccn);
+	free(nlsr);
+
+	return 0;
+}
+
diff --git a/nlsr.h b/nlsr.h
new file mode 100644
index 0000000..2b15b8b
--- /dev/null
+++ b/nlsr.h
@@ -0,0 +1,35 @@
+#ifndef _NLSR_H_
+#define _NLSR_H_
+
+#define LSA_ADJ_TYPE 1
+#define LSA_NAME_TYPE 2
+
+struct nlsr
+{
+
+	struct ccn_closure in_interest;
+	struct ccn_closure in_content;
+	struct ccn_schedule *sched;
+    	struct ccn_scheduled_event *event;
+
+	struct hashtb *adl;
+	struct hashtb *npl;
+
+	struct ccn *ccn;
+	char *router_name;
+
+	int is_synch_init;
+};
+
+struct nlsr *nlsr;
+
+
+void ndn_rtr_gettime(const struct ccn_gettime *self, struct ccn_timeval *result);
+void process_command_router_name(char *command);
+void process_command_ccnname(char *command);
+void process_command_ccnneighbor(char *command);
+void process_conf_command(char *command);
+int readConfigFile(const char *filename);
+
+
+#endif
diff --git a/nlsr_ndn.c b/nlsr_ndn.c
new file mode 100644
index 0000000..4b01e2a
--- /dev/null
+++ b/nlsr_ndn.c
@@ -0,0 +1,111 @@
+#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 "utility.h"
+
+enum ccn_upcall_res 
+incoming_interest(struct ccn_closure *selfp,
+        enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
+{
+    
+    switch (kind) {
+        case CCN_UPCALL_FINAL:
+            break;
+        case CCN_UPCALL_INTEREST:
+		// printing the name prefix for which it received interest
+            	printf("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]-info->pi->offset[CCN_PI_B_Name],0);
+		//ccn_name_chop(c,NULL,-1);
+		printf("%s\n",ccn_charbuf_as_string(c));
+		ccn_charbuf_destroy(&c);
+
+		//process_incoming_interest(selfp, info);
+		
+		/* 
+	    	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", 1010);
+                sp.sp_flags |= CCN_SP_TEMPL_FRESHNESS;
+        	ccn_charbuf_append_closer(sp.template_ccnb);		   
+
+		res= ccn_sign_content(ospfndn->ccn, data, name, &sp, "hello", strlen("hello")); 
+	    	res=ccn_put(ospfndn->ccn,data->buf,data->length);
+            	ccn_charbuf_destroy(&data);  
+
+		*/
+		break;
+
+        default:
+            break;
+    }
+
+    return CCN_UPCALL_RESULT_OK;
+}
+
+
+enum ccn_upcall_res incoming_content(struct ccn_closure* selfp,
+        enum ccn_upcall_kind kind, struct ccn_upcall_info* info)
+{
+
+
+    switch(kind) {
+        case CCN_UPCALL_FINAL:
+            break;
+        case CCN_UPCALL_CONTENT:
+            	printf("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);
+		printf("%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 \n"); 
+
+		const unsigned char *comp_ptr;
+		size_t comp_size;
+		int res;
+		
+		res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,2,&comp_ptr, &comp_size);
+
+		printf("Parsed Interest: %s size: %d Size of name prefix: %d\n",comp_ptr,(int)comp_size,(int)info->interest_comps->n);
+	   */
+	    
+		//process_timed_out_interest(selfp,info);
+	    break;
+        default:
+            fprintf(stderr, "Unexpected response of kind %d\n", kind);
+            return CCN_UPCALL_RESULT_ERR;
+    }
+
+    return CCN_UPCALL_RESULT_OK;
+}
diff --git a/nlsr_ndn.h b/nlsr_ndn.h
new file mode 100644
index 0000000..4400bbb
--- /dev/null
+++ b/nlsr_ndn.h
@@ -0,0 +1,10 @@
+#ifndef _NLSR_NDN_H_
+#define _NLSR_NDN_H_
+
+enum ccn_upcall_res incoming_interest(struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info);
+
+
+enum ccn_upcall_res incoming_content(struct ccn_closure* selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info* info);
+
+#endif
+
diff --git a/utility.c b/utility.c
new file mode 100644
index 0000000..5ad3529
--- /dev/null
+++ b/utility.c
@@ -0,0 +1,50 @@
+#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 "utility.h"
+
+
+char * getLocalTimeStamp(void)
+{
+	char *timestamp = (char *)malloc(sizeof(char) * 16);
+	time_t ltime;
+	ltime=time(NULL);
+	struct tm *tm;
+	tm=localtime(&ltime);
+  
+	sprintf(timestamp, "%04d%02d%02d%02d%02d%02d", tm->tm_year+1900, tm->tm_mon+1, 
+		tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
+
+	return timestamp;
+}
+
+char * 
+nth_named_component(const char *name_prefix, int n)
+{
+
+	int i;
+	char * seps="/";
+	char *rem=NULL;
+	char *component;
+
+	char *prefix=(char *)malloc(strlen(name_prefix)+1);
+	memcpy(prefix,name_prefix,strlen(name_prefix)+1);
+
+	component=strtok_r(prefix,seps,&rem);
+
+	for(i=1;i<n;i++)
+		component=strtok_r(NULL,seps,&rem);
+
+	return component;
+
+
+
+}
diff --git a/utility.h b/utility.h
new file mode 100644
index 0000000..ae3b999
--- /dev/null
+++ b/utility.h
@@ -0,0 +1,7 @@
+#ifndef _UTILITY_H_
+#define _UTILITY_H_
+
+char * getLocalTimeStamp(void);
+char * nth_named_component(const char *name_prefix, int n);
+
+#endif