#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"

void
set_new_lsdb_version(void)
{
	
	char *time_stamp=(char *)malloc(20);
	memset(time_stamp,0,20);
	get_current_timestamp_micro(time_stamp);
	
	free(nlsr->lsdb->lsdb_version);
	nlsr->lsdb->lsdb_version=(char *)malloc(strlen(time_stamp)+1);
	memset(nlsr->lsdb->lsdb_version,0,strlen(time_stamp)+1);
	memcpy(nlsr->lsdb->lsdb_version,time_stamp,strlen(time_stamp)+1);

	free(time_stamp);
	
}

void 
make_name_lsa_key(char *key, char *orig_router, int ls_type, long int ls_id)
{
	
	
	printf("Orig Router: %s LS Type: %d LS Id: %ld\n",orig_router,ls_type,ls_id);

	char lst[2];
	memset(lst,0,2);
	sprintf(lst,"%d",ls_type);	

	char lsid[10];
	memset(lsid,0,10);
	sprintf(lsid,"%ld",ls_id);
	
	memcpy(key+strlen(key),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));

	printf("Key: %s\n",key);
	
}

void 
build_and_install_name_lsas(void)
{
	printf("build_and_install_name_lsas called \n");

	int i, npl_element;
	struct name_prefix *np;

	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++)
	{
		np=e->data;
		struct nlsa *name_lsa=(struct nlsa *)malloc(sizeof( struct nlsa ));
		build_name_lsa(name_lsa,np);
		
		install_name_lsa(name_lsa);
		free(name_lsa->header->orig_router->name);
		free(name_lsa->header->orig_router);
		free(name_lsa->header);
		free(name_lsa->name_prefix->name);
		free(name_lsa->name_prefix);
		free(name_lsa);
		hashtb_next(e);		
	}

	hashtb_end(e);	

}

void 
build_name_lsa(struct nlsa *name_lsa, struct name_prefix *np)
{
	name_lsa->header=(struct nlsa_header *)malloc(sizeof(struct nlsa_header ));
	name_lsa->header->ls_type=LS_TYPE_NAME;

	char *time_stamp=(char *)malloc(20);
	memset(time_stamp,0,20);
	get_current_timestamp_micro(time_stamp);

	name_lsa->header->orig_time=(char *)malloc(strlen(time_stamp)+1); //free 
	memset(name_lsa->header->orig_time,0,strlen(time_stamp)+1);
	memcpy(name_lsa->header->orig_time,time_stamp,strlen(time_stamp)+1);
	
	free(time_stamp);

	name_lsa->header->ls_id=++nlsr->nlsa_id;
	name_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
	name_lsa->header->orig_router->name=(char *)malloc(strlen(nlsr->router_name)+1);
	memset(name_lsa->header->orig_router->name,0,strlen(nlsr->router_name)+1);
	memcpy(name_lsa->header->orig_router->name,nlsr->router_name,strlen(nlsr->router_name)+1);
	name_lsa->header->orig_router->length=strlen(nlsr->router_name)+1;
	name_lsa->header->isValid=1;

	
	name_lsa->name_prefix=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
	name_lsa->name_prefix->name=(char *)malloc(np->length);
	memcpy(name_lsa->name_prefix->name,np->name,np->length);
	name_lsa->name_prefix->length=np->length;

}

