Adding Adj LSA to Repo
diff --git a/nlsr-sync-0.0/nlsr_lsdb.c b/nlsr-sync-0.0/nlsr_lsdb.c
index decf4eb..85180d6 100755
--- a/nlsr-sync-0.0/nlsr_lsdb.c
+++ b/nlsr-sync-0.0/nlsr_lsdb.c
@@ -673,28 +673,6 @@
memset(lst,0,2);
sprintf(lst,"%d",LS_TYPE_ADJ);
- /*
- char *repo_con_name=(char *)malloc(strlen(nlsr->slice_prefix)+strlen(adj_lsa->header->orig_time)+strlen(adj_lsa->header->orig_router->name) + strlen(lst) + 5);
- memset(repo_con_name, 0, strlen(nlsr->slice_prefix)+strlen(adj_lsa->header->orig_time)+strlen(adj_lsa->header->orig_router->name) + strlen(lst) + 5);
- make_adj_lsa_prefix_for_repo(repo_con_name, adj_lsa->header->orig_router->name,LS_TYPE_ADJ,adj_lsa->header->orig_time,nlsr->slice_prefix);
- if ( nlsr->debugging )
- printf("Adj LSA Repo Key: %s \n",repo_con_name);
-
- char *key=(char *)malloc(adj_lsa->header->orig_router->length+2+2);
- memset(key,0,adj_lsa->header->orig_router->length+2+2);
- make_adj_lsa_key(key,adj_lsa);
- if ( nlsr->debugging )
- printf("Adj LSA: %s \n",key);
- struct name_prefix *lsaid=(struct name_prefix *)malloc(sizeof(struct name_prefix));
- lsaid->name=(char *)malloc(strlen(key)+1);
- memset(lsaid->name, 0, strlen(key)+1);
- memcpy(lsaid->name,key,strlen(key));
- lsaid->length=strlen(key)+1;
-
-
- write_adj_lsa_to_repo(repo_con_name, lsaid);
- */
-
char *repo_key=(char *)malloc(strlen(nlsr->slice_prefix)+strlen(adj_lsa->header->orig_time)+strlen(adj_lsa->header->orig_router->name) + strlen(lst) + 5);
memset(repo_key, 0, strlen(nlsr->slice_prefix)+strlen(adj_lsa->header->orig_time)+strlen(adj_lsa->header->orig_router->name) + strlen(lst) + 5);
make_adj_lsa_prefix_for_repo(repo_key, adj_lsa->header->orig_router->name,LS_TYPE_ADJ,adj_lsa->header->orig_time,nlsr->slice_prefix);
diff --git a/nlsr-sync-0.0/nlsr_sync.c b/nlsr-sync-0.0/nlsr_sync.c
index b1ff036..caa886a 100644
--- a/nlsr-sync-0.0/nlsr_sync.c
+++ b/nlsr-sync-0.0/nlsr_sync.c
@@ -548,6 +548,12 @@
void
write_data_to_repo(char *data, char *name_prefix)
{
+ if ( nlsr->debugging )
+ {
+ printf("write_data_to_repo called\n");
+ prtinf("Content Name: %s \n",name_prefix);
+ printf("Content Data: %s \n",data);
+ }
struct ccn_charbuf *name = NULL;
struct ccn_seqwriter *w = NULL;
@@ -594,29 +600,21 @@
blockread = 0;
- //struct ccn_charbuf *buf=ccn_charbuf_create();
- //get_name_lsdb_summary(buf);
- //blockread=buf->length;
+
blockread=strlen(data);
if (blockread > 0) {
- //res = ccn_seqw_write(w, ccn_charbuf_as_string(buf), blockread);
ccn_run(nlsr->ccn, 100);
res = ccn_seqw_write(w, data, blockread);
- while (res == -1) {
- ccn_run(nlsr->ccn, 100);
- //res = ccn_seqw_write(w, ccn_charbuf_as_string(buf), blockread);
- res = ccn_seqw_write(w, data, blockread);
- }
+ while (res == -1) {
+ ccn_run(nlsr->ccn, 100);
+ res = ccn_seqw_write(w, data, blockread);
+ }
}
-
- //ccn_run(nlsr->ccn, 1);
-
ccn_seqw_close(w);
- ccn_run(nlsr->ccn, 1);
- //ccn_charbuf_destroy(&buf);
+ //ccn_run(nlsr->ccn, 1);
ccn_charbuf_destroy(&name);
}