diff --git a/nlsr_ndn.c b/nlsr_ndn.c
index af79e3a..d67cd1d 100644
--- a/nlsr_ndn.c
+++ b/nlsr_ndn.c
@@ -20,9 +20,10 @@
 
 #include "nlsr.h"
 #include "nlsr_ndn.h"
-#include "utility.h"
 #include "nlsr_adl.h"
 #include "nlsr_lsdb.h"
+#include "utility.h"
+
 
 int
 appendLifetime(struct ccn_charbuf *cb, int lifetime) 
@@ -41,399 +42,152 @@
 	return res;
 }
 
+
+void 
+get_nbr(struct name_prefix *nbr,struct ccn_closure *selfp, struct ccn_upcall_info *info)
+{
+
+	printf("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));
+
+	}
+	
+	//neighbor[strlen(neighbor)]='\0';
+
+	nbr->name=(char *)malloc(strlen(neighbor)+1);
+	memcpy(nbr->name,neighbor,strlen(neighbor)+1);
+	nbr->length=strlen(neighbor)+1;
+
+	printf("Neighbor: %s Length: %d\n",nbr->name,nbr->length);
+	
+
+}
+
+void 
+get_lsa_identifier(struct name_prefix *lsaId,struct ccn_closure *selfp, struct ccn_upcall_info *info)
+{
+
+	printf("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=nlsr_position+2;i<info->interest_comps->n-2;i++)
+	{
+		res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,i,&comp_ptr1, &comp_size);
+		len+=1;
+		len+=(int)comp_size;	
+	}
+	len++;
+
+	char *neighbor=(char *)malloc(len);
+	memset(neighbor,0,len);
+
+	for(i=nlsr_position+2; i<info->interest_comps->n-2;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));
+
+	}
+	
+	//neighbor[strlen(neighbor)]='\0';
+
+	lsaId->name=(char *)malloc(strlen(neighbor)+1);
+	memset(lsaId->name,0,strlen(neighbor)+1);
+	memcpy(lsaId->name,neighbor,strlen(neighbor)+1);
+	lsaId->length=strlen(neighbor)+1;
+
+	printf("LSA Identifier: %s Length: %d\n",lsaId->name,lsaId->length-1);
+	
+
+}
+
 enum ccn_upcall_res 
 incoming_interest(struct ccn_closure *selfp,
         enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
 {
-	my_lock();
-    
+    	my_lock();
     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_uri_append(c,info->interest_ccnb,info->pi->offset[CCN_PI_E_Name],0);
-		//ccn_name_chop(c,NULL,-1);
-		printf("%s\n",ccn_charbuf_as_string(c));
-		ccn_charbuf_destroy(&c);
-
+            	printf("Interest Received \n"); 
 		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;
     }
-
 	my_unlock();
     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)