void 
install_name_lsa(struct nlsa *name_lsa)
{

	char *time_stamp=(char *)malloc(20);
	memset(time_stamp,0,20);
	get_current_timestamp_micro(time_stamp);
	long int lsa_life_time=get_time_diff(time_stamp,name_lsa->header->orig_time);

	printf("time difference: %ld \n",lsa_life_time);
	

		char lst[2];
		memset(lst,0,2);
		sprintf(lst,"%d",name_lsa->header->ls_type);	

		char lsid[10];
		memset(lsid,0,10);
		sprintf(lsid,"%ld",name_lsa->header->ls_id);
	
	
		char *key=(char *)malloc(strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
		memset(key,0,strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);


		make_name_lsa_key(key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id);	
		printf("Key:%s Length:%d\n",key,(int)strlen(key));

		struct nlsa *new_name_lsa=(struct nlsa*)malloc(sizeof(struct nlsa )); //free

		struct hashtb_enumerator ee;
    		struct hashtb_enumerator *e = &ee; 	
    		int res;

   		hashtb_start(nlsr->lsdb->name_lsdb, e);
    		res = hashtb_seek(e, key, strlen(key), 0);

		if(res == HT_NEW_ENTRY )
		{
		
			printf("New Name LSA... Adding to LSDB\n");
			new_name_lsa = e->data;

			new_name_lsa->header=(struct nlsa_header *)malloc(sizeof(struct nlsa_header )); //free
			new_name_lsa->header->ls_type=name_lsa->header->ls_type;

			new_name_lsa->header->orig_time=(char *)malloc(strlen(name_lsa->header->orig_time)+1);
			memset(new_name_lsa->header->orig_time,0,strlen(name_lsa->header->orig_time)+1);
			memcpy(new_name_lsa->header->orig_time,name_lsa->header->orig_time,strlen(name_lsa->header->orig_time)+1);

			new_name_lsa->header->ls_id=name_lsa->header->ls_id;
			new_name_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix )); //free
			new_name_lsa->header->orig_router->name=(char *)malloc(name_lsa->header->orig_router->length);
			memcpy(new_name_lsa->header->orig_router->name,name_lsa->header->orig_router->name,name_lsa->header->orig_router->length);
			new_name_lsa->header->orig_router->length=name_lsa->header->orig_router->length;
			new_name_lsa->header->isValid=name_lsa->header->isValid;

	
			new_name_lsa->name_prefix=(struct name_prefix *)malloc(sizeof(struct name_prefix )); //free
			new_name_lsa->name_prefix->name=(char *)malloc(name_lsa->name_prefix->length);
			memcpy(new_name_lsa->name_prefix->name,name_lsa->name_prefix->name,name_lsa->name_prefix->length);
			new_name_lsa->name_prefix->length=name_lsa->name_prefix->length;

			printf("New Name LSA Added....\n");	

			printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
			set_new_lsdb_version();	
			printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);	

			//struct hashtb *face_list;
			int num_next_hop=get_number_of_next_hop(new_name_lsa->header->orig_router->name);

			//printf("Next hop: %d \n",next_hop);

			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 )
				{
					printf("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);
				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]);
				int check=add_npt_entry(new_name_lsa->header->orig_router->name,new_name_lsa->name_prefix->name,next_hop,faces,route_costs);
				if ( check == HT_NEW_ENTRY )
				{
					printf("Added in npt \n");
				}
				free(faces);
				free(route_costs);

			}
			

		
			free(time_stamp);

		}
		else if(res == HT_OLD_ENTRY)
		{
			new_name_lsa=e->data;
			if(strcmp(name_lsa->header->orig_time,new_name_lsa->header->orig_time)<0)
			{
				printf("Older Adj LSA. Discarded...\n");
			}
			else if( strcmp(name_lsa->header->orig_time,new_name_lsa->header->orig_time) == 0 )
			{
				printf("Duplicate Adj LSA. Discarded...\n");
			}
			else 
			{
				if ( name_lsa->header->isValid == 0 )
				{
					// have to call to delete npt table entry
					delete_npt_entry(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)
					{
						hashtb_delete(e);
						printf("isValid bit not set for Router %s so LSA Deleted from LSDB\n",name_lsa->header->orig_router->name);
					}
					else 
					{
						new_name_lsa->header->isValid=name_lsa->header->isValid;
						free(new_name_lsa->header->orig_time);
						new_name_lsa->header->orig_time=(char *)malloc(strlen(name_lsa->header->orig_time)+1);
						memset(new_name_lsa->header->orig_time,0,strlen(name_lsa->header->orig_time)+1);
						memcpy(new_name_lsa->header->orig_time,name_lsa->header->orig_time,strlen(name_lsa->header->orig_time)+1);
					}
					printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
					set_new_lsdb_version();	
					printf("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(new_name_lsa->header->orig_router->name,new_name_lsa->name_prefix->name);
					}

					// copying LSA content with header

					free(new_name_lsa->header->orig_time);
					new_name_lsa->header->orig_time=(char *)malloc(strlen(name_lsa->header->orig_time)+1);
					memset(new_name_lsa->header->orig_time,0,strlen(name_lsa->header->orig_time)+1);
					memcpy(new_name_lsa->header->orig_time,name_lsa->header->orig_time,strlen(name_lsa->header->orig_time)+1);
				
					new_name_lsa->header->isValid=name_lsa->header->isValid;

					free(new_name_lsa->name_prefix->name);
					free(new_name_lsa->name_prefix);
					new_name_lsa->name_prefix=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
					new_name_lsa->name_prefix->name=(char *)malloc(name_lsa->name_prefix->length);
					memcpy(new_name_lsa->name_prefix->name,name_lsa->name_prefix->name,name_lsa->name_prefix->length);
					new_name_lsa->name_prefix->length=name_lsa->name_prefix->length;

					printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
					set_new_lsdb_version();	
					printf("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 )
							{
								printf("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);
							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]);
							
							int check=add_npt_entry(new_name_lsa->header->orig_router->name,new_name_lsa->name_prefix->name,next_hop,faces,route_costs);
							if ( check == HT_NEW_ENTRY )
							{
								printf("Added in npt \n");
							}
							free(faces);
							free(route_costs);
							
						}
						
					}
				}
			}
		
		}

    		hashtb_end(e);

		free(key);
}


void 
print_name_lsa(struct nlsa *name_lsa)
{
	
	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)
{
	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++)
	{
		printf("-----------Name LSA (%d)---------------\n",i+1);
		name_lsa=e->data;
		print_name_lsa(name_lsa);	
		hashtb_next(e);		
	}

	hashtb_end(e);

	printf("\n");
}


