Added COnfiguration for topo and Slice prefix
diff --git a/nlsr-sync-0.0/macbook.conf b/nlsr-sync-0.0/macbook.conf
index b22c00a..910b939 100755
--- a/nlsr-sync-0.0/macbook.conf
+++ b/nlsr-sync-0.0/macbook.conf
@@ -1,8 +1,9 @@
 #----configuration file for macbook----------
 #
-router-name /ndn/memphis.edu/netlab/macbook/
-ccnneighbor /ndn/memphis.edu/netlab/maia face11
-ccnneighbor /ndn/memphis.edu/pollux face38
+router-name /ndn/memphis.edu/netlab/macbook
+ccnneighbor /ndn/memphis.edu/cs/maia face11
+ccnneighbor /ndn/memphis.edu/cs/mira face38
+ccnneighbor /ndn/memphis.edu/cs/castor face38
 ccnname /ndn/memphis.edu/macbook/patterson
 ccnname /ndn/memphis.edu/macbook/houston/
 #------lsdb-synch-interval-----
@@ -14,4 +15,7 @@
 multi-path-face-num 2 
 debug on
 
+topo-prefix /ndn/test/topo
+slice-prefix /ndn/test/slice
+
 logdir /Users/akmhoque/NLSR2.0
diff --git a/nlsr-sync-0.0/nlsr.c b/nlsr-sync-0.0/nlsr.c
index cbf34b3..578a0a6 100755
--- a/nlsr-sync-0.0/nlsr.c
+++ b/nlsr-sync-0.0/nlsr.c
@@ -193,7 +193,17 @@
 	memcpy(nbr->name,rtr_name,strlen(rtr_name)+1);
 	nbr->length=strlen(rtr_name)+1;
 
-	add_nbr_to_adl(nbr,face_id);
+	//add_nbr_to_adl(nbr,face_id);
+
+	struct name_prefix *nbr_name=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
+	get_host_name_from_command_string(nbr_name,nbr->name,0);
+	printf("Hostname of neighbor: %s ",nbr_name->name);
+
+	struct sockaddr_in *ip=get_ip_from_hostname(nbr_name->name);
+	printf("IP Address: %s \n",inet_ntoa( ip->sin_addr ));
+
+	add_nbr_to_adl(nbr,face_id,inet_ntoa( ip->sin_addr ));
+	
 
 	free(nbr->name);
 	free(nbr);
@@ -509,6 +519,94 @@
 	}
 }
 