-{
-
-	my_lock();
-
-    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"); 
-		struct ccn_charbuf*ic;
-		ic=ccn_charbuf_create();
-		ccn_uri_append(ic,info->interest_ccnb,info->pi->offset[CCN_PI_E_Name],0);
-		printf("%s\n",ccn_charbuf_as_string(ic));
-		ccn_charbuf_destroy(&ic);	    
-		process_incoming_timed_out_interest(selfp,info);
-
-	    break;
-        default:
-            fprintf(stderr, "Unexpected response of kind %d\n", kind);
-            return CCN_UPCALL_RESULT_ERR;
-    }
-
-	my_unlock();
-    return CCN_UPCALL_RESULT_OK;
-}
-
-
-void 
-process_incoming_content(struct ccn_closure* selfp, struct ccn_upcall_info* info)
-{
-	printf("process_incoming_content called \n");
-
-	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_uri_append(c,info->interest_ccnb,info->pi->offset[CCN_PI_E_Name],0);
-	printf("%s\n",ccn_charbuf_as_string(c));
-	ccn_charbuf_destroy(&c);
-
-	const unsigned char *comp_ptr1;
-	size_t comp_size;
-	int res,i;
-	int nlsr_position=0;
-	int name_comps=(int)info->interest_comps->n;
-	
-	for(i=0;i<name_comps;i++)
-	{
-		res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
-		if( res == 0)
-		{
-			nlsr_position=i;
-			break;
-		}	
-	}
-
-	res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,nlsr_position+1,&comp_ptr1, &comp_size);
-
-
-	printf("Det= %s \n",comp_ptr1);
-
-	if(!strcmp((char *)comp_ptr1,"lsdb"))
-	{
-		process_incoming_content_lsdb(selfp,info);
-	}
-	if(!strcmp((char *)comp_ptr1,"info"))
-	{
-		process_incoming_content_info(selfp,info);
-	}
-
-}
-
-
-void 
-process_incoming_content_lsdb(struct ccn_closure* selfp, struct ccn_upcall_info* info)
-{
-	printf("process_incoming_content_lsdb called \n");
-
-	const unsigned char *content_data;
-	size_t length;
-	ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E_Content]-info->pco->offset[CCN_PCO_B_Content], info->pco, &content_data, &length);
-
-
-	if ( !strcmp((char *)content_data,"NACK"))
-	{
-		printf("NACK received for LSDB request. Do nothing \n");
-	}
-	else
-	{
-		// Do the LSDB processing here 
-
-		const unsigned char *comp_ptr1;
-		size_t comp_size;
-		int res;
-
-		res=ccn_name_comp_get(info->content_ccnb, info->content_comps,info->interest_comps->n-1,&comp_ptr1, &comp_size);
-		if ( res >=0)
-		printf("Received Database Version: %s \n",(char *)comp_ptr1);
-
-	}
-
-	
-
-}
-
-
-
-void 
-process_incoming_content_info(struct ccn_closure* selfp, struct ccn_upcall_info* info)
-{
-	printf("process_incoming_content_info called \n");
-
-	const unsigned char *content_data;
-	size_t length;
-	ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E_Content]-info->pco->offset[CCN_PCO_B_Content], info->pco, &content_data, &length);
-
-	printf("Info Value: %s \n",(char *)content_data);
-
-
-	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;
-		}	
-	}
-	
-	struct ccn_charbuf *nbr;
-	nbr=ccn_charbuf_create();
-
-	
-	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);
-		//printf("%s \n",comp_ptr1);
-		ccn_charbuf_append_string(nbr,"/");
-		ccn_charbuf_append_string(nbr,(const char *)comp_ptr1);	
-	}
-
-	ccn_charbuf_append_string(nbr,"\0");	
-	printf("Info Content received for Neighbor: %s\n",ccn_charbuf_as_string(nbr));
-	
-	update_adjacent_timed_out_zero_to_adl(nbr);
-	update_adjacent_status_to_adl(nbr,NBR_ACTIVE);
-
-	print_adjacent_from_adl();
-
-	nlsr->event_build_adj_lsa = ccn_schedule_event(nlsr->sched, 1, &install_adj_lsa, NULL, 0);
-
-	ccn_charbuf_destroy(&nbr);	
-	
-
-}
-
-void 
-process_incoming_timed_out_interest(struct ccn_closure* selfp, struct ccn_upcall_info* info)
-{
-	printf("process_incoming_timed_out_interest called \n");
-
-	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_uri_append(c,info->interest_ccnb,info->pi->offset[CCN_PI_E_Name],0);
-	printf("%s\n",ccn_charbuf_as_string(c));
-	ccn_charbuf_destroy(&c);
-
-	//const unsigned char *comp_ptr1;
-	//size_t comp_size;
-	int res,i;
-	int nlsr_position=0;
-	int name_comps=(int)info->interest_comps->n;
-	
-	for(i=0;i<name_comps;i++)
-	{
-		res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
-		if( res == 0)
-		{
-			nlsr_position=i;
-			break;
-		}	
-	}
-
-	//res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,nlsr_position+1,&comp_ptr1, &comp_size);
-
-
-	//printf("Det= %s \n",comp_ptr1);
-
-	//if(!strcmp((char *)comp_ptr1,"lsdb"))
-	if(ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,nlsr_position+1,"lsdb") == 0)
-	{
-		process_incoming_timed_out_interest_lsdb(selfp,info);
-	}
-	else if(ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,nlsr_position+1,"info") == 0)
-	{
-		process_incoming_timed_out_interest_info(selfp,info);
-	}
-}
-
-
-void 
-process_incoming_timed_out_interest_lsdb(struct ccn_closure* selfp, struct ccn_upcall_info* info)
-{
-	printf("process_incoming_timed_out_interest_lsdb called \n");
-
-		
-	int res,i;
-	int nlsr_position=0;
-	int name_comps=(int)info->interest_comps->n;
-
-	//const unsigned char *comp_ptr1;
-	//size_t comp_size;
-	
-	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;
-		}	
-	}	
-
-
-	struct ccn_charbuf *nbr;
-	nbr=ccn_charbuf_create();
-
-	
-	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);
-		//printf("%s \n",comp_ptr1);
-		ccn_charbuf_append_string(nbr,"/");
-		ccn_charbuf_append_string(nbr,(const char *)comp_ptr1);	
-	}
-
-	ccn_charbuf_append_string(nbr,"\0");	
-	printf("Interest Timed out for Neighbor: %s\n",ccn_charbuf_as_string(nbr));
-
-	//update_adjacent_status_to_adl(nbr,1);
-
-	ccn_charbuf_destroy(&nbr);	
-}
-
-void 
-process_incoming_timed_out_interest_info(struct ccn_closure* selfp, struct ccn_upcall_info* info)
-{
-
-	printf("process_incoming_timed_out_interest_info 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;
-		}	
-	}
-	
-	struct ccn_charbuf *nbr;
-	nbr=ccn_charbuf_create();
-
-	
-	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);
-		//printf("%s \n",comp_ptr1);
-		ccn_charbuf_append_string(nbr,"/");
-		ccn_charbuf_append_string(nbr,(const char *)comp_ptr1);	
-	}
-
-	ccn_charbuf_append_string(nbr,"\0");	
-	printf("Info Interest Timed out for Neighbor: %s\n",ccn_charbuf_as_string(nbr));
-
-	update_adjacent_timed_out_to_adl(nbr,1);
-
-	print_adjacent_from_adl();	
-
-	int timed_out=get_timed_out_number(nbr);
-	if(timed_out<nlsr->interest_retry && timed_out>0) // use configured variables 
-	{
-		printf("Neighbor: %s Info Interest Timed Out: %d times\n",ccn_charbuf_as_string(nbr),timed_out);
-		send_info_interest_to_neighbor(nbr);
-	}
-	else
-	{
-		printf("Neighbor: %s Info Interest Timed Out: %d times\n",ccn_charbuf_as_string(nbr),timed_out);
-		nlsr->event_build_adj_lsa = ccn_schedule_event(nlsr->sched, 1, &install_adj_lsa, NULL, 0);
-	}
-
-	ccn_charbuf_destroy(&nbr);
-}
-
-
 void 
 process_incoming_interest(struct ccn_closure *selfp, struct ccn_upcall_info *info)
 {
 	printf("process_incoming_interest called \n");
 
-
+	/*
 	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_uri_append(c,info->interest_ccnb,info->pi->offset[CCN_PI_E_Name],0);
+	ccn_uri_append(c,info->interest_ccnb,info->pi->offset[CCN_PI_E_Name]-info->pi->offset[CCN_PI_B_Name],0);	
 	printf("%s\n",ccn_charbuf_as_string(c));
 	ccn_charbuf_destroy(&c);
-
+	*/
 	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");
@@ -445,17 +199,82 @@
 	}
 
 	res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,nlsr_position+1,&comp_ptr1, &comp_size);
-	
+
 	printf("Det= %s \n",comp_ptr1);
 
-	if(!strcmp((char *)comp_ptr1,"lsdb"))
-	{
-		process_incoming_interest_lsdb(selfp,info);
-	}
 	if(!strcmp((char *)comp_ptr1,"info"))
 	{
 		process_incoming_interest_info(selfp,info);
 	}
