Update in Utility
diff --git a/nlsr.c b/nlsr.c
index 57f0d1d..f5a826f 100644
--- a/nlsr.c
+++ b/nlsr.c
@@ -304,10 +304,12 @@
hnbr->neighbor=(struct name_prefix *)malloc(sizeof(struct name_prefix *));
hnbr->neighbor->name=(char *)malloc(nbr->neighbor->length);
memcpy(hnbr->neighbor->name,nbr->neighbor->name,nbr->neighbor->length);
+ hnbr->last_lsdb_version=(char *)malloc(16);
+
hnbr->neighbor->length=nbr->neighbor->length;
hnbr->face=nbr->face;
hnbr->status=nbr->status;
- hnbr->last_lsdb_version=0;
+ hnbr->last_lsdb_version="0000000000000000";
struct hashtb_param param_luq = {0};
hnbr->lsa_update_queue=hashtb_create(200, ¶m_luq);
@@ -335,7 +337,7 @@
for(i=0;i<adl_element;i++)
{
nbr=e->data;
- printf("Neighbor: %s Length: %d Face: %d Status: %d LSDB Version: %d \n",nbr->neighbor->name,nbr->neighbor->length,nbr->face, nbr->status, nbr->last_lsdb_version);
+ printf("Neighbor: %s Length: %d Face: %d Status: %d LSDB Version: %s \n",nbr->neighbor->name,nbr->neighbor->length,nbr->face, nbr->status, nbr->last_lsdb_version);
hashtb_next(e);
}
@@ -395,6 +397,7 @@
nlsr->in_interest.p = &incoming_interest;
nlsr->in_content.p = &incoming_content;
nlsr->is_synch_init=1;
+ nlsr->nlsa_id=0;
struct ccn_charbuf *router_prefix;
@@ -441,7 +444,7 @@
nlsr->sched = ccn_schedule_create(nlsr, &ndn_rtr_ticker);
- nlsr->event_send_lsdb_interest = ccn_schedule_event(nlsr->sched, 60000000, &send_lsdb_interest, NULL, 0);
+ nlsr->event_send_lsdb_interest = ccn_schedule_event(nlsr->sched, 1000000, &send_lsdb_interest, NULL, 0);
while(1)
{
diff --git a/nlsr.h b/nlsr.h
index d2274ee..100b69e 100644
--- a/nlsr.h
+++ b/nlsr.h
@@ -15,7 +15,7 @@
struct name_prefix *neighbor;
int face;
int status;
- int last_lsdb_version;
+ char *last_lsdb_version;
struct hashtb *lsa_update_queue;
};
@@ -35,6 +35,7 @@
char *router_name;
int is_synch_init;
+ int nlsa_id;
};
struct nlsr *nlsr;
diff --git a/nlsr_ndn.c b/nlsr_ndn.c
index beff50c..32ad4f3 100644
--- a/nlsr_ndn.c
+++ b/nlsr_ndn.c
@@ -182,12 +182,14 @@
{
ccn_buf_advance(d);
ccn_buf_match_blob(d, &comp, &size);
- ccn_buf_check_close(d);
+ ccn_buf_check_close(d);
+
+
}
ccn_buf_check_close(d);
}
- //if (d->decoder.state < 0)
- //printf("Parse Failed\n");
+ if (d->decoder.state < 0)
+ printf("Parse Failed\n");
if (comp != NULL)
printf("Number in Exclusion Filter is %s\n",comp);
@@ -276,7 +278,7 @@
hashtb_end(e);
- nlsr->event_send_lsdb_interest = ccn_schedule_event(nlsr->sched, 60000000, &send_lsdb_interest, NULL, 0);
+ nlsr->event_send_lsdb_interest = ccn_schedule_event(nlsr->sched, 300000000, &send_lsdb_interest, NULL, 0);
return 0;
diff --git a/utility.c b/utility.c
index 2de07c9..420a911 100644
--- a/utility.c
+++ b/utility.c
@@ -27,6 +27,21 @@
return timestamp;
}
+char * getGmTimeStamp(void)
+{
+ char *timestamp = (char *)malloc(sizeof(char) * 16);
+ time_t gtime;
+ gtime=time(NULL);
+ struct tm *tm;
+ tm=gmtime(>ime);
+
+ sprintf(timestamp, "%04d%02d%02d%02d%02d%02d", tm->tm_year+1900, tm->tm_mon+1,
+ tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
+
+ return timestamp;
+}
+
+
char *
nth_named_component(const char *name_prefix, int n)
{
diff --git a/utility.h b/utility.h
index ae3b999..55863b3 100644
--- a/utility.h
+++ b/utility.h
@@ -2,6 +2,7 @@
#define _UTILITY_H_
char * getLocalTimeStamp(void);
+char * getGmTimeStamp(void);
char * nth_named_component(const char *name_prefix, int n);
#endif