+
+void 
+process_command_topo_prefix(char *command)
+{
+	if(command==NULL)
+	{
+		printf(" Wrong Command Format ( topo-prefix )\n");
+		return;
+	}
+	char *rem;
+	const char *sep=" \t\n";
+	char *topo_prefix;
+
+	topo_prefix=strtok_r(command,sep,&rem);
+	if(topo_prefix==NULL)
+	{
+		printf(" Wrong Command Format (  topo-prefix /name/prefix  )\n");
+		return;
+	}
+	else
+	{
+		if( nlsr->topo_prefix != NULL)	
+			free(nlsr->topo_prefix);
+		nlsr->topo_prefix=(char *)malloc(strlen(topo_prefix)+1);
+		memset(nlsr->topo_prefix,strlen(topo_prefix)+1,0);
+		memcpy(nlsr->topo_prefix,topo_prefix,strlen(topo_prefix));
+
+		//printf(" Topo Prefix: %s \n",nlsr->topo_prefix);
+
+	}
+}
+
+
+void 
+process_command_slice_prefix(char *command)
+{
+	if(command==NULL)
+	{
+		printf(" Wrong Command Format ( slice-prefix /name/prefix )\n");
+		return;
+	}
+	char *rem;
+	const char *sep=" \t\n";
+	char *slice_prefix;
+
+	slice_prefix=strtok_r(command,sep,&rem);
+	if(slice_prefix==NULL)
+	{
+		printf(" Wrong Command Format (  slice-prefix /name/prefix  )\n");
+		return;
+	}
+	else
+	{
+		if ( nlsr->slice_prefix != NULL)
+			free(nlsr->slice_prefix);
+		nlsr->slice_prefix=(char *)malloc(strlen(slice_prefix)+1);
+		memset(nlsr->slice_prefix,strlen(slice_prefix)+1,0);
+		memcpy(nlsr->slice_prefix,slice_prefix,strlen(slice_prefix));
+
+		//printf(" Slice Prefix: %s \n",nlsr->slice_prefix);
+	}
+}
+
+void 
+process_command_hyperbolic(char *command)
+{
+	if(command==NULL)
+	{
+		printf(" Wrong Command Format ( hyperbolic on/off )\n");
+		return;
+	}
+	char *rem;
+	const char *sep=" \t\n";
+	char *on_off;
+
+	on_off=strtok_r(command,sep,&rem);
+	if(on_off==NULL)
+	{
+		printf(" Wrong Command Format ( hyperbolic on/off )\n");
+		return;
+	}
+	
+	if ( strcmp(on_off,"ON") == 0 || strcmp(on_off,"on") == 0 )
+	{
+		nlsr->is_hyperbolic_calc=1;
+	}
+}
+
 void 
 process_conf_command(char *command)
 {
@@ -569,6 +667,14 @@
 	{
 			process_command_debug(remainder);
 	}
+	else if(!strcmp(cmd_type,"topo-prefix") )
+	{
+			process_command_topo_prefix(remainder);
+	}
+	else if(!strcmp(cmd_type,"slice-prefix") )
+	{
+			process_command_slice_prefix(remainder);
+	}
 	else 
 	{
 		printf("Wrong configuration Command %s \n",cmd_type);
@@ -703,7 +809,14 @@
 			res=is_neighbor(np->name);
 			if ( res == 0 )
 			{
-				add_nbr_to_adl(np,face_id);
+				struct name_prefix *nbr_name=(struct name_prefix *)malloc(sizeof(struct name_prefix ));
+				get_host_name_from_command_string(nbr_name,np->name,0);
+				printf("Hostname of neighbor: %s ",nbr_name->name);
+
+				struct sockaddr_in *ip=get_ip_from_hostname(nbr_name->name);
+				printf("IP Address: %s \n",inet_ntoa( ip->sin_addr ));
+				
+				add_nbr_to_adl(np,face_id,inet_ntoa( ip->sin_addr ));
 				sprintf(msg,"Neighbor %s has been added to adjacency list.",name);
 			}
 			else
@@ -957,8 +1070,6 @@
 
 	nlsr->api_port=API_PORT;
 
-	//create_sync_slice();
-
 	nlsr->topo_prefix=(char *)malloc(strlen("/ndn/routing/nlsr")+1);
 	memset(nlsr->topo_prefix,strlen("/ndn/routing/nlsr")+1,0);
 	memcpy(nlsr->topo_prefix,"/ndn/routing/nlsr",strlen("/ndn/routing/nlsr"));
@@ -967,6 +1078,8 @@
 	memset(nlsr->slice_prefix,strlen("/ndn/routing/nlsr/LSA")+1,0);
 	memcpy(nlsr->slice_prefix,"/ndn/routing/nlsr/LSA",strlen("/ndn/routing/nlsr/LSA"));
 
+	nlsr->is_hyperbolic_calc=0;
+
 	return 0;
 }
 
@@ -1007,6 +1120,7 @@
 		nlsr->api_port=port;
 
 	readConfigFile(config_file);
+
 	if ( daemon_mode == 1 )
 	{
 		daemonize_nlsr();
diff --git a/nlsr-sync-0.0/nlsr.h b/nlsr-sync-0.0/nlsr.h
index 095e128..254f1ec 100755
--- a/nlsr-sync-0.0/nlsr.h
+++ b/nlsr-sync-0.0/nlsr.h
@@ -65,6 +65,7 @@
 	struct hashtb *npt;
 	struct hashtb *routing_table;
 
+
 	struct linkStateDatabase *lsdb;
 
 	struct ccn *ccn;
@@ -98,6 +99,8 @@
 
 	char *topo_prefix;
 	char *slice_prefix;
+
+	int is_hyperbolic_calc;
 	
 };
 
diff --git a/nlsr-sync-0.0/nlsr_adl.c b/nlsr-sync-0.0/nlsr_adl.c
index 54d8954..8a5fbb4 100755
--- a/nlsr-sync-0.0/nlsr_adl.c
+++ b/nlsr-sync-0.0/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,13,0);
+		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);
diff --git a/nlsr-sync-0.0/nlsr_adl.h b/nlsr-sync-0.0/nlsr_adl.h
index 5e9fa5a..6fca523 100755
--- a/nlsr-sync-0.0/nlsr_adl.h
+++ b/nlsr-sync-0.0/nlsr_adl.h
@@ -11,6 +11,7 @@
 	int status;
 	char * last_lsdb_version;
 	char * last_info_version;
+	char *ip_address;
 	int info_interest_timed_out;
 	int lsdb_interest_timed_out;
 	int lsdb_random_time_component;
@@ -20,7 +21,7 @@
 	int metric;
 };
 
-void add_nbr_to_adl(struct name_prefix *new_nbr,int face);
+void add_nbr_to_adl(struct name_prefix *new_nbr,int face,char *ip);
 void delete_nbr_from_adl(struct name_prefix *nbr);
 void print_adjacent(struct ndn_neighbor *nbr);
 void print_adjacent_from_adl(void);
diff --git a/nlsr-sync-0.0/nlsr_sync.c b/nlsr-sync-0.0/nlsr_sync.c
index e89fcb8..7b4279b 100644
--- a/nlsr-sync-0.0/nlsr_sync.c
+++ b/nlsr-sync-0.0/nlsr_sync.c
@@ -95,6 +95,58 @@
 	
 }
 
