Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/c/Makefile	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -100,4 +100,5 @@
 	generic/vfs/canonify.c \
 	generic/net/inet.c \
+	generic/net/modules.c \
 	generic/stacktrace.c \
 	generic/arg_parse.c \
Index: uspace/lib/c/generic/net/modules.c
===================================================================
--- uspace/lib/c/generic/net/modules.c	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
+++ uspace/lib/c/generic/net/modules.c	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2009 Lukas Mejdrech
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - 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.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+
+/** @file
+ * Generic module functions implementation. 
+ *
+ * @todo MAKE IT POSSIBLE TO REMOVE THIS FILE VIA EITHER REPLACING PART OF ITS
+ * FUNCTIONALITY OR VIA INTEGRATING ITS FUNCTIONALITY MORE TIGHTLY WITH THE REST
+ * OF THE SYSTEM.
+ */
+
+#include <async.h>
+#include <malloc.h>
+#include <err.h>
+#include <sys/time.h>
+
+#include <ipc/ipc.h>
+#include <ipc/services.h>
+
+#include <net/modules.h>
+
+/** The time between connect requests in microseconds. */
+#define MODULE_WAIT_TIME	(10 * 1000)
+
+/** Answers the call.
+ *
+ * @param[in] callid	The call identifier.
+ * @param[in] result	The message processing result.
+ * @param[in] answer	The message processing answer.
+ * @param[in] answer_count The number of answer parameters.
+ */
+void
+answer_call(ipc_callid_t callid, int result, ipc_call_t *answer,
+    int answer_count)
+{
+	// choose the most efficient answer function
+	if (answer || (!answer_count)) {
+		switch (answer_count) {
+		case 0:
+			ipc_answer_0(callid, (ipcarg_t) result);
+			break;
+		case 1:
+			ipc_answer_1(callid, (ipcarg_t) result,
+			    IPC_GET_ARG1(*answer));
+			break;
+		case 2:
+			ipc_answer_2(callid, (ipcarg_t) result,
+			    IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer));
+			break;
+		case 3:
+			ipc_answer_3(callid, (ipcarg_t) result,
+			    IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer),
+			    IPC_GET_ARG3(*answer));
+			break;
+		case 4:
+			ipc_answer_4(callid, (ipcarg_t) result,
+			    IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer),
+			    IPC_GET_ARG3(*answer), IPC_GET_ARG4(*answer));
+			break;
+		case 5:
+		default:
+			ipc_answer_5(callid, (ipcarg_t) result,
+			    IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer),
+			    IPC_GET_ARG3(*answer), IPC_GET_ARG4(*answer),
+			    IPC_GET_ARG5(*answer));
+			break;
+		}
+	}
+}
+
+/** Create bidirectional connection with the needed module service and registers
+ * the message receiver.
+ *
+ * @param[in] need	The needed module service.
+ * @param[in] arg1	The first parameter.
+ * @param[in] arg2	The second parameter.
+ * @param[in] arg3	The third parameter.
+ * @param[in] client_receiver The message receiver.
+ *
+ * @return		The phone of the needed service.
+ * @return		Other error codes as defined for the ipc_connect_to_me()
+ *			function.
+ */
+int bind_service(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3,
+    async_client_conn_t client_receiver)
+{
+	return bind_service_timeout(need, arg1, arg2, arg3, client_receiver, 0);
+}
+
+/** Create bidirectional connection with the needed module service and registers
+ * the message receiver.
+ *
+ * @param[in] need	The needed module service.
+ * @param[in] arg1	The first parameter.
+ * @param[in] arg2	The second parameter.
+ * @param[in] arg3	The third parameter.
+ * @param[in] client_receiver The message receiver.
+ * @param[in] timeout	The connection timeout in microseconds. No timeout if
+ * 			set to zero (0).
+ *
+ * @return		The phone of the needed service.
+ * @return		ETIMEOUT if the connection timeouted.
+ * @return		Other error codes as defined for the ipc_connect_to_me()
+ *			function.
+ *
+ */
+int bind_service_timeout(services_t need, ipcarg_t arg1, ipcarg_t arg2,
+    ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout)
+{
+	ERROR_DECLARE;
+	
+	/* Connect to the needed service */
+	int phone = connect_to_service_timeout(need, timeout);
+	if (phone >= 0) {
+		/* Request the bidirectional connection */
+		ipcarg_t phonehash;
+		if (ERROR_OCCURRED(ipc_connect_to_me(phone, arg1, arg2, arg3,
+		    &phonehash))) {
+			ipc_hangup(phone);
+			return ERROR_CODE;
+		}
+		async_new_connection(phonehash, 0, NULL, client_receiver);
+	}
+	
+	return phone;
+}
+
+/** Connects to the needed module.
+ *
+ * @param[in] need	The needed module service.
+ * @returns		The phone of the needed service.
+ */
+int connect_to_service(services_t need)
+{
+	return connect_to_service_timeout(need, 0);
+}
+
+/** Connects to the needed module.
+ *
+ *  @param[in] need	The needed module service.
+ *  @param[in] timeout	The connection timeout in microseconds. No timeout if
+ *			set to zero (0).
+ *  @returns		The phone of the needed service.
+ *  @returns		ETIMEOUT if the connection timeouted.
+ */
+int connect_to_service_timeout(services_t need, suseconds_t timeout)
+{
+	int phone;
+
+	// if no timeout is set
+	if (timeout <= 0)
+		return async_connect_me_to_blocking(PHONE_NS, need, 0, 0);
+
+	while (true) {
+		phone = async_connect_me_to(PHONE_NS, need, 0, 0);
+		if ((phone >= 0) || (phone != ENOENT))
+			return phone;
+
+		// end if no time is left
+		if (timeout <= 0)
+			return ETIMEOUT;
+
+		// wait the minimum of the module wait time and the timeout
+		usleep((timeout <= MODULE_WAIT_TIME) ?
+		    timeout : MODULE_WAIT_TIME);
+		timeout -= MODULE_WAIT_TIME;
+	}
+}
+
+/** Receives data from the other party.
+ *
+ * The received data buffer is allocated and returned.
+ *
+ * @param[out] data	The data buffer to be filled.
+ * @param[out] length	The buffer length.
+ * @returns		EOK on success.
+ * @returns		EBADMEM if the data or the length parameter is NULL.
+ * @returns		EINVAL if the client does not send data.
+ * @returns		ENOMEM if there is not enough memory left.
+ * @returns		Other error codes as defined for the
+ *			async_data_write_finalize() function.
+ */
+int data_receive(void **data, size_t *length)
+{
+	ERROR_DECLARE;
+
+	ipc_callid_t callid;
+
+	if (!data || !length)
+		return EBADMEM;
+
+	// fetch the request
+	if (!async_data_write_receive(&callid, length))
+		return EINVAL;
+
+	// allocate the buffer
+	*data = malloc(*length);
+	if (!*data)
+		return ENOMEM;
+
+	// fetch the data
+	if (ERROR_OCCURRED(async_data_write_finalize(callid, *data, *length))) {
+		free(data);
+		return ERROR_CODE;
+	}
+
+	return EOK;
+}
+
+/** Replies the data to the other party.
+ *
+ * @param[in] data	The data buffer to be sent.
+ * @param[in] data_length The buffer length.
+ * @returns		EOK on success.
+ * @returns		EINVAL if the client does not expect the data.
+ * @returns		EOVERFLOW if the client does not expect all the data.
+ *			Only partial data are transfered.
+ * @returns		Other error codes as defined for the
+ *			async_data_read_finalize() function.
+ */
+int data_reply(void *data, size_t data_length)
+{
+	size_t length;
+	ipc_callid_t callid;
+
+	// fetch the request
+	if (!async_data_read_receive(&callid, &length))
+		return EINVAL;
+
+	// check the requested data size
+	if (length < data_length) {
+		async_data_read_finalize(callid, data, length);
+		return EOVERFLOW;
+	}
+
+	// send the data
+	return async_data_read_finalize(callid, data, data_length);
+}
+
+/** Refreshes answer structure and parameters count.
+ *
+ * Erases all attributes.
+ *
+ * @param[in,out] answer The message processing answer structure.
+ * @param[in,out] answer_count The number of answer parameters.
+ */
+void refresh_answer(ipc_call_t *answer, int *answer_count)
+{
+	if (answer_count)
+		*answer_count = 0;
+
+	if (answer) {
+		IPC_SET_RETVAL(*answer, 0);
+		// just to be precize
+		IPC_SET_METHOD(*answer, 0);
+		IPC_SET_ARG1(*answer, 0);
+		IPC_SET_ARG2(*answer, 0);
+		IPC_SET_ARG3(*answer, 0);
+		IPC_SET_ARG4(*answer, 0);
+		IPC_SET_ARG5(*answer, 0);
+	}
+}
+
+/** @}
+ */
Index: uspace/lib/c/include/net/modules.h
===================================================================
--- uspace/lib/c/include/net/modules.h	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
+++ uspace/lib/c/include/net/modules.h	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2009 Lukas Mejdrech
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - 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.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+
+/** @file
+ * Generic module functions.
+ *
+ * @todo MAKE IT POSSIBLE TO REMOVE THIS FILE VIA EITHER REPLACING PART OF ITS
+ * FUNCTIONALITY OR VIA INTEGRATING ITS FUNCTIONALITY MORE TIGHTLY WITH THE REST
+ * OF THE SYSTEM.
+ */
+
+#ifndef LIBC_MODULES_H_
+#define LIBC_MODULES_H_
+
+#include <async.h>
+
+#include <ipc/ipc.h>
+#include <ipc/services.h>
+
+#include <sys/time.h>
+
+/** Converts the data length between different types.
+ *
+ * @param[in] type_from	The source type.
+ * @param[in] type_to	The destination type.
+ * @param[in] count	The number units of the source type size.
+ */
+#define CONVERT_SIZE(type_from, type_to, count) \
+	((sizeof(type_from) / sizeof(type_to)) * (count))
+
+/** Registers the module service at the name server.
+ *
+ * @param[in] me	The module service.
+ * @param[out] phonehash The created phone hash.
+ */
+#define REGISTER_ME(me, phonehash) \
+	ipc_connect_to_me(PHONE_NS, (me), 0, 0, (phonehash))
+
+/** Connect to the needed module function type definition.
+ *
+ * @param[in] need	The needed module service.
+ * @returns		The phone of the needed service.
+ */
+typedef int connect_module_t(services_t need);
+
+extern void answer_call(ipc_callid_t, int, ipc_call_t *, int);
+extern int bind_service(services_t, ipcarg_t, ipcarg_t, ipcarg_t,
+    async_client_conn_t);
+extern int bind_service_timeout(services_t, ipcarg_t, ipcarg_t, ipcarg_t,
+    async_client_conn_t, suseconds_t);
+extern int connect_to_service(services_t);
+extern int connect_to_service_timeout(services_t, suseconds_t);
+extern int data_receive(void **, size_t *);
+extern int data_reply(void *, size_t);
+extern void refresh_answer(ipc_call_t *, int *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/adt/module_map.c
===================================================================
--- uspace/lib/net/adt/module_map.c	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/net/adt/module_map.c	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -42,5 +42,5 @@
 #include <ipc/services.h>
 
-#include <net_modules.h>
+#include <net/modules.h>
 
 #include <adt/generic_char_map.h>
Index: uspace/lib/net/generic/net_remote.c
===================================================================
--- uspace/lib/net/generic/net_remote.c	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/net/generic/net_remote.c	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -41,5 +41,5 @@
 
 #include <net_messages.h>
-#include <net_modules.h>
+#include <net/modules.h>
 #include <net_device.h>
 #include <net_interface.h>
Index: uspace/lib/net/il/arp_remote.c
===================================================================
--- uspace/lib/net/il/arp_remote.c	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/net/il/arp_remote.c	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -42,5 +42,5 @@
 
 #include <net_messages.h>
-#include <net_modules.h>
+#include <net/modules.h>
 #include <net_device.h>
 #include <arp_interface.h>
Index: uspace/lib/net/il/ip_remote.c
===================================================================
--- uspace/lib/net/il/ip_remote.c	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/net/il/ip_remote.c	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -43,5 +43,5 @@
 
 #include <net_messages.h>
-#include <net_modules.h>
+#include <net/modules.h>
 #include <net_device.h>
 #include <net/inet.h>
Index: uspace/lib/net/include/adt/module_map.h
===================================================================
--- uspace/lib/net/include/adt/module_map.h	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/net/include/adt/module_map.h	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -42,5 +42,5 @@
 #include <ipc/services.h>
 
-#include <net_modules.h>
+#include <net/modules.h>
 
 #include <adt/generic_char_map.h>
Index: uspace/lib/net/netif/netif_local.c
===================================================================
--- uspace/lib/net/netif/netif_local.c	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/net/netif/netif_local.c	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -45,5 +45,5 @@
 
 #include <net_messages.h>
-#include <net_modules.h>
+#include <net/modules.h>
 #include <packet/packet.h>
 #include <packet/packet_client.h>
Index: uspace/lib/net/netif/netif_remote.c
===================================================================
--- uspace/lib/net/netif/netif_remote.c	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/net/netif/netif_remote.c	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -37,5 +37,5 @@
 #include <ipc/services.h>
 
-#include <net_modules.h>
+#include <net/modules.h>
 #include <adt/measured_strings.h>
 #include <packet/packet.h>
Index: uspace/lib/net/tl/icmp_remote.c
===================================================================
--- uspace/lib/net/tl/icmp_remote.c	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/net/tl/icmp_remote.c	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -43,5 +43,5 @@
 
 #include <net_messages.h>
-#include <net_modules.h>
+#include <net/modules.h>
 #include <icmp_interface.h>
 #include <packet/packet_client.h>
Index: uspace/lib/socket/Makefile
===================================================================
--- uspace/lib/socket/Makefile	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/socket/Makefile	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -36,5 +36,4 @@
 	generic/socket_core.c \
 	generic/socket_parse.c \
-	generic/net_modules.c \
 	generic/icmp_common.c \
 	generic/icmp_api.c \
Index: uspace/lib/socket/generic/icmp_api.c
===================================================================
--- uspace/lib/socket/generic/icmp_api.c	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/socket/generic/icmp_api.c	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -45,5 +45,5 @@
 #include <sys/types.h>
 
-#include <net_modules.h>
+#include <net/modules.h>
 #include <icmp_api.h>
 #include <ip_codes.h>
Index: uspace/lib/socket/generic/icmp_common.c
===================================================================
--- uspace/lib/socket/generic/icmp_common.c	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/socket/generic/icmp_common.c	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -39,5 +39,5 @@
 #include <ipc/services.h>
 
-#include <net_modules.h>
+#include <net/modules.h>
 #include <icmp_common.h>
 #include <icmp_messages.h>
Index: uspace/lib/socket/generic/net_modules.c
===================================================================
--- uspace/lib/socket/generic/net_modules.c	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ 	(revision )
@@ -1,228 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/** @addtogroup net
- *  @{
- */
-
-/** @file
- *  Generic module functions implementation.
- */
-
-#include <async.h>
-#include <malloc.h>
-#include <err.h>
-
-#include <ipc/ipc.h>
-#include <ipc/services.h>
-
-#include <sys/time.h>
-
-#include <net_modules.h>
-
-/** The time between connect requests in microseconds.
- */
-#define MODULE_WAIT_TIME	(10 * 1000)
-
-void answer_call(ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count){
-	// choose the most efficient answer function
-	if(answer || (! answer_count)){
-		switch(answer_count){
-			case 0:
-				ipc_answer_0(callid, (ipcarg_t) result);
-				break;
-			case 1:
-				ipc_answer_1(callid, (ipcarg_t) result, IPC_GET_ARG1(*answer));
-				break;
-			case 2:
-				ipc_answer_2(callid, (ipcarg_t) result, IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer));
-				break;
-			case 3:
-				ipc_answer_3(callid, (ipcarg_t) result, IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer));
-				break;
-			case 4:
-				ipc_answer_4(callid, (ipcarg_t) result, IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer), IPC_GET_ARG4(*answer));
-				break;
-			case 5:
-			default:
-				ipc_answer_5(callid, (ipcarg_t) result, IPC_GET_ARG1(*answer), IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer), IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer));
-				break;
-		}
-	}
-}
-
-/** Create bidirectional connection with the needed module service and registers the message receiver.
- *
- * @param[in] need            The needed module service.
- * @param[in] arg1            The first parameter.
- * @param[in] arg2            The second parameter.
- * @param[in] arg3            The third parameter.
- * @param[in] client_receiver The message receiver.
- *
- * @return The phone of the needed service.
- * @return Other error codes as defined for the ipc_connect_to_me() function.
- *
- */
-int bind_service(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3,
-    async_client_conn_t client_receiver)
-{
-	return bind_service_timeout(need, arg1, arg2, arg3, client_receiver, 0);
-}
-
-/** Create bidirectional connection with the needed module service and registers the message receiver.
- *
- * @param[in] need            The needed module service.
- * @param[in] arg1            The first parameter.
- * @param[in] arg2            The second parameter.
- * @param[in] arg3            The third parameter.
- * @param[in] client_receiver The message receiver.
- * @param[in] timeout         The connection timeout in microseconds.
- *                            No timeout if set to zero (0).
- *
- * @return The phone of the needed service.
- * @return ETIMEOUT if the connection timeouted.
- * @return Other error codes as defined for the ipc_connect_to_me() function.
- *
- */
-int bind_service_timeout(services_t need, ipcarg_t arg1, ipcarg_t arg2,
-    ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout)
-{
-	ERROR_DECLARE;
-	
-	/* Connect to the needed service */
-	int phone = connect_to_service_timeout(need, timeout);
-	if (phone >= 0) {
-		/* Request the bidirectional connection */
-		ipcarg_t phonehash;
-		if (ERROR_OCCURRED(ipc_connect_to_me(phone, arg1, arg2, arg3,
-		    &phonehash))) {
-			ipc_hangup(phone);
-			return ERROR_CODE;
-		}
-		async_new_connection(phonehash, 0, NULL, client_receiver);
-	}
-	
-	return phone;
-}
-
-int connect_to_service(services_t need){
-	return connect_to_service_timeout(need, 0);
-}
-
-int connect_to_service_timeout(services_t need, suseconds_t timeout){
-	int phone;
-
-	// if no timeout is set
-	if (timeout <= 0){
-		return async_connect_me_to_blocking(PHONE_NS, need, 0, 0);
-	}
-
-	while(true){
-		phone = async_connect_me_to(PHONE_NS, need, 0, 0);
-		if((phone >= 0) || (phone != ENOENT)){
-			return phone;
-		}
-
-		// end if no time is left
-		if(timeout <= 0){
-			return ETIMEOUT;
-		}
-
-		// wait the minimum of the module wait time and the timeout
-		usleep((timeout <= MODULE_WAIT_TIME) ? timeout : MODULE_WAIT_TIME);
-		timeout -= MODULE_WAIT_TIME;
-	}
-}
-
-int data_receive(void ** data, size_t * length){
-	ERROR_DECLARE;
-
-	ipc_callid_t callid;
-
-	if(!(data && length)){
-		return EBADMEM;
-	}
-
-	// fetch the request
-	if(! async_data_write_receive(&callid, length)){
-		return EINVAL;
-	}
-
-	// allocate the buffer
-	*data = malloc(*length);
-	if(!(*data)){
-		return ENOMEM;
-	}
-
-	// fetch the data
-	if(ERROR_OCCURRED(async_data_write_finalize(callid, * data, * length))){
-		free(data);
-		return ERROR_CODE;
-	}
-	return EOK;
-}
-
-int data_reply(void * data, size_t data_length){
-	size_t length;
-	ipc_callid_t callid;
-
-	// fetch the request
-	if(! async_data_read_receive(&callid, &length)){
-		return EINVAL;
-	}
-
-	// check the requested data size
-	if(length < data_length){
-		async_data_read_finalize(callid, data, length);
-		return EOVERFLOW;
-	}
-
-	// send the data
-	return async_data_read_finalize(callid, data, data_length);
-}
-
-void refresh_answer(ipc_call_t * answer, int * answer_count){
-
-	if(answer_count){
-		*answer_count = 0;
-	}
-
-	if(answer){
-		IPC_SET_RETVAL(*answer, 0);
-		// just to be precize
-		IPC_SET_METHOD(*answer, 0);
-		IPC_SET_ARG1(*answer, 0);
-		IPC_SET_ARG2(*answer, 0);
-		IPC_SET_ARG3(*answer, 0);
-		IPC_SET_ARG4(*answer, 0);
-		IPC_SET_ARG5(*answer, 0);
-	}
-}
-
-/** @}
- */
Index: uspace/lib/socket/generic/socket_client.c
===================================================================
--- uspace/lib/socket/generic/socket_client.c	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/socket/generic/socket_client.c	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -48,5 +48,5 @@
 #include <ipc/socket.h>
 