void
build_and_install_others_name_lsa(char *orig_router,int ls_type,long int ls_id,char *orig_time, int isValid,char *np)
{
	printf("build_and_install_others_name_lsa called \n");

	struct nlsa *name_lsa=(struct nlsa *)malloc(sizeof( struct nlsa ));
	build_others_name_lsa(name_lsa,orig_router,ls_type,ls_id,orig_time, isValid,np);
	print_name_lsa(name_lsa);
	install_name_lsa(name_lsa);
	print_name_lsdb();
	print_npt();
	
	free(name_lsa->header->orig_router->name);
	free(name_lsa->header->orig_router);
	free(name_lsa->header);
	free(name_lsa->name_prefix->name);
	free(name_lsa->name_prefix);
	free(name_lsa);
	
}

void
build_others_name_lsa(struct nlsa *name_lsa, char *orig_router,int ls_type,long int ls_id,char *orig_time, int isValid,char *np)
{
	printf("build_others_name_lsa called \n");

	name_lsa->header=(struct nlsa_header *)malloc(sizeof(struct nlsa_header ));
	name_lsa->header->ls_type=LS_TYPE_NAME;

	name_lsa->header->orig_time=(char *)malloc(strlen(orig_time)+1);
	memset(name_lsa->header->orig_time,0,strlen(orig_time)+1);
	memcpy(name_lsa->header->orig_time,orig_time,strlen(orig_time)+1);

	name_lsa->header->ls_id=ls_id;
	name_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
	name_lsa->header->orig_router->name=(char *)malloc(strlen(orig_router)+1);
	memset(name_lsa->header->orig_router->name,0,strlen(orig_router)+1);
	memcpy(name_lsa->header->orig_router->name,orig_router,strlen(orig_router)+1);
	name_lsa->header->orig_router->length=strlen(orig_router)+1;
	name_lsa->header->isValid=isValid;

	name_lsa->name_prefix=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
	name_lsa->name_prefix->name=(char *)malloc(strlen(np)+1);
	memset(name_lsa->name_prefix->name,0,strlen(np)+1);
	memcpy(name_lsa->name_prefix->name,np,strlen(np)+1);
	name_lsa->name_prefix->length=strlen(np)+1;
}




void 
make_adj_lsa_key(char *key,struct alsa *adj_lsa)
{
	memcpy(key+strlen(key),adj_lsa->header->orig_router->name,adj_lsa->header->orig_router->length);
	memcpy(key+strlen(key),"/",1);
	char ls_type[2];
	sprintf(ls_type,"%d",adj_lsa->header->ls_type);
	memcpy(key+strlen(key),ls_type,strlen(ls_type));
	key[strlen(key)]='\0';
}

