Update in Version Numbering
diff --git a/nlsr.c b/nlsr.c
index 9aca876..3a9148b 100644
--- a/nlsr.c
+++ b/nlsr.c
@@ -338,8 +338,8 @@
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->lsdb->version=(char *)malloc(16);
+ nlsr->lsdb->version=0;
nlsr->lsdb->adj_lsdb = hashtb_create(sizeof(struct adj_lsa), ¶m_adj_lsdb);
nlsr->lsdb->name_lsdb = hashtb_create(sizeof(struct name_lsa), ¶m_name_lsdb);
diff --git a/nlsr.h b/nlsr.h
index d0df282..c491089 100644
--- a/nlsr.h
+++ b/nlsr.h
@@ -21,7 +21,7 @@
struct linkStateDatabase
{
- char *version;
+ long int version;
struct hashtb *adj_lsdb;
struct hashtb *name_lsdb;
};
diff --git a/nlsr_ndn.c b/nlsr_ndn.c
index 2d775ae..6d6a56c 100644
--- a/nlsr_ndn.c
+++ b/nlsr_ndn.c
@@ -352,17 +352,20 @@
/* Now comp points to the start of your potential number, and size is its length */
}
- int dbcmp=strncmp(nlsr->lsdb->version,(char *)comp,16);
+ int db_version=atoi((char *)comp);
+ int dbcmp=db_version- nlsr->lsdb->version;
+
+ //int dbcmp=strncmp(nlsr->lsdb->version,(char *)comp,16);
- printf (" dbcmp = %d \n",dbcmp);
+ //printf (" dbcmp = %d \n",dbcmp);
if(dbcmp > 0)
{
- printf("Has Updated database (Older: %s New: %s)\n",comp,nlsr->lsdb->version);
+ printf("Has Updated database (Older: %s New: %ld)\n",comp,nlsr->lsdb->version);
}
else
{
- printf("Data base is not updated than the older one (Older: %s New: %s)\n",comp,nlsr->lsdb->version);
+ printf("Data base is not updated than the older one (Older: %s New: %ld)\n",comp,nlsr->lsdb->version);
printf("Sending NACK Content back.....\n");
struct ccn_charbuf *data=ccn_charbuf_create();