Removing nlsr-sync folder and Adding marker in Content Name
diff --git a/nlsr_adl.c b/nlsr_adl.c
index 54d8954..042466a 100644
--- a/nlsr_adl.c
+++ b/nlsr_adl.c
@@ -8,6 +8,10 @@
#include <assert.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
#endif
@@ -25,7 +29,7 @@
#include "nlsr_npt.h"
void
-add_nbr_to_adl(struct name_prefix *new_nbr,int face)
+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
@@ -54,6 +58,9 @@
nbr->metric=LINK_METRIC;
nbr->is_lsdb_send_interest_scheduled=0;
+ nbr->ip_address=(char *)malloc(13);
+ memset(nbr->ip_address,0,13);
+ memcpy(nbr->ip_address,ip,strlen(ip));
char *time_stamp=(char *)malloc(20);
get_current_timestamp_micro(time_stamp);
@@ -81,6 +88,7 @@
printf("--------Neighbor---------------------------\n");
printf(" Neighbor: %s \n",nbr->neighbor->name);
printf(" Length : %d \n",nbr->neighbor->length);
+ printf(" Ip Address: %s \n",nbr->ip_address);
printf(" Face : %d \n",nbr->face);
printf(" Metric : %d \n",nbr->metric);
printf(" Status : %d \n",nbr->status);
@@ -310,23 +318,17 @@
hashtb_start(nlsr->adl, e);
- //printf("Neighbor: %s , Length: %d \n",nbr->name, nbr->length);
-
res = hashtb_seek(e, nbr->name, nbr->length, 0);
if( res == HT_OLD_ENTRY )
{
- //printf("Old Neighbor\n");
nnbr=e->data;
nnbr->lsdb_interest_timed_out += increment;
- //printf("lsdb_interest_timed_out: %d \n",nnbr->lsdb_interest_timed_out);
}
else if(res == HT_NEW_ENTRY)
{
hashtb_delete(e);
- }
-
- //print_adjacent_from_adl();
+ }
hashtb_end(e);
}
@@ -891,6 +893,32 @@
return connecting_face;
}
+void
+update_face_to_adl_for_nbr(char *nbr, int face)
+{
+ int res;
+ struct ndn_neighbor *nnbr;
+
+ struct hashtb_enumerator ee;
+ struct hashtb_enumerator *e = ⅇ
+
+ hashtb_start(nlsr->adl, e);
+ res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
+
+ if( res == HT_OLD_ENTRY )
+ {
+ nnbr=e->data;
+ nnbr->face=face;
+
+ }
+ else if(res == HT_NEW_ENTRY)
+ {
+ hashtb_delete(e);
+ }
+
+ hashtb_end(e);
+}
+
int
is_neighbor(char *nbr)
{
@@ -917,3 +945,34 @@
return ret;
}
+int
+is_active_neighbor(char *nbr)
+{
+ int ret=0;
+
+ int res;
+ struct hashtb_enumerator ee;
+ struct hashtb_enumerator *e = ⅇ
+
+ hashtb_start(nlsr->adl, e);
+ res = hashtb_seek(e, nbr, strlen(nbr)+1, 0);
+
+ if( res == HT_OLD_ENTRY )
+ {
+ struct ndn_neighbor *nnbr;
+ nnbr=e->data;
+ if (nnbr->status == NBR_ACTIVE )
+ {
+ ret=1;
+ }
+ }
+ else if(res == HT_NEW_ENTRY)
+ {
+ hashtb_delete(e);
+ }
+
+ hashtb_end(e);
+
+ return ret;
+}
+