Adding Validity Check & Content Name format
diff --git a/nlsr-sync-0.0/macbook.conf b/nlsr-sync-0.0/macbook.conf
index 18f9537..9e5835c 100755
--- a/nlsr-sync-0.0/macbook.conf
+++ b/nlsr-sync-0.0/macbook.conf
@@ -8,15 +8,15 @@
ccnname /ndn/memphis.edu/macbook/patterson
ccnname /ndn/memphis.edu/macbook/houston/
#------lsdb-synch-interval-----
-lsdb-synch-interval 350
+#lsdb-synch-interval 350
interest-retry 2
interest-resend-time 5
lsa-refresh-time 600
router-dead-interval 900
-multi-path-face-num 2
+max_faces_per_prefix 1
debug on
-hyperbolic-routing on
-hyperbolic-cordinate 1234.0 0.875
+#hyperbolic-routing on
+#hyperbolic-cordinate 1234.0 0.875
tunnel-type udp
topo-prefix /ndn/routing/nlsr/
diff --git a/nlsr-sync-0.0/nlsr.c b/nlsr-sync-0.0/nlsr.c
index 9ba67c6..351554f 100755
--- a/nlsr-sync-0.0/nlsr.c
+++ b/nlsr-sync-0.0/nlsr.c
@@ -278,6 +278,7 @@
}
+/*
void
process_command_lsdb_synch_interval(char *command)
{
@@ -305,7 +306,7 @@
}
}
-
+*/
void
process_command_interest_retry(char *command)
@@ -706,10 +707,10 @@
{
process_command_ccnname(remainder);
}
- else if(!strcmp(cmd_type,"lsdb-synch-interval") )
+ /*else if(!strcmp(cmd_type,"lsdb-synch-interval") )
{
process_command_lsdb_synch_interval(remainder);
- }
+ }*/
else if(!strcmp(cmd_type,"interest-retry") )
{
process_command_interest_retry(remainder);
@@ -1052,6 +1053,23 @@
return 0;
}
+int
+check_config_validity()
+{
+ if (nlsr->router_name == NULL )
+ {
+ fprintf(stderr,"Router name has not been configured :(\n");
+ return -1;
+ }
+ if ( nlsr->is_hyperbolic_calc == 1 && (nlsr->cor_r == -1.0 && nlsr->cor_theta== -1.0) )
+ {
+ fprintf(stderr,"Hyperbolic codinate has not been defined :(\n");
+ return -1;
+ }
+
+ return 0;
+}
+
void
nlsr_destroy( void )
{
@@ -1214,7 +1232,7 @@
nlsr->detailed_logging=0;
nlsr->debugging=0;
- nlsr->lsdb_synch_interval = LSDB_SYNCH_INTERVAL;
+ //nlsr->lsdb_synch_interval = LSDB_SYNCH_INTERVAL;
nlsr->interest_retry = INTEREST_RETRY;
nlsr->interest_resend_time = INTEREST_RESEND_TIME;
nlsr->lsa_refresh_time=LSA_REFRESH_TIME;
@@ -1279,11 +1297,8 @@
readConfigFile(config_file);
- if ( nlsr->is_hyperbolic_calc == 1 && (nlsr->cor_r == -1.0 && nlsr->cor_theta== -1.0) )
- {
- fprintf(stderr,"Hyperbolic codinate has not been defined :(\n");
- ON_ERROR_DESTROY(-1);
- }
+ ON_ERROR_DESTROY(check_config_validity());
+
print_adjacent_from_adl();
if ( daemon_mode == 1 )
@@ -1349,7 +1364,10 @@
print_name_lsdb();
- build_and_install_cor_lsa();
+ if ( nlsr->cor_r != -1.0 && nlsr->cor_theta== -1.0)
+ {
+ build_and_install_cor_lsa();
+ }
write_name_lsdb_to_repo(nlsr->slice_prefix);
nlsr->sched = ccn_schedule_create(nlsr, &ndn_rtr_ticker);
diff --git a/nlsr-sync-0.0/nlsr.h b/nlsr-sync-0.0/nlsr.h
index dcaf947..681973b 100755
--- a/nlsr-sync-0.0/nlsr.h
+++ b/nlsr-sync-0.0/nlsr.h
@@ -83,7 +83,7 @@
int is_send_lsdb_interest_scheduled;
int is_route_calculation_scheduled;
- long int lsdb_synch_interval;
+ //long int lsdb_synch_interval;
int interest_retry;
long int interest_resend_time;
long int lsa_refresh_time;
diff --git a/nlsr-sync-0.0/nlsr_lsdb.c b/nlsr-sync-0.0/nlsr_lsdb.c
index 0275e1f..00bb5b1 100755
--- a/nlsr-sync-0.0/nlsr_lsdb.c
+++ b/nlsr-sync-0.0/nlsr_lsdb.c
@@ -2320,6 +2320,8 @@
build_and_install_cor_lsa()
{
+
+
struct clsa *cor_lsa=(struct clsa *)malloc(sizeof( struct clsa ));
build_cor_lsa(cor_lsa,nlsr->cor_r,nlsr->cor_theta);
diff --git a/nlsr-sync-0.0/nlsr_ndn.c b/nlsr-sync-0.0/nlsr_ndn.c
index 6ad79d5..258c954 100755
--- a/nlsr-sync-0.0/nlsr_ndn.c
+++ b/nlsr-sync-0.0/nlsr_ndn.c
@@ -313,9 +313,9 @@
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);
+ char *raw_data=(char *)malloc(20);
+ memset(raw_data,0,20);
+ sprintf(raw_data,"%s", nlsr->lsdb->lsdb_version);
res= ccn_sign_content(nlsr->ccn, data, name, &sp, raw_data,strlen(raw_data));
if(res >= 0)
@@ -484,17 +484,17 @@
writeLogg(__FILE__,__FUNCTION__,__LINE__,"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);
+ //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);
- long int interval=atoi((char *)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);
+ //update_lsdb_synch_interval_to_adl(nbr,interval);
print_adjacent_from_adl();