diff --git a/src/Makefile b/src/Makefile
index a817e39..af7dbd8 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,17 +1,21 @@
 NAME=mod_netconf
-SOURCES=$(NAME).c
 
 APXS=/usr/sbin/apxs2
 
-CFLAGS=-I/usr/include/libxml2 
-LIBS=-lnetconf -lxml2 -lz -lm 
+CFLAGS=-I/usr/include/libxml2  -I/usr/include/json
+LIBS=-lnetconf -lxml2 -lz -lm -ljson 
 
-all: $(SOURCES)
-	$(APXS) $(CPPFLAGS) $(CFLAGS) $(LIBS) -c $(SOURCES)
+all: module client
+
+module: mod_netconf.c
+	$(APXS) $(CPPFLAGS) $(CFLAGS) $(LIBS) -c mod_netconf.c
+
+client: test-client.c
+	gcc -std=gnu99 -Wall -g -ljson -I/usr/include/json test-client.c -o test-client
 
 install: $(NAME).la
 	$(APXS) -i $(NAME).la
 
 clean:
-	rm -rf .libs *.la *.lo *.slo
+	rm -rf .libs *.la *.lo *.slo test-client
 
diff --git a/src/README b/src/README
index c62e3ba..2b538c2 100644
--- a/src/README
+++ b/src/README
@@ -1,6 +1,6 @@
 How To Setup Apache Server
 --------------------------
-- mod_netconf compilation requires apache2-devel package.
+- mod_netconf compilation requires apache2-devel and libjson-devel packages.
 
 - run following commands in this directory
 $ make
@@ -8,10 +8,9 @@
 
 - Add following lines into the (appropriate parts of the ) Apache configuration:
 LoadModule netconf_module                 /usr/lib64/apache2/mod_netconf.so
-<Location /netconf>
-        SetHandler netconf
-</Location>
 
-- copy index.php and login.php into Apache DocumentRoot.
-- create empty directory 'netconf' in Apache DocumentRoot
-- open index.php in the browser and follow instructions
+- Start Apache
+
+- For testing, you can run test-client
+  - run under the same user as Apache, or change access rights of the
+    communication socket (/tmp/pconn.sock) to allow writing.
diff --git a/src/index.php b/src/index.php
deleted file mode 100644
index 44c0089..0000000
--- a/src/index.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php 
-
-if (isset($_POST['action']) && $_POST['action'] == "disconnect") {
-	
-	apache_setenv("NETCONF_OP", "disconnect");
-	apache_setenv("NETCONF_NSID", $_POST["nsid"]);
-	virtual("/netconf/");
-	
-	echo "OK";
-}
-
-if (isset($_POST['action']) && $_POST['action'] == "login") {
-	apache_setenv("NETCONF_OP", "connect");
-	apache_setenv("NETCONF_HOST", "localhost");
-	apache_setenv("NETCONF_PORT", "830");
-	apache_setenv("NETCONF_USER", $_POST["login"]);
-	apache_setenv("NETCONF_PASS", $_POST["password"]);
-	virtual("/netconf/");
-	
-	echo "<html><body>";
-	$out = apache_getenv("NETCONF_NSID");
-	echo "NSID: ".$out;
-	
-	echo "<form method=\"post\" action=\"./index.php\" name=\"disconnect\">";
-	echo "<input type=\"hidden\" name=\"action\" value=\"disconnect\">";
-	echo "<input type=\"hidden\" name=\"nsid\" value=\"$out\">";
-	echo "<input type=\"submit\" value=\"Disconnect\">";
-	echo "</form>";
-	echo "</body></html>";
-	
-	return ;
-}
-
-if (!isset($_POST['nsid'])) {
-	/* no session related information known - redirect to the login page */
-	header('Location: ./login.php');
-	die();
-}
-
-?>
diff --git a/src/login.php b/src/login.php
deleted file mode 100644
index a633146..0000000
--- a/src/login.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<html>
-<body>
-
-<center>
-  <table cellpadding='2' cellspacing='0' border='1' id='login_table'>
-  <tr><td align=center style="padding:2;padding-bottom:4">
-    <b>Enter your login and password</b>
-  </td></tr>
-  <tr><td style="padding:5"><br>
-	<form method="post" action="./index.php" name="login">
-	  <input type="hidden" name="action" value="login">
-      <input type="hidden" name="hide" value="">
-	  <center>
-	    <table>
-		<tr><td>Login:</td><td><input type="text" name="login"></td></tr>
-		<tr><td>Password:</td><td><input type="password" name="password"></td></tr>
-		<tr><td>&nbsp;</td><td><input type="submit" value="Enter"></td></tr>
-		</table>
-      </center>
-	</form>
-  </td></tr>
-  </table>
-</center>
-
-</body>
-</html>
diff --git a/src/mod_netconf.c b/src/mod_netconf.c
index d56a9f3..23c3251 100644
--- a/src/mod_netconf.c
+++ b/src/mod_netconf.c
@@ -73,6 +73,8 @@
 #include <string.h>
 #include <errno.h>
 
+#include <json/json.h>
+
 #include <libnetconf.h>
 #include <libxml/tree.h>
 #include <libxml/parser.h>
