Change in sync_monitor function
diff --git a/nlsr_lsdb.c b/nlsr_lsdb.c
index 1a06889..46a9428 100644
--- a/nlsr_lsdb.c
+++ b/nlsr_lsdb.c
@@ -149,12 +149,12 @@
install_name_lsa(name_lsa);
update_nlsa_id_for_name_in_npl(npe->np,name_lsa->header->ls_id);
- 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);
+ //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);
}
@@ -182,11 +182,11 @@
install_name_lsa(name_lsa);
update_nlsa_id_for_name_in_npl(np,name_lsa->header->ls_id);
- 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->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);
print_name_prefix_from_npl();
@@ -229,9 +229,9 @@
install_name_lsa(struct nlsa *name_lsa)
{
- char *time_stamp=(char *)malloc(20);
+ /*char *time_stamp=(char *)malloc(20);
memset(time_stamp,0,20);
- get_current_timestamp_micro(time_stamp);
+ get_current_timestamp_micro(time_stamp);*/
char lst[2];
@@ -270,7 +270,9 @@
new_name_lsa = e->data;
+ //memcpy(e->data, name_lsa, sizeof(name_lsa));
+
new_name_lsa->header=(struct nlsa_header *)malloc(sizeof(struct nlsa_header ));
new_name_lsa->header->ls_type=name_lsa->header->ls_type;
@@ -302,7 +304,9 @@
writeLogg(__FILE__,__FUNCTION__,__LINE__,"New Name LSA Added....\n");
writeLogg(__FILE__,__FUNCTION__,__LINE__,"Old Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
}
+
set_new_lsdb_version();
+
if ( nlsr->debugging )
printf("New Version Number of LSDB: %s \n",nlsr->lsdb->lsdb_version);
if ( nlsr->detailed_logging )
@@ -355,10 +359,10 @@
writeLogg(__FILE__,__FUNCTION__,__LINE__," Name-LSA\n");
writeLogg(__FILE__,__FUNCTION__,__LINE__," Adding name lsa\n");
- write_log_for_name_lsa(new_name_lsa);
+ //write_log_for_name_lsa(new_name_lsa);
writeLogg(__FILE__,__FUNCTION__,__LINE__," name_lsa_end\n");
- free(time_stamp);
+ //free(time_stamp);
}
else if(res == HT_OLD_ENTRY)
diff --git a/nlsr_sync.c b/nlsr_sync.c
index 4130b9f..e6c5e83 100644
--- a/nlsr_sync.c
+++ b/nlsr_sync.c
@@ -52,31 +52,6 @@
struct ccn_charbuf *name)
{
int res;
- /*char *hexL;
- char *hexR;
- struct ccn_charbuf *uri = ccn_charbuf_create();
- if (lhash == NULL || lhash->length == 0) {
- hexL = strdup("none");
- } else
- hexL = hex_string(lhash->buf, lhash->length);
- if (rhash == NULL || rhash->length == 0) {
- hexR = strdup("none");
- } else
- hexR = hex_string(rhash->buf, rhash->length);
- if (name != NULL)
- ccn_uri_append(uri, name->buf, name->length, 1);
- else
- ccn_charbuf_append_string(uri, "(null)");
-
- if ( nlsr->debugging )
- printf("Response from sync in the name: %s \n",ccn_charbuf_as_string(uri));
-
- fflush(stdout);
- free(hexL);
- free(hexR);
- ccn_charbuf_destroy(&uri);
- */
-
//--Doing our thing from here
//struct ccn_indexbuf cid={0};
@@ -555,18 +530,19 @@
free(time_stamp);
}
- int
+int
sync_monitor(char *topo_prefix, char *slice_prefix)
{
- static struct ccns_name_closure nc={0};
- nlsr->closure = &nc;
+ //static struct ccns_name_closure nc={0};
+ //nlsr->closure = &nc;
+ nlsr->closure=(struct ccns_name_closure *)calloc(1,sizeof(struct ccns_name_closure));
struct ccn_charbuf *prefix = ccn_charbuf_create();
- struct ccn_charbuf *roothash = NULL;
+ //struct ccn_charbuf *roothash = NULL;
struct ccn_charbuf *topo = ccn_charbuf_create();
nlsr->slice = ccns_slice_create();
- ccn_charbuf_reset(prefix);
- ccn_charbuf_reset(topo);
+ //ccn_charbuf_reset(prefix);
+ //ccn_charbuf_reset(topo);
ccn_charbuf_reset(prefix);
ccn_name_from_uri(prefix, slice_prefix);
@@ -576,16 +552,16 @@
ccns_slice_set_topo_prefix(nlsr->slice, topo, prefix);
nlsr->closure->callback = &sync_cb;
- nlsr->ccns = ccns_open(nlsr->ccn, nlsr->slice, nlsr->closure, roothash, NULL);
+ nlsr->ccns = ccns_open(nlsr->ccn, nlsr->slice, nlsr->closure, NULL, NULL);
//01/31/2013
- ccn_charbuf_destroy(&prefix);
- ccn_charbuf_destroy(&topo);
- ccn_charbuf_destroy(&roothash);
+ //ccn_charbuf_destroy(&prefix);
+ //ccn_charbuf_destroy(&topo);
+ //ccn_charbuf_destroy(&roothash);
return 0;
}
- struct ccn_charbuf *
+struct ccn_charbuf *
make_template(int scope)
{
struct ccn_charbuf *templ = NULL;
@@ -599,7 +575,7 @@
return(templ);
}
- int
+int
write_data_to_repo(char *data, char *name_prefix)
{
if ( nlsr->debugging )