diff --git a/nlsr-sync-0.0/nlsr_face.c b/nlsr-sync-0.0/nlsr_face.c
new file mode 100644
index 0000000..1d74b06
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_face.c
@@ -0,0 +1,411 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include <ccn/ccn.h>
+#include <ccn/uri.h>
+#include <ccn/face_mgmt.h>
+#include <ccn/reg_mgmt.h>
+#include <ccn/charbuf.h>
+
+
+
+#include "nlsr_face.h"
+
+static void 
+ccn_fib_warn(int lineno, const char *format, ...)
+{
+	struct timeval t;
+	va_list ap;
+	va_start(ap, format);
+	gettimeofday(&t, NULL);
+	fprintf(stderr, "%d.%06d ccn_fib[%d]:%d: ", (int)t.tv_sec, (unsigned)t.tv_usec, (int)getpid(), lineno);
+	vfprintf(stderr, format, ap);
+	va_end(ap);
+}
+
+static void 
+ccn_fib_fatal(int lineno, const char *format, ...)
+{
+	struct timeval t;
+	va_list ap;
+	va_start(ap, format);
+	gettimeofday(&t, NULL);
+	fprintf(stderr, "%d.%06d ccn_fib[%d]:%d: ", (int)t.tv_sec, (unsigned)t.tv_usec, (int)getpid(), lineno);
+	vfprintf(stderr, format, ap);
+	va_end(ap);
+	exit(1);
+}
+
+#define ON_ERROR_EXIT(resval, msg) on_error_exit((resval), __LINE__, msg)
+
+static void 
+on_error_exit(int res, int lineno, const char *msg)
+{
+	if (res >= 0)
+		return;
+	ccn_fib_fatal(lineno, "fatal error, res = %d, %s\n", res, msg);
+}
+
+#define ON_ERROR_CLEANUP(resval) \
+{           \
+    if ((resval) < 0) { \
+        ccn_fib_warn (__LINE__, "OnError cleanup\n"); \
+        goto cleanup; \
+    } \
+}
+
+#define ON_NULL_CLEANUP(resval) \
+{           \
+    if ((resval) == NULL) { \
+        ccn_fib_warn(__LINE__, "OnNull cleanup\n"); \
+        goto cleanup; \
+    } \
+}
+
+
+/**
+ * 
+ * Bind a prefix to a face
+ *
+ */
+static int 
+register_unregister_prefix(struct ccn *h, struct ccn_charbuf *local_scope_template,
+        struct ccn_charbuf *no_name, struct ccn_charbuf *name_prefix,
+        struct ccn_face_instance *face_instance, int operation)
+{
+	struct ccn_charbuf *temp = NULL;
+	struct ccn_charbuf *resultbuf = NULL;
+	struct ccn_charbuf *signed_info = NULL;
+	struct ccn_charbuf *name = NULL;
+	struct ccn_charbuf *prefixreg = NULL;
+	struct ccn_parsed_ContentObject pcobuf = {0};
+	struct ccn_forwarding_entry forwarding_entry_storage = {0};
+	struct ccn_forwarding_entry *forwarding_entry = &forwarding_entry_storage;
+	struct ccn_forwarding_entry *new_forwarding_entry;
+	const unsigned char *ptr = NULL;
+	size_t length = 0;
+	int res;
+
+	/* Register or unregister the prefix */
+	forwarding_entry->action = (operation == OP_REG) ? "prefixreg" : "unreg";
+	forwarding_entry->name_prefix = name_prefix;
+	forwarding_entry->ccnd_id = face_instance->ccnd_id;
+	forwarding_entry->ccnd_id_size = face_instance->ccnd_id_size;
+	forwarding_entry->faceid = face_instance->faceid;
+	forwarding_entry->flags = -1;
+	forwarding_entry->lifetime = 2100;
+
+	prefixreg = ccn_charbuf_create();
+	ccnb_append_forwarding_entry(prefixreg, forwarding_entry);
+	temp = ccn_charbuf_create();
+	res = ccn_sign_content(h, temp, no_name, NULL, prefixreg->buf, prefixreg->length);
+	resultbuf = ccn_charbuf_create();
+
+	/* construct Interest containing prefixreg request */
+	name = ccn_charbuf_create();
+	ccn_name_init(name);
+	ccn_name_append_str(name, "ccnx");
+	ccn_name_append(name, face_instance->ccnd_id, face_instance->ccnd_id_size);
+	ccn_name_append_str(name, (operation == OP_REG) ? "prefixreg" : "unreg");
+	ccn_name_append(name, temp->buf, temp->length);
+
+	/* send Interest, get Data */
+	res = ccn_get(h, name, local_scope_template, 1000, resultbuf, &pcobuf, NULL, 0);
+	ON_ERROR_CLEANUP(res);
+
+	res = ccn_content_get_value(resultbuf->buf, resultbuf->length, &pcobuf, &ptr, &length);
+	ON_ERROR_CLEANUP(res);
+    
+	/* extract new forwarding entry from Data */
+	new_forwarding_entry = ccn_forwarding_entry_parse(ptr, length);
+	ON_NULL_CLEANUP(new_forwarding_entry);
+
+	res = new_forwarding_entry->faceid;
+
+	ccn_forwarding_entry_destroy(&new_forwarding_entry);
+	ccn_charbuf_destroy(&signed_info);
+	ccn_charbuf_destroy(&temp);
+	ccn_charbuf_destroy(&resultbuf);
+	ccn_charbuf_destroy(&name);
+	ccn_charbuf_destroy(&prefixreg);
+
+	return res;
+
+	cleanup:
+		ccn_forwarding_entry_destroy(&new_forwarding_entry);
+		ccn_charbuf_destroy(&signed_info);
+		ccn_charbuf_destroy(&temp);
+		ccn_charbuf_destroy(&resultbuf);
+		ccn_charbuf_destroy(&name);
+		ccn_charbuf_destroy(&prefixreg);
+
+	return -1;
+}
+
+/**
+ *
+ * Create new face by sending out a request Interest
+ * The actual new face instance is returned
+ * 
+ */
+static 
+struct ccn_face_instance *create_face(struct ccn *h, struct ccn_charbuf *local_scope_template,
+        struct ccn_charbuf *no_name, struct ccn_face_instance *face_instance)
+{
+	struct ccn_charbuf *newface = NULL;
+	struct ccn_charbuf *signed_info = NULL;
+	struct ccn_charbuf *temp = NULL;
+	struct ccn_charbuf *name = NULL;
+	struct ccn_charbuf *resultbuf = NULL;
+	struct ccn_parsed_ContentObject pcobuf = {0};
+	struct ccn_face_instance *new_face_instance = NULL;
+	const unsigned char *ptr = NULL;
+	size_t length = 0;
+	int res = 0;
+
+	/* Encode the given face instance */
+	newface = ccn_charbuf_create();
+	ccnb_append_face_instance(newface, face_instance);
+
+	temp = ccn_charbuf_create();
+	res = ccn_sign_content(h, temp, no_name, NULL, newface->buf, newface->length);
+	resultbuf = ccn_charbuf_create();
+
+	/* Construct the Interest name that will create the face */
+	name = ccn_charbuf_create();
+	ccn_name_init(name);
+	ccn_name_append_str(name, "ccnx");
+	ccn_name_append(name, face_instance->ccnd_id, face_instance->ccnd_id_size);
+	ccn_name_append_str(name, face_instance->action);
+	ccn_name_append(name, temp->buf, temp->length);
+
+	/* send Interest to retrieve Data that contains the newly created face */
+	res = ccn_get(h, name, local_scope_template, 1000, resultbuf, &pcobuf, NULL, 0);
+	ON_ERROR_CLEANUP(res);
+
+	/* decode Data to get the actual face instance */
+	res = ccn_content_get_value(resultbuf->buf, resultbuf->length, &pcobuf, &ptr, &length);
+	ON_ERROR_CLEANUP(res);
+
+	new_face_instance = ccn_face_instance_parse(ptr, length);
+
+	ccn_charbuf_destroy(&newface);
+	ccn_charbuf_destroy(&signed_info);
+	ccn_charbuf_destroy(&temp);
+	ccn_charbuf_destroy(&resultbuf);
+	ccn_charbuf_destroy(&name);
+
+	return new_face_instance;
+
+	cleanup:
+		ccn_charbuf_destroy(&newface);
+		ccn_charbuf_destroy(&signed_info);
+		ccn_charbuf_destroy(&temp);
+		ccn_charbuf_destroy(&resultbuf);
+		ccn_charbuf_destroy(&name);
+
+	return NULL;
+}
+
+/**
+ *
+ * Get ccnd id
+ *
+ */
+static int 
+get_ccndid(struct ccn *h, struct ccn_charbuf *local_scope_template,
+        unsigned char *ccndid)
+{
+	struct ccn_charbuf *name = NULL;
+	struct ccn_charbuf *resultbuf = NULL;
+	struct ccn_parsed_ContentObject pcobuf = {0};
+	char ccndid_uri[] = "ccnx:/%C1.M.S.localhost/%C1.M.SRV/ccnd/KEY";
+	const unsigned char *ccndid_result;
+	static size_t ccndid_result_size;
+	int res;
+
+	name = ccn_charbuf_create();
+	resultbuf = ccn_charbuf_create();
+
+	res = ccn_name_from_uri(name, ccndid_uri);
+	ON_ERROR_EXIT(res, "Unable to parse service locator URI for ccnd key\n");
+
+	/* get Data */
+	res = ccn_get(h, name, local_scope_template, 4500, resultbuf, &pcobuf, NULL, 0);
+	ON_ERROR_EXIT(res, "Unable to get key from ccnd\n");
+
+	/* extract from Data */
+	res = ccn_ref_tagged_BLOB(CCN_DTAG_PublisherPublicKeyDigest,
+            resultbuf->buf,
+            pcobuf.offset[CCN_PCO_B_PublisherPublicKeyDigest],
+            pcobuf.offset[CCN_PCO_E_PublisherPublicKeyDigest],
+            &ccndid_result, &ccndid_result_size);
+	ON_ERROR_EXIT(res, "Unable to parse ccnd response for ccnd id\n");
+
+	memcpy((void *)ccndid, ccndid_result, ccndid_result_size);
+
+	ccn_charbuf_destroy(&name);
+	ccn_charbuf_destroy(&resultbuf);
+
+	return (ccndid_result_size);
+}
+
+/**
+ * Construct a new face instance based on the given address and port
+ * This face instance is only used to send new face request
+ */
+static struct 
+ccn_face_instance *construct_face(const unsigned char *ccndid, size_t ccndid_size,
+        const char *address, const char *port)
+{
+	struct ccn_face_instance *fi = calloc(1, sizeof(*fi));
+	char rhostnamebuf[NI_MAXHOST];
+	char rhostportbuf[NI_MAXSERV];
+	struct addrinfo hints = {.ai_family = AF_UNSPEC, .ai_flags = (AI_ADDRCONFIG),
+        .ai_socktype = SOCK_DGRAM};
+	struct addrinfo *raddrinfo = NULL;
+	struct ccn_charbuf *store = ccn_charbuf_create();
+	int host_off = -1;
+	int port_off = -1;
+	int res;
+
+	res = getaddrinfo(address, port, &hints, &raddrinfo);
+	if (res != 0 || raddrinfo == NULL) 
+	{
+		fprintf(stderr, "Error: getaddrinfo\n");
+		return NULL;
+	}
+
+	res = getnameinfo(raddrinfo->ai_addr, raddrinfo->ai_addrlen,
+            rhostnamebuf, sizeof(rhostnamebuf),
+            rhostportbuf, sizeof(rhostportbuf),
+            NI_NUMERICHOST | NI_NUMERICSERV);
+	freeaddrinfo(raddrinfo);	
+	if (res != 0) 
+	{
+		fprintf(stderr, "Error: getnameinfo\n");
+		return NULL;
+	}
+
+	fi->store = store;
+	fi->descr.ipproto = IPPROTO_UDP;
+	fi->descr.mcast_ttl = CCN_FIB_MCASTTTL;
+	fi->lifetime = CCN_FIB_LIFETIME;
+
+	ccn_charbuf_append(store, "newface", strlen("newface") + 1);
+	host_off = store->length;
+	ccn_charbuf_append(store, rhostnamebuf, strlen(rhostnamebuf) + 1);
+	port_off = store->length;
+	ccn_charbuf_append(store, rhostportbuf, strlen(rhostportbuf) + 1);
+
+	char *b = (char *)store->buf;
+	fi->action = b;
+	fi->descr.address = b + host_off;
+	fi->descr.port = b + port_off;
+	fi->descr.source_address = NULL;
+	fi->ccnd_id = ccndid;
+	fi->ccnd_id_size = ccndid_size;
+
+	return fi;
+}
+
+/**
+ * initialize local data
+ */
+static void 
+init_data(struct ccn_charbuf *local_scope_template,
+        struct ccn_charbuf *no_name)
+{
+	ccn_charbuf_append_tt(local_scope_template, CCN_DTAG_Interest, CCN_DTAG);
+	ccn_charbuf_append_tt(local_scope_template, CCN_DTAG_Name, CCN_DTAG);
+	ccn_charbuf_append_closer(local_scope_template);    /* </Name> */
+	ccnb_tagged_putf(local_scope_template, CCN_DTAG_Scope, "1");
+	ccn_charbuf_append_closer(local_scope_template);    /* </Interest> */
+
+	ccn_name_init(no_name);
+}
+
+static int 
+add_delete_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int p, int operation)
+{
+	struct ccn_charbuf *prefix;
+	char port[6];
+	struct ccn_charbuf *local_scope_template = ccn_charbuf_create();
+	struct ccn_charbuf *no_name = ccn_charbuf_create();
+	unsigned char ccndid_storage[32] = {0};
+	unsigned char *ccndid = ccndid_storage;
+	size_t ccndid_size = 0;
+	struct ccn_face_instance *fi;
+	struct ccn_face_instance *nfi;
+	int res;
+
+	prefix = ccn_charbuf_create();
+	res = ccn_name_from_uri(prefix, uri);
+	ON_ERROR_CLEANUP(res);
+	memset(port, 0, 6);
+	sprintf(port, "%d", p);
+
+	init_data(local_scope_template, no_name);
+
+	ccndid_size = get_ccndid(h, local_scope_template, ccndid);
+	if (ccndid_size != sizeof(ccndid_storage))
+ 	{
+		fprintf(stderr, "Incorrect size for ccnd id in response\n");
+		ON_ERROR_CLEANUP(-1);
+	}
+
+	/* construct a face instance for new face request */
+	fi = construct_face(ccndid, ccndid_size, address, port);
+	ON_NULL_CLEANUP(fi);
+
+	/* send new face request to actually create a new face */
+	nfi = create_face(h, local_scope_template, no_name, fi);
+	ON_NULL_CLEANUP(nfi);
+
+
+	res = register_unregister_prefix(h, local_scope_template, no_name, prefix, nfi, operation);
+	ON_ERROR_CLEANUP(res);
+
+	int faceid=nfi->faceid;
+
+	ccn_charbuf_destroy(&local_scope_template);
+	ccn_charbuf_destroy(&no_name);
+	ccn_face_instance_destroy(&fi);
+	ccn_face_instance_destroy(&nfi);
+	ccn_charbuf_destroy(&prefix);
+
+	//return nfi->faceid;
+
+	return faceid;
+
+	cleanup:
+		ccn_charbuf_destroy(&prefix);
+		ccn_charbuf_destroy(&local_scope_template);
+		ccn_charbuf_destroy(&no_name);
+		ccn_face_instance_destroy(&fi);
+		ccn_face_instance_destroy(&nfi);
+
+	return -1;
+}
+
+
+int 
+add_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port)
+{
+	return add_delete_ccn_face(h, uri, address, port, OP_REG);
+}
+
+
+int 
+delete_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port)
+{
+	return add_delete_ccn_face(h, uri, address, port, OP_UNREG);
+}
+
diff --git a/nlsr-sync-0.0/nlsr_face.h b/nlsr-sync-0.0/nlsr_face.h
new file mode 100644
index 0000000..aae75f8
--- /dev/null
+++ b/nlsr-sync-0.0/nlsr_face.h
@@ -0,0 +1,12 @@
+#ifndef _NLSR_FACE_H_
+#define _NLSR_FACE_H_
+
+#define CCN_FIB_LIFETIME ((~0U) >> 1)
+#define CCN_FIB_MCASTTTL (-1)
+#define OP_REG  0
+#define OP_UNREG 1
+
+int add_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port);
+int delete_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int port);
+
+#endif