@@ -91,6 +93,22 @@
 
 struct timeval timeout = { 1, 0 };
 
+typedef enum MSG_TYPE {
+	REPLY_OK,
+	REPLY_DATA,
+	REPLY_ERROR,
+	MSG_CONNECT,
+	MSG_DISCONNECT,
+	MSG_GET,
+	MSG_GETCONFIG,
+	MSG_EDITCONFIG,
+	MSG_COPYCONFIG,
+	MSG_DELETECONFIG,
+	MSG_LOCK,
+	MSG_UNLOCK,
+	MSG_KILL
+} MSG_TYPE;
+
 #define MSG_OK 0
 #define MSG_OPEN  1
 #define MSG_DATA  2
@@ -101,8 +119,9 @@
 module AP_MODULE_DECLARE_DATA netconf_module;
 
 typedef struct {
-	apr_proc_t *forkproc;
 	apr_pool_t *pool;
+	apr_proc_t *forkproc;
+	char* sockname;
 } mod_netconf_cfg;
 
 volatile int isterminated = 0;
@@ -115,20 +134,15 @@
 	switch (sign) {
 	case SIGTERM:
 		isterminated = 1;
-		fprintf(stderr, "got TERM signal... %s\n",
-			apr_signal_description_get(sign));
-		break;
-	default:
-		printf("%s\n", apr_signal_description_get(sign));
 		break;
 	}
 }
 
-server_rec *gserver;
-static int gen_ncsession_hash(char** hash, const char* hostname, const char* port, const char* sid)
+static char* gen_ncsession_hash( const char* hostname, const char* port, const char* sid)
 {
 	unsigned char hash_raw[APR_SHA1_DIGESTSIZE];
 	int i;
+	char* hash;
 
 	apr_sha1_ctx_t sha1_ctx;
 	apr_sha1_init(&sha1_ctx);
@@ -138,13 +152,13 @@
 	apr_sha1_final(hash_raw, &sha1_ctx);
 
 	/* convert binary hash into hex string, which is printable */
-	*hash = malloc(sizeof(char) * ((2*APR_SHA1_DIGESTSIZE)+1));
+	hash = malloc(sizeof(char) * ((2*APR_SHA1_DIGESTSIZE)+1));
 	for (i = 0; i < APR_SHA1_DIGESTSIZE; i++) {
-		snprintf(*hash + (2*i), 3, "%02x", hash_raw[i]);
+		snprintf(hash + (2*i), 3, "%02x", hash_raw[i]);
 	}
 	//hash[2*APR_SHA1_DIGESTSIZE] = 0;
 
-	return (APR_SUCCESS);
+	return (hash);
 }
 
 int netconf_callback_ssh_hostkey_check (const char* hostname, int keytype, const char* fingerprint)
@@ -183,63 +197,35 @@
 	return;
 }
 
-static void handle_msg_open(server_rec* server, apr_pool_t* pool, int client, apr_hash_t* conns, char** address)
+static char* netconf_connect(server_rec* server, apr_pool_t* pool, apr_hash_t* conns, const char* host, const char* port, const char* user, const char* pass)
 {
 	struct nc_session* session;
-	char *hostname, *port, *username, *sid;
+	char *sid;
 	char *session_key;
-	char *reply;
-
-	hostname = address[0];
-	port = address[1];
-	username = address[2];
 
 	/* connect to the requested NETCONF server */
-	password = address[3];
-	session = nc_session_connect(hostname, (unsigned short) atoi (port), username, NULL);
-	password = NULL;
-
-	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "host: %s, port: %s, user: %s", hostname, port, username);
-
-	/* clear plaintext password */
-	size_t size = strlen(address[3]);
-	memset(address[3], 0, size + 1);
+	password = (char*)pass;
+	session = nc_session_connect(host, (unsigned short) atoi (port), user, NULL);
 
 	/* if connected successful, add session to the list */
 	if (session != NULL) {
 		/* generate hash for the session */
 		sid = nc_session_get_id(session);
-		gserver = server;
-		gen_ncsession_hash(&session_key, hostname, port, sid);
+		session_key = gen_ncsession_hash(host, port, sid);
 		free(sid);
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "hash: %s", session_key);
-
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Key in hash to add: %s", session_key);
 		apr_hash_set(conns, apr_pstrdup(pool, session_key), APR_HASH_KEY_STRING, (void *) session);
-		reply = malloc(strlen(session_key) + 2);
-		reply[0] = MSG_OK;
-		strcpy(&(reply[1]), session_key);
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "reply: %x%s", reply[0], &(reply[1]));
-		send(client, reply, strlen(session_key) + 2, 0);
 		ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, "NETCONF session established");
-		free(session_key);
-		free(reply);
-		return;
+		return (session_key);
 	} else {
 		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Connection could not be established");
+		return (NULL);
 	}
 
-	reply = malloc(2);
-	reply[0] = MSG_ERROR;
-	reply[1] = 0;
-	send(client, reply, 2, 0);
-	free(reply);
 }
 
