Added COnfiguration for topo and Slice prefix
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;
+
+
+}
+
+