+	if(!strcmp((char *)comp_ptr1,"lsdb"))
+	{
+		process_incoming_interest_lsdb(selfp,info);
+	}
+	if(!strcmp((char *)comp_ptr1,"lsa"))
+	{
+		process_incoming_interest_lsa(selfp,info);
+	}
+	
+}
+
+void 
+process_incoming_interest_info(struct ccn_closure *selfp, struct ccn_upcall_info *info)
+{
+	printf("process_incoming_interest_info called \n");
+	
+
+	printf("Sending info Content Back ...\n");
+	int res;
+	struct ccn_charbuf *data=ccn_charbuf_create();
+    	struct ccn_charbuf *name=ccn_charbuf_create();
+    	struct ccn_signing_params sp=CCN_SIGNING_PARAMS_INIT;
+	
+	res=ccn_charbuf_append(name, info->interest_ccnb + info->pi->offset[CCN_PI_B_Name],info->pi->offset[CCN_PI_E_Name] - info->pi->offset[CCN_PI_B_Name]);
+	if (res >= 0)
+	{
+		sp.template_ccnb=ccn_charbuf_create();
+		ccn_charbuf_append_tt(sp.template_ccnb,CCN_DTAG_SignedInfo, CCN_DTAG);
+		ccnb_tagged_putf(sp.template_ccnb, CCN_DTAG_FreshnessSeconds, "%ld", 10);
+       	 	sp.sp_flags |= CCN_SP_TEMPL_FRESHNESS;
+		ccn_charbuf_append_closer(sp.template_ccnb);
+
+
+		char *raw_data=(char *)malloc(16);
+		memset(raw_data,0,16);
+		sprintf(raw_data,"%ld", nlsr->lsdb_synch_interval);	
+
+		res= ccn_sign_content(nlsr->ccn, data, name, &sp, raw_data,strlen(raw_data)); 
+		if(res >= 0)
+			printf("Signing Content is successful \n");
+
+    		res=ccn_put(nlsr->ccn,data->buf,data->length);		
+		if(res >= 0)
+		printf("Sending Info Content is successful \n");
+
+		printf("Info Content sending done....\n");
+
+
+		struct name_prefix *nbr=(struct name_prefix * )malloc(sizeof(struct name_prefix *));
+		get_lsa_identifier(nbr,selfp,info);
+		printf("Neighbor : %s Length : %d Status : %d\n",nbr->name,nbr->length,get_adjacent_status(nbr));
+	
+
+		if( get_adjacent_status(nbr) == 0 && get_timed_out_number(nbr)>=nlsr->interest_retry )
+		{
+			send_info_interest_to_neighbor(nbr);
+		}
+
+		free(nbr);
+		free(raw_data);
+		ccn_charbuf_destroy(&sp.template_ccnb);
+	}
+	
+	ccn_charbuf_destroy(&data);
+	ccn_charbuf_destroy(&name);	
+
+	
+
+		
 }
 
 
@@ -463,14 +282,14 @@
 process_incoming_interest_lsdb(struct ccn_closure *selfp, struct ccn_upcall_info *info)
 {
 	printf("process_incoming_interest_lsdb called \n");
-	
-	int l, res;
+
+	int l,res;
 	const unsigned char *exclbase;
 	size_t size;
 	struct ccn_buf_decoder decoder;
 	struct ccn_buf_decoder *d;
-	const unsigned char *comp;	
-
+	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) 
@@ -489,345 +308,930 @@
 				ccn_buf_advance(d);
 				ccn_buf_match_blob(d, &comp, &size);
 				ccn_buf_check_close(d);			
-				
-				
+
+
 			}
 			ccn_buf_check_close(d);
 		}
-		//if (d->decoder.state < 0)
-			//printf("Parse Failed\n");
 		if (comp != NULL)
-			printf("Number in Exclusion Filter is %s\n",comp);
-			
+		{
+			printf("LSDB Version in Exclusion Filter is %s\n",comp);
+			dbcmp=strcmp(nlsr->lsdb->version,(char *)comp);
+		}
 		/* Now comp points to the start of your potential number, and size is its length */
 	}
-
-	int excl_db_version=atoi((char *)comp);
-	int dbcmp=nlsr->lsdb->version-excl_db_version;
-	//int dbcmp=strncmp(nlsr->lsdb->version,(char *)comp,16);
-
-	
-
-	printf (" dbcmp = %d \n",dbcmp);	
-
-	if(dbcmp > 0)
+	else
 	{
-		printf("Has Updated database (Older: %s New: %ld)\n",comp,nlsr->lsdb->version);
-	}
-	else 
-	{
-		printf("Data base is not updated than the older one (Older: %s New: %ld)\n",comp,nlsr->lsdb->version);
-		printf("Sending NACK Content back.....\n");
-
-		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, "NACK", strlen("NACK")); 
-		if(res >= 0)
-			printf("Signing Content is successful \n");
-
-	    	res=ccn_put(nlsr->ccn,data->buf,data->length);
-		
-		if(res >= 0)
-			printf("Sending NACK Content is successful \n");
-
-            	ccn_charbuf_destroy(&data);
-		ccn_charbuf_destroy(&name);
-		ccn_charbuf_destroy(&sp.template_ccnb);		
+		printf("LSDB Version in Exclusion Filter is: None Added\n");
+		dbcmp=1;		
 
 	}
 
-}
-
-
-void 
-process_incoming_interest_info(struct ccn_closure *selfp, struct ccn_upcall_info *info)
-{
-	printf("process_incoming_interest_info called \n");
-	int res;
-
-	printf("Sending Info Content back.....\n");
-
 	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]);	
+	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);	
+        sp.sp_flags |= CCN_SP_TEMPL_FRESHNESS;
+        ccn_charbuf_append_closer(sp.template_ccnb);
 
-	res= ccn_sign_content(nlsr->ccn, data, name, &sp,"info",strlen("info") ); 
-	if(res >= 0)
-		printf("Signing Content is successful \n");
 