-static void handle_msg_close(server_rec* server, int client, apr_hash_t* conns, char* session_key)
+static int netconf_close(server_rec* server, apr_hash_t* conns, char* session_key)
 {
 	struct nc_session *ns = NULL;
-	char* reply;
 
 	ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Key in hash to get: %s", session_key);
 	ns = (struct nc_session *)apr_hash_get(conns, session_key, APR_HASH_KEY_STRING);
@@ -252,109 +238,126 @@
 		apr_hash_set(conns, session_key, APR_HASH_KEY_STRING, NULL);
 		ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, "NETCONF session closed");
 
-		reply = malloc(2);
-		reply[0] = MSG_OK;
-		reply[1] = 0;
-		send(client, reply, 2, 0);
-		free(reply);
+		return (EXIT_SUCCESS);
 	} else {
 		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Unknown session to close");
-
-		reply = malloc(2);
-		reply[0] = MSG_ERROR;
-		reply[1] = 0;
-		send(client, reply, 2, 0);
-		free(reply);
+		return (EXIT_FAILURE);
 	}
 }
 
-static void handle_netconf_request(server_rec* server, int client, apr_hash_t* conns, char* session_key)
+static char* netconf_getconfig(server_rec* server, apr_hash_t* conns, char* session_key, NC_DATASTORE source, const char* filter)
 {
 	struct nc_session *session = NULL;
-	NC_DATASTORE target = NC_DATASTORE_RUNNING;
 	nc_rpc* rpc;
 	nc_reply* reply;
-	char* data, *client_reply_data;
+	char* data;
+	struct nc_filter *f = NULL;
 
 	session = (struct nc_session *)apr_hash_get(conns, session_key, APR_HASH_KEY_STRING);
 	if (session != NULL) {
+		/* create filter if set */
+		if (filter != NULL) {
+			f = nc_filter_new(NC_FILTER_SUBTREE, filter);
+		}
+
 		/* create requests */
-		rpc = nc_rpc_getconfig (target, NULL);
+		rpc = nc_rpc_getconfig (source, f);
+		nc_filter_free(f);
 		if (rpc == NULL) {
 			ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: creating rpc request failed");
-			goto error_reply;
+			return (NULL);
 		}
+
 		/* send the request and get the reply */
 		nc_session_send_rpc (session, rpc);
 		if (nc_session_recv_reply (session, &reply) == 0) {
 			nc_rpc_free (rpc);
 			if (nc_session_get_status(session) != NC_SESSION_STATUS_WORKING) {
 				ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: receiving rpc-reply failed");
-				handle_msg_close(server, client, conns, session_key);
-				goto error_reply;
+				netconf_close(server, conns, session_key);
+				return (NULL);
 			}
+
 			/* there is error handled by callback */
-			return;
+			return (NULL);
 		}
 		nc_rpc_free (rpc);
 
 		switch (nc_reply_get_type (reply)) {
 		case NC_REPLY_DATA:
-		case NC_REPLY_ERROR:
-			data = nc_reply_dump(reply);
+			if ((data = nc_reply_get_data (reply)) == NULL) {
+				ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: no data from reply");
+				return (NULL);
+			}
 			break;
 		default:
 			ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: unexpected rpc-reply");
-			goto error_reply;
+			return (NULL);
 		}
 		nc_reply_free(reply);
 
-		if (!data) {
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: no data from reply");
-			goto error_reply;
-		}
-
-		ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, server, "NETCONF get-config is done");
-		client_reply_data = malloc(sizeof(char) * (1 + strlen(data) + 1));
-		if (client_reply_data == NULL) {
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: allocating memory for client reply failed");
-			goto error_reply;
-		}
-		client_reply_data[0] = MSG_DATA;
-		apr_cpystrn(&client_reply_data[1], data, strlen(data) + 1);
-
-		client_reply_data[0] = MSG_OK;
-		send(client, client_reply_data, strlen(client_reply_data) + 2, 0);
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "sending message from daemon: %s", client_reply_data);
-		free(client_reply_data);
+		return (data);
 	} else {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Unknown session to close");
-		goto error_reply;
+		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Unknown session to process.");
+		return (NULL);
 	}
-
-	return;
-
-error_reply:
-	client_reply_data = malloc(2);
-	client_reply_data[0] = MSG_ERROR;
-	client_reply_data[1] = 0;
-	send(client, client_reply_data, 2, 0);
-	free(client_reply_data);
 }
 
