Updates in ccn_seqw
diff --git a/nlsr-sync-0.0/Makefile b/nlsr-sync-0.0/Makefile
index abe7b08..313a3ac 100755
--- a/nlsr-sync-0.0/Makefile
+++ b/nlsr-sync-0.0/Makefile
@@ -26,7 +26,7 @@
clean:
rm -f *.o
rm -f $(PROGRAMS)
- rm -rf $(PROGRAMS).dSYM
+ rm -rf *.dSYM
.c.o:
$(CC) $(CFLAGS) -c $<
diff --git a/nlsr-sync-0.0/macbook.conf b/nlsr-sync-0.0/macbook.conf
index 4150a56..3cebed4 100755
--- a/nlsr-sync-0.0/macbook.conf
+++ b/nlsr-sync-0.0/macbook.conf
@@ -15,7 +15,7 @@
multi-path-face-num 2
debug on
-topo-prefix /ndn/test/topo
-slice-prefix /ndn/test/slice
+topo-prefix /ndn/routing/nlsr
+slice-prefix /ndn/routing/nlsr/LSA
logdir /Users/akmhoque/NLSR2.0
diff --git a/nlsr-sync-0.0/nlsr.c b/nlsr-sync-0.0/nlsr.c
index 5a89109..5c9afef 100755
--- a/nlsr-sync-0.0/nlsr.c
+++ b/nlsr-sync-0.0/nlsr.c
@@ -548,6 +548,9 @@
{
if( nlsr->topo_prefix != NULL)
free(nlsr->topo_prefix);
+ if ( topo_prefix[strlen(topo_prefix)-1] == '/' )
+ topo_prefix[strlen(topo_prefix)-1]='\0';
+
nlsr->topo_prefix=(char *)malloc(strlen(topo_prefix)+1);
//nlsr->topo_prefix=(char *)calloc(strlen(topo_prefix)+1, sizeof(char));
memset(nlsr->topo_prefix,0,strlen(topo_prefix)+1);
@@ -582,6 +585,9 @@
{
if ( nlsr->slice_prefix != NULL)
free(nlsr->slice_prefix);
+ if ( slice_prefix[strlen(slice_prefix)-1] == '/' )
+ slice_prefix[strlen(slice_prefix)-1]='\0';
+
nlsr->slice_prefix=(char *)malloc(strlen(slice_prefix)+1);
memset(nlsr->slice_prefix,0,strlen(slice_prefix)+1);
memcpy(nlsr->slice_prefix,slice_prefix,strlen(slice_prefix));
diff --git a/nlsr-sync-0.0/nlsr_lsdb.c b/nlsr-sync-0.0/nlsr_lsdb.c
index 8692eca..a2995d3 100755
--- a/nlsr-sync-0.0/nlsr_lsdb.c
+++ b/nlsr-sync-0.0/nlsr_lsdb.c
@@ -68,23 +68,7 @@
void
make_name_lsa_prefix_for_repo(char *key, char *orig_router, int ls_type, long int ls_id,char *orig_time,char *slice_prefix)
{
-
- /*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),slice_prefix,strlen(slice_prefix));
- memcpy(key+strlen(key),lst,strlen(lst));
- memcpy(key+strlen(key),"/",1);
- memcpy(key+strlen(key),lsid,strlen(lsid));
- memcpy(key+strlen(key),"/",1);
- memcpy(key+strlen(key),orig_time,strlen(orig_time));
- memcpy(key+strlen(key),orig_router,strlen(orig_router));
- */
- sprintf(key,"%s%d/%d/%s%s",slice_prefix, ls_type, ls_id, orig_time, orig_router);
+ sprintf(key,"%s/%d/%ld/%s%s",slice_prefix, ls_type, ls_id, orig_time, orig_router);
printf("%s\n",key);
}
@@ -104,7 +88,7 @@
memcpy(key+strlen(key),orig_time,strlen(orig_time));
memcpy(key+strlen(key),orig_router,strlen(orig_router));
*/
- sprintf(key,"%s%d/%s%s",slice_prefix,ls_type, orig_time, orig_router);
+ sprintf(key,"%s/%d/%s%s",slice_prefix,ls_type, orig_time, orig_router);
printf("Key:%s\n",key);
}
@@ -2082,7 +2066,7 @@
void
write_name_lsa_to_repo(char *repo_content_prefix, struct name_prefix *lsa_id)
{
- printf("****Content Prefix: %s\n",repo_content_prefix);
+ printf("Content Prefix: %s\n",repo_content_prefix);
struct ccn_charbuf *lsa_data=ccn_charbuf_create();
get_name_lsa_data(lsa_data,lsa_id);
diff --git a/nlsr-sync-0.0/nlsr_sync.c b/nlsr-sync-0.0/nlsr_sync.c
index 6d5c562..d2ba580 100644
--- a/nlsr-sync-0.0/nlsr_sync.c
+++ b/nlsr-sync-0.0/nlsr_sync.c
@@ -71,7 +71,7 @@
free(hexR);
ccn_charbuf_destroy(&uri);
//--Doing ourthing from here
- struct ccn_indexbuf cid={0};
+ struct ccn_indexbuf cid={0};
struct ccn_indexbuf *components=&cid;
ccn_name_split (name, components);
@@ -594,6 +594,7 @@
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);
@@ -603,9 +604,10 @@
}
- ccn_run(nlsr->ccn, 1);
+ //ccn_run(nlsr->ccn, 1);
ccn_seqw_close(w);
+ ccn_run(nlsr->ccn, 1);
//ccn_charbuf_destroy(&buf);
ccn_charbuf_destroy(&name);
}
diff --git a/nlsr-sync-0.0/nlsr_sync.h b/nlsr-sync-0.0/nlsr_sync.h
index 8bb49d8..ef9d342 100644
--- a/nlsr-sync-0.0/nlsr_sync.h
+++ b/nlsr-sync-0.0/nlsr_sync.h
@@ -5,5 +5,6 @@
void write_data_to_repo(char *data,char *name_prefix);
int create_sync_slice(char *topo_prefix, char *slice_prefix);
void get_host_name_from_command_string(struct name_prefix *name_part,char *nbr_name_uri, int offset);
+void process_content_from_sync(struct ccn_charbuf *content_name, struct ccn_indexbuf *components);
#endif