Formatting nlsr_lsdb
diff --git a/nlsr_adl.c b/nlsr_adl.c
index 0c86785..947d5ac 100644
--- a/nlsr_adl.c
+++ b/nlsr_adl.c
@@ -31,7 +31,7 @@
void
add_nbr_to_adl(struct name_prefix *new_nbr,int face,char *ip)
{
- struct ndn_neighbor *nbr=(struct ndn_neighbor *)malloc(sizeof(struct ndn_neighbor )); //free
+ struct ndn_neighbor *nbr;//=(struct ndn_neighbor *)malloc(sizeof(struct ndn_neighbor )); //free
struct hashtb_enumerator ee;
struct hashtb_enumerator *e = ⅇ
diff --git a/nlsr_lsdb.c b/nlsr_lsdb.c
index edf5728..1b0b400 100644
--- a/nlsr_lsdb.c
+++ b/nlsr_lsdb.c
@@ -251,7 +251,7 @@
if ( nlsr->detailed_logging )
writeLogg(__FILE__,__FUNCTION__,__LINE__,"Key:%s Length:%d\n",key,(int)strlen(key));
- struct nlsa *new_name_lsa=(struct nlsa*)malloc(sizeof(struct nlsa ));
+ struct nlsa *new_name_lsa; //=(struct nlsa*)malloc(sizeof(struct nlsa ));
struct hashtb_enumerator ee;
struct hashtb_enumerator *e = ⅇ
@@ -270,13 +270,13 @@
new_name_lsa = e->data;
-
+
new_name_lsa->header=(struct nlsa_header *)malloc(sizeof(struct nlsa_header ));
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));
+ 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 ));
@@ -290,6 +290,7 @@
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;
+
if ( nlsr->debugging )
{
@@ -830,7 +831,7 @@
memset(key,0,adj_lsa->header->orig_router->length+2);
make_adj_lsa_key(key,adj_lsa);
- struct alsa *new_adj_lsa=(struct alsa*)malloc(sizeof(struct alsa ));
+ struct alsa *new_adj_lsa;//=(struct alsa*)malloc(sizeof(struct alsa ));
struct hashtb_enumerator ee;
struct hashtb_enumerator *e = ⅇ
@@ -1349,7 +1350,7 @@
if ( nlsr->detailed_logging )
writeLogg(__FILE__,__FUNCTION__,__LINE__,"get_name_lsa_data called \n");
- struct nlsa *name_lsa=(struct nlsa*)malloc(sizeof(struct nlsa ));
+ struct nlsa *name_lsa;//=(struct nlsa*)malloc(sizeof(struct nlsa ));
struct hashtb_enumerator ee;
struct hashtb_enumerator *e = ⅇ
@@ -2122,7 +2123,7 @@
refresh_name_lsdb();
refresh_adj_lsdb();
- refresh_cor_lsdb();
+ //refresh_cor_lsdb();
nlsr->event = ccn_schedule_event(nlsr->sched, 60000000, &refresh_lsdb, NULL, 0);
@@ -2145,7 +2146,7 @@
write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_content_prefix);
- ccn_charbuf_destroy(&lsa_data);
+ //ccn_charbuf_destroy(&lsa_data);
}
void
@@ -2164,7 +2165,7 @@
write_data_to_repo(ccn_charbuf_as_string(lsa_data), repo_content_prefix);
- ccn_charbuf_destroy(&lsa_data);
+ //ccn_charbuf_destroy(&lsa_data);
}
@@ -2311,7 +2312,7 @@
if ( nlsr->debugging )
printf("New Cor LSA... \n");
- struct clsa *new_cor_lsa=(struct clsa *)malloc(sizeof( struct clsa ));
+ struct clsa *new_cor_lsa;//=(struct clsa *)malloc(sizeof( struct clsa ));
new_cor_lsa=e->data;
new_cor_lsa->header=(struct alsa_header *)malloc(sizeof(struct alsa_header ));
@@ -2532,7 +2533,7 @@
free(lst);
free(key);
free(repo_key);
- ccn_charbuf_destroy(&lsa_data);
+ //ccn_charbuf_destroy(&lsa_data);
}
void
diff --git a/nlsr_sync.c b/nlsr_sync.c
index f528ba1..efebcbb 100644
--- a/nlsr_sync.c
+++ b/nlsr_sync.c
@@ -142,7 +142,7 @@
- void
+void
get_name_part(struct name_prefix *name_part,struct ccn_charbuf * interest_ccnb,
struct ccn_indexbuf *interest_comps, int offset)
{
diff --git a/utility.c b/utility.c
index f04ba39..0c0be75 100644
--- a/utility.c
+++ b/utility.c
@@ -35,7 +35,7 @@
char * getLocalTimeStamp(void)
{
- char *timestamp = (char *)malloc(sizeof(char) * 16);
+ char *timestamp = (char *)malloc(sizeof(char) * 20);
time_t ltime;
ltime=time(NULL);
struct tm *tm;
@@ -49,7 +49,7 @@
char * getGmTimeStamp(void)
{
- char *timestamp = (char *)malloc(sizeof(char) * 16);
+ char *timestamp = (char *)malloc(sizeof(char) * 20);
time_t gtime;
gtime=time(NULL);
struct tm *tm;