-static void get_target_address(char *address[4], char *cred)
+static char* netconf_get(server_rec* server, apr_hash_t* conns, char* session_key, const char* filter)
 {
-	int i;
+	struct nc_session *session = NULL;
+	nc_rpc* rpc;
+	nc_reply* reply;
+	char* data;
+	struct nc_filter *f = NULL;
 
-	/* <MSG_TYPE> <host> \0 <port> \0 <user> \0 <pass> \0 */
+	session = (struct nc_session *)apr_hash_get(conns, session_key, APR_HASH_KEY_STRING);
+	if (session != NULL) {
+		/* create filter if set */
+		if (filter != NULL) {
+			f = nc_filter_new(NC_FILTER_SUBTREE, filter);
+		}
 
-	/* hostname */
-	address[0] = &cred[0];
+		/* create requests */
+		rpc = nc_rpc_get (f);
+		nc_filter_free(f);
+		if (rpc == NULL) {
+			ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: creating rpc request failed");
+			return (NULL);
+		}
 
-	/* process the rest in loop */
-	for (i = 1; i < 4; i++) {
-		/* port, user, password */
-		address[i] = address[i-1] + strlen(address[i-1]) + 1;
+		/* send the request and get the reply */
+		nc_session_send_rpc (session, rpc);
+		if (nc_session_recv_reply (session, &reply) == 0) {
+			nc_rpc_free (rpc);
+			if (nc_session_get_status(session) != NC_SESSION_STATUS_WORKING) {
+				ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: receiving rpc-reply failed");
+				netconf_close(server, conns, session_key);
+				return (NULL);
+			}
+
+			/* there is error handled by callback */
+			return (NULL);
+		}
+		nc_rpc_free (rpc);
+
+		switch (nc_reply_get_type (reply)) {
+		case NC_REPLY_DATA:
+			if ((data = nc_reply_get_data (reply)) == NULL) {
+				ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: no data from reply");
+				return (NULL);
+			}
+			break;
+		default:
+			ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "mod_netconf: unexpected rpc-reply");
+			return (NULL);
+		}
+		nc_reply_free(reply);
+
+		return (data);
+	} else {
+		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Unknown session to process.");
+		return (NULL);
 	}
 }
 
@@ -380,23 +383,35 @@
 	socklen_t len, len2;
 	struct pollfd fds;
 	int status;
+	mod_netconf_cfg *config;
+	json_object *request, *reply;
+	int operation;
+	char* session_key, *data;
+	const char *msgtext;
+	const char *host, *port, *user, *pass;
+	const char *target, *source, *filter;
+	NC_DATASTORE ds_type1, ds_type2;
 
 	apr_hash_t *netconf_sessions_list;
 	char buffer[BUFFER_SIZE];
-	char *address[4];
 
 	/* change uid and gid of process for security reasons */
 	unixd_setup_child();
 
-	/* create listening UNIX socket to accept incoming connections */
+	config = ap_get_module_config(server->module_config, &netconf_module);
+	if (config == NULL) {
+		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Getting mod_netconf configuration failed");
+		return;
+	}
 
+	/* create listening UNIX socket to accept incoming connections */
 	if ((lsock = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) {
 		ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Creating socket failed (%s)", strerror(errno));
 		return;
 	}
 
 	local.sun_family = AF_UNIX;
-	strncpy(local.sun_path, SOCKET_FILENAME, sizeof(local.sun_path));
+	strncpy(local.sun_path, config->sockname, sizeof(local.sun_path));
 	unlink(local.sun_path);
 	len = offsetof(struct sockaddr_un, sun_path) + strlen(local.sun_path);
 
@@ -456,17 +471,19 @@
 			fds.events = POLLIN;
 			fds.revents = 0;
 
-			status = poll(&fds, 1, 100);
+			status = poll(&fds, 1, 1000);
 
-			if (status == -1 && errno == EINTR && isterminated == 0) {
+			if (status == 0 || (status == -1 && (errno == EAGAIN || (errno == EINTR && isterminated == 0)))) {
 				/* poll was interrupted - check if the isterminated is set and if not, try poll again */
+				//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "poll interrupted");
 				continue;
-			} else if (status <= 0) {
+			} else if (status < 0) {
 				/* 0:  poll time outed
 				 *     close socket and ignore this request from the client, it can try it again
 				 * -1: poll failed
 				 *     something wrong happend, close this socket and wait for another request
 				 */
+				//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "poll failed, status %d(%d: %s)", status, errno, strerror(errno));
 				close(client);
 				break;
 			}
@@ -477,6 +494,7 @@
 			/* if nothing to read and POLLHUP (EOF) or POLLERR set */
 			if ((fds.revents & POLLHUP) || (fds.revents & POLLERR)) {
 				/* close client's socket (it's probably already closed by client */
+				//ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "socket error (%d)", fds.revents);
 				close(client);
 				break;
 			}
@@ -485,27 +503,120 @@
 				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "receiving failed %d (%s)", errno, strerror(errno));
 				continue;
 			} else {
-				/* got message from client */
-				buffer[len2] = 0;
-				ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "received from client: %s", buffer);
+				request = json_tokener_parse(buffer);
+				operation = json_object_get_int(json_object_object_get(request, "type"));
 
-				/* message type */
-				switch (buffer[0]) {
-				case MSG_OPEN:
-					get_target_address(address, &buffer[1]);
-					handle_msg_open(server, pool, client, netconf_sessions_list, address);
+				switch (operation) {
+				case MSG_CONNECT:
+					ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: Connect");
+
+					host = json_object_get_string(json_object_object_get(request, "host"));
+					port = json_object_get_string(json_object_object_get(request, "port"));
+					user = json_object_get_string(json_object_object_get(request, "user"));
+					pass = json_object_get_string(json_object_object_get(request, "pass"));
+					ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "host: %s, port: %s, user: %s", host, port, user);
+					session_key = netconf_connect(server, pool, netconf_sessions_list, host, port, user, pass);
+					ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "hash: %s", session_key);
+
+					reply =  json_object_new_object();
+					if (session_key == NULL) {
+						/* negative reply */
+						json_object_object_add(reply, "type", json_object_new_int(REPLY_ERROR));
+						json_object_object_add(reply, "error-message", json_object_new_string("Connecting NETCONF server failed."));
+					} else {
+						/* positive reply */
+						json_object_object_add(reply, "type", json_object_new_int(REPLY_OK));
+						json_object_object_add(reply, "session", json_object_new_string(session_key));
+					}
+
+					free(session_key);
 					break;
