Update in Utility
diff --git a/nlsr.c b/nlsr.c
index f5a826f..ffa1900 100644
--- a/nlsr.c
+++ b/nlsr.c
@@ -396,6 +396,11 @@
nlsr->npl = hashtb_create(sizeof(struct name_prefix), ¶m_npl);
nlsr->in_interest.p = &incoming_interest;
nlsr->in_content.p = &incoming_content;
+
+ nlsr->lsdb=(struct linkStateDatabase *)malloc(sizeof(struct linkStateDatabase *));
+ nlsr->lsdb->version=(char *)malloc(16);
+ nlsr->lsdb->version="0000000000000000";
+
nlsr->is_synch_init=1;
nlsr->nlsa_id=0;
diff --git a/nlsr.h b/nlsr.h
index 100b69e..9895256 100644
--- a/nlsr.h
+++ b/nlsr.h
@@ -19,6 +19,12 @@
struct hashtb *lsa_update_queue;
};
+struct linkStateDatabase
+{
+ char *version;
+ struct hashtb *db;
+};
+
struct nlsr
{
@@ -34,6 +40,8 @@
struct ccn *ccn;
char *router_name;
+ struct linkStateDatabase *lsdb;
+
int is_synch_init;
int nlsa_id;
};
diff --git a/nlsr_ndn.c b/nlsr_ndn.c
index 32ad4f3..4c6d1f5 100644
--- a/nlsr_ndn.c
+++ b/nlsr_ndn.c
@@ -188,14 +188,21 @@
}
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);
/* Now comp points to the start of your potential number, and size is its length */
}
+ int dbcmp=strncmp(nlsr->lsdb->version,(char *)comp,16);
+
+ if(dbcmp > 0)
+ printf("Has Updated database (Older: %s New: %s)",comp,nlsr->lsdb->version);
+ else
+ printf("Data base is not updated than the older one (Older: %s New: %s)",comp,nlsr->lsdb->version);
+
}
@@ -230,7 +237,7 @@
hashtb_start(nlsr->adl, e);
adl_element=hashtb_n(nlsr->adl);
- int mynumber=15;
+ //int mynumber=15;
for(i=0;i<adl_element;i++)
{
@@ -257,7 +264,8 @@
ccn_charbuf_append_tt(templ, CCN_DTAG_Exclude, CCN_DTAG);
ccnb_tagged_putf(templ, CCN_DTAG_Any, "");
ccn_charbuf_reset(c);
- ccn_charbuf_putf(c, "%u", (unsigned)mynumber);
+ //ccn_charbuf_putf(c, "%u", (unsigned)mynumber);
+ ccn_charbuf_putf(c, "%s", nbr->last_lsdb_version);
ccnb_append_tagged_blob(templ, CCN_DTAG_Component, c->buf, c->length);
ccn_charbuf_append_closer(templ); /* </Exclude> */
ccn_charbuf_append_closer(templ); /* </Interest> */