Adding LSDB Interest, Summary LSDB
diff --git a/nlsr.h b/nlsr.h
index 045a9d3..ea815ee 100644
--- a/nlsr.h
+++ b/nlsr.h
@@ -53,6 +53,7 @@
 	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;
 
diff --git a/nlsr_lsdb.c b/nlsr_lsdb.c
index 92fc82d..dd96b57 100644
--- a/nlsr_lsdb.c
+++ b/nlsr_lsdb.c
@@ -2721,6 +2721,133 @@
 		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 = ⅇ
+    	
+    	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)
 {
diff --git a/nlsr_lsdb.h b/nlsr_lsdb.h
index db7b831..94e84af 100644
--- a/nlsr_lsdb.h
+++ b/nlsr_lsdb.h
@@ -104,4 +104,7 @@
 
 void destroy_lsdb(void);
 
+void 
+get_lsdb_summary(struct ccn_charbuf *lsdb_data);
+
 #endif
diff --git a/nlsr_ndn.c b/nlsr_ndn.c
index 1fcdd16..096c8a2 100644
--- a/nlsr_ndn.c
+++ b/nlsr_ndn.c
@@ -158,6 +158,35 @@
 }
 
 
+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 
@@ -241,6 +270,14 @@
 	{
 		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);
+	}
 
 }
 
@@ -368,6 +405,267 @@
 }
 
 
+
+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 
@@ -842,3 +1140,162 @@
 	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
index c254793..5d81208 100644
--- a/nlsr_ndn.h
+++ b/nlsr_ndn.h
@@ -22,4 +22,10 @@
 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