int
build_and_install_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
{
	if(flags == CCN_SCHEDULE_CANCEL)
	{
 	 	return -1;
	}

	nlsr_lock();

	printf("build_and_install_adj_lsa called \n");

	printf("adj_build_flag = %d \n",nlsr->adj_build_flag);

	if(nlsr->adj_build_flag > 0)
	{
		printf("is_adj_lsa_build = %d \n",is_adj_lsa_build());
		if ( is_adj_lsa_build()> 0)
		{
			struct alsa *adj_lsa=(struct alsa *)malloc(sizeof( struct alsa ));
			build_adj_lsa(adj_lsa);
			install_adj_lsa(adj_lsa);

			free(adj_lsa->header->orig_router->name);
			free(adj_lsa->header->orig_router);
			free(adj_lsa->header->orig_time);
			free(adj_lsa->header);
			free(adj_lsa->body);
			free(adj_lsa);
			nlsr->adj_build_flag=0;	
			print_adj_lsdb();		
		}
		else
		{
			printf("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)
{
	printf("build_adj_lsa called \n");

	int no_link=no_active_nbr();
	printf("Number of link in Adjacent LSA: %d\n",no_link);

	/*Filling Up Header Data */
	adj_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
	adj_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
	adj_lsa->header->orig_router->name=(char *)malloc(strlen(nlsr->router_name)+1);
	memset(adj_lsa->header->orig_router->name,0,strlen(nlsr->router_name)+1);
	memcpy(adj_lsa->header->orig_router->name,nlsr->router_name,strlen(nlsr->router_name)+1);
	adj_lsa->header->orig_router->length=strlen(nlsr->router_name)+1;

	adj_lsa->header->ls_type=(unsigned)LS_TYPE_ADJ;	

	char *time_stamp=(char *)malloc(20);
	memset(time_stamp,0,20);
	get_current_timestamp_micro(time_stamp);

	adj_lsa->header->orig_time=(char *)malloc(strlen(time_stamp)+1); 
	memset(adj_lsa->header->orig_time,0,strlen(time_stamp)+1);
	memcpy(adj_lsa->header->orig_time,time_stamp,strlen(time_stamp)+1);	
	free(time_stamp);


	/* Filling Up Body Data */

	adj_lsa->no_link=no_link;


	struct ccn_charbuf *c=ccn_charbuf_create();
	get_active_nbr_adj_data(c);
	char *data=ccn_charbuf_as_string(c);

	adj_lsa->body=(char *)malloc(strlen(data)+1);
	memset(adj_lsa->body,0,strlen(data)+1);
	memcpy(adj_lsa->body,(char *)data,strlen(data)+1);
	ccn_charbuf_destroy(&c);



	if( !nlsr->is_send_lsdb_interest_scheduled )
	{	
		nlsr->event_send_lsdb_interest= ccn_schedule_event(nlsr->sched, 1000, &send_lsdb_interest, NULL, 0);
		nlsr->is_send_lsdb_interest_scheduled=1;
	}

	nlsr->adj_build_count++;


}


void
install_adj_lsa(struct alsa * adj_lsa)
{
	printf("install_adj_lsa called \n");


	char *time_stamp=(char *)malloc(20);
	memset(time_stamp,0,20);
	get_current_timestamp_micro(time_stamp);
	long int lsa_life_time=get_time_diff(time_stamp,adj_lsa->header->orig_time);

	printf("time difference: %ld \n",lsa_life_time);


		char *key=(char *)malloc(adj_lsa->header->orig_router->length+2+2);
		memset(key,0,adj_lsa->header->orig_router->length+2);
		make_adj_lsa_key(key,adj_lsa);
		printf("Adjacent LSA key: %s \n",key);

		struct alsa *new_adj_lsa=(struct alsa*)malloc(sizeof(struct alsa ));

		struct hashtb_enumerator ee;
    		struct hashtb_enumerator *e = &ee; 	
    		int res;

   		hashtb_start(nlsr->lsdb->adj_lsdb, e);
    		res = hashtb_seek(e, key, strlen(key), 0);



		if(res == HT_NEW_ENTRY)
		{
			if ( adj_lsa->no_link > 0)
			{
				printf("New ADJ LSA... Adding to LSDB\n");
				new_adj_lsa = e->data;

				new_adj_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
				new_adj_lsa->header->ls_type=adj_lsa->header->ls_type;
				new_adj_lsa->header->orig_time=(char *)malloc(strlen(adj_lsa->header->orig_time)+1);
				memcpy(new_adj_lsa->header->orig_time,adj_lsa->header->orig_time,strlen(adj_lsa->header->orig_time)+1);		

				new_adj_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
				new_adj_lsa->header->orig_router->name=(char *)malloc(adj_lsa->header->orig_router->length);
				memcpy(new_adj_lsa->header->orig_router->name,adj_lsa->header->orig_router->name,adj_lsa->header->orig_router->length);
				new_adj_lsa->header->orig_router->length=adj_lsa->header->orig_router->length;

				new_adj_lsa->no_link=adj_lsa->no_link;
		
				new_adj_lsa->body=(char *)malloc(strlen(adj_lsa->body)+1);
				memset(new_adj_lsa->body,0,strlen(adj_lsa->body)+1);
				memcpy(new_adj_lsa->body,adj_lsa->body,strlen(adj_lsa->body)+1);
			
				add_next_hop_router(new_adj_lsa->header->orig_router->name);
				add_next_hop_from_lsa_adj_body(new_adj_lsa->body,new_adj_lsa->no_link);
			}
			else 
			{
				hashtb_delete(e);
			}

			printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
			set_new_lsdb_version();	
			printf("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)
			{
				printf("Older/Duplicate Adj LSA. Discarded...\n");
			}
			else
			{

				if ( adj_lsa->no_link > 0)
				{				
					new_adj_lsa = e->data;

					free(new_adj_lsa->header->orig_time);
					new_adj_lsa->header->orig_time=(char *)malloc(strlen(adj_lsa->header->orig_time)+1);
					memcpy(new_adj_lsa->header->orig_time,adj_lsa->header->orig_time,strlen(adj_lsa->header->orig_time)+1);

					new_adj_lsa->no_link=adj_lsa->no_link;
				
					new_adj_lsa->body=(char *)malloc(strlen(adj_lsa->body)+1);
					memset(new_adj_lsa->body,0,strlen(adj_lsa->body)+1);
					memcpy(new_adj_lsa->body,adj_lsa->body,strlen(adj_lsa->body)+1);

					add_next_hop_from_lsa_adj_body(new_adj_lsa->body,new_adj_lsa->no_link);
				}
				else
				{
					hashtb_delete(e);
				}
				printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
				set_new_lsdb_version();	
				printf("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 
print_adj_lsa_body(const char *body, int no_link)
{
	int i=0;
	char *lsa_data=(char *)malloc(strlen(body)+1);
	memset(	lsa_data,0,strlen(body)+1);
	memcpy(lsa_data,body,strlen(body)+1);
	char *sep="|";
	char *rem;
	char *rtr_id;
	char *length;
	char *face;
	char *metric;

	if(no_link >0 )
	{
		rtr_id=strtok_r(lsa_data,sep,&rem);
		length=strtok_r(NULL,sep,&rem);
		face=strtok_r(NULL,sep,&rem);
		metric=strtok_r(NULL,sep,&rem);

		printf("		Link %d	 	\n",i+1);
		printf("		Neighbor		 : %s	\n",rtr_id);
		printf("		Neighbor Length		 : %s	\n",length);
		printf("		Connecting Face		 : %s	\n",face);
		printf("		Metric			 : %s	\n",metric);


		for(i=1;i<no_link;i++)
		{
			rtr_id=strtok_r(NULL,sep,&rem);
			length=strtok_r(NULL,sep,&rem);
			face=strtok_r(NULL,sep,&rem);
			metric=strtok_r(NULL,sep,&rem);
			printf("		Link %d	 	\n",i+1);
			printf("		Neighbor		 : %s	\n",rtr_id);
			printf("		Neighbor Length		 : %s	\n",length);
			printf("		Connecting Face		 : %s	\n",face);
			printf("		Metric			 : %s	\n",metric);

		}
	}

	free(lsa_data);
}

void
print_adj_lsa(struct alsa * adj_lsa)
{

	printf("print_adj_lsa called \n");

	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);

/*
	struct link *templ=adj_lsa->links;
	int i;
	
	for(i=0 ; i< adj_lsa->no_link ; i++)
	{
		printf("		Link %d	 	\n",i+1);
		printf("		Neighbor		 : %s	\n",templ->nbr->name);
		printf("		Neighbor Length		 : %d	\n",templ->nbr->length);
		printf("		Connecting Face		 : %d	\n",templ->face);
		printf("		Metric			 : %d	\n",templ->metric);		

		templ++;
	}
*/
	printf("\n");

}

void
print_adj_lsdb(void)
{
	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++)
	{
		printf("-----------Adj LSA (%d)---------------\n",i+1);
		adj_lsa=e->data;
		print_adj_lsa(adj_lsa);	
		hashtb_next(e);		
	}

	hashtb_end(e);

	printf("\n");
}

void 
build_and_install_others_adj_lsa(char *orig_router,int ls_type,char *orig_time, int no_link,char *data)
{
	printf("build_and_install_others_adj_lsa called \n");	
	struct alsa *adj_lsa=(struct alsa *)malloc(sizeof( struct alsa ));
	build_others_adj_lsa(adj_lsa,orig_router,ls_type,orig_time,no_link,data);
	//print_adj_lsa(adj_lsa);
	install_adj_lsa(adj_lsa);
	

	free(adj_lsa->header->orig_router->name);
	free(adj_lsa->header->orig_router);
	free(adj_lsa->header->orig_time);
	free(adj_lsa->header);
	free(adj_lsa->body);
	free(adj_lsa);

	print_adj_lsdb();

}


void 
build_others_adj_lsa(struct alsa *adj_lsa,char *orig_router,int ls_type,char *orig_time,int no_link,char *data)
{
	printf("build_others_adj_lsa called \n");

	/*Filling Up Header Data */
	adj_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
	adj_lsa->header->orig_router=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
	adj_lsa->header->orig_router->name=(char *)malloc(strlen(orig_router)+1);
	memset(adj_lsa->header->orig_router->name,0,strlen(orig_router)+1);
	memcpy(adj_lsa->header->orig_router->name,orig_router,strlen(orig_router)+1);

	adj_lsa->header->orig_router->length=strlen(orig_router)+1;


	adj_lsa->header->ls_type=(unsigned)LS_TYPE_ADJ;	

	adj_lsa->header->orig_time=(char *)malloc(strlen(orig_time)+1);
	memset(adj_lsa->header->orig_time,0,strlen(orig_time)+1);
	memcpy(adj_lsa->header->orig_time,orig_time,strlen(orig_time)+1);

	adj_lsa->no_link=no_link;

	adj_lsa->body=(char *)malloc(strlen(data)+1);
	memset(adj_lsa->body,0,strlen(data)+1);
	memcpy(adj_lsa->body,(char *)data,strlen(data)+1);

}


long int
get_name_lsdb_num_element(void)
{
	long int num_element;


	struct hashtb_enumerator ee;
    	struct hashtb_enumerator *e = &ee;
    	
    	hashtb_start(nlsr->lsdb->name_lsdb, e);
	num_element=hashtb_n(nlsr->lsdb->name_lsdb);
	hashtb_end(e);

	return num_element; 
}

long int
get_adj_lsdb_num_element(void)
{
	long int num_element;


	struct hashtb_enumerator ee;
    	struct hashtb_enumerator *e = &ee;
    	
    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
	num_element=hashtb_n(nlsr->lsdb->adj_lsdb);
	hashtb_end(e);

	return num_element; 
}

void 
get_name_lsdb_summary(struct ccn_charbuf *name_lsdb_data)
{
	printf("get_name_lsdb_summary called \n");	
	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)
{
	printf("get_adj_lsdb_summary called \n");
	int i, adj_lsdb_element;
	struct alsa *adj_lsa;

	struct hashtb_enumerator ee;
    	struct hashtb_enumerator *e = &ee;
    	
    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
	adj_lsdb_element=hashtb_n(nlsr->lsdb->adj_lsdb);

	for(i=0;i<adj_lsdb_element;i++)
	{
		adj_lsa=e->data;

		ccn_charbuf_append_string(adj_lsdb_data,adj_lsa->header->orig_router->name);
		ccn_charbuf_append_string(adj_lsdb_data,"|");
		
		char *lst=(char *)malloc(20);
		memset(lst,0,20);
		sprintf(lst,"%d",adj_lsa->header->ls_type);
		ccn_charbuf_append_string(adj_lsdb_data,lst);
		free(lst);
		ccn_charbuf_append_string(adj_lsdb_data,"|");

		ccn_charbuf_append_string(adj_lsdb_data,adj_lsa->header->orig_time);
		ccn_charbuf_append_string(adj_lsdb_data,"|");

		hashtb_next(e);		
	}

	hashtb_end(e);
}


void 
get_lsdb_summary(struct ccn_charbuf *lsdb_data)
{
	struct ccn_charbuf *name_lsdb_data=ccn_charbuf_create();
	struct ccn_charbuf *adj_lsdb_data=ccn_charbuf_create();

	get_name_lsdb_summary(name_lsdb_data);
	get_adj_lsdb_summary(adj_lsdb_data);

	long int num_lsa=get_name_lsdb_num_element() + get_adj_lsdb_num_element();
	char *num_element=(char *)malloc(15);
	memset(num_element,0,15);
	sprintf(num_element,"%ld",num_lsa);

	if( num_lsa > 0)
	{
		ccn_charbuf_append_string(lsdb_data,num_element);
		ccn_charbuf_append_string(lsdb_data,"|");
	}
	if(name_lsdb_data->length>0)
	{
		char *data1=ccn_charbuf_as_string(name_lsdb_data);
		ccn_charbuf_append_string(lsdb_data,(char *)data1);
	}
	if(adj_lsdb_data->length>0)
	{
		char *data2=ccn_charbuf_as_string(adj_lsdb_data);
		ccn_charbuf_append_string(lsdb_data,(char *)data2);
	}
	ccn_charbuf_destroy(&name_lsdb_data);
	ccn_charbuf_destroy(&adj_lsdb_data);
	free(num_element);

}

int 
check_is_new_name_lsa(char *orig_router,char *lst,char *lsid,char *orig_time)
{
	int ret=0;
	struct ccn_charbuf *key=ccn_charbuf_create();
	ccn_charbuf_append_string(key,orig_router);
	ccn_charbuf_append_string(key,"/");
	ccn_charbuf_append_string(key,lst);
	ccn_charbuf_append_string(key,"/");
	ccn_charbuf_append_string(key,lsid);

	int res;
	struct nlsa *name_lsa;

	struct hashtb_enumerator ee;
    	struct hashtb_enumerator *e = &ee;

	hashtb_start(nlsr->lsdb->name_lsdb, e);
	res = hashtb_seek(e, ccn_charbuf_as_string(key), key->length, 0);

	if( res == HT_NEW_ENTRY )
	{
		hashtb_delete(e);
		ret=1;

	}
	else if(res == HT_OLD_ENTRY)
	{
		name_lsa=e->data;
		if( strcmp ( orig_time , name_lsa->header->orig_time ) > 0 )
		{
			ret=1;
		}
	}

	hashtb_end(e);

	ccn_charbuf_destroy(&key);
	
	return ret;
}

int 
check_is_new_adj_lsa(char *orig_router,char *lst,char *orig_time)
{
	int ret=0;
	struct ccn_charbuf *key=ccn_charbuf_create();
	ccn_charbuf_append_string(key,orig_router);
	ccn_charbuf_append_string(key,"/");
	ccn_charbuf_append_string(key,lst);

	int res;
	struct alsa *adj_lsa;

	struct hashtb_enumerator ee;
    	struct hashtb_enumerator *e = &ee;

	hashtb_start(nlsr->lsdb->adj_lsdb, e);
	res = hashtb_seek(e, ccn_charbuf_as_string(key), key->length, 0);

	if( res == HT_NEW_ENTRY )
	{
		hashtb_delete(e);
		ret=1;

	}
	else if(res == HT_OLD_ENTRY)
	{
		adj_lsa=e->data;
		if( strcmp ( orig_time , adj_lsa->header->orig_time ) > 0 )
		{
			ret=1;
		}
	}

	hashtb_end(e);
	
	ccn_charbuf_destroy(&key);

	return ret;
}

void 
get_name_lsa_data(struct ccn_charbuf *lsa_data, struct name_prefix *lsaId)
{
	printf("get_name_lsa_data called \n");

	struct nlsa *name_lsa=(struct nlsa*)malloc(sizeof(struct nlsa ));

	struct hashtb_enumerator ee;
    	struct hashtb_enumerator *e = &ee; 	
    	int res;

   	hashtb_start(nlsr->lsdb->name_lsdb, e);
    	res = hashtb_seek(e, lsaId->name, lsaId->length-1, 0);

	if( res == HT_OLD_ENTRY )
	{
		name_lsa=e->data;
		printf("NAME LSA found\n");

		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)
{
	printf("get_adj_lsa_data called \n");

	struct alsa *adj_lsa=(struct alsa*)malloc(sizeof(struct alsa ));

	struct hashtb_enumerator ee;
    	struct hashtb_enumerator *e = &ee; 	
    	int res;

   	hashtb_start(nlsr->lsdb->adj_lsdb, e);
    	res = hashtb_seek(e, lsaId->name, lsaId->length-1, 0);

	if( res == HT_OLD_ENTRY )
	{
		adj_lsa=e->data;
		printf("NAME LSA found\n");

		ccn_charbuf_append_string(lsa_data,adj_lsa->header->orig_router->name);
		ccn_charbuf_append_string(lsa_data,"|");

		char *temp_length=(char *)malloc(20);
		memset(temp_length,0,20);
		sprintf(temp_length,"%d",adj_lsa->header->orig_router->length);
		ccn_charbuf_append_string(lsa_data,temp_length);
		free(temp_length);
		ccn_charbuf_append_string(lsa_data,"|");

		char *temp_ltype=(char *)malloc(20);
		memset(temp_ltype,0,20);
		sprintf(temp_ltype,"%d",adj_lsa->header->ls_type);
		ccn_charbuf_append_string(lsa_data,temp_ltype);
		free(temp_ltype);
		ccn_charbuf_append_string(lsa_data,"|");

		ccn_charbuf_append_string(lsa_data,adj_lsa->header->orig_time);
		ccn_charbuf_append_string(lsa_data,"|");

		char *temp_nl=(char *)malloc(20);
		memset(temp_nl,0,20);
		sprintf(temp_nl,"%d",adj_lsa->no_link);
		ccn_charbuf_append_string(lsa_data,temp_nl);
		free(temp_nl);
		ccn_charbuf_append_string(lsa_data,"|");

		ccn_charbuf_append_string(lsa_data,adj_lsa->body);


	}
	else if(res == HT_NEW_ENTRY)
	{
		hashtb_delete(e);
	}

	hashtb_end(e);
}

int 
delete_name_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
{
	printf("delete_name_lsa called \n");
	
	if(flags == CCN_SCHEDULE_CANCEL)
	{
 	 	return -1;
	}



	nlsr_lock();

	printf("LSA Key: %s \n",(char *)ev->evdata);

	struct nlsa *nlsa;

	struct hashtb_enumerator ee;
    	struct hashtb_enumerator *e = &ee;
	 	
    	int res;

   	hashtb_start(nlsr->lsdb->name_lsdb, e);
    	res = hashtb_seek(e, (char *)ev->evdata, strlen((char *)ev->evdata), 0);

	if( res == HT_OLD_ENTRY )
	{
		nlsa=e->data;
		delete_npt_entry(nlsa->header->orig_router->name, nlsa->name_prefix->name);
		hashtb_delete(e);
	}
	else if( res == HT_OLD_ENTRY )
	{
		nlsa=e->data;	
		delete_npt_entry(nlsa->header->orig_router->name, nlsa->name_prefix->name);
		hashtb_delete(e);
	}
	hashtb_end(e);
	
	
	printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
	set_new_lsdb_version();	
	printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
	
	//print_name_lsdb();
	
	nlsr_unlock();

	return 0;
}

int 
delete_adj_lsa(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
{
	printf("delete_adj_lsa called \n");
	
	if(flags == CCN_SCHEDULE_CANCEL)
	{
 	 	return -1;
	}
	nlsr_lock();

	printf("LSA Key: %s \n",(char *)ev->evdata);

	struct hashtb_enumerator ee;
    	struct hashtb_enumerator *e = &ee; 	
    	int res;

   	hashtb_start(nlsr->lsdb->adj_lsdb, e);
    	res = hashtb_seek(e, (char *)ev->evdata, strlen((char *)ev->evdata), 0);

	if( res == HT_OLD_ENTRY )
	{
		hashtb_delete(e);
	}
	else if( res == HT_OLD_ENTRY )
	{
		hashtb_delete(e);
	}
	hashtb_end(e);

	printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
	set_new_lsdb_version();	
	printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);

	if ( !nlsr->is_route_calculation_scheduled)
	{
		nlsr->event_calculate_route = ccn_schedule_event(nlsr->sched, 1000000, &route_calculate, NULL, 0);
		nlsr->is_route_calculation_scheduled=1;
	}

	//print_adj_lsdb();

	nlsr_unlock();

	return 0;
}

void
refresh_name_lsdb(void)
{
	printf("refresh_name_lsdb called \n");

	//int lsa_change_count=0;

	char *time_stamp=(char *)malloc(20);
	memset(time_stamp,0,20);
	get_current_timestamp_micro(time_stamp);
	
	long int lsa_life_time;
		
	int i, name_lsdb_element;
	struct nlsa *name_lsa;

	struct hashtb_enumerator ee;
    	struct hashtb_enumerator *e = &ee;
    	
    	hashtb_start(nlsr->lsdb->name_lsdb, e);
	name_lsdb_element=hashtb_n(nlsr->lsdb->name_lsdb);

	for(i=0;i<name_lsdb_element;i++)
	{
		name_lsa=e->data;

		lsa_life_time=get_time_diff(time_stamp,name_lsa->header->orig_time);
		printf("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 )					
				{
					printf("Own Name LSA need to be refrshed\n");
					char *current_time_stamp=(char *)malloc(20);
					memset(current_time_stamp,0,20);
					get_current_timestamp_micro(current_time_stamp);

					free(name_lsa->header->orig_time);
					name_lsa->header->orig_time=(char *)malloc(strlen(current_time_stamp)+1); //free 
					memset(name_lsa->header->orig_time,0,strlen(current_time_stamp)+1);
					memcpy(name_lsa->header->orig_time,current_time_stamp,strlen(current_time_stamp)+1);
	
					free(current_time_stamp);
				}
				else 
				{
					char lst[2];
					memset(lst,0,2);
					sprintf(lst,"%d",name_lsa->header->ls_type);	

					char lsid[10];
					memset(lsid,0,10);
					sprintf(lsid,"%ld",name_lsa->header->ls_id);
	
	
					char *key=(char *)malloc(strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
					memset(key,0,strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);


					make_name_lsa_key(key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id);	
					printf("Key:%s Length:%d\n",key,(int)strlen(key));
				
					nlsr->event = ccn_schedule_event(nlsr->sched, 10, &delete_name_lsa, (void *)key, 0);
				}

				printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
				set_new_lsdb_version();	
				printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);				

				print_name_lsdb();
				//lsa_change_count++;
			}	
		}
		else 
		{
			if ( lsa_life_time > nlsr->router_dead_interval )
			{
				printf("Others Name LSA need to be deleted\n");

				char lst[2];
				memset(lst,0,2);
				sprintf(lst,"%d",name_lsa->header->ls_type);	

				char lsid[10];
				memset(lsid,0,10);
				sprintf(lsid,"%ld",name_lsa->header->ls_id);
	
	
				char *key=(char *)malloc(strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);
				memset(key,0,strlen(name_lsa->header->orig_router->name)+1+strlen(lst)+1+strlen(lsid)+1);


				make_name_lsa_key(key, name_lsa->header->orig_router->name,name_lsa->header->ls_type,name_lsa->header->ls_id);	
				printf("Key:%s Length:%d\n",key,(int)strlen(key));
				
				nlsr->event = ccn_schedule_event(nlsr->sched, 10, &delete_name_lsa, (void *)key, 0);
				//lsa_change_count++;
			}
		}

		hashtb_next(e);		
	}

	hashtb_end(e);
	
	free(time_stamp);

	
}

void
refresh_adj_lsdb(void)
{
	printf("refresh_adj_lsdb called \n");


	char *time_stamp=(char *)malloc(20);
	memset(time_stamp,0,20);
	get_current_timestamp_micro(time_stamp);
	
	long int lsa_life_time;
		
	int i, adj_lsdb_element;
	struct alsa *adj_lsa;

	struct hashtb_enumerator ee;
    	struct hashtb_enumerator *e = &ee;
    	
    	hashtb_start(nlsr->lsdb->adj_lsdb, e);
	adj_lsdb_element=hashtb_n(nlsr->lsdb->adj_lsdb);

	for(i=0;i<adj_lsdb_element;i++)
	{
		adj_lsa=e->data;

		lsa_life_time=get_time_diff(time_stamp,adj_lsa->header->orig_time);
		printf("LSA Life Time: %ld \n",lsa_life_time);			

		if ( strcmp(adj_lsa->header->orig_router->name,nlsr->router_name) == 0)
		{
			if ( lsa_life_time > nlsr->lsa_refresh_time )
			{
				printf("Own Adj LSA need to be refrshed\n");

				char *current_time_stamp=(char *)malloc(20);
				memset(current_time_stamp,0,20);
				get_current_timestamp_micro(current_time_stamp);

				free(adj_lsa->header->orig_time);
				adj_lsa->header->orig_time=(char *)malloc(strlen(current_time_stamp)+1); //free 
				memset(adj_lsa->header->orig_time,0,strlen(current_time_stamp)+1);
				memcpy(adj_lsa->header->orig_time,current_time_stamp,strlen(current_time_stamp)+1);
	
				free(current_time_stamp);


				printf("Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
				set_new_lsdb_version();	
				printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);

				print_adj_lsdb();
			}	
		}
		else 
		{
			if ( lsa_life_time > nlsr->router_dead_interval )
			{
				printf("Others Adj LSA need to be deleted\n");
				
				char *key=(char *)malloc(adj_lsa->header->orig_router->length+2+2);
				memset(key,0,adj_lsa->header->orig_router->length+2);
				make_adj_lsa_key(key,adj_lsa);
				printf("Adjacent LSA key: %s \n",key);				
				nlsr->event = ccn_schedule_event(nlsr->sched, 10, &delete_adj_lsa, (void *)key, 0);
			}
		}

		

		hashtb_next(e);		
	}

	hashtb_end(e);
	
	free(time_stamp);
}

int
refresh_lsdb(struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
{
	if(flags == CCN_SCHEDULE_CANCEL)
	{
 	 	return -1;
	}

	nlsr_lock();

	printf("refresh_lsdb called \n");
	
	refresh_name_lsdb();
	refresh_adj_lsdb();

	nlsr->event = ccn_schedule_event(nlsr->sched, 60000000, &refresh_lsdb, NULL, 0);
	
	nlsr_unlock();
	return 0;
}