+				case MSG_GET:
+					session_key = (char*)json_object_get_string(json_object_object_get(request, "session"));
+					ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: get-config (session %s)", session_key);
+					/* DO NOT FREE session_key HERE, IT IS PART OF REQUEST */
+
+					filter = json_object_get_string(json_object_object_get(request, "filter"));
+
+					reply =  json_object_new_object();
+
+					if ((data = netconf_get(server, netconf_sessions_list, session_key, filter)) == NULL) {
+						json_object_object_add(reply, "type", json_object_new_int(REPLY_ERROR));
+						json_object_object_add(reply, "error-message", json_object_new_string("get-config failed."));
+						break;
+					}
+
+					json_object_object_add(reply, "type", json_object_new_int(REPLY_DATA));
+					json_object_object_add(reply, "data", json_object_new_string(data));
+					break;
+				case MSG_GETCONFIG:
+					session_key = (char*)json_object_get_string(json_object_object_get(request, "session"));
+					ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: get-config (session %s)", session_key);
+					/* DO NOT FREE session_key HERE, IT IS PART OF REQUEST */
+
+					source = json_object_get_string(json_object_object_get(request, "source"));
+					filter = json_object_get_string(json_object_object_get(request, "filter"));
+
+					reply =  json_object_new_object();
+
+					if (strcmp(source, "running") == 0) {
+						ds_type1 = NC_DATASTORE_RUNNING;
+					} else if (strcmp(source, "startup") == 0) {
+						ds_type1 = NC_DATASTORE_STARTUP;
+					} else if (strcmp(source, "candidate") == 0) {
+						ds_type1 = NC_DATASTORE_CANDIDATE;
+					} else {
+						json_object_object_add(reply, "type", json_object_new_int(REPLY_ERROR));
+						json_object_object_add(reply, "error-message", json_object_new_string("Invalid target repository type requested."));
+						break;
+					}
+
+					if ((data = netconf_getconfig(server, netconf_sessions_list, session_key, ds_type1, filter)) == NULL) {
+						json_object_object_add(reply, "type", json_object_new_int(REPLY_ERROR));
+						json_object_object_add(reply, "error-message", json_object_new_string("get-config failed."));
+						break;
+					}
+
+					json_object_object_add(reply, "type", json_object_new_int(REPLY_DATA));
+					json_object_object_add(reply, "data", json_object_new_string(data));
+					break;
+				case MSG_DISCONNECT:
+					session_key = (char*)json_object_get_string(json_object_object_get(request, "session"));
+					ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Request: Disconnect session %s", session_key);
+					/* DO NOT FREE session_key HERE, IT IS PART OF REQUEST */
+
+					reply =  json_object_new_object();
+					if (netconf_close(server, netconf_sessions_list, session_key) != EXIT_SUCCESS) {
+						json_object_object_add(reply, "type", json_object_new_int(REPLY_ERROR));
+						json_object_object_add(reply, "error-message", json_object_new_string("Invalid session identifier."));
+					} else {
+						json_object_object_add(reply, "type", json_object_new_int(REPLY_OK));
+					}
+					break;
+				default:
+					ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Unknown mod_netconf operation requested (%d)", operation);
+					reply =  json_object_new_object();
+					json_object_object_add(reply, "type", json_object_new_int(REPLY_ERROR));
+					json_object_object_add(reply, "error-message", json_object_new_string("Operation not supported."));
+					break;
+				}
+				json_object_put(request);
+
+				/* send reply to caller */
+				if (reply != NULL) {
+					msgtext = json_object_to_json_string(reply);
+					send(client, msgtext, strlen(msgtext) + 1, 0);
+					json_object_put(reply);
+				} else {
+					break;
+				}
+
+#if 0
 				case MSG_DATA:
 					/* netconf data */
 					handle_netconf_request(server, client, netconf_sessions_list, &buffer[1]);
 					break;
-				case MSG_CLOSE:
-					handle_msg_close(server, client, netconf_sessions_list, &buffer[1]);
-					break;
-				default:
-					ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "Unknown mod_netconf message type");
-					break;
-				}
+#endif
 			}
 		}
 	}
@@ -524,6 +635,7 @@
 	mod_netconf_cfg *config = apr_pcalloc(pool, sizeof(mod_netconf_cfg));
 	apr_pool_create(&config->pool, pool);
 	config->forkproc = NULL;
+	config->sockname = SOCKET_FILENAME;
 
 	return (void *)config;
 }
@@ -586,152 +698,25 @@
 	return OK;
 }
 
