Index: uspace/lib/net/Makefile
===================================================================
--- uspace/lib/net/Makefile	(revision f902d362683090a4d4d8714b068ea5f2987efb8c)
+++ uspace/lib/net/Makefile	(revision fe8dfa6849229e829003d0fb83de58148a0aa45d)
@@ -43,4 +43,5 @@
 	netif/netif_skel.c \
 	nil/nil_remote.c \
+	nil/nil_skel.c \
 	il/il_interface.c \
 	il/ip_remote.c \
Index: uspace/lib/net/include/nil_interface.h
===================================================================
--- uspace/lib/net/include/nil_interface.h	(revision f902d362683090a4d4d8714b068ea5f2987efb8c)
+++ 	(revision )
@@ -1,73 +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 libnet
- * @{
- */
-
-#ifndef LIBNET_NIL_INTERFACE_H_
-#define LIBNET_NIL_INTERFACE_H_
-
-#include <async.h>
-#include <errno.h>
-
-#include <ipc/ipc.h>
-#include <ipc/nil.h>
-
-#include <generic.h>
-#include <nil_remote.h>
-
-#define nil_bind_service(service, device_id, me, receiver) \
-	bind_service(service, device_id, me, 0, receiver)
-
-#define nil_packet_size_req(nil_phone, device_id, packet_dimension) \
-	generic_packet_size_req_remote(nil_phone, NET_NIL_PACKET_SPACE, \
-	    device_id, packet_dimension)
-
-#define nil_get_addr_req(nil_phone, device_id, address, data) \
-	generic_get_addr_req(nil_phone, NET_NIL_ADDR, device_id, address, data)
-
-#define nil_get_broadcast_addr_req(nil_phone, device_id, address, data) \
-	generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, \
-	    address, data)
-
-#define nil_send_msg(nil_phone, device_id, packet, sender) \
-	generic_send_msg_remote(nil_phone, NET_NIL_SEND, device_id, \
-	    packet_get_id(packet), sender, 0)
-
-#define nil_device_req(nil_phone, device_id, mtu, netif_service) \
-	generic_device_req_remote(nil_phone, NET_NIL_DEVICE, device_id, mtu, \
-	    netif_service)
-
-#define nil_device_state_msg  nil_device_state_msg_remote
-#define nil_received_msg      nil_received_msg_remote
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/nil_local.h
===================================================================
--- uspace/lib/net/include/nil_local.h	(revision f902d362683090a4d4d8714b068ea5f2987efb8c)
+++ 	(revision )
@@ -1,136 +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 libnet
- * @{
- */
-
-/** @file
- * Network interface layer modules common skeleton.
- * All network interface layer modules have to implement this interface.
- */
-
-#ifndef LIBNET_NIL_LOCAL_H_
-#define LIBNET_NIL_LOCAL_H_
-
-#include <ipc/ipc.h>
-
-/** Module initialization.
- *
- * Is called by the module_start() function.
- *
- * @param[in] net_phone	The networking moduel phone.
- * @return		EOK on success.
- * @return		Other error codes as defined for each specific module
- *			initialize function.
- */
-extern int nil_initialize(int);
-
-/** Notify the network interface layer about the device state change.
- *
- * @param[in] nil_phone	The network interface layer phone.
- * @param[in] device_id	The device identifier.
- * @param[in] state	The new device state.
- * @return		EOK on success.
- * @return		Other error codes as defined for each specific module
- *			device state function.
- */
-extern int nil_device_state_msg_local(int, device_id_t, int);
-
-
-/** Pass the packet queue to the network interface layer.
- *
- * Process and redistribute the received packet queue to the registered
- * upper layers.
- *
- * @param[in] nil_phone	The network interface layer phone.
- * @param[in] device_id	The source device identifier.
- * @param[in] packet	The received packet or the received packet queue.
- * @param target	The target service. Ignored parameter.
- * @return		EOK on success.
- * @return		Other error codes as defined for each specific module
- * 			received function.
- */
-extern int nil_received_msg_local(int, device_id_t, packet_t *, services_t);
-
-/** Message processing function.
- *
- * @param[in] name	Module name.
- * @param[in] callid	The message identifier.
- * @param[in] call	The message parameters.
- * @param[out] answer	The message answer parameters.
- * @param[out] answer_count The last parameter for the actual answer in the
- *			answer parameter.
- * @return		EOK on success.
- * @return		ENOTSUP if the message is not known.
- * @return		Other error codes as defined for each specific module
- *			message function.
- *
- * @see nil_interface.h
- * @see IS_NET_NIL_MESSAGE()
- */
-extern int nil_message_standalone(const char *, ipc_callid_t, ipc_call_t *,
-    ipc_call_t *, size_t *);
-
-/** Pass the parameters to the module specific nil_message() function.
- *
- * @param[in] name	Module name.
- * @param[in] callid	The message identifier.
- * @param[in] call	The message parameters.
- * @param[out] answer	The message answer parameters.
- * @param[out] answer_count The last parameter for the actual answer in the
- *			answer parameter.
- * @return		EOK on success.
- * @return		ENOTSUP if the message is not known.
- * @return		Other error codes as defined for each specific module
- *			message function.
- */
-extern int nil_module_message_standalone(const char *, ipc_callid_t,
-    ipc_call_t *, ipc_call_t *, size_t *);
-
-/** Start the standalone nil layer module.
- *
- * Initialize the client connection serving function, initialize
- * the module, register the module service and start the async
- * manager, processing IPC messages in an infinite loop.
- *
- * @param[in] client_connection The client connection processing function.
- *			The module skeleton propagates its own one.
- * @return		EOK on success.
- * @return		Other error codes as defined for the pm_init() function.
- * @return		Other error codes as defined for the nil_initialize()
- *			function.
- * @return		Other error codes as defined for the REGISTER_ME() macro
- *			function.
- */
-extern int nil_module_start_standalone(async_client_conn_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/nil_remote.h
===================================================================
--- uspace/lib/net/include/nil_remote.h	(revision f902d362683090a4d4d8714b068ea5f2987efb8c)
+++ uspace/lib/net/include/nil_remote.h	(revision fe8dfa6849229e829003d0fb83de58148a0aa45d)
@@ -37,7 +37,30 @@
 #include <net/device.h>
 #include <net/packet.h>
+#include <generic.h>
 
-extern int nil_device_state_msg_remote(int, device_id_t, int);
-extern int nil_received_msg_remote(int, device_id_t, packet_t *, services_t);
+#define nil_bind_service(service, device_id, me, receiver) \
+	bind_service(service, device_id, me, 0, receiver)
+
+#define nil_packet_size_req(nil_phone, device_id, packet_dimension) \
+	generic_packet_size_req_remote(nil_phone, NET_NIL_PACKET_SPACE, \
+	    device_id, packet_dimension)
+
+#define nil_get_addr_req(nil_phone, device_id, address, data) \
+	generic_get_addr_req(nil_phone, NET_NIL_ADDR, device_id, address, data)
+
+#define nil_get_broadcast_addr_req(nil_phone, device_id, address, data) \
+	generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, \
+	    address, data)
+
+#define nil_send_msg(nil_phone, device_id, packet, sender) \
+	generic_send_msg_remote(nil_phone, NET_NIL_SEND, device_id, \
+	    packet_get_id(packet), sender, 0)
+
+#define nil_device_req(nil_phone, device_id, mtu, netif_service) \
+	generic_device_req_remote(nil_phone, NET_NIL_DEVICE, device_id, mtu, \
+	    netif_service)
+
+extern int nil_device_state_msg(int, device_id_t, int);
+extern int nil_received_msg(int, device_id_t, packet_t *, services_t);
 
 #endif
Index: uspace/lib/net/include/nil_skel.h
===================================================================
--- uspace/lib/net/include/nil_skel.h	(revision fe8dfa6849229e829003d0fb83de58148a0aa45d)
+++ uspace/lib/net/include/nil_skel.h	(revision fe8dfa6849229e829003d0fb83de58148a0aa45d)
@@ -0,0 +1,117 @@
+/*
+ * 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 libnet
+ * @{
+ */
+
+/** @file
+ * Network interface layer modules common skeleton.
+ * All network interface layer modules have to implement this interface.
+ */
+
+#ifndef LIBNET_NIL_SKEL_H_
+#define LIBNET_NIL_SKEL_H_
+
+#include <async.h>
+#include <fibril_synch.h>
+#include <ipc/ipc.h>
+#include <ipc/services.h>
+
+#include <adt/measured_strings.h>
+#include <net/device.h>
+#include <net/packet.h>
+
+/** Module initialization.
+ *
+ * Is called by the module_start() function.
+ *
+ * @param[in] net_phone Networking module phone.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for each specific module
+ *         initialize function.
+ *
+ */
+extern int nil_initialize(int);
+
+/** Notify the network interface layer about the device state change.
+ *
+ * @param[in] nil_phone Network interface layer phone.
+ * @param[in] device_id Device identifier.
+ * @param[in] state     New device state.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for each specific module
+ *         device state function.
+ *
+ */
+extern int nil_device_state_msg_local(int, device_id_t, int);
+
+/** Pass the packet queue to the network interface layer.
+ *
+ * Process and redistribute the received packet queue to the registered
+ * upper layers.
+ *
+ * @param[in] nil_phone Network interface layer phone.
+ * @param[in] device_id Source device identifier.
+ * @param[in] packet    Received packet or the received packet queue.
+ * @param[in] target    Target service. Ignored parameter.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for each specific module
+ *         received function.
+ *
+ */
+extern int nil_received_msg_local(int, device_id_t, packet_t *, services_t);
+
+/** Message processing function.
+ *
+ * @param[in]  name   Module name.
+ * @param[in]  callid Message identifier.
+ * @param[in]  call   Message parameters.
+ * @param[out] answer Message answer parameters.
+ * @param[out] count  Message answer arguments.
+ *
+ * @return EOK on success.
+ * @return ENOTSUP if the message is not known.
+ * @return Other error codes as defined for each specific module
+ *         message function.
+ *
+ * @see IS_NET_NIL_MESSAGE()
+ *
+ */
+extern int nil_module_message(ipc_callid_t, ipc_call_t *, ipc_call_t *,
+    size_t *);
+
+extern int nil_module_start(int);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/netif/netif_skel.c
===================================================================
--- uspace/lib/net/netif/netif_skel.c	(revision f902d362683090a4d4d8714b068ea5f2987efb8c)
+++ uspace/lib/net/netif/netif_skel.c	(revision fe8dfa6849229e829003d0fb83de58148a0aa45d)
@@ -33,5 +33,5 @@
 /** @file
  * Network interface module skeleton implementation.
- * @see netif.h
+ * @see netif_skel.h
  */
 
@@ -52,6 +52,6 @@
 #include <adt/measured_strings.h>
 #include <net/device.h>
-#include <nil_interface.h>
 #include <netif_skel.h>
+#include <nil_remote.h>
 
 DEVICE_MAP_IMPLEMENT(netif_device_map, netif_device_t);
Index: uspace/lib/net/nil/nil_remote.c
===================================================================
--- uspace/lib/net/nil/nil_remote.c	(revision f902d362683090a4d4d8714b068ea5f2987efb8c)
+++ uspace/lib/net/nil/nil_remote.c	(revision fe8dfa6849229e829003d0fb83de58148a0aa45d)
@@ -33,26 +33,26 @@
 /** @file
  * Network interface layer interface implementation for remote modules.
- * @see nil_interface.h
+ * @see nil_remote.h
  */
 
 #include <nil_remote.h>
-#include <nil_interface.h>
 #include <generic.h>
 #include <net/device.h>
 #include <net/packet.h>
 #include <packet_client.h>
-
 #include <ipc/nil.h>
 
 /** Notify the network interface layer about the device state change.
  *
- * @param[in] nil_phone	The network interface layer phone.
- * @param[in] device_id	The device identifier.
- * @param[in] state	The new device state.
- * @return		EOK on success.
- * @return		Other error codes as defined for each specific module
- *			device state function.
+ * @param[in] nil_phone Network interface layer phone.
+ * @param[in] device_id Device identifier.
+ * @param[in] state     New device state.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for each specific module
+ *         device state function.
+ *
  */
-int nil_device_state_msg_remote(int nil_phone, device_id_t device_id, int state)
+int nil_device_state_msg(int nil_phone, device_id_t device_id, int state)
 {
 	return generic_device_state_msg_remote(nil_phone, NET_NIL_DEVICE_STATE,
@@ -65,13 +65,15 @@
  * upper layers.
  *
- * @param[in] nil_phone	The network interface layer phone.
- * @param[in] device_id	The source device identifier.
- * @param[in] packet	The received packet or the received packet queue.
- * @param target	The target service. Ignored parameter.
- * @return		EOK on success.
- * @return		Other error codes as defined for each specific module
- * 			received function.
+ * @param[in] nil_phone Network interface layer phone.
+ * @param[in] device_id Source device identifier.
+ * @param[in] packet    Received packet or the received packet queue.
+ * @param[in] target    Target service. Ignored parameter.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for each specific module
+ *         received function.
+ *
  */
-int nil_received_msg_remote(int nil_phone, device_id_t device_id,
+int nil_received_msg(int nil_phone, device_id_t device_id,
     packet_t *packet, services_t target)
 {
Index: uspace/lib/net/nil/nil_skel.c
===================================================================
--- uspace/lib/net/nil/nil_skel.c	(revision fe8dfa6849229e829003d0fb83de58148a0aa45d)
+++ uspace/lib/net/nil/nil_skel.c	(revision fe8dfa6849229e829003d0fb83de58148a0aa45d)
@@ -0,0 +1,128 @@
+/*
+ * 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 libnet
+ * @{
+ */
+
+/** @file
+ * Network network interface layer module implementation.
+ * @see nil_skel.h
+ */
+
+#include <bool.h>
+#include <errno.h>
+#include <nil_skel.h>
+#include <net_interface.h>
+#include <net/modules.h>
+
+/** Default thread for new connections.
+ *
+ * @param[in] iid   The initial message identifier.
+ * @param[in] icall The initial message call structure.
+ *
+ */
+static void nil_client_connection(ipc_callid_t iid, ipc_call_t *icall)
+{
+	/*
+	 * Accept the connection by answering
+	 * the initial IPC_M_CONNECT_ME_TO call.
+	 */
+	ipc_answer_0(iid, EOK);
+	
+	while (true) {
+		ipc_call_t answer;
+		size_t count;
+		
+		/* Clear the answer structure */
+		refresh_answer(&answer, &count);
+		
+		/* Fetch the next message */
+		ipc_call_t call;
+		ipc_callid_t callid = async_get_call(&call);
+		
+		/* Process the message */
+		int res = nil_module_message(callid, &call, &answer,
+		    &count);
+		
+		/*
+		 * End if told to either by the message or the processing
+		 * result.
+		 */
+		if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||
+		    (res == EHANGUP))
+			return;
+		
+		/* Answer the message */
+		answer_call(callid, res, &answer, count);
+	}
+}
+
+/** Start the network interface layer module.
+ *
+ * Initialize the client connection serving function, initialize
+ * the module, register the module service and start the async
+ * manager, processing IPC messages in an infinite loop.
+ *
+ * @param[in] service Service identification.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the pm_init() function.
+ * @return Other error codes as defined for the nil_initialize()
+ *         function.
+ * @return Other error codes as defined for the REGISTER_ME() macro
+ *         function.
+ *
+ */
+int nil_module_start(int service)
+{
+	async_set_client_connection(nil_client_connection);
+	int net_phone = net_connect_module();
+	
+	int rc = pm_init();
+	if (rc != EOK)
+		return rc;
+	
+	rc = nil_initialize(net_phone);
+	if (rc != EOK)
+		goto out;
+	
+	sysarg_t phonehash;
+	rc = ipc_connect_to_me(PHONE_NS, service, 0, 0, &phonehash);
+	if (rc != EOK)
+		goto out;
+	
+	async_manager();
+	
+out:
+	pm_destroy();
+	return rc;
+}
+
+/** @}
+ */