-    	res=ccn_put(nlsr->ccn,data->buf,data->length);		
-	if(res >= 0)
-		printf("Sending Info Content is successful \n");
+	if(dbcmp>0)
+	{
+		printf("Has Updated Database than Neighbor\n");
+		printf("Sending LSDB Summary of Updated LSDB Content...\n");	
+		/*
+		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]); 
+
+		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);
+		*/	
+
+		//ccn_charbuf_append_string(name,nlsr->lsdb->version);
+
+
+		
+		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);
+
+		char *name_lsdb_summary=get_name_lsdb_summary();
+		char *adj_lsdb_summary=get_adj_lsdb_summary();
+
+		char *raw_data=(char *)malloc(strlen(num_element) + strlen(name_lsdb_summary)+strlen(adj_lsdb_summary)+1);
+		memset(raw_data,0,strlen(num_element) + strlen(name_lsdb_summary)+strlen(adj_lsdb_summary)+1);
+
+		memcpy(raw_data+strlen(raw_data),num_element,strlen(num_element)+1);
+
+		if( strlen(name_lsdb_summary) >0 )
+		{
+			memcpy(raw_data+strlen(raw_data),name_lsdb_summary,strlen(name_lsdb_summary)+1);
+		}
+		if( strlen(adj_lsdb_summary) >0 )
+		{
+			memcpy(raw_data+strlen(raw_data),adj_lsdb_summary,strlen(adj_lsdb_summary)+1);
+		}
+
+		printf("Content Data to be sent: %s \n",raw_data);		
+
+		if(nlsr->adj_build_count == 0 && nlsr->is_build_adj_lsa_sheduled == 1)
+		{
+			 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)
+			printf("Signing LSDB Summary of Updated LSDB Content is successful \n");
+
+	    	res=ccn_put(nlsr->ccn,data->buf,data->length);
+
+		if(res >= 0)
+			printf("Sending LSDB Summary of Updated LSDB Content is successful \n");
+
+		//ccn_charbuf_destroy(&nlsd);
+		//ccn_charbuf_destroy(&alsd);
+		free(num_element);
+	}
+	else
+	{
+		printf("Does not have Updated Database than Neighbor\n");
+		
+		printf("Sending NACK Content.....\n");	
+		//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]); 
+
+		/*
+		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, "NACK", strlen("NACK")); 
+		if(res >= 0)
+			printf("Signing NACK Content is successful \n");
+
+	    	res=ccn_put(nlsr->ccn,data->buf,data->length);
+
+		if(res >= 0)
+			printf("Sending NACK Content is successful \n");
+
+		
+	}
 
 	ccn_charbuf_destroy(&data);
 	ccn_charbuf_destroy(&name);
-	//ccn_charbuf_destroy(&c);
 	ccn_charbuf_destroy(&sp.template_ccnb);
 
 }
 
-int
-send_lsdb_interest(struct ccn_schedule *sched, void *clienth,
-        struct ccn_scheduled_event *ev, int flags)
+void 
+process_incoming_interest_lsa(struct ccn_closure *selfp, struct ccn_upcall_info *info)
 {
-	my_lock();
-	struct ccn_charbuf *name;
-	long int rnum;
-	char rnumstr[20];
-	char lsdb_str[5];
-	char nlsr_str[5];
+	printf("process_incoming_interest_lsa called \n");
 
-	int res,i;
-	int adl_element;
+	/*
+	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);	
+	printf("%s\n",ccn_charbuf_as_string(c));
+	ccn_charbuf_destroy(&c);
+	*/
+	int res;
 
-	rnum=random();
-	memset(&rnumstr,0,20);
-	sprintf(rnumstr,"%ld",rnum);
-	memset(&nlsr_str,0,5);
-	sprintf(nlsr_str,"nlsr");
-	memset(&lsdb_str,0,5);
-	sprintf(lsdb_str,"lsdb");
-	
+	struct name_prefix *lsaId=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
+	get_lsa_identifier(lsaId,selfp,info);
 
-	struct ndn_neighbor *nbr;
+	printf("LSA Identifier: %s Length: %d\n",lsaId->name,lsaId->length-1);
+	printf("Router Name   : %s Length: %d\n",nlsr->router_name->name,nlsr->router_name->length);		
 
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-	//int mynumber=15;
+	char lsa_type=lsaId->name[nlsr->router_name->length];
+	printf("LSA Type: %c\n",lsa_type);
+	int ls_type=atoi(&lsa_type);
 
-	for(i=0;i<adl_element;i++)
+	struct ccn_charbuf *lsa_data=ccn_charbuf_create();
+
+	if ( ls_type == LSA_NAME_TYPE )
 	{
-		nbr=e->data;
-		printf("Sending interest for name prefix:%s/%s/%s\n",ccn_charbuf_as_string(nbr->neighbor),nlsr_str,lsdb_str);	
-		name=ccn_charbuf_create();
-		res=ccn_name_from_uri(name,ccn_charbuf_as_string(nbr->neighbor));
-		ccn_name_append_str(name,nlsr_str);
-		ccn_name_append_str(name,lsdb_str);
-		//ccn_name_append_str(name,rnumstr);
-
-		/* 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, "%u", (unsigned)mynumber);
-		//ccn_charbuf_putf(c, "%s", nbr->last_lsdb_version);
-		ccn_charbuf_putf(c, "%u", (unsigned)nbr->last_lsdb_version);
-		ccnb_append_tagged_blob(templ, CCN_DTAG_Component, c->buf, c->length);
-		ccn_charbuf_append_closer(templ); /* </Exclude> */
-		ccn_charbuf_append_closer(templ); /* </Interest> */
-
-	
-		/* Adding Exclusion filter done */
-				
-		res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
-			
-		if ( res >= 0 )
-			printf("Interest sending Successfull .... \n");	
-		ccn_charbuf_destroy(&c);
-		ccn_charbuf_destroy(&templ);
-		ccn_charbuf_destroy(&name);
-	
-		hashtb_next(e);		
+		printf("Interest Received for NAME LSA\n");
+		get_name_lsa_data(lsa_data,lsaId);
+	}
+	else if ( ls_type == LSA_ADJ_TYPE )
+	{
+		printf("Interest Received for ADJ LSA\n");
+		get_adj_lsa_data(lsa_data,lsaId);
 	}
 
-	hashtb_end(e);
+	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);
 
-	nlsr->event_send_lsdb_interest = ccn_schedule_event(nlsr->sched, 60000000, &send_lsdb_interest, NULL, 0);
+	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]); 
 
-	my_unlock();
-	return 0;
+	sp.template_ccnb=ccn_charbuf_create();
+	ccn_charbuf_append_tt(sp.template_ccnb,CCN_DTAG_SignedInfo, CCN_DTAG);
+	ccnb_tagged_putf(sp.template_ccnb, CCN_DTAG_FreshnessSeconds, "%ld", 10);
+        sp.sp_flags |= CCN_SP_TEMPL_FRESHNESS;
+        ccn_charbuf_append_closer(sp.template_ccnb);
 