-#include <net_modules.h>
+#include <net/modules.h>
 #include <net/in.h>
 #include <socket.h>
Index: uspace/lib/socket/generic/socket_core.c
===================================================================
--- uspace/lib/socket/generic/socket_core.c	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ uspace/lib/socket/generic/socket_core.c	(revision c7a8442ca3b47932cb646a789c90c21a68d739cc)
@@ -48,5 +48,5 @@
 #include <packet/packet.h>
 #include <packet/packet_client.h>
-#include <net_modules.h>
+#include <net/modules.h>
 #include <socket_core.h>
 
Index: uspace/lib/socket/include/net_modules.h
===================================================================
--- uspace/lib/socket/include/net_modules.h	(revision 88e127ee0bb8923637bdd782e2a0ca3803cd7faf)
+++ 	(revision )
@@ -1,125 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/** @addtogroup net
- *  @{
- */
-
-/** @file
- *  Generic module functions.
- */
-
-#ifndef __NET_MODULES_H__
-#define __NET_MODULES_H__
- 
-#include <async.h>
-
-#include <ipc/ipc.h>
-#include <ipc/services.h>
-
-#include <sys/time.h>
-
-/** Converts the data length between different types.
- *	@param[in] type_from The source type.
- *  @param[in] type_to The destination type.
- *  @param[in] count The number units of the source type size.
- */
-#define CONVERT_SIZE(type_from, type_to, count)	((sizeof(type_from) / sizeof(type_to)) * (count))
-
-/** Registers the module service at the name server.
- *  @param[in] me The module service.
- *  @param[out] phonehash The created phone hash.
- */
-#define REGISTER_ME(me, phonehash)	ipc_connect_to_me(PHONE_NS, (me), 0, 0, (phonehash))
-
-/** Connect to the needed module function type definition.
- *  @param[in] need The needed module service.
- *  @returns The phone of the needed service.
- */
-typedef int connect_module_t(services_t need);
-
-/** Answers the call.
- *  @param[in] callid The call identifier.
- *  @param[in] result The message processing result.
- *  @param[in] answer The message processing answer.
- *  @param[in] answer_count The number of answer parameters.
- */
-extern void answer_call(ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count);
-
-extern int bind_service(services_t, ipcarg_t, ipcarg_t, ipcarg_t,
-    async_client_conn_t);
-extern int bind_service_timeout(services_t, ipcarg_t, ipcarg_t, ipcarg_t,
-    async_client_conn_t, suseconds_t);
-
-/** Connects to the needed module.
- *  @param[in] need The needed module service.
- *  @returns The phone of the needed service.
- */
-extern int connect_to_service(services_t need);
-
-/** Connects to the needed module.
- *  @param[in] need The needed module service.
- *  @param[in] timeout The connection timeout in microseconds. No timeout if set to zero (0).
- *  @returns The phone of the needed service.
- *  @returns ETIMEOUT if the connection timeouted.
- */
-extern int connect_to_service_timeout(services_t need, suseconds_t timeout);
-
-/** Receives data from the other party.
- *  The received data buffer is allocated and returned.
- *  @param[out] data The data buffer to be filled.
- *  @param[out] length The buffer length.
- *  @returns EOK on success.
- *  @returns EBADMEM if the data or the length parameter is NULL.
- *  @returns EINVAL if the client does not send data.
- *  @returns ENOMEM if there is not enough memory left.
- *  @returns Other error codes as defined for the async_data_write_finalize() function.
- */
-extern int data_receive(void ** data, size_t * length);
-
-/** Replies the data to the other party.
- *  @param[in] data The data buffer to be sent.
- *  @param[in] data_length The buffer length.
- *  @returns EOK on success.
- *  @returns EINVAL if the client does not expect the data.
- *  @returns EOVERFLOW if the client does not expect all the data. Only partial data are transfered.
- *  @returns Other error codes as defined for the async_data_read_finalize() function.
- */
-extern int data_reply(void * data, size_t data_length);
-
-/** Refreshes answer structure and parameters count.
- *  Erases all attributes.
- *  @param[in,out] answer The message processing answer structure.
- *  @param[in,out] answer_count The number of answer parameters.
- */
-extern void refresh_answer(ipc_call_t * answer, int * answer_count);
-
-#endif
-
-/** @}
- */
