Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -66,5 +66,31 @@
 	srv/hid/kbd \
 	srv/hw/char/i8042 \
-	srv/hw/netif/dp8390
+	srv/hw/netif/dp8390 \
+	srv/net/cfg \
+	srv/net/netif/lo \
+	srv/net/il/arp \
+	srv/net/il/ip \
+	srv/net/tl/icmp \
+	srv/net/tl/udp \
+	srv/net/tl/tcp \
+	srv/net/net \
+	srv/net/netstart \
+	app/netecho \
+	app/nettest1 \
+	app/nettest2 \
+	app/ping
+
+## Networking
+#
+
+ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y)
+	LIBN = \
+		srv/net/nil/eth \
+		srv/net/nil/nildummy
+else
+	DIRS += \
+		srv/net/nil/eth \
+		srv/net/nil/nildummy
+endif
 
 ## Platform-specific hardware support
@@ -93,25 +119,4 @@
 endif
 
-## Networking
-#
-
-NETWORKING_COMMON = \
-	srv/net/netif/lo \
-	srv/net/nil/eth \
-	srv/net/nil/nildummy \
-	srv/net/net \
-	srv/net/netstart \
-	app/netecho \
-	app/nettest1 \
-	app/nettest2 \
-	app/ping
-
-NETWORKING_MODULAR = \
-	srv/net/il/arp \
-	srv/net/il/ip \
-	srv/net/tl/icmp \
-	srv/net/tl/udp \
-	srv/net/tl/tcp
-
 ## System libraries
 #
@@ -125,6 +130,5 @@
 	lib/softfloat \
 	lib/socket \
-	lib/net \
-	lib/netif
+	lib/net
 
 ifeq ($(UARCH),amd64)
@@ -139,16 +143,10 @@
 LIBC_BUILD = $(addsuffix .build,$(LIBC))
 LIBS_BUILD = $(addsuffix .build,$(LIBS))
+LIBN_BUILD = $(addsuffix .build,$(LIBN))
+BUILDS := $(addsuffix .build,$(DIRS))
 
-ifeq ($(CONFIG_NETWORKING),modular)
-	BUILDS := $(addsuffix .build,$(DIRS)) $(addsuffix .build,$(NETWORKING_COMMON)) $(addsuffix .build,$(NETWORKING_MODULAR))
-endif
+CLEANS := $(addsuffix .clean,$(DIRS)) $(addsuffix .clean,$(LIBN)) $(addsuffix .clean,$(LIBS)) $(addsuffix .clean,$(LIBC))
 
-ifeq ($(CONFIG_NETWORKING),module)
-	BUILDS := $(addsuffix .build,$(DIRS)) $(addsuffix .build,$(NETWORKING_COMMON))
-endif
-
-CLEANS := $(addsuffix .clean,$(DIRS)) $(addsuffix .clean,$(NETWORKING_COMMON)) $(addsuffix .clean,$(NETWORKING_MODULAR)) $(addsuffix .clean,$(LIBS)) $(addsuffix .clean,$(LIBC))
-
-.PHONY: all $(LIBC_BUILD) $(LIBS_BUILD) $(BUILDS) $(CLEANS) clean
+.PHONY: all $(LIBC_BUILD) $(LIBS_BUILD) $(LIBN_BUILD) $(BUILDS) $(CLEANS) clean
 
 all: $(BUILDS)
@@ -159,5 +157,8 @@
 	-$(MAKE) -C $(basename $@) clean
 
-$(BUILDS): $(LIBC_BUILD) $(LIBS_BUILD)
+$(BUILDS): $(LIBC_BUILD) $(LIBS_BUILD) $(LIBN_BUILD)
+	$(MAKE) -C $(basename $@) all PRECHECK=$(PRECHECK)
+
+$(LIBN_BUILD): $(LIBC_BUILD) $(LIBS_BUILD)
 	$(MAKE) -C $(basename $@) all PRECHECK=$(PRECHECK)
 
Index: uspace/Makefile.common
===================================================================
--- uspace/Makefile.common	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/Makefile.common	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -90,5 +90,4 @@
 LIBSOCKET_PREFIX = $(LIB_PREFIX)/socket
 LIBNET_PREFIX = $(LIB_PREFIX)/net
-LIBNETIF_PREFIX = $(LIB_PREFIX)/netif
 
 BASE_LIBS = $(LIBC_PREFIX)/libc.a $(LIBSOFTINT_PREFIX)/libsoftint.a
Index: uspace/app/bdsh/exec.c
===================================================================
--- uspace/app/bdsh/exec.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/app/bdsh/exec.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -40,4 +40,5 @@
 #include <str.h>
 #include <fcntl.h>
+#include <str_error.h>
 
 #include "config.h"
@@ -124,5 +125,5 @@
 
 	if (tid == 0) {
-		cli_error(CL_EEXEC, "Cannot spawn `%s'.", cmd);
+		cli_error(CL_EEXEC, "%s: Cannot spawn `%s'", progname, cmd);
 		return 1;
 	}
@@ -130,7 +131,8 @@
 	task_wait(tid, &texit, &retval);
 	if (texit != TASK_EXIT_NORMAL) {
-		printf("Command failed (unexpectedly terminated).\n");
+		printf("%s: Command failed (unexpectedly terminated)\n", progname);
 	} else if (retval != 0) {
-		printf("Command failed (return value %d).\n", retval);
+		printf("%s: Command failed (%s)\n",
+		    progname, str_error(retval));
 	}
 
Index: uspace/app/bdsh/scli.h
===================================================================
--- uspace/app/bdsh/scli.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/app/bdsh/scli.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -13,3 +13,5 @@
 } cliuser_t;
 
+extern const char *progname;
+
 #endif
Index: uspace/app/netecho/Makefile
===================================================================
--- uspace/app/netecho/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/app/netecho/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -35,5 +35,4 @@
 SOURCES = \
 	netecho.c \
-	parse.c \
 	print_error.c
 
Index: uspace/app/netecho/netecho.c
===================================================================
--- uspace/app/netecho/netecho.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/app/netecho/netecho.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -40,4 +40,5 @@
 #include <str.h>
 #include <task.h>
+#include <arg_parse.h>
 
 #include <in.h>
@@ -46,6 +47,6 @@
 #include <socket.h>
 #include <net_err.h>
-
-#include "parse.h"
+#include <socket_parse.h>
+
 #include "print_error.h"
 
@@ -128,8 +129,4 @@
 	int value;
 
-	// print the program label
-	printf("Task %d - ", task_get_id());
-	printf("%s\n", NAME);
-
 	// parse the command line arguments
 	for(index = 1; index < argc; ++ index){
@@ -137,11 +134,11 @@
 			switch(argv[index][1]){
 				case 'b':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &backlog, "accepted sockets queue size", 0));
+					ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &backlog, 0));
 					break;
 				case 'c':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &count, "message count", 0));
+					ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &count, 0));
 					break;
 				case 'f':
-					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 0, parse_protocol_family));
+					ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &family, 0, socket_parse_protocol_family));
 					break;
 				case 'h':
@@ -150,16 +147,16 @@
 					break;
 				case 'p':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 0));
+					ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &value, 0));
 					port = (uint16_t) value;
 					break;
 				case 'r':
-					ERROR_PROPAGATE(parse_parameter_string(argc, argv, &index, &reply, "reply string", 0));
+					ERROR_PROPAGATE(arg_parse_string(argc, argv, &index, &reply, 0));
 					break;
 				case 's':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "receive size", 0));
+					ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &value, 0));
 					size = (value >= 0) ? (size_t) value : 0;
 					break;
 				case 't':
-					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 0, parse_socket_type));
+					ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &value, 0, socket_parse_socket_type));
 					type = (sock_type_t) value;
 					break;
@@ -170,27 +167,26 @@
 				case '-':
 					if(str_lcmp(argv[index] + 2, "backlog=", 6) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &backlog, "accepted sockets queue size", 8));
+						ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &backlog, 8));
 					}else if(str_lcmp(argv[index] + 2, "count=", 6) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &count, "message count", 8));
+						ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &count, 8));
 					}else if(str_lcmp(argv[index] + 2, "family=", 7) == 0){
-						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 9, parse_protocol_family));
+						ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &family, 9, socket_parse_protocol_family));
 					}else if(str_lcmp(argv[index] + 2, "help", 5) == 0){
 						echo_print_help();
 						return EOK;
 					}else if(str_lcmp(argv[index] + 2, "port=", 5) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 7));
+						ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &value, 7));
 						port = (uint16_t) value;
 					}else if(str_lcmp(argv[index] + 2, "reply=", 6) == 0){
-						ERROR_PROPAGATE(parse_parameter_string(argc, argv, &index, &reply, "reply string", 8));
+						ERROR_PROPAGATE(arg_parse_string(argc, argv, &index, &reply, 8));
 					}else if(str_lcmp(argv[index] + 2, "size=", 5) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "receive size", 7));
+						ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &value, 7));
 						size = (value >= 0) ? (size_t) value : 0;
 					}else if(str_lcmp(argv[index] + 2, "type=", 5) == 0){
-						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 7, parse_socket_type));
+						ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &value, 7, socket_parse_socket_type));
 						type = (sock_type_t) value;
 					}else if(str_lcmp(argv[index] + 2, "verbose", 8) == 0){
 						verbose = 1;
 					}else{
-						print_unrecognized(index, argv[index] + 2);
 						echo_print_help();
 						return EINVAL;
@@ -198,10 +194,8 @@
 					break;
 				default:
-					print_unrecognized(index, argv[index] + 1);
 					echo_print_help();
 					return EINVAL;
 			}
 		}else{
-			print_unrecognized(index, argv[index]);
 			echo_print_help();
 			return EINVAL;
Index: uspace/app/netecho/parse.c
===================================================================
--- uspace/app/netecho/parse.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,123 +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_app
- *  @{
- */
-
-/** @file
- *  Generic application parsing functions implementation.
- */
-
-#include <stdio.h>
-#include <str.h>
-
-#include <socket.h>
-#include <net_err.h>
-
-#include "parse.h"
-
-int parse_address_family(const char * name){
-	if(str_lcmp(name, "AF_INET", 7) == 0){
-		return AF_INET;
-	}else if(str_lcmp(name, "AF_INET6", 8) == 0){
-		return AF_INET6;
-	}
-	return EAFNOSUPPORT;
-}
-
-int parse_parameter_int(int argc, char ** argv, int * index, int * value, const char * name, int offset){
-	char * rest;
-
-	if(offset){
-		*value = strtol(argv[*index] + offset, &rest, 10);
-	}else if((*index) + 1 < argc){
-		++ (*index);
-		*value = strtol(argv[*index], &rest, 10);
-	}else{
-		fprintf(stderr, "Command line error: missing %s\n", name);
-		return EINVAL;
-	}
-	if(rest && (*rest)){
-		fprintf(stderr, "Command line error: %s unrecognized (%d: %s)\n", name, * index, argv[*index]);
-		return EINVAL;
-	}
-	return EOK;
-}
-
-int parse_parameter_name_int(int argc, char ** argv, int * index, int * value, const char * name, int offset, int (*parse_value)(const char * value)){
-	ERROR_DECLARE;
-
-	char * parameter;
-
-	ERROR_PROPAGATE(parse_parameter_string(argc, argv, index, &parameter, name, offset));
-	*value = (*parse_value)(parameter);
-	if((*value) == ENOENT){
-		fprintf(stderr, "Command line error: unrecognized %s value (%d: %s)\n", name, * index, parameter);
-		return ENOENT;
-	}
-	return EOK;
-}
-
-int parse_parameter_string(int argc, char ** argv, int * index, char ** value, const char * name, int offset){
-	if(offset){
-		*value = argv[*index] + offset;
-	}else if((*index) + 1 < argc){
-		++ (*index);
-		*value = argv[*index];
-	}else{
-		fprintf(stderr, "Command line error: missing %s\n", name);
-		return EINVAL;
-	}
-	return EOK;
-}
-
-int parse_protocol_family(const char * name){
-	if(str_lcmp(name, "PF_INET", 7) == 0){
-		return PF_INET;
-	}else if(str_lcmp(name, "PF_INET6", 8) == 0){
-		return PF_INET6;
-	}
-	return EPFNOSUPPORT;
-}
-
-int parse_socket_type(const char * name){
-	if(str_lcmp(name, "SOCK_DGRAM", 11) == 0){
-		return SOCK_DGRAM;
-	}else if(str_lcmp(name, "SOCK_STREAM", 12) == 0){
-		return SOCK_STREAM;
-	}
-	return ESOCKTNOSUPPORT;
-}
-
-void print_unrecognized(int index, const char * parameter){
-	fprintf(stderr, "Command line error: unrecognized argument (%d: %s)\n", index, parameter);
-}
-
-/** @}
- */
Index: uspace/app/netecho/parse.h
===================================================================
--- uspace/app/netecho/parse.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,120 +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_app
- *  @{
- */
-
-/** @file
- *  Generic command line arguments parsing functions.
- */
-
-#ifndef __NET_APP_PARSE__
-#define __NET_APP_PARSE__
-
-#include <socket.h>
-
-/** Translates the character string to the address family number.
- *  @param[in] name The address family name.
- *  @returns The corresponding address family number.
- *  @returns EAFNOSUPPORTED if the address family is not supported.
- */
-extern int parse_address_family(const char * name);
-
-/** Parses the next parameter as an integral number.
- *  The actual parameter is pointed by the index.
- *  Parses the offseted actual parameter value if the offset is set or the next one if not.
- *  @param[in] argc The total number of the parameters.
- *  @param[in] argv The parameters.
- *  @param[in,out] index The actual parameter index. The index is incremented by the number of processed parameters.
- *  @param[out] value The parsed parameter value.
- *  @param[in] name The parameter name to be printed on errors.
- *  @param[in] offset The value offset in the actual parameter. If not set, the next parameter is parsed instead.
- *  @returns EOK on success.
- *  @returns EINVAL if the parameter is missing.
- *  @returns EINVAL if the parameter is in wrong format.
- */
-extern int parse_parameter_int(int argc, char ** argv, int * index, int * value, const char * name, int offset);
-
-/** Parses the next named parameter as an integral number.
- *  The actual parameter is pointed by the index.
- *  Uses the offseted actual parameter if the offset is set or the next one if not.
- *  Translates the parameter using the parse_value function.
- *  Increments the actual index by the number of processed parameters.
- *  @param[in] argc The total number of the parameters.
- *  @param[in] argv The parameters.
- *  @param[in,out] index The actual parameter index. The index is incremented by the number of processed parameters.
- *  @param[out] value The parsed parameter value.
- *  @param[in] name The parameter name to be printed on errors.
- *  @param[in] offset The value offset in the actual parameter. If not set, the next parameter is parsed instead.
- *  @param[in] parse_value The translation function to parse the named value.
- *  @returns EOK on success.
- *  @returns EINVAL if the parameter is missing.
- *  @returns ENOENT if the parameter name has not been found.
- */
-extern int parse_parameter_name_int(int argc, char ** argv, int * index, int * value, const char * name, int offset, int (*parse_value)(const char * value));
-
-/** Parses the next parameter as a character string.
- *  The actual parameter is pointed by the index.
- *  Uses the offseted actual parameter value if the offset is set or the next one if not.
- *  Increments the actual index by the number of processed parameters.
- *  @param[in] argc The total number of the parameters.
- *  @param[in] argv The parameters.
- *  @param[in,out] index The actual parameter index. The index is incremented by the number of processed parameters.
- *  @param[out] value The parsed parameter value.
- *  @param[in] name The parameter name to be printed on errors.
- *  @param[in] offset The value offset in the actual parameter. If not set, the next parameter is parsed instead.
- *  @returns EOK on success.
- *  @returns EINVAL if the parameter is missing.
- */
-extern int parse_parameter_string(int argc, char ** argv, int * index, char ** value, const char * name, int offset);
-
-/** Translates the character string to the protocol family number.
- *  @param[in] name The protocol family name.
- *  @returns The corresponding protocol family number.
- *  @returns EPFNOSUPPORTED if the protocol family is not supported.
- */
-extern int parse_protocol_family(const char * name);
-
-/** Translates the character string to the socket type number.
- *  @param[in] name The socket type name.
- *  @returns The corresponding socket type number.
- *  @returns ESOCKNOSUPPORTED if the socket type is not supported.
- */
-extern int parse_socket_type(const char * name);
-
-/** Prints the parameter unrecognized message and the application help.
- *  @param[in] index The index of the parameter.
- *  @param[in] parameter The parameter name.
- */
-extern void print_unrecognized(int index, const char * parameter);
-
-#endif
-
-/** @}
- */
Index: uspace/app/nettest1/Makefile
===================================================================
--- uspace/app/nettest1/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/app/nettest1/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -36,5 +36,4 @@
 	nettest1.c \
 	nettest.c \
-	parse.c \
 	print_error.c
 
Index: uspace/app/nettest1/nettest1.c
===================================================================
--- uspace/app/nettest1/nettest1.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/app/nettest1/nettest1.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -40,4 +40,5 @@
 #include <task.h>
 #include <time.h>
+#include <arg_parse.h>
 
 #include <in.h>
@@ -46,7 +47,7 @@
 #include <socket.h>
 #include <net_err.h>
+#include <socket_parse.h>
 
 #include "nettest.h"
-#include "parse.h"
 #include "print_error.h"
 
@@ -105,8 +106,4 @@
 	struct timeval time_after;
 
-	// print the program label
-	printf("Task %d - ", task_get_id());
-	printf("%s\n", NAME);
-
 	// parse the command line arguments
 	// stop before the last argument if it does not start with the minus sign ('-')
@@ -117,5 +114,5 @@
 				// short options with only one letter
 				case 'f':
-					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 0, parse_protocol_family));
+					ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &family, 0, socket_parse_protocol_family));
 					break;
 				case 'h':
@@ -124,19 +121,19 @@
 					break;
 				case 'm':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &messages, "message count", 0));
+					ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &messages, 0));
 					break;
 				case 'n':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 0));
+					ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &sockets, 0));
 					break;
 				case 'p':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 0));
+					ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &value, 0));
 					port = (uint16_t) value;
 					break;
 				case 's':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "packet size", 0));
+					ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &value, 0));
 					size = (value >= 0) ? (size_t) value : 0;
 					break;
 				case 't':
-					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 0, parse_socket_type));
+					ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &value, 0, socket_parse_socket_type));
 					type = (sock_type_t) value;
 					break;
@@ -147,22 +144,21 @@
 				case '-':
 					if(str_lcmp(argv[index] + 2, "family=", 7) == 0){
-						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 9, parse_protocol_family));
+						ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &family, 9, socket_parse_protocol_family));
 					}else if(str_lcmp(argv[index] + 2, "help", 5) == 0){
 						nettest1_print_help();
 						return EOK;
 					}else if(str_lcmp(argv[index] + 2, "messages=", 6) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &messages, "message count", 8));
+						ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &messages, 8));
 					}else if(str_lcmp(argv[index] + 2, "sockets=", 6) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 8));
+						ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &sockets, 8));
 					}else if(str_lcmp(argv[index] + 2, "port=", 5) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 7));
+						ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &value, 7));
 						port = (uint16_t) value;
 					}else if(str_lcmp(argv[index] + 2, "type=", 5) == 0){
-						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 7, parse_socket_type));
+						ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &value, 7, socket_parse_socket_type));
 						type = (sock_type_t) value;
 					}else if(str_lcmp(argv[index] + 2, "verbose", 8) == 0){
 						verbose = 1;
 					}else{
-						print_unrecognized(index, argv[index] + 2);
 						nettest1_print_help();
 						return EINVAL;
@@ -170,10 +166,8 @@
 					break;
 				default:
-					print_unrecognized(index, argv[index] + 1);
 					nettest1_print_help();
 					return EINVAL;
 			}
 		}else{
-			print_unrecognized(index, argv[index]);
 			nettest1_print_help();
 			return EINVAL;
Index: uspace/app/nettest1/parse.c
===================================================================
--- uspace/app/nettest1/parse.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../netecho/parse.c
Index: uspace/app/nettest1/parse.h
===================================================================
--- uspace/app/nettest1/parse.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../netecho/parse.h
Index: uspace/app/nettest2/Makefile
===================================================================
--- uspace/app/nettest2/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/app/nettest2/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -36,5 +36,4 @@
 	nettest2.c \
 	nettest.c \
-	parse.c \
 	print_error.c
 
Index: uspace/app/nettest2/nettest2.c
===================================================================
--- uspace/app/nettest2/nettest2.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/app/nettest2/nettest2.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -40,4 +40,5 @@
 #include <task.h>
 #include <time.h>
+#include <arg_parse.h>
 
 #include <in.h>
@@ -46,7 +47,7 @@
 #include <socket.h>
 #include <net_err.h>
+#include <socket_parse.h>
 
 #include "nettest.h"
-#include "parse.h"
 #include "print_error.h"
 
@@ -105,7 +106,4 @@
 	struct timeval time_after;
 
-	printf("Task %d - ", task_get_id());
-	printf("%s\n", NAME);
-
 	// parse the command line arguments
 	// stop before the last argument if it does not start with the minus sign ('-')
@@ -116,5 +114,5 @@
 				// short options with only one letter
 				case 'f':
-					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 0, parse_protocol_family));
+					ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &family, 0, socket_parse_protocol_family));
 					break;
 				case 'h':
@@ -123,19 +121,19 @@
 					break;
 				case 'm':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &messages, "message count", 0));
+					ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &messages, 0));
 					break;
 				case 'n':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 0));
+					ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &sockets, 0));
 					break;
 				case 'p':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 0));
+					ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &value, 0));
 					port = (uint16_t) value;
 					break;
 				case 's':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "packet size", 0));
+					ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &value, 0));
 					size = (value >= 0) ? (size_t) value : 0;
 					break;
 				case 't':
-					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 0, parse_socket_type));
+					ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &value, 0, socket_parse_socket_type));
 					type = (sock_type_t) value;
 					break;
@@ -146,22 +144,21 @@
 				case '-':
 					if(str_lcmp(argv[index] + 2, "family=", 7) == 0){
-						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 9, parse_protocol_family));
+						ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &family, 9, socket_parse_protocol_family));
 					}else if(str_lcmp(argv[index] + 2, "help", 5) == 0){
 						nettest2_print_help();
 						return EOK;
 					}else if(str_lcmp(argv[index] + 2, "messages=", 6) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &messages, "message count", 8));
+						ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &messages, 8));
 					}else if(str_lcmp(argv[index] + 2, "sockets=", 6) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 8));
+						ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &sockets, 8));
 					}else if(str_lcmp(argv[index] + 2, "port=", 5) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 7));
+						ERROR_PROPAGATE(arg_parse_int(argc, argv, &index, &value, 7));
 						port = (uint16_t) value;
 					}else if(str_lcmp(argv[index] + 2, "type=", 5) == 0){
-						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 7, parse_socket_type));
+						ERROR_PROPAGATE(arg_parse_name_int(argc, argv, &index, &value, 7, socket_parse_socket_type));
 						type = (sock_type_t) value;
 					}else if(str_lcmp(argv[index] + 2, "verbose", 8) == 0){
 						verbose = 1;
 					}else{
-						print_unrecognized(index, argv[index] + 2);
 						nettest2_print_help();
 						return EINVAL;
@@ -169,10 +166,8 @@
 					break;
 				default:
-					print_unrecognized(index, argv[index] + 1);
 					nettest2_print_help();
 					return EINVAL;
 			}
 		}else{
-			print_unrecognized(index, argv[index]);
 			nettest2_print_help();
 			return EINVAL;
Index: uspace/app/nettest2/parse.c
===================================================================
--- uspace/app/nettest2/parse.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../netecho/parse.c
Index: uspace/app/nettest2/parse.h
===================================================================
--- uspace/app/nettest2/parse.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../netecho/parse.h
Index: uspace/app/ping/Makefile
===================================================================
--- uspace/app/ping/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/app/ping/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -35,5 +35,4 @@
 SOURCES = \
 	ping.c \
-	parse.c \
 	print_error.c
 
Index: uspace/app/ping/parse.c
===================================================================
--- uspace/app/ping/parse.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../netecho/parse.c
Index: uspace/app/ping/parse.h
===================================================================
--- uspace/app/ping/parse.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../netecho/parse.h
Index: uspace/app/ping/ping.c
===================================================================
--- uspace/app/ping/ping.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/app/ping/ping.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -28,9 +28,9 @@
 
 /** @addtogroup ping
- *  @{
+ * @{
  */
 
 /** @file
- *  Ping application.
+ * Packet Internet Network Grouper.
  */
 
@@ -41,4 +41,6 @@
 #include <ipc/ipc.h>
 #include <ipc/services.h>
+#include <str_error.h>
+#include <arg_parse.h>
 
 #include <icmp_api.h>
@@ -48,252 +50,355 @@
 #include <ip_codes.h>
 #include <socket_errno.h>
-#include <net_err.h>
-
-#include "parse.h"
+#include <socket_parse.h>
+
 #include "print_error.h"
 
-/** Echo module name.
+#define NAME  "ping"
+
+#define CL_OK           0
+#define CL_USAGE        -1
+#define CL_MISSING      -2
+#define CL_INVALID      -3
+#define CL_UNSUPPORTED  -4
+#define CL_ERROR        -5
+
+/** Ping configuration
+ *
  */
-#define NAME	"Ping"
-
-/** Module entry point.
- *  Reads command line parameters and pings.
- *  @param[in] argc The number of command line parameters.
- *  @param[in] argv The command line parameters.
- *  @returns EOK on success.
- */
-int main(int argc, char * argv[]);
-
-/** Prints the application help.
- */
-void ping_print_help(void);
-
-int main(int argc, char * argv[]){
-	ERROR_DECLARE;
-
-	size_t size			= 38;
-	int verbose			= 0;
-	int dont_fragment	= 0;
-	ip_ttl_t ttl		= 0;
-	ip_tos_t tos		= 0;
-	int count			= 3;
-	suseconds_t timeout	= 3000;
-	int family			= AF_INET;
-
-	socklen_t max_length				= sizeof(struct sockaddr_in6);
-	uint8_t address_data[max_length];
-	struct sockaddr * address			= (struct sockaddr *) address_data;
-	struct sockaddr_in * address_in		= (struct sockaddr_in *) address;
-	struct sockaddr_in6 * address_in6	= (struct sockaddr_in6 *) address;
-	socklen_t addrlen;
-	char address_string[INET6_ADDRSTRLEN];
-	uint8_t * address_start;
-	int icmp_phone;
-	struct timeval time_before;
-	struct timeval time_after;
-	int result;
-	int value;
-	int index;
-
-	// print the program label
-	printf("Task %d - ", task_get_id());
-	printf("%s\n", NAME);
-
-	// parse the command line arguments
-	// stop before the last argument if it does not start with the minus sign ('-')
-	for(index = 1; (index < argc - 1) || ((index == argc - 1) && (argv[index][0] == '-')); ++ index){
-		// options should start with the minus sign ('-')
-		if(argv[index][0] == '-'){
-			switch(argv[index][1]){
-				// short options with only one letter
-				case 'c':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &count, "count", 0));
-					break;
-				case 'f':
-					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "address family", 0, parse_address_family));
-					break;
-				case 'h':
-					ping_print_help();
-					return EOK;
-					break;
-				case 's':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "packet size", 0));
-					size = (value >= 0) ? (size_t) value : 0;
-					break;
-				case 't':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "timeout", 0));
-					timeout = (value >= 0) ? (suseconds_t) value : 0;
-					break;
-				case 'v':
-					verbose = 1;
-					break;
-				// long options with the double minus sign ('-')
-				case '-':
-					if(str_lcmp(argv[index] + 2, "count=", 6) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &count, "received count", 8));
-					}else if(str_lcmp(argv[index] + 2, "dont_fragment", 13) == 0){
-						dont_fragment = 1;
-					}else if(str_lcmp(argv[index] + 2, "family=", 7) == 0){
-						ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "address family", 9, parse_address_family));
-					}else if(str_lcmp(argv[index] + 2, "help", 5) == 0){
-						ping_print_help();
-						return EOK;
-					}else if(str_lcmp(argv[index] + 2, "size=", 5) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "packet size", 7));
-						size = (value >= 0) ? (size_t) value : 0;
-					}else if(str_lcmp(argv[index] + 2, "timeout=", 8) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "timeout", 7));
-						timeout = (value >= 0) ? (suseconds_t) value : 0;
-					}else if(str_lcmp(argv[index] + 2, "tos=", 4) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "type of service", 7));
-						tos = (value >= 0) ? (ip_tos_t) value : 0;
-					}else if(str_lcmp(argv[index] + 2, "ttl=", 4) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "time to live", 7));
-						ttl = (value >= 0) ? (ip_ttl_t) value : 0;
-					}else if(str_lcmp(argv[index] + 2, "verbose", 8) == 0){
-						verbose = 1;
-					}else{
-						print_unrecognized(index, argv[index] + 2);
-						ping_print_help();
-						return EINVAL;
-					}
-					break;
-				default:
-					print_unrecognized(index, argv[index] + 1);
-					ping_print_help();
-					return EINVAL;
-			}
-		}else{
-			print_unrecognized(index, argv[index]);
-			ping_print_help();
-			return EINVAL;
-		}
-	}
-
-	// if not before the last argument containing the address
-	if(index >= argc){
-		printf("Command line error: missing address\n");
-		ping_print_help();
-		return EINVAL;
-	}
-
-	// prepare the address buffer
-	bzero(address_data, max_length);
-	switch(family){
-		case AF_INET:
-			address_in->sin_family = AF_INET;
-			address_start = (uint8_t *) &address_in->sin_addr.s_addr;
-			addrlen = sizeof(struct sockaddr_in);
+typedef struct {
+	bool verbose;               /**< Verbose printouts. */
+	size_t size;                /**< Outgoing packet size. */
+	unsigned int count;         /**< Number of packets to send. */
+	suseconds_t timeout;        /**< Reply wait timeout. */
+	int af;                     /**< Address family. */
+	ip_tos_t tos;               /**< Type of service. */
+	ip_ttl_t ttl;               /**< Time-to-live. */
+	bool fragments;             /**< Fragmentation. */
+	
+	char *dest_addr;            /**< Destination address. */
+	struct sockaddr_in dest;    /**< IPv4 destionation. */
+	struct sockaddr_in6 dest6;  /**< IPv6 destionation. */
+	
+	struct sockaddr *dest_raw;  /**< Raw destination address. */
+	socklen_t dest_len;         /**< Raw destination address length. */
+	
+	/** Converted address string. */
+	char dest_str[INET6_ADDRSTRLEN];
+} ping_config_t;
+
+
+static void usage(void)
+{
+	printf(
+	    "Usage: ping [-c count] [-s size] [-W timeout] [-f family] [-t ttl]\n" \
+	    "            [-Q tos] [--dont_fragment] destination\n" \
+	    "\n" \
+	    "Options:\n" \
+	    "\t-c count\n" \
+	    "\t--count=count\n" \
+	    "\t\tNumber of outgoing packets (default: 4)\n" \
+	    "\n" \
+	    "\t-s size\n" \
+	    "\t--size=bytes\n" \
+	    "\t\tOutgoing packet size (default: 56 bytes)\n" \
+	    "\n" \
+	    "\t-W timeout\n" \
+	    "\t--timeout=ms\n" \
+	    "\t\tReply wait timeout (default: 3000 ms)\n" \
+	    "\n" \
+	    "\t-f family\n" \
+	    "\t--family=family\n" \
+	    "\t\tDestination address family, AF_INET or AF_INET6 (default: AF_INET)\n" \
+	    "\n" \
+	    "\t-t ttl\n" \
+	    "\t--ttl=ttl\n" \
+	    "\t\tOutgoing packet time-to-live (default: 0)\n" \
+	    "\n" \
+	    "\t-Q tos\n" \
+	    "\t--tos=tos\n" \
+	    "\t\tOutgoing packet type of service (default: 0)\n" \
+	    "\n" \
+	    "\t--dont_fragment\n" \
+	    "\t\tDisable packet fragmentation (default: enabled)\n" \
+	    "\n" \
+	    "\t-v\n" \
+	    "\t--verbose\n" \
+	    "\t\tVerbose operation\n" \
+	    "\n" \
+	    "\t-h\n" \
+	    "\t--help\n" \
+	    "\t\tPrint this usage information\n"
+	);
+}
+
+static int arg_short_long(const char *arg, const char *ashort,
+    const char *along)
+{
+	if (str_cmp(arg, ashort) == 0)
+		return 0;
+	
+	if (str_lcmp(arg, along, str_length(along)) == 0)
+		return str_length(along);
+	
+	return -1;
+}
+
+static int args_parse(int argc, char *argv[], ping_config_t *config)
+{
+	if (argc < 2)
+		return CL_USAGE;
+	
+	int i;
+	int ret;
+	
+	for (i = 1; i < argc; i++) {
+		
+		/* Not an option */
+		if (argv[i][0] != '-')
 			break;
-		case AF_INET6:
-			address_in6->sin6_family = AF_INET6;
-			address_start = (uint8_t *) &address_in6->sin6_addr.s6_addr;
-			addrlen = sizeof(struct sockaddr_in6);
+		
+		/* Options terminator */
+		if (str_cmp(argv[i], "--") == 0) {
+			i++;
+			break;
+		}
+		
+		int off;
+		int tmp;
+		
+		/* Usage */
+		if ((off = arg_short_long(argv[i], "-h", "--help")) != -1)
+			return CL_USAGE;
+		
+		/* Verbose */
+		if ((off = arg_short_long(argv[i], "-v", "--verbose")) != -1) {
+			config->verbose = true;
+			continue;
+		}
+		
+		/* Don't fragment */
+		if (str_cmp(argv[i], "--dont_fragment") == 0) {
+			config->fragments = false;
+			continue;
+		}
+		
+		/* Count */
+		if ((off = arg_short_long(argv[i], "-c", "--count=")) != -1) {
+			ret = arg_parse_int(argc, argv, &i, &tmp, off);
+			
+			if ((ret != EOK) || (tmp < 0))
+				return i;
+			
+			config->count = (unsigned int) tmp;
+			continue;
+		}
+		
+		/* Outgoing packet size */
+		if ((off = arg_short_long(argv[i], "-s", "--size=")) != -1) {
+			ret = arg_parse_int(argc, argv, &i, &tmp, off);
+			
+			if ((ret != EOK) || (tmp < 0))
+				return i;
+			
+			config->size = (size_t) tmp;
+			continue;
+		}
+		
+		/* Reply wait timeout */
+		if ((off = arg_short_long(argv[i], "-W", "--timeout=")) != -1) {
+			ret = arg_parse_int(argc, argv, &i, &tmp, off);
+			
+			if ((ret != EOK) || (tmp < 0))
+				return i;
+			
+			config->timeout = (suseconds_t) tmp;
+			continue;
+		}
+		
+		/* Address family */
+		if ((off = arg_short_long(argv[i], "-f", "--family=")) != -1) {
+			ret = arg_parse_name_int(argc, argv, &i, &config->af, off,
+			    socket_parse_address_family);
+			
+			if (ret != EOK)
+				return i;
+			
+			continue;
+		}
+		
+		/* Type of service */
+		if ((off = arg_short_long(argv[i], "-Q", "--tos=")) != -1) {
+			ret = arg_parse_name_int(argc, argv, &i, &tmp, off,
+			    socket_parse_address_family);
+			
+			if ((ret != EOK) || (tmp < 0))
+				return i;
+			
+			config->tos = (ip_tos_t) tmp;
+			continue;
+		}
+		
+		/* Time to live */
+		if ((off = arg_short_long(argv[i], "-t", "--ttl=")) != -1) {
+			ret = arg_parse_name_int(argc, argv, &i, &tmp, off,
+			    socket_parse_address_family);
+			
+			if ((ret != EOK) || (tmp < 0))
+				return i;
+			
+			config->ttl = (ip_ttl_t) tmp;
+			continue;
+		}
+	}
+	
+	if (i >= argc)
+		return CL_MISSING;
+	
+	config->dest_addr = argv[i];
+	
+	/* Resolve destionation address */
+	switch (config->af) {
+	case AF_INET:
+		config->dest_raw = (struct sockaddr *) &config->dest;
+		config->dest_len = sizeof(config->dest);
+		config->dest.sin_family = config->af;
+		ret = inet_pton(config->af, config->dest_addr,
+		    (uint8_t *) &config->dest.sin_addr.s_addr);
+		break;
+	case AF_INET6:
+		config->dest_raw = (struct sockaddr *) &config->dest6;
+		config->dest_len = sizeof(config->dest6);
+		config->dest6.sin6_family = config->af;
+		ret = inet_pton(config->af, config->dest_addr,
+		    (uint8_t *) &config->dest6.sin6_addr.s6_addr);
+		break;
+	default:
+		return CL_UNSUPPORTED;
+	}
+	
+	if (ret != EOK)
+		return CL_INVALID;
+	
+	/* Convert destination address back to string */
+	switch (config->af) {
+	case AF_INET:
+		ret = inet_ntop(config->af,
+		    (uint8_t *) &config->dest.sin_addr.s_addr,
+		    config->dest_str, sizeof(config->dest_str));
+		break;
+	case AF_INET6:
+		ret = inet_ntop(config->af,
+		    (uint8_t *) &config->dest6.sin6_addr.s6_addr,
+		    config->dest_str, sizeof(config->dest_str));
+		break;
+	default:
+		return CL_UNSUPPORTED;
+	}
+	
+	if (ret != EOK)
+		return CL_ERROR;
+	
+	return CL_OK;
+}
+
+int main(int argc, char *argv[])
+{
+	ping_config_t config;
+	
+	/* Default configuration */
+	config.verbose = false;
+	config.size = 56;
+	config.count = 4;
+	config.timeout = 3000;
+	config.af = AF_INET;
+	config.tos = 0;
+	config.ttl = 0;
+	config.fragments = true;
+	
+	int ret = args_parse(argc, argv, &config);
+	
+	switch (ret) {
+	case CL_OK:
+		break;
+	case CL_USAGE:
+		usage();
+		return 0;
+	case CL_MISSING:
+		fprintf(stderr, "%s: Destination address missing\n", NAME);
+		return 1;
+	case CL_INVALID:
+		fprintf(stderr, "%s: Destination address '%s' invalid or malformed\n",
+		    NAME, config.dest_addr);
+		return 2;
+	case CL_UNSUPPORTED:
+		fprintf(stderr, "%s: Destination address '%s' unsupported\n",
+		    NAME, config.dest_addr);
+		return 3;
+	case CL_ERROR:
+		fprintf(stderr, "%s: Destination address '%s' error\n",
+		    NAME, config.dest_addr);
+		return 4;
+	default:
+		fprintf(stderr, "%s: Unknown or invalid option '%s'\n", NAME,
+		    argv[ret]);
+		return 5;
+	}
+	
+	printf("PING %s (%s) %u(%u) bytes of data\n", config.dest_addr,
+	    config.dest_str, config.size, config.size);
+	
+	int icmp_phone = icmp_connect_module(SERVICE_ICMP, ICMP_CONNECT_TIMEOUT);
+	if (icmp_phone < 0) {
+		fprintf(stderr, "%s: Unable to connect to ICMP service (%s)\n", NAME,
+		    str_error(icmp_phone));
+		return icmp_phone;
+	}
+	
+	unsigned int seq;
+	for (seq = 0; seq < config.count; seq++) {
+		struct timeval t0;
+		ret = gettimeofday(&t0, NULL);
+		if (ret != EOK) {
+			fprintf(stderr, "%s: gettimeofday failed (%s)\n", NAME,
+			    str_error(ret));
+			
+			ipc_hangup(icmp_phone);
+			return ret;
+		}
+		
+		/* Ping! */
+		int result = icmp_echo_msg(icmp_phone, config.size, config.timeout,
+		    config.ttl, config.tos, !config.fragments, config.dest_raw,
+		    config.dest_len);
+		
+		struct timeval t1;
+		ret = gettimeofday(&t1, NULL);
+		if (ret != EOK) {
+			fprintf(stderr, "%s: gettimeofday failed (%s)\n", NAME,
+			    str_error(ret));
+			
+			ipc_hangup(icmp_phone);
+			return ret;
+		}
+		
+		suseconds_t elapsed = tv_sub(&t1, &t0);
+		
+		switch (result) {
+		case ICMP_ECHO:
+			printf("%u bytes from ? (?): icmp_seq=%u ttl=? time=%u.%04u\n",
+				config.size, seq, elapsed / 1000, elapsed % 1000);
+			break;
+		case ETIMEOUT:
+			printf("%u bytes from ? (?): icmp_seq=%u Timed out\n",
+				config.size, seq);
 			break;
 		default:
-			fprintf(stderr, "Address family is not supported\n");
-			return EAFNOSUPPORT;
-	}
-
-	// parse the last argument which should contain the address
-	if(ERROR_OCCURRED(inet_pton(family, argv[argc - 1], address_start))){
-		fprintf(stderr, "Address parse error %d\n", ERROR_CODE);
-		return ERROR_CODE;
-	}
-
-	// connect to the ICMP module
-	icmp_phone = icmp_connect_module(SERVICE_ICMP, ICMP_CONNECT_TIMEOUT);
-	if(icmp_phone < 0){
-		fprintf(stderr, "ICMP connect error %d\n", icmp_phone);
-		return icmp_phone;
-	}
-
-	// print the ping header
-	printf("PING %d bytes of data\n", size);
-	if(ERROR_OCCURRED(inet_ntop(address->sa_family, address_start, address_string, sizeof(address_string)))){
-		fprintf(stderr, "Address error %d\n", ERROR_CODE);
-	}else{
-		printf("Address %s:\n", address_string);
-	}
-
-	// do count times
-	while(count > 0){
-
-		// get the starting time
-		if(ERROR_OCCURRED(gettimeofday(&time_before, NULL))){
-			fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
-			// release the ICMP phone
-			ipc_hangup(icmp_phone);
-			return ERROR_CODE;
-		}
-
-		// request the ping
-		result = icmp_echo_msg(icmp_phone, size, timeout, ttl, tos, dont_fragment, address, addrlen);
-
-		// get the ending time
-		if(ERROR_OCCURRED(gettimeofday(&time_after, NULL))){
-			fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
-			// release the ICMP phone
-			ipc_hangup(icmp_phone);
-			return ERROR_CODE;
-		}
-
-		// print the result
-		switch(result){
-			case ICMP_ECHO:
-				printf("Ping round trip time %d miliseconds\n", tv_sub(&time_after, &time_before) / 1000);
-				break;
-			case ETIMEOUT:
-				printf("Timed out.\n");
-				break;
-			default:
-				print_error(stdout, result, NULL, "\n");
-		}
-		-- count;
-	}
-
-	if(verbose){
-		printf("Exiting\n");
-	}
-
-	// release the ICMP phone
+			print_error(stdout, result, NULL, "\n");
+		}
+	}
+	
 	ipc_hangup(icmp_phone);
-
-	return EOK;
-}
-
-void ping_print_help(void){
-	printf(
-		"Network Ping aplication\n" \
-		"Usage: ping [options] numeric_address\n" \
-		"Where options are:\n" \
-		"\n" \
-		"-c request_count | --count=request_count\n" \
-		"\tThe number of packets the application sends. The default is three (3).\n" \
-		"\n" \
-		"--dont_fragment\n" \
-		"\tDisable packet fragmentation.\n"
-		"\n" \
-		"-f address_family | --family=address_family\n" \
-		"\tThe given address family. Only the AF_INET and AF_INET6 are supported.\n"
-		"\n" \
-		"-h | --help\n" \
-		"\tShow this application help.\n"
-		"\n" \
-		"-s packet_size | --size=packet_size\n" \
-		"\tThe packet data size the application sends. The default is 38 bytes.\n" \
-		"\n" \
-		"-t timeout | --timeout=timeout\n" \
-		"\tThe number of miliseconds the application waits for a reply. The default is three thousands (3 000).\n" \
-		"\n" \
-		"--tos=tos\n" \
-		"\tThe type of service to be used.\n" \
-		"\n" \
-		"--ttl=ttl\n" \
-		"\tThe time to live to be used.\n" \
-		"\n" \
-		"-v | --verbose\n" \
-		"\tShow all output messages.\n"
-	);
+	
+	return 0;
 }
 
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/c/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -35,11 +35,14 @@
 INCLUDE_LIBARCH = include/libarch
 
-PRE_DEPEND = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH)
+COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
+COMMON_HEADER = $(ROOT_PATH)/common.h
+COMMON_HEADER_ARCH = arch/$(UARCH)/include/common.h
+
+CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
+
+PRE_DEPEND = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH)
 EXTRA_OUTPUT = $(LINKER_SCRIPT)
-EXTRA_CLEAN = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(LINKER_SCRIPT)
+EXTRA_CLEAN = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) $(LINKER_SCRIPT)
 LIBRARY = libc
-
-COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
-CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
 
 -include $(COMMON_MAKEFILE)
@@ -58,4 +61,5 @@
 	generic/mem.c \
 	generic/str.c \
+	generic/str_error.c \
 	generic/fibril.c \
 	generic/fibril_synch.c \
@@ -90,5 +94,6 @@
 	generic/vfs/vfs.c \
 	generic/vfs/canonify.c \
-	generic/stacktrace.c
+	generic/stacktrace.c \
+	generic/arg_parse.c
 
 SOURCES = \
@@ -111,2 +116,5 @@
 $(LINKER_SCRIPT): $(LINKER_SCRIPT).in
 	$(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -E -x c $< | grep -v "^\#" > $@
+
+$(COMMON_HEADER_ARCH): $(COMMON_HEADER)
+	ln -sfn ../../../$< $@
Index: uspace/lib/c/Makefile.toolchain
===================================================================
--- uspace/lib/c/Makefile.toolchain	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,85 +1,0 @@
-#
-# Copyright (C) 2005 Martin Decky
-# 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.
-#
-
-OPTIMIZATION = 3
-
-GCC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(LIBC_PREFIX)/../../../config.h \
-	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
-	-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
-	-Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
-	-Werror-implicit-function-declaration -Wwrite-strings \
-	-Werror -pipe -g -D__$(ENDIANESS)__
-
-ICC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(LIBC_PREFIX)/../../../config.h \
-	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
-	-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
-	-Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
-	-Werror-implicit-function-declaration -Wwrite-strings \
-	-Werror -pipe -g -D__$(ENDIANESS)__
-
-CLANG_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(LIBC_PREFIX)/../../../config.h \
-	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
-	-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
-	-Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
-	-Werror-implicit-function-declaration -Wwrite-strings \
-	-pipe -g -arch $(CLANG_ARCH) -D__$(ENDIANESS)__
-
-LFLAGS = -M -N $(SOFTINT_PREFIX)/libsoftint.a
-AFLAGS =
-
-## Setup platform configuration
-#
-
--include $(LIBC_PREFIX)/../../../Makefile.common
--include $(LIBC_PREFIX)/../../../Makefile.config
--include $(LIBC_PREFIX)/arch/$(UARCH)/Makefile.inc
-
-## Compilation options
-#
-
-JOBFILE = $(LIBC_PREFIX)/../../../tools/jobfile.py
-
-ifeq ($(COMPILER),gcc_cross)
-	CFLAGS = $(GCC_CFLAGS)
-	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
-endif
-
-ifeq ($(COMPILER),gcc_native)
-	CFLAGS = $(GCC_CFLAGS)
-	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
-endif
-
-ifeq ($(COMPILER),icc)
-	CFLAGS = $(ICC_CFLAGS)
-	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
-endif
-
-ifeq ($(COMPILER),clang)
-	CFLAGS = $(CLANG_CFLAGS)
-	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
-endif
Index: uspace/lib/c/arch/abs32le/include/types.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/types.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/c/arch/abs32le/include/types.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -38,15 +38,7 @@
 #define __32_BITS__
 
-typedef unsigned int sysarg_t;
+#include <libarch/common.h>
 
-typedef char int8_t;
-typedef short int int16_t;
-typedef int int32_t;
-typedef long long int int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short int uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long int uint64_t;
+typedef uint32_t sysarg_t;
 
 typedef int32_t ssize_t;
Index: uspace/lib/c/arch/amd64/include/types.h
===================================================================
--- uspace/lib/c/arch/amd64/include/types.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/c/arch/amd64/include/types.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -38,15 +38,7 @@
 #define __64_BITS__
 
-typedef unsigned long long sysarg_t;
+#include <libarch/common.h>
 
-typedef signed char int8_t;
-typedef short int int16_t;
-typedef int int32_t;
-typedef long long int int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short int uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long int uint64_t;
+typedef uint64_t sysarg_t;
 
 typedef int64_t ssize_t;
Index: uspace/lib/c/arch/arm32/include/types.h
===================================================================
--- uspace/lib/c/arch/arm32/include/types.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/c/arch/arm32/include/types.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -27,8 +27,8 @@
  */
 
-/** @addtogroup libcarm32	
+/** @addtogroup libcarm32
  * @{
  */
-/** @file 
+/** @file
  *  @brief Definitions of basic types like #uintptr_t.
  */
@@ -39,15 +39,7 @@
 #define __32_BITS__
 
-typedef unsigned int sysarg_t;
+#include <libarch/common.h>
 
-typedef char int8_t;
-typedef short int int16_t;
-typedef long int int32_t;
-typedef long long int int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short int uint16_t;
-typedef unsigned long int uint32_t;
-typedef unsigned long long int uint64_t;
+typedef uint32_t sysarg_t;
 
 typedef int32_t ssize_t;
Index: uspace/lib/c/arch/ia32/include/types.h
===================================================================
--- uspace/lib/c/arch/ia32/include/types.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/c/arch/ia32/include/types.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -38,15 +38,7 @@
 #define __32_BITS__
 
-typedef unsigned int sysarg_t;
+#include <libarch/common.h>
 
-typedef char int8_t;
-typedef short int int16_t;
-typedef int int32_t;
-typedef long long int int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short int uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long int uint64_t;
+typedef uint32_t sysarg_t;
 
 typedef int32_t ssize_t;
Index: uspace/lib/c/arch/ia64/include/types.h
===================================================================
--- uspace/lib/c/arch/ia64/include/types.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/c/arch/ia64/include/types.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -38,20 +38,7 @@
 #define __64_BITS__
 
-typedef unsigned long sysarg_t;
+#include <libarch/common.h>
 
-typedef char int8_t;
-typedef short int int16_t;
-typedef int int32_t;
-typedef long int int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short int uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long int uint64_t;
-
-typedef struct {
-	uint64_t lo;
-	uint64_t hi;
-} uint128_t;
+typedef uint64_t sysarg_t;
 
 typedef int64_t ssize_t;
Index: uspace/lib/c/arch/mips32/include/types.h
===================================================================
--- uspace/lib/c/arch/mips32/include/types.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/c/arch/mips32/include/types.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -39,15 +39,7 @@
 #define __32_BITS__
 
-typedef unsigned int sysarg_t;
+#include <libarch/common.h>
 
-typedef char int8_t;
-typedef short int int16_t;
-typedef long int int32_t;
-typedef long long int int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short int uint16_t;
-typedef unsigned long int uint32_t;
-typedef unsigned long long int uint64_t;
+typedef uint32_t sysarg_t;
 
 typedef int32_t ssize_t;
Index: uspace/lib/c/arch/ppc32/include/types.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/types.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/c/arch/ppc32/include/types.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -38,15 +38,7 @@
 #define __32_BITS__
 
-typedef unsigned int sysarg_t;
+#include <libarch/common.h>
 
-typedef char int8_t;
-typedef short int int16_t;
-typedef int int32_t;
-typedef long long int int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short int uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long int uint64_t;
+typedef uint32_t sysarg_t;
 
 typedef int32_t ssize_t;
Index: uspace/lib/c/arch/sparc64/include/types.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/types.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/c/arch/sparc64/include/types.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -38,15 +38,7 @@
 #define __64_BITS__
 
-typedef unsigned long sysarg_t;
+#include <libarch/common.h>
 
-typedef signed char int8_t;
-typedef short int int16_t;
-typedef int int32_t;
-typedef long int int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short int uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long int uint64_t;
+typedef uint64_t sysarg_t;
 
 typedef int64_t ssize_t;
Index: uspace/lib/c/generic/arg_parse.c
===================================================================
--- uspace/lib/c/generic/arg_parse.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/c/generic/arg_parse.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,141 @@
+/*
+ * 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.
+ */
+
+/** @file
+ * Command-line arguments parsing functions
+ */
+
+#include <arg_parse.h>
+#include <errno.h>
+#include <str.h>
+
+/** Parse the next argument as an integer.
+ *
+ * The actual argument is pointed by the index.
+ * Parse the offseted argument value if the offset is set
+ * or the next one if not.
+ *
+ * @param[in]     argc   The total number of arguments.
+ * @param[in]     argv   The arguments.
+ * @param[in,out] index  The actual argument index. The index is incremented
+ *                       by the number of processed arguments.
+ * @param[out]    value  The parsed argument value.
+ * @param[in]     offset The value offset in the actual argument. If not set,
+ *                       the next argument is parsed instead.
+ *
+ * @return EOK on success.
+ * @return ENOENT if the argument is missing.
+ * @return EINVAL if the argument is in wrong format.
+ *
+ */
+int arg_parse_int(int argc, char *argv[], int *index, int *value,
+    int offset)
+{
+	char *rest;
+	
+	if (offset)
+		*value = strtol(argv[*index] + offset, &rest, 10);
+	else if ((*index) + 1 < argc) {
+		(*index)++;
+		*value = strtol(argv[*index], &rest, 10);
+	} else
+		return ENOENT;
+	
+	if ((rest) && (*rest))
+		return EINVAL;
+	
+	return EOK;
+}
+
+/** Parse the next named argument as an integral number.
+ *
+ * The actual argument is pointed by the index.
+ * Parse the offseted actual argument if the offset is set or the next
+ * one if not. Translate the argument using the parse_value function.
+ * Increment the actual index by the number of processed arguments.
+ *
+ * @param[in]     argc        The total number of arguments.
+ * @param[in]     argv        The arguments.
+ * @param[in,out] index       The actual argument index. The index is
+ *                            incremented by the number of processed arguments.
+ * @param[out]    value       The parsed argument value.
+ * @param[in]     offset      The value offset in the actual argument. If not
+ *                            set, the next argument is parsed instead.
+ * @param[in]     parse_value The translation function to parse the named value.
+ *
+ * @return EOK on success.
+ * @return ENOENT if the argument is missing.
+ * @return EINVAL if the argument name has not been found.
+ *
+ */
+int arg_parse_name_int(int argc, char *argv[], int *index, int *value,
+    int offset, arg_parser parser)
+{
+	char *arg;
+	
+	int ret = arg_parse_string(argc, argv, index, &arg, offset);
+	if (ret != EOK)
+		return ret;
+	
+	return parser(arg, value);
+}
+
+/** Parse the next argument as a character string.
+ *
+ * The actual argument is pointed by the index.
+ * Parse the offseted actual argument value if the offset is set or the next
+ * one if not. Increment the actual index by the number of processed arguments.
+ *
+ * @param[in]     argc   The total number of arguments.
+ * @param[in]     argv   The arguments.
+ * @param[in,out] index  The actual argument index. The index is
+ *                       incremented by the number of processed arguments.
+ * @param[out]    value  The parsed argument value.
+ * @param[in]     offset The value offset in the actual argument. If not set,
+ *                       the next argument is parsed instead.
+ *
+ * @return EOK on success.
+ * @return ENOENT if the parameter is missing.
+ *
+ */
+int arg_parse_string(int argc, char **argv, int *index, char **value,
+    int offset)
+{
+	if (offset)
+		*value = argv[*index] + offset;
+	else if ((*index) + 1 < argc) {
+		(*index)++;
+		*value = argv[*index];
+	} else
+		return ENOENT;
+	
+	return EOK;
+}
+
+/** @}
+ */
Index: uspace/lib/c/generic/str_error.c
===================================================================
--- uspace/lib/c/generic/str_error.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/c/generic/str_error.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2010 Martin Decky
+ * 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
+ */
+
+#include <str_error.h>
+#include <stdio.h>
+#include <fibril.h>
+
+#define MIN_ERRNO  -17
+#define NOERR_LEN  64
+
+static const char* err_desc[] = {
+	"No error",
+	"No such entry",
+	"Not enought memory",
+	"Limit exceeded", 
+	"Connection refused",
+	"Forward error",
+	"Permission denied",
+	"Answerbox closed connection",
+	"Other party error",
+	"Entry already exists",
+	"Bad memory pointer",
+	"Not supported",
+	"Address not available",
+	"Timeout expired",
+	"Invalid value",
+	"Resource is busy",
+	"Result does not fits its size",
+	"Operation was interrupted"
+};
+
+static fibril_local char noerr[NOERR_LEN];
+
+const char *str_error(const int errno)
+{
+	if ((errno <= 0) && (errno >= MIN_ERRNO))
+		return err_desc[-errno];
+	
+	snprintf(noerr, NOERR_LEN, "Unkown error code %d", errno);
+	return noerr;
+}
+
+/** @}
+ */
Index: uspace/lib/c/include/arg_parse.h
===================================================================
--- uspace/lib/c/include/arg_parse.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/c/include/arg_parse.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,47 @@
+/*
+ * 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
+ */
+
+#ifndef LIBC_ARG_PARSE_H_
+#define LIBC_ARG_PARSE_H_
+
+typedef int (*arg_parser)(const char *, int *);
+
+extern int arg_parse_int(int, char **, int *, int *, int);
+extern int arg_parse_name_int(int, char **, int *, int *, int, arg_parser);
+extern int arg_parse_string(int, char **, int *, char **, int);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/errno.h
===================================================================
--- uspace/lib/c/include/errno.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/c/include/errno.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -43,5 +43,5 @@
 #define errno _errno
 
-#define EMFILE        (-17)
+#define EMFILE        (-18)
 #define ENAMETOOLONG  (-256)
 #define EISDIR        (-257)
Index: uspace/lib/c/include/str_error.h
===================================================================
--- uspace/lib/c/include/str_error.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/c/include/str_error.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010 Martin Decky
+ * 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
+ */
+
+#ifndef LIBC_STRERROR_H_
+#define LIBC_STRERROR_H_
+
+const char *str_error(const int);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/Makefile
===================================================================
--- uspace/lib/net/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -37,6 +37,6 @@
 	generic/packet_remote.c \
 	adt/module_map.c \
-	netif/netif.c \
-	netif/netif_standalone.c \
+	netif/netif_local.c \
+	netif/netif_remote.c \
 	netif/netif_nil_bundle.c \
 	nil/nil_remote.c \
Index: uspace/lib/net/generic/net_remote.c
===================================================================
--- uspace/lib/net/generic/net_remote.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/generic/net_remote.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -32,5 +32,5 @@
 
 /** @file
- *  Networking interface implementation for standalone remote modules.
+ *  Networking interface implementation for remote modules.
  *  @see net_interface.h
  */
Index: uspace/lib/net/generic/packet_remote.c
===================================================================
--- uspace/lib/net/generic/packet_remote.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/generic/packet_remote.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -32,5 +32,5 @@
 
 /** @file
- *  Packet client interface implementation for standalone remote modules.
+ *  Packet client interface implementation for remote modules.
  *  @see packet_client.h
  */
@@ -47,94 +47,107 @@
 #include <packet/packet_header.h>
 #include <packet/packet_messages.h>
+#include <packet_remote.h>
 
-/** Obtains the packet from the packet server as the shared memory block.
- *  Creates the local packet mapping as well.
- *  @param[in] phone The packet server module phone.
- *  @param[out] packet The packet reference pointer to store the received packet reference.
- *  @param[in] packet_id The packet identifier.
- *  @param[in] size The packet total size in bytes.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the pm_add() function.
- *  @returns Other error codes as defined for the async_share_in_start() function.
+/** Obtain the packet from the packet server as the shared memory block.
+ *
+ * Create the local packet mapping as well.
+ *
+ * @param[in]  phone     The packet server module phone.
+ * @param[out] packet    The packet reference pointer to store the received
+ *                       packet reference.
+ * @param[in]  packet_id The packet identifier.
+ * @param[in]  size      The packet total size in bytes.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the pm_add() function.
+ * @return Other error codes as defined for the async_share_in_start() function.
+ *
  */
-int packet_return(int phone, packet_ref packet, packet_id_t packet_id, size_t size);
-
-int packet_translate(int phone, packet_ref packet, packet_id_t packet_id){
+static int packet_return(int phone, packet_ref packet, packet_id_t packet_id, size_t size){
 	ERROR_DECLARE;
-
-	ipcarg_t size;
-	packet_t next;
-
-	if(! packet){
-		return EINVAL;
-	}
-	*packet = pm_find(packet_id);
-	if(!(*packet)){
-		ERROR_PROPAGATE(async_req_1_1(phone, NET_PACKET_GET_SIZE, packet_id, &size));
-		ERROR_PROPAGATE(packet_return(phone, packet, packet_id, size));
-	}
-	if((** packet).next){
-		return packet_translate(phone, &next, (** packet).next);
-	}else return EOK;
-}
-
-int packet_return(int phone, packet_ref packet, packet_id_t packet_id, size_t size){
-	ERROR_DECLARE;
-
-	aid_t message;
+	
 	ipc_call_t answer;
-	ipcarg_t result;
-
-	message = async_send_1(phone, NET_PACKET_GET, packet_id, &answer);
+	aid_t message = async_send_1(phone, NET_PACKET_GET, packet_id, &answer);
 	*packet = (packet_t) as_get_mappable_page(size);
-	if(ERROR_OCCURRED(async_share_in_start_0_0(phone, * packet, size))
-		|| ERROR_OCCURRED(pm_add(*packet))){
+	if (ERROR_OCCURRED(async_share_in_start_0_0(phone, *packet, size))
+	    || ERROR_OCCURRED(pm_add(*packet))) {
 		munmap(*packet, size);
 		async_wait_for(message, NULL);
 		return ERROR_CODE;
 	}
+	
+	ipcarg_t result;
 	async_wait_for(message, &result);
+	
 	return result;
 }
 
-packet_t packet_get_4(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix){
+int packet_translate_remote(int phone, packet_ref packet, packet_id_t packet_id)
+{
 	ERROR_DECLARE;
+	
+	if (!packet)
+		return EINVAL;
+	
+	*packet = pm_find(packet_id);
+	if (!(*packet)) {
+		ipcarg_t size;
+		
+		ERROR_PROPAGATE(async_req_1_1(phone, NET_PACKET_GET_SIZE, packet_id, &size));
+		ERROR_PROPAGATE(packet_return(phone, packet, packet_id, size));
+	}
+	if ((** packet).next) {
+		packet_t next;
+		
+		return packet_translate_remote(phone, &next, (** packet).next);
+	}
+	
+	return EOK;
+}
 
+packet_t packet_get_4_remote(int phone, size_t max_content, size_t addr_len,
+    size_t max_prefix, size_t max_suffix)
+{
+	ERROR_DECLARE;
+	
 	ipcarg_t packet_id;
 	ipcarg_t size;
-	packet_t packet;
-
-	if(ERROR_OCCURRED(async_req_4_2(phone, NET_PACKET_CREATE_4, max_content, addr_len, max_prefix, max_suffix, &packet_id, &size))){
+	
+	if (ERROR_OCCURRED(async_req_4_2(phone, NET_PACKET_CREATE_4, max_content,
+	    addr_len, max_prefix, max_suffix, &packet_id, &size)))
 		return NULL;
+	
+	
+	packet_t packet = pm_find(packet_id);
+	if (!packet) {
+		if (ERROR_OCCURRED(packet_return(phone, &packet, packet_id, size)))
+			return NULL;
 	}
-	packet = pm_find(packet_id);
-	if(! packet){
-		if(ERROR_OCCURRED(packet_return(phone, &packet, packet_id, size))){
-			return NULL;
-		}
-	}
+	
 	return packet;
 }
 
-packet_t packet_get_1(int phone, size_t content){
+packet_t packet_get_1_remote(int phone, size_t content)
+{
 	ERROR_DECLARE;
-
+	
 	ipcarg_t packet_id;
 	ipcarg_t size;
-	packet_t packet;
-
-	if(ERROR_OCCURRED(async_req_1_2(phone, NET_PACKET_CREATE_1, content, &packet_id, &size))){
+	
+	if (ERROR_OCCURRED(async_req_1_2(phone, NET_PACKET_CREATE_1, content,
+	    &packet_id, &size)))
 		return NULL;
+	
+	packet_t packet = pm_find(packet_id);
+	if (!packet) {
+		if (ERROR_OCCURRED(packet_return(phone, &packet, packet_id, size)))
+			return NULL;
 	}
-	packet = pm_find(packet_id);
-	if(! packet){
-		if(ERROR_OCCURRED(packet_return(phone, &packet, packet_id, size))){
-			return NULL;
-		}
-	}
+	
 	return packet;
 }
 
-void pq_release(int phone, packet_id_t packet_id){
+void pq_release_remote(int phone, packet_id_t packet_id)
+{
 	async_msg_1(phone, NET_PACKET_RELEASE, packet_id);
 }
Index: uspace/lib/net/il/arp_remote.c
===================================================================
--- uspace/lib/net/il/arp_remote.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/il/arp_remote.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -32,5 +32,5 @@
 
 /** @file
- *  ARP interface implementation for standalone remote modules.
+ *  ARP interface implementation for remote modules.
  *  @see arp_interface.h
  */
Index: uspace/lib/net/il/ip_client.c
===================================================================
--- uspace/lib/net/il/ip_client.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/il/ip_client.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -56,5 +56,5 @@
 }
 
-int ip_client_get_pseudo_header(ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, ip_pseudo_header_ref * header, size_t * headerlen){
+int ip_client_get_pseudo_header(ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, void **header, size_t * headerlen){
 	ipv4_pseudo_header_ref header_in;
 	struct sockaddr_in * address_in;
@@ -84,5 +84,5 @@
 			header_in->protocol = protocol;
 			header_in->data_length = htons(data_length);
-			*header = (ip_pseudo_header_ref) header_in;
+			*header = header_in;
 			return EOK;
 		// TODO IPv6
@@ -164,5 +164,5 @@
 }
 
-int ip_client_set_pseudo_header_data_length(ip_pseudo_header_ref header, size_t headerlen, size_t data_length){
+int ip_client_set_pseudo_header_data_length(void *header, size_t headerlen, size_t data_length){
 	ipv4_pseudo_header_ref header_in;
 
Index: uspace/lib/net/il/ip_remote.c
===================================================================
--- uspace/lib/net/il/ip_remote.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/il/ip_remote.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -28,11 +28,14 @@
 
 /** @addtogroup ip
- *  @{
+ * @{
  */
 
 /** @file
- *  IP interface implementation for standalone remote modules.
- *  @see ip_interface.h
- *  @see il_interface.h
+ *
+ * IP interface implementation for remote modules.
+ *
+ * @see ip_interface.h
+ * @see il_interface.h
+ *
  */
 
@@ -47,69 +50,187 @@
 #include <il_messages.h>
 #include <ip_messages.h>
-
-int ip_add_route_req(int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway){
-	return (int) async_req_4_0(ip_phone, NET_IP_ADD_ROUTE, (ipcarg_t) device_id, (ipcarg_t) gateway.s_addr, (ipcarg_t) address.s_addr, (ipcarg_t) netmask.s_addr);
-}
-
-int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg){
-	return (int) bind_service(service, (ipcarg_t) protocol, me, service, receiver);
-}
-
-int ip_connect_module(services_t service){
+#include <ip_remote.h>
+
+/** Add a route to the device routing table.
+ *
+ * The target network is routed using this device.
+ *
+ * @param[in] ip_phone  The IP module phone used for (semi)remote calls.
+ * @param[in] device_id The device identifier.
+ * @param[in] address   The target network address.
+ * @param[in] netmask   The target network mask.
+ * @param[in] gateway   The target network gateway. Not used if zero.
+ *
+ */
+int ip_add_route_req_remote(int ip_phone, device_id_t device_id,
+    in_addr_t address, in_addr_t netmask, in_addr_t gateway)
+{
+	return (int) async_req_4_0(ip_phone, NET_IP_ADD_ROUTE,
+	    (ipcarg_t) device_id, (ipcarg_t) gateway.s_addr,
+	    (ipcarg_t) address.s_addr, (ipcarg_t) netmask.s_addr);
+}
+
+int ip_bind_service(services_t service, int protocol, services_t me,
+    async_client_conn_t receiver, tl_received_msg_t tl_received_msg)
+{
+	return (int) bind_service(service, (ipcarg_t) protocol, me, service,
+	    receiver);
+}
+
+int ip_connect_module(services_t service)
+{
 	return connect_to_service(SERVICE_IP);
 }
 
-int ip_device_req(int ip_phone, device_id_t device_id, services_t service){
-	return generic_device_req(ip_phone, NET_IL_DEVICE, device_id, 0, service);
-}
-
-int ip_get_route_req(int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, ip_pseudo_header_ref * header, size_t * headerlen){
-	aid_t message_id;
-	ipcarg_t result;
+/** Register the new device.
+ *
+ * Register itself as the ip packet receiver.
+ * If the device uses ARP registers also the new ARP device.
+ *
+ * @param[in] ip_phone  The IP module phone used for (semi)remote calls.
+ * @param[in] device_id The new device identifier.
+ * @param[in] netif     The underlying device network interface layer service.
+ *
+ * @return EOK on success.
+ * @return ENOMEM if there is not enough memory left.
+ * @return EINVAL if the device configuration is invalid.
+ * @return ENOTSUP if the device uses IPv6.
+ * @return ENOTSUP if the device uses DHCP.
+ * @return Other error codes as defined for the net_get_device_conf_req()
+ *         function.
+ * @return Other error codes as defined for the arp_device_req() function.
+ *
+ */
+int ip_device_req_remote(int ip_phone, device_id_t device_id,
+    services_t service)
+{
+	return generic_device_req_remote(ip_phone, NET_IL_DEVICE, device_id, 0,
+	    service);
+}
+
+/** Return the device identifier and the IP pseudo header based on the destination address.
+ *
+ * @param[in]  ip_phone    The IP module phone used for (semi)remote calls.
+ * @param[in]  protocol    The transport protocol.
+ * @param[in]  destination The destination address.
+ * @param[in]  addrlen     The destination address length.
+ * @param[out] device_id   The device identifier.
+ * @param[out] header      The constructed IP pseudo header.
+ * @param[out] headerlen   The IP pseudo header length.
+ *
+ */
+int ip_get_route_req_remote(int ip_phone, ip_protocol_t protocol,
+    const struct sockaddr *destination, socklen_t addrlen,
+    device_id_t *device_id, void **header, size_t *headerlen)
+{
+	if ((!destination) || (addrlen == 0))
+		return EINVAL;
+	
+	if ((!device_id) || (header) || (headerlen))
+		return EBADMEM;
+	
+	*header = NULL;
+	
 	ipc_call_t answer;
-
-	if(!(destination && (addrlen > 0))){
-		return EINVAL;
-	}
-	if(!(device_id && header && headerlen)){
-		return EBADMEM;
-	}
-
-	*header = NULL;
-	message_id = async_send_1(ip_phone, NET_IP_GET_ROUTE, (ipcarg_t) protocol, &answer);
-	if((async_data_write_start(ip_phone, destination, addrlen) == EOK)
-		&& (async_data_read_start(ip_phone, headerlen, sizeof(*headerlen)) == EOK)
-		&& (*headerlen > 0)){
-		*header = (ip_pseudo_header_ref) malloc(*headerlen);
-		if(*header){
-			if(async_data_read_start(ip_phone, * header, * headerlen) != EOK){
+	aid_t message_id = async_send_1(ip_phone, NET_IP_GET_ROUTE,
+	    (ipcarg_t) protocol, &answer);
+	
+	if ((async_data_write_start(ip_phone, destination, addrlen) == EOK)
+	    && (async_data_read_start(ip_phone, headerlen, sizeof(*headerlen)) == EOK)
+	    && (*headerlen > 0)) {
+		*header = malloc(*headerlen);
+		if (*header) {
+			if (async_data_read_start(ip_phone, *header, *headerlen) != EOK)
 				free(*header);
-			}
 		}
 	}
+	
+	ipcarg_t result;
 	async_wait_for(message_id, &result);
-
-	if((result != EOK) && (*header)){
+	
+	if ((result != EOK) && (*header))
 		free(*header);
-	}else{
+	else
 		*device_id = IPC_GET_DEVICE(&answer);
-	}
+	
 	return (int) result;
 }
 
-int ip_packet_size_req(int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension){
-	return generic_packet_size_req(ip_phone, NET_IL_PACKET_SPACE, device_id, packet_dimension);
-}
-
-int ip_received_error_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error){
-	return generic_received_msg(ip_phone, NET_IP_RECEIVED_ERROR, device_id, packet_get_id(packet), target, error);
-}
-
-int ip_send_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error){
-	return generic_send_msg(ip_phone, NET_IL_SEND, device_id, packet_get_id(packet), sender, error);
-}
-
-int ip_set_gateway_req(int ip_phone, device_id_t device_id, in_addr_t gateway){
-	return (int) async_req_2_0(ip_phone, NET_IP_SET_GATEWAY, (ipcarg_t) device_id, (ipcarg_t) gateway.s_addr);
+/** Return the device packet dimension for sending.
+ *
+ * @param[in]  ip_phone         The IP module phone used for (semi)remote calls.
+ * @param[in]  device_id        The device identifier.
+ * @param[out] packet_dimension The packet dimension.
+ *
+ * @return EOK on success.
+ * @return ENOENT if there is no such device.
+ * @return Other error codes as defined for the
+ *         generic_packet_size_req_remote() function.
+ *
+ */
+int ip_packet_size_req_remote(int ip_phone, device_id_t device_id,
+    packet_dimension_ref packet_dimension)
+{
+	return generic_packet_size_req_remote(ip_phone, NET_IL_PACKET_SPACE, device_id,
+	    packet_dimension);
+}
+
+/** Notify the IP module about the received error notification packet.
+ *
+ * @param[in] ip_phone  The IP module phone used for (semi)remote calls.
+ * @param[in] device_id The device identifier.
+ * @param[in] packet    The received packet or the received packet queue.
+ * @param[in] target    The target internetwork module service to be
+ *                      delivered to.
+ * @param[in] error     The packet error reporting service. Prefixes the
+ *                      received packet.
+ *
+ * @return EOK on success.
+ *
+ */
+int ip_received_error_msg_remote(int ip_phone, device_id_t device_id,
+    packet_t packet, services_t target, services_t error)
+{
+	return generic_received_msg_remote(ip_phone, NET_IP_RECEIVED_ERROR,
+	    device_id, packet_get_id(packet), target, error);
+}
+
+/** Send the packet queue.
+ *
+ * The packets may get fragmented if needed.
+ *
+ * @param[in] ip_phone  The IP module phone used for (semi)remote calls.
+ * @param[in] device_id The device identifier.
+ * @param[in] packet    The packet fragments as a packet queue. All the
+ *                      packets have to have the same destination address.
+ * @param[in] sender    The sending module service.
+ * @param[in] error     The packet error reporting service. Prefixes the
+ *                      received packet.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the generic_send_msg() function.
+ *
+ */
+int ip_send_msg_remote(int ip_phone, device_id_t device_id, packet_t packet,
+    services_t sender, services_t error)
+{
+	return generic_send_msg_remote(ip_phone, NET_IL_SEND, device_id,
+	    packet_get_id(packet), sender, error);
+}
+
+/** Set the default gateway.
+ *
+ * This gateway is used if no other route is found.
+ *
+ * @param[in] ip_phone  The IP module phone used for (semi)remote calls.
+ * @param[in] device_id The device identifier.
+ * @param[in] gateway   The default gateway.
+ *
+ */
+int ip_set_gateway_req_remote(int ip_phone, device_id_t device_id,
+    in_addr_t gateway)
+{
+	return (int) async_req_2_0(ip_phone, NET_IP_SET_GATEWAY,
+	    (ipcarg_t) device_id, (ipcarg_t) gateway.s_addr);
 }
 
Index: uspace/lib/net/include/arp_interface.h
===================================================================
--- uspace/lib/net/include/arp_interface.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/arp_interface.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -29,11 +29,4 @@
 /** @addtogroup arp
  *  @{
- */
-
-/** @file
- *  ARP module interface.
- *  The same interface is used for standalone remote modules as well as for bundle modules.
- *  The standalone remote modules have to be compiled with the arp_remote.c source file.
- *  The bundle modules with the arp.c source file.
  */
 
Index: uspace/lib/net/include/icmp_interface.h
===================================================================
--- uspace/lib/net/include/icmp_interface.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/icmp_interface.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -29,11 +29,4 @@
 /** @addtogroup icmp
  *  @{
- */
-
-/** @file
- *  ICMP module interface.
- *  The same interface is used for standalone remote modules as well as for bundle modules.
- *  The standalone remote modules have to be compiled with the icmp_remote.c source file.
- *  The bundle modules with the icmp.c source file.
  */
 
Index: uspace/lib/net/include/il_interface.h
===================================================================
--- uspace/lib/net/include/il_interface.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/il_interface.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -32,6 +32,6 @@
 
 /** @file
- *  Internetwork layer module interface for the underlying network interface layer.
- *  This interface is always called by the standalone remote modules.
+ * Internetwork layer module interface for the underlying network interface layer.
+ * This interface is always called by the remote modules.
  */
 
@@ -50,39 +50,63 @@
 
 /** @name Internetwork layer module interface
- *  This interface is used by other modules.
+ * This interface is used by other modules.
  */
 /*@{*/
 
-/** Notifies the internetwork layer modules about the device state change.
- *  @param[in] il_phone The internetwork layer module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] state The new device state.
- *  @param[in] target The target internetwork module service to be delivered to.
- *  @returns EOK on success.
+/** Notify the internetwork layer modules about the device state change.
+ *
+ * @param[in] il_phone  The internetwork layer module phone used for
+ *                      (semi)remote calls.
+ * @param[in] device_id The device identifier.
+ * @param[in] state     The new device state.
+ * @param[in] target    The target internetwork module service to be
+ *                      delivered to.
+ *
+ * @return EOK on success.
+ *
  */
-static inline int il_device_state_msg(int il_phone, device_id_t device_id, device_state_t state, services_t target){
-	return generic_device_state_msg(il_phone, NET_IL_DEVICE_STATE, device_id, state, target);
+static inline int il_device_state_msg(int il_phone, device_id_t device_id,
+    device_state_t state, services_t target)
+{
+	return generic_device_state_msg_remote(il_phone, NET_IL_DEVICE_STATE,
+	    device_id, state, target);
 }
 
-/** Notifies the internetwork layer modules about the received packet/s.
- *  @param[in] il_phone The internetwork layer module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The received packet or the received packet queue.
- *  @param[in] target The target internetwork module service to be delivered to.
- *  @returns EOK on success.
+/** Notify the internetwork layer modules about the received packet/s.
+ *
+ * @param[in] il_phone  The internetwork layer module phone used for
+ *                      (semi)remote calls.
+ * @param[in] device_id The device identifier.
+ * @param[in] packet    The received packet or the received packet queue.
+ * @param[in] target    The target internetwork module service to be
+ *                      delivered to.
+ *
+ * @return EOK on success.
+ *
  */
-inline static int il_received_msg(int il_phone, device_id_t device_id, packet_t packet, services_t target){
-	return generic_received_msg(il_phone, NET_IL_RECEIVED, device_id, packet_get_id(packet), target, 0);
+inline static int il_received_msg(int il_phone, device_id_t device_id,
+    packet_t packet, services_t target)
+{
+	return generic_received_msg_remote(il_phone, NET_IL_RECEIVED, device_id,
+	    packet_get_id(packet), target, 0);
 }
 
-/** Notifies the internetwork layer modules about the mtu change.
- *  @param[in] il_phone The internetwork layer module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] mtu The new mtu value.
- *  @param[in] target The target internetwork module service to be delivered to.
- *  @returns EOK on success.
+/** Notify the internetwork layer modules about the mtu change.
+ *
+ * @param[in] il_phone  The internetwork layer module phone used for
+ *                      (semi)remote calls.
+ * @param[in] device_id The device identifier.
+ * @param[in] mtu       The new mtu value.
+ * @param[in] target    The target internetwork module service to be
+ *                      delivered to.
+ *
+ * @return EOK on success.
+ *
  */
-inline static int il_mtu_changed_msg(int il_phone, device_id_t device_id, size_t mtu, services_t target){
-	return generic_device_state_msg(il_phone, NET_IL_MTU_CHANGED, device_id, (int) mtu, target);
+inline static int il_mtu_changed_msg(int il_phone, device_id_t device_id,
+    size_t mtu, services_t target)
+{
+	return generic_device_state_msg_remote(il_phone, NET_IL_MTU_CHANGED,
+	    device_id, (int) mtu, target);
 }
 
Index: uspace/lib/net/include/il_local.h
===================================================================
--- uspace/lib/net/include/il_local.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/net/include/il_local.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010 Martin Decky
+ * 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 il_local
+ *  @{
+ */
+
+#ifndef __IL_LOCAL_H__
+#define __IL_LOCAL_H__
+
+#include <ipc/ipc.h>
+#include <async.h>
+
+extern int il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
+    ipc_call_t *answer, int *answer_count);
+extern int il_module_start_standalone(async_client_conn_t client_connection);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/il_messages.h
===================================================================
--- uspace/lib/net/include/il_messages.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/il_messages.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -28,11 +28,11 @@
 
 /** @addtogroup net_il
- *  @{
+ * @{
  */
 
 /** @file
- *  Internetwork layer modules messages.
- *  @see il_interface.h
- *  @see ip_interface.h
+ * Internetwork layer modules messages.
+ * @see il_interface.h
+ * @see ip_interface.h
  */
 
@@ -44,5 +44,5 @@
 /** Internet layer modules messages.
  */
-typedef enum{
+typedef enum {
 	/** New device message.
 	 *  @see ip_device_req()
@@ -72,16 +72,19 @@
 
 /** @name Internetwork layer specific message parameters definitions
+ *
  */
 /*@{*/
 
-/** Returns the protocol number message parameter.
- *  @param[in] call The message call structure.
+/** Return the protocol number message parameter.
+ * @param[in] call The message call structure.
+ *
  */
-#define IL_GET_PROTO(call)		(int) IPC_GET_ARG1(*call)
+#define IL_GET_PROTO(call)  (int) IPC_GET_ARG1(*call)
 
-/** Returns the registering service message parameter.
- *  @param[in] call The message call structure.
+/** Return the registering service message parameter.
+ * @param[in] call The message call structure.
+ *
  */
-#define IL_GET_SERVICE(call)	(services_t) IPC_GET_ARG2(*call)
+#define IL_GET_SERVICE(call)  (services_t) IPC_GET_ARG2(*call)
 
 /*@}*/
Index: uspace/lib/net/include/il_standalone.h
===================================================================
--- uspace/lib/net/include/il_standalone.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * 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 il_standalone
- *  @{
- */
-
-#ifndef __IL_STANDALONE_H__
-#define __IL_STANDALONE_H__
-
-#include <ipc/ipc.h>
-#include <async.h>
-
-extern int il_module_message(ipc_callid_t callid, ipc_call_t *call,
-    ipc_call_t *answer, int *answer_count);
-extern int il_module_start(async_client_conn_t client_connection);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/ip_client.h
===================================================================
--- uspace/lib/net/include/ip_client.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/ip_client.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -87,5 +87,5 @@
  *  @returns EINVAL if the headerlen parameter is not IPv4 pseudo header length.
  */
-extern int ip_client_set_pseudo_header_data_length(ip_pseudo_header_ref header, size_t headerlen, size_t data_length);
+extern int ip_client_set_pseudo_header_data_length(void *header, size_t headerlen, size_t data_length);
 
 /** Constructs the IPv4 pseudo header.
@@ -107,5 +107,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-extern int ip_client_get_pseudo_header(ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, ip_pseudo_header_ref * header, size_t * headerlen);
+extern int ip_client_get_pseudo_header(ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, void **header, size_t * headerlen);
 
 // TODO ipopt manipulation
Index: uspace/lib/net/include/ip_interface.h
===================================================================
--- uspace/lib/net/include/ip_interface.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/ip_interface.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -31,11 +31,4 @@
  */
 
-/** @file
- *  IP module interface.
- *  The same interface is used for standalone remote modules as well as for bundle modules.
- *  The standalone remote modules have to be compiled with the ip_remote.c source file.
- *  The bundle modules with the ip.c source file.
- */
-
 #ifndef __NET_IP_INTERFACE_H__
 #define __NET_IP_INTERFACE_H__
@@ -51,12 +44,34 @@
 #include <socket_codes.h>
 
+#ifdef CONFIG_IL_TL_BUNDLE
+
+#include <ip_local.h>
+
+#define ip_received_error_msg  ip_received_error_msg_local
+#define ip_set_gateway_req     ip_set_gateway_req_local
+#define ip_packet_size_req     ip_packet_size_req_local
+#define ip_device_req          ip_device_req_local
+#define ip_add_route_req       ip_add_route_req_local
+#define ip_send_msg            ip_send_msg_local
+#define ip_get_route_req       ip_get_route_req_local
+
+#else
+
+#include <ip_remote.h>
+
+#define ip_received_error_msg  ip_received_error_msg_remote
+#define ip_set_gateway_req     ip_set_gateway_req_remote
+#define ip_packet_size_req     ip_packet_size_req_remote
+#define ip_device_req          ip_device_req_remote
+#define ip_add_route_req       ip_add_route_req_remote
+#define ip_send_msg            ip_send_msg_remote
+#define ip_get_route_req       ip_get_route_req_remote
+
+#endif
+
 /** @name IP module interface
  *  This interface is used by other modules.
  */
 /*@{*/
-
-/** Type definition of the internet pseudo header pointer.
- */
-typedef void *		ip_pseudo_header_ref;
 
 /** The transport layer notification function type definition.
@@ -82,32 +97,4 @@
 extern int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg);
 
-/** Registers the new device.
- *  Registers itself as the ip packet receiver.
- *  If the device uses ARP registers also the new ARP device.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] device_id The new device identifier.
- *  @param[in] netif The underlying device network interface layer service.
- *  @returns EOK on success.
- *  @returns ENOMEM if there is not enough memory left.
- *  @returns EINVAL if the device configuration is invalid.
- *  @returns ENOTSUP if the device uses IPv6.
- *  @returns ENOTSUP if the device uses DHCP.
- *  @returns Other error codes as defined for the net_get_device_conf_req() function.
- *  @returns Other error codes as defined for the arp_device_req() function.
- */
-extern int ip_device_req(int ip_phone, device_id_t device_id, services_t netif);
-
-/** Sends the packet queue.
- *  The packets may get fragmented if needed.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The packet fragments as a~packet queue. All the packets have to have the same destination address.
- *  @param[in] sender The sending module service.
- *  @param[in] error The packet error reporting service. Prefixes the received packet.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the generic_send_msg() function.
- */
-extern int ip_send_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error);
-
 /** Connects to the IP module.
  *  @param service The IP module service. Ignored parameter.
@@ -117,53 +104,4 @@
 extern int ip_connect_module(services_t service);
 
-/** Adds a route to the device routing table.
- *  The target network is routed using this device.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] address The target network address.
- *  @param[in] netmask The target network mask.
- *  @param[in] gateway The target network gateway. Not used if zero.
- */
-extern int ip_add_route_req(int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway);
-
-/** Sets the default gateway.
- *  This gateway is used if no other route is found.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] gateway The default gateway.
- */
-extern int ip_set_gateway_req(int ip_phone, device_id_t device_id, in_addr_t gateway);
-
-/** Returns the device packet dimension for sending.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[out] packet_dimension The packet dimension.
- *  @returns EOK on success.
- *  @returns ENOENT if there is no such device.
- *  @returns Other error codes as defined for the generic_packet_size_req() function.
- */
-extern int ip_packet_size_req(int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension);
-
-/** Notifies the IP module about the received error notification packet.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The received packet or the received packet queue.
- *  @param[in] target The target internetwork module service to be delivered to.
- *  @param[in] error The packet error reporting service. Prefixes the received packet.
- *  @returns EOK on success.
- */
-extern int ip_received_error_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error);
-
-/** Returns the device identifier and the IP pseudo header based on the destination address.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] protocol The transport protocol.
- *  @param[in] destination The destination address.
- *  @param[in] addrlen The destination address length.
- *  @param[out] device_id The device identifier.
- *  @param[out] header The constructed IP pseudo header.
- *  @param[out] headerlen The IP pseudo header length.
- */
-extern int ip_get_route_req(int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, ip_pseudo_header_ref * header, size_t * headerlen);
-
 /*@}*/
 
Index: uspace/lib/net/include/ip_local.h
===================================================================
--- uspace/lib/net/include/ip_local.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/net/include/ip_local.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,61 @@
+/*
+ * 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 ip
+ * @{
+ */
+
+#ifndef __NET_IP_LOCAL_H__
+#define __NET_IP_LOCAL_H__
+
+#include <async.h>
+#include <ipc/services.h>
+
+#include <ip_codes.h>
+#include <inet.h>
+#include <in.h>
+#include <socket.h>
+
+extern int ip_received_error_msg_local(int, device_id_t, packet_t, services_t,
+    services_t);
+extern int ip_set_gateway_req_local(int, device_id_t, in_addr_t);
+extern int ip_packet_size_req_local(int, device_id_t, packet_dimension_ref);
+extern int ip_received_error_msg_local(int, device_id_t, packet_t, services_t,
+    services_t);
+extern int ip_device_req_local(int, device_id_t, services_t);
+extern int ip_add_route_req_local(int, device_id_t, in_addr_t, in_addr_t,
+    in_addr_t);
+extern int ip_send_msg_local(int, device_id_t, packet_t, services_t,
+    services_t);
+extern int ip_get_route_req_local(int, ip_protocol_t, const struct sockaddr *,
+    socklen_t, device_id_t *, void **, size_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/ip_remote.h
===================================================================
--- uspace/lib/net/include/ip_remote.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/net/include/ip_remote.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,59 @@
+/*
+ * 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 ip
+ * @{
+ */
+
+#ifndef __NET_IP_REMOTE_H__
+#define __NET_IP_REMOTE_H__
+
+#include <async.h>
+#include <ipc/services.h>
+
+#include <ip_codes.h>
+#include <inet.h>
+#include <in.h>
+#include <socket.h>
+
+extern int ip_set_gateway_req_remote(int, device_id_t, in_addr_t);
+extern int ip_packet_size_req_remote(int, device_id_t, packet_dimension_ref);
+extern int ip_received_error_msg_remote(int, device_id_t, packet_t, services_t,
+    services_t);
+extern int ip_device_req_remote(int, device_id_t, services_t);
+extern int ip_add_route_req_remote(int, device_id_t, in_addr_t, in_addr_t,
+    in_addr_t);
+extern int ip_send_msg_remote(int, device_id_t, packet_t, services_t,
+    services_t);
+extern int ip_get_route_req_remote(int, ip_protocol_t, const struct sockaddr *,
+    socklen_t, device_id_t *, void **, size_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/net_interface.h
===================================================================
--- uspace/lib/net/include/net_interface.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/net_interface.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -29,11 +29,4 @@
 /** @addtogroup net
  *  @{
- */
-
-/** @file
- *  Networking module interface.
- *  The same interface is used for standalone remote modules as well as for bundle modules.
- *  The standalone remote modules have to be compiled with the net_remote.c source file.
- *  The bundle networking module is compiled with the net_bundle.c source file and the choosen bundle module implementation source files.
  */
 
Index: uspace/lib/net/include/netif.h
===================================================================
--- uspace/lib/net/include/netif.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,161 +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 netif
- *  @{
- */
-
-/** @file
- *  Network interface module skeleton.
- *  The skeleton has to be part of each network interface module.
- *  The skeleton can be also part of the module bundled with the network interface layer.
- */
-
-#ifndef __NET_NETIF_H__
-#define __NET_NETIF_H__
-
-#include <async.h>
-#include <fibril_synch.h>
-
-#include <ipc/ipc.h>
-
-#include <net_err.h>
-#include <net_device.h>
-#include <packet/packet.h>
-
-/** Network interface module skeleton global data.
- */
-typedef struct netif_globals	netif_globals_t;
-
-/** Type definition of the device specific data.
- *  @see netif_device
- */
-typedef struct netif_device	device_t;
-
-/** Type definition of the device specific data pointer.
- *  @see netif_device
- */
-typedef device_t *			device_ref;
-
-/** Device map.
- *  Maps device identifiers to the network interface device specific data.
- *  @see device.h
- */
-DEVICE_MAP_DECLARE(device_map, device_t);
-
-/** Network interface device specific data.
- */
-struct	netif_device{
-	/** Device identifier.
-	 */
-	device_id_t device_id;
-	/** Receiving network interface layer phone.
-	 */
-	int nil_phone;
-	/** Actual device state.
-	 */
-	device_state_t state;
-	/** Driver specific data.
-	 */
-	void * specific;
-};
-
-/** Network interface module skeleton global data.
- */
-struct	netif_globals{
-	/** Networking module phone.
-	 */
-	int net_phone;
-	/**	Device map.
-	 */
-	device_map_t device_map;
-	/** Safety lock.
-	 */
-	fibril_rwlock_t lock;
-};
-
-extern netif_globals_t netif_globals;
-
-/**	Finds the device specific data.
- *  @param[in] device_id The device identifier.
- *  @param[out] device The device specific data.
- *  @returns EOK on success.
- *  @returns ENOENT if device is not found.
- *  @returns EPERM if the device is not initialized.
- */
-extern int find_device(device_id_t device_id, device_ref * device);
-
-/** Clears the usage statistics.
- *  @param[in] stats The usage statistics.
- */
-extern void null_device_stats(device_stats_ref stats);
-
-// prepared for future optimalizations
-/** Releases the given packet.
- *  @param[in] packet_id The packet identifier.
- */
-extern void netif_pq_release(packet_id_t packet_id);
-
-/** Allocates new packet to handle the given content size.
- *  @param[in] content The minimum content size.
- *  @returns The allocated packet.
- *  @returns NULL if there is an error.
- */
-extern packet_t netif_packet_get_1(size_t content);
-
-/** Processes the netif module messages.
- *  @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.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for each specific module message function.
- *  @see netif_interface.h
- *  @see IS_NET_NETIF_MESSAGE()
- */
-extern int netif_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
-
-/** Initializes the netif module.
- *  The function has to be defined in each module.
- *  @param[in] net_client_connection The client connection functio to be registered.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module message function.
- */
-extern int netif_init_module(async_client_conn_t client_connection);
-
-/** Starts and maintains the netif module until terminated.
- *  @returns EOK after the module is terminated.
- */
-extern int netif_run_module(void);
-
-#endif
-
-/** @}
- */
-
Index: uspace/lib/net/include/netif_interface.h
===================================================================
--- uspace/lib/net/include/netif_interface.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/netif_interface.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -28,12 +28,5 @@
 
 /** @addtogroup netif
- *  @{
- */
-
-/** @file
- *  Network interface module interface.
- *  The same interface is used for standalone remote modules as well as for bundle network interface layer modules.
- *  The standalone remote modules have to be compiled with the netif_remote.c source file.
- *  The bundle network interface layer modules are compiled with the netif_nil_bundle.c source file and the choosen network interface layer implementation source file.
+ * @{
  */
 
@@ -41,86 +34,36 @@
 #define __NET_NETIF_INTERFACE_H__
 
-#include <ipc/services.h>
+#ifdef CONFIG_NETIF_NIL_BUNDLE
 
-#include <net_messages.h>
-#include <adt/measured_strings.h>
-#include <packet/packet.h>
-#include <net_device.h>
+#include <netif_local.h>
+#include <netif_nil_bundle.h>
+#include <packet/packet_server.h>
 
-/** @name Network interface module interface
- *  This interface is used by other modules.
- */
-/*@{*/
+#define netif_module_message    netif_nil_module_message
+#define netif_module_start      netif_nil_module_start
+#define netif_get_addr_req      netif_get_addr_req_local
+#define netif_probe_req         netif_probe_req_local
+#define netif_send_msg          netif_send_msg_local
+#define netif_start_req         netif_start_req_local
+#define netif_stop_req          netif_stop_req_local
+#define netif_stats_req         netif_stats_req_local
+#define netif_bind_service      netif_bind_service_local
 
-/** Returns the device local hardware address.
- *  @param[in] netif_phone The network interface phone.
- *  @param[in] device_id The device identifier.
- *  @param[out] address The device local hardware address.
- *  @param[out] data The address data.
- *  @returns EOK on success.
- *  @returns EBADMEM if the address parameter is NULL.
- *  @returns ENOENT if there no such device.
- *  @returns Other error codes as defined for the netif_get_addr_message() function.
- */
-extern int netif_get_addr_req(int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data);
+#else /* CONFIG_NETIF_NIL_BUNDLE */
 
-/** Probes the existence of the device.
- *  @param[in] netif_phone The network interface phone.
- *  @param[in] device_id The device identifier.
- *  @param[in] irq The device interrupt number.
- *  @param[in] io The device input/output address.
- *  @returns EOK on success.
- *  @returns Other errro codes as defined for the netif_probe_message().
- */
-extern int netif_probe_req(int netif_phone, device_id_t device_id, int irq, int io);
+#include <netif_remote.h>
+#include <packet/packet_client.h>
 
-/** Sends the packet queue.
- *  @param[in] netif_phone The network interface phone.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The packet queue.
- *  @param[in] sender The sending module service.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the generic_send_msg() function.
- */
-extern int netif_send_msg(int netif_phone, device_id_t device_id, packet_t packet, services_t sender);
+#define netif_module_message    netif_module_message_standalone
+#define netif_module_start      netif_module_start_standalone
+#define netif_get_addr_req      netif_get_addr_req_remote
+#define netif_probe_req         netif_probe_req_remote
+#define netif_send_msg          netif_send_msg_remote
+#define netif_start_req         netif_start_req_remote
+#define netif_stop_req          netif_stop_req_remote
+#define netif_stats_req         netif_stats_req_remote
+#define netif_bind_service      netif_bind_service_remote
 
-/** Starts the device.
- *  @param[in] netif_phone The network interface phone.
- *  @param[in] device_id The device identifier.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the netif_start_message() function.
- */
-extern int netif_start_req(int netif_phone, device_id_t device_id);
-
-/** Stops the device.
- *  @param[in] netif_phone The network interface phone.
- *  @param[in] device_id The device identifier.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the netif_stop_message() function.
- */
-extern int netif_stop_req(int netif_phone, device_id_t device_id);
-
-/** Returns the device usage statistics.
- *  @param[in] netif_phone The network interface phone.
- *  @param[in] device_id The device identifier.
- *  @param[out] stats The device usage statistics.
- *  @returns EOK on success.
- */
-extern int netif_stats_req(int netif_phone, device_id_t device_id, device_stats_ref stats);
-
-/** Creates bidirectional connection with the network interface module and registers the message receiver.
- *  @param[in] service The network interface module service.
- *  @param[in] device_id The device identifier.
- *  @param[in] me The requesting module service.
- *  @param[in] receiver The message receiver.
- *  @returns The phone of the needed service.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the bind_service() function.
- */
-extern int netif_bind_service(services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver);
-
-/*@}*/
+#endif /* CONFIG_NETIF_NIL_BUNDLE */
 
 #endif
Index: uspace/lib/net/include/netif_local.h
===================================================================
--- uspace/lib/net/include/netif_local.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/net/include/netif_local.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,227 @@
+/*
+ * 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 netif
+ * @{
+ */
+
+/** @file
+ * Network interface module skeleton.
+ * The skeleton has to be part of each network interface module.
+ * The skeleton can be also part of the module bundled with the network interface layer.
+ */
+
+#ifndef __NET_NETIF_LOCAL_H__
+#define __NET_NETIF_LOCAL_H__
+
+#include <async.h>
+#include <fibril_synch.h>
+#include <ipc/ipc.h>
+#include <ipc/services.h>
+
+#include <adt/measured_strings.h>
+#include <net_err.h>
+#include <net_device.h>
+#include <packet/packet.h>
+
+/** Network interface device specific data.
+ *
+ */
+typedef struct {
+	device_id_t device_id;  /**< Device identifier. */
+	int nil_phone;          /**< Receiving network interface layer phone. */
+	device_state_t state;   /**< Actual device state. */
+	void *specific;         /**< Driver specific data. */
+} netif_device_t;
+
+/** Device map.
+ *
+ * Maps device identifiers to the network interface device specific data.
+ * @see device.h
+ *
+ */
+DEVICE_MAP_DECLARE(netif_device_map, netif_device_t);
+
+/** Network interface module skeleton global data.
+ *
+ */
+typedef struct {
+	int net_phone;                  /**< Networking module phone. */
+	netif_device_map_t device_map;  /**< Device map. */
+	fibril_rwlock_t lock;           /**< Safety lock. */
+} netif_globals_t;
+
+extern netif_globals_t netif_globals;
+
+/** Initialize the specific module.
+ *
+ * This function has to be implemented in user code.
+ *
+ */
+extern int netif_initialize(void);
+
+/** Probe the existence of the device.
+ *
+ * This has to be implemented in user code.
+ *
+ * @param[in] device_id The device identifier.
+ * @param[in] irq       The device interrupt number.
+ * @param[in] io        The device input/output address.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_probe_message(device_id_t device_id, int irq, uintptr_t io);
+
+/** Send the packet queue.
+ *
+ * This has to be implemented in user code.
+ *
+ * @param[in] device_id The device identifier.
+ * @param[in] packet    The packet queue.
+ * @param[in] sender    The sending module service.
+ *
+ * @return EOK on success.
+ * @return EFORWARD if the device is not active (in the NETIF_ACTIVE state).
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_send_message(device_id_t device_id, packet_t packet,
+    services_t sender);
+
+/** Start the device.
+ *
+ * This has to be implemented in user code.
+ *
+ * @param[in] device The device structure.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_start_message(netif_device_t *device);
+
+/** Stop the device.
+ *
+ * This has to be implemented in user code.
+ *
+ * @param[in] device The device structure.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_stop_message(netif_device_t *device);
+
+/** Return the device local hardware address.
+ *
+ * This has to be implemented in user code.
+ *
+ * @param[in]  device_id The device identifier.
+ * @param[out] address   The device local hardware address.
+ *
+ * @return EOK on success.
+ * @return EBADMEM if the address parameter is NULL.
+ * @return ENOENT if there no such device.
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_get_addr_message(device_id_t device_id,
+    measured_string_ref address);
+
+/** Process the netif driver specific message.
+ *
+ * This function is called for uncommon messages received by the netif
+ * skeleton. This has to be implemented in user code.
+ *
+ * @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 the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_specific_message(ipc_callid_t callid, ipc_call_t *call,
+    ipc_call_t *answer, int *answer_count);
+
+/** Return the device usage statistics.
+ *
+ * This has to be implemented in user code.
+ *
+ * @param[in]  device_id The device identifier.
+ * @param[out] stats     The device usage statistics.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_get_device_stats(device_id_t device_id,
+    device_stats_ref stats);
+
+extern int netif_get_addr_req_local(int, device_id_t, measured_string_ref *,
+    char **);
+extern int netif_probe_req_local(int, device_id_t, int, int);
+extern int netif_send_msg_local(int, device_id_t, packet_t, services_t);
+extern int netif_start_req_local(int, device_id_t);
+extern int netif_stop_req_local(int, device_id_t);
+extern int netif_stats_req_local(int, device_id_t, device_stats_ref);
+extern int netif_bind_service_local(services_t, device_id_t, services_t,
+    async_client_conn_t);
+
+extern int find_device(device_id_t, netif_device_t **);
+extern void null_device_stats(device_stats_ref);
+extern void netif_pq_release(packet_id_t);
+extern packet_t netif_packet_get_1(size_t);
+extern int netif_init_module(async_client_conn_t);
+
+extern int netif_module_message_standalone(const char *, ipc_callid_t,
+    ipc_call_t *, ipc_call_t *, int *);
+extern int netif_module_start_standalone(async_client_conn_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/netif_messages.h
===================================================================
--- uspace/lib/net/include/netif_messages.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/netif_messages.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -28,10 +28,9 @@
 
 /** @addtogroup netif
- *  @{
+ * @{
  */
 
 /** @file
- *  Network interface common module messages.
- *  @see netif_interface.h
+ * Network interface common module messages.
  */
 
@@ -76,12 +75,12 @@
 /*@{*/
 
-/** Returns the interrupt number message parameter.
- *  @param[in] call The message call structure.
+/** Return the interrupt number message parameter.
+ * @param[in] call The message call structure.
  */
 #define NETIF_GET_IRQ(call) \
 	({int irq = (int) IPC_GET_ARG2(*call); irq;})
 
-/** Returns the input/output address message parameter.
- *  @param[in] call The message call structure.
+/** Return the input/output address message parameter.
+ * @param[in] call The message call structure.
  */
 #define NETIF_GET_IO(call) \
Index: uspace/lib/net/include/netif_module.h
===================================================================
--- uspace/lib/net/include/netif_module.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(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 netif
- *  @{
- */
-
-/** @file
- *  Network interface module interface.
- *  The interface has to be implemented by each network interface module.
- *  The interface is used by the network interface module skeleton.
- */
-
-#ifndef __NET_NETIF_MODULE_H__
-#define __NET_NETIF_MODULE_H__
-
-#include <ipc/ipc.h>
-#include <ipc/services.h>
-
-#include <adt/measured_strings.h>
-#include <packet/packet.h>
-#include <net_device.h>
-
-/** Initializes the specific module.
- */
-extern int netif_initialize(void);
-
-/** Probes the existence of the device.
- *  @param[in] device_id The device identifier.
- *  @param[in] irq The device interrupt number.
- *  @param[in] io The device input/output address.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_probe_message(device_id_t device_id, int irq, uintptr_t io);
-
-/** Sends the packet queue.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The packet queue.
- *  @param[in] sender The sending module service.
- *  @returns EOK on success.
- *  @returns EFORWARD if the device is not active (in the NETIF_ACTIVE state).
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_send_message(device_id_t device_id, packet_t packet, services_t sender);
-
-/** Starts the device.
- *  @param[in] device The device structure.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_start_message(device_ref device);
-
-/** Stops the device.
- *  @param[in] device The device structure.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_stop_message(device_ref device);
-
-/** Returns the device local hardware address.
- *  @param[in] device_id The device identifier.
- *  @param[out] address The device local hardware address.
- *  @returns EOK on success.
- *  @returns EBADMEM if the address parameter is NULL.
- *  @returns ENOENT if there no such device.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_get_addr_message(device_id_t device_id, measured_string_ref address);
-
-/** Processes the netif driver specific message.
- *  This function is called for uncommon messages received by the netif skeleton.
- *  @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.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
-
-/** Returns the device usage statistics.
- *  @param[in] device_id The device identifier.
- *  @param[out] stats The device usage statistics.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_get_device_stats(device_id_t device_id, device_stats_ref stats);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/netif_nil_bundle.h
===================================================================
--- uspace/lib/net/include/netif_nil_bundle.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/netif_nil_bundle.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -37,7 +37,7 @@
 #include <async.h>
 
-extern int netif_nil_module_message(ipc_callid_t callid, ipc_call_t *call,
-    ipc_call_t *answer, int *answer_count);
-extern int netif_nil_module_start(async_client_conn_t client_connection);
+extern int netif_nil_module_message(const char *, ipc_callid_t, ipc_call_t *,
+    ipc_call_t *, int *);
+extern int netif_nil_module_start(async_client_conn_t);
 
 #endif
Index: uspace/lib/net/include/netif_remote.h
===================================================================
--- uspace/lib/net/include/netif_remote.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/net/include/netif_remote.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,53 @@
+/*
+ * 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 netif
+ * @{
+ */
+
+#ifndef __NET_NETIF_REMOTE_H__
+#define __NET_NETIF_REMOTE_H__
+
+#include <async.h>
+#include <fibril_synch.h>
+#include <ipc/ipc.h>
+
+extern int netif_get_addr_req_remote(int, device_id_t, measured_string_ref *,
+    char **);
+extern int netif_probe_req_remote(int, device_id_t, int, int);
+extern int netif_send_msg_remote(int, device_id_t, packet_t, services_t);
+extern int netif_start_req_remote(int, device_id_t);
+extern int netif_stop_req_remote(int, device_id_t);
+extern int netif_stats_req_remote(int, device_id_t, device_stats_ref);
+extern int netif_bind_service_remote(services_t, device_id_t, services_t,
+    async_client_conn_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/netif_standalone.h
===================================================================
--- uspace/lib/net/include/netif_standalone.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * 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 netif_standalone
- *  @{
- */
-
-#ifndef __NETIF_STANDALONE_H__
-#define __NETIF_STANDALONE_H__
-
-#include <ipc/ipc.h>
-#include <async.h>
-
-extern int netif_module_message(ipc_callid_t callid, ipc_call_t *call,
-    ipc_call_t *answer, int *answer_count);
-extern int netif_module_start(async_client_conn_t client_connection);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/nil_interface.h
===================================================================
--- uspace/lib/net/include/nil_interface.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/nil_interface.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -31,12 +31,4 @@
  */
 
-/** @file
- *  Network interface layer module interface.
- *  The same interface is used for standalone remote device modules as well as for bundle device modules.
- *  The standalone remote device modules have to be compiled with the nil_remote.c source file.
- *  The bundle device modules with the appropriate network interface layer source file (eth.c etc.).
- *  The upper layers cannot be bundled with the network interface layer.
- */
-
 #ifndef __NET_NIL_INTERFACE_H__
 #define __NET_NIL_INTERFACE_H__
@@ -53,102 +45,44 @@
 #include <net_device.h>
 
-/** @name Network interface layer module interface
- *  This interface is used by other modules.
- */
-/*@{*/
+#define nil_bind_service(service, device_id, me, receiver) \
+	bind_service(service, device_id, me, 0, receiver)
 
-/** Returns the device local hardware address.
- *  @param[in] nil_phone The network interface layer phone.
- *  @param[in] device_id The device identifier.
- *  @param[out] address The device local hardware address.
- *  @param[out] data The address data.
- *  @returns EOK on success.
- *  @returns EBADMEM if the address parameter and/or the data parameter is NULL.
- *  @returns ENOENT if there no such device.
- *  @returns Other error codes as defined for the generic_get_addr_req() function.
- */
-#define nil_get_addr_req(nil_phone, device_id, address, data)	\
+#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)
 
-/** Returns the device broadcast hardware address.
- *  @param[in] nil_phone The network interface layer phone.
- *  @param[in] device_id The device identifier.
- *  @param[out] address The device broadcast hardware address.
- *  @param[out] data The address data.
- *  @returns EOK on success.
- *  @returns EBADMEM if the address parameter is NULL.
- *  @returns ENOENT if there no such device.
- *  @returns Other error codes as defined for the generic_get_addr_req() function.
- */
-#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_get_broadcast_addr_req(nil_phone, device_id, address, data) \
+	generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, \
+	    address, data)
 
-/** Sends the packet queue.
- *  @param[in] nil_phone The network interface layer phone.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The packet queue.
- *  @param[in] sender The sending module service.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the generic_send_msg() function.
- */
-#define nil_send_msg(nil_phone, device_id, packet, sender)	\
-	generic_send_msg(nil_phone, NET_NIL_SEND, device_id, packet_get_id(packet), sender, 0)
+#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)
 
-/** Returns the device packet dimension for sending.
- *  @param[in] nil_phone The network interface layer phone.
- *  @param[in] device_id The device identifier.
- *  @param[out] packet_dimension The packet dimensions.
- *  @returns EOK on success.
- *  @returns ENOENT if there is no such device.
- *  @returns Other error codes as defined for the generic_packet_size_req() function.
- */
-#define nil_packet_size_req(nil_phone, device_id, packet_dimension)	\
-	generic_packet_size_req(nil_phone, NET_NIL_PACKET_SPACE, device_id, packet_dimension)
+#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)
 
-/** Registers new device or updates the MTU of an existing one.
- *  @param[in] nil_phone The network interface layer phone.
- *  @param[in] device_id The new device identifier.
- *  @param[in] mtu The device maximum transmission unit.
- *  @param[in] netif_service The device driver service.
- *  @returns EOK on success.
- *  @returns EEXIST if the device with the different service exists.
- *  @returns ENOMEM if there is not enough memory left.
- *  @returns Other error codes as defined for the generic_device_req() function.
- */
-#define nil_device_req(nil_phone, device_id, mtu, netif_service)	\
-	generic_device_req(nil_phone, NET_NIL_DEVICE, device_id, mtu, netif_service)
 
-/** Notifies 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.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module device state function.
- */
-extern int nil_device_state_msg(int nil_phone, device_id_t device_id, int state);
+#ifdef CONFIG_NETIF_NIL_BUNDLE
 
-/** Passes the packet queue to the network interface layer.
- *  Processes and redistributes 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.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module received function.
- */
-extern int nil_received_msg(int nil_phone, device_id_t device_id, packet_t packet, services_t target);
+#include <nil_local.h>
+#include <packet/packet_server.h>
 
-/** Creates bidirectional connection with the network interface layer module and registers the message receiver.
- *  @param[in] service The network interface layer module service.
- *  @param[in] device_id The device identifier.
- *  @param[in] me The requesting module service.
- *  @param[in] receiver The message receiver.
- *  @returns The phone of the needed service.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the bind_service() function.
- */
-#define	nil_bind_service(service, device_id, me, receiver)	\
-	bind_service(service, device_id, me, 0, receiver);
-/*@}*/
+#define nil_device_state_msg  nil_device_state_msg_local
+#define nil_received_msg      nil_received_msg_local
+
+#else /* CONFIG_NETIF_NIL_BUNDLE */
+
+#include <nil_remote.h>
+#include <packet/packet_server.h>
+
+#define nil_device_state_msg  nil_device_state_msg_remote
+#define nil_received_msg      nil_received_msg_remote
+
+#endif /* CONFIG_NETIF_NIL_BUNDLE */
 
 #endif
Index: uspace/lib/net/include/nil_local.h
===================================================================
--- uspace/lib/net/include/nil_local.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/net/include/nil_local.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,86 @@
+/*
+ * 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_nil
+ *  @{
+ */
+
+/** @file
+ * Network interface layer modules common skeleton.
+ * All network interface layer modules have to implement this interface.
+ */
+
+#ifndef __NET_NIL_LOCAL_H__
+#define __NET_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);
+
+extern int nil_device_state_msg_local(int, device_id_t, int);
+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 *,
+    int *);
+
+extern int nil_module_message_standalone(const char *, ipc_callid_t,
+    ipc_call_t *, ipc_call_t *, int *);
+extern int nil_module_start_standalone(async_client_conn_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/nil_messages.h
===================================================================
--- uspace/lib/net/include/nil_messages.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/nil_messages.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -28,10 +28,9 @@
 
 /** @addtogroup net_nil
- *  @{
+ * @{
  */
 
 /** @file
- *  Network interface layer module messages.
- *  @see nil_interface.h
+ * Network interface layer module messages.
  */
 
@@ -43,5 +42,5 @@
 #include <net_messages.h>
 
-/**  Network interface layer module messages.
+/** Network interface layer module messages.
  */
 typedef enum {
@@ -80,5 +79,5 @@
 /*@{*/
 
-/** Returns the protocol service message parameter.
+/** Return the protocol service message parameter.
  */
 #define NIL_GET_PROTO(call) \
Index: uspace/lib/net/include/nil_module.h
===================================================================
--- uspace/lib/net/include/nil_module.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,67 +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_nil
- *  @{
- */
-
-/** @file
- *  Network interface layer modules common skeleton.
- *  All network interface layer modules have to implement this interface.
- */
-
-#ifndef __NET_NIL_MODULE_H__
-#define __NET_NIL_MODULE_H__
-
-#include <ipc/ipc.h>
-
-/** Module initialization.
- *  Is called by the module_start() function.
- *  @param[in] net_phone The networking moduel phone.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module initialize function.
- */
-extern int nil_initialize(int net_phone);
-
-/** Message processing function.
- *  @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.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for each specific module message function.
- *  @see nil_interface.h
- *  @see IS_NET_NIL_MESSAGE()
- */
-extern int nil_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/nil_remote.h
===================================================================
--- uspace/lib/net/include/nil_remote.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/net/include/nil_remote.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,46 @@
+/*
+ * 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 netif
+ * @{
+ */
+
+#ifndef __NET_NIL_REMOTE_H__
+#define __NET_NIL_REMOTE_H__
+
+#include <async.h>
+#include <fibril_synch.h>
+#include <ipc/ipc.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);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/nil_standalone.h
===================================================================
--- uspace/lib/net/include/nil_standalone.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * 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 nil_standalone
- *  @{
- */
-
-#ifndef __NIL_STANDALONE_H__
-#define __NIL_STANDALONE_H__
-
-#include <ipc/ipc.h>
-#include <async.h>
-
-extern int nil_module_message(ipc_callid_t callid, ipc_call_t *call,
-    ipc_call_t *answer, int *answer_count);
-extern int nil_module_start(async_client_conn_t client_connection);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/packet_remote.h
===================================================================
--- uspace/lib/net/include/packet_remote.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/net/include/packet_remote.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,46 @@
+/*
+ * 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 packet
+ * @{
+ */
+
+#ifndef __NET_PACKET_REMOTE_H__
+#define __NET_PACKET_REMOTE_H__
+
+#include <packet/packet.h>
+
+extern int packet_translate_remote(int, packet_ref, packet_id_t);
+extern packet_t packet_get_4_remote(int, size_t, size_t, size_t, size_t);
+extern packet_t packet_get_1_remote(int, size_t);
+extern void pq_release_remote(int, packet_id_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/tl_common.h
===================================================================
--- uspace/lib/net/include/tl_common.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/tl_common.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -49,4 +49,7 @@
 DEVICE_MAP_DECLARE(packet_dimensions, packet_dimension_t);
 
+extern int tl_get_ip_packet_dimension(int, packet_dimensions_ref,
+    device_id_t, packet_dimension_ref *);
+
 /** Gets the address port.
  *  Supports AF_INET and AF_INET6 address families.
@@ -59,19 +62,4 @@
  */
 extern int tl_get_address_port(const struct sockaddr * addr, int addrlen, uint16_t * port);
-
-/** Gets IP packet dimensions.
- *  Tries to search a cache and queries the IP module if not found.
- *  The reply is cached then.
- *  @param[in] ip_phone The IP moduel phone for (semi)remote calls.
- *  @param[in] packet_dimensions The packet dimensions cache.
- *  @param[in] device_id The device identifier.
- *  @param[out] packet_dimension The IP packet dimensions.
- *  @returns EOK on success.
- *  @returns EBADMEM if the packet_dimension parameter is NULL.
- *  @return ENOMEM if there is not enough memory left.
- *  @returns EINVAL if the packet_dimensions cache is not valid.
- *  @returns Other codes as defined for the ip_packet_size_req() function.
- */
-extern int tl_get_ip_packet_dimension(int ip_phone, packet_dimensions_ref packet_dimensions, device_id_t device_id, packet_dimension_ref * packet_dimension);
 
 /** Updates IP device packet dimensions cache.
Index: uspace/lib/net/include/tl_interface.h
===================================================================
--- uspace/lib/net/include/tl_interface.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/include/tl_interface.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -32,5 +32,5 @@
 
 /** @file
- *  Transport layer module interface for the underlying internetwork layer.
+ * Transport layer module interface for the underlying internetwork layer.
  */
 
@@ -48,18 +48,29 @@
 
 /** @name Transport layer module interface
- *  This interface is used by other modules.
+ * This interface is used by other modules.
  */
 /*@{*/
 
-/** Notifies the remote transport layer modules about the received packet/s.
- *  @param[in] tl_phone The transport layer module phone used for remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The received packet or the received packet queue. The packet queue is used to carry a~fragmented datagram. The first packet contains the headers, the others contain only data.
- *  @param[in] target The target transport layer module service to be delivered to.
- *  @param[in] error The packet error reporting service. Prefixes the received packet.
- *  @returns EOK on success.
+/** Notify the remote transport layer modules about the received packet/s.
+ *
+ * @param[in] tl_phone  The transport layer module phone used for remote calls.
+ * @param[in] device_id The device identifier.
+ * @param[in] packet    The received packet or the received packet queue.
+ *                      The packet queue is used to carry a fragmented
+ *                      datagram. The first packet contains the headers,
+ *                      the others contain only data.
+ * @param[in] target    The target transport layer module service to be
+ *                      delivered to.
+ * @param[in] error     The packet error reporting service. Prefixes the
+ *                      received packet.
+ *
+ * @return EOK on success.
+ *
  */
-inline static int tl_received_msg(int tl_phone, device_id_t device_id, packet_t packet, services_t target, services_t error){
-	return generic_received_msg(tl_phone, NET_TL_RECEIVED, device_id, packet_get_id(packet), target, error);
+inline static int tl_received_msg(int tl_phone, device_id_t device_id,
+    packet_t packet, services_t target, services_t error)
+{
+	return generic_received_msg_remote(tl_phone, NET_TL_RECEIVED, device_id,
+	    packet_get_id(packet), target, error);
 }
 
Index: uspace/lib/net/include/tl_local.h
===================================================================
--- uspace/lib/net/include/tl_local.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/net/include/tl_local.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010 Martin Decky
+ * 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 tl_local
+ *  @{
+ */
+
+#ifndef __TL_LOCAL_H__
+#define __TL_LOCAL_H__
+
+#include <ipc/ipc.h>
+#include <async.h>
+
+extern int tl_module_message_standalone(ipc_callid_t, ipc_call_t *,
+    ipc_call_t *, int *);
+extern int tl_module_start_standalone(async_client_conn_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/tl_standalone.h
===================================================================
--- uspace/lib/net/include/tl_standalone.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * 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 tl_standalone
- *  @{
- */
-
-#ifndef __TL_STANDALONE_H__
-#define __TL_STANDALONE_H__
-
-#include <ipc/ipc.h>
-#include <async.h>
-
-extern int tl_module_message(ipc_callid_t callid, ipc_call_t *call,
-    ipc_call_t *answer, int *answer_count);
-extern int tl_module_start(async_client_conn_t client_connection);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/netif/netif.c
===================================================================
--- uspace/lib/net/netif/netif.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,281 +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 netif
- *  @{
- */
-
-/** @file
- *  Network interface module skeleton implementation.
- *  @see netif.h
- */
-
-#include <async.h>
-#include <mem.h>
-#include <fibril_synch.h>
-#include <stdio.h>
-
-#include <ipc/ipc.h>
-#include <ipc/services.h>
-
-#include <net_err.h>
-#include <net_messages.h>
-#include <net_modules.h>
-#include <packet/packet.h>
-#include <packet/packet_client.h>
-#include <adt/measured_strings.h>
-#include <net_device.h>
-#include <netif_interface.h>
-#include <nil_interface.h>
-#include <netif.h>
-#include <netif_messages.h>
-#include <netif_module.h>
-
-DEVICE_MAP_IMPLEMENT(device_map, device_t)
-
-/** Network interface global data.
- */
-netif_globals_t netif_globals;
-
-int netif_probe_req(int netif_phone, device_id_t device_id, int irq, int io){
-	int result;
-
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	result = netif_probe_message(device_id, irq, io);
-	fibril_rwlock_write_unlock(&netif_globals.lock);
-	return result;
-}
-
-int netif_send_msg(int netif_phone, device_id_t device_id, packet_t packet, services_t sender){
-	int result;
-
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	result = netif_send_message(device_id, packet, sender);
-	fibril_rwlock_write_unlock(&netif_globals.lock);
-	return result;
-}
-
-int netif_start_req(int netif_phone, device_id_t device_id){
-	ERROR_DECLARE;
-
-	device_ref device;
-	int result;
-	int phone;
-
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	if(ERROR_OCCURRED(find_device(device_id, &device))){
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		return ERROR_CODE;
-	}
-	result = netif_start_message(device);
-	if(result > NETIF_NULL){
-		phone = device->nil_phone;
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		nil_device_state_msg(phone, device_id, result);
-		return EOK;
-	}else{
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-	}
-	return result;
-}
-
-int netif_stop_req(int netif_phone, device_id_t device_id){
-	ERROR_DECLARE;
-
-	device_ref device;
-	int result;
-	int phone;
-
-	fibril_rwlock_write_lock(&netif_globals.lock);
-	if(ERROR_OCCURRED(find_device(device_id, &device))){
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		return ERROR_CODE;
-	}
-	result = netif_stop_message(device);
-	if(result > NETIF_NULL){
-		phone = device->nil_phone;
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-		nil_device_state_msg(phone, device_id, result);
-		return EOK;
-	}else{
-		fibril_rwlock_write_unlock(&netif_globals.lock);
-	}
-	return result;
-}
-
-int netif_stats_req(int netif_phone, device_id_t device_id, device_stats_ref stats){
-	int res;
-
-	fibril_rwlock_read_lock(&netif_globals.lock);
-	res = netif_get_device_stats(device_id, stats);
-	fibril_rwlock_read_unlock(&netif_globals.lock);
-	return res;
-}
-
-int netif_get_addr_req(int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data){
-	ERROR_DECLARE;
-
-	measured_string_t translation;
-
-	if(!(address && data)){
-		return EBADMEM;
-	}
-	fibril_rwlock_read_lock(&netif_globals.lock);
-	if(! ERROR_OCCURRED(netif_get_addr_message(device_id, &translation))){
-		*address = measured_string_copy(&translation);
-		ERROR_CODE = (*address) ? EOK : ENOMEM;
-	}
-	fibril_rwlock_read_unlock(&netif_globals.lock);
-	*data = (** address).value;
-	return ERROR_CODE;
-}
-
-int netif_bind_service(services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver){
-	return EOK;
-}
-
-int find_device(device_id_t device_id, device_ref * device){
-	if(! device){
-		return EBADMEM;
-	}
-	*device = device_map_find(&netif_globals.device_map, device_id);
-	if(! * device){
-		return ENOENT;
-	}
-	if((** device).state == NETIF_NULL) return EPERM;
-	return EOK;
-}
-
-void null_device_stats(device_stats_ref stats){
-	bzero(stats, sizeof(device_stats_t));
-}
-
-/** Registers the device notification receiver, the network interface layer module.
- *  @param[in] device_id The device identifier.
- *  @param[in] phone The network interface layer module phone.
- *  @returns EOK on success.
- *  @returns ENOENT if there is no such device.
- *  @returns ELIMIT if there is another module registered.
- */
-static int register_message(device_id_t device_id, int phone){
-	ERROR_DECLARE;
-
-	device_ref device;
-
-	ERROR_PROPAGATE(find_device(device_id, &device));
-	if(device->nil_phone > 0){
-		return ELIMIT;
-	}
-	device->nil_phone = phone;
-	printf("New receiver of the device %d registered:\n\tphone\t= %d\n", device->device_id, device->nil_phone);
-	return EOK;
-}
-
-int netif_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	ERROR_DECLARE;
-
-	size_t length;
-	device_stats_t stats;
-	packet_t packet;
-	measured_string_t address;
-
-//	printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_NETIF_FIRST);
-	*answer_count = 0;
-	switch(IPC_GET_METHOD(*call)){
-		case IPC_M_PHONE_HUNGUP:
-			return EOK;
-		case NET_NETIF_PROBE:
-			return netif_probe_req(0, IPC_GET_DEVICE(call), NETIF_GET_IRQ(call), NETIF_GET_IO(call));
-		case IPC_M_CONNECT_TO_ME:
-			fibril_rwlock_write_lock(&netif_globals.lock);
-			ERROR_CODE = register_message(IPC_GET_DEVICE(call), IPC_GET_PHONE(call));
-			fibril_rwlock_write_unlock(&netif_globals.lock);
-			return ERROR_CODE;
-		case NET_NETIF_SEND:
-			ERROR_PROPAGATE(packet_translate(netif_globals.net_phone, &packet, IPC_GET_PACKET(call)));
-			return netif_send_msg(0, IPC_GET_DEVICE(call), packet, IPC_GET_SENDER(call));
-		case NET_NETIF_START:
-			return netif_start_req(0, IPC_GET_DEVICE(call));
-		case NET_NETIF_STATS:
-			fibril_rwlock_read_lock(&netif_globals.lock);
-			if(! ERROR_OCCURRED(async_data_read_receive(&callid, &length))){
-				if(length < sizeof(device_stats_t)){
-					ERROR_CODE = EOVERFLOW;
-				}else{
-					if(! ERROR_OCCURRED(netif_get_device_stats(IPC_GET_DEVICE(call), &stats))){
-						ERROR_CODE = async_data_read_finalize(callid, &stats, sizeof(device_stats_t));
-					}
-				}
-			}
-			fibril_rwlock_read_unlock(&netif_globals.lock);
-			return ERROR_CODE;
-		case NET_NETIF_STOP:
-			return netif_stop_req(0, IPC_GET_DEVICE(call));
-		case NET_NETIF_GET_ADDR:
-			fibril_rwlock_read_lock(&netif_globals.lock);
-			if(! ERROR_OCCURRED(netif_get_addr_message(IPC_GET_DEVICE(call), &address))){
-				ERROR_CODE = measured_strings_reply(&address, 1);
-			}
-			fibril_rwlock_read_unlock(&netif_globals.lock);
-			return ERROR_CODE;
-	}
-	return netif_specific_message(callid, call, answer, answer_count);
-}
-
-int netif_init_module(async_client_conn_t client_connection){
-	ERROR_DECLARE;
-
-	async_set_client_connection(client_connection);
-	netif_globals.net_phone = connect_to_service(SERVICE_NETWORKING);
-	device_map_initialize(&netif_globals.device_map);
-	ERROR_PROPAGATE(pm_init());
-	fibril_rwlock_initialize(&netif_globals.lock);
-	if(ERROR_OCCURRED(netif_initialize())){
-		pm_destroy();
-		return ERROR_CODE;
-	}
-	return EOK;
-}
-
-int netif_run_module(void){
-	async_manager();
-
-	pm_destroy();
-	return EOK;
-}
-
-void netif_pq_release(packet_id_t packet_id){
-	pq_release(netif_globals.net_phone, packet_id);
-}
-
-packet_t netif_packet_get_1(size_t content){
-	return packet_get_1(netif_globals.net_phone, content);
-}
-
-/** @}
- */
Index: uspace/lib/net/netif/netif_local.c
===================================================================
--- uspace/lib/net/netif/netif_local.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/net/netif/netif_local.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,468 @@
+/*
+ * 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 netif
+ * @{
+ */
+
+/** @file
+ * Network interface module skeleton implementation.
+ * @see netif.h
+ */
+
+#include <async.h>
+#include <mem.h>
+#include <fibril_synch.h>
+#include <stdio.h>
+#include <ipc/ipc.h>
+#include <ipc/services.h>
+
+#include <net_err.h>
+#include <net_messages.h>
+#include <net_modules.h>
+#include <packet/packet.h>
+#include <packet/packet_client.h>
+#include <packet/packet_server.h>
+#include <packet_remote.h>
+#include <adt/measured_strings.h>
+#include <net_device.h>
+#include <nil_interface.h>
+#include <netif_local.h>
+#include <netif_messages.h>
+#include <netif_interface.h>
+
+DEVICE_MAP_IMPLEMENT(netif_device_map, netif_device_t);
+
+/** Network interface global data.
+ */
+netif_globals_t netif_globals;
+
+/** Probe the existence of the device.
+ *
+ * @param[in] netif_phone The network interface phone.
+ * @param[in] device_id   The device identifier.
+ * @param[in] irq         The device interrupt number.
+ * @param[in] io          The device input/output address.
+ *
+ * @return EOK on success.
+ * @return Other errro codes as defined for the netif_probe_message().
+ *
+ */
+int netif_probe_req_local(int netif_phone, device_id_t device_id, int irq, int io)
+{
+	fibril_rwlock_write_lock(&netif_globals.lock);
+	int result = netif_probe_message(device_id, irq, io);
+	fibril_rwlock_write_unlock(&netif_globals.lock);
+	
+	return result;
+}
+
+/** Send the packet queue.
+ *
+ * @param[in] netif_phone The network interface phone.
+ * @param[in] device_id   The device identifier.
+ * @param[in] packet      The packet queue.
+ * @param[in] sender      The sending module service.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the generic_send_msg() function.
+ *
+ */
+int netif_send_msg_local(int netif_phone, device_id_t device_id,
+    packet_t packet, services_t sender)
+{
+	fibril_rwlock_write_lock(&netif_globals.lock);
+	int result = netif_send_message(device_id, packet, sender);
+	fibril_rwlock_write_unlock(&netif_globals.lock);
+	
+	return result;
+}
+
+/** Start the device.
+ *
+ * @param[in] netif_phone The network interface phone.
+ * @param[in] device_id   The device identifier.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the netif_start_message() function.
+ *
+ */
+int netif_start_req_local(int netif_phone, device_id_t device_id)
+{
+	ERROR_DECLARE;
+	
+	fibril_rwlock_write_lock(&netif_globals.lock);
+	
+	netif_device_t *device;
+	if (ERROR_OCCURRED(find_device(device_id, &device))) {
+		fibril_rwlock_write_unlock(&netif_globals.lock);
+		return ERROR_CODE;
+	}
+	
+	int result = netif_start_message(device);
+	if (result > NETIF_NULL) {
+		int phone = device->nil_phone;
+		fibril_rwlock_write_unlock(&netif_globals.lock);
+		nil_device_state_msg(phone, device_id, result);
+		return EOK;
+	}
+	
+	fibril_rwlock_write_unlock(&netif_globals.lock);
+	
+	return result;
+}
+
+/** Stop the device.
+ *
+ * @param[in] netif_phone The network interface phone.
+ * @param[in] device_id   The device identifier.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the netif_stop_message() function.
+ *
+ */
+int netif_stop_req_local(int netif_phone, device_id_t device_id)
+{
+	ERROR_DECLARE;
+	
+	fibril_rwlock_write_lock(&netif_globals.lock);
+	
+	netif_device_t *device;
+	if (ERROR_OCCURRED(find_device(device_id, &device))) {
+		fibril_rwlock_write_unlock(&netif_globals.lock);
+		return ERROR_CODE;
+	}
+	
+	int result = netif_stop_message(device);
+	if (result > NETIF_NULL) {
+		int phone = device->nil_phone;
+		fibril_rwlock_write_unlock(&netif_globals.lock);
+		nil_device_state_msg(phone, device_id, result);
+		return EOK;
+	}
+	
+	fibril_rwlock_write_unlock(&netif_globals.lock);
+	
+	return result;
+}
+
+/** Return the device usage statistics.
+ *
+ * @param[in]  netif_phone The network interface phone.
+ * @param[in]  device_id   The device identifier.
+ * @param[out] stats       The device usage statistics.
+ *
+ * @return EOK on success.
+ *
+ */
+int netif_stats_req_local(int netif_phone, device_id_t device_id,
+    device_stats_ref stats)
+{
+	fibril_rwlock_read_lock(&netif_globals.lock);
+	int res = netif_get_device_stats(device_id, stats);
+	fibril_rwlock_read_unlock(&netif_globals.lock);
+	
+	return res;
+}
+
+/** Return the device local hardware address.
+ *
+ * @param[in]  netif_phone The network interface phone.
+ * @param[in]  device_id   The device identifier.
+ * @param[out] address     The device local hardware address.
+ * @param[out] data        The address data.
+ *
+ * @return EOK on success.
+ * @return EBADMEM if the address parameter is NULL.
+ * @return ENOENT if there no such device.
+ * @return Other error codes as defined for the netif_get_addr_message()
+ *         function.
+ *
+ */
+int netif_get_addr_req_local(int netif_phone, device_id_t device_id,
+    measured_string_ref *address, char **data)
+{
+	ERROR_DECLARE;
+	
+	if ((!address) || (!data))
+		return EBADMEM;
+	
+	fibril_rwlock_read_lock(&netif_globals.lock);
+	
+	measured_string_t translation;
+	if (!ERROR_OCCURRED(netif_get_addr_message(device_id, &translation))) {
+		*address = measured_string_copy(&translation);
+		ERROR_CODE = (*address) ? EOK : ENOMEM;
+	}
+	
+	fibril_rwlock_read_unlock(&netif_globals.lock);
+	
+	*data = (**address).value;
+	
+	return ERROR_CODE;
+}
+
+/** Create bidirectional connection with the network interface module and registers the message receiver.
+ *
+ * @param[in] service   The network interface module service.
+ * @param[in] device_id The device identifier.
+ * @param[in] me        The requesting module service.
+ * @param[in] receiver  The message receiver.
+ *
+ * @return The phone of the needed service.
+ * @return EOK on success.
+ * @return Other error codes as defined for the bind_service() function.
+ *
+ */
+int netif_bind_service_local(services_t service, device_id_t device_id,
+    services_t me, async_client_conn_t receiver)
+{
+	return EOK;
+}
+
+/** Find the device specific data.
+ *
+ * @param[in]  device_id The device identifier.
+ * @param[out] device    The device specific data.
+ *
+ * @return EOK on success.
+ * @return ENOENT if device is not found.
+ * @return EPERM if the device is not initialized.
+ *
+ */
+int find_device(device_id_t device_id, netif_device_t **device)
+{
+	if (!device)
+		return EBADMEM;
+	
+	*device = netif_device_map_find(&netif_globals.device_map, device_id);
+	if (*device == NULL)
+		return ENOENT;
+	
+	if ((*device)->state == NETIF_NULL)
+		return EPERM;
+	
+	return EOK;
+}
+
+/** Clear the usage statistics.
+ *
+ * @param[in] stats The usage statistics.
+ *
+ */
+void null_device_stats(device_stats_ref stats)
+{
+	bzero(stats, sizeof(device_stats_t));
+}
+
+/** Initialize the netif module.
+ *
+ *  @param[in] client_connection The client connection functio to be
+ *                               registered.
+ *
+ *  @return EOK on success.
+ *  @return Other error codes as defined for each specific module
+ *          message function.
+ *
+ */
+int netif_init_module(async_client_conn_t client_connection)
+{
+	ERROR_DECLARE;
+	
+	async_set_client_connection(client_connection);
+	
+	netif_globals.net_phone = connect_to_service(SERVICE_NETWORKING);
+	netif_device_map_initialize(&netif_globals.device_map);
+	
+	ERROR_PROPAGATE(pm_init());
+	
+	fibril_rwlock_initialize(&netif_globals.lock);
+	if (ERROR_OCCURRED(netif_initialize())) {
+		pm_destroy();
+		return ERROR_CODE;
+	}
+	
+	return EOK;
+}
+
+/** Release the given packet.
+ *
+ * Prepared for future optimization.
+ *
+ * @param[in] packet_id The packet identifier.
+ *
+ */
+void netif_pq_release(packet_id_t packet_id)
+{
+	pq_release_remote(netif_globals.net_phone, packet_id);
+}
+
+/** Allocate new packet to handle the given content size.
+ *
+ * @param[in] content The minimum content size.
+ *
+ * @return The allocated packet.
+ * @return NULL if there is an error.
+ *
+ */
+packet_t netif_packet_get_1(size_t content)
+{
+	return packet_get_1_remote(netif_globals.net_phone, content);
+}
+
+/** Register the device notification receiver, the network interface layer module.
+ *
+ * @param[in] name      Module name.
+ * @param[in] device_id The device identifier.
+ * @param[in] phone     The network interface layer module phone.
+ *
+ * @return EOK on success.
+ * @return ENOENT if there is no such device.
+ * @return ELIMIT if there is another module registered.
+ *
+ */
+static int register_message(const char *name, device_id_t device_id, int phone)
+{
+	ERROR_DECLARE;
+	
+	netif_device_t *device;
+	ERROR_PROPAGATE(find_device(device_id, &device));
+	if(device->nil_phone > 0)
+		return ELIMIT;
+	
+	device->nil_phone = phone;
+	printf("%s: Receiver of device %d registered (phone: %d)\n",
+	    name, device->device_id, device->nil_phone);
+	return EOK;
+}
+
+/** Process the netif module messages.
+ *
+ * @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 IS_NET_NETIF_MESSAGE()
+ *
+ */
+int netif_module_message_standalone(const char *name, ipc_callid_t callid,
+    ipc_call_t *call, ipc_call_t *answer, int *answer_count)
+{
+	ERROR_DECLARE;
+	
+	size_t length;
+	device_stats_t stats;
+	packet_t packet;
+	measured_string_t address;
+	
+	*answer_count = 0;
+	switch (IPC_GET_METHOD(*call)) {
+		case IPC_M_PHONE_HUNGUP:
+			return EOK;
+		case NET_NETIF_PROBE:
+			return netif_probe_req_local(0, IPC_GET_DEVICE(call),
+			    NETIF_GET_IRQ(call), NETIF_GET_IO(call));
+		case IPC_M_CONNECT_TO_ME:
+			fibril_rwlock_write_lock(&netif_globals.lock);
+			ERROR_CODE = register_message(name, IPC_GET_DEVICE(call),
+			    IPC_GET_PHONE(call));
+			fibril_rwlock_write_unlock(&netif_globals.lock);
+			return ERROR_CODE;
+		case NET_NETIF_SEND:
+			ERROR_PROPAGATE(packet_translate_remote(netif_globals.net_phone,
+			    &packet, IPC_GET_PACKET(call)));
+			return netif_send_msg_local(0, IPC_GET_DEVICE(call), packet,
+			    IPC_GET_SENDER(call));
+		case NET_NETIF_START:
+			return netif_start_req_local(0, IPC_GET_DEVICE(call));
+		case NET_NETIF_STATS:
+			fibril_rwlock_read_lock(&netif_globals.lock);
+			if (!ERROR_OCCURRED(async_data_read_receive(&callid, &length))) {
+				if (length < sizeof(device_stats_t))
+					ERROR_CODE = EOVERFLOW;
+				else {
+					if (!ERROR_OCCURRED(netif_get_device_stats(
+					    IPC_GET_DEVICE(call), &stats)))
+						ERROR_CODE = async_data_read_finalize(callid, &stats,
+						    sizeof(device_stats_t));
+				}
+			}
+			fibril_rwlock_read_unlock(&netif_globals.lock);
+			return ERROR_CODE;
+		case NET_NETIF_STOP:
+			return netif_stop_req_local(0, IPC_GET_DEVICE(call));
+		case NET_NETIF_GET_ADDR:
+			fibril_rwlock_read_lock(&netif_globals.lock);
+			if (!ERROR_OCCURRED(netif_get_addr_message(IPC_GET_DEVICE(call),
+			    &address)))
+				ERROR_CODE = measured_strings_reply(&address, 1);
+			fibril_rwlock_read_unlock(&netif_globals.lock);
+			return ERROR_CODE;
+	}
+	
+	return netif_specific_message(callid, call, answer, answer_count);
+}
+
+/** Start the network interface module.
+ *
+ * Initialize the client connection serving function, initialize
+ * the module, registers 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 each specific module message
+ *         function.
+ *
+ */
+int netif_module_start_standalone(async_client_conn_t client_connection)
+{
+	ERROR_DECLARE;
+	
+	ERROR_PROPAGATE(netif_init_module(client_connection));
+	
+	async_manager();
+	
+	pm_destroy();
+	return EOK;
+}
+
+/** @}
+ */
Index: uspace/lib/net/netif/netif_nil_bundle.c
===================================================================
--- uspace/lib/net/netif/netif_nil_bundle.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/netif/netif_nil_bundle.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -41,40 +41,63 @@
 #include <net_messages.h>
 #include <packet/packet.h>
-#include <nil_module.h>
 #include <netif_nil_bundle.h>
-#include <netif.h>
+#include <netif_local.h>
+#include <nil_local.h>
 
-/** Distributes the messages between the module parts.
- *  @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.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for each specific module message function.
+/** Distribute the messages between the module parts.
+ *
+ * @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.
+ *
  */
-int netif_nil_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	if(IS_NET_NIL_MESSAGE(call) || (IPC_GET_METHOD(*call) == IPC_M_CONNECT_TO_ME)){
-		return nil_message(callid, call, answer, answer_count);
-	}else{
-		return netif_message(callid, call, answer, answer_count);
-	}
+int netif_nil_module_message(const char *name, ipc_callid_t callid,
+    ipc_call_t *call, ipc_call_t *answer, int *answer_count)
+{
+	if ((IS_NET_NIL_MESSAGE(call))
+	    || (IPC_GET_METHOD(*call) == IPC_M_CONNECT_TO_ME))
+		return nil_message_standalone(name, callid, call, answer,
+		    answer_count);
+	else
+		return netif_module_message_standalone(name, callid, call, answer,
+		    answer_count);
 }
 
-/** Starts the bundle network interface module.
- *  Initializes the client connection serving function, initializes both module parts, registers the module service and starts 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.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module message function.
+/** Start the bundle network interface module.
+ *
+ * Initialize the client connection serving function, initialize
+ * both module parts, 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 each specific module message
+ *         function.
+ *
  */
-int netif_nil_module_start(async_client_conn_t client_connection){
+int netif_nil_module_start(async_client_conn_t client_connection)
+{
 	ERROR_DECLARE;
-
+	
 	ERROR_PROPAGATE(netif_init_module(client_connection));
-	if(ERROR_OCCURRED(nil_initialize(netif_globals.net_phone))){
+	if (ERROR_OCCURRED(nil_initialize(netif_globals.net_phone))) {
 		pm_destroy();
 		return ERROR_CODE;
 	}
-	return netif_run_module();
+	
+	async_manager();
+	
+	pm_destroy();
+	return EOK;
 }
 
Index: uspace/lib/net/netif/netif_remote.c
===================================================================
--- uspace/lib/net/netif/netif_remote.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/net/netif/netif_remote.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,99 @@
+/*
+ * 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 netif
+ * @{
+ */
+
+/** @file
+ * Network interface module interface implementation for remote modules.
+ */
+
+#include <ipc/services.h>
+
+#include <net_modules.h>
+#include <adt/measured_strings.h>
+#include <packet/packet.h>
+#include <packet/packet_client.h>
+#include <net_device.h>
+#include <netif_remote.h>
+#include <netif_messages.h>
+
+int netif_get_addr_req_remote(int netif_phone, device_id_t device_id,
+    measured_string_ref *address, char **data)
+{
+	return generic_get_addr_req(netif_phone, NET_NETIF_GET_ADDR, device_id,
+	    address, data);
+}
+
+int netif_probe_req_remote(int netif_phone, device_id_t device_id, int irq, int io)
+{
+	return async_req_3_0(netif_phone, NET_NETIF_PROBE, device_id, irq, io);
+}
+
+int netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t packet,
+    services_t sender)
+{
+	return generic_send_msg_remote(netif_phone, NET_NETIF_SEND, device_id,
+	    packet_get_id(packet), sender, 0);
+}
+
+int netif_start_req_remote(int netif_phone, device_id_t device_id)
+{
+	return async_req_1_0(netif_phone, NET_NETIF_START, device_id);
+}
+
+int netif_stop_req_remote(int netif_phone, device_id_t device_id)
+{
+	return async_req_1_0(netif_phone, NET_NETIF_STOP, device_id);
+}
+
+int netif_stats_req_remote(int netif_phone, device_id_t device_id,
+    device_stats_ref stats)
+{
+	if (!stats)
+		return EBADMEM;
+	
+	aid_t message_id = async_send_1(netif_phone, NET_NETIF_STATS,
+	    (ipcarg_t) device_id, NULL);
+	async_data_read_start(netif_phone, stats, sizeof(*stats));
+	
+	ipcarg_t result;
+	async_wait_for(message_id, &result);
+	
+	return (int) result;
+}
+
+int netif_bind_service_remote(services_t service, device_id_t device_id, services_t me,
+    async_client_conn_t receiver)
+{
+	return bind_service(service, device_id, me, 0, receiver);
+}
+
+/** @}
+ */
Index: uspace/lib/net/netif/netif_standalone.c
===================================================================
--- uspace/lib/net/netif/netif_standalone.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,70 +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 netif
- *  @{
- */
-
-/** @file
- *  Wrapper for the standalone network interface module.
- */
-
-#include <async.h>
-#include <ipc/ipc.h>
-
-#include <netif.h>
-#include <netif_standalone.h>
-
-/** Delegates the messages to the netif_message() function.
- *  @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.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for each specific module message function.
- */
-int netif_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	return netif_message(callid, call, answer, answer_count);
-}
-
-/** Starts the network interface module.
- *  Initializes the client connection serving function, initializes the module, registers the module service and starts 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.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module message function.
- */
-int netif_module_start(async_client_conn_t client_connection){
-	ERROR_DECLARE;
-
-	ERROR_PROPAGATE(netif_init_module(client_connection));
-	return netif_run_module();
-}
-
-/** @}
- */
Index: uspace/lib/net/nil/nil_remote.c
===================================================================
--- uspace/lib/net/nil/nil_remote.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/nil/nil_remote.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -28,10 +28,10 @@
 
 /** @addtogroup net_nil
- *  @{
+ * @{
  */
 
 /** @file
- *  Network interface layer interface implementation for standalone remote modules.
- *  @see nil_interface.h
+ * Network interface layer interface implementation for remote modules.
+ * @see nil_interface.h
  */
 
@@ -42,11 +42,43 @@
 #include <packet/packet_client.h>
 #include <nil_messages.h>
+#include <nil_remote.h>
 
-int nil_device_state_msg(int nil_phone, device_id_t device_id, int state){
-	return generic_device_state_msg(nil_phone, NET_NIL_DEVICE_STATE, device_id, state, 0);
+/** 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.
+ *
+ */
+int nil_device_state_msg_remote(int nil_phone, device_id_t device_id, int state)
+{
+	return generic_device_state_msg_remote(nil_phone, NET_NIL_DEVICE_STATE,
+	    device_id, state, 0);
 }
 
-int nil_received_msg(int nil_phone, device_id_t device_id, packet_t packet, services_t target){
-	return generic_received_msg(nil_phone, NET_NIL_RECEIVED, device_id, packet_get_id(packet), target, 0);
+/** 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.
+ *
+ */
+int nil_received_msg_remote(int nil_phone, device_id_t device_id,
+    packet_t packet, services_t target)
+{
+	return generic_received_msg_remote(nil_phone, NET_NIL_RECEIVED, device_id,
+	    packet_get_id(packet), target, 0);
 }
 
Index: uspace/lib/net/tl/icmp_remote.c
===================================================================
--- uspace/lib/net/tl/icmp_remote.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/tl/icmp_remote.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -32,5 +32,5 @@
 
 /** @file
- *  ICMP interface implementation for standalone remote modules.
+ *  ICMP interface implementation for remote modules.
  *  @see icmp_interface.h
  */
Index: uspace/lib/net/tl/tl_common.c
===================================================================
--- uspace/lib/net/tl/tl_common.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/net/tl/tl_common.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -42,4 +42,5 @@
 #include <packet/packet.h>
 #include <packet/packet_client.h>
+#include <packet_remote.h>
 #include <net_device.h>
 #include <icmp_interface.h>
@@ -47,7 +48,10 @@
 #include <in6.h>
 #include <inet.h>
-#include <ip_interface.h>
+#include <ip_local.h>
+#include <ip_remote.h>
 #include <socket_codes.h>
 #include <socket_errno.h>
+#include <ip_interface.h>
+#include <tl_interface.h>
 #include <tl_common.h>
 
@@ -82,28 +86,51 @@
 }
 
-int tl_get_ip_packet_dimension(int ip_phone, packet_dimensions_ref packet_dimensions, device_id_t device_id, packet_dimension_ref * packet_dimension){
+/** Get IP packet dimensions.
+ *
+ * Try to search a cache and query the IP module if not found.
+ * The reply is cached then.
+ *
+ * @param[in]  ip_phone          The IP moduel phone for (semi)remote calls.
+ * @param[in]  packet_dimensions The packet dimensions cache.
+ * @param[in]  device_id         The device identifier.
+ * @param[out] packet_dimension  The IP packet dimensions.
+ *
+ * @return EOK on success.
+ * @return EBADMEM if the packet_dimension parameter is NULL.
+ * @return ENOMEM if there is not enough memory left.
+ * @return EINVAL if the packet_dimensions cache is not valid.
+ * @return Other codes as defined for the ip_packet_size_req() function.
+ *
+ */
+int tl_get_ip_packet_dimension(int ip_phone,
+    packet_dimensions_ref packet_dimensions, device_id_t device_id,
+    packet_dimension_ref *packet_dimension)
+{
 	ERROR_DECLARE;
-
-	if(! packet_dimension){
+	
+	if (!packet_dimension)
 		return EBADMEM;
-	}
-
+	
 	*packet_dimension = packet_dimensions_find(packet_dimensions, device_id);
-	if(! * packet_dimension){
-		// ask for and remember them if not found
-		*packet_dimension = malloc(sizeof(** packet_dimension));
-		if(! * packet_dimension){
+	if (!*packet_dimension) {
+		/* Ask for and remember them if not found */
+		*packet_dimension = malloc(sizeof(**packet_dimension));
+		if(!*packet_dimension)
 			return ENOMEM;
-		}
-		if(ERROR_OCCURRED(ip_packet_size_req(ip_phone, device_id, * packet_dimension))){
+		
+		if (ERROR_OCCURRED(ip_packet_size_req(ip_phone, device_id,
+		    *packet_dimension))) {
 			free(*packet_dimension);
 			return ERROR_CODE;
 		}
-		ERROR_CODE = packet_dimensions_add(packet_dimensions, device_id, * packet_dimension);
-		if(ERROR_CODE < 0){
+		
+		ERROR_CODE = packet_dimensions_add(packet_dimensions, device_id,
+		    *packet_dimension);
+		if (ERROR_CODE < 0) {
 			free(*packet_dimension);
 			return ERROR_CODE;
 		}
 	}
+	
 	return EOK;
 }
@@ -169,7 +196,7 @@
 	// detach the first packet and release the others
 	next = pq_detach(packet);
-	if(next){
-		pq_release(packet_phone, packet_get_id(next));
-	}
+	if (next)
+		pq_release_remote(packet_phone, packet_get_id(next));
+	
 	length = packet_get_addr(packet, &src, NULL);
 	if((length > 0)
@@ -180,5 +207,5 @@
 		return EOK;
 	}else{
-		pq_release(packet_phone, packet_get_id(packet));
+		pq_release_remote(packet_phone, packet_get_id(packet));
 	}
 	return ENOENT;
@@ -200,5 +227,5 @@
 	}
 	// get a new packet
-	*packet = packet_get_4(packet_phone, length, dimension->addr_len, prefix + dimension->prefix, dimension->suffix);
+	*packet = packet_get_4_remote(packet_phone, length, dimension->addr_len, prefix + dimension->prefix, dimension->suffix);
 	if(! packet){
 		return ENOMEM;
@@ -207,5 +234,5 @@
 	data = packet_suffix(*packet, length);
 	if(! data){
-		pq_release(packet_phone, packet_get_id(*packet));
+		pq_release_remote(packet_phone, packet_get_id(*packet));
 		return ENOMEM;
 	}
@@ -214,5 +241,5 @@
 	// set the packet destination address
 		|| ERROR_OCCURRED(packet_set_addr(*packet, NULL, (uint8_t *) addr, addrlen))){
-		pq_release(packet_phone, packet_get_id(*packet));
+		pq_release_remote(packet_phone, packet_get_id(*packet));
 		return ERROR_CODE;
 	}
Index: uspace/lib/netif/Makefile
===================================================================
--- uspace/lib/netif/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# 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.
-#
-
-USPACE_PREFIX = ../..
-EXTRA_CFLAGS = -Iinclude -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
-LIBRARY = libnetif
-
-SOURCES = \
-	generic/netif_remote.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/netif/generic/netif_remote.c
===================================================================
--- uspace/lib/netif/generic/netif_remote.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,86 +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 netif
- *  @{
- */
-
-/** @file
- *  Network interface module interface implementation for standalone remote modules.
- *  @see netif_interface.h
- */
-
-#include <ipc/services.h>
-
-#include <net_modules.h>
-#include <adt/measured_strings.h>
-#include <packet/packet.h>
-#include <packet/packet_client.h>
-#include <net_device.h>
-#include <netif_interface.h>
-#include <netif_messages.h>
-
-int netif_get_addr_req(int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data){
-	return generic_get_addr_req(netif_phone, NET_NETIF_GET_ADDR, device_id, address, data);
-}
-
-int netif_probe_req(int netif_phone, device_id_t device_id, int irq, int io){
-	return async_req_3_0(netif_phone, NET_NETIF_PROBE, device_id, irq, io);
-}
-
-int netif_send_msg(int netif_phone, device_id_t device_id, packet_t packet, services_t sender){
-	return generic_send_msg(netif_phone, NET_NETIF_SEND, device_id, packet_get_id(packet), sender, 0);
-}
-
-int netif_start_req(int netif_phone, device_id_t device_id){
-	return async_req_1_0(netif_phone, NET_NETIF_START, device_id);
-}
-
-int netif_stop_req(int netif_phone, device_id_t device_id){
-	return async_req_1_0(netif_phone, NET_NETIF_STOP, device_id);
-}
-
-int netif_stats_req(int netif_phone, device_id_t device_id, device_stats_ref stats){
-	aid_t message_id;
-	ipcarg_t result;
-
-	if(! stats){
-		return EBADMEM;
-	}
-	message_id = async_send_1(netif_phone, NET_NETIF_STATS, (ipcarg_t) device_id, NULL);
-	async_data_read_start(netif_phone, stats, sizeof(*stats));
-	async_wait_for(message_id, &result);
-	return (int) result;
-}
-
-int netif_bind_service(services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver){
-	return bind_service(service, device_id, me, 0, receiver);
-}
-
-/** @}
- */
Index: uspace/lib/socket/Makefile
===================================================================
--- uspace/lib/socket/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/socket/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -35,4 +35,5 @@
 	generic/socket_client.c \
 	generic/socket_core.c \
+	generic/socket_parse.c \
 	generic/inet.c \
 	generic/net_modules.c \
Index: uspace/lib/socket/generic/net_modules.c
===================================================================
--- uspace/lib/socket/generic/net_modules.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/socket/generic/net_modules.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -77,20 +77,49 @@
 }
 
-int bind_service(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver){
+/** 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);
 }
 
-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){
+/** 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;
-
-	int phone;
-	ipcarg_t phonehash;
-
-	// connect to the needed service
-	phone = connect_to_service_timeout(need, timeout);
-	// if connected
-	if(phone >= 0){
-		// request the bidirectional connection
-		if(ERROR_OCCURRED(ipc_connect_to_me(phone, arg1, arg2, arg3, &phonehash))){
+	
+	/* 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;
@@ -98,4 +127,5 @@
 		async_new_connection(phonehash, 0, NULL, client_receiver);
 	}
+	
 	return phone;
 }
Index: uspace/lib/socket/generic/socket_core.c
===================================================================
--- uspace/lib/socket/generic/socket_core.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/socket/generic/socket_core.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -90,5 +90,5 @@
 	// release all received packets
 	while((packet_id = dyn_fifo_pop(&socket->received)) >= 0){
-		pq_release(packet_phone, packet_id);
+		pq_release_local(packet_phone, packet_id);
 	}
 	dyn_fifo_destroy(&socket->received);
Index: uspace/lib/socket/generic/socket_parse.c
===================================================================
--- uspace/lib/socket/generic/socket_parse.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/socket/generic/socket_parse.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,122 @@
+/*
+ * 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 socket
+ * @{
+ */
+
+/** @file
+ * Command-line argument parsing functions related to networking.
+ */
+
+#include <socket_parse.h>
+#include <arg_parse.h>
+#include <errno.h>
+#include <str.h>
+#include <socket.h>
+
+/** Translate the character string to the address family number.
+ *
+ * @param[in]  name The address family name.
+ * @param[out] af   The corresponding address family number
+ *                  or EAFNOSUPPORTED.
+ *
+ * @return EOK on success.
+ * @return ENOTSUP on unsupported address family.
+ *
+ */
+int socket_parse_address_family(const char *name, int *af)
+{
+	if (str_lcmp(name, "AF_INET", 7) == 0) {
+		*af = AF_INET;
+		return EOK;
+	}
+	
+	if (str_lcmp(name, "AF_INET6", 8) == 0) {
+		*af = AF_INET6;
+		return EOK;
+	}
+	
+	*af = EAFNOSUPPORT;
+	return ENOTSUP;
+}
+
+/** Translate the character string to the protocol family number.
+ *
+ * @param[in]  name The protocol family name.
+ * @param[out] pf   The corresponding protocol family number
+ *                  or EPFNOSUPPORTED.
+ *
+ * @return EOK on success.
+ * @return ENOTSUP on unsupported protocol family.
+ *
+ */
+int socket_parse_protocol_family(const char *name, int *pf)
+{
+	if (str_lcmp(name, "PF_INET", 7) == 0) {
+		*pf = PF_INET;
+		return EOK;
+	}
+	
+	if (str_lcmp(name, "PF_INET6", 8) == 0) {
+		*pf = PF_INET6;
+		return EOK;
+	}
+	
+	*pf = EPFNOSUPPORT;
+	return ENOTSUP;
+}
+
+/** Translate the character string to the socket type number.
+ *
+ * @param[in]  name  The socket type name.
+ * @param[out] sockt The corresponding socket type number
+ *                   or ESOCKTNOSUPPORT.
+ *
+ * @return EOK on success.
+ * @return ENOTSUP on unsupported socket type.
+ *
+ */
+int socket_parse_socket_type(const char *name, int *sockt)
+{
+	if (str_lcmp(name, "SOCK_DGRAM", 11) == 0) {
+		*sockt = SOCK_DGRAM;
+		return EOK;
+	}
+	
+	if (str_lcmp(name, "SOCK_STREAM", 12) == 0) {
+		*sockt = SOCK_STREAM;
+		return EOK;
+	}
+	
+	*sockt = ESOCKTNOSUPPORT;
+	return ENOTSUP;
+}
+
+/** @}
+ */
Index: uspace/lib/socket/include/net_err.h
===================================================================
--- uspace/lib/socket/include/net_err.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/socket/include/net_err.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -28,9 +28,9 @@
 
 /** @addtogroup net
- *  @{
+ * @{
  */
 
 /** @file
- *  Common error processing codes and routines.
+ * Common error processing codes and routines.
  */
 
@@ -41,40 +41,56 @@
 
 #ifdef CONFIG_DEBUG
+	#include <stdio.h>
+	#include <str_error.h>
+#endif
 
-#include <stdio.h>
+/** An actual stored error code.
+ *
+ */
+#define ERROR_CODE  error_check_return_value
+
+/** An error processing routines declaration.
+ *
+ * This has to be declared in the block where the error processing
+ * is desired.
+ *
+ */
+#define ERROR_DECLARE  int ERROR_CODE
+
+/** Store the value as an error code and checks if an error occurred.
+ *
+ * @param[in] value The value to be checked. May be a function call.
+ * @return False if the value indicates success (EOK).
+ * @return True otherwise.
+ *
+ */
+#ifdef CONFIG_DEBUG
+
+#define ERROR_OCCURRED(value) \
+	(((ERROR_CODE = (value)) != EOK) \
+	&& ({ \
+		fprintf(stderr, "libsocket error at %s:%d (%s)\n", \
+		__FILE__, __LINE__, str_error(ERROR_CODE)); \
+		1; \
+	}))
+
+#else
+
+#define ERROR_OCCURRED(value)  ((ERROR_CODE = (value)) != EOK)
 
 #endif
 
-/** An actual stored error code.
- */
-#define ERROR_CODE					error_check_return_value
-
-/** An error processing routines declaration.
- *  This has to be declared in the block where the error processing is desired.
- */
-#define ERROR_DECLARE				int ERROR_CODE
-
-/** Stores the value as an error code and checks if an error occurred.
- *  @param[in] value The value to be checked. May be a function call.
- *  @returns FALSE if the value indicates success (EOK).
- *  @returns TRUE otherwise.
- */
-#ifdef CONFIG_DEBUG
-
-#define ERROR_OCCURRED(value)												\
-	(((ERROR_CODE = (value)) != EOK)										\
-	&& ({printf("error at %s:%d %d\n", __FILE__, __LINE__, ERROR_CODE); 1;}))
-
-#else
-
-#define ERROR_OCCURRED(value)		((ERROR_CODE = (value)) != EOK)
-
-#endif
-
-/** Checks if an error occurred and immediately exits the actual function returning the error code.
- *  @param[in] value The value to be checked. May be a function call.
+/** Error propagation
+ *
+ * Check if an error occurred and immediately exit the actual
+ * function returning the error code.
+ *
+ * @param[in] value The value to be checked. May be a function call.
+ *
  */
 
-#define ERROR_PROPAGATE(value)	if(ERROR_OCCURRED(value)) return ERROR_CODE
+#define ERROR_PROPAGATE(value) \
+	if (ERROR_OCCURRED(value)) \
+		return ERROR_CODE
 
 #endif
Index: uspace/lib/socket/include/net_messages.h
===================================================================
--- uspace/lib/socket/include/net_messages.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/socket/include/net_messages.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -462,28 +462,41 @@
 /*@}*/
 
-/** Notifies the module about the device state change.
- *  @param[in] phone The service module phone.
- *  @param[in] message The service specific message.
- *  @param[in] device_id The device identifier.
- *  @param[in] state The new device state.
- *  @param[in] target The target module service.
- *  @returns EOK on success.
- */
-static inline int generic_device_state_msg(int phone, int message, device_id_t device_id, int state, services_t target){
-	async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) state, target);
+/** Notify the module about the device state change.
+ *
+ * @param[in] phone     The service module phone.
+ * @param[in] message   The service specific message.
+ * @param[in] device_id The device identifier.
+ * @param[in] state     The new device state.
+ * @param[in] target    The target module service.
+ *
+ * @return EOK on success.
+ *
+ */
+static inline int generic_device_state_msg_remote(int phone, int message,
+    device_id_t device_id, int state, services_t target)
+{
+	async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id,
+	    (ipcarg_t) state, target);
+	
 	return EOK;
 }
 
-/** Notifies a module about the device.
- *  @param[in] phone The service module phone.
- *  @param[in] message The service specific message.
- *  @param[in] device_id The device identifier.
- *  @param[in] arg2 The second argument of the message.
- *  @param[in] service The device module service.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the specific service message.
- */
-static inline int generic_device_req(int phone, int message, device_id_t device_id, int arg2, services_t service){
-	return (int) async_req_3_0(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) arg2, (ipcarg_t) service);
+/** Notify a module about the device.
+ *
+ * @param[in] phone     The service module phone.
+ * @param[in] message   The service specific message.
+ * @param[in] device_id The device identifier.
+ * @param[in] arg2      The second argument of the message.
+ * @param[in] service   The device module service.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the specific service message.
+ *
+ */
+static inline int generic_device_req_remote(int phone, int message,
+    device_id_t device_id, int arg2, services_t service)
+{
+	return (int) async_req_3_0(phone, (ipcarg_t) message, (ipcarg_t) device_id,
+	    (ipcarg_t) arg2, (ipcarg_t) service);
 }
 
@@ -521,64 +534,88 @@
 }
 
-/** Returns the device packet dimension for sending.
- *  @param[in] phone The service module phone.
- *  @param[in] message The service specific message.
- *  @param[in] device_id The device identifier.
- *  @param[out] packet_dimension The packet dimension.
- *  @returns EOK on success.
- *  @returns EBADMEM if the packet_dimension parameter is NULL.
- *  @returns Other error codes as defined for the specific service message.
- */
-static inline int generic_packet_size_req(int phone, int message, device_id_t device_id, packet_dimension_ref packet_dimension){
-	ipcarg_t result;
+/** Return the device packet dimension for sending.
+ *
+ * @param[in]  phone            The service module phone.
+ * @param[in]  message          The service specific message.
+ * @param[in]  device_id        The device identifier.
+ * @param[out] packet_dimension The packet dimension.
+ *
+ * @return EOK on success.
+ * @return EBADMEM if the packet_dimension parameter is NULL.
+ * @return Other error codes as defined for the specific service message.
+ *
+ */
+static inline int generic_packet_size_req_remote(int phone, int message,
+    device_id_t device_id, packet_dimension_ref packet_dimension)
+{
+	if (!packet_dimension)
+		return EBADMEM;
+	
+	ipcarg_t addr_len;
 	ipcarg_t prefix;
 	ipcarg_t content;
 	ipcarg_t suffix;
-	ipcarg_t addr_len;
-
-	if(! packet_dimension){
-		return EBADMEM;
-	}
-	result = async_req_1_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, &addr_len, &prefix, &content, &suffix);
+	
+	ipcarg_t result = async_req_1_4(phone, (ipcarg_t) message,
+	    (ipcarg_t) device_id, &addr_len, &prefix, &content, &suffix);
+	
 	packet_dimension->prefix = (size_t) prefix;
 	packet_dimension->content = (size_t) content;
 	packet_dimension->suffix = (size_t) suffix;
 	packet_dimension->addr_len = (size_t) addr_len;
+	
 	return (int) result;
 }
 
-/** Passes the packet queue to the module.
- *  @param[in] phone The service module phone.
- *  @param[in] message The service specific message.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet_id The received packet or the received packet queue identifier.
- *  @param[in] target The target module service.
- *  @param[in] error The error module service.
- *  @returns EOK on success.
- */
-static inline int generic_received_msg(int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t target, services_t error){
-	if(error){
-		async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) target, (ipcarg_t) error);
-	}else{
-		async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) target);
-	}
+/** Pass the packet queue to the module.
+ *
+ * @param[in] phone     The service module phone.
+ * @param[in] message   The service specific message.
+ * @param[in] device_id The device identifier.
+ * @param[in] packet_id The received packet or the received packet queue
+ *                      identifier.
+ * @param[in] target    The target module service.
+ * @param[in] error     The error module service.
+ *
+ * @return EOK on success.
+ *
+ */
+static inline int generic_received_msg_remote(int phone, int message,
+    device_id_t device_id, packet_id_t packet_id, services_t target,
+    services_t error)
+{
+	if (error)
+		async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id,
+		    (ipcarg_t) packet_id, (ipcarg_t) target, (ipcarg_t) error);
+	else
+		async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id,
+		    (ipcarg_t) packet_id, (ipcarg_t) target);
+	
 	return EOK;
 }
 
-/** Sends the packet queue.
- *  @param[in] phone The service module phone.
- *  @param[in] message The service specific message.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet_id The packet or the packet queue identifier.
- *  @param[in] sender The sending module service.
- *  @param[in] error The error module service.
- *  @returns EOK on success.
- */
-static inline int generic_send_msg(int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t sender, services_t error){
-	if(error){
-		async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) sender, (ipcarg_t) error);
-	}else{
-		async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) sender);
-	}
+/** Send the packet queue.
+ *
+ * @param[in] phone     The service module phone.
+ * @param[in] message   The service specific message.
+ * @param[in] device_id The device identifier.
+ * @param[in] packet_id The packet or the packet queue identifier.
+ * @param[in] sender    The sending module service.
+ * @param[in] error     The error module service.
+ *
+ * @return EOK on success.
+ *
+ */
+static inline int generic_send_msg_remote(int phone, int message,
+    device_id_t device_id, packet_id_t packet_id, services_t sender,
+    services_t error)
+{
+	if (error)
+		async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id,
+		    (ipcarg_t) packet_id, (ipcarg_t) sender, (ipcarg_t) error);
+	else
+		async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id,
+		    (ipcarg_t) packet_id, (ipcarg_t) sender);
+	
 	return EOK;
 }
Index: uspace/lib/socket/include/net_modules.h
===================================================================
--- uspace/lib/socket/include/net_modules.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/socket/include/net_modules.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -72,27 +72,8 @@
 extern void answer_call(ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count);
 
-/** Creates 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.
- *  @returns The phone of the needed service.
- *  @returns Other error codes as defined for the ipc_connect_to_me() function.
- */
-extern int bind_service(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver);
-
-/** Creates 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).
- *  @returns The phone of the needed service.
- *  @returns ETIMEOUT if the connection timeouted.
- *  @returns Other error codes as defined for the ipc_connect_to_me() function.
- */
-extern 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);
+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.
Index: uspace/lib/socket/include/packet/packet_client.h
===================================================================
--- uspace/lib/socket/include/packet/packet_client.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/socket/include/packet/packet_client.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -45,5 +45,5 @@
 #define __NET_PACKET_CLIENT_H__
 
-#include "packet.h"
+#include <packet/packet.h>
 
 /** @name Packet client interface
@@ -172,5 +172,5 @@
  *  @returns Other error codes as defined for the packet_return() function.
  */
-extern int packet_translate(int phone, packet_ref packet, packet_id_t packet_id);
+extern int packet_translate_local(int phone, packet_ref packet, packet_id_t packet_id);
 
 /** Obtains the packet of the given dimensions.
@@ -184,5 +184,5 @@
  *  @returns NULL on error.
  */
-extern packet_t packet_get_4(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix);
+extern packet_t packet_get_4_local(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix);
 
 /** Obtains the packet of the given content size.
@@ -193,5 +193,5 @@
  *  @returns NULL on error.
  */
-extern packet_t packet_get_1(int phone, size_t content);
+extern packet_t packet_get_1_local(int phone, size_t content);
 
 /** Releases the packet queue.
@@ -202,5 +202,5 @@
  *  @param[in] packet_id The packet identifier.
  */
-extern void pq_release(int phone, packet_id_t packet_id);
+extern void pq_release_local(int phone, packet_id_t packet_id);
 
 /** Returns the packet copy.
Index: uspace/lib/socket/include/socket_parse.h
===================================================================
--- uspace/lib/socket/include/socket_parse.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/lib/socket/include/socket_parse.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,42 @@
+/*
+ * 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 socket
+ * @{
+ */
+
+/** @file
+ * Command-line argument parsing functions related to networking.
+ */
+
+extern int socket_parse_address_family(const char *, int *);
+extern int socket_parse_protocol_family(const char *, int *);
+extern int socket_parse_socket_type(const char *, int *);
+
+/** @}
+ */
Index: uspace/lib/socket/packet/packet_client.c
===================================================================
--- uspace/lib/socket/packet/packet_client.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/socket/packet/packet_client.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -164,5 +164,5 @@
 	}
 	// get a new packet
-	copy = packet_get_4(phone, PACKET_DATA_LENGTH(packet), PACKET_MAX_ADDRESS_LENGTH(packet), packet->max_prefix, PACKET_MIN_SUFFIX(packet));
+	copy = packet_get_4_local(phone, PACKET_DATA_LENGTH(packet), PACKET_MAX_ADDRESS_LENGTH(packet), packet->max_prefix, PACKET_MIN_SUFFIX(packet));
 	if(! copy){
 		return NULL;
@@ -178,5 +178,5 @@
 		return copy;
 	}else{
-		pq_release(phone, copy->packet_id);
+		pq_release_local(phone, copy->packet_id);
 		return NULL;
 	}
Index: uspace/lib/socket/packet/packet_server.c
===================================================================
--- uspace/lib/socket/packet/packet_server.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/lib/socket/packet/packet_server.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -97,8 +97,9 @@
 };
 
-int packet_translate(int phone, packet_ref packet, packet_id_t packet_id){
-	if(! packet){
+int packet_translate_local(int phone, packet_ref packet, packet_id_t packet_id)
+{
+	if (!packet)
 		return EINVAL;
-	}
+	
 	*packet = pm_find(packet_id);
 	return (*packet) ? EOK : ENOENT;
@@ -161,60 +162,79 @@
 }
 
-/** Returns the packet of dimensions at least as given.
- *  Tries to reuse free packets first.
- *  Creates a&nbsp;new packet aligned to the memory page size if none available.
- *  Locks the global data during its processing.
- *  @param[in] addr_len The source and destination addresses maximal length in bytes.
- *  @param[in] max_prefix The maximal prefix length in bytes.
- *  @param[in] max_content The maximal content length in bytes.
- *  @param[in] max_suffix The maximal suffix length in bytes.
- *  @returns The packet of dimensions at least as given.
- *  @returns NULL if there is not enough memory left.
- */
-static packet_t packet_get(size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix){
-	int index;
+/** Return the packet of dimensions at least as given.
+ *
+ * Try to reuse free packets first.
+ * Create a new packet aligned to the memory page size if none available.
+ * Lock the global data during its processing.
+ *
+ * @param[in] addr_len    The source and destination addresses
+ *                        maximal length in bytes.
+ * @param[in] max_prefix  The maximal prefix length in bytes.
+ * @param[in] max_content The maximal content length in bytes.
+ * @param[in] max_suffix  The maximal suffix length in bytes.
+ *
+ * @return The packet of dimensions at least as given.
+ * @return NULL if there is not enough memory left.
+ *
+ */
+static packet_t packet_get_local(size_t addr_len, size_t max_prefix,
+    size_t max_content, size_t max_suffix)
+{
+	size_t length = ALIGN_UP(sizeof(struct packet) + 2 * addr_len + max_prefix
+	    + max_content + max_suffix, PAGE_SIZE);
+	
+	fibril_mutex_lock(&ps_globals.lock);
+	
 	packet_t packet;
-	size_t length;
-
-	length = ALIGN_UP(sizeof(struct packet) + 2 * addr_len + max_prefix + max_content + max_suffix, PAGE_SIZE);
-	fibril_mutex_lock(&ps_globals.lock);
-	for(index = 0; index < FREE_QUEUES_COUNT - 1; ++ index){
-		if(length <= ps_globals.sizes[index]){
+	unsigned int index;
+	
+	for (index = 0; index < FREE_QUEUES_COUNT - 1; index++) {
+		if (length <= ps_globals.sizes[index]) {
 			packet = ps_globals.free[index];
-			while(packet_is_valid(packet) && (packet->length < length)){
+			
+			while (packet_is_valid(packet) && (packet->length < length))
 				packet = pm_find(packet->next);
-			}
-			if(packet_is_valid(packet)){
-				if(packet == ps_globals.free[index]){
+			
+			if (packet_is_valid(packet)) {
+				if (packet == ps_globals.free[index])
 					ps_globals.free[index] = pq_detach(packet);
-				}else{
+				else
 					pq_detach(packet);
-				}
-				packet_init(packet, addr_len, max_prefix, max_content, max_suffix);
+				
+				packet_init(packet, addr_len, max_prefix, max_content,
+				    max_suffix);
 				fibril_mutex_unlock(&ps_globals.lock);
-				// remove debug dump
-//				printf("packet %d got\n", packet->packet_id);
+				
 				return packet;
 			}
 		}
 	}
-	packet = packet_create(length, addr_len, max_prefix, max_content, max_suffix);
+	
+	packet = packet_create(length, addr_len, max_prefix, max_content,
+	    max_suffix);
+	
 	fibril_mutex_unlock(&ps_globals.lock);
-	// remove debug dump
-//	printf("packet %d created\n", packet->packet_id);
+	
 	return packet;
 }
 
-packet_t packet_get_4(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix){
-	return packet_get(addr_len, max_prefix, max_content, max_suffix);
-}
-
-packet_t packet_get_1(int phone, size_t content){
-	return packet_get(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, content, DEFAULT_SUFFIX);
-}
-
-/** Releases the packet and returns it to the appropriate free packet queue.
+packet_t packet_get_4_local(int phone, size_t max_content, size_t addr_len,
+    size_t max_prefix, size_t max_suffix)
+{
+	return packet_get_local(addr_len, max_prefix, max_content, max_suffix);
+}
+
+packet_t packet_get_1_local(int phone, size_t content)
+{
+	return packet_get_local(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, content,
+	    DEFAULT_SUFFIX);
+}
+
+/** Release the packet and returns it to the appropriate free packet queue.
+ *
  *  Should be used only when the global data are locked.
+ *
  *  @param[in] packet The packet to be released.
+ *
  */
 static void packet_release(packet_t packet){
@@ -247,5 +267,6 @@
 }
 
-void pq_release(int phone, packet_id_t packet_id){
+void pq_release_local(int phone, packet_id_t packet_id)
+{
 	(void) packet_release_wrapper(packet_id);
 }
@@ -281,5 +302,5 @@
 			return EOK;
 		case NET_PACKET_CREATE_1:
-			packet = packet_get(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, IPC_GET_CONTENT(call), DEFAULT_SUFFIX);
+			packet = packet_get_local(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, IPC_GET_CONTENT(call), DEFAULT_SUFFIX);
 			if(! packet){
 				return ENOMEM;
@@ -290,5 +311,5 @@
 			return EOK;
 		case NET_PACKET_CREATE_4:
-			packet = packet_get(((DEFAULT_ADDR_LEN < IPC_GET_ADDR_LEN(call)) ? IPC_GET_ADDR_LEN(call) : DEFAULT_ADDR_LEN), DEFAULT_PREFIX + IPC_GET_PREFIX(call), IPC_GET_CONTENT(call), DEFAULT_SUFFIX + IPC_GET_SUFFIX(call));
+			packet = packet_get_local(((DEFAULT_ADDR_LEN < IPC_GET_ADDR_LEN(call)) ? IPC_GET_ADDR_LEN(call) : DEFAULT_ADDR_LEN), DEFAULT_PREFIX + IPC_GET_PREFIX(call), IPC_GET_CONTENT(call), DEFAULT_SUFFIX + IPC_GET_SUFFIX(call));
 			if(! packet){
 				return ENOMEM;
Index: uspace/srv/hw/netif/dp8390/Makefile
===================================================================
--- uspace/srv/hw/netif/dp8390/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/hw/netif/dp8390/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -39,11 +39,9 @@
 -include $(CONFIG_MAKEFILE)
 
-ifeq ($(CONFIG_NETWORKING),modular)
-	BINARY = dp8390
+ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y)
+	LIBS += $(USPACE_PREFIX)/srv/net/nil/eth/libeth.a
 endif
 
-ifeq ($(CONFIG_NETWORKING),module)
-	LIBRARY = libdp8390
-endif
+BINARY = dp8390
 
 SOURCES = \
Index: uspace/srv/hw/netif/dp8390/dp8390.c
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/hw/netif/dp8390/dp8390.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -37,9 +37,7 @@
 
 #include <net_byteorder.h>
-
+#include <netif_local.h>
 #include <packet/packet.h>
 #include <packet/packet_client.h>
-
-#include <netif.h>
 
 #include "dp8390_drv.h"
Index: uspace/srv/hw/netif/dp8390/dp8390_module.c
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390_module.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/hw/netif/dp8390/dp8390_module.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -50,6 +50,6 @@
 #include <net_device.h>
 #include <nil_interface.h>
-#include <netif.h>
-#include <netif_module.h>
+#include <netif_interface.h>
+#include <netif_local.h>
 
 #include "dp8390.h"
@@ -59,5 +59,5 @@
 /** DP8390 module name.
  */
-#define NAME	"dp8390 network interface"
+#define NAME  "dp8390"
 
 /** Returns the device from the interrupt call.
@@ -95,8 +95,4 @@
 };
 
-/** Network interface module global data.
- */
-netif_globals_t netif_globals;
-
 /** Handles the interrupt messages.
  *  This is the interrupt handler callback function.
@@ -104,61 +100,7 @@
  *  @param[in] call The interrupt message.
  */
-void irq_handler(ipc_callid_t iid, ipc_call_t * call);
-
-/** Changes the network interface state.
- *  @param[in,out] device The network interface.
- *  @param[in] state The new state.
- *  @returns The new state.
- */
-int change_state(device_ref device, device_state_t state);
-
-int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	return ENOTSUP;
-}
-
-int netif_get_device_stats(device_id_t device_id, device_stats_ref stats){
-	ERROR_DECLARE;
-
-	device_ref device;
-	eth_stat_t * de_stat;
-
-	if(! stats){
-		return EBADMEM;
-	}
-	ERROR_PROPAGATE(find_device(device_id, &device));
-	de_stat = &((dpeth_t *) device->specific)->de_stat;
-	null_device_stats(stats);
-	stats->receive_errors = de_stat->ets_recvErr;
-	stats->send_errors = de_stat->ets_sendErr;
-	stats->receive_crc_errors = de_stat->ets_CRCerr;
-	stats->receive_frame_errors = de_stat->ets_frameAll;
-	stats->receive_missed_errors = de_stat->ets_missedP;
-	stats->receive_packets = de_stat->ets_packetR;
-	stats->send_packets = de_stat->ets_packetT;
-	stats->collisions = de_stat->ets_collision;
-	stats->send_aborted_errors = de_stat->ets_transAb;
-	stats->send_carrier_errors = de_stat->ets_carrSense;
-	stats->send_heartbeat_errors = de_stat->ets_CDheartbeat;
-	stats->send_window_errors = de_stat->ets_OWC;
-	return EOK;
-}
-
-int netif_get_addr_message(device_id_t device_id, measured_string_ref address){
-	ERROR_DECLARE;
-
-	device_ref device;
-
-	if(! address){
-		return EBADMEM;
-	}
-	ERROR_PROPAGATE(find_device(device_id, &device));
-	address->value = (char *) (&((dpeth_t *) device->specific)->de_address);
-	address->length = CONVERT_SIZE(ether_addr_t, char, 1);
-	return EOK;
-}
-
-void irq_handler(ipc_callid_t iid, ipc_call_t * call)
+static void irq_handler(ipc_callid_t iid, ipc_call_t * call)
 {
-	device_ref device;
+	netif_device_t * device;
 	dpeth_t * dep;
 	packet_t received;
@@ -203,11 +145,77 @@
 }
 
+/** Changes the network interface state.
+ *  @param[in,out] device The network interface.
+ *  @param[in] state The new state.
+ *  @returns The new state.
+ */
+static int change_state(netif_device_t * device, device_state_t state)
+{
+	if (device->state != state) {
+		device->state = state;
+		
+		printf("%s: State changed to %s\n", NAME,
+		    (state == NETIF_ACTIVE) ? "active" : "stopped");
+		
+		return state;
+	}
+	
+	return EOK;
+}
+
+int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return ENOTSUP;
+}
+
+int netif_get_device_stats(device_id_t device_id, device_stats_ref stats){
+	ERROR_DECLARE;
+
+	netif_device_t * device;
+	eth_stat_t * de_stat;
+
+	if(! stats){
+		return EBADMEM;
+	}
+	ERROR_PROPAGATE(find_device(device_id, &device));
+	de_stat = &((dpeth_t *) device->specific)->de_stat;
+	null_device_stats(stats);
+	stats->receive_errors = de_stat->ets_recvErr;
+	stats->send_errors = de_stat->ets_sendErr;
+	stats->receive_crc_errors = de_stat->ets_CRCerr;
+	stats->receive_frame_errors = de_stat->ets_frameAll;
+	stats->receive_missed_errors = de_stat->ets_missedP;
+	stats->receive_packets = de_stat->ets_packetR;
+	stats->send_packets = de_stat->ets_packetT;
+	stats->collisions = de_stat->ets_collision;
+	stats->send_aborted_errors = de_stat->ets_transAb;
+	stats->send_carrier_errors = de_stat->ets_carrSense;
+	stats->send_heartbeat_errors = de_stat->ets_CDheartbeat;
+	stats->send_window_errors = de_stat->ets_OWC;
+	return EOK;
+}
+
+int netif_get_addr_message(device_id_t device_id, measured_string_ref address){
+	ERROR_DECLARE;
+
+	netif_device_t * device;
+
+	if(! address){
+		return EBADMEM;
+	}
+	ERROR_PROPAGATE(find_device(device_id, &device));
+	address->value = (char *) (&((dpeth_t *) device->specific)->de_address);
+	address->length = CONVERT_SIZE(ether_addr_t, char, 1);
+	return EOK;
+}
+
+
+
 int netif_probe_message(device_id_t device_id, int irq, uintptr_t io){
 	ERROR_DECLARE;
 
-	device_ref device;
-	dpeth_t * dep;
-
-	device = (device_ref) malloc(sizeof(device_t));
+	netif_device_t * device;
+	dpeth_t * dep;
+
+	device = (netif_device_t *) malloc(sizeof(netif_device_t));
 	if(! device){
 		return ENOMEM;
@@ -218,5 +226,5 @@
 		return ENOMEM;
 	}
-	bzero(device, sizeof(device_t));
+	bzero(device, sizeof(netif_device_t));
 	bzero(dep, sizeof(dpeth_t));
 	device->device_id = device_id;
@@ -233,5 +241,5 @@
 		return ERROR_CODE;
 	}
-	if(ERROR_OCCURRED(device_map_add(&netif_globals.device_map, device->device_id, device))){
+	if(ERROR_OCCURRED(netif_device_map_add(&netif_globals.device_map, device->device_id, device))){
 		free(dep);
 		free(device);
@@ -244,5 +252,5 @@
 	ERROR_DECLARE;
 
-	device_ref device;
+	netif_device_t * device;
 	dpeth_t * dep;
 	packet_t next;
@@ -271,5 +279,5 @@
 }
 
-int netif_start_message(device_ref device){
+int netif_start_message(netif_device_t * device){
 	ERROR_DECLARE;
 
@@ -290,5 +298,5 @@
 }
 
-int netif_stop_message(device_ref device){
+int netif_stop_message(netif_device_t * device){
 	dpeth_t * dep;
 
@@ -302,10 +310,4 @@
 }
 
-int change_state(device_ref device, device_state_t state){
-	device->state = state;
-	printf("State changed to %s\n", (state == NETIF_ACTIVE) ? "ACTIVE" : "STOPPED");
-	return state;
-}
-
 int netif_initialize(void){
 	ipcarg_t phonehash;
@@ -315,8 +317,4 @@
 	return REGISTER_ME(SERVICE_DP8390, &phonehash);
 }
-
-#ifdef CONFIG_NETWORKING_modular
-
-#include <netif_standalone.h>
 
 /** Default thread for new connections.
@@ -346,5 +344,6 @@
 		
 		/* Process the message */
-		int res = netif_module_message(callid, &call, &answer, &answer_count);
+		int res = netif_module_message(NAME, callid, &call, &answer,
+		    &answer_count);
 		
 		/* End if said to either by the message or the processing result */
@@ -370,18 +369,10 @@
 	ERROR_DECLARE;
 	
-	/* Print the module label */
-	printf("Task %d - %s\n", task_get_id(), NAME);
+	/* Start the module */
+	if (ERROR_OCCURRED(netif_module_start(netif_client_connection)))
+		return ERROR_CODE;
 	
-	/* Start the module */
-	if (ERROR_OCCURRED(netif_module_start(netif_client_connection))) {
-		printf(" - ERROR %i\n", ERROR_CODE);
-		return ERROR_CODE;
-	}
-	
-	return EOK;
-}
-
-#endif /* CONFIG_NETWORKING_modular */
-
+	return EOK;
+}
 
 /** @}
Index: uspace/srv/net/cfg/Makefile
===================================================================
--- uspace/srv/net/cfg/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/srv/net/cfg/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,60 @@
+#
+# Copyright (c) 2010 Martin Decky
+# 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.
+#
+
+USPACE_PREFIX = ../../..
+ROOT_PATH = $(USPACE_PREFIX)/..
+
+COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
+CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
+
+-include $(COMMON_MAKEFILE)
+-include $(CONFIG_MAKEFILE)
+
+ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y)
+	LO_SOURCE = lo.netif_nil_bundle
+	NE2K_SOURCE = ne2k.netif_nil_bundle
+else
+	LO_SOURCE = lo.netif_standalone
+	NE2K_SOURCE = ne2k.netif_standalone
+endif
+
+LO_TARGET = lo
+NE2K_TARGET = ne2k
+
+.PHONY: all clean
+
+all: $(LO_TARGET) $(NE2K_TARGET)
+
+clean:
+	rm -f $(LO_TARGET) $(NE2K_TARGET)
+
+$(LO_TARGET): $(LO_SOURCE)
+	cp $< $@
+
+$(NE2K_TARGET): $(NE2K_SOURCE)
+	cp $< $@
Index: uspace/srv/net/cfg/general
===================================================================
--- uspace/srv/net/cfg/general	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/srv/net/cfg/general	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,12 @@
+# general configuration
+
+IPV=4
+IP_ROUTING=no
+
+MTU=1500
+
+ICMP_ERROR_REPORTING=yes
+ICMP_ECHO_REPLYING=yes
+
+UDP_CHECKSUM_COMPUTING=yes
+UDP_AUTOBINDING=yes
Index: uspace/srv/net/cfg/lo.netif_nil_bundle
===================================================================
--- uspace/srv/net/cfg/lo.netif_nil_bundle	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/srv/net/cfg/lo.netif_nil_bundle	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,13 @@
+# loopback configuration
+
+NAME=lo
+
+NETIF=lo
+NIL=lo
+IL=ip
+
+IP_CONFIG=static
+IP_ADDR=127.0.0.1
+IP_NETMASK=255.0.0.0
+
+MTU=15535
Index: uspace/srv/net/cfg/lo.netif_standalone
===================================================================
--- uspace/srv/net/cfg/lo.netif_standalone	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/srv/net/cfg/lo.netif_standalone	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,13 @@
+# loopback configuration
+
+NAME=lo
+
+NETIF=lo
+NIL=nildummy
+IL=ip
+
+IP_CONFIG=static
+IP_ADDR=127.0.0.1
+IP_NETMASK=255.0.0.0
+
+MTU=15535
Index: uspace/srv/net/cfg/modular/general
===================================================================
--- uspace/srv/net/cfg/modular/general	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,12 +1,0 @@
-# general configuration
-
-IPV=4
-IP_ROUTING=no
-
-MTU=1500
-
-ICMP_ERROR_REPORTING=yes
-ICMP_ECHO_REPLYING=yes
-
-UDP_CHECKSUM_COMPUTING=yes
-UDP_AUTOBINDING=yes
Index: uspace/srv/net/cfg/modular/lo
===================================================================
--- uspace/srv/net/cfg/modular/lo	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,13 +1,0 @@
-# loopback configuration
-
-NAME=lo
-
-NETIF=lo
-NIL=nildummy
-IL=ip
-
-IP_CONFIG=static
-IP_ADDR=127.0.0.1
-IP_NETMASK=255.0.0.0
-
-MTU=15535
Index: uspace/srv/net/cfg/modular/ne2k
===================================================================
--- uspace/srv/net/cfg/modular/ne2k	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# DP8390 (NE2k) configuration
-
-NAME=ne2k
-
-NETIF=dp8390
-NIL=ethernet
-IL=ip
-
-# sysinfo_value("netif.dp8390.inr")
-IRQ=9
-IO=300
-
-# 8023_2_LSAP, 8023_2_SNAP
-ETH_MODE=DIX
-ETH_DUMMY=no
-
-IP_CONFIG=static
-IP_ADDR=10.0.2.15
-IP_ROUTING=yes
-IP_NETMASK=255.255.255.240
-IP_BROADCAST=10.0.2.255
-IP_GATEWAY=10.0.2.2
-ARP=arp
-
-MTU=1492
Index: uspace/srv/net/cfg/module/general
===================================================================
--- uspace/srv/net/cfg/module/general	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,12 +1,0 @@
-# general configuration
-
-IPV=4
-IP_ROUTING=no
-
-MTU=1500
-
-ICMP_ERROR_REPORTING=yes
-ICMP_ECHO_REPLYING=yes
-
-UDP_CHECKSUM_COMPUTING=yes
-UDP_AUTOBINDING=yes
Index: uspace/srv/net/cfg/module/lo
===================================================================
--- uspace/srv/net/cfg/module/lo	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,13 +1,0 @@
-# loopback configuration
-
-NAME=lo
-
-NETIF=lo
-NIL=lo
-IL=ip
-
-IP_CONFIG=static
-IP_ADDR=127.0.0.1
-IP_NETMASK=255.0.0.0
-
-MTU=15535
Index: uspace/srv/net/cfg/module/ne2k
===================================================================
--- uspace/srv/net/cfg/module/ne2k	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# DP8390 (NE2k) configuration
-
-NAME=ne2k
-
-NETIF=dp8390
-NIL=dp8390
-IL=ip
-
-# sysinfo_value("netif.dp8390.inr")
-IRQ=9
-IO=300
-
-# 8023_2_LSAP, 8023_2_SNAP
-ETH_MODE=DIX
-ETH_DUMMY=no
-
-IP_CONFIG=static
-IP_ADDR=10.0.2.15
-IP_ROUTING=yes
-IP_NETMASK=255.255.255.240
-IP_BROADCAST=10.0.2.255
-IP_GATEWAY=10.0.2.2
-ARP=arp
-
-MTU=1492
Index: uspace/srv/net/cfg/ne2k.netif_nil_bundle
===================================================================
--- uspace/srv/net/cfg/ne2k.netif_nil_bundle	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/srv/net/cfg/ne2k.netif_nil_bundle	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,25 @@
+# DP8390 (NE2k) configuration
+
+NAME=ne2k
+
+NETIF=dp8390
+NIL=dp8390
+IL=ip
+
+# sysinfo_value("netif.dp8390.inr")
+IRQ=9
+IO=300
+
+# 8023_2_LSAP, 8023_2_SNAP
+ETH_MODE=DIX
+ETH_DUMMY=no
+
+IP_CONFIG=static
+IP_ADDR=10.0.2.15
+IP_ROUTING=yes
+IP_NETMASK=255.255.255.240
+IP_BROADCAST=10.0.2.255
+IP_GATEWAY=10.0.2.2
+ARP=arp
+
+MTU=1492
Index: uspace/srv/net/cfg/ne2k.netif_standalone
===================================================================
--- uspace/srv/net/cfg/ne2k.netif_standalone	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
+++ uspace/srv/net/cfg/ne2k.netif_standalone	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -0,0 +1,25 @@
+# DP8390 (NE2k) configuration
+
+NAME=ne2k
+
+NETIF=dp8390
+NIL=eth
+IL=ip
+
+# sysinfo_value("netif.dp8390.inr")
+IRQ=9
+IO=300
+
+# 8023_2_LSAP, 8023_2_SNAP
+ETH_MODE=DIX
+ETH_DUMMY=no
+
+IP_CONFIG=static
+IP_ADDR=10.0.2.15
+IP_ROUTING=yes
+IP_NETMASK=255.255.255.240
+IP_BROADCAST=10.0.2.255
+IP_GATEWAY=10.0.2.2
+ARP=arp
+
+MTU=1492
Index: uspace/srv/net/il/arp/arp.c
===================================================================
--- uspace/srv/net/il/arp/arp.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/il/arp/arp.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -57,5 +57,8 @@
 #include <packet/packet.h>
 #include <packet/packet_client.h>
+#include <packet_remote.h>
 #include <il_messages.h>
+#include <il_interface.h>
+#include <il_local.h>
 #include <arp_messages.h>
 
@@ -68,5 +71,5 @@
 /** ARP module name.
  */
-#define NAME	"ARP protocol"
+#define NAME  "arp"
 
 /** ARP global data.
@@ -338,5 +341,6 @@
 			return ERROR_CODE;
 		}
-		printf("New device registered:\n\tid\t= %d\n\ttype\t= 0x%x\n\tservice\t= %d\n\tproto\t= %d\n", device->device_id, device->hardware, device->service, protocol);
+		printf("%s: Device registered (id: %d, type: 0x%x, service: %d, proto: %d)\n",
+		    NAME, device->device_id, device->hardware, device->service, protocol);
 	}
 	fibril_rwlock_write_unlock(&arp_globals.lock);
@@ -369,7 +373,9 @@
 }
 
-int arp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+int arp_message_standalone(ipc_callid_t callid, ipc_call_t *call,
+    ipc_call_t *answer, int *answer_count)
+{
 	ERROR_DECLARE;
-
+	
 	measured_string_ref address;
 	measured_string_ref translation;
@@ -377,8 +383,7 @@
 	packet_t packet;
 	packet_t next;
-
-//	printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_ARP_FIRST);
+	
 	*answer_count = 0;
-	switch(IPC_GET_METHOD(*call)){
+	switch (IPC_GET_METHOD(*call)) {
 		case IPC_M_PHONE_HUNGUP:
 			return EOK;
@@ -417,5 +422,5 @@
 			return EOK;
 		case NET_IL_RECEIVED:
-			if(! ERROR_OCCURRED(packet_translate(arp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+			if(! ERROR_OCCURRED(packet_translate_remote(arp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
 				fibril_rwlock_read_lock(&arp_globals.lock);
 				do{
@@ -423,5 +428,5 @@
 					ERROR_CODE = arp_receive_message(IPC_GET_DEVICE(call), packet);
 					if(ERROR_CODE != 1){
-						pq_release(arp_globals.net_phone, packet_get_id(packet));
+						pq_release_remote(arp_globals.net_phone, packet_get_id(packet));
 					}
 					packet = next;
@@ -433,4 +438,5 @@
 			return arp_mtu_changed_message(IPC_GET_DEVICE(call), IPC_GET_MTU(call));
 	}
+	
 	return ENOTSUP;
 }
@@ -569,5 +575,5 @@
 		return NULL;
 	}
-	packet = packet_get_4(arp_globals.net_phone, device->packet_dimension.addr_len, device->packet_dimension.prefix, length, device->packet_dimension.suffix);
+	packet = packet_get_4_remote(arp_globals.net_phone, device->packet_dimension.addr_len, device->packet_dimension.prefix, length, device->packet_dimension.suffix);
 	if(! packet){
 		return NULL;
@@ -575,5 +581,5 @@
 	header = (arp_header_ref) packet_suffix(packet, length);
 	if(! header){
-		pq_release(arp_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(arp_globals.net_phone, packet_get_id(packet));
 		return NULL;
 	}
@@ -592,5 +598,5 @@
 	memcpy(((uint8_t *) header) + length, target->value, target->length);
 	if(packet_set_addr(packet, (uint8_t *) device->addr->value, (uint8_t *) device->broadcast_addr->value, CONVERT_SIZE(char, uint8_t, device->addr->length)) != EOK){
-		pq_release(arp_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(arp_globals.net_phone, packet_get_id(packet));
 		return NULL;
 	}
@@ -618,8 +624,4 @@
 	}
 }
-
-#ifdef CONFIG_NETWORKING_modular
-
-#include <il_standalone.h>
 
 /** Default thread for new connections.
@@ -649,5 +651,6 @@
 		
 		/* Process the message */
-		int res = il_module_message(callid, &call, &answer, &answer_count);
+		int res = il_module_message_standalone(callid, &call, &answer,
+		    &answer_count);
 		
 		/* End if said to either by the message or the processing result */
@@ -673,17 +676,10 @@
 	ERROR_DECLARE;
 	
-	/* Print the module label */
-	printf("Task %d - %s\n", task_get_id(), NAME);
+	/* Start the module */
+	if (ERROR_OCCURRED(il_module_start_standalone(il_client_connection)))
+		return ERROR_CODE;
 	
-	/* Start the module */
-	if (ERROR_OCCURRED(il_module_start(il_client_connection))) {
-		printf(" - ERROR %i\n", ERROR_CODE);
-		return ERROR_CODE;
-	}
-	
-	return EOK;
-}
-
-#endif /* CONFIG_NETWORKING_modular */
+	return EOK;
+}
 
 /** @}
Index: uspace/srv/net/il/arp/arp_module.c
===================================================================
--- uspace/srv/net/il/arp/arp_module.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/il/arp/arp_module.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -48,5 +48,5 @@
 #include <net_interface.h>
 #include <packet/packet.h>
-#include <il_standalone.h>
+#include <il_local.h>
 
 #include "arp.h"
@@ -65,6 +65,6 @@
  *  @returns Other error codes as defined for the arp_message() function.
  */
-int il_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	return arp_message(callid, call, answer, answer_count);
+int il_module_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return arp_message_standalone(callid, call, answer, answer_count);
 }
 
@@ -76,20 +76,20 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int il_module_start(async_client_conn_t client_connection){
+int il_module_start_standalone(async_client_conn_t client_connection){
 	ERROR_DECLARE;
-
-	ipcarg_t phonehash;
-
+	
 	async_set_client_connection(client_connection);
 	arp_globals.net_phone = net_connect_module(SERVICE_NETWORKING);
 	ERROR_PROPAGATE(pm_init());
-	if(ERROR_OCCURRED(arp_initialize(client_connection))
-		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_ARP, &phonehash))){
+	
+	ipcarg_t phonehash;
+	if (ERROR_OCCURRED(arp_initialize(client_connection))
+	    || ERROR_OCCURRED(REGISTER_ME(SERVICE_ARP, &phonehash))) {
 		pm_destroy();
 		return ERROR_CODE;
 	}
-
+	
 	async_manager();
-
+	
 	pm_destroy();
 	return EOK;
Index: uspace/srv/net/il/arp/arp_module.h
===================================================================
--- uspace/srv/net/il/arp/arp_module.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/il/arp/arp_module.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -58,5 +58,5 @@
  *  @see IS_NET_ARP_MESSAGE()
  */
-int arp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
+int arp_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 #endif
Index: uspace/srv/net/il/ip/ip.c
===================================================================
--- uspace/srv/net/il/ip/ip.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/il/ip/ip.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -69,6 +69,9 @@
 #include <adt/module_map.h>
 #include <packet/packet_client.h>
+#include <packet_remote.h>
 #include <nil_messages.h>
 #include <il_messages.h>
+#include <il_local.h>
+#include <ip_local.h>
 
 #include "ip.h"
@@ -79,5 +82,5 @@
 /** IP module name.
  */
-#define NAME	"IP protocol"
+#define NAME  "ip"
 
 /** IP version 4.
@@ -424,5 +427,5 @@
 }
 
-int ip_device_req(int il_phone, device_id_t device_id, services_t netif){
+int ip_device_req_local(int il_phone, device_id_t device_id, services_t netif){
 	ERROR_DECLARE;
 
@@ -430,5 +433,4 @@
 	ip_route_ref route;
 	int index;
-	char * data;
 
 	ip_netif = (ip_netif_ref) malloc(sizeof(ip_netif_t));
@@ -454,25 +456,28 @@
 	}
 	// print the settings
-	printf("New device registered:\n\tid\t= %d\n\tphone\t= %d\n\tIPV\t= %d\n", ip_netif->device_id, ip_netif->phone, ip_netif->ipv);
-	printf("\tconfiguration\t= %s\n", ip_netif->dhcp ? "dhcp" : "static");
+	printf("%s: Device registered (id: %d, phone: %d, ipv: %d, conf: %s)\n",
+	    NAME, ip_netif->device_id, ip_netif->phone, ip_netif->ipv,
+	    ip_netif->dhcp ? "dhcp" : "static");
+	
 	// TODO ipv6 addresses
-	data = (char *) malloc(INET_ADDRSTRLEN);
-	if(data){
-		for(index = 0; index < ip_routes_count(&ip_netif->routes); ++ index){
-			route = ip_routes_get_index(&ip_netif->routes, index);
-			if(route){
-				printf("\tRouting %d:\n", index);
-				inet_ntop(AF_INET, (uint8_t *) &route->address.s_addr, data, INET_ADDRSTRLEN);
-				printf("\t\taddress\t= %s\n", data);
-				inet_ntop(AF_INET, (uint8_t *) &route->netmask.s_addr, data, INET_ADDRSTRLEN);
-				printf("\t\tnetmask\t= %s\n", data);
-				inet_ntop(AF_INET, (uint8_t *) &route->gateway.s_addr, data, INET_ADDRSTRLEN);
-				printf("\t\tgateway\t= %s\n", data);
-			}
-		}
-		inet_ntop(AF_INET, (uint8_t *) &ip_netif->broadcast.s_addr, data, INET_ADDRSTRLEN);
-		printf("\t\tbroadcast\t= %s\n", data);
-		free(data);
-	}
+	
+	char address[INET_ADDRSTRLEN];
+	char netmask[INET_ADDRSTRLEN];
+	char gateway[INET_ADDRSTRLEN];
+	
+	for (index = 0; index < ip_routes_count(&ip_netif->routes); ++ index){
+		route = ip_routes_get_index(&ip_netif->routes, index);
+		if (route) {
+			inet_ntop(AF_INET, (uint8_t *) &route->address.s_addr, address, INET_ADDRSTRLEN);
+			inet_ntop(AF_INET, (uint8_t *) &route->netmask.s_addr, netmask, INET_ADDRSTRLEN);
+			inet_ntop(AF_INET, (uint8_t *) &route->gateway.s_addr, gateway, INET_ADDRSTRLEN);
+			printf("%s: Route %d (address: %s, netmask: %s, gateway: %s)\n",
+			    NAME, index, address, netmask, gateway);
+		}
+	}
+	
+	inet_ntop(AF_INET, (uint8_t *) &ip_netif->broadcast.s_addr, address, INET_ADDRSTRLEN);
+	printf("%s: Broadcast (%s)\n", NAME, address);
+	
 	fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 	return EOK;
@@ -595,5 +600,5 @@
 	}
 	netif->packet_dimension.content = mtu;
-	printf("ip - device %d changed mtu to %d\n\n", device_id, mtu);
+	printf("%s: Device %d changed MTU to %d\n", NAME, device_id, mtu);
 	fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 	return EOK;
@@ -611,5 +616,5 @@
 	}
 	netif->state = state;
-	printf("ip - device %d changed state to %d\n\n", device_id, state);
+	printf("%s: Device %d changed state to %d\n", NAME, device_id, state);
 	fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
 	return EOK;
@@ -646,10 +651,13 @@
 		return index;
 	}
-	printf("New protocol registered:\n\tprotocol\t= %d\n\tphone\t= %d\n", proto->protocol, proto->phone);
+	
+	printf("%s: Protocol registered (protocol: %d, phone: %d)\n",
+	    NAME, proto->protocol, proto->phone);
+	
 	fibril_rwlock_write_unlock(&ip_globals.protos_lock);
 	return EOK;
 }
 
-int ip_send_msg(int il_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error){
+int ip_send_msg_local(int il_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error){
 	ERROR_DECLARE;
 
@@ -777,5 +785,5 @@
 //			sleep(1);
 //			ERROR_PROPAGATE(arp_translate_req(netif->arp->phone, netif->device_id, SERVICE_IP, &destination, &translation, &data));
-			pq_release(ip_globals.net_phone, packet_get_id(packet));
+			pq_release_remote(ip_globals.net_phone, packet_get_id(packet));
 			return ERROR_CODE;
 		}
@@ -794,5 +802,5 @@
 	}else translation = NULL;
 	if(ERROR_OCCURRED(ip_prepare_packet(src, dest, packet, translation))){
-		pq_release(ip_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(ip_globals.net_phone, packet_get_id(packet));
 	}else{
 		packet = ip_split_packet(packet, netif->packet_dimension.prefix, netif->packet_dimension.content, netif->packet_dimension.suffix, netif->packet_dimension.addr_len, error);
@@ -886,54 +894,69 @@
 }
 
-int ip_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+int ip_message_standalone(ipc_callid_t callid, ipc_call_t *call,
+    ipc_call_t *answer, int * answer_count)
+{
 	ERROR_DECLARE;
-
+	
 	packet_t packet;
-	struct sockaddr * addr;
+	struct sockaddr *addr;
 	size_t addrlen;
 	size_t prefix;
 	size_t suffix;
 	size_t content;
-	ip_pseudo_header_ref header;
+	void *header;
 	size_t headerlen;
 	device_id_t device_id;
-
+	
 	*answer_count = 0;
-	switch(IPC_GET_METHOD(*call)){
+	switch (IPC_GET_METHOD(*call)) {
 		case IPC_M_PHONE_HUNGUP:
 			return EOK;
 		case NET_IL_DEVICE:
-			return ip_device_req(0, IPC_GET_DEVICE(call), IPC_GET_SERVICE(call));
+			return ip_device_req_local(0, IPC_GET_DEVICE(call),
+			    IPC_GET_SERVICE(call));
 		case IPC_M_CONNECT_TO_ME:
-			return ip_register(IL_GET_PROTO(call), IL_GET_SERVICE(call), IPC_GET_PHONE(call), NULL);
+			return ip_register(IL_GET_PROTO(call), IL_GET_SERVICE(call),
+			    IPC_GET_PHONE(call), NULL);
 		case NET_IL_SEND:
-			ERROR_PROPAGATE(packet_translate(ip_globals.net_phone, &packet, IPC_GET_PACKET(call)));
-			return ip_send_msg(0, IPC_GET_DEVICE(call), packet, 0, IPC_GET_ERROR(call));
+			ERROR_PROPAGATE(packet_translate_remote(ip_globals.net_phone, &packet,
+			    IPC_GET_PACKET(call)));
+			return ip_send_msg_local(0, IPC_GET_DEVICE(call), packet, 0,
+			    IPC_GET_ERROR(call));
 		case NET_IL_DEVICE_STATE:
-			return ip_device_state_message(IPC_GET_DEVICE(call), IPC_GET_STATE(call));
+			return ip_device_state_message(IPC_GET_DEVICE(call),
+			    IPC_GET_STATE(call));
 		case NET_IL_RECEIVED:
-			ERROR_PROPAGATE(packet_translate(ip_globals.net_phone, &packet, IPC_GET_PACKET(call)));
+			ERROR_PROPAGATE(packet_translate_remote(ip_globals.net_phone, &packet,
+			    IPC_GET_PACKET(call)));
 			return ip_receive_message(IPC_GET_DEVICE(call), packet);
 		case NET_IP_RECEIVED_ERROR:
-			ERROR_PROPAGATE(packet_translate(ip_globals.net_phone, &packet, IPC_GET_PACKET(call)));
-			return ip_received_error_msg(0, IPC_GET_DEVICE(call), packet, IPC_GET_TARGET(call), IPC_GET_ERROR(call));
+			ERROR_PROPAGATE(packet_translate_remote(ip_globals.net_phone, &packet,
+			    IPC_GET_PACKET(call)));
+			return ip_received_error_msg_local(0, IPC_GET_DEVICE(call), packet,
+			    IPC_GET_TARGET(call), IPC_GET_ERROR(call));
 		case NET_IP_ADD_ROUTE:
-			return ip_add_route_req(0, IPC_GET_DEVICE(call), IP_GET_ADDRESS(call), IP_GET_NETMASK(call), IP_GET_GATEWAY(call));
+			return ip_add_route_req_local(0, IPC_GET_DEVICE(call),
+			    IP_GET_ADDRESS(call), IP_GET_NETMASK(call), IP_GET_GATEWAY(call));
 		case NET_IP_SET_GATEWAY:
-			return ip_set_gateway_req(0, IPC_GET_DEVICE(call), IP_GET_GATEWAY(call));
+			return ip_set_gateway_req_local(0, IPC_GET_DEVICE(call),
+			    IP_GET_GATEWAY(call));
 		case NET_IP_GET_ROUTE:
 			ERROR_PROPAGATE(data_receive((void **) &addr, &addrlen));
-			ERROR_PROPAGATE(ip_get_route_req(0, IP_GET_PROTOCOL(call), addr, (socklen_t) addrlen,
-			    &device_id, &header, &headerlen));
+			ERROR_PROPAGATE(ip_get_route_req_local(0, IP_GET_PROTOCOL(call),
+			    addr, (socklen_t) addrlen, &device_id, &header, &headerlen));
 			IPC_SET_DEVICE(answer, device_id);
 			IP_SET_HEADERLEN(answer, headerlen);
+			
 			*answer_count = 2;
-			if(! ERROR_OCCURRED(data_reply(&headerlen, sizeof(headerlen)))){
+			
+			if (!ERROR_OCCURRED(data_reply(&headerlen, sizeof(headerlen))))
 				ERROR_CODE = data_reply(header, headerlen);
-			}
+			
 			free(header);
 			return ERROR_CODE;
 		case NET_IL_PACKET_SPACE:
-			ERROR_PROPAGATE(ip_packet_size_message(IPC_GET_DEVICE(call), &addrlen, &prefix, &content, &suffix));
+			ERROR_PROPAGATE(ip_packet_size_message(IPC_GET_DEVICE(call),
+			    &addrlen, &prefix, &content, &suffix));
 			IPC_SET_ADDR(answer, addrlen);
 			IPC_SET_PREFIX(answer, prefix);
@@ -943,14 +966,20 @@
 			return EOK;
 		case NET_IL_MTU_CHANGED:
-			return ip_mtu_changed_message(IPC_GET_DEVICE(call), IPC_GET_MTU(call));
-	}
+			return ip_mtu_changed_message(IPC_GET_DEVICE(call),
+			    IPC_GET_MTU(call));
+	}
+	
 	return ENOTSUP;
 }
 
-int ip_packet_size_req(int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension){
-	if(! packet_dimension){
+int ip_packet_size_req_local(int ip_phone, device_id_t device_id,
+    packet_dimension_ref packet_dimension)
+{
+	if (!packet_dimension)
 		return EBADMEM;
-	}
-	return ip_packet_size_message(device_id, &packet_dimension->addr_len, &packet_dimension->prefix, &packet_dimension->content, &packet_dimension->suffix);
+	
+	return ip_packet_size_message(device_id, &packet_dimension->addr_len,
+	    &packet_dimension->prefix, &packet_dimension->content,
+	    &packet_dimension->suffix);
 }
 
@@ -998,5 +1027,5 @@
 }
 
-int ip_add_route_req(int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway){
+int ip_add_route_req_local(int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway){
 	ip_route_ref route;
 	ip_netif_ref netif;
@@ -1062,5 +1091,6 @@
 }
 
-int ip_set_gateway_req(int ip_phone, device_id_t device_id, in_addr_t gateway){
+int ip_set_gateway_req_local(int ip_phone, device_id_t device_id, in_addr_t gateway)
+{
 	ip_netif_ref netif;
 
@@ -1107,5 +1137,5 @@
 					}
 				}else{
-					pq_release(ip_globals.net_phone, packet_get_id(next));
+					pq_release_remote(ip_globals.net_phone, packet_get_id(next));
 				}
 				next = new_packet;
@@ -1148,5 +1178,5 @@
 	}
 	// create the last fragment
-	new_packet = packet_get_4(ip_globals.net_phone, prefix, length, suffix, ((addrlen > addr_len) ? addrlen : addr_len));
+	new_packet = packet_get_4_remote(ip_globals.net_phone, prefix, length, suffix, ((addrlen > addr_len) ? addrlen : addr_len));
 	if(! new_packet){
 		return ENOMEM;
@@ -1172,5 +1202,5 @@
 	// create middle framgents
 	while(IP_TOTAL_LENGTH(header) > length){
-		new_packet = packet_get_4(ip_globals.net_phone, prefix, length, suffix, ((addrlen >= addr_len) ? addrlen : addr_len));
+		new_packet = packet_get_4_remote(ip_globals.net_phone, prefix, length, suffix, ((addrlen >= addr_len) ? addrlen : addr_len));
 		if(! new_packet){
 			return ENOMEM;
@@ -1352,5 +1382,18 @@
 }
 
-int ip_received_error_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error){
+/** Notify the IP module about the received error notification packet.
+ *
+ * @param[in] ip_phone  The IP module phone used for (semi)remote calls.
+ * @param[in] device_id The device identifier.
+ * @param[in] packet    The received packet or the received packet queue.
+ * @param[in] target    The target internetwork module service to be
+ *                      delivered to.
+ * @param[in] error     The packet error reporting service. Prefixes the
+ *                      received packet.
+ *
+ * @return EOK on success.
+ *
+ */
+int ip_received_error_msg_local(int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error){
 	uint8_t * data;
 	int offset;
@@ -1487,5 +1530,5 @@
 	next = pq_detach(packet);
 	if(next){
-		pq_release(ip_globals.net_phone, packet_get_id(next));
+		pq_release_remote(ip_globals.net_phone, packet_get_id(next));
 	}
 	if(! header){
@@ -1551,9 +1594,9 @@
 
 int ip_release_and_return(packet_t packet, int result){
-	pq_release(ip_globals.net_phone, packet_get_id(packet));
+	pq_release_remote(ip_globals.net_phone, packet_get_id(packet));
 	return result;
 }
 
-int ip_get_route_req(int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, ip_pseudo_header_ref * header, size_t * headerlen){
+int ip_get_route_req_local(int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, void **header, size_t * headerlen){
 	struct sockaddr_in * address_in;
 //	struct sockaddr_in6 *	address_in6;
@@ -1619,11 +1662,7 @@
 	header_in->protocol = protocol;
 	header_in->data_length = 0;
-	*header = (ip_pseudo_header_ref) header_in;
+	*header = header_in;
 	return EOK;
 }
-
-#ifdef CONFIG_NETWORKING_modular
-
-#include <il_standalone.h>
 
 /** Default thread for new connections.
@@ -1653,5 +1692,6 @@
 		
 		/* Process the message */
-		int res = il_module_message(callid, &call, &answer, &answer_count);
+		int res = il_module_message_standalone(callid, &call, &answer,
+		    &answer_count);
 		
 		/* End if said to either by the message or the processing result */
@@ -1677,18 +1717,11 @@
 	ERROR_DECLARE;
 	
-	/* Print the module label */
-	printf("Task %d - %s\n", task_get_id(), NAME);
-	
 	/* Start the module */
-	if (ERROR_OCCURRED(il_module_start(il_client_connection))) {
-		printf(" - ERROR %i\n", ERROR_CODE);
+	if (ERROR_OCCURRED(il_module_start_standalone(il_client_connection)))
 		return ERROR_CODE;
-	}
 	
 	return EOK;
 }
 
-#endif /* CONFIG_NETWORKING_modular */
-
 /** @}
  */
Index: uspace/srv/net/il/ip/ip_module.c
===================================================================
--- uspace/srv/net/il/ip/ip_module.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/il/ip/ip_module.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -47,5 +47,5 @@
 #include <net_interface.h>
 #include <packet/packet.h>
-#include <il_standalone.h>
+#include <il_local.h>
 
 #include "ip.h"
@@ -54,5 +54,5 @@
 /** IP module global data.
  */
-extern ip_globals_t	ip_globals;
+extern ip_globals_t ip_globals;
 
 /** Processes the IP message.
@@ -64,6 +64,6 @@
  *  @returns Other error codes as defined for the ip_message() function.
  */
-int il_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	return ip_message(callid, call, answer, answer_count);
+int il_module_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return ip_message_standalone(callid, call, answer, answer_count);
 }
 
@@ -75,20 +75,20 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int il_module_start(async_client_conn_t client_connection){
+int il_module_start_standalone(async_client_conn_t client_connection){
 	ERROR_DECLARE;
-
-	ipcarg_t phonehash;
-
+	
 	async_set_client_connection(client_connection);
 	ip_globals.net_phone = net_connect_module(SERVICE_NETWORKING);
 	ERROR_PROPAGATE(pm_init());
-	if(ERROR_OCCURRED(ip_initialize(client_connection))
-		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_IP, &phonehash))){
+	
+	ipcarg_t phonehash;
+	if (ERROR_OCCURRED(ip_initialize(client_connection))
+	    || ERROR_OCCURRED(REGISTER_ME(SERVICE_IP, &phonehash))) {
 		pm_destroy();
 		return ERROR_CODE;
 	}
-
+	
 	async_manager();
-
+	
 	pm_destroy();
 	return EOK;
Index: uspace/srv/net/il/ip/ip_module.h
===================================================================
--- uspace/srv/net/il/ip/ip_module.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/il/ip/ip_module.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -59,5 +59,5 @@
  *  @see IS_NET_IP_MESSAGE()
  */
-int ip_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
+int ip_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 #endif
Index: uspace/srv/net/net/Makefile
===================================================================
--- uspace/srv/net/net/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/net/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -30,6 +30,6 @@
 USPACE_PREFIX = ../../..
 ROOT_PATH = $(USPACE_PREFIX)/..
-LIBS = $(LIBNETIF_PREFIX)/libnetif.a $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
-EXTRA_CFLAGS = -I$(LIBNETIF_PREFIX)/include -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
+LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
+EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
 
 COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
Index: uspace/srv/net/net/net.c
===================================================================
--- uspace/srv/net/net/net.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/net/net.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -28,9 +28,10 @@
 
 /** @addtogroup net
- *  @{
+ * @{
  */
 
 /** @file
- *  Networking subsystem central module implementation.
+ * Networking subsystem central module implementation.
+ *
  */
 
@@ -55,6 +56,6 @@
 #include <packet/packet.h>
 #include <il_messages.h>
+#include <netif_remote.h>
 #include <net_device.h>
-#include <netif_interface.h>
 #include <nil_interface.h>
 #include <net_interface.h>
@@ -64,232 +65,564 @@
 #include "net.h"
 
+/** Networking module name.
+ *
+ */
+#define NAME  "net"
+
 /** File read buffer size.
- */
-#define BUFFER_SIZE	256
-
-/** Networking module name.
- */
-#define NAME	"Networking"
+ *
+ */
+#define BUFFER_SIZE  256
 
 /** Networking module global data.
- */
-net_globals_t	net_globals;
-
-/** Generates new system-unique device identifier.
- *  @returns The system-unique devic identifier.
- */
-device_id_t generate_new_device_id(void);
-
-/** Returns the configured values.
- *  The network interface configuration is searched first.
- *  @param[in] netif_conf The network interface configuration setting.
- *  @param[out] configuration The found configured values.
- *  @param[in] count The desired settings count.
- *  @param[out] data The found configuration settings data.
- *  @returns EOK.
- */
-int net_get_conf(measured_strings_ref netif_conf, measured_string_ref configuration, size_t count, char ** data);
-
-/** Initializes the networking module.
- *  @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
- *  @returns EOK on success.
- *  @returns ENOMEM if there is not enough memory left.
- */
-int net_initialize(async_client_conn_t client_connection);
-
-/** \todo
- */
-int parse_line(measured_strings_ref configuration, char * line);
-
-/** Reads the networking subsystem global configuration.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the add_configuration() function.
- */
-int read_configuration(void);
-
-/** \todo
- */
-int read_configuration_file(const char * directory, const char * filename, measured_strings_ref configuration);
-
-/** Reads the network interface specific configuration.
- *  @param[in] name The network interface name.
- *  @param[in,out] netif The network interface structure.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the add_configuration() function.
- */
-int read_netif_configuration(const char * name, netif_ref netif);
-
-/** Starts the network interface according to its configuration.
- *  Registers the network interface with the subsystem modules.
- *  Starts the needed subsystem modules.
- *  @param[in] netif The network interface specific data.
- *  @returns EOK on success.
- *  @returns EINVAL if there are some settings missing.
- *  @returns ENOENT if the internet protocol module is not known.
- *  @returns Other error codes as defined for the netif_probe_req() function.
- *  @returns Other error codes as defined for the nil_device_req() function.
- *  @returns Other error codes as defined for the needed internet layer registering function.
- */
-int start_device(netif_ref netif);
-
-/** Reads the configuration and starts all network interfaces.
- *  @returns EOK on success.
- *  @returns EXDEV if there is no available system-unique device identifier.
- *  @returns EINVAL if any of the network interface names are not configured.
- *  @returns ENOMEM if there is not enough memory left.
- *  @returns Other error codes as defined for the read_configuration() function.
- *  @returns Other error codes as defined for the read_netif_configuration() function.
- *  @returns Other error codes as defined for the start_device() function.
- */
-int startup(void);
-
-GENERIC_CHAR_MAP_IMPLEMENT(measured_strings, measured_string_t)
-
-DEVICE_MAP_IMPLEMENT(netifs, netif_t)
-
-int add_configuration(measured_strings_ref configuration, const char * name, const char * value){
-	ERROR_DECLARE;
-
-	measured_string_ref setting;
-
-	setting = measured_string_create_bulk(value, 0);
-	if(! setting){
+ *
+ */
+net_globals_t net_globals;
+
+GENERIC_CHAR_MAP_IMPLEMENT(measured_strings, measured_string_t);
+DEVICE_MAP_IMPLEMENT(netifs, netif_t);
+
+/** Add the configured setting to the configuration map.
+ *
+ * @param[in] configuration The configuration map.
+ * @param[in] name          The setting name.
+ * @param[in] value         The setting value.
+ *
+ * @returns EOK on success.
+ * @returns ENOMEM if there is not enough memory left.
+ *
+ */
+int add_configuration(measured_strings_ref configuration, const char *name,
+    const char *value)
+{
+	ERROR_DECLARE;
+	
+	measured_string_ref setting =
+	    measured_string_create_bulk(value, 0);
+	
+	if (!setting)
 		return ENOMEM;
-	}
-	// add the configuration setting
-	if(ERROR_OCCURRED(measured_strings_add(configuration, name, 0, setting))){
+	
+	/* Add the configuration setting */
+	if (ERROR_OCCURRED(measured_strings_add(configuration, name, 0, setting))) {
 		free(setting);
 		return ERROR_CODE;
 	}
-	return EOK;
-}
-
-device_id_t generate_new_device_id(void){
+	
+	return EOK;
+}
+
+/** Generate new system-unique device identifier.
+ *
+ * @returns The system-unique devic identifier.
+ *
+ */
+static device_id_t generate_new_device_id(void)
+{
 	return device_assign_devno();
 }
 
-/** Starts the networking module.
- *  Initializes the client connection serving function, initializes the module, registers the module service and starts 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.
- *  @returns EOK on successful module termination.
- *  @returns Other error codes as defined for the net_initialize() function.
- *  @returns Other error codes as defined for the REGISTER_ME() macro function.
- */
-static int net_module_start(async_client_conn_t client_connection){
-	ERROR_DECLARE;
-
-	ipcarg_t phonehash;
-
-	async_set_client_connection(client_connection);
-	ERROR_PROPAGATE(pm_init());
-	if(ERROR_OCCURRED(net_initialize(client_connection))
-		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_NETWORKING, &phonehash))){
-		pm_destroy();
+static int parse_line(measured_strings_ref configuration, char *line)
+{
+	ERROR_DECLARE;
+	
+	/* From the beginning */
+	char *name = line;
+	
+	/* Skip comments and blank lines */
+	if ((*name == '#') || (*name == '\0'))
+		return EOK;
+	
+	/* Skip spaces */
+	while (isspace(*name))
+		name++;
+	
+	/* Remember the name start */
+	char *value = name;
+	
+	/* Skip the name */
+	while (isalnum(*value) || (*value == '_'))
+		value++;
+	
+	if (*value == '=') {
+		/* Terminate the name */
+		*value = '\0';
+	} else {
+		/* Terminate the name */
+		*value = '\0';
+		
+		/* Skip until '=' */
+		value++;
+		while ((*value) && (*value != '='))
+			value++;
+		
+		/* Not found? */
+		if (*value != '=')
+			return EINVAL;
+	}
+	
+	value++;
+	
+	/* Skip spaces */
+	while (isspace(*value))
+		value++;
+	
+	/* Create a bulk measured string till the end */
+	measured_string_ref setting =
+	    measured_string_create_bulk(value, 0);
+	if (!setting)
+		return ENOMEM;
+	
+	/* Add the configuration setting */
+	if (ERROR_OCCURRED(measured_strings_add(configuration, name, 0, setting))) {
+		free(setting);
 		return ERROR_CODE;
 	}
-
-	async_manager();
-
-	pm_destroy();
-	return EOK;
-}
-
-int net_connect_module(services_t service){
-	return EOK;
-}
-
-void net_free_settings(measured_string_ref settings, char * data){
-}
-
-int net_get_conf(measured_strings_ref netif_conf, measured_string_ref configuration, size_t count, char ** data){
-	measured_string_ref setting;
-	size_t index;
-
-	if(data){
-		*data = NULL;
-	}
-
-	for(index = 0; index < count; ++ index){
-		setting = measured_strings_find(netif_conf, configuration[index].value, 0);
-		if(! setting){
-			setting = measured_strings_find(&net_globals.configuration, configuration[index].value, 0);
+	
+	return EOK;
+}
+
+static int read_configuration_file(const char *directory, const char *filename,
+    measured_strings_ref configuration)
+{
+	ERROR_DECLARE;
+	
+	printf("%s: Reading configuration file %s/%s\n", NAME, directory, filename);
+	
+	/* Construct the full filename */
+	char line[BUFFER_SIZE];
+	if (snprintf(line, BUFFER_SIZE, "%s/%s", directory, filename) > BUFFER_SIZE)
+		return EOVERFLOW;
+	
+	/* Open the file */
+	FILE *cfg = fopen(line, "r");
+	if (!cfg)
+		return ENOENT;
+	
+	/*
+	 * Read the configuration line by line
+	 * until an error or the end of file
+	 */
+	unsigned int line_number = 0;
+	size_t index = 0;
+	while ((!ferror(cfg)) && (!feof(cfg))) {
+		int read = fgetc(cfg);
+		if ((read > 0) && (read != '\n') && (read != '\r')) {
+			if (index >= BUFFER_SIZE) {
+				line[BUFFER_SIZE - 1] = '\0';
+				fprintf(stderr, "%s: Configuration line %u too long: %s\n",
+				    NAME, line_number, line);
+				
+				/* No space left in the line buffer */
+				return EOVERFLOW;
+			} else {
+				/* Append the character */
+				line[index] = (char) read;
+				index++;
+			}
+		} else {
+			/* On error or new line */
+			line[index] = '\0';
+			line_number++;
+			if (ERROR_OCCURRED(parse_line(configuration, line)))
+				fprintf(stderr, "%s: Configuration error on line %u: %s\n",
+				    NAME, line_number, line);
+			
+			index = 0;
 		}
-		if(setting){
-			configuration[index].length = setting->length;
-			configuration[index].value = setting->value;
-		}else{
-			configuration[index].length = 0;
-			configuration[index].value = NULL;
-		}
-	}
-	return EOK;
-}
-
-int net_get_conf_req(int net_phone, measured_string_ref * configuration, size_t count, char ** data){
-	if(!(configuration && (count > 0))){
-		return EINVAL;
-	}
-
-	return net_get_conf(NULL, * configuration, count, data);
-}
-
-int net_get_device_conf_req(int net_phone, device_id_t device_id, measured_string_ref * configuration, size_t count, char ** data){
-	netif_ref netif;
-
-	if(!(configuration && (count > 0))){
-		return EINVAL;
-	}
-
-	netif = netifs_find(&net_globals.netifs, device_id);
-	if(netif){
-		return net_get_conf(&netif->configuration, * configuration, count, data);
-	}else{
-		return net_get_conf(NULL, * configuration, count, data);
-	}
-}
-
-int net_initialize(async_client_conn_t client_connection){
-	ERROR_DECLARE;
-
+	}
+	
+	fclose(cfg);
+	return EOK;
+}
+
+/** Read the network interface specific configuration.
+ *
+ * @param[in]     name  The network interface name.
+ * @param[in,out] netif The network interface structure.
+ *
+ * @returns EOK on success.
+ * @returns Other error codes as defined for the add_configuration() function.
+ *
+ */
+static int read_netif_configuration(const char *name, netif_t *netif)
+{
+	return read_configuration_file(CONF_DIR, name, &netif->configuration);
+}
+
+/** Read the networking subsystem global configuration.
+ *
+ * @returns EOK on success.
+ * @returns Other error codes as defined for the add_configuration() function.
+ *
+ */
+static int read_configuration(void)
+{
+	return read_configuration_file(CONF_DIR, CONF_GENERAL_FILE,
+	    &net_globals.configuration);
+}
+
+/** Initialize the networking module.
+ *
+ * @param[in] client_connection The client connection processing
+ *                              function. The module skeleton propagates
+ *                              its own one.
+ *
+ * @returns EOK on success.
+ * @returns ENOMEM if there is not enough memory left.
+ *
+ */
+static int net_initialize(async_client_conn_t client_connection)
+{
+	ERROR_DECLARE;
+	
 	netifs_initialize(&net_globals.netifs);
 	char_map_initialize(&net_globals.netif_names);
 	modules_initialize(&net_globals.modules);
 	measured_strings_initialize(&net_globals.configuration);
-
-	// TODO dynamic configuration
+	
+	// TODO: dynamic configuration
 	ERROR_PROPAGATE(read_configuration());
-
-	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, LO_NAME, LO_FILENAME, SERVICE_LO, 0, connect_to_service));
-	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, DP8390_NAME, DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service));
-	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, ETHERNET_NAME, ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service));
-	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, NILDUMMY_NAME, NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service));
-
-	// build specific initialization
+	
+	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules,
+	    LO_NAME, LO_FILENAME, SERVICE_LO, 0, connect_to_service));
+	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules,
+	    DP8390_NAME, DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service));
+	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules,
+	    ETHERNET_NAME, ETHERNET_FILENAME, SERVICE_ETHERNET, 0,
+	    connect_to_service));
+	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules,
+	    NILDUMMY_NAME, NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0,
+	    connect_to_service));
+	
+	/* Build specific initialization */
 	return net_initialize_build(client_connection);
 }
 
-int net_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	ERROR_DECLARE;
-
+/** Start the networking module.
+ *
+ * Initializes the client connection serving function,
+ * initializes the module, registers the module service
+ * and starts 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.
+ *
+ * @returns EOK on successful module termination.
+ * @returns Other error codes as defined for the net_initialize() function.
+ * @returns Other error codes as defined for the REGISTER_ME() macro function.
+ *
+ */
+static int net_module_start(async_client_conn_t client_connection)
+{
+	ERROR_DECLARE;
+	
+	async_set_client_connection(client_connection);
+	ERROR_PROPAGATE(pm_init());
+	
+	ipcarg_t phonehash;
+	
+	if (ERROR_OCCURRED(net_initialize(client_connection))
+	    || ERROR_OCCURRED(REGISTER_ME(SERVICE_NETWORKING, &phonehash))){
+		pm_destroy();
+		return ERROR_CODE;
+	}
+	
+	async_manager();
+	
+	pm_destroy();
+	return EOK;
+}
+
+/** Return the configured values.
+ *
+ * The network interface configuration is searched first.
+ &
+ * @param[in]  netif_conf    The network interface configuration setting.
+ * @param[out] configuration The found configured values.
+ * @param[in]  count         The desired settings count.
+ * @param[out] data          The found configuration settings data.
+ *
+ * @returns EOK.
+ *
+ */
+static int net_get_conf(measured_strings_ref netif_conf,
+    measured_string_ref configuration, size_t count, char **data)
+{
+	if (data)
+		*data = NULL;
+	
+	size_t index;
+	for (index = 0; index < count; index++) {
+		measured_string_ref setting =
+		    measured_strings_find(netif_conf, configuration[index].value, 0);
+		if (!setting)
+			setting = measured_strings_find(&net_globals.configuration,
+			    configuration[index].value, 0);
+		
+		if (setting) {
+			configuration[index].length = setting->length;
+			configuration[index].value = setting->value;
+		} else {
+			configuration[index].length = 0;
+			configuration[index].value = NULL;
+		}
+	}
+	
+	return EOK;
+}
+
+int net_get_conf_req(int net_phone, measured_string_ref *configuration,
+    size_t count, char **data)
+{
+	if (!(configuration && (count > 0)))
+		return EINVAL;
+	
+	return net_get_conf(NULL, *configuration, count, data);
+}
+
+int net_get_device_conf_req(int net_phone, device_id_t device_id,
+    measured_string_ref *configuration, size_t count, char **data)
+{
+	if ((!configuration) || (count == 0))
+		return EINVAL;
+
+	netif_t *netif = netifs_find(&net_globals.netifs, device_id);
+	if (netif)
+		return net_get_conf(&netif->configuration, *configuration, count, data);
+	else
+		return net_get_conf(NULL, *configuration, count, data);
+}
+
+void net_free_settings(measured_string_ref settings, char *data)
+{
+}
+
+/** Start the network interface according to its configuration.
+ *
+ * Register the network interface with the subsystem modules.
+ * Start the needed subsystem modules.
+ *
+ * @param[in] netif The network interface specific data.
+ *
+ * @returns EOK on success.
+ * @returns EINVAL if there are some settings missing.
+ * @returns ENOENT if the internet protocol module is not known.
+ * @returns Other error codes as defined for the netif_probe_req() function.
+ * @returns Other error codes as defined for the nil_device_req() function.
+ * @returns Other error codes as defined for the needed internet layer
+ *          registering function.
+ *
+ */
+static int start_device(netif_t *netif)
+{
+	ERROR_DECLARE;
+	
+	/* Mandatory netif */
+	measured_string_ref setting =
+	    measured_strings_find(&netif->configuration, CONF_NETIF, 0);
+	
+	netif->driver = get_running_module(&net_globals.modules, setting->value);
+	if (!netif->driver) {
+		fprintf(stderr, "%s: Failed to start network interface driver '%s'\n",
+		    NAME, setting->value);
+		return EINVAL;
+	}
+	
+	/* Optional network interface layer */
+	setting = measured_strings_find(&netif->configuration, CONF_NIL, 0);
+	if (setting) {
+		netif->nil = get_running_module(&net_globals.modules, setting->value);
+		if (!netif->nil) {
+			fprintf(stderr, "%s: Failed to start network interface layer '%s'\n",
+			    NAME, setting->value);
+			return EINVAL;
+		}
+	} else
+		netif->nil = NULL;
+	
+	/* Mandatory internet layer */
+	setting = measured_strings_find(&netif->configuration, CONF_IL, 0);
+	netif->il = get_running_module(&net_globals.modules, setting->value);
+	if (!netif->il) {
+		fprintf(stderr, "%s: Failed to start internet layer '%s'\n",
+		    NAME, setting->value);
+		return EINVAL;
+	}
+	
+	/* Hardware configuration */
+	setting = measured_strings_find(&netif->configuration, CONF_IRQ, 0);
+	int irq = setting ? strtol(setting->value, NULL, 10) : 0;
+	
+	setting = measured_strings_find(&netif->configuration, CONF_IO, 0);
+	int io = setting ? strtol(setting->value, NULL, 16) : 0;
+	
+	ERROR_PROPAGATE(netif_probe_req_remote(netif->driver->phone, netif->id, irq, io));
+	
+	/* Network interface layer startup */
+	services_t internet_service;
+	if (netif->nil) {
+		setting = measured_strings_find(&netif->configuration, CONF_MTU, 0);
+		if (!setting)
+			setting = measured_strings_find(&net_globals.configuration,
+			    CONF_MTU, 0);
+		
+		int mtu = setting ? strtol(setting->value, NULL, 10) : 0;
+		
+		ERROR_PROPAGATE(nil_device_req(netif->nil->phone, netif->id, mtu,
+		    netif->driver->service));
+		
+		internet_service = netif->nil->service;
+	} else
+		internet_service = netif->driver->service;
+	
+	/* Inter-network layer startup */
+	switch (netif->il->service) {
+		case SERVICE_IP:
+			ERROR_PROPAGATE(ip_device_req(netif->il->phone, netif->id,
+			    internet_service));
+			break;
+		default:
+			return ENOENT;
+	}
+	
+	ERROR_PROPAGATE(netif_start_req_remote(netif->driver->phone, netif->id));
+	return EOK;
+}
+
+/** Read the configuration and start all network interfaces.
+ *
+ * @returns EOK on success.
+ * @returns EXDEV if there is no available system-unique device identifier.
+ * @returns EINVAL if any of the network interface names are not configured.
+ * @returns ENOMEM if there is not enough memory left.
+ * @returns Other error codes as defined for the read_configuration()
+ *          function.
+ * @returns Other error codes as defined for the read_netif_configuration()
+ *          function.
+ * @returns Other error codes as defined for the start_device() function.
+ *
+ */
+static int startup(void)
+{
+	ERROR_DECLARE;
+	
+	const char *conf_files[] = {"lo", "ne2k"};
+	size_t count = sizeof(conf_files) / sizeof(char *);
+	
+	size_t i;
+	for (i = 0; i < count; i++) {
+		netif_t *netif = (netif_t *) malloc(sizeof(netif_t));
+		if (!netif)
+			return ENOMEM;
+		
+		netif->id = generate_new_device_id();
+		if (!netif->id)
+			return EXDEV;
+		
+		ERROR_PROPAGATE(measured_strings_initialize(&netif->configuration));
+		
+		/* Read configuration files */
+		if (ERROR_OCCURRED(read_netif_configuration(conf_files[i], netif))) {
+			measured_strings_destroy(&netif->configuration);
+			free(netif);
+			return ERROR_CODE;
+		}
+		
+		/* Mandatory name */
+		measured_string_ref setting =
+		    measured_strings_find(&netif->configuration, CONF_NAME, 0);
+		if (!setting) {
+			fprintf(stderr, "%s: Network interface name is missing\n", NAME);
+			measured_strings_destroy(&netif->configuration);
+			free(netif);
+			return EINVAL;
+		}
+		netif->name = setting->value;
+		
+		/* Add to the netifs map */
+		int index = netifs_add(&net_globals.netifs, netif->id, netif);
+		if (index < 0) {
+			measured_strings_destroy(&netif->configuration);
+			free(netif);
+			return index;
+		}
+		
+		/*
+		 * Add to the netif names map and start network interfaces
+		 * and needed modules.
+		 */
+		if ((ERROR_OCCURRED(char_map_add(&net_globals.netif_names,
+		    netif->name, 0, index))) || (ERROR_OCCURRED(start_device(netif)))) {
+			measured_strings_destroy(&netif->configuration);
+			netifs_exclude_index(&net_globals.netifs, index);
+			return ERROR_CODE;
+		}
+		
+		/* Increment modules' usage */
+		netif->driver->usage++;
+		if (netif->nil)
+			netif->nil->usage++;
+		netif->il->usage++;
+		
+		printf("%s: Network interface started (name: %s, id: %d, driver: %s, "
+		    "nil: %s, il: %s)\n", NAME, netif->name, netif->id,
+		    netif->driver->name,  netif->nil ? netif->nil->name : "[none]",
+		    netif->il->name);
+	}
+	
+	return EOK;
+}
+
+/** Process the networking message.
+ *
+ * @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.
+ *
+ * @returns EOK on success.
+ * @returns ENOTSUP if the message is not known.
+ *
+ * @see net_interface.h
+ * @see IS_NET_NET_MESSAGE()
+ *
+ */
+int net_message(ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer,
+    int *answer_count)
+{
+	ERROR_DECLARE;
+	
 	measured_string_ref strings;
-	char * data;
-
+	char *data;
+	
 	*answer_count = 0;
-	switch(IPC_GET_METHOD(*call)){
+	switch (IPC_GET_METHOD(*call)) {
 		case IPC_M_PHONE_HUNGUP:
 			return EOK;
 		case NET_NET_GET_DEVICE_CONF:
-			ERROR_PROPAGATE(measured_strings_receive(&strings, &data, IPC_GET_COUNT(call)));
-			net_get_device_conf_req(0, IPC_GET_DEVICE(call), &strings, IPC_GET_COUNT(call), NULL);
-			// strings should not contain received data anymore
+			ERROR_PROPAGATE(measured_strings_receive(&strings, &data,
+			    IPC_GET_COUNT(call)));
+			net_get_device_conf_req(0, IPC_GET_DEVICE(call), &strings,
+			    IPC_GET_COUNT(call), NULL);
+			
+			/* Strings should not contain received data anymore */
 			free(data);
+			
 			ERROR_CODE = measured_strings_reply(strings, IPC_GET_COUNT(call));
 			free(strings);
 			return ERROR_CODE;
 		case NET_NET_GET_CONF:
-			ERROR_PROPAGATE(measured_strings_receive(&strings, &data, IPC_GET_COUNT(call)));
+			ERROR_PROPAGATE(measured_strings_receive(&strings, &data,
+			    IPC_GET_COUNT(call)));
 			net_get_conf_req(0, &strings, IPC_GET_COUNT(call), NULL);
-			// strings should not contain received data anymore
+			
+			/* Strings should not contain received data anymore */
 			free(data);
+			
 			ERROR_CODE = measured_strings_reply(strings, IPC_GET_COUNT(call));
 			free(strings);
@@ -301,273 +634,11 @@
 }
 
-int parse_line(measured_strings_ref configuration, char * line){
-	ERROR_DECLARE;
-
-	measured_string_ref setting;
-	char * name;
-	char * value;
-
-	// from the beginning
-	name = line;
-
-	// skip comments and blank lines
-	if((*name == '#') || (*name == '\0')){
-		return EOK;
-	}
-	// skip spaces
-	while(isspace(*name)){
-		++ name;
-	}
-
-	// remember the name start
-	value = name;
-	// skip the name
-	while(isalnum(*value) || (*value == '_')){
-		// make uppercase
-//		*value = toupper(*value);
-		++ value;
-	}
-
-	if(*value == '='){
-		// terminate the name
-		*value = '\0';
-	}else{
-		// terminate the name
-		*value = '\0';
-		// skip until '='
-		++ value;
-		while((*value) && (*value != '=')){
-			++ value;
-		}
-		// not found?
-		if(*value != '='){
-			return EINVAL;
-		}
-	}
-
-	++ value;
-	// skip spaces
-	while(isspace(*value)){
-		++ value;
-	}
-	// create a bulk measured string till the end
-	setting = measured_string_create_bulk(value, 0);
-	if(! setting){
-		return ENOMEM;
-	}
-
-	// add the configuration setting
-	if(ERROR_OCCURRED(measured_strings_add(configuration, name, 0, setting))){
-		free(setting);
-		return ERROR_CODE;
-	}
-	return EOK;
-}
-
-int read_configuration(void){
-	// read the general configuration file
-	return read_configuration_file(CONF_DIR, CONF_GENERAL_FILE, &net_globals.configuration);
-}
-
-int read_configuration_file(const char * directory, const char * filename, measured_strings_ref configuration){
-	ERROR_DECLARE;
-
-	size_t index = 0;
-	char line[BUFFER_SIZE];
-	FILE * cfg;
-	int read;
-	int line_number = 0;
-
-	// construct the full filename
-	printf("Reading file %s/%s\n", directory, filename);
-	if(snprintf(line, BUFFER_SIZE, "%s/%s", directory, filename) > BUFFER_SIZE){
-		return EOVERFLOW;
-	}
-	// open the file
-	cfg = fopen(line, "r");
-	if(! cfg){
-		return ENOENT;
-	}
-
-	// read the configuration line by line
-	// until an error or the end of file
-	while((! ferror(cfg)) && (! feof(cfg))){
-		read = fgetc(cfg);
-		if((read > 0) && (read != '\n') && (read != '\r')){
-			if(index >= BUFFER_SIZE){
-				line[BUFFER_SIZE - 1] = '\0';
-				printf("line %d too long: %s\n", line_number, line);
-				// no space left in the line buffer
-				return EOVERFLOW;
-			}else{
-				// append the character
-				line[index] = (char) read;
-				++ index;
-			}
-		}else{
-			// on error or new line
-			line[index] = '\0';
-			++ line_number;
-			if(ERROR_OCCURRED(parse_line(configuration, line))){
-				printf("error on line %d: %s\n", line_number, line);
-				//fclose(cfg);
-				//return ERROR_CODE;
-			}
-			index = 0;
-		}
-	}
-	fclose(cfg);
-	return EOK;
-}
-
-int read_netif_configuration(const char * name, netif_ref netif){
-	// read the netif configuration file
-	return read_configuration_file(CONF_DIR, name, &netif->configuration);
-}
-
-int start_device(netif_ref netif){
-	ERROR_DECLARE;
-
-	measured_string_ref setting;
-	services_t internet_service;
-	int irq;
-	int io;
-	int mtu;
-
-	// mandatory netif
-	setting = measured_strings_find(&netif->configuration, CONF_NETIF, 0);
-	netif->driver = get_running_module(&net_globals.modules, setting->value);
-	if(! netif->driver){
-		printf("Failed to start the network interface driver %s\n", setting->value);
-		return EINVAL;
-	}
-
-	// optional network interface layer
-	setting = measured_strings_find(&netif->configuration, CONF_NIL, 0);
-	if(setting){
-		netif->nil = get_running_module(&net_globals.modules, setting->value);
-		if(! netif->nil){
-			printf("Failed to start the network interface layer %s\n", setting->value);
-			return EINVAL;
-		}
-	}else{
-		netif->nil = NULL;
-	}
-
-	// mandatory internet layer
-	setting = measured_strings_find(&netif->configuration, CONF_IL, 0);
-	netif->il = get_running_module(&net_globals.modules, setting->value);
-	if(! netif->il){
-		printf("Failed to start the internet layer %s\n", setting->value);
-		return EINVAL;
-	}
-
-	// hardware configuration
-	setting = measured_strings_find(&netif->configuration, CONF_IRQ, 0);
-	irq = setting ? strtol(setting->value, NULL, 10) : 0;
-	setting = measured_strings_find(&netif->configuration, CONF_IO, 0);
-	io = setting ? strtol(setting->value, NULL, 16) : 0;
-	ERROR_PROPAGATE(netif_probe_req(netif->driver->phone, netif->id, irq, io));
-
-	// network interface layer startup
-	if(netif->nil){
-		setting = measured_strings_find(&netif->configuration, CONF_MTU, 0);
-		if(! setting){
-			setting = measured_strings_find(&net_globals.configuration, CONF_MTU, 0);
-		}
-		mtu = setting ? strtol(setting->value, NULL, 10) : 0;
-		ERROR_PROPAGATE(nil_device_req(netif->nil->phone, netif->id, mtu, netif->driver->service));
-		internet_service = netif->nil->service;
-	}else{
-		internet_service = netif->driver->service;
-	}
-
-	// inter-network layer startup
-	switch(netif->il->service){
-		case SERVICE_IP:
-			ERROR_PROPAGATE(ip_device_req(netif->il->phone, netif->id, internet_service));
-			break;
-		default:
-			return ENOENT;
-	}
-	ERROR_PROPAGATE(netif_start_req(netif->driver->phone, netif->id));
-	return EOK;
-}
-
-int startup(void){
-	ERROR_DECLARE;
-
-	const char * conf_files[] = {"lo", "ne2k"};
-
-	int count = sizeof(conf_files) / sizeof(char *);
-	int index;
-	netif_ref netif;
-	int i;
-	measured_string_ref setting;
-
-	for(i = 0; i < count; ++ i){
-		netif = (netif_ref) malloc(sizeof(netif_t));
-		if(! netif){
-			return ENOMEM;
-		}
-
-		netif->id = generate_new_device_id();
-		if(! netif->id){
-			return EXDEV;
-		}
-		ERROR_PROPAGATE(measured_strings_initialize(&netif->configuration));
-
-		// read configuration files
-		if(ERROR_OCCURRED(read_netif_configuration(conf_files[i], netif))){
-			measured_strings_destroy(&netif->configuration);
-			free(netif);
-			return ERROR_CODE;
-		}
-
-		// mandatory name
-		setting = measured_strings_find(&netif->configuration, CONF_NAME, 0);
-		if(! setting){
-			printf("The name is missing\n");
-			measured_strings_destroy(&netif->configuration);
-			free(netif);
-			return EINVAL;
-		}
-		netif->name = setting->value;
-
-		// add to the netifs map
-		index = netifs_add(&net_globals.netifs, netif->id, netif);
-		if(index < 0){
-			measured_strings_destroy(&netif->configuration);
-			free(netif);
-			return index;
-		}
-
-		// add to the netif names map
-		if(ERROR_OCCURRED(char_map_add(&net_globals.netif_names, netif->name, 0, index))
-		// start network interfaces and needed modules
-			|| ERROR_OCCURRED(start_device(netif))){
-			measured_strings_destroy(&netif->configuration);
-			netifs_exclude_index(&net_globals.netifs, index);
-			return ERROR_CODE;
-		}
-
-		// increment modules' usage
-		++ netif->driver->usage;
-		if(netif->nil){
-			++ netif->nil->usage;
-		}
-		++ netif->il->usage;
-		printf("New network interface started:\n\tname\t= %s\n\tid\t= %d\n\tdriver\t= %s\n\tnil\t= %s\n\til\t= %s\n", netif->name, netif->id, netif->driver->name, netif->nil ? netif->nil->name : NULL, netif->il->name);
-	}
-	return EOK;
-}
-
 /** Default thread for new connections.
  *
- *  @param[in] iid The initial message identifier.
- *  @param[in] icall The initial message call structure.
- *
- */
-static void net_client_connection(ipc_callid_t iid, ipc_call_t * icall)
+ * @param[in] iid The initial message identifier.
+ * @param[in] icall The initial message call structure.
+ *
+ */
+static void net_client_connection(ipc_callid_t iid, ipc_call_t *icall)
 {
 	/*
@@ -577,9 +648,8 @@
 	ipc_answer_0(iid, EOK);
 	
-	while(true) {
+	while (true) {
+		/* Clear the answer structure */
 		ipc_call_t answer;
 		int answer_count;
-		
-		/* Clear the answer structure */
 		refresh_answer(&answer, &answer_count);
 		
@@ -600,23 +670,10 @@
 }
 
-/** Starts the module.
- *
- *  @param argc The count of the command line arguments. Ignored parameter.
- *  @param argv The command line parameters. Ignored parameter.
- *
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module start function.
- *
- */
 int main(int argc, char *argv[])
 {
 	ERROR_DECLARE;
 	
-	/* Print the module label */
-	printf("Task %d - %s\n", task_get_id(), NAME);
-	
-	/* Start the module */
 	if (ERROR_OCCURRED(net_module_start(net_client_connection))) {
-		printf(" - ERROR %i\n", ERROR_CODE);
+		fprintf(stderr, "%s: net_module_start error %i\n", NAME, ERROR_CODE);
 		return ERROR_CODE;
 	}
Index: uspace/srv/net/net/net.h
===================================================================
--- uspace/srv/net/net/net.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/net/net.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -28,9 +28,10 @@
 
 /** @addtogroup net
- *  @{
+ * @{
  */
 
 /** @file
- *  Networking subsystem central module.
+ * Networking subsystem central module.
+ *
  */
 
@@ -48,197 +49,92 @@
 
 /** @name Modules definitions
+ * @{
  */
-/*@{*/
 
-/** DP8390 network interface module full path filename.
+#define DP8390_FILENAME  "/srv/dp8390"
+#define DP8390_NAME      "dp8390"
+
+#define ETHERNET_FILENAME  "/srv/eth"
+#define ETHERNET_NAME      "eth"
+
+#define IP_FILENAME  "/srv/ip"
+#define IP_NAME      "ip"
+
+#define LO_FILENAME  "/srv/lo"
+#define LO_NAME      "lo"
+
+#define NILDUMMY_FILENAME  "/srv/nildummy"
+#define NILDUMMY_NAME      "nildummy"
+
+/** @}
  */
-#define DP8390_FILENAME		"/srv/dp8390"
-
-/** DP8390 network interface module name.
- */
-#define DP8390_NAME			"dp8390"
-
-/** Ethernet module full path filename.
- */
-#define ETHERNET_FILENAME	"/srv/eth"
-
-/** Ethernet module name.
- */
-#define ETHERNET_NAME		"ethernet"
-
-/** IP module full path filename.
- */
-#define IP_FILENAME			"/srv/ip"
-
-/** IP module name.
- */
-#define IP_NAME				"ip"
-
-/** Loopback network interface module full path filename.
- */
-#define LO_FILENAME			"/srv/lo"
-
-/** Loopback network interface module name.
- */
-#define LO_NAME				"lo"
-
-/** Ethernet module full path filename.
- */
-#define NILDUMMY_FILENAME	"/srv/nildummy"
-
-/** Ethernet module name.
- */
-#define NILDUMMY_NAME		"nildummy"
-
-/*@}*/
 
 /** @name Configuration setting names definitions
+ * @{
  */
-/*@{*/
 
-/** Internet protocol module name configuration label.
+#define CONF_IL     "IL"     /**< Internet protocol module name configuration label. */
+#define CONF_IO     "IO"     /**< Device input/output address configuration label. */
+#define CONF_IRQ    "IRQ"    /**< Interrupt number configuration label. */
+#define CONF_MTU    "MTU"    /**< Maximum transmission unit configuration label. */
+#define CONF_NAME   "NAME"   /**< Network interface name configuration label. */
+#define CONF_NETIF  "NETIF"  /**< Network interface module name configuration label. */
+#define CONF_NIL    "NIL"    /**< Network interface layer module name configuration label. */
+
+/** @}
  */
-#define CONF_IL				"IL"
 
-/** Device input/output address configuration label.
- */
-#define CONF_IO				"IO"
-
-/** Interrupt number configuration label.
- */
-#define CONF_IRQ			"IRQ"
-
-/** Maximum transmission unit configuration label.
- */
-#define CONF_MTU			"MTU"
-
-/** Network interface name configuration label.
- */
-#define CONF_NAME			"NAME"
-
-/** Network interface module name configuration label.
- */
-#define CONF_NETIF			"NETIF"
-
-/** Network interface layer module name configuration label.
- */
-#define CONF_NIL			"NIL"
-
-/*@}*/
-
-/** Configuration directory.
- */
-#define CONF_DIR			"/cfg/net"
-
-/** General configuration file.
- */
-#define CONF_GENERAL_FILE	"general"
-
-/** Type definition of the networking module global data.
- *  @see net_globals
- */
-typedef struct net_globals	net_globals_t;
-
-/** Type definition of the network interface specific data.
- *  @see netif
- */
-typedef struct netif	netif_t;
-
-/** Type definition of the network interface specific data pointer.
- *  @see netif
- */
-typedef netif_t *		netif_ref;
+#define CONF_DIR           "/cfg/net"  /**< Configuration directory. */
+#define CONF_GENERAL_FILE  "general"   /**< General configuration file. */
 
 /** Configuration settings.
- *  Maps setting names to the values.
- *  @see generic_char_map.h
+ *
+ * Maps setting names to the values.
+ * @see generic_char_map.h
+ *
  */
-GENERIC_CHAR_MAP_DECLARE(measured_strings, measured_string_t)
+GENERIC_CHAR_MAP_DECLARE(measured_strings, measured_string_t);
+
+/** Present network interface device.
+ *
+ */
+typedef struct {
+	measured_strings_t configuration;  /**< Configuration. */
+	
+	/** Serving network interface driver module index. */
+	module_ref driver;
+	
+	device_id_t id;  /**< System-unique network interface identifier. */
+	module_ref il;   /**< Serving internet layer module index. */
+	char *name;      /**< System-unique network interface name. */
+	module_ref nil;  /**< Serving link layer module index. */
+} netif_t;
 
 /** Present network interfaces.
- *  Maps devices to the networking device specific data.
- *  @see device.h
+ *
+ * Maps devices to the networking device specific data.
+ * @see device.h
+ *
  */
-DEVICE_MAP_DECLARE(netifs, netif_t)
+DEVICE_MAP_DECLARE(netifs, netif_t);
 
-/** Networking module global variables.
+/** Networking module global data.
+ *
  */
-struct net_globals{
-	/** Global configuration.
-	 */
-	measured_strings_t configuration;
-	/** Available modules.
-	 */
-	modules_t modules;
-	/** Network interface structure indices by names.
-	 */
+typedef struct {
+	measured_strings_t configuration;  /**< Global configuration. */
+	modules_t modules;                 /**< Available modules. */
+	
+	/** Network interface structure indices by names. */
 	char_map_t netif_names;
-	/** Present network interfaces.
-	 */
+	
+	/** Present network interfaces. */
 	netifs_t netifs;
-};
+} net_globals_t;
 
-/** Present network interface device.
- */
-struct netif{
-	/** Configuration.
-	 */
-	measured_strings_t configuration;
-	/** Serving network interface driver module index.
-	 */
-	module_ref driver;
-	/** System-unique network interface identifier.
-	 */
-	device_id_t id;
-	/** Serving internet layer module index.
-	 */
-	module_ref il;
-	/** System-unique network interface name.
-	 */
-	char * name;
-	/** Serving link layer module index.
-	 */
-	module_ref nil;
-};
-
-/** Adds the configured setting to the configuration map.
- *  @param[in] configuration The configuration map.
- *  @param[in] name The setting name.
- *  @param[in] value The setting value.
- *  @returns EOK on success.
- *  @returns ENOMEM if there is not enough memory left.
- */
-int add_configuration(measured_strings_ref configuration, const char * name, const char * value);
-
-/** Processes the module message.
- *  Distributes the message to the right bundled module.
- *  @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.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for each bundled module message function.
- */
-int net_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
-
-/** Initializes the networking module for the chosen subsystem build type.
- *  @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
- *  @returns EOK on success.
- *  @returns ENOMEM if there is not enough memory left.
- */
-int net_initialize_build(async_client_conn_t client_connection);
-
-/** Processes the networking message.
- *  @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.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @see net_interface.h
- *  @see IS_NET_NET_MESSAGE()
- */
-int net_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
+extern int add_configuration(measured_strings_ref, const char *, const char *);
+extern int net_module_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, int *);
+extern int net_initialize_build(async_client_conn_t);
+extern int net_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, int *);
 
 #endif
Index: uspace/srv/net/net/net_bundle.c
===================================================================
--- uspace/srv/net/net/net_bundle.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/net/net_bundle.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -60,4 +60,9 @@
 extern net_globals_t	net_globals;
 
+/** Initializes the networking module for the chosen subsystem build type.
+ *  @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
+ *  @returns EOK on success.
+ *  @returns ENOMEM if there is not enough memory left.
+ */
 int net_initialize_build(async_client_conn_t client_connection){
 	ERROR_DECLARE;
@@ -79,4 +84,14 @@
 }
 
+/** Processes the module message.
+ *  Distributes the message to the right bundled module.
+ *  @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.
+ *  @returns EOK on success.
+ *  @returns ENOTSUP if the message is not known.
+ *  @returns Other error codes as defined for each bundled module message function.
+ */
 int net_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	if((IPC_GET_METHOD(*call) == IPC_M_CONNECT_TO_ME)
Index: uspace/srv/net/net/net_standalone.c
===================================================================
--- uspace/srv/net/net/net_standalone.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/net/net_standalone.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -49,34 +49,60 @@
 /** Networking module global data.
  */
-extern net_globals_t	net_globals;
+extern net_globals_t net_globals;
 
+/** Initialize the networking module for the chosen subsystem build type.
+ *
+ *  @param[in] client_connection The client connection processing function.
+ *                               The module skeleton propagates its own one.
+ *
+ *  @return EOK on success.
+ *  @return ENOMEM if there is not enough memory left.
+ *
+ */
 int net_initialize_build(async_client_conn_t client_connection){
 	ERROR_DECLARE;
-
-	task_id_t task_id;
-
-	task_id = spawn("/srv/ip");
-	if(! task_id){
+	
+	task_id_t task_id = spawn("/srv/ip");
+	if (!task_id)
 		return EINVAL;
-	}
-	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_id, ip_connect_module));
-	if(! spawn("/srv/icmp")){
+	
+	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, IP_NAME,
+	    IP_FILENAME, SERVICE_IP, task_id, ip_connect_module));
+	
+	if (!spawn("/srv/icmp"))
 		return EINVAL;
-	}
-	if(! spawn("/srv/udp")){
+	
+	if (!spawn("/srv/udp"))
 		return EINVAL;
-	}
-	if(! spawn("/srv/tcp")){
+	
+	if (!spawn("/srv/tcp"))
 		return EINVAL;
-	}
+	
 	return EOK;
 }
 
-int net_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	if(IS_NET_PACKET_MESSAGE(call)){
+/** Process the module message.
+ *
+ * Distribute the message to the right module.
+ *
+ * @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 bundled module
+ *         message function.
+ *
+ */
+int net_module_message(ipc_callid_t callid, ipc_call_t *call,
+    ipc_call_t *answer, int *answer_count)
+{
+	if (IS_NET_PACKET_MESSAGE(call))
 		return packet_server_message(callid, call, answer, answer_count);
-	}else{
-		return net_message(callid, call, answer, answer_count);
-	}
+	
+	return net_message(callid, call, answer, answer_count);
 }
 
Index: uspace/srv/net/netif/lo/Makefile
===================================================================
--- uspace/srv/net/netif/lo/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/netif/lo/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -39,11 +39,9 @@
 -include $(CONFIG_MAKEFILE)
 
-ifeq ($(CONFIG_NETWORKING),modular)
-	BINARY = lo
+ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y)
+	LIBS += $(USPACE_PREFIX)/srv/net/nil/nildummy/libnildummy.a
 endif
 
-ifeq ($(CONFIG_NETWORKING),module)
-	LIBRARY = liblo
-endif
+BINARY = lo
 
 SOURCES = \
Index: uspace/srv/net/netif/lo/lo.c
===================================================================
--- uspace/srv/net/netif/lo/lo.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/netif/lo/lo.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -51,6 +51,6 @@
 #include <nil_interface.h>
 #include <nil_messages.h>
-#include <netif.h>
-#include <netif_module.h>
+#include <netif_interface.h>
+#include <netif_local.h>
 
 /** Default hardware address.
@@ -64,5 +64,5 @@
 /** Loopback module name.
  */
-#define NAME	"lo - loopback interface"
+#define NAME  "lo"
 
 /** Network interface global data.
@@ -76,5 +76,5 @@
  *  @returns EOK otherwise.
  */
-int change_state_message(device_ref device, device_state_t state);
+int change_state_message(netif_device_t * device, device_state_t state);
 
 /** Creates and returns the loopback network interface structure.
@@ -85,5 +85,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-int create(device_id_t device_id, device_ref * device);
+int create(device_id_t device_id, netif_device_t * * device);
 
 int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
@@ -103,5 +103,5 @@
 	ERROR_DECLARE;
 
-	device_ref device;
+	netif_device_t * device;
 
 	if(! stats){
@@ -113,20 +113,25 @@
 }
 
-int change_state_message(device_ref device, device_state_t state){
-	if(device->state != state){
+int change_state_message(netif_device_t * device, device_state_t state)
+{
+	if (device->state != state) {
 		device->state = state;
-		printf("State changed to %s\n", (state == NETIF_ACTIVE) ? "ACTIVE" : "STOPPED");
+		
+		printf("%s: State changed to %s\n", NAME,
+		    (state == NETIF_ACTIVE) ? "active" : "stopped");
+		
 		return state;
 	}
-	return EOK;
-}
-
-int create(device_id_t device_id, device_ref * device){
+	
+	return EOK;
+}
+
+int create(device_id_t device_id, netif_device_t * * device){
 	int index;
 
-	if(device_map_count(&netif_globals.device_map) > 0){
+	if(netif_device_map_count(&netif_globals.device_map) > 0){
 		return EXDEV;
 	}else{
-		*device = (device_ref) malloc(sizeof(device_t));
+		*device = (netif_device_t *) malloc(sizeof(netif_device_t));
 		if(!(*device)){
 			return ENOMEM;
@@ -141,5 +146,5 @@
 		(** device).nil_phone = -1;
 		(** device).state = NETIF_STOPPED;
-		index = device_map_add(&netif_globals.device_map, (** device).device_id, * device);
+		index = netif_device_map_add(&netif_globals.device_map, (** device).device_id, * device);
 		if(index < 0){
 			free(*device);
@@ -161,10 +166,10 @@
 	ERROR_DECLARE;
 
-	device_ref device;
+	netif_device_t * device;
 
 	// create a new device
 	ERROR_PROPAGATE(create(device_id, &device));
 	// print the settings
-	printf("New device created:\n\tid\t= %d\n", device->device_id);
+	printf("%s: Device created (id: %d)\n", NAME, device->device_id);
 	return EOK;
 }
@@ -173,5 +178,5 @@
 	ERROR_DECLARE;
 
-	device_ref device;
+	netif_device_t * device;
 	size_t length;
 	packet_t next;
@@ -199,23 +204,19 @@
 }
 
-int netif_start_message(device_ref device){
+int netif_start_message(netif_device_t * device){
 	return change_state_message(device, NETIF_ACTIVE);
 }
 
-int netif_stop_message(device_ref device){
+int netif_stop_message(netif_device_t * device){
 	return change_state_message(device, NETIF_STOPPED);
 }
 
-#ifdef CONFIG_NETWORKING_modular
-
-#include <netif_standalone.h>
-
 /** Default thread for new connections.
  *
- *  @param[in] iid The initial message identifier.
- *  @param[in] icall The initial message call structure.
- *
- */
-static void netif_client_connection(ipc_callid_t iid, ipc_call_t * icall)
+ * @param[in] iid The initial message identifier.
+ * @param[in] icall The initial message call structure.
+ *
+ */
+static void netif_client_connection(ipc_callid_t iid, ipc_call_t *icall)
 {
 	/*
@@ -237,5 +238,6 @@
 		
 		/* Process the message */
-		int res = netif_module_message(callid, &call, &answer, &answer_count);
+		int res = netif_module_message(NAME, callid, &call, &answer,
+		    &answer_count);
 		
 		/* End if said to either by the message or the processing result */
@@ -248,30 +250,14 @@
 }
 
-/** Starts the module.
- *
- *  @param argc The count of the command line arguments. Ignored parameter.
- *  @param argv The command line parameters. Ignored parameter.
- *
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module start function.
- *
- */
 int main(int argc, char *argv[])
 {
 	ERROR_DECLARE;
 	
-	/* Print the module label */
-	printf("Task %d - %s\n", task_get_id(), NAME);
-	
 	/* Start the module */
-	if (ERROR_OCCURRED(netif_module_start(netif_client_connection))) {
-		printf(" - ERROR %i\n", ERROR_CODE);
+	if (ERROR_OCCURRED(netif_module_start(netif_client_connection)))
 		return ERROR_CODE;
-	}
-	
-	return EOK;
-}
-
-#endif /* CONFIG_NETWORKING_modular */
+	
+	return EOK;
+}
 
 /** @}
Index: uspace/srv/net/netstart/netstart.c
===================================================================
--- uspace/srv/net/netstart/netstart.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/netstart/netstart.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -79,15 +79,4 @@
 }
 
-/** Network startup entry point.
- *
- * @param[in] argc The number of command line parameters.
- * @param[in] argv The command line parameters.
- *
- * @returns EOK on success.
- * @returns EINVAL if the net module cannot be started.
- * @returns Other error codes as defined for the self_test() function.
- * @returns Other error codes as defined for the NET_NET_STARTUP message.
- *
- */
 int main(int argc, char *argv[])
 {
@@ -105,5 +94,5 @@
 	int net_phone = connect_to_service(SERVICE_NETWORKING);
 	if (ERROR_OCCURRED(ipc_call_sync_0_0(net_phone, NET_NET_STARTUP))) {
-		fprintf(stderr, "%s: Networking error %d\n", NAME, ERROR_CODE);
+		fprintf(stderr, "%s: Startup error %d\n", NAME, ERROR_CODE);
 		return ERROR_CODE;
 	}
Index: uspace/srv/net/netstart/self_test.c
===================================================================
--- uspace/srv/net/netstart/self_test.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/netstart/self_test.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -49,9 +49,8 @@
 #include "self_test.h"
 
-/** Test the function, compare the result and remember if the result differs.
- *
- *  @param[in] name          The test name.
- *  @param[in] function_call The function to be called and checked.
- *  @param[in] result        The expected result.
+/** Test the statement, compare the result and evaluate.
+ *
+ * @param[in] statement The statement to test.
+ * @param[in] result    The expected result.
  *
  */
@@ -85,4 +84,12 @@
 INT_MAP_IMPLEMENT(int_map, int);
 
+/** Self-test start function.
+ *
+ * Run all self-tests.
+ *
+ * @returns EOK on success.
+ * @returns The first error occurred.
+ *
+ */
 int self_test(void)
 {
Index: uspace/srv/net/nil/eth/Makefile
===================================================================
--- uspace/srv/net/nil/eth/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/nil/eth/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -29,7 +29,19 @@
 
 USPACE_PREFIX = ../../../..
-LIBS = $(LIBNETIF_PREFIX)/libnetif.a $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
-EXTRA_CFLAGS = -I$(LIBNETIF_PREFIX)/include -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
-BINARY = eth
+ROOT_PATH = $(USPACE_PREFIX)/..
+LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
+EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
+
+COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
+CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
+
+-include $(COMMON_MAKEFILE)
+-include $(CONFIG_MAKEFILE)
+
+ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y)
+	LIBRARY = libeth
+else
+	BINARY = eth
+endif
 
 SOURCES = \
Index: uspace/srv/net/nil/eth/eth.c
===================================================================
--- uspace/srv/net/nil/eth/eth.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/nil/eth/eth.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -60,4 +60,6 @@
 #include <adt/measured_strings.h>
 #include <packet/packet_client.h>
+#include <packet_remote.h>
+#include <nil_local.h>
 
 #include "eth.h"
@@ -66,5 +68,5 @@
 /** The module name.
  */
-#define NAME	"Ethernet protocol"
+#define NAME  "eth"
 
 /** Reserved packet prefix length.
@@ -270,5 +272,5 @@
 INT_MAP_IMPLEMENT(eth_protos, eth_proto_t)
 
-int nil_device_state_msg(int nil_phone, device_id_t device_id, int state){
+int nil_device_state_msg_local(int nil_phone, device_id_t device_id, int state){
 	int index;
 	eth_proto_ref proto;
@@ -401,5 +403,10 @@
 			return index;
 		}
-		printf("New device registered:\n\tid\t= %d\n\tservice\t= %d\n\tMTU\t= %d\n\taddress\t= %X:%X:%X:%X:%X:%X\n\tflags\t= 0x%x\n", device->device_id, device->service, device->mtu, device->addr_data[0], device->addr_data[1], device->addr_data[2], device->addr_data[3], device->addr_data[4], device->addr_data[5], device->flags);
+		printf("%s: Device registered (id: %d, service: %d: mtu: %d, "
+		    "mac: %x:%x:%x:%x:%x:%x, flags: 0x%x)\n",
+		    NAME, device->device_id, device->service, device->mtu,
+		    device->addr_data[0], device->addr_data[1],
+		    device->addr_data[2], device->addr_data[3],
+		    device->addr_data[4], device->addr_data[5], device->flags);
 	}
 	fibril_rwlock_write_unlock(&eth_globals.devices_lock);
@@ -469,5 +476,5 @@
 }
 
-int nil_received_msg(int nil_phone, device_id_t device_id, packet_t packet, services_t target){
+int nil_received_msg_local(int nil_phone, device_id_t device_id, packet_t packet, services_t target){
 	eth_proto_ref proto;
 	packet_t next;
@@ -491,5 +498,5 @@
 		}else{
 			// drop invalid/unknown
-			pq_release(eth_globals.net_phone, packet_get_id(packet));
+			pq_release_remote(eth_globals.net_phone, packet_get_id(packet));
 		}
 		packet = next;
@@ -571,5 +578,8 @@
 		}
 	}
-	printf("New protocol registered:\n\tprotocol\t= 0x%x\n\tservice\t= %d\n\tphone\t= %d\n", proto->protocol, proto->service, proto->phone);
+	
+	printf("%s: Protocol registered (protocol: %d, service: %d, phone: %d)\n",
+	    NAME, proto->protocol, proto->service, proto->phone);
+	
 	fibril_rwlock_write_unlock(&eth_globals.protos_lock);
 	return EOK;
@@ -672,5 +682,5 @@
 	ethertype = htons(protocol_map(SERVICE_ETHERNET, sender));
 	if(! ethertype){
-		pq_release(eth_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(eth_globals.net_phone, packet_get_id(packet));
 		return EINVAL;
 	}
@@ -690,5 +700,5 @@
 				packet = tmp;
 			}
-			pq_release(eth_globals.net_phone, packet_get_id(next));
+			pq_release_remote(eth_globals.net_phone, packet_get_id(next));
 			next = tmp;
 		}else{
@@ -704,7 +714,9 @@
 }
 
-int nil_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+int nil_message_standalone(const char *name, ipc_callid_t callid, ipc_call_t *call,
+    ipc_call_t *answer, int *answer_count)
+{
 	ERROR_DECLARE;
-
+	
 	measured_string_ref address;
 	packet_t packet;
@@ -713,17 +725,20 @@
 	size_t suffix;
 	size_t content;
-
-//	printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_NIL_FIRST);
+	
 	*answer_count = 0;
-	switch(IPC_GET_METHOD(*call)){
+	switch (IPC_GET_METHOD(*call)) {
 		case IPC_M_PHONE_HUNGUP:
 			return EOK;
 		case NET_NIL_DEVICE:
-			return eth_device_message(IPC_GET_DEVICE(call), IPC_GET_SERVICE(call), IPC_GET_MTU(call));
+			return eth_device_message(IPC_GET_DEVICE(call),
+			    IPC_GET_SERVICE(call), IPC_GET_MTU(call));
 		case NET_NIL_SEND:
-			ERROR_PROPAGATE(packet_translate(eth_globals.net_phone, &packet, IPC_GET_PACKET(call)));
-			return eth_send_message(IPC_GET_DEVICE(call), packet, IPC_GET_SERVICE(call));
+			ERROR_PROPAGATE(packet_translate_remote(eth_globals.net_phone, &packet,
+			    IPC_GET_PACKET(call)));
+			return eth_send_message(IPC_GET_DEVICE(call), packet,
+			    IPC_GET_SERVICE(call));
 		case NET_NIL_PACKET_SPACE:
-			ERROR_PROPAGATE(eth_packet_space_message(IPC_GET_DEVICE(call), &addrlen, &prefix, &content, &suffix));
+			ERROR_PROPAGATE(eth_packet_space_message(IPC_GET_DEVICE(call),
+			    &addrlen, &prefix, &content, &suffix));
 			IPC_SET_ADDR(answer, addrlen);
 			IPC_SET_PREFIX(answer, prefix);
@@ -733,12 +748,16 @@
 			return EOK;
 		case NET_NIL_ADDR:
-			ERROR_PROPAGATE(eth_addr_message(IPC_GET_DEVICE(call), ETH_LOCAL_ADDR, &address));
+			ERROR_PROPAGATE(eth_addr_message(IPC_GET_DEVICE(call),
+			    ETH_LOCAL_ADDR, &address));
 			return measured_strings_reply(address, 1);
 		case NET_NIL_BROADCAST_ADDR:
-			ERROR_PROPAGATE(eth_addr_message(IPC_GET_DEVICE(call), ETH_BROADCAST_ADDR, &address));
+			ERROR_PROPAGATE(eth_addr_message(IPC_GET_DEVICE(call),
+			    ETH_BROADCAST_ADDR, &address));
 			return measured_strings_reply(address, 1);
 		case IPC_M_CONNECT_TO_ME:
-			return eth_register_message(NIL_GET_PROTO(call), IPC_GET_PHONE(call));
-	}
+			return eth_register_message(NIL_GET_PROTO(call),
+			    IPC_GET_PHONE(call));
+	}
+	
 	return ENOTSUP;
 }
@@ -753,10 +772,10 @@
 		switch(IPC_GET_METHOD(*icall)){
 			case NET_NIL_DEVICE_STATE:
-				nil_device_state_msg(0, IPC_GET_DEVICE(icall), IPC_GET_STATE(icall));
+				nil_device_state_msg_local(0, IPC_GET_DEVICE(icall), IPC_GET_STATE(icall));
 				ipc_answer_0(iid, EOK);
 				break;
 			case NET_NIL_RECEIVED:
-				if(! ERROR_OCCURRED(packet_translate(eth_globals.net_phone, &packet, IPC_GET_PACKET(icall)))){
-					ERROR_CODE = nil_received_msg(0, IPC_GET_DEVICE(icall), packet, 0);
+				if(! ERROR_OCCURRED(packet_translate_remote(eth_globals.net_phone, &packet, IPC_GET_PACKET(icall)))){
+					ERROR_CODE = nil_received_msg_local(0, IPC_GET_DEVICE(icall), packet, 0);
 				}
 				ipc_answer_0(iid, (ipcarg_t) ERROR_CODE);
@@ -769,15 +788,13 @@
 }
 
-#ifdef CONFIG_NETWORKING_modular
-
-#include <nil_standalone.h>
+#ifndef CONFIG_NETIF_NIL_BUNDLE
 
 /** Default thread for new connections.
  *
- *  @param[in] iid The initial message identifier.
- *  @param[in] icall The initial message call structure.
+ * @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)
+static void nil_client_connection(ipc_callid_t iid, ipc_call_t *icall)
 {
 	/*
@@ -799,5 +816,6 @@
 		
 		/* Process the message */
-		int res = nil_module_message(callid, &call, &answer, &answer_count);
+		int res = nil_module_message_standalone(NAME, callid, &call, &answer,
+		    &answer_count);
 		
 		/* End if said to either by the message or the processing result */
@@ -810,30 +828,16 @@
 }
 
-/** Starts the module.
- *
- *  @param argc The count of the command line arguments. Ignored parameter.
- *  @param argv The command line parameters. Ignored parameter.
- *
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module start function.
- *
- */
 int main(int argc, char *argv[])
 {
 	ERROR_DECLARE;
 	
-	/* Print the module label */
-	printf("Task %d - %s\n", task_get_id(), NAME);
-	
 	/* Start the module */
-	if (ERROR_OCCURRED(nil_module_start(nil_client_connection))) {
-		printf(" - ERROR %i\n", ERROR_CODE);
+	if (ERROR_OCCURRED(nil_module_start_standalone(nil_client_connection)))
 		return ERROR_CODE;
-	}
 	
 	return EOK;
 }
 
-#endif /* CONFIG_NETWORKING_modular */
+#endif /* CONFIG_NETIF_NIL_BUNDLE */
 
 /** @}
Index: uspace/srv/net/nil/eth/eth.h
===================================================================
--- uspace/srv/net/nil/eth/eth.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/nil/eth/eth.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -147,25 +147,4 @@
 };
 
-/** Module initialization.
- *  Is called by the module_start() function.
- *  @param[in] net_phone The networking moduel phone.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module initialize function.
- */
-extern int nil_initialize(int net_phone);
-
-/** Message processing function.
- *  @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.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for each specific module message function.
- *  @see nil_interface.h
- *  @see IS_NET_NIL_MESSAGE()
- */
-extern int nil_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
-
 #endif
 
Index: uspace/srv/net/nil/eth/eth_module.c
===================================================================
--- uspace/srv/net/nil/eth/eth_module.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/nil/eth/eth_module.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -46,5 +46,5 @@
 #include <net_interface.h>
 #include <packet/packet.h>
-#include <nil_standalone.h>
+#include <nil_local.h>
 
 #include "eth.h"
@@ -58,36 +58,44 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int nil_module_start(async_client_conn_t client_connection){
+int nil_module_start_standalone(async_client_conn_t client_connection)
+{
 	ERROR_DECLARE;
-
+	
+	async_set_client_connection(client_connection);
+	int net_phone = net_connect_module(SERVICE_NETWORKING);
+	ERROR_PROPAGATE(pm_init());
+	
 	ipcarg_t phonehash;
-	int net_phone;
-
-	async_set_client_connection(client_connection);
-	net_phone = net_connect_module(SERVICE_NETWORKING);
-	ERROR_PROPAGATE(pm_init());
-	if(ERROR_OCCURRED(nil_initialize(net_phone))
-		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_ETHERNET, &phonehash))){
+	if (ERROR_OCCURRED(nil_initialize(net_phone))
+	    || ERROR_OCCURRED(REGISTER_ME(SERVICE_ETHERNET, &phonehash))) {
 		pm_destroy();
 		return ERROR_CODE;
 	}
-
+	
 	async_manager();
-
+	
 	pm_destroy();
 	return EOK;
 }
 
-/** Passes the parameters to the module specific nil_message() function.
- *  @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.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for each specific module message function.
+/** 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.
+ *
  */
-int nil_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	return nil_message(callid, call, answer, answer_count);
+int nil_module_message_standalone(const char *name, ipc_callid_t callid, ipc_call_t *call,
+    ipc_call_t *answer, int *answer_count)
+{
+	return nil_message_standalone(name, callid, call, answer, answer_count);
 }
 
Index: uspace/srv/net/nil/nildummy/Makefile
===================================================================
--- uspace/srv/net/nil/nildummy/Makefile	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/nil/nildummy/Makefile	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -29,7 +29,19 @@
 
 USPACE_PREFIX = ../../../..
-LIBS = $(LIBNETIF_PREFIX)/libnetif.a $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
-EXTRA_CFLAGS = -I$(LIBNETIF_PREFIX)/include -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
-BINARY = nildummy
+ROOT_PATH = $(USPACE_PREFIX)/..
+LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
+EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
+
+COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
+CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
+
+-include $(COMMON_MAKEFILE)
+-include $(CONFIG_MAKEFILE)
+
+ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y)
+	LIBRARY = libnildummy
+else
+	BINARY = nildummy
+endif
 
 SOURCES = \
Index: uspace/srv/net/nil/nildummy/nildummy.c
===================================================================
--- uspace/srv/net/nil/nildummy/nildummy.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/nil/nildummy/nildummy.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -28,10 +28,10 @@
 
 /** @addtogroup nildummy
- *  @{
+ * @{
  */
 
 /** @file
- *  Dummy network interface layer module implementation.
- *  @see nildummy.h
+ * Dummy network interface layer module implementation.
+ * @see nildummy.h
  */
 
@@ -41,5 +41,4 @@
 #include <stdio.h>
 #include <str.h>
-
 #include <ipc/ipc.h>
 #include <ipc/services.h>
@@ -54,113 +53,106 @@
 #include <adt/measured_strings.h>
 #include <packet/packet.h>
-#include <nil_module.h>
+#include <packet_remote.h>
+#include <nil_local.h>
 
 #include "nildummy.h"
 
 /** The module name.
- */
-#define NAME	"Dummy nil protocol"
+ *
+ */
+#define NAME  "nildummy"
 
 /** Default maximum transmission unit.
- */
-#define NET_DEFAULT_MTU	1500
+ *
+ */
+#define NET_DEFAULT_MTU  1500
 
 /** Network interface layer module global data.
- */
-nildummy_globals_t	nildummy_globals;
-
-/** @name Message processing functions
- */
-/*@{*/
-
-/** Processes IPC messages from the registered device driver modules in an infinite loop.
- *  @param[in] iid The message identifier.
- *  @param[in,out] icall The message parameters.
- */
-void nildummy_receiver(ipc_callid_t iid, ipc_call_t * icall);
-
-/** Registers new device or updates the MTU of an existing one.
- *  Determines the device local hardware address.
- *  @param[in] device_id The new device identifier.
- *  @param[in] service The device driver service.
- *  @param[in] mtu The device maximum transmission unit.
- *  @returns EOK on success.
- *  @returns EEXIST if the device with the different service exists.
- *  @returns ENOMEM if there is not enough memory left.
- *  @returns Other error codes as defined for the netif_bind_service() function.
- *  @returns Other error codes as defined for the netif_get_addr_req() function.
- */
-int nildummy_device_message(device_id_t device_id, services_t service, size_t mtu);
-
-/** Returns the device packet dimensions for sending.
- *  @param[in] device_id The device identifier.
- *  @param[out] addr_len The minimum reserved address length.
- *  @param[out] prefix The minimum reserved prefix size.
- *  @param[out] content The maximum content size.
- *  @param[out] suffix The minimum reserved suffix size.
- *  @returns EOK on success.
- *  @returns EBADMEM if either one of the parameters is NULL.
- *  @returns ENOENT if there is no such device.
- */
-int nildummy_packet_space_message(device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix);
-
-/** Registers receiving module service.
- *  Passes received packets for this service.
- *  @param[in] service The module service.
- *  @param[in] phone The service phone.
- *  @returns EOK on success.
- *  @returns ENOENT if the service is not known.
- *  @returns ENOMEM if there is not enough memory left.
- */
-int nildummy_register_message(services_t service, int phone);
-
-/** Sends the packet queue.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The packet queue.
- *  @param[in] sender The sending module service.
- *  @returns EOK on success.
- *  @returns ENOENT if there no such device.
- *  @returns EINVAL if the service parameter is not known.
- */
-int nildummy_send_message(device_id_t device_id, packet_t packet, services_t sender);
-
-/** Returns the device hardware address.
- *  @param[in] device_id The device identifier.
- *  @param[out] address The device hardware address.
- *  @returns EOK on success.
- *  @returns EBADMEM if the address parameter is NULL.
- *  @returns ENOENT if there no such device.
- */
-int nildummy_addr_message(device_id_t device_id, measured_string_ref * address);
-
-/*@}*/
-
-DEVICE_MAP_IMPLEMENT(nildummy_devices, nildummy_device_t)
-
-int nil_device_state_msg(int nil_phone, device_id_t device_id, int state){
+ *
+ */
+nildummy_globals_t nildummy_globals;
+
+DEVICE_MAP_IMPLEMENT(nildummy_devices, nildummy_device_t);
+
+int nil_device_state_msg_local(int nil_phone, device_id_t device_id, int state)
+{
 	fibril_rwlock_read_lock(&nildummy_globals.protos_lock);
-	if(nildummy_globals.proto.phone){
-		il_device_state_msg(nildummy_globals.proto.phone, device_id, state, nildummy_globals.proto.service);
-	}
+	
+	if (nildummy_globals.proto.phone)
+		il_device_state_msg(nildummy_globals.proto.phone, device_id, state,
+		    nildummy_globals.proto.service);
+	
 	fibril_rwlock_read_unlock(&nildummy_globals.protos_lock);
-	return EOK;
-}
-
-int nil_initialize(int net_phone){
+	
+	return EOK;
+}
+
+int nil_initialize(int net_phone)
+{
 	ERROR_DECLARE;
-
+	
 	fibril_rwlock_initialize(&nildummy_globals.devices_lock);
 	fibril_rwlock_initialize(&nildummy_globals.protos_lock);
 	fibril_rwlock_write_lock(&nildummy_globals.devices_lock);
 	fibril_rwlock_write_lock(&nildummy_globals.protos_lock);
+	
 	nildummy_globals.net_phone = net_phone;
 	nildummy_globals.proto.phone = 0;
 	ERROR_PROPAGATE(nildummy_devices_initialize(&nildummy_globals.devices));
+	
 	fibril_rwlock_write_unlock(&nildummy_globals.protos_lock);
 	fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
-	return EOK;
-}
-
-int nildummy_device_message(device_id_t device_id, services_t service, size_t mtu){
+	
+	return EOK;
+}
+
+/** Process IPC messages from the registered device driver modules in an infinite loop.
+ *
+ * @param[in]     iid   The message identifier.
+ * @param[in,out] icall The message parameters.
+ *
+ */
+static void nildummy_receiver(ipc_callid_t iid, ipc_call_t * icall){
+	ERROR_DECLARE;
+
+	packet_t packet;
+
+	while(true){
+		switch(IPC_GET_METHOD(*icall)){
+			case NET_NIL_DEVICE_STATE:
+				ERROR_CODE = nil_device_state_msg_local(0, IPC_GET_DEVICE(icall), IPC_GET_STATE(icall));
+				ipc_answer_0(iid, (ipcarg_t) ERROR_CODE);
+				break;
+			case NET_NIL_RECEIVED:
+				if(! ERROR_OCCURRED(packet_translate_remote(nildummy_globals.net_phone, &packet, IPC_GET_PACKET(icall)))){
+					ERROR_CODE = nil_received_msg_local(0, IPC_GET_DEVICE(icall), packet, 0);
+				}
+				ipc_answer_0(iid, (ipcarg_t) ERROR_CODE);
+				break;
+			default:
+				ipc_answer_0(iid, (ipcarg_t) ENOTSUP);
+		}
+		iid = async_get_call(icall);
+	}
+}
+
+/** Register new device or updates the MTU of an existing one.
+ *
+ * Determine the device local hardware address.
+ *
+ * @param[in] device_id The new device identifier.
+ * @param[in] service   The device driver service.
+ * @param[in] mtu       The device maximum transmission unit.
+ *
+ * @returns EOK on success.
+ * @returns EEXIST if the device with the different service exists.
+ * @returns ENOMEM if there is not enough memory left.
+ * @returns Other error codes as defined for the netif_bind_service() function.
+ * @returns Other error codes as defined for the netif_get_addr_req() function.
+ *
+ */
+static int nildummy_device_message(device_id_t device_id, services_t service,
+    size_t mtu)
+{
 	ERROR_DECLARE;
 
@@ -228,5 +220,6 @@
 			return index;
 		}
-		printf("New device registered:\n\tid\t= %d\n\tservice\t= %d\n\tMTU\t= %d\n", device->device_id, device->service, device->mtu);
+		printf("%s: Device registered (id: %d, service: %d, mtu: %d)\n",
+		    NAME, device->device_id, device->service, device->mtu);
 	}
 	fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
@@ -234,5 +227,17 @@
 }
 
-int nildummy_addr_message(device_id_t device_id, measured_string_ref * address){
+/** Return the device hardware address.
+ *
+ * @param[in]  device_id The device identifier.
+ * @param[out] address   The device hardware address.
+ *
+ * @return EOK on success.
+ * @return EBADMEM if the address parameter is NULL.
+ * @return ENOENT if there no such device.
+ *
+ */
+static int nildummy_addr_message(device_id_t device_id,
+    measured_string_ref *address)
+{
 	nildummy_device_ref device;
 
@@ -251,5 +256,20 @@
 }
 
-int nildummy_packet_space_message(device_id_t device_id, size_t * addr_len, size_t * prefix, size_t * content, size_t * suffix){
+/** Return the device packet dimensions for sending.
+ *
+ * @param[in]  device_id The device identifier.
+ * @param[out] addr_len  The minimum reserved address length.
+ * @param[out] prefix    The minimum reserved prefix size.
+ * @param[out] content   The maximum content size.
+ * @param[out] suffix    The minimum reserved suffix size.
+ *
+ * @return EOK on success.
+ * @return EBADMEM if either one of the parameters is NULL.
+ * @return ENOENT if there is no such device.
+ *
+ */
+static int nildummy_packet_space_message(device_id_t device_id,
+    size_t *addr_len, size_t *prefix, size_t *content, size_t *suffix)
+{
 	nildummy_device_ref device;
 
@@ -271,5 +291,5 @@
 }
 
-int nil_received_msg(int nil_phone, device_id_t device_id, packet_t packet, services_t target){
+int nil_received_msg_local(int nil_phone, device_id_t device_id, packet_t packet, services_t target){
 	packet_t next;
 
@@ -286,14 +306,43 @@
 }
 
-int nildummy_register_message(services_t service, int phone){
+/** Register receiving module service.
+ *
+ * Pass received packets for this service.
+ *
+ * @param[in] service The module service.
+ * @param[in] phone   The service phone.
+ *
+ * @return EOK on success.
+ * @return ENOENT if the service is not known.
+ * @return ENOMEM if there is not enough memory left.
+ *
+ */
+static int nildummy_register_message(services_t service, int phone)
+{
 	fibril_rwlock_write_lock(&nildummy_globals.protos_lock);
 	nildummy_globals.proto.service = service;
 	nildummy_globals.proto.phone = phone;
-	printf("New protocol registered:\n\tservice\t= %d\n\tphone\t= %d\n", nildummy_globals.proto.service, nildummy_globals.proto.phone);
+	
+	printf("%s: Protocol registered (service: %d, phone: %d)\n",
+	    NAME, nildummy_globals.proto.service, nildummy_globals.proto.phone);
+	
 	fibril_rwlock_write_unlock(&nildummy_globals.protos_lock);
 	return EOK;
 }
 
-int nildummy_send_message(device_id_t device_id, packet_t packet, services_t sender){
+/** Send the packet queue.
+ *
+ * @param[in] device_id The device identifier.
+ * @param[in] packet    The packet queue.
+ * @param[in] sender    The sending module service.
+ *
+ * @return EOK on success.
+ * @return ENOENT if there no such device.
+ * @return EINVAL if the service parameter is not known.
+ *
+ */
+static int nildummy_send_message(device_id_t device_id, packet_t packet,
+    services_t sender)
+{
 	nildummy_device_ref device;
 
@@ -312,7 +361,9 @@
 }
 
-int nil_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+int nil_message_standalone(const char *name, ipc_callid_t callid, ipc_call_t *call,
+    ipc_call_t *answer, int *answer_count)
+{
 	ERROR_DECLARE;
-
+	
 	measured_string_ref address;
 	packet_t packet;
@@ -321,17 +372,20 @@
 	size_t suffix;
 	size_t content;
-
-//	printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_NIL_FIRST);
+	
 	*answer_count = 0;
-	switch(IPC_GET_METHOD(*call)){
+	switch (IPC_GET_METHOD(*call)) {
 		case IPC_M_PHONE_HUNGUP:
 			return EOK;
 		case NET_NIL_DEVICE:
-			return nildummy_device_message(IPC_GET_DEVICE(call), IPC_GET_SERVICE(call), IPC_GET_MTU(call));
+			return nildummy_device_message(IPC_GET_DEVICE(call),
+			    IPC_GET_SERVICE(call), IPC_GET_MTU(call));
 		case NET_NIL_SEND:
-			ERROR_PROPAGATE(packet_translate(nildummy_globals.net_phone, &packet, IPC_GET_PACKET(call)));
-			return nildummy_send_message(IPC_GET_DEVICE(call), packet, IPC_GET_SERVICE(call));
+			ERROR_PROPAGATE(packet_translate_remote(nildummy_globals.net_phone,
+			    &packet, IPC_GET_PACKET(call)));
+			return nildummy_send_message(IPC_GET_DEVICE(call), packet,
+			    IPC_GET_SERVICE(call));
 		case NET_NIL_PACKET_SPACE:
-			ERROR_PROPAGATE(nildummy_packet_space_message(IPC_GET_DEVICE(call), &addrlen, &prefix, &content, &suffix));
+			ERROR_PROPAGATE(nildummy_packet_space_message(IPC_GET_DEVICE(call),
+			    &addrlen, &prefix, &content, &suffix));
 			IPC_SET_ADDR(answer, addrlen);
 			IPC_SET_PREFIX(answer, prefix);
@@ -341,48 +395,28 @@
 			return EOK;
 		case NET_NIL_ADDR:
-			ERROR_PROPAGATE(nildummy_addr_message(IPC_GET_DEVICE(call), &address));
+			ERROR_PROPAGATE(nildummy_addr_message(IPC_GET_DEVICE(call),
+			    &address));
+			return measured_strings_reply(address, 1);
+		case NET_NIL_BROADCAST_ADDR:
+			ERROR_PROPAGATE(nildummy_addr_message(IPC_GET_DEVICE(call),
+			    &address));
 			return measured_strings_reply(address, 1);
 		case IPC_M_CONNECT_TO_ME:
-			return nildummy_register_message(NIL_GET_PROTO(call), IPC_GET_PHONE(call));
-	}
+			return nildummy_register_message(NIL_GET_PROTO(call),
+			    IPC_GET_PHONE(call));
+	}
+	
 	return ENOTSUP;
 }
 
-void nildummy_receiver(ipc_callid_t iid, ipc_call_t * icall){
-	ERROR_DECLARE;
-
-	packet_t packet;
-
-	while(true){
-//		printf("message %d - %d\n", IPC_GET_METHOD(*icall), NET_NIL_FIRST);
-		switch(IPC_GET_METHOD(*icall)){
-			case NET_NIL_DEVICE_STATE:
-				ERROR_CODE = nil_device_state_msg(0, IPC_GET_DEVICE(icall), IPC_GET_STATE(icall));
-				ipc_answer_0(iid, (ipcarg_t) ERROR_CODE);
-				break;
-			case NET_NIL_RECEIVED:
-				if(! ERROR_OCCURRED(packet_translate(nildummy_globals.net_phone, &packet, IPC_GET_PACKET(icall)))){
-					ERROR_CODE = nil_received_msg(0, IPC_GET_DEVICE(icall), packet, 0);
-				}
-				ipc_answer_0(iid, (ipcarg_t) ERROR_CODE);
-				break;
-			default:
-				ipc_answer_0(iid, (ipcarg_t) ENOTSUP);
-		}
-		iid = async_get_call(icall);
-	}
-}
-
-#ifdef CONFIG_NETWORKING_modular
-
-#include <nil_standalone.h>
+#ifndef CONFIG_NETIF_NIL_BUNDLE
 
 /** 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)
+ * @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)
 {
 	/*
@@ -404,5 +438,6 @@
 		
 		/* Process the message */
-		int res = nil_module_message(callid, &call, &answer, &answer_count);
+		int res = nil_module_message_standalone(NAME, callid, &call, &answer,
+		    &answer_count);
 		
 		/* End if said to either by the message or the processing result */
@@ -415,30 +450,16 @@
 }
 
-/** Starts the module.
- *
- *  @param argc The count of the command line arguments. Ignored parameter.
- *  @param argv The command line parameters. Ignored parameter.
- *
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module start function.
- *
- */
 int main(int argc, char *argv[])
 {
 	ERROR_DECLARE;
 	
-	/* Print the module label */
-	printf("Task %d - %s\n", task_get_id(), NAME);
-	
 	/* Start the module */
-	if (ERROR_OCCURRED(nil_module_start(nil_client_connection))) {
-		printf(" - ERROR %i\n", ERROR_CODE);
+	if (ERROR_OCCURRED(nil_module_start_standalone(nil_client_connection)))
 		return ERROR_CODE;
-	}
-	
-	return EOK;
-}
-
-#endif /* CONFIG_NETWORKING_modular */
+	
+	return EOK;
+}
+
+#endif /* CONFIG_NETIF_NIL_BUNDLE */
 
 /** @}
Index: uspace/srv/net/nil/nildummy/nildummy_module.c
===================================================================
--- uspace/srv/net/nil/nildummy/nildummy_module.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/nil/nildummy/nildummy_module.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -46,49 +46,64 @@
 #include <net_interface.h>
 #include <packet/packet.h>
-#include <nil_module.h>
-#include <nil_standalone.h>
+#include <nil_local.h>
 
 #include "nildummy.h"
 
-/** Starts the dummy nil module.
- *  Initializes the client connection serving function, initializes the module, registers the module service and starts 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.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the pm_init() function.
- *  @returns Other error codes as defined for the nil_initialize() function.
- *  @returns Other error codes as defined for the REGISTER_ME() macro function.
+/** Start the dummy nil 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.
+ *
  */
-int nil_module_start(async_client_conn_t client_connection){
+int nil_module_start_standalone(async_client_conn_t client_connection)
+{
 	ERROR_DECLARE;
-
+	
+	async_set_client_connection(client_connection);
+	int net_phone = net_connect_module(SERVICE_NETWORKING);
+	ERROR_PROPAGATE(pm_init());
+	
 	ipcarg_t phonehash;
-	int net_phone;
-
-	async_set_client_connection(client_connection);
-	net_phone = net_connect_module(SERVICE_NETWORKING);
-	ERROR_PROPAGATE(pm_init());
-	if(ERROR_OCCURRED(nil_initialize(net_phone))
-		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_NILDUMMY, &phonehash))){
+	if (ERROR_OCCURRED(nil_initialize(net_phone))
+	    || ERROR_OCCURRED(REGISTER_ME(SERVICE_NILDUMMY, &phonehash))){
 		pm_destroy();
 		return ERROR_CODE;
 	}
-
+	
 	async_manager();
-
+	
 	pm_destroy();
 	return EOK;
 }
 
-/** Passes the parameters to the module specific nil_message() function.
- *  @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.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for each specific module message function.
+/** 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.
+ *
  */
-int nil_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	return nil_message(callid, call, answer, answer_count);
+int nil_module_message_standalone(const char *name, ipc_callid_t callid,
+    ipc_call_t *call, ipc_call_t *answer, int *answer_count)
+{
+	return nil_message_standalone(name, callid, call, answer, answer_count);
 }
 
Index: uspace/srv/net/tl/icmp/icmp.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/tl/icmp/icmp.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -51,4 +51,5 @@
 #include <net_modules.h>
 #include <packet/packet_client.h>
+#include <packet_remote.h>
 #include <net_byteorder.h>
 #include <net_checksum.h>
@@ -67,4 +68,6 @@
 #include <socket_errno.h>
 #include <tl_messages.h>
+#include <tl_interface.h>
+#include <tl_local.h>
 #include <icmp_messages.h>
 #include <icmp_header.h>
@@ -288,5 +291,5 @@
 	// TODO do not ask all the time
 	ERROR_PROPAGATE(ip_packet_size_req(icmp_globals.ip_phone, -1, &icmp_globals.packet_dimension));
-	packet = packet_get_4(icmp_globals.net_phone, size, icmp_globals.packet_dimension.addr_len, ICMP_HEADER_SIZE + icmp_globals.packet_dimension.prefix, icmp_globals.packet_dimension.suffix);
+	packet = packet_get_4_remote(icmp_globals.net_phone, size, icmp_globals.packet_dimension.addr_len, ICMP_HEADER_SIZE + icmp_globals.packet_dimension.prefix, icmp_globals.packet_dimension.suffix);
 	if(! packet){
 		return ENOMEM;
@@ -626,5 +629,5 @@
 	// compute the reply key
 	reply_key = ICMP_GET_REPLY_KEY(header->un.echo.identifier, header->un.echo.sequence_number);
-	pq_release(icmp_globals.net_phone, packet_get_id(packet));
+	pq_release_remote(icmp_globals.net_phone, packet_get_id(packet));
 	// lock the globals
 	fibril_rwlock_write_lock(&icmp_globals.lock);
@@ -641,5 +644,5 @@
 }
 
-int icmp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+int icmp_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	ERROR_DECLARE;
 
@@ -649,5 +652,5 @@
 	switch(IPC_GET_METHOD(*call)){
 		case NET_TL_RECEIVED:
-			if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+			if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
 				ERROR_CODE = icmp_received_msg(IPC_GET_DEVICE(call), packet, SERVICE_ICMP, IPC_GET_ERROR(call));
 			}
@@ -759,20 +762,20 @@
 	switch(IPC_GET_METHOD(*call)){
 		case NET_ICMP_DEST_UNREACH:
-			if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+			if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
 				ERROR_CODE = icmp_destination_unreachable_msg(0, ICMP_GET_CODE(call), ICMP_GET_MTU(call), packet);
 			}
 			return ERROR_CODE;
 		case NET_ICMP_SOURCE_QUENCH:
-			if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+			if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
 				ERROR_CODE = icmp_source_quench_msg(0, packet);
 			}
 			return ERROR_CODE;
 		case NET_ICMP_TIME_EXCEEDED:
-			if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+			if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
 				ERROR_CODE = icmp_time_exceeded_msg(0, ICMP_GET_CODE(call), packet);
 			}
 			return ERROR_CODE;
 		case NET_ICMP_PARAMETERPROB:
-			if(! ERROR_OCCURRED(packet_translate(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+			if(! ERROR_OCCURRED(packet_translate_remote(icmp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
 				ERROR_CODE = icmp_parameter_problem_msg(0, ICMP_GET_CODE(call), ICMP_GET_POINTER(call), packet);
 			}
@@ -784,5 +787,5 @@
 
 int icmp_release_and_return(packet_t packet, int result){
-	pq_release(icmp_globals.net_phone, packet_get_id(packet));
+	pq_release_remote(icmp_globals.net_phone, packet_get_id(packet));
 	return result;
 }
@@ -819,8 +822,4 @@
 }
 
-#ifdef CONFIG_NETWORKING_modular
-
-#include <tl_standalone.h>
-
 /** Default thread for new connections.
  *
@@ -849,5 +848,6 @@
 		
 		/* Process the message */
-		int res = tl_module_message(callid, &call, &answer, &answer_count);
+		int res = tl_module_message_standalone(callid, &call, &answer,
+		    &answer_count);
 		
 		/* End if said to either by the message or the processing result */
@@ -873,18 +873,11 @@
 	ERROR_DECLARE;
 	
-	/* Print the module label */
-	printf("Task %d - %s\n", task_get_id(), NAME);
-	
 	/* Start the module */
-	if (ERROR_OCCURRED(tl_module_start(tl_client_connection))) {
-		printf(" - ERROR %i\n", ERROR_CODE);
+	if (ERROR_OCCURRED(tl_module_start_standalone(tl_client_connection)))
 		return ERROR_CODE;
-	}
 	
 	return EOK;
 }
 
-#endif /* CONFIG_NETWORKING_modular */
-
 /** @}
  */
Index: uspace/srv/net/tl/icmp/icmp_module.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp_module.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/tl/icmp/icmp_module.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -47,5 +47,5 @@
 #include <packet/packet.h>
 #include <net_interface.h>
-#include <tl_standalone.h>
+#include <tl_local.h>
 
 #include "icmp.h"
@@ -63,5 +63,5 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int tl_module_start(async_client_conn_t client_connection){
+int tl_module_start_standalone(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
@@ -94,6 +94,6 @@
  *  @returns Other error codes as defined for the icmp_message() function.
  */
-int tl_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	return icmp_message(callid, call, answer, answer_count);
+int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return icmp_message_standalone(callid, call, answer, answer_count);
 }
 
Index: uspace/srv/net/tl/icmp/icmp_module.h
===================================================================
--- uspace/srv/net/tl/icmp/icmp_module.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/tl/icmp/icmp_module.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -59,5 +59,5 @@
  *  @see IS_NET_ICMP_MESSAGE()
  */
-int icmp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
+int icmp_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 #endif
Index: uspace/srv/net/tl/tcp/tcp.c
===================================================================
--- uspace/srv/net/tl/tcp/tcp.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/tl/tcp/tcp.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -51,4 +51,5 @@
 #include <adt/dynamic_fifo.h>
 #include <packet/packet_client.h>
+#include <packet_remote.h>
 #include <net_checksum.h>
 #include <in.h>
@@ -68,4 +69,6 @@
 #include <tl_common.h>
 #include <tl_messages.h>
+#include <tl_local.h>
+#include <tl_interface.h>
 
 #include "tcp.h"
@@ -421,5 +424,5 @@
 			break;
 		default:
-			pq_release(tcp_globals.net_phone, packet_get_id(packet));
+			pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 	}
 
@@ -473,5 +476,5 @@
 			// release the acknowledged packets
 			next_packet = pq_next(packet);
-			pq_release(tcp_globals.net_phone, packet_get_id(packet));
+			pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 			packet = next_packet;
 			offset -= length;
@@ -517,5 +520,5 @@
 			next_packet = pq_next(next_packet);
 			pq_insert_after(tmp_packet, next_packet);
-			pq_release(tcp_globals.net_phone, packet_get_id(tmp_packet));
+			pq_release_remote(tcp_globals.net_phone, packet_get_id(tmp_packet));
 		}
 		assert(new_sequence_number + total_length == socket_data->next_incoming + socket_data->window);
@@ -548,5 +551,5 @@
 					socket_data->incoming = next_packet;
 				}
-				pq_release(tcp_globals.net_phone, packet_get_id(packet));
+				pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 				packet = next_packet;
 				continue;
@@ -568,5 +571,5 @@
 				if(length <= 0){
 					// remove the empty packet
-					pq_release(tcp_globals.net_phone, packet_get_id(packet));
+					pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 					packet = next_packet;
 					continue;
@@ -595,5 +598,5 @@
 				}
 				// remove the duplicit or corrupted packet
-				pq_release(tcp_globals.net_phone, packet_get_id(packet));
+				pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 				packet = next_packet;
 				continue;
@@ -617,6 +620,6 @@
 		if(ERROR_OCCURRED(pq_add(&socket_data->incoming, packet, new_sequence_number, length))){
 			// remove the corrupted packets
-			pq_release(tcp_globals.net_phone, packet_get_id(packet));
-			pq_release(tcp_globals.net_phone, packet_get_id(next_packet));
+			pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
+			pq_release_remote(tcp_globals.net_phone, packet_get_id(next_packet));
 		}else{
 			while(next_packet){
@@ -626,5 +629,5 @@
 				if(ERROR_OCCURRED(pq_set_order(next_packet, new_sequence_number, length))
 					|| ERROR_OCCURRED(pq_insert_after(packet, next_packet))){
-					pq_release(tcp_globals.net_phone, packet_get_id(next_packet));
+					pq_release_remote(tcp_globals.net_phone, packet_get_id(next_packet));
 				}
 				next_packet = tmp_packet;
@@ -634,5 +637,5 @@
 		printf("unexpected\n");
 		// release duplicite or restricted
-		pq_release(tcp_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 	}
 
@@ -679,5 +682,5 @@
 	// queue the received packet
 	if(ERROR_OCCURRED(dyn_fifo_push(&socket->received, packet_get_id(packet), SOCKET_MAX_RECEIVED_SIZE))
-		|| ERROR_OCCURRED(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, socket_data->device_id, &packet_dimension))){
+	    || ERROR_OCCURRED(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, socket_data->device_id, &packet_dimension))){
 		return tcp_release_and_return(packet, ERROR_CODE);
 	}
@@ -710,5 +713,5 @@
 		next_packet = pq_detach(packet);
 		if(next_packet){
-			pq_release(tcp_globals.net_phone, packet_get_id(next_packet));
+			pq_release_remote(tcp_globals.net_phone, packet_get_id(next_packet));
 		}
 		// trim if longer than the header
@@ -780,5 +783,5 @@
 				free(socket_data->addr);
 				free(socket_data);
-				pq_release(tcp_globals.net_phone, packet_get_id(packet));
+				pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 				return ERROR_CODE;
 			}
@@ -846,5 +849,5 @@
 			next_packet = pq_detach(packet);
 			if(next_packet){
-				pq_release(tcp_globals.net_phone, packet_get_id(next_packet));
+				pq_release_remote(tcp_globals.net_phone, packet_get_id(next_packet));
 			}
 			// trim if longer than the header
@@ -895,5 +898,5 @@
 
 		socket_data->next_incoming = ntohl(header->sequence_number);// + 1;
-		pq_release(tcp_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 		socket_data->state = TCP_SOCKET_ESTABLISHED;
 		listening_socket = socket_cores_find(socket_data->local_sockets, socket_data->listening_socket_id);
@@ -981,5 +984,5 @@
 					// add to acknowledged or release
 					if(pq_add(&acknowledged, packet, 0, 0) != EOK){
-						pq_release(tcp_globals.net_phone, packet_get_id(packet));
+						pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 					}
 					packet = next;
@@ -990,5 +993,5 @@
 			// release acknowledged
 			if(acknowledged){
-				pq_release(tcp_globals.net_phone, packet_get_id(acknowledged));
+				pq_release_remote(tcp_globals.net_phone, packet_get_id(acknowledged));
 			}
 			return;
@@ -1006,5 +1009,5 @@
 }
 
-int tcp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+int tcp_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	ERROR_DECLARE;
 
@@ -1019,5 +1022,5 @@
 		case NET_TL_RECEIVED:
 			//fibril_rwlock_read_lock(&tcp_globals.lock);
-			if(! ERROR_OCCURRED(packet_translate(tcp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+			if(! ERROR_OCCURRED(packet_translate_remote(tcp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
 				ERROR_CODE = tcp_received_msg(IPC_GET_DEVICE(call), packet, SERVICE_TCP, IPC_GET_ERROR(call));
 			}
@@ -1111,5 +1114,5 @@
 					fibril_rwlock_write_unlock(&lock);
 					if(res == EOK){
-						if(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){
+						if (tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){
 							SOCKET_SET_DATA_FRAGMENT_SIZE(answer, ((packet_dimension->content < socket_data->data_fragment_size) ? packet_dimension->content : socket_data->data_fragment_size));
 						}
@@ -1565,5 +1568,5 @@
 			}else{
 				if(ERROR_OCCURRED(pq_insert_after(previous, copy))){
-					pq_release(tcp_globals.net_phone, packet_get_id(copy));
+					pq_release_remote(tcp_globals.net_phone, packet_get_id(copy));
 					return sending;
 				}
@@ -1597,5 +1600,5 @@
 	// adjust the pseudo header
 	if(ERROR_OCCURRED(ip_client_set_pseudo_header_data_length(socket_data->pseudo_header, socket_data->headerlen, packet_get_data_length(packet)))){
-		pq_release(tcp_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 		return NULL;
 	}
@@ -1604,5 +1607,5 @@
 	header = (tcp_header_ref) packet_get_data(packet);
 	if(! header){
-		pq_release(tcp_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 		return NULL;
 	}
@@ -1625,5 +1628,5 @@
 	// prepare the timeout
 		|| ERROR_OCCURRED(tcp_prepare_timeout(tcp_timeout, socket, socket_data, sequence_number, socket_data->state, socket_data->timeout, true))){
-		pq_release(tcp_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 		return NULL;
 	}
@@ -1750,5 +1753,5 @@
 		return NO_DATA;
 	}
-	ERROR_PROPAGATE(packet_translate(tcp_globals.net_phone, &packet, packet_id));
+	ERROR_PROPAGATE(packet_translate_remote(tcp_globals.net_phone, &packet, packet_id));
 
 	// reply the packets
@@ -1757,5 +1760,5 @@
 	// release the packet
 	dyn_fifo_pop(&socket->received);
-	pq_release(tcp_globals.net_phone, packet_get_id(packet));
+	pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 	// return the total length
 	return (int) length;
@@ -1889,5 +1892,5 @@
 	ERROR_PROPAGATE(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, socket_data->device_id, &packet_dimension));
 	// get a new packet
-	*packet = packet_get_4(tcp_globals.net_phone, TCP_HEADER_SIZE, packet_dimension->addr_len, packet_dimension->prefix, packet_dimension->suffix);
+	*packet = packet_get_4_remote(tcp_globals.net_phone, TCP_HEADER_SIZE, packet_dimension->addr_len, packet_dimension->prefix, packet_dimension->suffix);
 	if(! * packet){
 		return ENOMEM;
@@ -1993,11 +1996,7 @@
 
 int tcp_release_and_return(packet_t packet, int result){
-	pq_release(tcp_globals.net_phone, packet_get_id(packet));
+	pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 	return result;
 }
-
-#ifdef CONFIG_NETWORKING_modular
-
-#include <tl_standalone.h>
 
 /** Default thread for new connections.
@@ -2027,5 +2026,6 @@
 		
 		/* Process the message */
-		int res = tl_module_message(callid, &call, &answer, &answer_count);
+		int res = tl_module_message_standalone(callid, &call, &answer,
+		    &answer_count);
 		
 		/* End if said to either by the message or the processing result */
@@ -2051,18 +2051,11 @@
 	ERROR_DECLARE;
 	
-	/* Print the module label */
-	printf("Task %d - %s\n", task_get_id(), NAME);
-	
 	/* Start the module */
-	if (ERROR_OCCURRED(tl_module_start(tl_client_connection))) {
-		printf(" - ERROR %i\n", ERROR_CODE);
+	if (ERROR_OCCURRED(tl_module_start_standalone(tl_client_connection)))
 		return ERROR_CODE;
-	}
 	
 	return EOK;
 }
 
-#endif /* CONFIG_NETWORKING_modular */
-
 /** @}
  */
Index: uspace/srv/net/tl/tcp/tcp.h
===================================================================
--- uspace/srv/net/tl/tcp/tcp.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/tl/tcp/tcp.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -232,5 +232,5 @@
 	/** IP pseudo header.
 	 */
-	ip_pseudo_header_ref pseudo_header;
+	void *pseudo_header;
 	/** IP pseudo header length.
 	 */
Index: uspace/srv/net/tl/tcp/tcp_module.c
===================================================================
--- uspace/srv/net/tl/tcp/tcp_module.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/tl/tcp/tcp_module.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -49,5 +49,5 @@
 #include <ip_protocols.h>
 #include <ip_interface.h>
-#include <tl_standalone.h>
+#include <tl_local.h>
 
 #include "tcp.h"
@@ -65,20 +65,21 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int tl_module_start(async_client_conn_t client_connection){
+int tl_module_start_standalone(async_client_conn_t client_connection)
+{
 	ERROR_DECLARE;
-
-	ipcarg_t phonehash;
-
+	
 	async_set_client_connection(client_connection);
 	tcp_globals.net_phone = net_connect_module(SERVICE_NETWORKING);
 	ERROR_PROPAGATE(pm_init());
-	if(ERROR_OCCURRED(tcp_initialize(client_connection))
-		|| ERROR_OCCURRED(REGISTER_ME(SERVICE_TCP, &phonehash))){
+	
+	ipcarg_t phonehash;
+	if (ERROR_OCCURRED(tcp_initialize(client_connection))
+	    || ERROR_OCCURRED(REGISTER_ME(SERVICE_TCP, &phonehash))) {
 		pm_destroy();
 		return ERROR_CODE;
 	}
-
+	
 	async_manager();
-
+	
 	pm_destroy();
 	return EOK;
@@ -93,6 +94,6 @@
  *  @returns Other error codes as defined for the tcp_message() function.
  */
-int tl_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	return tcp_message(callid, call, answer, answer_count);
+int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return tcp_message_standalone(callid, call, answer, answer_count);
 }
 
Index: uspace/srv/net/tl/tcp/tcp_module.h
===================================================================
--- uspace/srv/net/tl/tcp/tcp_module.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/tl/tcp/tcp_module.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -59,5 +59,5 @@
  *  @see IS_NET_TCP_MESSAGE()
  */
-extern int tcp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
+extern int tcp_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 #endif
Index: uspace/srv/net/tl/udp/udp.c
===================================================================
--- uspace/srv/net/tl/udp/udp.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/tl/udp/udp.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -48,4 +48,5 @@
 #include <adt/dynamic_fifo.h>
 #include <packet/packet_client.h>
+#include <packet_remote.h>
 #include <net_checksum.h>
 #include <in.h>
@@ -63,4 +64,6 @@
 #include <socket_messages.h>
 #include <tl_common.h>
+#include <tl_local.h>
+#include <tl_interface.h>
 #include <tl_messages.h>
 
@@ -258,5 +261,5 @@
 	icmp_type_t type;
 	icmp_code_t code;
-	ip_pseudo_header_ref ip_header;
+	void *ip_header;
 	struct sockaddr * src;
 	struct sockaddr * dest;
@@ -356,5 +359,5 @@
 			while(tmp_packet){
 				next_packet = pq_detach(tmp_packet);
-				pq_release(udp_globals.net_phone, packet_get_id(tmp_packet));
+				pq_release_remote(udp_globals.net_phone, packet_get_id(tmp_packet));
 				tmp_packet = next_packet;
 			}
@@ -382,5 +385,5 @@
 	// queue the received packet
 	if(ERROR_OCCURRED(dyn_fifo_push(&socket->received, packet_get_id(packet), SOCKET_MAX_RECEIVED_SIZE))
-		|| ERROR_OCCURRED(tl_get_ip_packet_dimension(udp_globals.ip_phone, &udp_globals.dimensions, device_id, &packet_dimension))){
+	    || ERROR_OCCURRED(tl_get_ip_packet_dimension(udp_globals.ip_phone, &udp_globals.dimensions, device_id, &packet_dimension))){
 		return udp_release_and_return(packet, ERROR_CODE);
 	}
@@ -392,5 +395,5 @@
 }
 
-int udp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+int udp_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	ERROR_DECLARE;
 
@@ -400,5 +403,5 @@
 	switch(IPC_GET_METHOD(*call)){
 		case NET_TL_RECEIVED:
-			if(! ERROR_OCCURRED(packet_translate(udp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+			if(! ERROR_OCCURRED(packet_translate_remote(udp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
 				ERROR_CODE = udp_received_msg(IPC_GET_DEVICE(call), packet, SERVICE_UDP, IPC_GET_ERROR(call));
 			}
@@ -457,5 +460,5 @@
 
 				if(res == EOK){
-					if(tl_get_ip_packet_dimension(udp_globals.ip_phone, &udp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){
+					if (tl_get_ip_packet_dimension(udp_globals.ip_phone, &udp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){
 						SOCKET_SET_DATA_FRAGMENT_SIZE(answer, packet_dimension->content);
 					}
@@ -533,5 +536,5 @@
 	uint16_t dest_port;
 	uint32_t checksum;
-	ip_pseudo_header_ref ip_header;
+	void *ip_header;
 	size_t headerlen;
 	device_id_t device_id;
@@ -662,9 +665,9 @@
 		return NO_DATA;
 	}
-	ERROR_PROPAGATE(packet_translate(udp_globals.net_phone, &packet, packet_id));
+	ERROR_PROPAGATE(packet_translate_remote(udp_globals.net_phone, &packet, packet_id));
 	// get udp header
 	data = packet_get_data(packet);
 	if(! data){
-		pq_release(udp_globals.net_phone, packet_id);
+		pq_release_remote(udp_globals.net_phone, packet_id);
 		return NO_DATA;
 	}
@@ -674,5 +677,5 @@
 	result = packet_get_addr(packet, (uint8_t **) &addr, NULL);
 	if(ERROR_OCCURRED(tl_set_address_port(addr, result, ntohs(header->source_port)))){
-		pq_release(udp_globals.net_phone, packet_id);
+		pq_release_remote(udp_globals.net_phone, packet_id);
 		return ERROR_CODE;
 	}
@@ -689,5 +692,5 @@
 	// release the packet
 	dyn_fifo_pop(&socket->received);
-	pq_release(udp_globals.net_phone, packet_get_id(packet));
+	pq_release_remote(udp_globals.net_phone, packet_get_id(packet));
 	// return the total length
 	return (int) length;
@@ -695,11 +698,7 @@
 
 int udp_release_and_return(packet_t packet, int result){
-	pq_release(udp_globals.net_phone, packet_get_id(packet));
+	pq_release_remote(udp_globals.net_phone, packet_get_id(packet));
 	return result;
 }
-
-#ifdef CONFIG_NETWORKING_modular
-
-#include <tl_standalone.h>
 
 /** Default thread for new connections.
@@ -729,5 +728,6 @@
 		
 		/* Process the message */
-		int res = tl_module_message(callid, &call, &answer, &answer_count);
+		int res = tl_module_message_standalone(callid, &call, &answer,
+		    &answer_count);
 		
 		/* End if said to either by the message or the processing result */
@@ -753,18 +753,11 @@
 	ERROR_DECLARE;
 	
-	/* Print the module label */
-	printf("Task %d - %s\n", task_get_id(), NAME);
-	
 	/* Start the module */
-	if (ERROR_OCCURRED(tl_module_start(tl_client_connection))) {
-		printf(" - ERROR %i\n", ERROR_CODE);
+	if (ERROR_OCCURRED(tl_module_start_standalone(tl_client_connection)))
 		return ERROR_CODE;
-	}
 	
 	return EOK;
 }
 
-#endif /* CONFIG_NETWORKING_modular */
-
 /** @}
  */
Index: uspace/srv/net/tl/udp/udp_module.c
===================================================================
--- uspace/srv/net/tl/udp/udp_module.c	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/tl/udp/udp_module.c	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -47,5 +47,5 @@
 #include <packet/packet.h>
 #include <net_interface.h>
-#include <tl_standalone.h>
+#include <tl_local.h>
 
 #include "udp.h"
@@ -63,5 +63,5 @@
  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
  */
-int tl_module_start(async_client_conn_t client_connection){
+int tl_module_start_standalone(async_client_conn_t client_connection){
 	ERROR_DECLARE;
 
@@ -94,6 +94,6 @@
  *  @returns Other error codes as defined for the udp_message() function.
  */
-int tl_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
-	return udp_message(callid, call, answer, answer_count);
+int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+	return udp_message_standalone(callid, call, answer, answer_count);
 }
 
Index: uspace/srv/net/tl/udp/udp_module.h
===================================================================
--- uspace/srv/net/tl/udp/udp_module.h	(revision 074444f189ee9356421b26e70454fae61c81def3)
+++ uspace/srv/net/tl/udp/udp_module.h	(revision 75ebb5b6271b6a2c74a51ea695d73085ed9b97db)
@@ -59,5 +59,5 @@
  *  @see IS_NET_UDP_MESSAGE()
  */
-extern int udp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
+extern int udp_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
 
 #endif