+	res= ccn_sign_content(nlsr->ccn, data, name, &sp, raw_data , strlen(raw_data)); 
+	if(res >= 0)
+		printf("Signing LSA Content is successful \n");
+
+	res=ccn_put(nlsr->ccn,data->buf,data->length);
+	if(res >= 0)
+		printf("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);
 }
 
-
-int
-send_info_interest(struct ccn_schedule *sched, void *clienth,
-        struct ccn_scheduled_event *ev, int flags)
+enum ccn_upcall_res incoming_content(struct ccn_closure* selfp,
+        enum ccn_upcall_kind kind, struct ccn_upcall_info* info)
 {
 
 	my_lock();
-	struct ccn_charbuf *name;
-	long int rnum;
-	char rnumstr[20];
-	char info_str[5];
-	char nlsr_str[5];
-
-	int res,i;
-	int adl_element;
-	int scope = 2;  //no further than the next host
-
-	rnum=random();
-	memset(&rnumstr,0,20);
-	sprintf(rnumstr,"%ld",rnum);
-	memset(&nlsr_str,0,5);
-	sprintf(nlsr_str,"nlsr");
-	memset(&info_str,0,5);
-	sprintf(info_str,"info");
-	
-
-	struct ndn_neighbor *nbr;
-
-	struct hashtb_enumerator ee;
-    	struct hashtb_enumerator *e = &ee;
-    	
-    	hashtb_start(nlsr->adl, e);
-	adl_element=hashtb_n(nlsr->adl);
-	//int mynumber=15;
-
-	for(i=0;i<adl_element;i++)
-	{
-		nbr=e->data;
-		printf("Sending interest for name prefix:%s/%s/%s\n",ccn_charbuf_as_string(nbr->neighbor),nlsr_str,info_str);	
-		name=ccn_charbuf_create();
-		res=ccn_name_from_uri(name,ccn_charbuf_as_string(nbr->neighbor));
-		ccn_name_append_str(name,nlsr_str);
-		ccn_name_append_str(name,info_str);
-		//ccn_name_append_str(name,rnumstr);
-
-		/* adding Exclusion filter */
+    switch(kind) {
+        case CCN_UPCALL_FINAL:
+            break;
+        case CCN_UPCALL_CONTENT:
+            	printf("Content Received \n");  
 		
-		struct ccn_charbuf *templ;
-		templ = ccn_charbuf_create();
+		process_incoming_content(selfp, info);
 
-//		struct ccn_charbuf *c;
-//		c = ccn_charbuf_create();
+	    break;
+        case CCN_UPCALL_INTEREST_TIMED_OUT:
+          	printf("Interest timed out \n"); 	    
+		process_incoming_timed_out_interest(selfp,info);
 
-
-		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, "%u", (unsigned)mynumber);
-//		//ccn_charbuf_putf(c, "%s", nbr->last_lsdb_version);
-//		ccn_charbuf_putf(c, "%u", (unsigned)nbr->last_lsdb_version);
-//		ccnb_append_tagged_blob(templ, CCN_DTAG_Component, c->buf, c->length);
-//		ccn_charbuf_append_closer(templ); /* </Exclude> */
-		ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", 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 )
-			printf("Interest sending Successfull .... \n");	
-//		ccn_charbuf_destroy(&c);
-		ccn_charbuf_destroy(&templ);
-		ccn_charbuf_destroy(&name);
-	
-		hashtb_next(e);		
-	}
-
-	hashtb_end(e);
-
-	//nlsr->event_send_info_interest = ccn_schedule_event(nlsr->sched, 20000000, &send_info_interest, NULL, 0);
+	    break;
+        default:
+            fprintf(stderr, "Unexpected response of kind %d\n", kind);
+            //return CCN_UPCALL_RESULT_ERR;
+    }
 
 	my_unlock();
-	return 0;
-
+    return CCN_UPCALL_RESULT_OK;
 }
 
-
 void 