-static int mod_netconf_fixups(request_rec *r)
-{
-	apr_pool_t *temp_pool = NULL;
-	char* operation;
-	char *data;
-	int len;
-	int sock = -1;
-	char buffer[BUFFER_SIZE];
-	struct sockaddr_un addr;
-	int retval = OK;
-
-	/* process only requests for the mod_netconf handler */
-	if (!r->handler || (strcmp(r->handler, "netconf") != 0)) {
-		return DECLINED;
-	}
-
-	/* allow running module only as subrequest */
-	if (r->main == NULL) {
-		return DECLINED;
-	}
-
-	/* create temporary pool */
-	apr_pool_create(&temp_pool, NULL);
-
-	operation = apr_pstrdup(temp_pool, apr_table_get(r->subprocess_env, "NETCONF_OP"));
-	if (operation == NULL) {
-		apr_pool_destroy(temp_pool);
-		return HTTP_INTERNAL_SERVER_ERROR;
-	}
-
-	/* connect to the daemon */
-	sock = socket(PF_UNIX, SOCK_STREAM, 0);
-	if (sock == -1) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "Cannot create client's mod_netconf socket");
-		apr_pool_destroy(temp_pool);
-		return HTTP_INTERNAL_SERVER_ERROR;
-	}
-	addr.sun_family = AF_UNIX;
-	strncpy(addr.sun_path, SOCKET_FILENAME, sizeof(addr.sun_path));
-	len = strlen(addr.sun_path) + sizeof(addr.sun_family);
-	if (connect(sock, (struct sockaddr *) &addr, len) == -1) {
-		ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "Cannot connect to the mod_netconf daemon");
-		apr_pool_destroy(temp_pool);
-		return HTTP_INTERNAL_SERVER_ERROR;
-	}
-
-	/* process the request */
-	if (strcmp(operation, "connect") == 0) {
-		char *host = apr_pstrdup(r->pool, apr_table_get(r->subprocess_env, "NETCONF_HOST"));
-		char *port = apr_pstrdup(r->pool, apr_table_get(r->subprocess_env, "NETCONF_PORT"));
-		char *user = apr_pstrdup(r->pool, apr_table_get(r->subprocess_env, "NETCONF_USER"));
-		char *pass = apr_pstrdup(r->pool, apr_table_get(r->subprocess_env, "NETCONF_PASS"));
-
-		/* <MSG_TYPE><host>\0<port>\0<user>\0<pass>\0 */
-		data = apr_psprintf(temp_pool, " %s %s %s %s", host, port, user, pass);
-		data[len = 0] = MSG_OPEN;
-		data[len += strlen(host) + 1] = 0; /* <host>\0 */
-		data[len += strlen(port) + 1] = 0; /* <port>\0 */
-		data[len += strlen(user) + 1] = 0; /* <user>\0 */
-		/* <pass>\0 is already done from printf, but we need to count index for send */
-		data[len += strlen(pass) + 1] = 0;
-
-		send(sock, data, len, 0);
-		len = recv(sock, buffer, BUFFER_SIZE, 0);
-
-		if (len < 2) {
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "Invalid reply from mod_netconf daemon");
-			apr_pool_destroy(temp_pool);
-			return HTTP_INTERNAL_SERVER_ERROR;
-		} else if (buffer[0] != MSG_OK) {
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "received from daemon: %x%s", buffer[0], &(buffer[1]));
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "Cannot connect with NETCONF server");
-			apr_pool_destroy(temp_pool);
-			return HTTP_INTERNAL_SERVER_ERROR;
-		} else {
-			/* ok, received OK message */
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "received from daemon: %x%s", buffer[0], &(buffer[1]));
-			apr_table_set(r->main->subprocess_env, "NETCONF_NSID", &(buffer[1]));
-		}
-	} else if (strcmp(operation, "disconnect") == 0) {
-		char* nsid = apr_pstrdup(r->pool, apr_table_get(r->subprocess_env, "NETCONF_NSID"));
-		data = apr_psprintf(temp_pool, " %s", nsid);
-		data[0] = MSG_CLOSE;
-		len = strlen(nsid) + 2;
-		send(sock, data, len, 0);
-		len = recv(sock, buffer, BUFFER_SIZE, 0);
-
-		if (len < 2) {
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "Invalid reply from mod_netconf daemon");
-			retval = HTTP_INTERNAL_SERVER_ERROR;
-			goto cleanup;
-		} else if (buffer[0] != MSG_OK) {
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "received from daemon: %x%s", buffer[0], &(buffer[1]));
-			ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "Cannot connect with NETCONF server");
-			retval = HTTP_INTERNAL_SERVER_ERROR;
-			goto cleanup;
-		} else {
-			/* ok, received OK message */
-			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "received from daemon: %x%s", buffer[0], &(buffer[1]));
-		}
-
-	} else if (strcmp(operation, "get-config") == 0) {
-
-	} else {
-		retval = HTTP_NOT_IMPLEMENTED;
-		goto cleanup;
-	}
-
-cleanup:
-	if (sock != -1) {
-		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "client closes socket");
-		close (sock);
-	}
-	if (temp_pool != NULL) {
-		apr_pool_destroy(temp_pool);
-	}
-
-	return retval;
-}
-
-/**
- * Testing content handler
- * This function should handle NETCONF and return UI
- */
-static int mod_netconf_handler(request_rec * r)
-{
-	/* pseudo code of args to apr_proc_create() */
-	if (!r->handler || (strcmp(r->handler, "netconf") != 0)) {
-		return DECLINED;
-	}
-
-	/* everything was done in fixups */
-	return OK;
-}
-
 /**
  * Register module hooks
  */
 static void mod_netconf_register_hooks(apr_pool_t * p)
 {
 	ap_hook_post_config(mod_netconf_master_init, NULL, NULL, APR_HOOK_LAST);
-	ap_hook_fixups(mod_netconf_fixups, NULL, NULL, APR_HOOK_FIRST);
-	ap_hook_handler(mod_netconf_handler, NULL, NULL, APR_HOOK_MIDDLE);
-
 }
 