+void 
+get_host_name_from_command_string(struct name_prefix *name_part,char *nbr_name_uri, int offset)
+{
+
+	
+	
+	int res,i;
+	int len=0;
+	const unsigned char *comp_ptr1;
+	size_t comp_size;
+
+	struct ccn_charbuf *name=ccn_charbuf_create();
+	name = ccn_charbuf_create();
+    	res = ccn_name_from_uri(name,nbr_name_uri);
+    	if (res < 0) {
+        	fprintf(stderr, "Bad ccn URI: %s\n", nbr_name_uri);
+        	exit(1);
+    	}	
+
+	struct ccn_indexbuf cid={0};
+
+    	struct ccn_indexbuf *components=&cid;
+    	ccn_name_split (name, components);
+
+	for(i=components->n-2;i> (0+offset);i--)
+	{
+		res=ccn_name_comp_get(name->buf, components,i,&comp_ptr1, &comp_size);
+		len+=1;
+		len+=(int)comp_size;	
+	}
+	len++;
+
+	char *neighbor=(char *)malloc(len);
+	memset(neighbor,0,len);
+
+	for(i=components->n-2;i> (0+offset);i--)
+	{
+		res=ccn_name_comp_get(name->buf, components,i,&comp_ptr1, &comp_size);
+		if ( i != components->n-2)
+		memcpy(neighbor+strlen(neighbor),".",1);
+		memcpy(neighbor+strlen(neighbor),(char *)comp_ptr1,strlen((char *)comp_ptr1));
+
+	}
+
+	name_part->name=(char *)malloc(strlen(neighbor)+1);
+	memset(name_part->name,0,strlen(neighbor)+1);
+	memcpy(name_part->name,neighbor,strlen(neighbor)+1);
+	name_part->length=strlen(neighbor)+1;
+
+	
+}
+
 
 char *
 get_content_by_content_name(char *content_name)
diff --git a/nlsr-sync-0.0/nlsr_sync.h b/nlsr-sync-0.0/nlsr_sync.h
index 5fe9a52..8bb49d8 100644
--- a/nlsr-sync-0.0/nlsr_sync.h
+++ b/nlsr-sync-0.0/nlsr_sync.h
@@ -4,5 +4,6 @@
 void sync_monitor(char *topo_prefix, char *slice_prefix);
 void write_data_to_repo(char *data,char *name_prefix);
 int create_sync_slice(char *topo_prefix, char *slice_prefix);
+void get_host_name_from_command_string(struct name_prefix *name_part,char *nbr_name_uri, int offset);
 
 #endif
diff --git a/nlsr-sync-0.0/utility.c b/nlsr-sync-0.0/utility.c
index b136c67..d18af41 100755
--- a/nlsr-sync-0.0/utility.c
+++ b/nlsr-sync-0.0/utility.c
@@ -10,6 +10,10 @@
 #include <errno.h>
 #include <sys/stat.h>
 #include <sys/time.h>
+#include<sys/socket.h>
+#include<arpa/inet.h>
+#include<errno.h>
+#include<netdb.h>
 #include <time.h>
 #include <assert.h>
 #ifdef HAVE_CONFIG_H
@@ -17,6 +21,7 @@
 #endif
 
 
+
 #include <ccn/ccn.h>
 #include <ccn/uri.h>
 #include <ccn/keystore.h>
@@ -214,3 +219,35 @@
     	}
 }
 
+
+struct sockaddr_in *
+get_ip_from_hostname(char *hostname )
+{
+ 
+
+    struct addrinfo hints, *servinfo, *p;
+    int res; 
+    struct sockaddr_in * ip;
+    memset(&hints, 0, sizeof hints);
+    hints.ai_family = AF_UNSPEC;
+    hints.ai_socktype = SOCK_STREAM;
+
+    if ( (res = getaddrinfo( hostname , "http", &hints , &servinfo)) != 0)
+    {
+        fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(res));
+        return NULL;
+    }
+    //int i=0;
+    for(p = servinfo; p != NULL; p = p->ai_next)
+    {
+        ip = (struct sockaddr_in *) p->ai_addr;
+	//i++;
+   
+    }
+    freeaddrinfo(servinfo);
+    return ip;
+
+
+}
+
+
diff --git a/nlsr-sync-0.0/utility.h b/nlsr-sync-0.0/utility.h
index 6ae550a..9028600 100755
--- a/nlsr-sync-0.0/utility.h
+++ b/nlsr-sync-0.0/utility.h
@@ -9,4 +9,5 @@
 
 void startLogging(char *loggingDir);
 void writeLogg(const char *source_file, const char *function, const int line, const char *format, ...);
+struct sockaddr_in * get_ip_from_hostname(char *hostname);
 #endif