-send_info_interest_to_neighbor(struct ccn_charbuf *nbr)
+process_incoming_content(struct ccn_closure *selfp, struct ccn_upcall_info* info)
 {
+	printf("process_incoming_content called \n");
+	
+	/*	
+	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);	
+	printf("%s\n",ccn_charbuf_as_string(c));
+	ccn_charbuf_destroy(&c);
+	*/
+
+	const unsigned char *comp_ptr1;
+	size_t comp_size;
+	int res,i;
+	int nlsr_position=0;
+	int name_comps=(int)info->interest_comps->n;
+
+	for(i=0;i<name_comps;i++)
+	{
+		res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
+		if( res == 0)
+		{
+			nlsr_position=i;
+			break;
+		}	
+	}
+
+	res=ccn_name_comp_get(info->interest_ccnb, info->interest_comps,nlsr_position+1,&comp_ptr1, &comp_size);
+
+	printf("Det= %s \n",comp_ptr1);
+
+	if(!strcmp((char *)comp_ptr1,"info"))
+	{
+		process_incoming_content_info(selfp,info);
+	}
+	if(!strcmp((char *)comp_ptr1,"lsdb"))
+	{
+		process_incoming_content_lsdb(selfp,info);
+	}
+	if(!strcmp((char *)comp_ptr1,"lsa"))
+	{
+		process_incoming_content_lsa(selfp,info);
+	}
+	
+}
+
+void 
+process_incoming_content_info(struct ccn_closure *selfp, struct ccn_upcall_info* info)
+{
+	printf("process_incoming_content_info called \n");
+	
+	struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
+	get_nbr(nbr,selfp,info);
+	
+	printf("Info Content Received For Neighbor: %s Length:%d\n",nbr->name,nbr->length);
+		
+
+	const unsigned char *ptr;
+	size_t length;
+	ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E_Content]-info->pco->offset[CCN_PCO_B_Content], info->pco, &ptr, &length);
+	printf("Content data: %s\n",ptr);
+
+	long int interval=atoi((char *)ptr);
+
+
+	update_adjacent_timed_out_zero_to_adl(nbr);	
+	update_adjacent_status_to_adl(nbr,NBR_ACTIVE);
+	update_lsdb_synch_interval_to_adl(nbr,interval);
+	print_adjacent_from_adl();
+
+	if(!nlsr->is_build_adj_lsa_sheduled)
+	{
+		printf("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
+	{
+		printf("Build and Install Adj LSA already scheduled\n");
+	}
+
+	free(nbr);
+	
+
+}
+
+void 
+process_incoming_content_lsdb(struct ccn_closure *selfp, struct ccn_upcall_info* info)
+{
+	printf("process_incoming_content_lsdb called \n");
+
+	
+	const unsigned char *ptr;
+	size_t length;
+	ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E_Content]-info->pco->offset[CCN_PCO_B_Content], info->pco, &ptr, &length);
+	printf("Content data: %s\n",ptr);
+
+	if( (strcmp("NACK",(char *)ptr) != 0 ) && (strcmp("WAIT",(char *)ptr) != 0 ) )
+	{
+		struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
+		get_nbr(nbr,selfp,info);
+
+		char *nl;
+		int num_element;
+		int i;
+		char *rem;
+		const char *sep="|";
+		char *orig_router;
+		char *lst;
+		int ls_type;
+		char *lsid;
+		long int ls_id;
+
+		nl=strtok_r((char *)ptr,sep,&rem);
+		num_element=atoi(nl);		
+
+		for(i = 0 ; i < num_element ; i++)
+		{
+			orig_router=strtok_r(NULL,sep,&rem);
+			lst=strtok_r(NULL,sep,&rem);
+			ls_type=atoi(lst);
+			printf("Orig Router: %s ls Type: %d",orig_router,ls_type);			
+
+			if(ls_type == LS_TYPE_NAME)
+			{
+				lsid=strtok_r(NULL,sep,&rem);
+				ls_id=atoi(lsid);
+				printf(" LS Id: %ld\n",ls_id);
+				send_interest_for_name_lsa(nbr,orig_router,lst,lsid);	
+			}
+			else
+			{
+				printf("\n");
+				send_interest_for_adj_lsa(nbr,orig_router,lst);
+			}
+				
+		}
+				
+
+		
+		char *version=get_current_timestamp_micro();
+		printf("Old LSDB Version of Neighbor: %s is :%s\n",nbr->name,get_nbr_lsdb_version(nbr->name));		
+		update_adjacent_lsdb_version_to_adl(nbr,version);
+		printf("New LSDB Version of Neighbor: %s is :%s\n",nbr->name,get_nbr_lsdb_version(nbr->name));
+		
+		
+
+		free(nbr);	
+	}
+	else if (strcmp("WAIT",(char *)ptr) == 0)
+	{
+		struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
+		get_nbr(nbr,selfp,info);
+		long int interval=get_lsdb_synch_interval(nbr->name);
+		adjust_adjacent_last_lsdb_requested_to_adl(nbr->name,(long int)interval/2);
+		
+
+		free(nbr);
+	}
+	else 
+	{
+		printf("NACK Content Received\n");
+	}
+	
+	
+}
+
+void 
+process_incoming_content_lsa(struct ccn_closure *selfp, struct ccn_upcall_info* info)
+{
+	printf("process_incoming_content_lsa called \n");
+
+	char *sep="|";
+	char *rem;
+	char *orig_router;
+	char *orl;
+	int orig_router_length;
+	char *lst;
+	int ls_type;
+	char *lsid;
+	long int ls_id;
+	char *isvld;
+	int isValid;
+	char *num_link;
+	int no_link;
+	char *np;
+	char *np_length;
+	int name_length;
+	char *data;
+	char *orig_time;
+
+	const unsigned char *ptr;
+	size_t length;
+	ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E_Content]-info->pco->offset[CCN_PCO_B_Content], info->pco, &ptr, &length);
+	printf("Content data Received: %s\n",ptr);
+
+	printf("LSA Data\n");
+
+	if( strlen((char *) ptr ) > 0 )
+	{
+
+		orig_router=strtok_r((char *)ptr,sep,&rem);
+		orl=strtok_r(NULL,sep,&rem);
+		orig_router_length=atoi(orl);
+
+		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);
+
+		printf("	LS Type  : %d\n",ls_type);
+
+		if ( ls_type == LSA_NAME_TYPE )
+		{
+			lsid=strtok_r(NULL,sep,&rem);
+			ls_id=atoi(lsid);
+			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);
+
+			printf("	LS ID  : %ld\n",ls_id);
+			printf("	isValid  : %d\n",isValid);
+			printf("	Name Prefix : %s\n",np);
+			printf("	Name Prefix length: %d\n",name_length);
+
+			build_and_install_others_name_lsa(orig_router,ls_type,ls_id,isValid,np);
+				
+		}
+		else if ( ls_type == LSA_ADJ_TYPE )
+		{
+			orig_time=strtok_r(NULL,sep,&rem);
+			num_link=strtok_r(NULL,sep,&rem);
+			no_link=atoi(num_link);
+			data=rem;
+
+			printf("	No Link  : %d\n",no_link);
+			printf("	Data  : %s\n",data);
+
+			build_and_install_others_adj_lsa(orig_router,ls_type,orig_time,no_link,data);
+		}
+	
+
+	}
+
+}
+
+void
+process_incoming_timed_out_interest(struct ccn_closure* selfp, struct ccn_upcall_info* info)
+{
+	printf("process_incoming_timed_out_interest called \n");
+
+	/*
+	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);
+	printf("%s\n",ccn_charbuf_as_string(c));
+	ccn_charbuf_destroy(&c);
+	*/
+
+	int res,i;
+	int nlsr_position=0;
+	int name_comps=(int)info->interest_comps->n;
+
+	for(i=0;i<name_comps;i++)
+	{
+		res=ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,i,"nlsr");
+		if( res == 0)
+		{
+			nlsr_position=i;
+			break;
+		}	
+	}
+
+	if(ccn_name_comp_strcmp(info->interest_ccnb,info->interest_comps,nlsr_position+1,"info") == 0)
+	{
+		process_incoming_timed_out_interest_info(selfp,info);
+	}
+}
+
+void
+process_incoming_timed_out_interest_info(struct ccn_closure* selfp, struct ccn_upcall_info* info)
+{
+	printf("process_incoming_timed_out_interest_info called \n");
+
+	struct name_prefix *nbr=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
+	get_nbr(nbr,selfp,info);
+
+	printf("Info Interest Timed Out for for Neighbor: %s Length:%d\n",nbr->name,nbr->length);
+		
+	
+	update_adjacent_timed_out_to_adl(nbr,1);
+	print_adjacent_from_adl();	
+	int timed_out=get_timed_out_number(nbr);
+	
+
+	if(timed_out<nlsr->interest_retry && timed_out>0) // use configured variables 
+	{
+		printf("Neighbor: %s Info Interest Timed Out: %d times\n",nbr->name,timed_out);
+		send_info_interest_to_neighbor(nbr);
+	}
+	else
+	{
+		printf("Neighbor: %s Info Interest Timed Out: %d times\n",nbr->name,timed_out);		
+		update_adjacent_status_to_adl(nbr,NBR_DOWN);
+		if(!nlsr->is_build_adj_lsa_sheduled)
+		{
+			nlsr->event_build_adj_lsa = ccn_schedule_event(nlsr->sched, 1000, &build_and_install_adj_lsa, NULL, 0);
+			nlsr->is_build_adj_lsa_sheduled=1;		
+		}
+	}
+
+	free(nbr);
+		
+
+}
+
+int 
+send_info_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
+{
+	printf("send_info_interest called \n");
+	printf("\n");
 
 	my_lock();
-	struct ccn_charbuf *name;
-	long int rnum;
-	char rnumstr[20];
-	char info_str[5];
-	char nlsr_str[5];
+
+	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);
+
+	my_unlock();
+
+	return 0;
+}
+
+void 
+send_info_interest_to_neighbor(struct name_prefix *nbr)
+{
+	printf("send_info_interest_to_neighbor called \n");
 
 	int res;
-	int scope = 2;  //no further than the next host
+	//int scope = 2;  //no further than the next host
+	
+	char info_str[5];
+	char nlsr_str[5];
+	long int rnum;
+	char rnumstr[20];
 
 	rnum=random();
 	memset(&rnumstr,0,20);
 	sprintf(rnumstr,"%ld",rnum);
+	
 	memset(&nlsr_str,0,5);
 	sprintf(nlsr_str,"nlsr");
 	memset(&info_str,0,5);
 	sprintf(info_str,"info");
 	
-	printf("Sending interest for name prefix:%s/%s/%s\n",ccn_charbuf_as_string(nbr),nlsr_str,info_str);	
+	
+	struct ccn_charbuf *name;	
 	name=ccn_charbuf_create();
-	res=ccn_name_from_uri(name,ccn_charbuf_as_string(nbr));
-	ccn_name_append_str(name,nlsr_str);
-	ccn_name_append_str(name,info_str);
-	//ccn_name_append_str(name,rnumstr);
 
-	/* adding Exclusion filter */
+	char *int_name=(char *)malloc(strlen(nbr->name)+1+strlen(nlsr_str)+1+strlen(info_str)+strlen(nlsr->router_name->name)+1);
+	memset(int_name,0,strlen(nbr->name)+1+strlen(nlsr_str)+1+strlen(info_str)+strlen(nlsr->router_name->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->name,strlen(nlsr->router_name->name));
+	
+
+	res=ccn_name_from_uri(name,int_name);
+	if ( res >=0 )
+	{
+		ccn_name_append_str(name,rnumstr);
+
+		/* adding InterestLifeTime and InterestScope filter */
+
+		struct ccn_charbuf *templ;
+		templ = ccn_charbuf_create();
+
+		ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
+		ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
+		ccn_charbuf_append_closer(templ); /* </Name> */
+		//ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
+		//ccn_charbuf_append_tt(templ, CCN_DTAG_Scope, CCN_DTAG);
+		//ccn_charbuf_append_tt(templ, 1, CCN_UDATA);
+		//ccn_charbuf_append(templ, "2", 1); //scope of interest: 2 (not further than next host)
+		//ccn_charbuf_append_closer(templ); /* </Scope> */
+
+		appendLifetime(templ,nlsr->interest_resend_time);
+		ccn_charbuf_append_closer(templ); /* </Interest> */
+		/* Adding InterestLifeTime and InterestScope filter done */
+	
+		printf("Sending info interest on name prefix : %s \n",int_name);
+
+		res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
+
+		if ( res >= 0 )
+			printf("Info interest sending Successfull .... \n");	
+		ccn_charbuf_destroy(&templ);
+	}
+	ccn_charbuf_destroy(&name);
+	free(int_name);
+
+}
+
+
+int 
+send_lsdb_interest(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
+{
+	printf("send_lsdb_interest called \n");	
+
+	my_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);	
+				printf("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))
+				{
+					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);
+
+	my_unlock();
+	return 0;
+}
+
+void 
+send_lsdb_interest_to_nbr(struct name_prefix *nbr)
+{
+	printf("send_lsdb_interest_to_nbr called \n");	
+	
+	char *last_lsdb_version=get_nbr_lsdb_version(nbr->name);
+
+	if(last_lsdb_version !=NULL)
+	{
+		printf("Last LSDB Version: %s \n",last_lsdb_version);
+
+
+		struct ccn_charbuf *name;
+		int res;
+		long int rnum;
+		char rnumstr[20];
+		char lsdb_str[5];
+		char nlsr_str[5];
+						
+		rnum=random();
+		memset(&rnumstr,0,20);
+		sprintf(rnumstr,"%ld",rnum);
+		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
+		printf("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);
+			ccn_name_append_str(name,rnumstr);
+	
+			/* 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);
+			//ccn_charbuf_putf(c, "%u", (unsigned)nbr->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 )
+			{
+				printf("Interest sending Successfull .... \n");	
+				update_adjacent_last_lsdb_requested_to_adl(nbr->name,get_current_time_sec());
+
+			}
+			ccn_charbuf_destroy(&c);
+			ccn_charbuf_destroy(&templ);
+		}
+		ccn_charbuf_destroy(&name);
+	}	
+	set_is_lsdb_send_interest_scheduled_to_zero(nbr->name);
+
+}
+
+void 
+send_interest_for_name_lsa(struct name_prefix *nbr, char *orig_router, char *ls_type, char *ls_id)
+{
+	printf("send_interest_for_name_lsa called\n");
+
+	int res;
+	long int rnum;
+	char rnumstr[20];
+	char lsa_str[5];
+	char nlsr_str[5];
+
+						
+	rnum=random();
+	memset(&rnumstr,0,20);
+	sprintf(rnumstr,"%ld",rnum);
+	memset(&nlsr_str,0,5);
+	sprintf(nlsr_str,"nlsr");
+	memset(&lsa_str,0,5);
+	sprintf(lsa_str,"lsa");
+
+	char *int_name=(char *)malloc(nbr->length + strlen(orig_router)+strlen(nlsr_str)+strlen(lsa_str)+2);
+	memset(int_name,0,nbr->length + strlen(orig_router)+strlen(nlsr_str)+strlen(lsa_str)+2);
+
+	memcpy(int_name+strlen(int_name),nbr->name,nbr->length);
+	memcpy(int_name+strlen(int_name),"/",1);
+	memcpy(int_name+strlen(int_name),nlsr_str,strlen(nlsr_str));
+	memcpy(int_name+strlen(int_name),"/",1);
+	memcpy(int_name+strlen(int_name),lsa_str,strlen(lsa_str));
+	memcpy(int_name+strlen(int_name),orig_router,strlen(orig_router));	
+
+	
+	struct ccn_charbuf *name;	
+	name=ccn_charbuf_create();
+
+
+	res=ccn_name_from_uri(name,int_name);
+	ccn_name_append_str(name,ls_type);
+	ccn_name_append_str(name,ls_id);
+	ccn_name_append_str(name,rnumstr);
+
+
+	/* adding InterestLifeTime and InterestScope 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, "%u", (unsigned)mynumber);
-//	//ccn_charbuf_putf(c, "%s", nbr->last_lsdb_version);
-//	ccn_charbuf_putf(c, "%u", (unsigned)nbr->last_lsdb_version);
-//	ccnb_append_tagged_blob(templ, CCN_DTAG_Component, c->buf, c->length);
-//	ccn_charbuf_append_closer(templ); /* </Exclude> */
-	ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
-	appendLifetime(templ,15);
+	//ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
+	ccn_charbuf_append_tt(templ, CCN_DTAG_Scope, CCN_DTAG);
+	ccn_charbuf_append_tt(templ, 1, CCN_UDATA);
+	ccn_charbuf_append(templ, "2", 1); //scope of interest: 2 (not further than next host)
+	ccn_charbuf_append_closer(templ); /* </Scope> */
+
+	appendLifetime(templ,nlsr->interest_resend_time);
 	ccn_charbuf_append_closer(templ); /* </Interest> */
+	/* Adding InterestLifeTime and InterestScope filter done */
+	
+	printf("Sending NAME LSA interest on name prefix : %s/%s/%s\n",int_name,ls_type,ls_id);
 
-
-	/* Adding Exclusion filter done */
-				
 	res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
-			
+
 	if ( res >= 0 )
-		printf("Interest sending Successfull .... \n");	
-//	ccn_charbuf_destroy(&c);
+		printf("NAME LSA interest sending Successfull .... \n");	
+	
+	//free(lsa_orig_router);	
 	ccn_charbuf_destroy(&templ);
 	ccn_charbuf_destroy(&name);
-
-	my_unlock();
-
+	free(int_name);
+	
+	
 }
+
+void 
+send_interest_for_adj_lsa(struct name_prefix *nbr, char *orig_router, char *ls_type)
+{
+	printf("send_interest_for_adj_lsa called\n");
+
+	int res;
+	long int rnum;
+	char rnumstr[20];
+	char lsa_str[5];
+	char nlsr_str[5];
+
+						
+	rnum=random();
+	memset(&rnumstr,0,20);
+	sprintf(rnumstr,"%ld",rnum);
+	memset(&nlsr_str,0,5);
+	sprintf(nlsr_str,"nlsr");
+	memset(&lsa_str,0,5);
+	sprintf(lsa_str,"lsa");
+
+	char *int_name=(char *)malloc(nbr->length + strlen(orig_router)+strlen(nlsr_str)+strlen(lsa_str)+2);
+	memset(int_name,0,nbr->length + strlen(orig_router)+strlen(nlsr_str)+strlen(lsa_str)+2);
+
+	memcpy(int_name+strlen(int_name),nbr->name,nbr->length);
+	memcpy(int_name+strlen(int_name),"/",1);
+	memcpy(int_name+strlen(int_name),nlsr_str,strlen(nlsr_str));
+	memcpy(int_name+strlen(int_name),"/",1);
+	memcpy(int_name+strlen(int_name),lsa_str,strlen(lsa_str));
+	memcpy(int_name+strlen(int_name),orig_router,strlen(orig_router));
+
+	
+	struct ccn_charbuf *name;	
+	name=ccn_charbuf_create();
+	
+
+	ccn_name_from_uri(name,int_name);
+	ccn_name_append_str(name,ls_type);
+	ccn_name_append_str(name,rnumstr);
+
+	/* adding InterestLifeTime and InterestScope filter */
+
+	struct ccn_charbuf *templ;
+	templ = ccn_charbuf_create();
+
+	ccn_charbuf_append_tt(templ, CCN_DTAG_Interest, CCN_DTAG);
+	ccn_charbuf_append_tt(templ, CCN_DTAG_Name, CCN_DTAG);
+	ccn_charbuf_append_closer(templ); /* </Name> */
+	//ccnb_tagged_putf(templ, CCN_DTAG_Scope, "%d", scope);
+	ccn_charbuf_append_tt(templ, CCN_DTAG_Scope, CCN_DTAG);
+	ccn_charbuf_append_tt(templ, 1, CCN_UDATA);
+	ccn_charbuf_append(templ, "2", 1); //scope of interest: 2 (not further than next host)
+	ccn_charbuf_append_closer(templ); /* </Scope> */
+
+	appendLifetime(templ,nlsr->interest_resend_time);
+	ccn_charbuf_append_closer(templ); /* </Interest> */
+	/* Adding InterestLifeTime and InterestScope filter done */
+	
+	printf("Sending ADJ LSA interest on name prefix : %s/%s/%s%s/%s/\n",nbr->name,nlsr_str,lsa_str,orig_router,ls_type);
+
+	res=ccn_express_interest(nlsr->ccn,name,&(nlsr->in_content),templ);
+
+	if ( res >= 0 )
+		printf("ADJ LSA interest sending Successfull .... \n");	
+	
+	//free(lsa_orig_router);	
+	ccn_charbuf_destroy(&templ);
+	ccn_charbuf_destroy(&name);
+	free(int_name);
+
+	
+}
+