+static const char* cfg_set_socket_path(cmd_parms* cmd, void* cfg, const char* arg)
+{
+	((mod_netconf_cfg*)cfg)->sockname = apr_pstrdup(cmd->pool, arg);
+	return NULL;
+}
+
+static const command_rec netconf_cmds[] = {
+		AP_INIT_TAKE1("NetconfSocket", cfg_set_socket_path, NULL, OR_ALL, "UNIX socket path for mod_netconf communication."),
+		{NULL}
+};
+
 /* Dispatch list for API hooks */
 module AP_MODULE_DECLARE_DATA netconf_module = {
 	STANDARD20_MODULE_STUFF,
@@ -739,6 +724,6 @@
 	NULL,			/* merge  per-dir    config structures */
 	mod_netconf_create_conf,	/* create per-server config structures */
 	NULL,			/* merge  per-server config structures */
-	NULL,			/* table of config file commands       */
+	netconf_cmds,			/* table of config file commands       */
 	mod_netconf_register_hooks	/* register hooks                      */
 };
diff --git a/src/test-client.c b/src/test-client.c
new file mode 100644
index 0000000..f9e099e
--- /dev/null
+++ b/src/test-client.c
@@ -0,0 +1,227 @@
+/*!
+ * \file test-client.c
+ * \brief Testing client sending JSON requsts to the mod_netconf socket
+ * \author Radek Krejci <rkrejci@cesnet.cz>
+ * \date 2012
+ */
+/*
+ * Copyright (C) 2012 CESNET
+ *
+ * LICENSE TERMS
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 3. Neither the name of the Company nor the names of its contributors
+ *    may be used to endorse or promote products derived from this
+ *    software without specific prior written permission.
+ *
+ * ALTERNATIVELY, provided that this notice is retained in full, this
+ * product may be distributed under the terms of the GNU General Public
+ * License (GPL) version 2 or later, in which case the provisions
+ * of the GPL apply INSTEAD OF those given above.
+ *
+ * This software is provided ``as is'', and any express or implied
+ * warranties, including, but not limited to, the implied warranties of
+ * merchantability and fitness for a particular purpose are disclaimed.
+ * In no event shall the company or contributors be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential
+ * damages (including, but not limited to, procurement of substitute
+ * goods or services; loss of use, data, or profits; or business
+ * interruption) however caused and on any theory of liability, whether
+ * in contract, strict liability, or tort (including negligence or
+ * otherwise) arising in any way out of the use of this software, even
+ * if advised of the possibility of such damage.
+ *
+ */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <json/json.h>
+
+#define SOCKET_FILENAME "/tmp/pcon.sock"
+#define BUFFER_SIZE 4096
+
+typedef enum MSG_TYPE {
+	REPLY_OK,
+	REPLY_DATA,
+	REPLY_ERROR,
+	MSG_CONNECT,
+	MSG_DISCONNECT,
+	MSG_GET,
+	MSG_GETCONFIG,
+	MSG_EDITCONFIG,
+	MSG_COPYCONFIG,
+	MSG_DELETECONFIG,
+	MSG_LOCK,
+	MSG_UNLOCK,
+	MSG_KILL
+} MSG_TYPE;
+
+void print_help(char* progname)
+{
+	printf("Usage: %s <command>\n", progname);
+	printf("Available commands:\n");
+	printf("\tconnect\n");
+	printf("\tdisconnect\n");
+	printf("\tcopy-config\n");
+	printf("\tdelete-config\n");
+	printf("\tedit-config\n");
+	printf("\tget\n");
+	printf("\tget-config\n");
+	printf("\tkill-session\n");
+	printf("\tlock\n");
+	printf("\tunlock\n");
+}
+
+int main (int argc, char* argv[])
+{
+	json_object* msg = NULL, *reply;
+	const char* msg_text;
+	int sock;
+	struct sockaddr_un addr;
+	size_t len;
+	char buffer[BUFFER_SIZE];
+	char* line = NULL;
+
+	if (argc != 2) {
+		print_help(argv[0]);
+		return (2);
+	}
+
+	/* connect to the daemon */
+	sock = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (sock == -1) {
+		fprintf(stderr, "Creating socket failed (%s)", strerror(errno));
+		return (EXIT_FAILURE);
+	}
+	addr.sun_family = AF_UNIX;
+	strncpy(addr.sun_path, SOCKET_FILENAME, sizeof(addr.sun_path));
+	len = strlen(addr.sun_path) + sizeof(addr.sun_family);
+	if (connect(sock, (struct sockaddr *) &addr, len) == -1) {
+		fprintf(stderr, "Connecting to mod_netconf (%s) failed (%s)", SOCKET_FILENAME, strerror(errno));
+		close(sock);
+		return (EXIT_FAILURE);
+	}
+
+	line = malloc(sizeof(char) * BUFFER_SIZE);
+
+	if (strcmp(argv[1], "connect") == 0) {
+		msg = json_object_new_object();
+		json_object_object_add(msg, "type", json_object_new_int(MSG_CONNECT));
+		printf("Hostname: ");
+		getline (&line, &len, stdin);
+		line[(strlen(line)-1)] = 0;
+		json_object_object_add(msg, "host", json_object_new_string(line));
+		printf("Port: ");
+		getline (&line, &len, stdin);
+		line[(strlen(line)-1)] = 0;
+		json_object_object_add(msg, "port", json_object_new_string(line));
+		printf("Username: ");
+		getline (&line, &len, stdin);
+		line[(strlen(line)-1)] = 0;
+		json_object_object_add(msg, "user", json_object_new_string(line));
+		printf("Password: ");
+		system("stty -echo");
+		getline (&line, &len, stdin);
+		system("stty echo");
+		printf("\n");
+		line[(strlen(line)-1)] = 0;
+		json_object_object_add(msg, "pass", json_object_new_string(line));
+	} else if (strcmp(argv[1], "disconnect") == 0) {
+		msg = json_object_new_object();
+		json_object_object_add(msg, "type", json_object_new_int(MSG_DISCONNECT));
+		printf("Session: ");
+		getline (&line, &len, stdin);
+		line[(strlen(line)-1)] = 0;
+		json_object_object_add(msg, "session", json_object_new_string(line));
+	} else if (strcmp(argv[1], "copy-config") == 0) {
+	} else if (strcmp(argv[1], "delete-config") == 0) {
+	} else if (strcmp(argv[1], "edit-config") == 0) {
+	} else if (strcmp(argv[1], "get") == 0) {
+		msg = json_object_new_object();
+		json_object_object_add(msg, "type", json_object_new_int(MSG_GET));
+		printf("Session: ");
+		getline (&line, &len, stdin);
+		line[(strlen(line)-1)] = 0;
+		json_object_object_add(msg, "session", json_object_new_string(line));
+		printf("Filter: ");
+		getline(&line, &len, stdin);
+		line[(strlen(line)-1)] = 0;
+		if (strlen(line) > 0) {
+			json_object_object_add(msg, "filter", json_object_new_string(line));
+		}
+	} else if (strcmp(argv[1], "get-config") == 0) {
+		msg = json_object_new_object();
+		json_object_object_add(msg, "type", json_object_new_int(MSG_GETCONFIG));
+		printf("Session: ");
+		getline (&line, &len, stdin);
+		line[(strlen(line)-1)] = 0;
+		json_object_object_add(msg, "session", json_object_new_string(line));
+		printf("Source (running|startup|candidate): ");
+		getline (&line, &len, stdin);
+		line[(strlen(line)-1)] = 0;
+		json_object_object_add(msg, "source", json_object_new_string(line));
+		printf("Filter: ");
+		getline(&line, &len, stdin);
+		line[(strlen(line)-1)] = 0;
+		if (strlen(line) > 0) {
+			json_object_object_add(msg, "filter", json_object_new_string(line));
+		}
+	} else if (strcmp(argv[1], "kill-session") == 0) {
+	} else if (strcmp(argv[1], "lock") == 0) {
+	} else if (strcmp(argv[1], "unlock") == 0) {
+	} else {
+		fprintf(stderr, "Unknown command %s\n", argv[1]);
+		close(sock);
+		return (EXIT_FAILURE);
+	}
+
+	/* send the message */
+	if (msg != NULL) {
+		msg_text = json_object_to_json_string(msg);
+
+		printf("Sending: %s\n", msg_text);
+		send(sock, msg_text, strlen(msg_text) + 1, 0);
+
+		json_object_put(msg);
+	} else {
+		close(sock);
+		return (EXIT_FAILURE);
+	}
+
+	len = recv(sock, buffer, BUFFER_SIZE, 0);
+	reply = json_tokener_parse(buffer);
+	printf("Received:\n");
+	json_object_object_foreach(reply, key, value) {
+		printf("Key: %s, Value: ", key);
+		switch(json_object_get_type(value)) {
+		case json_type_string:
+			printf("%s\n", json_object_get_string(value));
+			break;
+		case json_type_int:
+			printf("%d\n", json_object_get_int(value));
+			break;
+		default:
+			printf("\n");
+			break;
+		}
+	}
+	json_object_put(reply);
+	close(sock);
+	free(line);
+
+	return (EXIT_SUCCESS);
+}
