Index: uspace/srv/net/Doxyfile
===================================================================
--- uspace/srv/net/Doxyfile	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/Doxyfile	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -6,5 +6,5 @@
 DOXYFILE_ENCODING      = UTF-8
 PROJECT_NAME           = "Networking and TCP/IP stack for HelenOS system"
-PROJECT_NUMBER         = ""
+PROJECT_NUMBER         = "Master thesis 2009"
 OUTPUT_DIRECTORY       = doc/
 CREATE_SUBDIRS         = YES
Index: uspace/srv/net/Makefile
===================================================================
--- uspace/srv/net/Makefile	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/Makefile	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -29,14 +29,5 @@
 include ../../../Makefile.config
 
-# keep netif drivers before nil modules
-# in order to support networking architectures build
-
-ifeq ($(CONFIG_NETIF_DP8390),y)
-	DIRS = netif/dp8390
-else
-	DIRS =
-endif
-
-DIRS += \
+DIRS = \
 	netif/lo \
 	nil/eth \
@@ -56,4 +47,8 @@
 		tl/udp \
 		tl/tcp \
+
+ifeq ($(CONFIG_NETIF_DP8390),y)
+	DIRS += netif/dp8390
+endif
 
 DIRS_ALL = $(DIRS) $(DIRS_MODULAR)
Index: uspace/srv/net/app/echo/echo.c
===================================================================
--- uspace/srv/net/app/echo/echo.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/app/echo/echo.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -55,8 +55,4 @@
 #define NAME	"Echo"
 
-/** Prints the application help.
- */
-void echo_print_help(void);
-
 /** Module entry point.
  *  Reads command line parameters and starts listenning.
@@ -66,4 +62,22 @@
  */
 int main(int argc, char * argv[]);
+
+/** Prints the application help.
+ */
+void echo_print_help(void);
+
+/** 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.
+ */
+int echo_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.
+ */
+int echo_parse_socket_type(const char * name);
 
 void echo_print_help(void){
@@ -101,4 +115,22 @@
 }
 
+int echo_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 echo_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;
+}
+
 int main(int argc, char * argv[]){
 	ERROR_DECLARE;
@@ -106,14 +138,14 @@
 	size_t size			= 1024;
 	int verbose			= 0;
-	char * reply		= NULL;
-	sock_type_t type	= SOCK_DGRAM;
+	char * reply			= NULL;
+	sock_type_t type			= SOCK_DGRAM;
 	int count			= -1;
 	int family			= PF_INET;
-	uint16_t port		= 7;
+	uint16_t port			= 7;
 	int backlog			= 3;
 
-	socklen_t max_length				= sizeof(struct sockaddr_in6);
+	socklen_t max_length		= sizeof(struct sockaddr_in6);
 	uint8_t address_data[max_length];
-	struct sockaddr * address			= (struct sockaddr *) address_data;
+	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;
@@ -123,5 +155,5 @@
 	int socket_id;
 	int listening_id;
-	char * data;
+	char * 				data;
 	size_t length;
 	int index;
@@ -129,9 +161,7 @@
 	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){
 		if(argv[index][0] == '-'){
@@ -144,5 +174,5 @@
 					break;
 				case 'f':
-					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 0, parse_protocol_family));
+					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 0, echo_parse_protocol_family));
 					break;
 				case 'h':
@@ -162,5 +192,5 @@
 					break;
 				case 't':
-					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 0, parse_socket_type));
+					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 0, echo_parse_socket_type));
 					type = (sock_type_t) value;
 					break;
@@ -168,5 +198,4 @@
 					verbose = 1;
 					break;
-				// long options with the double minus sign ('-')
 				case '-':
 					if(str_lcmp(argv[index] + 2, "backlog=", 6) == 0){
@@ -175,5 +204,5 @@
 						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &count, "message 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(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 9, echo_parse_protocol_family));
 					}else if(str_lcmp(argv[index] + 2, "help", 5) == 0){
 						echo_print_help();
@@ -188,5 +217,5 @@
 						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(parse_parameter_name_int(argc, argv, &index, &value, "socket type", 7, echo_parse_socket_type));
 						type = (sock_type_t) value;
 					}else if(str_lcmp(argv[index] + 2, "verbose", 8) == 0){
@@ -210,10 +239,9 @@
 	}
 
-	// check the buffer size
 	if(size <= 0){
 		fprintf(stderr, "Receive size too small (%d). Using 1024 bytes instead.\n", size);
 		size = 1024;
 	}
-	// size plus the terminating null (\0)
+	// size plus terminating null (\0)
 	data = (char *) malloc(size + 1);
 	if(! data){
@@ -222,8 +250,12 @@
 	}
 
-	// set the reply size if set
 	reply_length = reply ? str_length(reply) : 0;
 
-	// prepare the address buffer
+	listening_id = socket(family, type, 0);
+	if(listening_id < 0){
+		socket_print_error(stderr, listening_id, "Socket create: ", "\n");
+		return listening_id;
+	}
+
 	bzero(address_data, max_length);
 	switch(family){
@@ -243,5 +275,4 @@
 	}
 
-	// get a listening socket
 	listening_id = socket(family, type, 0);
 	if(listening_id < 0){
@@ -250,12 +281,9 @@
 	}
 
-	// if the stream socket is used
 	if(type == SOCK_STREAM){
-		// check the backlog
 		if(backlog <= 0){
 			fprintf(stderr, "Accepted sockets queue size too small (%d). Using 3 instead.\n", size);
 			backlog = 3;
 		}
-		// set the backlog
 		if(ERROR_OCCURRED(listen(listening_id, backlog))){
 			socket_print_error(stderr, ERROR_CODE, "Socket listen: ", "\n");
@@ -264,5 +292,4 @@
 	}
 
-	// bind the listenning socket
 	if(ERROR_OCCURRED(bind(listening_id, address, addrlen))){
 		socket_print_error(stderr, ERROR_CODE, "Socket bind: ", "\n");
@@ -276,11 +303,7 @@
 	socket_id = listening_id;
 
-	// do count times
-	// or indefinitely if set to a negative value
 	while(count){
-
 		addrlen = max_length;
 		if(type == SOCK_STREAM){
-			// acceept a socket if the stream socket is used
 			socket_id = accept(listening_id, address, &addrlen);
 			if(socket_id <= 0){
@@ -292,9 +315,5 @@
 			}
 		}
-
-		// if the datagram socket is used or the stream socked was accepted
 		if(socket_id > 0){
-
-			// receive an echo request
 			value = recvfrom(socket_id, data, size, 0, address, &addrlen);
 			if(value < 0){
@@ -303,7 +322,4 @@
 				length = (size_t) value;
 				if(verbose){
-					// print the header
-
-					// get the source port and prepare the address buffer
 					address_start = NULL;
 					switch(address->sa_family){
@@ -319,5 +335,4 @@
 							fprintf(stderr, "Address family %d (0x%X) is not supported.\n", address->sa_family);
 					}
-					// parse the source address
 					if(address_start){
 						if(ERROR_OCCURRED(inet_ntop(address->sa_family, address_start, address_string, sizeof(address_string)))){
@@ -329,13 +344,8 @@
 					}
 				}
-
-				// answer the request either with the static reply or the original data
 				if(ERROR_OCCURRED(sendto(socket_id, reply ? reply : data, reply ? reply_length : length, 0, address, addrlen))){
 					socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
 				}
-
-			}
-
-			// close the accepted stream socket
+			}
 			if(type == SOCK_STREAM){
 				if(ERROR_OCCURRED(closesocket(socket_id))){
@@ -343,8 +353,5 @@
 				}
 			}
-
-		}
-
-		// decrease the count if positive
+		}
 		if(count > 0){
 			-- count;
@@ -359,5 +366,4 @@
 	}
 
-	// close the listenning socket
 	if(ERROR_OCCURRED(closesocket(listening_id))){
 		socket_print_error(stderr, ERROR_CODE, "Close socket: ", "\n");
Index: pace/srv/net/app/nettest.c
===================================================================
--- uspace/srv/net/app/nettest.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ 	(revision )
@@ -1,202 +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 nettest
- *  @{
- */
-
-/** @file
- *  Networking test support functions implementation.
- */
-
-#include <stdio.h>
-
-#include "../include/socket.h"
-
-#include "../err.h"
-
-#include "nettest.h"
-#include "print_error.h"
-
-int sockets_create(int verbose, int * socket_ids, int sockets, int family, sock_type_t type){
-	int index;
-
-	if(verbose){
-		printf("Create\t");
-	}
-	fflush(stdout);
-	for(index = 0; index < sockets; ++ index){
-		socket_ids[index] = socket(family, type, 0);
-		if(socket_ids[index] < 0){
-			printf("Socket %d (%d) error:\n", index, socket_ids[index]);
-			socket_print_error(stderr, socket_ids[index], "Socket create: ", "\n");
-			return socket_ids[index];
-		}
-		if(verbose){
-			print_mark(index);
-		}
-	}
-	return EOK;
-}
-
-int sockets_close(int verbose, int * socket_ids, int sockets){
-	ERROR_DECLARE;
-
-	int index;
-
-	if(verbose){
-		printf("\tClose\t");
-	}
-	fflush(stdout);
-	for(index = 0; index < sockets; ++ index){
-		if(ERROR_OCCURRED(closesocket(socket_ids[index]))){
-			printf("Socket %d (%d) error:\n", index, socket_ids[index]);
-			socket_print_error(stderr, ERROR_CODE, "Socket close: ", "\n");
-			return ERROR_CODE;
-		}
-		if(verbose){
-			print_mark(index);
-		}
-	}
-	return EOK;
-}
-
-int sockets_connect(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen){
-	ERROR_DECLARE;
-
-	int index;
-
-	if(verbose){
-		printf("\tConnect\t");
-	}
-	fflush(stdout);
-	for(index = 0; index < sockets; ++ index){
-		if(ERROR_OCCURRED(connect(socket_ids[index], address, addrlen))){
-			socket_print_error(stderr, ERROR_CODE, "Socket connect: ", "\n");
-			return ERROR_CODE;
-		}
-		if(verbose){
-			print_mark(index);
-		}
-	}
-	return EOK;
-}
-
-int sockets_sendto(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages){
-	ERROR_DECLARE;
-
-	int index;
-	int message;
-
-	if(verbose){
-		printf("\tSendto\t");
-	}
-	fflush(stdout);
-	for(index = 0; index < sockets; ++ index){
-		for(message = 0; message < messages; ++ message){
-			if(ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, addrlen))){
-				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
-				socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
-				return ERROR_CODE;
-			}
-		}
-		if(verbose){
-			print_mark(index);
-		}
-	}
-	return EOK;
-}
-
-int sockets_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages){
-	int value;
-	int index;
-	int message;
-
-	if(verbose){
-		printf("\tRecvfrom\t");
-	}
-	fflush(stdout);
-	for(index = 0; index < sockets; ++ index){
-		for(message = 0; message < messages; ++ message){
-			value = recvfrom(socket_ids[index], data, size, 0, address, addrlen);
-			if(value < 0){
-				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
-				socket_print_error(stderr, value, "Socket receive: ", "\n");
-				return value;
-			}
-		}
-		if(verbose){
-			print_mark(index);
-		}
-	}
-	return EOK;
-}
-
-int sockets_sendto_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages){
-	ERROR_DECLARE;
-
-	int value;
-	int index;
-	int message;
-
-	if(verbose){
-		printf("\tSendto and recvfrom\t");
-	}
-	fflush(stdout);
-	for(index = 0; index < sockets; ++ index){
-		for(message = 0; message < messages; ++ message){
-			if(ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, * addrlen))){
-				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
-				socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
-				return ERROR_CODE;
-			}
-			value = recvfrom(socket_ids[index], data, size, 0, address, addrlen);
-			if(value < 0){
-				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
-				socket_print_error(stderr, value, "Socket receive: ", "\n");
-				return value;
-			}
-		}
-		if(verbose){
-			print_mark(index);
-		}
-	}
-	return EOK;
-}
-
-void print_mark(int index){
-	if((index + 1) % 10){
-		printf("*");
-	}else{
-		printf("|");
-	}
-	fflush(stdout);
-}
-
-/** @}
- */
Index: pace/srv/net/app/nettest.h
===================================================================
--- uspace/srv/net/app/nettest.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ 	(revision )
@@ -1,126 +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 nettest
- *  @{
- */
-
-/** @file
- *  Networking test support functions.
- */
-
-#ifndef __NET_TEST__
-#define __NET_TEST__
-
-#include "../include/socket.h"
-
-/** Prints a mark.
- *  If the index is a multiple of ten, a different mark is printed.
- *  @param[in] index The index of the mark to be printed.
- */
-void print_mark(int index);
-
-/** Creates new sockets.
- *  @param[in] verbose A value indicating whether to print out verbose information.
- *  @param[out] socket_ids A field to store the socket identifiers.
- *  @param[in] sockets The number of sockets to create. Should be at most the size of the field.
- *  @param[in] family The socket address family.
- *  @param[in] type The socket type.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the socket() function.
- */
-int sockets_create(int verbose, int * socket_ids, int sockets, int family, sock_type_t type);
-
-/** Closes sockets.
- *  @param[in] verbose A value indicating whether to print out verbose information.
- *  @param[in] socket_ids A field of stored socket identifiers.
- *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the closesocket() function.
- */
-int sockets_close(int verbose, int * socket_ids, int sockets);
-
-/** Connects sockets.
- *  @param[in] verbose A value indicating whether to print out verbose information.
- *  @param[in] socket_ids A field of stored socket identifiers.
- *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
- *  @param[in] address The destination host address to connect to.
- *  @param[in] addrlen The length of the destination address in bytes.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the connect() function.
- */
-int sockets_connect(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen);
-
-/** Sends data via sockets.
- *  @param[in] verbose A value indicating whether to print out verbose information.
- *  @param[in] socket_ids A field of stored socket identifiers.
- *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
- *  @param[in] address The destination host address to send data to.
- *  @param[in] addrlen The length of the destination address in bytes.
- *  @param[in] data The data to be sent.
- *  @param[in] size The data size in bytes.
- *  @param[in] messages The number of datagrams per socket to be sent.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the sendto() function.
- */
-int sockets_sendto(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages);
-
-/** Receives data via sockets.
- *  @param[in] verbose A value indicating whether to print out verbose information.
- *  @param[in] socket_ids A field of stored socket identifiers.
- *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
- *  @param[in] address The source host address of received datagrams.
- *  @param[in,out] addrlen The maximum length of the source address in bytes. The actual size of the source address is set instead.
- *  @param[out] data The received data.
- *  @param[in] size The maximum data size in bytes.
- *  @param[in] messages The number of datagrams per socket to be received.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the recvfrom() function.
- */
-int sockets_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages);
-
-/** Sends and receives data via sockets.
- *  Each datagram is sent and a reply read consequently.
- *  The next datagram is sent after the reply is received.
- *  @param[in] verbose A value indicating whether to print out verbose information.
- *  @param[in] socket_ids A field of stored socket identifiers.
- *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
- *  @param[in,out] address The destination host address to send data to. The source host address of received datagrams is set instead.
- *  @param[in] addrlen The length of the destination address in bytes.
- *  @param[in,out] data The data to be sent. The received data are set instead.
- *  @param[in] size The data size in bytes.
- *  @param[in] messages The number of datagrams per socket to be received.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the recvfrom() function.
- */
-int sockets_sendto_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages);
-
-#endif
-
-/** @}
- */
Index: uspace/srv/net/app/nettest1/Makefile
===================================================================
--- uspace/srv/net/app/nettest1/Makefile	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/app/nettest1/Makefile	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -40,5 +40,4 @@
 SOURCES = \
 	$(NAME).c \
-	$(NET_BASE)app/nettest.c \
 	$(NET_BASE)app/parse.c \
 	$(NET_BASE)app/print_error.c
Index: uspace/srv/net/app/nettest1/nettest1.c
===================================================================
--- uspace/srv/net/app/nettest1/nettest1.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/app/nettest1/nettest1.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -48,5 +48,4 @@
 #include "../../err.h"
 
-#include "../nettest.h"
 #include "../parse.h"
 #include "../print_error.h"
@@ -70,5 +69,19 @@
 /** Prints the application help.
  */
-void nettest1_print_help(void);
+void print_help(void);
+
+/** 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.
+ */
+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.
+ */
+int parse_socket_type(const char * name);
 
 /** Refreshes the data.
@@ -77,309 +90,88 @@
  *  @param[in] size The data block size in bytes.
  */
-void nettest1_refresh_data(char * data, size_t size);
-
-int main(int argc, char * argv[]){
-	ERROR_DECLARE;
-
-	size_t size			= 27;
-	int verbose			= 0;
-	sock_type_t type	= SOCK_DGRAM;
-	int sockets			= 10;
-	int messages		= 10;
-	int family			= PF_INET;
-	uint16_t port		= 7;
-
-	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 * socket_ids;
-	char * data;
-	int value;
-	int index;
-	struct timeval time_before;
-	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 ('-')
-	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 'f':
-					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 0, parse_protocol_family));
-					break;
-				case 'h':
-					nettest1_print_help();
-					return EOK;
-					break;
-				case 'm':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &messages, "message count", 0));
-					break;
-				case 'n':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 0));
-					break;
-				case 'p':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 0));
-					port = (uint16_t) value;
-					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_name_int(argc, argv, &index, &value, "socket type", 0, parse_socket_type));
-					type = (sock_type_t) value;
-					break;
-				case 'v':
-					verbose = 1;
-					break;
-				// long options with the double minus sign ('-')
-				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));
-					}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));
-					}else if(str_lcmp(argv[index] + 2, "sockets=", 6) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 8));
-					}else if(str_lcmp(argv[index] + 2, "port=", 5) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 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));
-						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;
-					}
-					break;
-				default:
-					print_unrecognized(index, argv[index] + 1);
-					nettest1_print_help();
-					return EINVAL;
-			}
-		}else{
-			print_unrecognized(index, argv[index]);
-			nettest1_print_help();
-			return EINVAL;
-		}
-	}
-
-	// if not before the last argument containing the address
-	if(index >= argc){
-		printf("Command line error: missing address\n");
-		nettest1_print_help();
-		return EINVAL;
-	}
-
-	// prepare the address buffer
-	bzero(address_data, max_length);
-	switch(family){
-		case PF_INET:
-			address_in->sin_family = AF_INET;
-			address_in->sin_port = htons(port);
-			address_start = (uint8_t *) &address_in->sin_addr.s_addr;
-			addrlen = sizeof(struct sockaddr_in);
-			break;
-		case PF_INET6:
-			address_in6->sin6_family = AF_INET6;
-			address_in6->sin6_port = htons(port);
-			address_start = (uint8_t *) &address_in6->sin6_addr.s6_addr;
-			addrlen = sizeof(struct sockaddr_in6);
-			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;
-	}
-
-	// check the buffer size
-	if(size <= 0){
-		fprintf(stderr, "Data buffer size too small (%d). Using 1024 bytes instead.\n", size);
-		size = 1024;
-	}
-
-	// prepare the buffer
-	// size plus the terminating null (\0)
-	data = (char *) malloc(size + 1);
-	if(! data){
-		fprintf(stderr, "Failed to allocate data buffer.\n");
-		return ENOMEM;
-	}
-	nettest1_refresh_data(data, size);
-
-	// check the socket count
-	if(sockets <= 0){
-		fprintf(stderr, "Socket count too small (%d). Using 2 instead.\n", sockets);
-		sockets = 2;
-	}
-
-	// prepare the socket buffer
-	// count plus the terminating null (\0)
-	socket_ids = (int *) malloc(sizeof(int) * (sockets + 1));
-	if(! socket_ids){
-		fprintf(stderr, "Failed to allocate receive buffer.\n");
-		return ENOMEM;
-	}
-	socket_ids[sockets] = NULL;
-
-	if(verbose){
-		printf("Starting tests\n");
-	}
-
-	if(verbose){
-		printf("1 socket, 1 message\n");
-	}
-
-	if(ERROR_OCCURRED(gettimeofday(&time_before, NULL))){
-		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
-		return ERROR_CODE;
-	}
-
-	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
-	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
-	if(verbose){
-		printf("\tOK\n");
-	}
-
-	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
-	if(type == SOCK_STREAM){
-		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, 1, address, addrlen));
-	}
-	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, 1, address, &addrlen, data, size, 1));
-	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
-	if(verbose){
-		printf("\tOK\n");
-	}
-
-	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
-	if(type == SOCK_STREAM){
-		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, 1, address, addrlen));
-	}
-	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, 1, address, addrlen, data, size, 1));
-	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, 1, address, &addrlen, data, size, 1));
-	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
-	if(verbose){
-		printf("\tOK\n");
-	}
-
-	if(verbose){
-		printf("1 socket, %d messages\n", messages);
-	}
-
-	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
-	if(type == SOCK_STREAM){
-		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, 1, address, addrlen));
-	}
-	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, 1, address, &addrlen, data, size, messages));
-	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
-	if(verbose){
-		printf("\tOK\n");
-	}
-
-	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
-	if(type == SOCK_STREAM){
-		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, 1, address, addrlen));
-	}
-	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, 1, address, addrlen, data, size, messages));
-	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, 1, address, &addrlen, data, size, messages));
-	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
-	if(verbose){
-		printf("\tOK\n");
-	}
-
-	if(verbose){
-		printf("%d sockets, 1 message\n", sockets);
-	}
-
-	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
-	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
-	if(verbose){
-		printf("\tOK\n");
-	}
-
-	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
-	if(type == SOCK_STREAM){
-		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
-	}
-	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, 1));
-	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
-	if(verbose){
-		printf("\tOK\n");
-	}
-
-	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
-	if(type == SOCK_STREAM){
-		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
-	}
-	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, sockets, address, addrlen, data, size, 1));
-	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, 1));
-	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
-	if(verbose){
-		printf("\tOK\n");
-	}
-
-	if(verbose){
-		printf("%d sockets, %d messages\n", sockets, messages);
-	}
-
-	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
-	if(type == SOCK_STREAM){
-		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
-	}
-	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, messages));
-	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
-	if(verbose){
-		printf("\tOK\n");
-	}
-
-	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
-	if(type == SOCK_STREAM){
-		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
-	}
-	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, sockets, address, addrlen, data, size, messages));
-	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, messages));
-	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
-
-	if(ERROR_OCCURRED(gettimeofday(&time_after, NULL))){
-		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
-		return ERROR_CODE;
-	}
-
-	if(verbose){
-		printf("\tOK\n");
-	}
-
-	printf("Tested in %d microseconds\n", tv_sub(&time_after, &time_before));
-
-	if(verbose){
-		printf("Exiting\n");
-	}
-
-	return EOK;
-}
-
-void nettest1_print_help(void){
+void refresh_data(char * data, size_t size);
+
+/** Creates new sockets.
+ *  @param[in] verbose A value indicating whether to print out verbose information.
+ *  @param[out] socket_ids A field to store the socket identifiers.
+ *  @param[in] sockets The number of sockets to create. Should be at most the size of the field.
+ *  @param[in] family The socket address family.
+ *  @param[in] type The socket type.
+ *  @returns EOK on success.
+ *  @returns Other error codes as defined for the socket() function.
+ */
+int sockets_create(int verbose, int * socket_ids, int sockets, int family, sock_type_t type);
+
+/** Closes sockets.
+ *  @param[in] verbose A value indicating whether to print out verbose information.
+ *  @param[in] socket_ids A field of stored socket identifiers.
+ *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ *  @returns EOK on success.
+ *  @returns Other error codes as defined for the closesocket() function.
+ */
+int sockets_close(int verbose, int * socket_ids, int sockets);
+
+/** Connects sockets.
+ *  @param[in] verbose A value indicating whether to print out verbose information.
+ *  @param[in] socket_ids A field of stored socket identifiers.
+ *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ *  @param[in] address The destination host address to connect to.
+ *  @param[in] addrlen The length of the destination address in bytes.
+ *  @returns EOK on success.
+ *  @returns Other error codes as defined for the connect() function.
+ */
+int sockets_connect(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen);
+
+/** Sends data via sockets.
+ *  @param[in] verbose A value indicating whether to print out verbose information.
+ *  @param[in] socket_ids A field of stored socket identifiers.
+ *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ *  @param[in] address The destination host address to send data to.
+ *  @param[in] addrlen The length of the destination address in bytes.
+ *  @param[in] data The data to be sent.
+ *  @param[in] size The data size in bytes.
+ *  @param[in] messages The number of datagrams per socket to be sent.
+ *  @returns EOK on success.
+ *  @returns Other error codes as defined for the sendto() function.
+ */
+int sockets_sendto(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages);
+
+/** Receives data via sockets.
+ *  @param[in] verbose A value indicating whether to print out verbose information.
+ *  @param[in] socket_ids A field of stored socket identifiers.
+ *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ *  @param[in] address The source host address of received datagrams.
+ *  @param[in,out] addrlen The maximum length of the source address in bytes. The actual size of the source address is set instead.
+ *  @param[out] data The received data.
+ *  @param[in] size The maximum data size in bytes.
+ *  @param[in] messages The number of datagrams per socket to be received.
+ *  @returns EOK on success.
+ *  @returns Other error codes as defined for the recvfrom() function.
+ */
+int sockets_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages);
+
+/** Sends and receives data via sockets.
+ *  Each datagram is sent and a reply read consequently.
+ *  The next datagram is sent after the reply is received.
+ *  @param[in] verbose A value indicating whether to print out verbose information.
+ *  @param[in] socket_ids A field of stored socket identifiers.
+ *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ *  @param[in,out] address The destination host address to send data to. The source host address of received datagrams is set instead.
+ *  @param[in] addrlen The length of the destination address in bytes.
+ *  @param[in,out] data The data to be sent. The received data are set instead.
+ *  @param[in] size The data size in bytes.
+ *  @param[in] messages The number of datagrams per socket to be received.
+ *  @returns EOK on success.
+ *  @returns Other error codes as defined for the recvfrom() function.
+ */
+int sockets_sendto_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages);
+
+/** Prints a mark.
+ *  If the index is a multiple of ten, a different mark is printed.
+ *  @param[in] index The index of the mark to be printed.
+ */
+void print_mark(int index);
+
+void print_help(void){
 	printf(
 		"Network Networking test 1 aplication - sockets\n" \
@@ -409,5 +201,23 @@
 }
 
-void nettest1_refresh_data(char * data, size_t size){
+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 refresh_data(char * data, size_t size){
 	size_t length;
 
@@ -422,4 +232,445 @@
 }
 
+int sockets_create(int verbose, int * socket_ids, int sockets, int family, sock_type_t type){
+	int index;
+
+	if(verbose){
+		printf("Create\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		socket_ids[index] = socket(family, type, 0);
+		if(socket_ids[index] < 0){
+			printf("Socket %d (%d) error:\n", index, socket_ids[index]);
+			socket_print_error(stderr, socket_ids[index], "Socket create: ", "\n");
+			return socket_ids[index];
+		}
+		if(verbose){
+			print_mark(index);
+		}
+	}
+	return EOK;
+}
+
+int sockets_close(int verbose, int * socket_ids, int sockets){
+	ERROR_DECLARE;
+
+	int index;
+
+	if(verbose){
+		printf("\tClose\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		if(ERROR_OCCURRED(closesocket(socket_ids[index]))){
+			printf("Socket %d (%d) error:\n", index, socket_ids[index]);
+			socket_print_error(stderr, ERROR_CODE, "Socket close: ", "\n");
+			return ERROR_CODE;
+		}
+		if(verbose){
+			print_mark(index);
+		}
+	}
+	return EOK;
+}
+
+int sockets_connect(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen){
+	ERROR_DECLARE;
+
+	int index;
+
+	if(verbose){
+		printf("\tConnect\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		if(ERROR_OCCURRED(connect(socket_ids[index], address, addrlen))){
+			socket_print_error(stderr, ERROR_CODE, "Socket connect: ", "\n");
+			return ERROR_CODE;
+		}
+		if(verbose){
+			print_mark(index);
+		}
+	}
+	return EOK;
+}
+
+int sockets_sendto(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages){
+	ERROR_DECLARE;
+
+	int index;
+	int message;
+
+	if(verbose){
+		printf("\tSendto\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		for(message = 0; message < messages; ++ message){
+			if(ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, addrlen))){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
+				return ERROR_CODE;
+			}
+		}
+		if(verbose){
+			print_mark(index);
+		}
+	}
+	return EOK;
+}
+
+int sockets_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages){
+	int value;
+	int index;
+	int message;
+
+	if(verbose){
+		printf("\tRecvfrom\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		for(message = 0; message < messages; ++ message){
+			value = recvfrom(socket_ids[index], data, size, 0, address, addrlen);
+			if(value < 0){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, value, "Socket receive: ", "\n");
+				return value;
+			}
+		}
+		if(verbose){
+			print_mark(index);
+		}
+	}
+	return EOK;
+}
+
+int sockets_sendto_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages){
+	ERROR_DECLARE;
+
+	int value;
+	int index;
+	int message;
+
+	if(verbose){
+		printf("\tSendto and recvfrom\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		for(message = 0; message < messages; ++ message){
+			if(ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, * addrlen))){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
+				return ERROR_CODE;
+			}
+			value = recvfrom(socket_ids[index], data, size, 0, address, addrlen);
+			if(value < 0){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, value, "Socket receive: ", "\n");
+				return value;
+			}
+		}
+		if(verbose){
+			print_mark(index);
+		}
+	}
+	return EOK;
+}
+
+void print_mark(int index){
+	if((index + 1) % 10){
+		printf("*");
+	}else{
+		printf("|");
+	}
+	fflush(stdout);
+}
+
+int main(int argc, char * argv[]){
+	ERROR_DECLARE;
+
+	size_t size			= 27;
+	int verbose			= 0;
+	sock_type_t type			= SOCK_DGRAM;
+	int sockets			= 10;
+	int messages		= 10;
+	int family			= PF_INET;
+	uint16_t port			= 7;
+
+	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 * socket_ids;
+	char * 				data;
+	int value;
+	int index;
+	struct timeval time_before;
+	struct timeval time_after;
+
+	printf("Task %d - ", task_get_id());
+	printf("%s\n", NAME);
+
+	if(argc <= 1){
+		print_help();
+		return EINVAL;
+	}
+
+	for(index = 1; (index < argc - 1) || ((index == argc) && (argv[index][0] == '-')); ++ index){
+		if(argv[index][0] == '-'){
+			switch(argv[index][1]){
+				case 'f':
+					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 0, parse_protocol_family));
+					break;
+				case 'h':
+					print_help();
+					return EOK;
+					break;
+				case 'm':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &messages, "message count", 0));
+					break;
+				case 'n':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 0));
+					break;
+				case 'p':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 0));
+					port = (uint16_t) value;
+					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_name_int(argc, argv, &index, &value, "socket type", 0, parse_socket_type));
+					type = (sock_type_t) value;
+					break;
+				case 'v':
+					verbose = 1;
+					break;
+				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));
+					}else if(str_lcmp(argv[index] + 2, "help", 5) == 0){
+						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));
+					}else if(str_lcmp(argv[index] + 2, "sockets=", 6) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 8));
+					}else if(str_lcmp(argv[index] + 2, "port=", 5) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 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));
+						type = (sock_type_t) value;
+					}else if(str_lcmp(argv[index] + 2, "verbose", 8) == 0){
+						verbose = 1;
+					}else{
+						print_unrecognized(index, argv[index] + 2);
+						print_help();
+						return EINVAL;
+					}
+					break;
+				default:
+					print_unrecognized(index, argv[index] + 1);
+					print_help();
+					return EINVAL;
+			}
+		}else{
+			print_unrecognized(index, argv[index]);
+			print_help();
+			return EINVAL;
+		}
+	}
+
+	bzero(address_data, max_length);
+	switch(family){
+		case PF_INET:
+			address_in->sin_family = AF_INET;
+			address_in->sin_port = htons(port);
+			address_start = (uint8_t *) &address_in->sin_addr.s_addr;
+			addrlen = sizeof(struct sockaddr_in);
+			break;
+		case PF_INET6:
+			address_in6->sin6_family = AF_INET6;
+			address_in6->sin6_port = htons(port);
+			address_start = (uint8_t *) &address_in6->sin6_addr.s6_addr;
+			addrlen = sizeof(struct sockaddr_in6);
+			break;
+		default:
+			fprintf(stderr, "Address family is not supported\n");
+			return EAFNOSUPPORT;
+	}
+
+	if(ERROR_OCCURRED(inet_pton(family, argv[argc - 1], address_start))){
+		fprintf(stderr, "Address parse error %d\n", ERROR_CODE);
+		return ERROR_CODE;
+	}
+
+	if(size <= 0){
+		fprintf(stderr, "Data buffer size too small (%d). Using 1024 bytes instead.\n", size);
+		size = 1024;
+	}
+	// size plus terminating null (\0)
+	data = (char *) malloc(size + 1);
+	if(! data){
+		fprintf(stderr, "Failed to allocate data buffer.\n");
+		return ENOMEM;
+	}
+	refresh_data(data, size);
+
+	if(sockets <= 0){
+		fprintf(stderr, "Socket count too small (%d). Using 2 instead.\n", sockets);
+		sockets = 2;
+	}
+	// count plus terminating null (\0)
+	socket_ids = (int *) malloc(sizeof(int) * (sockets + 1));
+	if(! socket_ids){
+		fprintf(stderr, "Failed to allocate receive buffer.\n");
+		return ENOMEM;
+	}
+	socket_ids[sockets] = NULL;
+
+	if(verbose){
+		printf("Starting tests\n");
+	}
+
+	if(verbose){
+		printf("1 socket, 1 message\n");
+	}
+
+	if(ERROR_OCCURRED(gettimeofday(&time_before, NULL))){
+		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
+		return ERROR_CODE;
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, 1, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, 1, address, &addrlen, data, size, 1));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, 1, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, 1, address, addrlen, data, size, 1));
+	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, 1, address, &addrlen, data, size, 1));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	if(verbose){
+		printf("1 socket, %d messages\n", messages);
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, 1, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, 1, address, &addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, 1, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, 1, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, 1, address, addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, 1, address, &addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, 1));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	if(verbose){
+		printf("%d sockets, 1 message\n", sockets);
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, 1));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, sockets, address, addrlen, data, size, 1));
+	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, 1));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	if(verbose){
+		printf("%d sockets, %d messages\n", sockets, messages);
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
+	}
+	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, sockets, address, addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
+
+	if(ERROR_OCCURRED(gettimeofday(&time_after, NULL))){
+		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
+		return ERROR_CODE;
+	}
+
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	printf("Tested in %d microseconds\n", tv_sub(&time_after, &time_before));
+
+	if(verbose){
+		printf("Exiting\n");
+	}
+
+	return EOK;
+}
+
 /** @}
  */
Index: uspace/srv/net/app/nettest2/Makefile
===================================================================
--- uspace/srv/net/app/nettest2/Makefile	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/app/nettest2/Makefile	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -40,5 +40,4 @@
 SOURCES = \
 	$(NAME).c \
-	$(NET_BASE)app/nettest.c \
 	$(NET_BASE)app/parse.c \
 	$(NET_BASE)app/print_error.c
Index: uspace/srv/net/app/nettest2/nettest2.c
===================================================================
--- uspace/srv/net/app/nettest2/nettest2.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/app/nettest2/nettest2.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -48,5 +48,4 @@
 #include "../../err.h"
 
-#include "../nettest.h"
 #include "../parse.h"
 #include "../print_error.h"
@@ -70,5 +69,19 @@
 /** Prints the application help.
  */
-void nettest2_print_help(void);
+void print_help(void);
+
+/** 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.
+ */
+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.
+ */
+int parse_socket_type(const char * name);
 
 /** Refreshes the data.
@@ -77,232 +90,88 @@
  *  @param[in] size The data block size in bytes.
  */
-void nettest2_refresh_data(char * data, size_t size);
-
-int main(int argc, char * argv[]){
-	ERROR_DECLARE;
-
-	size_t size			= 28;
-	int verbose			= 0;
-	sock_type_t type	= SOCK_DGRAM;
-	int sockets			= 10;
-	int messages		= 10;
-	int family			= PF_INET;
-	uint16_t port		= 7;
-
-	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 * socket_ids;
-	char * data;
-	int value;
-	int index;
-	struct timeval time_before;
-	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 ('-')
-	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 'f':
-					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 0, parse_protocol_family));
-					break;
-				case 'h':
-					nettest2_print_help();
-					return EOK;
-					break;
-				case 'm':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &messages, "message count", 0));
-					break;
-				case 'n':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 0));
-					break;
-				case 'p':
-					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 0));
-					port = (uint16_t) value;
-					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_name_int(argc, argv, &index, &value, "socket type", 0, parse_socket_type));
-					type = (sock_type_t) value;
-					break;
-				case 'v':
-					verbose = 1;
-					break;
-				// long options with the double minus sign ('-')
-				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));
-					}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));
-					}else if(str_lcmp(argv[index] + 2, "sockets=", 6) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 8));
-					}else if(str_lcmp(argv[index] + 2, "port=", 5) == 0){
-						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 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));
-						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;
-					}
-					break;
-				default:
-					print_unrecognized(index, argv[index] + 1);
-					nettest2_print_help();
-					return EINVAL;
-			}
-		}else{
-			print_unrecognized(index, argv[index]);
-			nettest2_print_help();
-			return EINVAL;
-		}
-	}
-
-	// if not before the last argument containing the address
-	if(index >= argc){
-		printf("Command line error: missing address\n");
-		nettest2_print_help();
-		return EINVAL;
-	}
-
-	// prepare the address buffer
-	bzero(address_data, max_length);
-	switch(family){
-		case PF_INET:
-			address_in->sin_family = AF_INET;
-			address_in->sin_port = htons(port);
-			address_start = (uint8_t *) &address_in->sin_addr.s_addr;
-			addrlen = sizeof(struct sockaddr_in);
-			break;
-		case PF_INET6:
-			address_in6->sin6_family = AF_INET6;
-			address_in6->sin6_port = htons(port);
-			address_start = (uint8_t *) &address_in6->sin6_addr.s6_addr;
-			addrlen = sizeof(struct sockaddr_in6);
-			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;
-	}
-
-	// check the buffer size
-	if(size <= 0){
-		fprintf(stderr, "Data buffer size too small (%d). Using 1024 bytes instead.\n", size);
-		size = 1024;
-	}
-
-	// prepare the buffer
-	// size plus terminating null (\0)
-	data = (char *) malloc(size + 1);
-	if(! data){
-		fprintf(stderr, "Failed to allocate data buffer.\n");
-		return ENOMEM;
-	}
-	nettest2_refresh_data(data, size);
-
-	// check the socket count
-	if(sockets <= 0){
-		fprintf(stderr, "Socket count too small (%d). Using 2 instead.\n", sockets);
-		sockets = 2;
-	}
-
-	// prepare the socket buffer
-	// count plus the terminating null (\0)
-	socket_ids = (int *) malloc(sizeof(int) * (sockets + 1));
-	if(! socket_ids){
-		fprintf(stderr, "Failed to allocate receive buffer.\n");
-		return ENOMEM;
-	}
-	socket_ids[sockets] = NULL;
-
-	if(verbose){
-		printf("Starting tests\n");
-	}
-
-	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
-
-	if(type == SOCK_STREAM){
-		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
-	}
-
-	if(verbose){
-		printf("\n");
-	}
-
-	if(ERROR_OCCURRED(gettimeofday(&time_before, NULL))){
-		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
-		return ERROR_CODE;
-	}
-
-	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, messages));
-
-	if(ERROR_OCCURRED(gettimeofday(&time_after, NULL))){
-		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
-		return ERROR_CODE;
-	}
-
-	if(verbose){
-		printf("\tOK\n");
-	}
-
-	printf("sendto + recvfrom tested in %d microseconds\n", tv_sub(&time_after, &time_before));
-
-	if(ERROR_OCCURRED(gettimeofday(&time_before, NULL))){
-		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
-		return ERROR_CODE;
-	}
-
-	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, sockets, address, addrlen, data, size, messages));
-	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, messages));
-
-	if(ERROR_OCCURRED(gettimeofday(&time_after, NULL))){
-		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
-		return ERROR_CODE;
-	}
-
-	if(verbose){
-		printf("\tOK\n");
-	}
-
-	printf("sendto, recvfrom tested in %d microseconds\n", tv_sub(&time_after, &time_before));
-
-	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
-
-	if(verbose){
-		printf("\nExiting\n");
-	}
-
-	return EOK;
-}
-
-void nettest2_print_help(void){
+void refresh_data(char * data, size_t size);
+
+/** Creates new sockets.
+ *  @param[in] verbose A value indicating whether to print out verbose information.
+ *  @param[out] socket_ids A field to store the socket identifiers.
+ *  @param[in] sockets The number of sockets to create. Should be at most the size of the field.
+ *  @param[in] family The socket address family.
+ *  @param[in] type The socket type.
+ *  @returns EOK on success.
+ *  @returns Other error codes as defined for the socket() function.
+ */
+int sockets_create(int verbose, int * socket_ids, int sockets, int family, sock_type_t type);
+
+/** Closes sockets.
+ *  @param[in] verbose A value indicating whether to print out verbose information.
+ *  @param[in] socket_ids A field of stored socket identifiers.
+ *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ *  @returns EOK on success.
+ *  @returns Other error codes as defined for the closesocket() function.
+ */
+int sockets_close(int verbose, int * socket_ids, int sockets);
+
+/** Connects sockets.
+ *  @param[in] verbose A value indicating whether to print out verbose information.
+ *  @param[in] socket_ids A field of stored socket identifiers.
+ *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ *  @param[in] address The destination host address to connect to.
+ *  @param[in] addrlen The length of the destination address in bytes.
+ *  @returns EOK on success.
+ *  @returns Other error codes as defined for the connect() function.
+ */
+int sockets_connect(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen);
+
+/** Sends data via sockets.
+ *  @param[in] verbose A value indicating whether to print out verbose information.
+ *  @param[in] socket_ids A field of stored socket identifiers.
+ *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ *  @param[in] address The destination host address to send data to.
+ *  @param[in] addrlen The length of the destination address in bytes.
+ *  @param[in] data The data to be sent.
+ *  @param[in] size The data size in bytes.
+ *  @param[in] messages The number of datagrams per socket to be sent.
+ *  @returns EOK on success.
+ *  @returns Other error codes as defined for the sendto() function.
+ */
+int sockets_sendto(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages);
+
+/** Receives data via sockets.
+ *  @param[in] verbose A value indicating whether to print out verbose information.
+ *  @param[in] socket_ids A field of stored socket identifiers.
+ *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ *  @param[in] address The source host address of received datagrams.
+ *  @param[in,out] addrlen The maximum length of the source address in bytes. The actual size of the source address is set instead.
+ *  @param[out] data The received data.
+ *  @param[in] size The maximum data size in bytes.
+ *  @param[in] messages The number of datagrams per socket to be received.
+ *  @returns EOK on success.
+ *  @returns Other error codes as defined for the recvfrom() function.
+ */
+int sockets_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages);
+
+/** Sends and receives data via sockets.
+ *  Each datagram is sent and a reply read consequently.
+ *  The next datagram is sent after the reply is received.
+ *  @param[in] verbose A value indicating whether to print out verbose information.
+ *  @param[in] socket_ids A field of stored socket identifiers.
+ *  @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ *  @param[in,out] address The destination host address to send data to. The source host address of received datagrams is set instead.
+ *  @param[in] addrlen The length of the destination address in bytes.
+ *  @param[in,out] data The data to be sent. The received data are set instead.
+ *  @param[in] size The data size in bytes.
+ *  @param[in] messages The number of datagrams per socket to be received.
+ *  @returns EOK on success.
+ *  @returns Other error codes as defined for the recvfrom() function.
+ */
+int sockets_sendto_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages);
+
+/** Prints a mark.
+ *  If the index is a multiple of ten, a different mark is printed.
+ *  @param[in] index The index of the mark to be printed.
+ */
+void print_mark(int index);
+
+void print_help(void){
 	printf(
 		"Network Networking test 2 aplication - UDP transfer\n" \
@@ -332,5 +201,23 @@
 }
 
-void nettest2_refresh_data(char * data, size_t size){
+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 refresh_data(char * data, size_t size){
 	size_t length;
 
@@ -345,4 +232,369 @@
 }
 
+int sockets_create(int verbose, int * socket_ids, int sockets, int family, sock_type_t type){
+	int index;
+
+	if(verbose){
+		printf("Create\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		socket_ids[index] = socket(family, type, 0);
+		if(socket_ids[index] < 0){
+			printf("Socket %d (%d) error:\n", index, socket_ids[index]);
+			socket_print_error(stderr, socket_ids[index], "Socket create: ", "\n");
+			return socket_ids[index];
+		}
+		if(verbose){
+			print_mark(index);
+		}
+	}
+	return EOK;
+}
+
+int sockets_close(int verbose, int * socket_ids, int sockets){
+	ERROR_DECLARE;
+
+	int index;
+
+	if(verbose){
+		printf("\tClose\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		if(ERROR_OCCURRED(closesocket(socket_ids[index]))){
+			printf("Socket %d (%d) error:\n", index, socket_ids[index]);
+			socket_print_error(stderr, ERROR_CODE, "Socket close: ", "\n");
+			return ERROR_CODE;
+		}
+		if(verbose){
+			print_mark(index);
+		}
+	}
+	return EOK;
+}
+
+int sockets_connect(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen){
+	ERROR_DECLARE;
+
+	int index;
+
+	if(verbose){
+		printf("\tConnect\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		if(ERROR_OCCURRED(connect(socket_ids[index], address, addrlen))){
+			socket_print_error(stderr, ERROR_CODE, "Socket connect: ", "\n");
+			return ERROR_CODE;
+		}
+		if(verbose){
+			print_mark(index);
+		}
+	}
+	return EOK;
+}
+
+int sockets_sendto(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages){
+	ERROR_DECLARE;
+
+	int index;
+	int message;
+
+	if(verbose){
+		printf("\tSendto\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		for(message = 0; message < messages; ++ message){
+			if(ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, addrlen))){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
+				return ERROR_CODE;
+			}
+		}
+		if(verbose){
+			print_mark(index);
+		}
+	}
+	return EOK;
+}
+
+int sockets_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages){
+	int value;
+	int index;
+	int message;
+
+	if(verbose){
+		printf("\tRecvfrom\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		for(message = 0; message < messages; ++ message){
+			value = recvfrom(socket_ids[index], data, size, 0, address, addrlen);
+			if(value < 0){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, value, "Socket receive: ", "\n");
+				return value;
+			}
+		}
+		if(verbose){
+			print_mark(index);
+		}
+	}
+	return EOK;
+}
+
+int sockets_sendto_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages){
+	ERROR_DECLARE;
+
+	int value;
+	int index;
+	int message;
+
+	if(verbose){
+		printf("\tSendto and recvfrom\t");
+	}
+	fflush(stdout);
+	for(index = 0; index < sockets; ++ index){
+		for(message = 0; message < messages; ++ message){
+			if(ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, * addrlen))){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
+				return ERROR_CODE;
+			}
+			value = recvfrom(socket_ids[index], data, size, 0, address, addrlen);
+			if(value < 0){
+				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
+				socket_print_error(stderr, value, "Socket receive: ", "\n");
+				return value;
+			}
+		}
+		if(verbose){
+			print_mark(index);
+		}
+	}
+	return EOK;
+}
+
+void print_mark(int index){
+	if((index + 1) % 10){
+		printf("*");
+	}else{
+		printf("|");
+	}
+	fflush(stdout);
+}
+
+int main(int argc, char * argv[]){
+	ERROR_DECLARE;
+
+	size_t size			= 28;
+	int verbose			= 0;
+	sock_type_t type			= SOCK_DGRAM;
+	int sockets			= 10;
+	int messages		= 10;
+	int family			= PF_INET;
+	uint16_t port			= 7;
+
+	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 * socket_ids;
+	char * 				data;
+	int value;
+	int index;
+	struct timeval time_before;
+	struct timeval time_after;
+
+	printf("Task %d - ", task_get_id());
+	printf("%s\n", NAME);
+
+	if(argc <= 1){
+		print_help();
+		return EINVAL;
+	}
+
+	for(index = 1; (index < argc - 1) || ((index == argc) && (argv[index][0] == '-')); ++ index){
+		if(argv[index][0] == '-'){
+			switch(argv[index][1]){
+				case 'f':
+					ERROR_PROPAGATE(parse_parameter_name_int(argc, argv, &index, &family, "protocol family", 0, parse_protocol_family));
+					break;
+				case 'h':
+					print_help();
+					return EOK;
+					break;
+				case 'm':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &messages, "message count", 0));
+					break;
+				case 'n':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 0));
+					break;
+				case 'p':
+					ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 0));
+					port = (uint16_t) value;
+					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_name_int(argc, argv, &index, &value, "socket type", 0, parse_socket_type));
+					type = (sock_type_t) value;
+					break;
+				case 'v':
+					verbose = 1;
+					break;
+				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));
+					}else if(str_lcmp(argv[index] + 2, "help", 5) == 0){
+						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));
+					}else if(str_lcmp(argv[index] + 2, "sockets=", 6) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &sockets, "socket count", 8));
+					}else if(str_lcmp(argv[index] + 2, "port=", 5) == 0){
+						ERROR_PROPAGATE(parse_parameter_int(argc, argv, &index, &value, "port number", 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));
+						type = (sock_type_t) value;
+					}else if(str_lcmp(argv[index] + 2, "verbose", 8) == 0){
+						verbose = 1;
+					}else{
+						print_unrecognized(index, argv[index] + 2);
+						print_help();
+						return EINVAL;
+					}
+					break;
+				default:
+					print_unrecognized(index, argv[index] + 1);
+					print_help();
+					return EINVAL;
+			}
+		}else{
+			print_unrecognized(index, argv[index]);
+			print_help();
+			return EINVAL;
+		}
+	}
+
+	bzero(address_data, max_length);
+	switch(family){
+		case PF_INET:
+			address_in->sin_family = AF_INET;
+			address_in->sin_port = htons(port);
+			address_start = (uint8_t *) &address_in->sin_addr.s_addr;
+			addrlen = sizeof(struct sockaddr_in);
+			break;
+		case PF_INET6:
+			address_in6->sin6_family = AF_INET6;
+			address_in6->sin6_port = htons(port);
+			address_start = (uint8_t *) &address_in6->sin6_addr.s6_addr;
+			addrlen = sizeof(struct sockaddr_in6);
+			break;
+		default:
+			fprintf(stderr, "Address family is not supported\n");
+			return EAFNOSUPPORT;
+	}
+
+	if(ERROR_OCCURRED(inet_pton(family, argv[argc - 1], address_start))){
+		fprintf(stderr, "Address parse error %d\n", ERROR_CODE);
+		return ERROR_CODE;
+	}
+
+	if(size <= 0){
+		fprintf(stderr, "Data buffer size too small (%d). Using 1024 bytes instead.\n", size);
+		size = 1024;
+	}
+	// size plus terminating null (\0)
+	data = (char *) malloc(size + 1);
+	if(! data){
+		fprintf(stderr, "Failed to allocate data buffer.\n");
+		return ENOMEM;
+	}
+	refresh_data(data, size);
+
+	if(sockets <= 0){
+		fprintf(stderr, "Socket count too small (%d). Using 2 instead.\n", sockets);
+		sockets = 2;
+	}
+	// count plus terminating null (\0)
+	socket_ids = (int *) malloc(sizeof(int) * (sockets + 1));
+	if(! socket_ids){
+		fprintf(stderr, "Failed to allocate receive buffer.\n");
+		return ENOMEM;
+	}
+	socket_ids[sockets] = NULL;
+
+	if(verbose){
+		printf("Starting tests\n");
+	}
+
+	ERROR_PROPAGATE(sockets_create(verbose, socket_ids, sockets, family, type));
+
+	if(type == SOCK_STREAM){
+		ERROR_PROPAGATE(sockets_connect(verbose, socket_ids, sockets, address, addrlen));
+	}
+
+	if(verbose){
+		printf("\n");
+	}
+
+	if(ERROR_OCCURRED(gettimeofday(&time_before, NULL))){
+		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
+		return ERROR_CODE;
+	}
+
+	ERROR_PROPAGATE(sockets_sendto_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, messages));
+
+	if(ERROR_OCCURRED(gettimeofday(&time_after, NULL))){
+		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
+		return ERROR_CODE;
+	}
+
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	printf("sendto + recvfrom tested in %d microseconds\n", tv_sub(&time_after, &time_before));
+
+	if(ERROR_OCCURRED(gettimeofday(&time_before, NULL))){
+		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
+		return ERROR_CODE;
+	}
+
+	ERROR_PROPAGATE(sockets_sendto(verbose, socket_ids, sockets, address, addrlen, data, size, messages));
+	ERROR_PROPAGATE(sockets_recvfrom(verbose, socket_ids, sockets, address, &addrlen, data, size, messages));
+
+	if(ERROR_OCCURRED(gettimeofday(&time_after, NULL))){
+		fprintf(stderr, "Get time of day error %d\n", ERROR_CODE);
+		return ERROR_CODE;
+	}
+
+	if(verbose){
+		printf("\tOK\n");
+	}
+
+	printf("sendto, recvfrom tested in %d microseconds\n", tv_sub(&time_after, &time_before));
+
+	ERROR_PROPAGATE(sockets_close(verbose, socket_ids, sockets));
+
+	if(verbose){
+		printf("\nExiting\n");
+	}
+
+	return EOK;
+}
+
 /** @}
  */
Index: uspace/srv/net/app/parse.c
===================================================================
--- uspace/srv/net/app/parse.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/app/parse.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -38,18 +38,7 @@
 #include <string.h>
 
-#include "../include/socket.h"
-
 #include "../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){
@@ -72,4 +61,17 @@
 }
 
+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_parameter_name_int(int argc, char ** argv, int * index, int * value, const char * name, int offset, int (*parse_value)(const char * value)){
 	ERROR_DECLARE;
@@ -86,37 +88,6 @@
 }
 
-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);
+	fprintf(stderr, "Command line error - unrecognized parameter (%d: %s)\n", index, parameter);
 }
 
Index: uspace/srv/net/app/parse.h
===================================================================
--- uspace/srv/net/app/parse.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/app/parse.h	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -38,12 +38,9 @@
 #define __NET_APP_PARSE__
 
-#include "../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.
+/** Prints the parameter unrecognized message and the application help.
+ *  @param[in] index The index of the parameter.
+ *  @param[in] parameter The parameter name.
  */
-int parse_address_family(const char * name);
+void print_unrecognized(int index, const char * parameter);
 
 /** Parses the next parameter as an integral number.
@@ -61,4 +58,19 @@
  */
 int parse_parameter_int(int argc, char ** argv, int * index, int * value, const char * name, int offset);
+
+/** 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.
+ */
+int parse_parameter_string(int argc, char ** argv, int * index, char ** value, const char * name, int offset);
 
 /** Parses the next named parameter as an integral number.
@@ -80,39 +92,4 @@
 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.
- */
-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.
- */
-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.
- */
-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.
- */
-void print_unrecognized(int index, const char * parameter);
-
 #endif
 
Index: uspace/srv/net/app/ping/ping.c
===================================================================
--- uspace/srv/net/app/ping/ping.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/app/ping/ping.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -39,5 +39,4 @@
 #include <task.h>
 #include <time.h>
-#include <ipc/ipc.h>
 #include <ipc/services.h>
 
@@ -68,5 +67,56 @@
 /** Prints the application help.
  */
-void ping_print_help(void);
+void print_help(void);
+
+/** 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.
+ */
+int parse_address_family(const char * name);
+
+void 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"
+	);
+}
+
+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 main(int argc, char * argv[]){
@@ -76,13 +126,13 @@
 	int verbose			= 0;
 	int dont_fragment	= 0;
-	ip_ttl_t ttl		= 0;
-	ip_tos_t tos		= 0;
+	ip_ttl_t ttl				= 0;
+	ip_tos_t tos				= 0;
 	int count			= 3;
-	suseconds_t timeout	= 3000;
+	suseconds_t timeout			= 3000;
 	int family			= AF_INET;
 
-	socklen_t max_length				= sizeof(struct sockaddr_in6);
+	socklen_t max_length		= sizeof(struct sockaddr_in6);
 	uint8_t address_data[max_length];
-	struct sockaddr * address			= (struct sockaddr *) address_data;
+	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;
@@ -97,15 +147,15 @@
 	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(argc <= 1){
+		print_help();
+		return EINVAL;
+	}
+
+	for(index = 1; (index < argc - 1) || ((index == argc) && (argv[index][0] == '-')); ++ index){
 		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));
@@ -115,5 +165,5 @@
 					break;
 				case 'h':
-					ping_print_help();
+					print_help();
 					return EOK;
 					break;
@@ -129,5 +179,4 @@
 					verbose = 1;
 					break;
-				// long options with the double minus sign ('-')
 				case '-':
 					if(str_lcmp(argv[index] + 2, "count=", 6) == 0){
@@ -138,5 +187,5 @@
 						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();
+						print_help();
 						return EOK;
 					}else if(str_lcmp(argv[index] + 2, "size=", 5) == 0){
@@ -156,5 +205,5 @@
 					}else{
 						print_unrecognized(index, argv[index] + 2);
-						ping_print_help();
+						print_help();
 						return EINVAL;
 					}
@@ -162,22 +211,14 @@
 				default:
 					print_unrecognized(index, argv[index] + 1);
-					ping_print_help();
+					print_help();
 					return EINVAL;
 			}
 		}else{
 			print_unrecognized(index, argv[index]);
-			ping_print_help();
+			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){
@@ -197,5 +238,4 @@
 	}
 
-	// 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);
@@ -203,5 +243,4 @@
 	}
 
-	// connect to the ICMP module
 	icmp_phone = icmp_connect_module(SERVICE_ICMP, ICMP_CONNECT_TIMEOUT);
 	if(icmp_phone < 0){
@@ -210,5 +249,4 @@
 	}
 
-	// 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)))){
@@ -218,27 +256,14 @@
 	}
 
-	// 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:
@@ -258,45 +283,7 @@
 	}
 
-	// release the ICMP phone
-	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"
-	);
-}
-
 /** @}
  */
Index: uspace/srv/net/app/print_error.c
===================================================================
--- uspace/srv/net/app/print_error.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/app/print_error.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -41,4 +41,12 @@
 
 #include "print_error.h"
+
+void print_error(FILE * output, int error_code, const char * prefix, const char * suffix){
+	if(IS_ICMP_ERROR(error_code)){
+		icmp_print_error(output, error_code, prefix, suffix);
+	}else if(IS_SOCKET_ERROR(error_code)){
+		socket_print_error(output, error_code, prefix, suffix);
+	}
+}
 
 void icmp_print_error(FILE * output, int error_code, const char * prefix, const char * suffix){
@@ -93,12 +101,4 @@
 }
 
-void print_error(FILE * output, int error_code, const char * prefix, const char * suffix){
-	if(IS_ICMP_ERROR(error_code)){
-		icmp_print_error(output, error_code, prefix, suffix);
-	}else if(IS_SOCKET_ERROR(error_code)){
-		socket_print_error(output, error_code, prefix, suffix);
-	}
-}
-
 void socket_print_error(FILE * output, int error_code, const char * prefix, const char * suffix){
 	if(output){
Index: uspace/srv/net/app/print_error.h
===================================================================
--- uspace/srv/net/app/print_error.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/app/print_error.h	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -50,12 +50,4 @@
 #define IS_SOCKET_ERROR(error_code)	((error_code) < 0)
 
-/** Prints the specific ICMP error description.
- *  @param[in] output The description output stream. May be NULL.
- *  @param[in] error_code The ICMP error code.
- *  @param[in] prefix The error description prefix. May be NULL.
- *  @param[in] suffix The error description suffix. May be NULL.
- */
-void icmp_print_error(FILE * output, int error_code, const char * prefix, const char * suffix);
-
 /** Prints the error description.
  *  Supports ICMP and socket error codes.
@@ -66,4 +58,12 @@
  */
 void print_error(FILE * output, int error_code, const char * prefix, const char * suffix);
+
+/** Prints the specific ICMP error description.
+ *  @param[in] output The description output stream. May be NULL.
+ *  @param[in] error_code The ICMP error code.
+ *  @param[in] prefix The error description prefix. May be NULL.
+ *  @param[in] suffix The error description suffix. May be NULL.
+ */
+void icmp_print_error(FILE * output, int error_code, const char * prefix, const char * suffix);
 
 /** Prints the specific socket error description.
Index: uspace/srv/net/cfg/modular/general
===================================================================
--- uspace/srv/net/cfg/modular/general	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/cfg/modular/general	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -3,10 +3,7 @@
 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/general
===================================================================
--- uspace/srv/net/cfg/module/general	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/cfg/module/general	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -3,10 +3,7 @@
 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/checksum.c
===================================================================
--- uspace/srv/net/checksum.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/checksum.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -47,11 +47,60 @@
 #define CRC_DIVIDER_LE	0xEDB88320
 
-uint16_t compact_checksum(uint32_t sum){
-	// shorten to the 16 bits
-	while(sum >> 16){
-		sum = (sum &0xFFFF) + (sum >> 16);
+uint32_t compute_crc32_le(uint32_t seed, uint8_t * data, size_t length){
+	size_t index;
+
+	while(length >= 8){
+		seed ^= (*data);
+		for(index = 0; index < 8; ++ index){
+			if(seed &1){
+				seed = (seed >> 1) ^ ((uint32_t) CRC_DIVIDER_LE);
+			}else{
+				seed >>= 1;
+			}
+		}
+		++ data;
+		length -= 8;
 	}
+	if(length > 0){
+		seed ^= (*data) >> (8 - length);
+		for(index = 0; index < length; ++ index){
+			if(seed &1){
+				seed = (seed >> 1) ^ ((uint32_t) CRC_DIVIDER_LE);
+			}else{
+				seed >>= 1;
+			}
+		}
+		length -= 8;
+	}
+	return seed;
+}
 
-	return (uint16_t) sum;
+uint32_t compute_crc32_be(uint32_t seed, uint8_t * data, size_t length){
+	size_t index;
+
+	while(length >= 8){
+		seed ^= (*data) << 24;
+		for(index = 0; index < 8; ++ index){
+			if(seed &0x80000000){
+				seed = (seed << 1) ^ ((uint32_t) CRC_DIVIDER_BE);
+			}else{
+				seed <<= 1;
+			}
+		}
+		++ data;
+		length -= 8;
+	}
+	if(length > 0){
+		seed ^= ((*data) &(0xFF << (8 - length))) << 24;
+		for(index = 0; index < length; ++ index){
+			if(seed &0x80000000){
+				seed = (seed << 1) ^ ((uint32_t) CRC_DIVIDER_BE);
+			}else{
+				seed <<= 1;
+			}
+		}
+		length -= 8;
+	}
+	return seed;
 }
 
@@ -72,87 +121,11 @@
 }
 
-uint32_t compute_crc32_be(uint32_t seed, uint8_t * data, size_t length){
-	size_t index;
-
-	// process full bytes
-	while(length >= 8){
-		// add the data
-		seed ^= (*data) << 24;
-		// for each added bit
-		for(index = 0; index < 8; ++ index){
-			// if the first bit is set
-			if(seed &0x80000000){
-				// shift and divide the checksum
-				seed = (seed << 1) ^ ((uint32_t) CRC_DIVIDER_BE);
-			}else{
-				// shift otherwise
-				seed <<= 1;
-			}
-		}
-		// move to the next byte
-		++ data;
-		length -= 8;
+uint16_t compact_checksum(uint32_t sum){
+	// shorten to the 16 bits
+	while(sum >> 16){
+		sum = (sum &0xFFFF) + (sum >> 16);
 	}
 
-	// process the odd bits
-	if(length > 0){
-		// add the data with zero padding
-		seed ^= ((*data) &(0xFF << (8 - length))) << 24;
-		// for each added bit
-		for(index = 0; index < length; ++ index){
-			// if the first bit is set
-			if(seed &0x80000000){
-				// shift and divide the checksum
-				seed = (seed << 1) ^ ((uint32_t) CRC_DIVIDER_BE);
-			}else{
-				// shift otherwise
-				seed <<= 1;
-			}
-		}
-	}
-
-	return seed;
-}
-
-uint32_t compute_crc32_le(uint32_t seed, uint8_t * data, size_t length){
-	size_t index;
-
-	// process full bytes
-	while(length >= 8){
-		// add the data
-		seed ^= (*data);
-		// for each added bit
-		for(index = 0; index < 8; ++ index){
-			// if the last bit is set
-			if(seed &1){
-				// shift and divide the checksum
-				seed = (seed >> 1) ^ ((uint32_t) CRC_DIVIDER_LE);
-			}else{
-				// shift otherwise
-				seed >>= 1;
-			}
-		}
-		// move to the next byte
-		++ data;
-		length -= 8;
-	}
-
-	// process the odd bits
-	if(length > 0){
-		// add the data with zero padding
-		seed ^= (*data) >> (8 - length);
-		for(index = 0; index < length; ++ index){
-			// if the last bit is set
-			if(seed &1){
-				// shift and divide the checksum
-				seed = (seed >> 1) ^ ((uint32_t) CRC_DIVIDER_LE);
-			}else{
-				// shift otherwise
-				seed >>= 1;
-			}
-		}
-	}
-
-	return seed;
+	return (uint16_t) sum;
 }
 
@@ -164,5 +137,4 @@
 
 uint16_t ip_checksum(uint8_t * data, size_t length){
-	// compute, compact and flip the data checksum
 	return flip_checksum(compact_checksum(compute_checksum(0, data, length)));
 }
Index: uspace/srv/net/configuration.h
===================================================================
--- uspace/srv/net/configuration.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/configuration.h	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -46,4 +46,10 @@
 /*@{*/
 
+/** Activates the measured strings self test.
+ *  The NET_SELF_TEST has to be activated.
+ *  @see measured_strings.h
+ */
+#define NET_SELF_TEST_MEASURED_STRINGS	1
+
 /** Activates the char map self test.
  *  The NET_SELF_TEST has to be activated.
@@ -52,15 +58,15 @@
 #define NET_SELF_TEST_CHAR_MAP			1
 
-/** Activates the CRC computation self test.
+/** Activates the integral map self test.
  *  The NET_SELF_TEST has to be activated.
- *  @see crc.h
+ *  @see int_map.h
  */
-#define NET_SELF_TEST_CRC				1
+#define NET_SELF_TEST_INT_MAP			1
 
-/** Activates the dynamic fifo self test.
+/** Activates the generic field self test.
  *  The NET_SELF_TEST has to be activated.
- *  @see dynamic_fifo.h
+ *  @see generic_field.h
  */
-#define NET_SELF_TEST_DYNAMIC_FIFO		1
+#define NET_SELF_TEST_GENERIC_FIELD		1
 
 /** Activates the generic char map self test.
@@ -70,21 +76,15 @@
 #define NET_SELF_TEST_GENERIC_CHAR_MAP	1
 
-/** Activates the generic field self test.
+/** Activates the CRC computation self test.
  *  The NET_SELF_TEST has to be activated.
- *  @see generic_field.h
+ *  @see crc.h
  */
-#define NET_SELF_TEST_GENERIC_FIELD		1
+#define NET_SELF_TEST_CRC	1
 
-/** Activates the integral map self test.
+/** Activates the dynamic fifo self test.
  *  The NET_SELF_TEST has to be activated.
- *  @see int_map.h
+ *  @see dynamic_fifo.h
  */
-#define NET_SELF_TEST_INT_MAP			1
-
-/** Activates the measured strings self test.
- *  The NET_SELF_TEST has to be activated.
- *  @see measured_strings.h
- */
-#define NET_SELF_TEST_MEASURED_STRINGS	1
+#define NET_SELF_TEST_DYNAMIC_FIFO	1
 
 /*@}*/
Index: uspace/srv/net/err.h
===================================================================
--- uspace/srv/net/err.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/err.h	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -62,7 +62,5 @@
 #ifdef CONFIG_DEBUG
 
-#define ERROR_OCCURRED(value)												\
-	(((ERROR_CODE = (value)) != EOK)										\
-	&& ({printf("error at %s:%d %d\n", __FILE__, __LINE__, ERROR_CODE); 1;}))
+#define ERROR_OCCURRED(value)		(((ERROR_CODE = (value)) != EOK) && ({printf("error at %s:%d %d\n", __FILE__, __LINE__, ERROR_CODE); 1;}))
 
 #else
Index: uspace/srv/net/il/arp/arp.c
===================================================================
--- uspace/srv/net/il/arp/arp.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/il/arp/arp.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -73,9 +73,4 @@
 arp_globals_t	arp_globals;
 
-/** Clears the device specific data.
- *  @param[in] device The device specific data.
- */
-void arp_clear_device(arp_device_ref device);
-
 /** Creates new protocol specific data.
  *  Allocates and returns the needed memory block as the proto parameter.
@@ -87,4 +82,9 @@
  */
 int arp_proto_create(arp_proto_ref * proto, services_t service, measured_string_ref address);
+
+/** Clears the device specific data.
+ *  @param[in] device The device specific data.
+ */
+void arp_clear_device(arp_device_ref device);
 
 /** @name Message processing functions
@@ -105,11 +105,16 @@
 int arp_device_message(device_id_t device_id, services_t service, services_t protocol, measured_string_ref address);
 
-/** Updates the device content length according to the new MTU value.
+/** Returns the hardware address for the given protocol address.
+ *  Sends the ARP request packet if the hardware address is not found in the cache.
  *  @param[in] device_id The device identifier.
- *  @param[in] mtu The new mtu value.
- *  @returns ENOENT if device is not found.
- *  @returns EOK on success.
- */
-int arp_mtu_changed_message(device_id_t device_id, size_t mtu);
+ *  @param[in] protocol The protocol service.
+ *  @param[in] target The target protocol address.
+ *  @returns The hardware address of the target.
+ *  @returns NULL if the target parameter is NULL.
+ *  @returns NULL if the device is not found.
+ *  @returns NULL if the device packet is too small to send a&nbsp;request.
+ *  @returns NULL if the hardware address is not found in the cache.
+ */
+measured_string_ref arp_translate_message(device_id_t device_id, services_t protocol, measured_string_ref target);
 
 /** Processes the received ARP packet.
@@ -128,16 +133,11 @@
 int arp_receive_message(device_id_t device_id, packet_t packet);
 
-/** Returns the hardware address for the given protocol address.
- *  Sends the ARP request packet if the hardware address is not found in the cache.
+/** Updates the device content length according to the new MTU value.
  *  @param[in] device_id The device identifier.
- *  @param[in] protocol The protocol service.
- *  @param[in] target The target protocol address.
- *  @returns The hardware address of the target.
- *  @returns NULL if the target parameter is NULL.
- *  @returns NULL if the device is not found.
- *  @returns NULL if the device packet is too small to send a&nbsp;request.
- *  @returns NULL if the hardware address is not found in the cache.
- */
-measured_string_ref arp_translate_message(device_id_t device_id, services_t protocol, measured_string_ref target);
+ *  @param[in] mtu The new mtu value.
+ *  @returns ENOENT if device is not found.
+ *  @returns EOK on success.
+ */
+int arp_mtu_changed_message(device_id_t device_id, size_t mtu);
 
 /*@}*/
@@ -148,4 +148,43 @@
 
 GENERIC_CHAR_MAP_IMPLEMENT(arp_addr, measured_string_t)
+
+task_id_t arp_task_get_id(void){
+	return task_get_id();
+}
+
+int arp_clear_device_req(int arp_phone, device_id_t device_id){
+	arp_device_ref device;
+
+	fibril_rwlock_write_lock(&arp_globals.lock);
+	device = arp_cache_find(&arp_globals.cache, device_id);
+	if(! device){
+		fibril_rwlock_write_unlock(&arp_globals.lock);
+		return ENOENT;
+	}
+	arp_clear_device(device);
+	printf("Device %d cleared\n", device_id);
+	fibril_rwlock_write_unlock(&arp_globals.lock);
+	return EOK;
+}
+
+int arp_clear_address_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address){
+	arp_device_ref device;
+	arp_proto_ref proto;
+
+	fibril_rwlock_write_lock(&arp_globals.lock);
+	device = arp_cache_find(&arp_globals.cache, device_id);
+	if(! device){
+		fibril_rwlock_write_unlock(&arp_globals.lock);
+		return ENOENT;
+	}
+	proto = arp_protos_find(&device->protos, protocol);
+	if(! proto){
+		fibril_rwlock_write_unlock(&arp_globals.lock);
+		return ENOENT;
+	}
+	arp_addr_exclude(&proto->addresses, address->value, address->length);
+	fibril_rwlock_write_unlock(&arp_globals.lock);
+	return EOK;
+}
 
 int arp_clean_cache_req(int arp_phone){
@@ -172,61 +211,62 @@
 }
 
-int arp_clear_address_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address){
-	arp_device_ref device;
-	arp_proto_ref proto;
-
+int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address){
+	ERROR_DECLARE;
+
+	measured_string_ref tmp;
+
+	// copy the given address for exclusive use
+	tmp = measured_string_copy(address);
+	if(ERROR_OCCURRED(arp_device_message(device_id, netif, protocol, tmp))){
+		free(tmp->value);
+		free(tmp);
+	}
+	return ERROR_CODE;
+}
+
+int arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data){
+	measured_string_ref tmp;
+
+	fibril_rwlock_read_lock(&arp_globals.lock);
+	tmp = arp_translate_message(device_id, protocol, address);
+	if(tmp){
+		*translation = measured_string_copy(tmp);
+		fibril_rwlock_read_unlock(&arp_globals.lock);
+		if(*translation){
+			*data = (** translation).value;
+			return EOK;
+		}else{
+			return ENOMEM;
+		}
+	}else{
+		fibril_rwlock_read_unlock(&arp_globals.lock);
+		return ENOENT;
+	}
+}
+
+int arp_initialize(async_client_conn_t client_connection){
+	ERROR_DECLARE;
+
+	fibril_rwlock_initialize(&arp_globals.lock);
 	fibril_rwlock_write_lock(&arp_globals.lock);
-	device = arp_cache_find(&arp_globals.cache, device_id);
-	if(! device){
-		fibril_rwlock_write_unlock(&arp_globals.lock);
-		return ENOENT;
-	}
-	proto = arp_protos_find(&device->protos, protocol);
-	if(! proto){
-		fibril_rwlock_write_unlock(&arp_globals.lock);
-		return ENOENT;
-	}
-	arp_addr_exclude(&proto->addresses, address->value, address->length);
+	arp_globals.client_connection = client_connection;
+	ERROR_PROPAGATE(arp_cache_initialize(&arp_globals.cache));
 	fibril_rwlock_write_unlock(&arp_globals.lock);
 	return EOK;
 }
 
-void arp_clear_device(arp_device_ref device){
-	int count;
-	arp_proto_ref proto;
-
-	for(count = arp_protos_count(&device->protos) - 1; count >= 0; -- count){
-		proto = arp_protos_get_index(&device->protos, count);
-		if(proto){
-			if(proto->addr){
-				free(proto->addr);
-			}
-			if(proto->addr_data){
-				free(proto->addr_data);
-			}
-			arp_addr_destroy(&proto->addresses);
-		}
-	}
-	arp_protos_clear(&device->protos);
-}
-
-int arp_clear_device_req(int arp_phone, device_id_t device_id){
-	arp_device_ref device;
-
-	fibril_rwlock_write_lock(&arp_globals.lock);
-	device = arp_cache_find(&arp_globals.cache, device_id);
-	if(! device){
-		fibril_rwlock_write_unlock(&arp_globals.lock);
-		return ENOENT;
-	}
-	arp_clear_device(device);
-	printf("Device %d cleared\n", device_id);
-	fibril_rwlock_write_unlock(&arp_globals.lock);
-	return EOK;
-}
-
-int arp_connect_module(services_t service){
-	if(service != SERVICE_ARP){
-		return EINVAL;
+int arp_proto_create(arp_proto_ref * proto, services_t service, measured_string_ref address){
+	ERROR_DECLARE;
+
+	*proto = (arp_proto_ref) malloc(sizeof(arp_proto_t));
+	if(!(*proto)){
+		return ENOMEM;
+	}
+	(** proto).service = service;
+	(** proto).addr = address;
+	(** proto).addr_data = address->value;
+	if(ERROR_OCCURRED(arp_addr_initialize(&(** proto).addresses))){
+		free(*proto);
+		return ERROR_CODE;
 	}
 	return EOK;
@@ -343,25 +383,168 @@
 }
 
-int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address){
+measured_string_ref arp_translate_message(device_id_t device_id, services_t protocol, measured_string_ref target){
+	arp_device_ref device;
+	arp_proto_ref proto;
+	measured_string_ref addr;
+	size_t length;
+	packet_t packet;
+	arp_header_ref header;
+
+	if(! target){
+		return NULL;
+	}
+	device = arp_cache_find(&arp_globals.cache, device_id);
+	if(! device){
+		return NULL;
+	}
+	proto = arp_protos_find(&device->protos, protocol);
+	if((! proto) || (proto->addr->length != target->length)){
+		return NULL;
+	}
+	addr = arp_addr_find(&proto->addresses, target->value, target->length);
+	if(addr){
+		return addr;
+	}
+	// ARP packet content size = header + (address + translation) * 2
+	length = 8 + (CONVERT_SIZE(char, uint8_t, proto->addr->length) + CONVERT_SIZE(char, uint8_t, device->addr->length)) * 2;
+	if(length > device->packet_dimension.content){
+		return NULL;
+	}
+	packet = packet_get_4(arp_globals.net_phone, device->packet_dimension.addr_len, device->packet_dimension.prefix, length, device->packet_dimension.suffix);
+	if(! packet){
+		return NULL;
+	}
+	header = (arp_header_ref) packet_suffix(packet, length);
+	if(! header){
+		pq_release(arp_globals.net_phone, packet_get_id(packet));
+		return NULL;
+	}
+	header->hardware = htons(device->hardware);
+	header->hardware_length = (uint8_t) device->addr->length;
+	header->protocol = htons(protocol_map(device->service, protocol));
+	header->protocol_length = (uint8_t) proto->addr->length;
+	header->operation = htons(ARPOP_REQUEST);
+	length = sizeof(arp_header_t);
+	memcpy(((uint8_t *) header) + length, device->addr->value, device->addr->length);
+	length += device->addr->length;
+	memcpy(((uint8_t *) header) + length, proto->addr->value, proto->addr->length);
+	length += proto->addr->length;
+	bzero(((uint8_t *) header) + length, device->addr->length);
+	length += device->addr->length;
+	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));
+		return NULL;
+	}
+	nil_send_msg(device->phone, device_id, packet, SERVICE_ARP);
+	return NULL;
+}
+
+int arp_receive_message(device_id_t device_id, packet_t packet){
 	ERROR_DECLARE;
 
-	measured_string_ref tmp;
-
-	// copy the given address for exclusive use
-	tmp = measured_string_copy(address);
-	if(ERROR_OCCURRED(arp_device_message(device_id, netif, protocol, tmp))){
-		free(tmp->value);
-		free(tmp);
-	}
-	return ERROR_CODE;
-}
-
-int arp_initialize(async_client_conn_t client_connection){
-	ERROR_DECLARE;
-
-	fibril_rwlock_initialize(&arp_globals.lock);
+	size_t length;
+	arp_header_ref header;
+	arp_device_ref device;
+	arp_proto_ref proto;
+	measured_string_ref hw_source;
+	uint8_t * src_hw;
+	uint8_t * src_proto;
+	uint8_t * des_hw;
+	uint8_t * des_proto;
+
+	length = packet_get_data_length(packet);
+	if(length <= sizeof(arp_header_t)){
+		return EINVAL;
+	}
+	device = arp_cache_find(&arp_globals.cache, device_id);
+	if(! device){
+		return ENOENT;
+	}
+	header = (arp_header_ref) packet_get_data(packet);
+	if((ntohs(header->hardware) != device->hardware)
+		|| (length < sizeof(arp_header_t) + header->hardware_length * 2u + header->protocol_length * 2u)){
+		return EINVAL;
+	}
+	proto = arp_protos_find(&device->protos, protocol_unmap(device->service, ntohs(header->protocol)));
+	if(! proto){
+		return ENOENT;
+	}
+	src_hw = ((uint8_t *) header) + sizeof(arp_header_t);
+	src_proto = src_hw + header->hardware_length;
+	des_hw = src_proto + header->protocol_length;
+	des_proto = des_hw + header->hardware_length;
+	hw_source = arp_addr_find(&proto->addresses, (char *) src_proto, CONVERT_SIZE(uint8_t, char, header->protocol_length));
+	// exists?
+	if(hw_source){
+		if(hw_source->length != CONVERT_SIZE(uint8_t, char, header->hardware_length)){
+			return EINVAL;
+		}
+		memcpy(hw_source->value, src_hw, hw_source->length);
+	}
+	// is my protocol address?
+	if(proto->addr->length != CONVERT_SIZE(uint8_t, char, header->protocol_length)){
+		return EINVAL;
+	}
+	if(! str_lcmp(proto->addr->value, (char *) des_proto, proto->addr->length)){
+		// not already upadted?
+		if(! hw_source){
+			hw_source = measured_string_create_bulk((char *) src_hw, CONVERT_SIZE(uint8_t, char, header->hardware_length));
+			if(! hw_source){
+				return ENOMEM;
+			}
+			ERROR_PROPAGATE(arp_addr_add(&proto->addresses, (char *) src_proto, CONVERT_SIZE(uint8_t, char, header->protocol_length), hw_source));
+		}
+		if(ntohs(header->operation) == ARPOP_REQUEST){
+			header->operation = htons(ARPOP_REPLY);
+			memcpy(des_proto, src_proto, header->protocol_length);
+			memcpy(src_proto, proto->addr->value, header->protocol_length);
+			memcpy(src_hw, device->addr->value, device->packet_dimension.addr_len);
+			memcpy(des_hw, hw_source->value, header->hardware_length);
+			ERROR_PROPAGATE(packet_set_addr(packet, src_hw, des_hw, header->hardware_length));
+			nil_send_msg(device->phone, device_id, packet, SERVICE_ARP);
+			return 1;
+		}
+	}
+	return EOK;
+}
+
+void arp_clear_device(arp_device_ref device){
+	int count;
+	arp_proto_ref proto;
+
+	for(count = arp_protos_count(&device->protos) - 1; count >= 0; -- count){
+		proto = arp_protos_get_index(&device->protos, count);
+		if(proto){
+			if(proto->addr){
+				free(proto->addr);
+			}
+			if(proto->addr_data){
+				free(proto->addr_data);
+			}
+			arp_addr_destroy(&proto->addresses);
+		}
+	}
+	arp_protos_clear(&device->protos);
+}
+
+int arp_connect_module(services_t service){
+	if(service != SERVICE_ARP){
+		return EINVAL;
+	}
+	return EOK;
+}
+
+int arp_mtu_changed_message(device_id_t device_id, size_t mtu){
+	arp_device_ref device;
+
 	fibril_rwlock_write_lock(&arp_globals.lock);
-	arp_globals.client_connection = client_connection;
-	ERROR_PROPAGATE(arp_cache_initialize(&arp_globals.cache));
+	device = arp_cache_find(&arp_globals.cache, device_id);
+	if(! device){
+		fibril_rwlock_write_unlock(&arp_globals.lock);
+		return ENOENT;
+	}
+	device->packet_dimension.content = mtu;
+	printf("arp - device %d changed mtu to %d\n\n", device_id, mtu);
 	fibril_rwlock_write_unlock(&arp_globals.lock);
 	return EOK;
@@ -435,187 +618,4 @@
 }
 
-int arp_mtu_changed_message(device_id_t device_id, size_t mtu){
-	arp_device_ref device;
-
-	fibril_rwlock_write_lock(&arp_globals.lock);
-	device = arp_cache_find(&arp_globals.cache, device_id);
-	if(! device){
-		fibril_rwlock_write_unlock(&arp_globals.lock);
-		return ENOENT;
-	}
-	device->packet_dimension.content = mtu;
-	printf("arp - device %d changed mtu to %d\n\n", device_id, mtu);
-	fibril_rwlock_write_unlock(&arp_globals.lock);
-	return EOK;
-}
-
-int arp_proto_create(arp_proto_ref * proto, services_t service, measured_string_ref address){
-	ERROR_DECLARE;
-
-	*proto = (arp_proto_ref) malloc(sizeof(arp_proto_t));
-	if(!(*proto)){
-		return ENOMEM;
-	}
-	(** proto).service = service;
-	(** proto).addr = address;
-	(** proto).addr_data = address->value;
-	if(ERROR_OCCURRED(arp_addr_initialize(&(** proto).addresses))){
-		free(*proto);
-		return ERROR_CODE;
-	}
-	return EOK;
-}
-
-int arp_receive_message(device_id_t device_id, packet_t packet){
-	ERROR_DECLARE;
-
-	size_t length;
-	arp_header_ref header;
-	arp_device_ref device;
-	arp_proto_ref proto;
-	measured_string_ref hw_source;
-	uint8_t * src_hw;
-	uint8_t * src_proto;
-	uint8_t * des_hw;
-	uint8_t * des_proto;
-
-	length = packet_get_data_length(packet);
-	if(length <= sizeof(arp_header_t)){
-		return EINVAL;
-	}
-	device = arp_cache_find(&arp_globals.cache, device_id);
-	if(! device){
-		return ENOENT;
-	}
-	header = (arp_header_ref) packet_get_data(packet);
-	if((ntohs(header->hardware) != device->hardware)
-		|| (length < sizeof(arp_header_t) + header->hardware_length * 2u + header->protocol_length * 2u)){
-		return EINVAL;
-	}
-	proto = arp_protos_find(&device->protos, protocol_unmap(device->service, ntohs(header->protocol)));
-	if(! proto){
-		return ENOENT;
-	}
-	src_hw = ((uint8_t *) header) + sizeof(arp_header_t);
-	src_proto = src_hw + header->hardware_length;
-	des_hw = src_proto + header->protocol_length;
-	des_proto = des_hw + header->hardware_length;
-	hw_source = arp_addr_find(&proto->addresses, (char *) src_proto, CONVERT_SIZE(uint8_t, char, header->protocol_length));
-	// exists?
-	if(hw_source){
-		if(hw_source->length != CONVERT_SIZE(uint8_t, char, header->hardware_length)){
-			return EINVAL;
-		}
-		memcpy(hw_source->value, src_hw, hw_source->length);
-	}
-	// is my protocol address?
-	if(proto->addr->length != CONVERT_SIZE(uint8_t, char, header->protocol_length)){
-		return EINVAL;
-	}
-	if(! str_lcmp(proto->addr->value, (char *) des_proto, proto->addr->length)){
-		// not already upadted?
-		if(! hw_source){
-			hw_source = measured_string_create_bulk((char *) src_hw, CONVERT_SIZE(uint8_t, char, header->hardware_length));
-			if(! hw_source){
-				return ENOMEM;
-			}
-			ERROR_PROPAGATE(arp_addr_add(&proto->addresses, (char *) src_proto, CONVERT_SIZE(uint8_t, char, header->protocol_length), hw_source));
-		}
-		if(ntohs(header->operation) == ARPOP_REQUEST){
-			header->operation = htons(ARPOP_REPLY);
-			memcpy(des_proto, src_proto, header->protocol_length);
-			memcpy(src_proto, proto->addr->value, header->protocol_length);
-			memcpy(src_hw, device->addr->value, device->packet_dimension.addr_len);
-			memcpy(des_hw, hw_source->value, header->hardware_length);
-			ERROR_PROPAGATE(packet_set_addr(packet, src_hw, des_hw, header->hardware_length));
-			nil_send_msg(device->phone, device_id, packet, SERVICE_ARP);
-			return 1;
-		}
-	}
-	return EOK;
-}
-
-task_id_t arp_task_get_id(void){
-	return task_get_id();
-}
-
-measured_string_ref arp_translate_message(device_id_t device_id, services_t protocol, measured_string_ref target){
-	arp_device_ref device;
-	arp_proto_ref proto;
-	measured_string_ref addr;
-	size_t length;
-	packet_t packet;
-	arp_header_ref header;
-
-	if(! target){
-		return NULL;
-	}
-	device = arp_cache_find(&arp_globals.cache, device_id);
-	if(! device){
-		return NULL;
-	}
-	proto = arp_protos_find(&device->protos, protocol);
-	if((! proto) || (proto->addr->length != target->length)){
-		return NULL;
-	}
-	addr = arp_addr_find(&proto->addresses, target->value, target->length);
-	if(addr){
-		return addr;
-	}
-	// ARP packet content size = header + (address + translation) * 2
-	length = 8 + (CONVERT_SIZE(char, uint8_t, proto->addr->length) + CONVERT_SIZE(char, uint8_t, device->addr->length)) * 2;
-	if(length > device->packet_dimension.content){
-		return NULL;
-	}
-	packet = packet_get_4(arp_globals.net_phone, device->packet_dimension.addr_len, device->packet_dimension.prefix, length, device->packet_dimension.suffix);
-	if(! packet){
-		return NULL;
-	}
-	header = (arp_header_ref) packet_suffix(packet, length);
-	if(! header){
-		pq_release(arp_globals.net_phone, packet_get_id(packet));
-		return NULL;
-	}
-	header->hardware = htons(device->hardware);
-	header->hardware_length = (uint8_t) device->addr->length;
-	header->protocol = htons(protocol_map(device->service, protocol));
-	header->protocol_length = (uint8_t) proto->addr->length;
-	header->operation = htons(ARPOP_REQUEST);
-	length = sizeof(arp_header_t);
-	memcpy(((uint8_t *) header) + length, device->addr->value, device->addr->length);
-	length += device->addr->length;
-	memcpy(((uint8_t *) header) + length, proto->addr->value, proto->addr->length);
-	length += proto->addr->length;
-	bzero(((uint8_t *) header) + length, device->addr->length);
-	length += device->addr->length;
-	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));
-		return NULL;
-	}
-	nil_send_msg(device->phone, device_id, packet, SERVICE_ARP);
-	return NULL;
-}
-
-int arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data){
-	measured_string_ref tmp;
-
-	fibril_rwlock_read_lock(&arp_globals.lock);
-	tmp = arp_translate_message(device_id, protocol, address);
-	if(tmp){
-		*translation = measured_string_copy(tmp);
-		fibril_rwlock_read_unlock(&arp_globals.lock);
-		if(*translation){
-			*data = (** translation).value;
-			return EOK;
-		}else{
-			return ENOMEM;
-		}
-	}else{
-		fibril_rwlock_read_unlock(&arp_globals.lock);
-		return ENOENT;
-	}
-}
-
 /** @}
  */
Index: uspace/srv/net/il/arp/arp.h
===================================================================
--- uspace/srv/net/il/arp/arp.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/il/arp/arp.h	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -51,4 +51,9 @@
 
 
+/** Type definition of the ARP global data.
+ *  @see arp_globals
+ */
+typedef struct arp_globals	arp_globals_t;
+
 /** Type definition of the ARP device specific data.
  *  @see arp_device
@@ -61,9 +66,4 @@
 typedef arp_device_t *		arp_device_ref;
 
-/** Type definition of the ARP global data.
- *  @see arp_globals
- */
-typedef struct arp_globals	arp_globals_t;
-
 /** Type definition of the ARP protocol specific data.
  *  @see arp_proto
@@ -75,10 +75,4 @@
  */
 typedef arp_proto_t *		arp_proto_ref;
-
-/** ARP address map.
- *  Translates addresses.
- *  @see generic_char_map.h
- */
-GENERIC_CHAR_MAP_DECLARE(arp_addr, measured_string_t)
 
 /** ARP address cache.
@@ -94,7 +88,22 @@
 INT_MAP_DECLARE(arp_protos, arp_proto_t)
 
+/** ARP address map.
+ *  Translates addresses.
+ *  @see generic_char_map.h
+ */
+GENERIC_CHAR_MAP_DECLARE(arp_addr, measured_string_t)
+
 /** ARP device specific data.
  */
 struct arp_device{
+	/** Device identifier.
+	 */
+	device_id_t device_id;
+	/** Hardware type.
+	 */
+	hw_type_t hardware;
+	/** Packet dimension.
+	 */
+	packet_dimension_t packet_dimension;
 	/** Actual device hardware address.
 	 */
@@ -109,13 +118,7 @@
 	 */
 	char * broadcast_data;
-	/** Device identifier.
+	/** Device module service.
 	 */
-	device_id_t device_id;
-	/** Hardware type.
-	 */
-	hw_type_t hardware;
-	/** Packet dimension.
-	 */
-	packet_dimension_t packet_dimension;
+	services_t service;
 	/** Device module phone.
 	 */
@@ -125,25 +128,4 @@
 	 */
 	arp_protos_t protos;
-	/** Device module service.
-	 */
-	services_t service;
-};
-
-/** ARP global data.
- */
-struct	arp_globals{
-	/** ARP address cache.
-	 */
-	arp_cache_t cache;
-	/** The client connection processing function.
-	 *  The module skeleton propagates its own one.
-	 */
-	async_client_conn_t client_connection;
-	/** Networking module phone.
-	 */
-	int net_phone;
-	/** Safety lock.
-	 */
-	fibril_rwlock_t lock;
 };
 
@@ -151,4 +133,7 @@
  */
 struct arp_proto{
+	/** Protocol service.
+	 */
+	services_t service;
 	/** Actual device protocol address.
 	 */
@@ -160,7 +145,22 @@
 	 */
 	arp_addr_t addresses;
-	/** Protocol service.
+};
+
+/** ARP global data.
+ */
+struct	arp_globals{
+	/** Networking module phone.
 	 */
-	services_t service;
+	int net_phone;
+	/** Safety lock.
+	 */
+	fibril_rwlock_t lock;
+	/** ARP address cache.
+	 */
+	arp_cache_t cache;
+	/** The client connection processing function.
+	 *  The module skeleton propagates its own one.
+	 */
+	async_client_conn_t client_connection;
 };
 
Index: uspace/srv/net/il/arp/arp_messages.h
===================================================================
--- uspace/srv/net/il/arp/arp_messages.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/il/arp/arp_messages.h	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -46,24 +46,24 @@
  */
 typedef enum{
-	/** Clean cache message.
-	 *  @see arp_clean_cache()
+	/** New device message.
+	 *  @see arp_device_req()
 	 */
-	NET_ARP_CLEAN_CACHE = NET_ARP_FIRST,
+	NET_ARP_DEVICE = NET_ARP_FIRST,
+	/** Address translation message.
+	 *  @see arp_translate_req()
+	 */
+	NET_ARP_TRANSLATE,
+	/** Clear device cache message.
+	 *  @see arp_clear_device_req()
+	 */
+	NET_ARP_CLEAR_DEVICE,
 	/** Clear address cache message.
 	 *  @see arp_clear_address_msg()
 	 */
 	NET_ARP_CLEAR_ADDRESS,
-	/** Clear device cache message.
-	 *  @see arp_clear_device_req()
+	/** Clean cache message.
+	 *  @see arp_clean_cache()
 	 */
-	NET_ARP_CLEAR_DEVICE,
-	/** New device message.
-	 *  @see arp_device_req()
-	 */
-	NET_ARP_DEVICE,
-	/** Address translation message.
-	 *  @see arp_translate_req()
-	 */
-	NET_ARP_TRANSLATE
+	NET_ARP_CLEAN_CACHE,
 } arp_messages;
 
Index: uspace/srv/net/il/arp/arp_module.c
===================================================================
--- uspace/srv/net/il/arp/arp_module.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/il/arp/arp_module.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -58,18 +58,4 @@
 #define NAME	"ARP protocol"
 
-/** ARP module global data.
- */
-extern arp_globals_t	arp_globals;
-
-/** Processes the ARP 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 Other error codes as defined for the arp_message() function.
- */
-int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
-
 /** Prints the module name.
  *  @see NAME
@@ -86,7 +72,17 @@
 int module_start(async_client_conn_t client_connection);
 
-int 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);
-}
+/** Processes the ARP 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 Other error codes as defined for the arp_message() function.
+ */
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
+
+/** ARP module global data.
+ */
+extern arp_globals_t	arp_globals;
 
 void module_print_name(void){
@@ -114,4 +110,8 @@
 }
 
+int 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);
+}
+
 /** @}
  */
Index: uspace/srv/net/il/arp/arp_oc.h
===================================================================
--- uspace/srv/net/il/arp/arp_oc.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/il/arp/arp_oc.h	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -44,81 +44,81 @@
 /** REQUEST operation code.
  */
-#define ARPOP_REQUEST					1
+#define ARPOP_REQUEST		1
 
 /** REPLY operation code.
  */
-#define ARPOP_REPLY						2
+#define ARPOP_REPLY		2
 
 /** Reverse request operation code.
  */
-#define ARPOP_RREQUEST					3
+#define ARPOP_RREQUEST		3
 
 /** Reverse reply operation code.
  */
-#define ARPOP_RREPLY					4
+#define ARPOP_RREPLY		4
 
 /** DRARP-Request operation code.
  */
-#define ARPOP_DRARP_Request				5
+#define ARPOP_DRARP_Request		5
 
 /** DRARP-Reply operation code.
  */
-#define ARPOP_DRARP_Reply				6
+#define ARPOP_DRARP_Reply		6
 
 /** DRARP-Error operation code.
  */
-#define ARPOP_DRARP_Error				7
+#define ARPOP_DRARP_Error		7
 
 /** InARP-Request operation code.
  */
-#define ARPOP_InREQUEST					8
+#define ARPOP_InREQUEST		8
 
 /** InARP-Reply operation code.
  */
-#define ARPOP_InREPLY					9
+#define ARPOP_InREPLY		9
 
 /** ARP-NAK operation code.
  */
-#define ARPOP_NAK						10
+#define ARPOP_NAK		10
 
 /** MARS-Request operation code.
  */
-#define ARPOP_MARS_Request				11
+#define ARPOP_MARS_Request		11
 
 /** MARS-Multi operation code.
  */
-#define ARPOP_MARS_Multi				12
+#define ARPOP_MARS_Multi		12
 
 /** MARS-MServ operation code.
  */
-#define ARPOP_MARS_MServ				13
+#define ARPOP_MARS_MServ		13
 
 /** MARS-Join operation code.
  */
-#define ARPOP_MARS_Join					14
+#define ARPOP_MARS_Join		14
 
 /** MARS-Leave operation code.
  */
-#define ARPOP_MARS_Leave				15
+#define ARPOP_MARS_Leave		15
 
 /** MARS-NAK operation code.
  */
-#define ARPOP_MARS_NAK					16
+#define ARPOP_MARS_NAK		16
 
 /** MARS-Unserv operation code.
  */
-#define ARPOP_MARS_Unserv				17
+#define ARPOP_MARS_Unserv		17
 
 /** MARS-SJoin operation code.
  */
-#define ARPOP_MARS_SJoin				18
+#define ARPOP_MARS_SJoin		18
 
 /** MARS-SLeave operation code.
  */
-#define ARPOP_MARS_SLeave				19
+#define ARPOP_MARS_SLeave		19
 
 /** MARS-Grouplist-Request operation code.
  */
-#define ARPOP_MARS_Grouplist_Request	20
+#define ARPOP_MARS_Grouplist_Request		20
 
 /** MARS-Grouplist-Reply operation code.
@@ -128,9 +128,9 @@
 /** MARS-Redirect-Map operation code.
  */
-#define ARPOP_MARS_Redirect_Map			22
+#define ARPOP_MARS_Redirect_Map		22
 
 /** MAPOS-UNARP operation code.
  */
-#define ARPOP_MAPOS_UNARP				23
+#define ARPOP_MAPOS_UNARP		23
 
 /*@}*/
Index: uspace/srv/net/il/arp/arp_remote.c
===================================================================
--- uspace/srv/net/il/arp/arp_remote.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/il/arp/arp_remote.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -52,13 +52,20 @@
 #include "arp_messages.h"
 
-int arp_connect_module(services_t service){
-	if(service != SERVICE_ARP){
-		return EINVAL;
-	}
-	return connect_to_service(SERVICE_ARP);
+int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address){
+	aid_t message_id;
+	ipcarg_t result;
+
+	message_id = async_send_3(arp_phone, NET_ARP_DEVICE, (ipcarg_t) device_id, protocol, netif, NULL);
+	measured_strings_send(arp_phone, address, 1);
+	async_wait_for(message_id, &result);
+	return (int) result;
 }
 
-int arp_clean_cache_req(int arp_phone){
-	return (int) async_req_0_0(arp_phone, NET_ARP_CLEAN_CACHE);
+int arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data){
+	return generic_translate_req(arp_phone, NET_ARP_TRANSLATE, device_id, protocol, address, 1, translation, data);
+}
+
+int arp_clear_device_req(int arp_phone, device_id_t device_id){
+	return (int) async_req_1_0(arp_phone, NET_ARP_CLEAR_DEVICE, (ipcarg_t) device_id);
 }
 
@@ -73,16 +80,13 @@
 }
 
-int arp_clear_device_req(int arp_phone, device_id_t device_id){
-	return (int) async_req_1_0(arp_phone, NET_ARP_CLEAR_DEVICE, (ipcarg_t) device_id);
+int arp_clean_cache_req(int arp_phone){
+	return (int) async_req_0_0(arp_phone, NET_ARP_CLEAN_CACHE);
 }
 
-int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address){
-	aid_t message_id;
-	ipcarg_t result;
-
-	message_id = async_send_3(arp_phone, NET_ARP_DEVICE, (ipcarg_t) device_id, protocol, netif, NULL);
-	measured_strings_send(arp_phone, address, 1);
-	async_wait_for(message_id, &result);
-	return (int) result;
+int arp_connect_module(services_t service){
+	if(service != SERVICE_ARP){
+		return EINVAL;
+	}
+	return connect_to_service(SERVICE_ARP);
 }
 
@@ -91,8 +95,4 @@
 }
 
-int arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data){
-	return generic_translate_req(arp_phone, NET_ARP_TRANSLATE, device_id, protocol, address, 1, translation, data);
-}
-
 /** @}
  */
Index: uspace/srv/net/il/il_messages.h
===================================================================
--- uspace/srv/net/il/il_messages.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/il/il_messages.h	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -53,12 +53,4 @@
 	 */
 	NET_IL_DEVICE_STATE,
-	/** Device MTU changed message.
-	 *  @see il_mtu_changed_msg()
-	 */
-	NET_IL_MTU_CHANGED,
-	/** Packet size message.
-	 *  @see il_packet_size_req()
-	 */
-	NET_IL_PACKET_SPACE,
 	/** Packet received message.
 	 *  @see il_received_msg()
@@ -68,5 +60,13 @@
 	 *  @see il_send_msg()
 	 */
-	NET_IL_SEND
+	NET_IL_SEND,
+	/** Packet size message.
+	 *  @see il_packet_size_req()
+	 */
+	NET_IL_PACKET_SPACE,
+	/** Device MTU changed message.
+	 *  @see il_mtu_changed_msg()
+	 */
+	NET_IL_MTU_CHANGED
 } il_messages;
 
@@ -83,5 +83,5 @@
  *  @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/srv/net/il/ip/ip.h
===================================================================
--- uspace/srv/net/il/ip/ip.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/il/ip/ip.h	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -106,55 +106,55 @@
  */
 struct	ip_netif{
+	/** Device identifier.
+	 */
+	device_id_t device_id;
+	/** Netif module service.
+	 */
+	services_t service;
+	/** Netif module phone.
+	 */
+	int phone;
 	/** ARP module.
 	 *  Assigned if using ARP.
 	 */
 	module_ref arp;
+	/** IP version.
+	 */
+	int ipv;
+	/** Indicates whether using DHCP.
+	 */
+	int dhcp;
+	/** Indicates whether IP routing is enabled.
+	 */
+	int routing;
+	/** Device state.
+	 */
+	device_state_t state;
 	/** Broadcast address.
 	 */
 	in_addr_t broadcast;
-	/** Device identifier.
-	 */
-	device_id_t device_id;
-	/** Indicates whether using DHCP.
-	 */
-	int dhcp;
-	/** IP version.
-	 */
-	int ipv;
+	/** Routing table.
+	 */
+	ip_routes_t routes;
 	/** Packet dimension.
 	 */
 	packet_dimension_t packet_dimension;
-	/** Netif module phone.
+};
+
+/** IP protocol specific data.
+ */
+struct ip_proto{
+	/** Protocol number.
+	 */
+	int protocol;
+	/** Protocol module service.
+	 */
+	services_t service;
+	/** Protocol module phone.
 	 */
 	int phone;
-	/** Routing table.
-	 */
-	ip_routes_t routes;
-	/** Indicates whether IP routing is enabled.
-	 */
-	int routing;
-	/** Netif module service.
-	 */
-	services_t service;
-	/** Device state.
-	 */
-	device_state_t state;
-};
-
-/** IP protocol specific data.
- */
-struct ip_proto{
-	/** Protocol module phone.
-	 */
-	int phone;
-	/** Protocol number.
-	 */
-	int protocol;
 	/** Protocol packet receiving function.
 	 */
 	tl_received_msg_t received_msg;
-	/** Protocol module service.
-	 */
-	services_t service;
 };
 
@@ -165,4 +165,7 @@
 	 */
 	in_addr_t address;
+	/** Target network mask.
+	 */
+	in_addr_t netmask;
 	/** Gateway.
 	 */
@@ -171,7 +174,4 @@
 	 */
 	ip_netif_ref netif;
-	/** Target network mask.
-	 */
-	in_addr_t netmask;
 };
 
@@ -179,16 +179,4 @@
  */
 struct	ip_globals{
-	/** Default client connection function for support modules.
-	 */
-	async_client_conn_t client_connection;
-	/** Default gateway.
-	 */
-	ip_route_t gateway;
-	/** Safety lock.
-	 */
-	fibril_rwlock_t lock;
-	/** Known support modules.
-	 */
-	modules_t modules;
 	/** Networking module phone.
 	 */
@@ -200,7 +188,4 @@
 	 */
 	fibril_rwlock_t netifs_lock;
-	/** Packet counter.
-	 */
-	uint16_t packet_counter;
 	/** Registered protocols.
 	 */
@@ -209,4 +194,19 @@
 	 */
 	fibril_rwlock_t protos_lock;
+	/** Default gateway.
+	 */
+	ip_route_t gateway;
+	/** Known support modules.
+	 */
+	modules_t modules;
+	/** Default client connection function for support modules.
+	 */
+	async_client_conn_t client_connection;
+	/** Packet counter.
+	 */
+	uint16_t packet_counter;
+	/** Safety lock.
+	 */
+	fibril_rwlock_t lock;
 };
 
Index: uspace/srv/net/il/ip/ip_client.c
===================================================================
--- uspace/srv/net/il/ip/ip_client.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/il/ip/ip_client.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -48,4 +48,60 @@
 #include "ip_header.h"
 
+int ip_client_prepare_packet(packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, size_t ipopt_length){
+	ip_header_ref header;
+	uint8_t * data;
+	size_t padding;
+
+	padding =  ipopt_length % 4;
+	if(padding){
+		padding = 4 - padding;
+		ipopt_length += padding;
+	}
+	data = (uint8_t *) packet_prefix(packet, sizeof(ip_header_t) + padding);
+	if(! data){
+		return ENOMEM;
+	}
+	while(padding --){
+		data[sizeof(ip_header_t) + padding] = IPOPT_NOOP;
+	}
+	header = (ip_header_ref) data;
+	header->header_length = IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) + ipopt_length);
+	header->ttl = (ttl ? ttl : IPDEFTTL); //(((ttl) <= MAXTTL) ? ttl : MAXTTL) : IPDEFTTL;
+	header->tos = tos;
+	header->protocol = protocol;
+	if(dont_fragment){
+		header->flags = IPFLAG_DONT_FRAGMENT;
+	}
+	return EOK;
+}
+
+int ip_client_process_packet(packet_t packet, ip_protocol_t * protocol, ip_ttl_t * ttl, ip_tos_t * tos, int * dont_fragment, size_t * ipopt_length){
+	ip_header_ref header;
+
+	header = (ip_header_ref) packet_get_data(packet);
+	if((! header)
+		|| (packet_get_data_length(packet) < sizeof(ip_header_t))){
+		return ENOMEM;
+	}
+	if(protocol){
+		*protocol = header->protocol;
+	}
+	if(ttl){
+		*ttl = header->ttl;
+	}
+	if(tos){
+		*tos = header->tos;
+	}
+	if(dont_fragment){
+		*dont_fragment = header->flags &IPFLAG_DONT_FRAGMENT;
+	}
+	if(ipopt_length){
+		*ipopt_length = IP_HEADER_LENGTH(header) - sizeof(ip_header_t);
+		return sizeof(ip_header_t);
+	}else{
+		return IP_HEADER_LENGTH(header);
+	}
+}
+
 size_t ip_client_header_length(packet_t packet){
 	ip_header_ref header;
@@ -57,4 +113,19 @@
 	}
 	return IP_HEADER_LENGTH(header);
+}
+
+int ip_client_set_pseudo_header_data_length(ip_pseudo_header_ref header, size_t headerlen, size_t data_length){
+	ipv4_pseudo_header_ref header_in;
+
+	if(! header){
+		return EBADMEM;
+	}
+	if(headerlen == sizeof(ipv4_pseudo_header_t)){
+		header_in = (ipv4_pseudo_header_ref) header;
+		header_in->data_length = htons(data_length);
+		return EOK;
+	}else{
+		return EINVAL;
+	}
 }
 
@@ -69,5 +140,4 @@
 		return EINVAL;
 	}
-
 	switch(src->sa_family){
 		case AF_INET:
@@ -101,87 +171,4 @@
 }
 
-int ip_client_prepare_packet(packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, size_t ipopt_length){
-	ip_header_ref header;
-	uint8_t * data;
-	size_t padding;
-
-	// compute the padding if IP options are set
-	// multiple of 4 bytes
-	padding =  ipopt_length % 4;
-	if(padding){
-		padding = 4 - padding;
-		ipopt_length += padding;
-	}
-
-	// prefix the header
-	data = (uint8_t *) packet_prefix(packet, sizeof(ip_header_t) + padding);
-	if(! data){
-		return ENOMEM;
-	}
-
-	// add the padding
-	while(padding --){
-		data[sizeof(ip_header_t) + padding] = IPOPT_NOOP;
-	}
-
-	// set the header
-	header = (ip_header_ref) data;
-	header->header_length = IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) + ipopt_length);
-	header->ttl = (ttl ? ttl : IPDEFTTL); //(((ttl) <= MAXTTL) ? ttl : MAXTTL) : IPDEFTTL;
-	header->tos = tos;
-	header->protocol = protocol;
-
-	if(dont_fragment){
-		header->flags = IPFLAG_DONT_FRAGMENT;
-	}
-	return EOK;
-}
-
-int ip_client_process_packet(packet_t packet, ip_protocol_t * protocol, ip_ttl_t * ttl, ip_tos_t * tos, int * dont_fragment, size_t * ipopt_length){
-	ip_header_ref header;
-
-	header = (ip_header_ref) packet_get_data(packet);
-	if((! header)
-		|| (packet_get_data_length(packet) < sizeof(ip_header_t))){
-		return ENOMEM;
-	}
-
-	if(protocol){
-		*protocol = header->protocol;
-	}
-	if(ttl){
-		*ttl = header->ttl;
-	}
-	if(tos){
-		*tos = header->tos;
-	}
-	if(dont_fragment){
-		*dont_fragment = header->flags &IPFLAG_DONT_FRAGMENT;
-	}
-	if(ipopt_length){
-		*ipopt_length = IP_HEADER_LENGTH(header) - sizeof(ip_header_t);
-		return sizeof(ip_header_t);
-	}else{
-		return IP_HEADER_LENGTH(header);
-	}
-}
-
-int ip_client_set_pseudo_header_data_length(ip_pseudo_header_ref header, size_t headerlen, size_t data_length){
-	ipv4_pseudo_header_ref header_in;
-
-	if(! header){
-		return EBADMEM;
-	}
-
-	if(headerlen == sizeof(ipv4_pseudo_header_t)){
-		header_in = (ipv4_pseudo_header_ref) header;
-		header_in->data_length = htons(data_length);
-		return EOK;
-	// TODO IPv6
-	}else{
-		return EINVAL;
-	}
-}
-
 /** @}
  */
Index: uspace/srv/net/il/ip/ip_header.h
===================================================================
--- uspace/srv/net/il/ip/ip_header.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/il/ip/ip_header.h	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -42,4 +42,34 @@
 #include <sys/types.h>
 
+/** Returns the actual IP header length in bytes.
+ *  @param[in] header The IP packet header.
+ */
+#define IP_HEADER_LENGTH(header)		((header)->header_length * 4u)
+
+/** Returns the IP header length.
+ *  @param[in] length The IP header length in bytes.
+ */
+#define IP_COMPUTE_HEADER_LENGTH(length)		((uint8_t) ((length) / 4u))
+
+/** Returns the actual IP packet total length.
+ *  @param[in] header The IP packet header.
+ */
+#define IP_TOTAL_LENGTH(header)		ntohs((header)->total_length)
+
+/** Returns the actual IP packet data length.
+ *  @param[in] header The IP packet header.
+ */
+#define IP_HEADER_DATA_LENGTH(header)	(IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header))
+
+/** Returns the IP packet header checksum.
+ *  @param[in] header The IP packet header.
+ */
+#define IP_HEADER_CHECKSUM(header)	(htons(ip_checksum((uint8_t *)(header), IP_HEADER_LENGTH(header))))
+
+/** Returns the fragment offest.
+ *  @param[in] header The IP packet header.
+ */
+#define IP_FRAGMENT_OFFSET(header) ((((header)->fragment_offset_high << 8) + (header)->fragment_offset_low) * 8u)
+
 /** Returns the fragment offest high bits.
  *  @param[in] length The prefixed data total length.
@@ -52,68 +82,4 @@
 #define IP_COMPUTE_FRAGMENT_OFFSET_LOW(length) (((length) / 8u) &0xFF)
 
-/** Returns the IP header length.
- *  @param[in] length The IP header length in bytes.
- */
-#define IP_COMPUTE_HEADER_LENGTH(length)		((uint8_t) ((length) / 4u))
-
-/** Returns the fragment offest.
- *  @param[in] header The IP packet header.
- */
-#define IP_FRAGMENT_OFFSET(header) ((((header)->fragment_offset_high << 8) + (header)->fragment_offset_low) * 8u)
-
-/** Returns the IP packet header checksum.
- *  @param[in] header The IP packet header.
- */
-#define IP_HEADER_CHECKSUM(header)	(htons(ip_checksum((uint8_t *)(header), IP_HEADER_LENGTH(header))))
-
-/** Returns the actual IP packet data length.
- *  @param[in] header The IP packet header.
- */
-#define IP_HEADER_DATA_LENGTH(header)	(IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header))
-
-/** Returns the actual IP header length in bytes.
- *  @param[in] header The IP packet header.
- */
-#define IP_HEADER_LENGTH(header)		((header)->header_length * 4u)
-
-/** Returns the actual IP packet total length.
- *  @param[in] header The IP packet header.
- */
-#define IP_TOTAL_LENGTH(header)		ntohs((header)->total_length)
-
-/** @name IP flags definitions
- */
-/*@{*/
-
-/** Fragment flag field shift.
- */
-#define IPFLAG_FRAGMENT_SHIFT		1
-
-/** Fragmented flag field shift.
- */
-#define IPFLAG_FRAGMENTED_SHIFT		0
-
-/** Don't fragment flag value.
- *  Permits the packet fragmentation.
- */
-#define IPFLAG_DONT_FRAGMENT		(0x1 << IPFLAG_FRAGMENT_SHIFT)
-
-/** Last fragment flag value.
- *  Indicates the last packet fragment.
- */
-#define IPFLAG_LAST_FRAGMENT		(0x0 << IPFLAG_FRAGMENTED_SHIFT)
-
-/** May fragment flag value.
- *  Allows the packet fragmentation.
- */
-#define IPFLAG_MAY_FRAGMENT			(0x0 << IPFLAG_FRAGMENT_SHIFT)
-
-/** More fragments flag value.
- *  Indicates that more packet fragments follow.
- */
-#define IPFLAG_MORE_FRAGMENTS		(0x1 << IPFLAG_FRAGMENTED_SHIFT)
-
-/*@}*/
-
 /** Type definition of the internet header.
  *  @see ip_header
@@ -125,24 +91,4 @@
  */
 typedef ip_header_t *		ip_header_ref;
-
-/** Type definition of the internet option header.
- *  @see ip_header
- */
-typedef struct ip_option	ip_option_t;
-
-/** Type definition of the internet option header pointer.
- *  @see ip_header
- */
-typedef ip_option_t *		ip_option_ref;
-
-/** Type definition of the internet version 4 pseudo header.
- *  @see ipv4_pseudo_header
- */
-typedef struct ipv4_pseudo_header	ipv4_pseudo_header_t;
-
-/** Type definition of the internet version 4 pseudo header pointer.
- *  @see ipv4_pseudo_header
- */
-typedef ipv4_pseudo_header_t *		ipv4_pseudo_header_ref;
 
 /** Internet header.
@@ -225,4 +171,14 @@
 } __attribute__ ((packed));
 
+/** Type definition of the internet option header.
+ *  @see ip_header
+ */
+typedef struct ip_option	ip_option_t;
+
+/** Type definition of the internet option header pointer.
+ *  @see ip_header
+ */
+typedef ip_option_t *		ip_option_ref;
+
 /** Internet option header.
  *  Only type field is always valid.
@@ -256,4 +212,48 @@
 } __attribute__ ((packed));
 
+/** @name IP flags definitions
+ */
+/*@{*/
+
+/** Fragment flag field shift.
+ */
+#define IPFLAG_FRAGMENT_SHIFT		1
+
+/** Fragmented flag field shift.
+ */
+#define IPFLAG_FRAGMENTED_SHIFT		0
+
+/** May fragment flag value.
+ *  Allows the packet fragmentation.
+ */
+#define IPFLAG_MAY_FRAGMENT			(0x0 << IPFLAG_FRAGMENT_SHIFT)
+
+/** Don't fragment flag value.
+ *  Permits the packet fragmentation.
+ */
+#define IPFLAG_DONT_FRAGMENT		(0x1 << IPFLAG_FRAGMENT_SHIFT)
+
+/** Last fragment flag value.
+ *  Indicates the last packet fragment.
+ */
+#define IPFLAG_LAST_FRAGMENT		(0x0 << IPFLAG_FRAGMENTED_SHIFT)
+
+/** More fragments flag value.
+ *  Indicates that more packet fragments follow.
+ */
+#define IPFLAG_MORE_FRAGMENTS		(0x1 << IPFLAG_FRAGMENTED_SHIFT)
+
+/*@}*/
+
+/** Type definition of the internet version 4 pseudo header.
+ *  @see ipv4_pseudo_header
+ */
+typedef struct ipv4_pseudo_header	ipv4_pseudo_header_t;
+
+/** Type definition of the internet version 4 pseudo header pointer.
+ *  @see ipv4_pseudo_header
+ */
+typedef ipv4_pseudo_header_t *		ipv4_pseudo_header_ref;
+
 /** Internet version 4 pseudo header.
  */
Index: uspace/srv/net/il/ip/ip_messages.h
===================================================================
--- uspace/srv/net/il/ip/ip_messages.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/il/ip/ip_messages.h	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -51,16 +51,16 @@
 	 */
 	NET_IP_ADD_ROUTE = NET_IP_FIRST,
-	/** Gets the actual route information.
-	 *  @see ip_get_route()
+	/** Sets the default gateway.
+	 *  @see ip_set_default_gateway()
 	 */
-	NET_IP_GET_ROUTE,
+	NET_IP_SET_GATEWAY,
 	/** Processes the received error notification.
 	 *  @see ip_received_error_msg()
 	 */
 	NET_IP_RECEIVED_ERROR,
-	/** Sets the default gateway.
-	 *  @see ip_set_default_gateway()
+	/** Gets the actual route information.
+	 *  @see ip_get_route()
 	 */
-	NET_IP_SET_GATEWAY
+	NET_IP_GET_ROUTE
 } ip_messages;
 
@@ -69,9 +69,4 @@
 /*@{*/
 
-/** Returns the address message parameter.
- *  @param[in] call The message call structure.
- */
-#define IP_GET_ADDRESS(call)		({in_addr_t addr; addr.s_addr = IPC_GET_ARG3(*call); addr;})
-
 /** Returns the gateway message parameter.
  *  @param[in] call The message call structure.
@@ -79,8 +74,8 @@
 #define IP_GET_GATEWAY(call)		({in_addr_t addr; addr.s_addr = IPC_GET_ARG2(*call); addr;})
 
-/** Sets the header length in the message answer.
- *  @param[out] answer The message answer structure.
+/** Returns the address message parameter.
+ *  @param[in] call The message call structure.
  */
-#define IP_SET_HEADERLEN(answer)	((size_t *) &IPC_GET_ARG2(*answer))
+#define IP_GET_ADDRESS(call)		({in_addr_t addr; addr.s_addr = IPC_GET_ARG3(*call); addr;})
 
 /** Returns the network mask message parameter.
@@ -94,4 +89,9 @@
 #define IP_GET_PROTOCOL(call)		((ip_protocol_t) IPC_GET_ARG1(*call))
 
+/** Sets the header length in the message answer.
+ *  @param[out] answer The message answer structure.
+ */
+#define IP_SET_HEADERLEN(answer)	((size_t *) &IPC_GET_ARG2(*answer))
+
 /*@}*/
 
Index: uspace/srv/net/il/ip/ip_module.c
===================================================================
--- uspace/srv/net/il/ip/ip_module.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/il/ip/ip_module.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -58,18 +58,4 @@
 #define NAME	"IP protocol"
 
-/** IP module global data.
- */
-extern ip_globals_t	ip_globals;
-
-/** Processes the IP 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 Other error codes as defined for the ip_message() function.
- */
-int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
-
 /** Prints the module name.
  *  @see NAME
@@ -86,7 +72,17 @@
 int module_start(async_client_conn_t client_connection);
 
-int 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);
-}
+/** Processes the IP 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 Other error codes as defined for the ip_message() function.
+ */
+int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
+
+/** IP module global data.
+ */
+extern ip_globals_t	ip_globals;
 
 void module_print_name(void){
@@ -114,4 +110,8 @@
 }
 
+int 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);
+}
+
 /** @}
  */
Index: uspace/srv/net/il/ip/ip_remote.c
===================================================================
--- uspace/srv/net/il/ip/ip_remote.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/il/ip/ip_remote.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -52,6 +52,26 @@
 #include "ip_messages.h"
 
+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_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_connect_module(services_t service){
+	return connect_to_service(SERVICE_IP);
+}
+
 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_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);
+}
+
+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);
 }
 
@@ -60,10 +80,6 @@
 }
 
-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_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);
 }
 
@@ -79,5 +95,4 @@
 		return EBADMEM;
 	}
-
 	*header = NULL;
 	message_id = async_send_1(ip_phone, NET_IP_GET_ROUTE, (ipcarg_t) protocol, &answer);
@@ -93,5 +108,4 @@
 	}
 	async_wait_for(message_id, &result);
-
 	if((result != EOK) && (*header)){
 		free(*header);
@@ -102,20 +116,4 @@
 }
 
-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);
-}
-
 /** @}
  */
Index: uspace/srv/net/inet.c
===================================================================
--- uspace/srv/net/inet.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/inet.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -45,45 +45,11 @@
 #include "include/socket_codes.h"
 
-int inet_ntop(uint16_t family, const uint8_t * data, char * address, size_t length){
-	if((! data) || (! address)){
-		return EINVAL;
-	}
-
-	switch(family){
-		case AF_INET:
-			// check the output buffer size
-			if(length < INET_ADDRSTRLEN){
-				return ENOMEM;
-			}
-			// fill the buffer with the IPv4 address
-			snprintf(address, length, "%hhu.%hhu.%hhu.%hhu", data[0], data[1], data[2], data[3]);
-			return EOK;
-		case AF_INET6:
-			// check the output buffer size
-			if(length < INET6_ADDRSTRLEN){
-				return ENOMEM;
-			}
-			// fill the buffer with the IPv6 address
-			snprintf(address, length, "%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15]);
-			return EOK;
-		default:
-			return ENOTSUP;
-	}
-}
-
 int inet_pton(uint16_t family, const char * address, uint8_t * data){
-	/** The base number of the values.
-	 */
-	int base;
-	/** The number of bytes per a section.
-	 */
-	size_t bytes;
-	/** The number of bytes of the address data.
-	 */
-	int count;
-
 	const char * next;
 	char * last;
 	int index;
+	int count;
+	int base;
+	size_t bytes;
 	size_t shift;
 	unsigned long value;
@@ -92,6 +58,4 @@
 		return EINVAL;
 	}
-
-	// set the processing parameters
 	switch(family){
 		case AF_INET:
@@ -108,31 +72,17 @@
 			return ENOTSUP;
 	}
-
-	// erase if no address
 	if(! address){
 		bzero(data, count);
 		return ENOENT;
 	}
-
-	// process the string from the beginning
 	next = address;
 	index = 0;
 	do{
-		// if the actual character is set
 		if(next && (*next)){
-
-			// if not on the first character
 			if(index){
-				// move to the next character
 				++ next;
 			}
-
-			// parse the actual integral value
 			value = strtoul(next, &last, base);
-			// remember the last problematic character
-			// should be either '.' or ':' but is ignored to be more generic
 			next = last;
-
-			// fill the address data byte by byte
 			shift = bytes - 1;
 			do{
@@ -141,14 +91,33 @@
 				value >>= 8;
 			}while(shift --);
-
 			index += bytes;
 		}else{
-			// erase the rest of the address
 			bzero(data + index, count - index);
 			return EOK;
 		}
 	}while(index < count);
+	return EOK;
+}
 
-	return EOK;
+int inet_ntop(uint16_t family, const uint8_t * data, char * address, size_t length){
+	if((! data) || (! address)){
+		return EINVAL;
+	}
+	switch(family){
+		case AF_INET:
+			if(length < INET_ADDRSTRLEN){
+				return ENOMEM;
+			}
+			snprintf(address, length, "%hhu.%hhu.%hhu.%hhu", data[0], data[1], data[2], data[3]);
+			return EOK;
+		case AF_INET6:
+			if(length < INET6_ADDRSTRLEN){
+				return ENOMEM;
+			}
+			snprintf(address, length, "%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx:%hhx%hhx", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15]);
+			return EOK;
+		default:
+			return ENOTSUP;
+	}
 }
 
Index: uspace/srv/net/messages.h
===================================================================
--- uspace/srv/net/messages.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/messages.h	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -48,4 +48,182 @@
 #include "structures/packet/packet.h"
 
+/** @name Networking message counts
+ */
+/*@{*/
+
+/** The number of network interface driver messages.
+ */
+#define NET_NETIF_COUNT		6
+
+/** The number of general networking messages.
+ */
+#define NET_NET_COUNT		3
+
+/** The number of network interface layer messages.
+ */
+#define NET_NIL_COUNT		7
+
+/** The number of Ethernet messages.
+ */
+#define NET_ETH_COUNT		0
+
+/** The number of inter-network messages.
+ */
+#define NET_IL_COUNT		6
+
+/** The number of IP messages.
+ */
+#define NET_IP_COUNT		4
+
+/** The number of ARP messages.
+ */
+#define NET_ARP_COUNT		5
+
+/** The number of ICMP messages.
+ */
+#define NET_ICMP_COUNT		6
+
+/** The number of transport layer messages.
+ */
+#define NET_TL_COUNT		1
+
+/** The number of UDP messages.
+ */
+#define NET_UDP_COUNT		0
+
+/** The number of TCP messages.
+ */
+#define NET_TCP_COUNT		0
+
+/** The number of packet management system messages.
+ */
+#define NET_PACKET_COUNT	5
+
+/** The number of socket messages.
+ */
+#define NET_SOCKET_COUNT	14
+
+/*@}*/
+
+/** @name Networking message intervals
+ */
+/*@{*/
+
+/** The first networking message.
+ */
+#define NET_FIRST			2000
+
+/** The first network interface layer message.
+ */
+#define NET_NETIF_FIRST		NET_FIRST
+
+/** The last network interface layer message.
+ */
+#define NET_NETIF_LAST		(NET_NETIF_FIRST + NET_NETIF_COUNT)
+
+/** The first general networking message.
+ */
+#define NET_NET_FIRST		(NET_NETIF_LAST + 0)
+
+/** The last general networking message.
+ */
+#define NET_NET_LAST		(NET_NET_FIRST + NET_NET_COUNT)
+
+/** The first network interface layer message.
+ */
+#define NET_NIL_FIRST		(NET_NET_LAST + 0)
+
+/** The last network interface layer message.
+ */
+#define NET_NIL_LAST		(NET_NIL_FIRST + NET_NIL_COUNT)
+
+/** The first Ethernet message.
+ */
+#define NET_ETH_FIRST		(NET_NIL_LAST + 0)
+
+/** The last Ethernet message.
+ */
+#define NET_ETH_LAST		(NET_ETH_FIRST + NET_ETH_COUNT)
+
+/** The first inter-network message.
+ */
+#define NET_IL_FIRST		(NET_ETH_LAST + 0)
+
+/** The last inter-network message.
+ */
+#define NET_IL_LAST			(NET_IL_FIRST + NET_IL_COUNT)
+
+/** The first IP message.
+ */
+#define NET_IP_FIRST		(NET_IL_LAST + 0)
+
+/** The last IP message.
+ */
+#define NET_IP_LAST			(NET_IP_FIRST + NET_IP_COUNT)
+
+/** The first ARP message.
+ */
+#define NET_ARP_FIRST		(NET_IP_LAST + 0)
+
+/** The last ARP message.
+ */
+#define NET_ARP_LAST		(NET_ARP_FIRST + NET_ARP_COUNT)
+
+/** The first ICMP message.
+ */
+#define NET_ICMP_FIRST		(NET_ARP_LAST + 0)
+
+/** The last ICMP message.
+ */
+#define NET_ICMP_LAST		(NET_ICMP_FIRST + NET_ICMP_COUNT)
+
+/** The first ICMP message.
+ */
+#define NET_TL_FIRST		(NET_ICMP_LAST + 0)
+
+/** The last ICMP message.
+ */
+#define NET_TL_LAST			(NET_TL_FIRST + NET_TL_COUNT)
+
+/** The first UDP message.
+ */
+#define NET_UDP_FIRST		(NET_TL_LAST + 0)
+
+/** The last UDP message.
+ */
+#define NET_UDP_LAST		(NET_UDP_FIRST + NET_UDP_COUNT)
+
+/** The first TCP message.
+ */
+#define NET_TCP_FIRST		(NET_UDP_LAST + 0)
+
+/** The last TCP message.
+ */
+#define NET_TCP_LAST		(NET_TCP_FIRST + NET_TCP_COUNT)
+
+/** The first socket message.
+ */
+#define NET_SOCKET_FIRST	(NET_TCP_LAST + 0)
+
+/** The last socket message.
+ */
+#define NET_SOCKET_LAST		(NET_SOCKET_FIRST + NET_SOCKET_COUNT)
+
+/** The first packet management system message.
+ */
+#define NET_PACKET_FIRST	(NET_SOCKET_LAST + 0)
+
+/** The last packet management system message.
+ */
+#define NET_PACKET_LAST		(NET_PACKET_FIRST + NET_PACKET_COUNT)
+
+/** The last networking message.
+ */
+#define NET_LAST			NET_PACKET_LAST
+
+/** The number of networking messages.
+ */
+#define NET_COUNT			(NET_LAST - NET_FIRST)
+
 /** Returns a value indicating whether the value is in the interval.
  *  @param[in] item The value to be checked.
@@ -55,336 +233,124 @@
 #define IS_IN_INTERVAL(item, first_inclusive, last_exclusive)	(((item) >= (first_inclusive)) && ((item) < (last_exclusive)))
 
-/** @name Networking message counts
+/** Returns a value indicating whether the IPC call is a generic networking message.
+ *  @param[in] call The IPC call to be checked.
+ */
+#define IS_NET_MESSAGE(call)			IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_FIRST, NET_LAST)
+
+/** Returns a value indicating whether the IPC call is a generic networking message.
+ *  @param[in] call The IPC call to be checked.
+ */
+#define IS_NET_NET_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NET_FIRST, NET_NET_LAST)
+
+/** Returns a value indicating whether the IPC call is a network interface layer message.
+ *  @param[in] call The IPC call to be checked.
+ */
+#define IS_NET_NIL_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NIL_FIRST, NET_NIL_LAST)
+
+/** Returns a value indicating whether the IPC call is an Ethernet message.
+ *  @param[in] call The IPC call to be checked.
+ */
+#define IS_NET_ETH_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ETH_FIRST, NET_ETH_LAST)
+
+/** Returns a value indicating whether the IPC call is an inter-network layer message.
+ *  @param[in] call The IPC call to be checked.
+ */
+#define IS_NET_IL_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IL_FIRST, NET_IL_LAST)
+
+/** Returns a value indicating whether the IPC call is an IP message.
+ *  @param[in] call The IPC call to be checked.
+ */
+#define IS_NET_IP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IP_FIRST, NET_IP_LAST)
+
+/** Returns a value indicating whether the IPC call is an ARP message.
+ *  @param[in] call The IPC call to be checked.
+ */
+#define IS_NET_ARP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ARP_FIRST, NET_ARP_LAST)
+
+/** Returns a value indicating whether the IPC call is an ICMP message.
+ *  @param[in] call The IPC call to be checked.
+ */
+#define IS_NET_ICMP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ICMP_FIRST, NET_ICMP_LAST)
+
+/** Returns a value indicating whether the IPC call is a transport layer message.
+ *  @param[in] call The IPC call to be checked.
+ */
+#define IS_NET_TL_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TL_FIRST, NET_TL_LAST)
+
+/** Returns a value indicating whether the IPC call is a UDP message.
+ *  @param[in] call The IPC call to be checked.
+ */
+#define IS_NET_UDP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_UDP_FIRST, NET_UDP_LAST)
+
+/** Returns a value indicating whether the IPC call is a TCP message.
+ *  @param[in] call The IPC call to be checked.
+ */
+#define IS_NET_TCP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TCP_FIRST, NET_TCP_LAST)
+
+/** Returns a value indicating whether the IPC call is a socket message.
+ *  @param[in] call The IPC call to be checked.
+ */
+#define IS_NET_SOCKET_MESSAGE(call)	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
+
+/** Returns a value indicating whether the IPC call is a packet manaagement system message.
+ *  @param[in] call The IPC call to be checked.
+ */
+#define IS_NET_PACKET_MESSAGE(call)	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_PACKET_FIRST, NET_PACKET_LAST)
+
+/*@}*/
+
+/** @name Networking specific message parameters definitions
  */
 /*@{*/
 
-/** The number of ARP messages.
- */
-#define NET_ARP_COUNT		5
-
-/** The number of Ethernet messages.
- */
-#define NET_ETH_COUNT		0
-
-/** The number of ICMP messages.
- */
-#define NET_ICMP_COUNT		6
-
-/** The number of inter-network messages.
- */
-#define NET_IL_COUNT		6
-
-/** The number of IP messages.
- */
-#define NET_IP_COUNT		4
-
-/** The number of general networking messages.
- */
-#define NET_NET_COUNT		3
-
-/** The number of network interface driver messages.
- */
-#define NET_NETIF_COUNT		6
-
-/** The number of network interface layer messages.
- */
-#define NET_NIL_COUNT		7
-
-/** The number of packet management system messages.
- */
-#define NET_PACKET_COUNT	5
-
-/** The number of socket messages.
- */
-#define NET_SOCKET_COUNT	14
-
-/** The number of TCP messages.
- */
-#define NET_TCP_COUNT		0
-
-/** The number of transport layer messages.
- */
-#define NET_TL_COUNT		1
-
-/** The number of UDP messages.
- */
-#define NET_UDP_COUNT		0
-
-/*@}*/
-
-/** @name Networking message intervals
- */
-/*@{*/
-
-/** The first networking message.
- */
-#define NET_FIRST			2000
-
-/** The first network interface layer message.
- */
-#define NET_NETIF_FIRST		NET_FIRST
-
-/** The last network interface layer message.
- */
-#define NET_NETIF_LAST		(NET_NETIF_FIRST + NET_NETIF_COUNT)
-
-/** The first general networking message.
- */
-#define NET_NET_FIRST		(NET_NETIF_LAST + 0)
-
-/** The last general networking message.
- */
-#define NET_NET_LAST		(NET_NET_FIRST + NET_NET_COUNT)
-
-/** The first network interface layer message.
- */
-#define NET_NIL_FIRST		(NET_NET_LAST + 0)
-
-/** The last network interface layer message.
- */
-#define NET_NIL_LAST		(NET_NIL_FIRST + NET_NIL_COUNT)
-
-/** The first Ethernet message.
- */
-#define NET_ETH_FIRST		(NET_NIL_LAST + 0)
-
-/** The last Ethernet message.
- */
-#define NET_ETH_LAST		(NET_ETH_FIRST + NET_ETH_COUNT)
-
-/** The first inter-network message.
- */
-#define NET_IL_FIRST		(NET_ETH_LAST + 0)
-
-/** The last inter-network message.
- */
-#define NET_IL_LAST			(NET_IL_FIRST + NET_IL_COUNT)
-
-/** The first IP message.
- */
-#define NET_IP_FIRST		(NET_IL_LAST + 0)
-
-/** The last IP message.
- */
-#define NET_IP_LAST			(NET_IP_FIRST + NET_IP_COUNT)
-
-/** The first ARP message.
- */
-#define NET_ARP_FIRST		(NET_IP_LAST + 0)
-
-/** The last ARP message.
- */
-#define NET_ARP_LAST		(NET_ARP_FIRST + NET_ARP_COUNT)
-
-/** The first ICMP message.
- */
-#define NET_ICMP_FIRST		(NET_ARP_LAST + 0)
-
-/** The last ICMP message.
- */
-#define NET_ICMP_LAST		(NET_ICMP_FIRST + NET_ICMP_COUNT)
-
-/** The first ICMP message.
- */
-#define NET_TL_FIRST		(NET_ICMP_LAST + 0)
-
-/** The last ICMP message.
- */
-#define NET_TL_LAST			(NET_TL_FIRST + NET_TL_COUNT)
-
-/** The first UDP message.
- */
-#define NET_UDP_FIRST		(NET_TL_LAST + 0)
-
-/** The last UDP message.
- */
-#define NET_UDP_LAST		(NET_UDP_FIRST + NET_UDP_COUNT)
-
-/** The first TCP message.
- */
-#define NET_TCP_FIRST		(NET_UDP_LAST + 0)
-
-/** The last TCP message.
- */
-#define NET_TCP_LAST		(NET_TCP_FIRST + NET_TCP_COUNT)
-
-/** The first socket message.
- */
-#define NET_SOCKET_FIRST	(NET_TCP_LAST + 0)
-
-/** The last socket message.
- */
-#define NET_SOCKET_LAST		(NET_SOCKET_FIRST + NET_SOCKET_COUNT)
-
-/** The first packet management system message.
- */
-#define NET_PACKET_FIRST	(NET_SOCKET_LAST + 0)
-
-/** The last packet management system message.
- */
-#define NET_PACKET_LAST		(NET_PACKET_FIRST + NET_PACKET_COUNT)
-
-/** The last networking message.
- */
-#define NET_LAST			NET_PACKET_LAST
-
-/** The number of networking messages.
- */
-#define NET_COUNT			(NET_LAST - NET_FIRST)
-
-/** Returns a value indicating whether the IPC call is a generic networking message.
- *  @param[in] call The IPC call to be checked.
- */
-#define IS_NET_MESSAGE(call)			IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_FIRST, NET_LAST)
-
-/** Returns a value indicating whether the IPC call is an ARP message.
- *  @param[in] call The IPC call to be checked.
- */
-#define IS_NET_ARP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ARP_FIRST, NET_ARP_LAST)
-
-/** Returns a value indicating whether the IPC call is an Ethernet message.
- *  @param[in] call The IPC call to be checked.
- */
-#define IS_NET_ETH_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ETH_FIRST, NET_ETH_LAST)
-
-/** Returns a value indicating whether the IPC call is an ICMP message.
- *  @param[in] call The IPC call to be checked.
- */
-#define IS_NET_ICMP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ICMP_FIRST, NET_ICMP_LAST)
-
-/** Returns a value indicating whether the IPC call is an inter-network layer message.
- *  @param[in] call The IPC call to be checked.
- */
-#define IS_NET_IL_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IL_FIRST, NET_IL_LAST)
-
-/** Returns a value indicating whether the IPC call is an IP message.
- *  @param[in] call The IPC call to be checked.
- */
-#define IS_NET_IP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IP_FIRST, NET_IP_LAST)
-
-/** Returns a value indicating whether the IPC call is a generic networking message.
- *  @param[in] call The IPC call to be checked.
- */
-#define IS_NET_NET_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NET_FIRST, NET_NET_LAST)
-
-/** Returns a value indicating whether the IPC call is a network interface layer message.
- *  @param[in] call The IPC call to be checked.
- */
-#define IS_NET_NIL_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NIL_FIRST, NET_NIL_LAST)
-
-/** Returns a value indicating whether the IPC call is a packet manaagement system message.
- *  @param[in] call The IPC call to be checked.
- */
-#define IS_NET_PACKET_MESSAGE(call)	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_PACKET_FIRST, NET_PACKET_LAST)
-
-/** Returns a value indicating whether the IPC call is a socket message.
- *  @param[in] call The IPC call to be checked.
- */
-#define IS_NET_SOCKET_MESSAGE(call)	IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
-
-/** Returns a value indicating whether the IPC call is a TCP message.
- *  @param[in] call The IPC call to be checked.
- */
-#define IS_NET_TCP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TCP_FIRST, NET_TCP_LAST)
-
-/** Returns a value indicating whether the IPC call is a transport layer message.
- *  @param[in] call The IPC call to be checked.
- */
-#define IS_NET_TL_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TL_FIRST, NET_TL_LAST)
-
-/** Returns a value indicating whether the IPC call is a UDP message.
- *  @param[in] call The IPC call to be checked.
- */
-#define IS_NET_UDP_MESSAGE(call)		IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_UDP_FIRST, NET_UDP_LAST)
-
-/*@}*/
-
-/** @name Networking specific message arguments definitions
- */
-/*@{*/
-
-/** @name First arguments
- */
-/*@{*/
-
-/** Returns the device identifier message argument.
+/** Returns the device identifier message parameter.
  *  @param[in] call The message call structure.
  */
 #define IPC_GET_DEVICE(call)		(device_id_t) IPC_GET_ARG1(*call)
 
-/*@}*/
-
-/** @name Second arguments
- */
-/*@{*/
-
-/** Returns the packet identifier message argument.
+/** Returns the packet identifier message parameter.
  *  @param[in] call The message call structure.
  */
 #define IPC_GET_PACKET(call)		(packet_id_t) IPC_GET_ARG2(*call)
 
-/** Returns the count message argument.
+/** Returns the count message parameter.
  *  @param[in] call The message call structure.
  */
 #define IPC_GET_COUNT(call)		(size_t) IPC_GET_ARG2(*call)
 
-/** Returns the device state message argument.
+/** Returns the device state message parameter.
  *  @param[in] call The message call structure.
  */
 #define IPC_GET_STATE(call)		(device_state_t) IPC_GET_ARG2(*call)
 
-/** Returns the maximum transmission unit message argument.
+/** Returns the maximum transmission unit message parameter.
  *  @param[in] call The message call structure.
  */
 #define IPC_GET_MTU(call)			(size_t) IPC_GET_ARG2(*call)
 
-/*@}*/
-
-/** @name Third arguments
- */
-/*@{*/
-
-/** Returns the device driver service message argument.
+/** Returns the device driver service message parameter.
  *  @param[in] call The message call structure.
  */
 #define IPC_GET_SERVICE(call)		(services_t) IPC_GET_ARG3(*call)
 
-/** Returns the target service message argument.
+/** Returns the target service message parameter.
  *  @param[in] call The message call structure.
  */
 #define IPC_GET_TARGET(call)		(services_t) IPC_GET_ARG3(*call)
 
-/** Returns the sender service message argument.
+/** Returns the sender service message parameter.
  *  @param[in] call The message call structure.
  */
 #define IPC_GET_SENDER(call)		(services_t) IPC_GET_ARG3(*call)
 
-/*@}*/
-
-/** @name Fourth arguments
- */
-/*@{*/
-
-/** Returns the error service message argument.
+/** Returns the error service message parameter.
  *  @param[in] call The message call structure.
  */
 #define IPC_GET_ERROR(call)		(services_t) IPC_GET_ARG4(*call)
 
-/*@}*/
-
-/** @name Fifth arguments
- */
-/*@{*/
-
-/** Returns the phone message argument.
+/** Returns the phone message parameter.
  *  @param[in] call The message call structure.
  */
 #define IPC_GET_PHONE(call)		(int) IPC_GET_ARG5(*call)
-
-/*@}*/
-
-/** @name First answers
- */
-/*@{*/
 
 /** Sets the device identifier in the message answer.
@@ -398,10 +364,4 @@
 #define IPC_SET_ADDR(answer)		((size_t *) &IPC_GET_ARG1(*answer))
 
-/*@}*/
-
-/** @name Second answers
- */
-/*@{*/
-
 /** Sets the minimum prefix size in the message answer.
  *  @param[out] answer The message answer structure.
@@ -409,10 +369,4 @@
 #define IPC_SET_PREFIX(answer)	((size_t *) &IPC_GET_ARG2(*answer))
 
-/*@}*/
-
-/** @name Third answers
- */
-/*@{*/
-
 /** Sets the maximum content size in the message answer.
  *  @param[out] answer The message answer structure.
@@ -420,10 +374,4 @@
 #define IPC_SET_CONTENT(answer)	((size_t *) &IPC_GET_ARG3(*answer))
 
-/*@}*/
-
-/** @name Fourth answers
- */
-/*@{*/
-
 /** Sets the minimum suffix size in the message answer.
  *  @param[out] answer The message answer structure.
@@ -432,32 +380,4 @@
 
 /*@}*/
-
-/*@}*/
-
-/** 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);
-	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);
-}
 
 /** Returns the address.
@@ -479,17 +399,68 @@
 		return EBADMEM;
 	}
-
-	// request the address
 	message_id = async_send_1(phone, (ipcarg_t) message, (ipcarg_t) device_id, NULL);
 	string = measured_strings_return(phone, address, data, 1);
 	async_wait_for(message_id, &result);
-
-	// if not successful
 	if((string == EOK) && (result != EOK)){
-		// clear the data
 		free(*address);
 		free(*data);
 	}
 	return (int) result;
+}
+
+/** Translates the given strings.
+ *  Allocates and returns the needed memory block as the data parameter.
+ *  @param[in] phone The service module phone.
+ *  @param[in] message The service specific message.
+ *  @param[in] device_id The device identifier.
+ *  @param[in] service The module service.
+ *  @param[in] configuration The key strings.
+ *  @param[in] count The number of configuration keys.
+ *  @param[out] translation The translated values.
+ *  @param[out] data The translation data container.
+ *  @returns EOK on success.
+ *  @returns EINVAL if the configuration parameter is NULL.
+ *  @returns EINVAL if the count parameter is zero (0).
+ *  @returns EBADMEM if the translation or the data parameters are NULL.
+ *  @returns Other error codes as defined for the specific service message.
+ */
+static inline int generic_translate_req(int phone, int message, device_id_t device_id, services_t service, measured_string_ref configuration, size_t count, measured_string_ref * translation, char ** data){
+	aid_t message_id;
+	ipcarg_t result;
+	int string;
+
+	if(!(configuration && (count > 0))){
+		return EINVAL;
+	}
+	if(!(translation && data)){
+		return EBADMEM;
+	}
+	message_id = async_send_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) count, (ipcarg_t) service, NULL);
+	measured_strings_send(phone, configuration, count);
+	string = measured_strings_return(phone, translation, data, count);
+	async_wait_for(message_id, &result);
+	if((string == EOK) && (result != EOK)){
+		free(*translation);
+		free(*data);
+	}
+	return (int) result;
+}
+
+/** 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);
+	}
+	return EOK;
 }
 
@@ -521,4 +492,17 @@
 }
 
+/** 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);
+	return EOK;
+}
+
 /** Passes the packet queue to the module.
  *  @param[in] phone The service module phone.
@@ -539,64 +523,15 @@
 }
 
-/** 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);
-	}
-	return EOK;
-}
-
-/** Translates the given strings.
- *  Allocates and returns the needed memory block as the data parameter.
- *  @param[in] phone The service module phone.
- *  @param[in] message The service specific message.
- *  @param[in] device_id The device identifier.
- *  @param[in] service The module service.
- *  @param[in] configuration The key strings.
- *  @param[in] count The number of configuration keys.
- *  @param[out] translation The translated values.
- *  @param[out] data The translation data container.
- *  @returns EOK on success.
- *  @returns EINVAL if the configuration parameter is NULL.
- *  @returns EINVAL if the count parameter is zero (0).
- *  @returns EBADMEM if the translation or the data parameters are NULL.
+/** 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_translate_req(int phone, int message, device_id_t device_id, services_t service, measured_string_ref configuration, size_t count, measured_string_ref * translation, char ** data){
-	aid_t message_id;
-	ipcarg_t result;
-	int string;
-
-	if(!(configuration && (count > 0))){
-		return EINVAL;
-	}
-	if(!(translation && data)){
-		return EBADMEM;
-	}
-
-	// request the translation
-	message_id = async_send_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) count, (ipcarg_t) service, NULL);
-	measured_strings_send(phone, configuration, count);
-	string = measured_strings_return(phone, translation, data, count);
-	async_wait_for(message_id, &result);
-
-	// if not successful
-	if((string == EOK) && (result != EOK)){
-		// clear the data
-		free(*translation);
-		free(*data);
-	}
-
-	return (int) result;
+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);
 }
 
Index: uspace/srv/net/module.c
===================================================================
--- uspace/srv/net/module.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/module.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -104,22 +104,14 @@
 	ipc_answer_0(iid, EOK);
 
-	// process additional messages
 	while(true){
-
-		// clear the answer structure
 		refresh_answer(&answer, &answer_count);
 
-		// fetch the next message
 		callid = async_get_call(&call);
-
-		// process the message
 		res = module_message(callid, &call, &answer, &answer_count);
 
-		// end if said to either by the message or the processing result
 		if((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP)){
 			return;
 		}
 
-		// answer the message
 		answer_call(callid, res, &answer, answer_count);
 	}
@@ -129,15 +121,11 @@
 	ERROR_DECLARE;
 
-	// print the module label
 	printf("Task %d - ", task_get_id());
 	module_print_name();
 	printf("\n");
-
-	// start the module
 	if(ERROR_OCCURRED(module_start(client_connection))){
 		printf(" - ERROR %i\n", ERROR_CODE);
 		return ERROR_CODE;
 	}
-
 	return EOK;
 }
Index: uspace/srv/net/modules.c
===================================================================
--- uspace/srv/net/modules.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/modules.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -51,5 +51,4 @@
 
 void answer_call(ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count){
-	// choose the most efficient answer function
 	if(answer || (! answer_count)){
 		switch(answer_count){
@@ -87,9 +86,6 @@
 	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))){
 			ipc_hangup(phone);
@@ -106,25 +102,20 @@
 
 int connect_to_service_timeout(services_t need, suseconds_t timeout){
-	int phone;
+	if (timeout <= 0)
+		return async_connect_me_to_blocking(PHONE_NS, need, 0, 0);
+	
+	while(true){
+		int phone;
 
-	// if no timeout is set
-	if (timeout <= 0){
-		return async_connect_me_to_blocking(PHONE_NS, need, 0, 0);
-	}
-
-	while(true){
 		phone = async_connect_me_to(PHONE_NS, need, 0, 0);
-		if((phone >= 0) || (phone != ENOENT)){
+		if((phone >= 0) || (phone != ENOENT))
 			return phone;
-		}
-
-		// end if no time is left
+	
+		timeout -= MODULE_WAIT_TIME;
 		if(timeout <= 0){
 			return ETIMEOUT;
 		}
 
-		// wait the minimum of the module wait time and the timeout
-		usleep((timeout <= MODULE_WAIT_TIME) ? timeout : MODULE_WAIT_TIME);
-		timeout -= MODULE_WAIT_TIME;
+		usleep(MODULE_WAIT_TIME);
 	}
 }
@@ -138,17 +129,11 @@
 		return EBADMEM;
 	}
-
-	// fetch the request
 	if(! async_data_write_receive(&callid, length)){
 		return EINVAL;
 	}
-
-	// allocate the buffer
 	*data = malloc(*length);
 	if(!(*data)){
 		return ENOMEM;
 	}
-
-	// fetch the data
 	if(ERROR_OCCURRED(async_data_write_finalize(callid, * data, * length))){
 		free(data);
@@ -162,25 +147,18 @@
 	ipc_callid_t callid;
 
-	// fetch the request
 	if(! async_data_read_receive(&callid, &length)){
 		return EINVAL;
 	}
-
-	// check the requested data size
 	if(length < data_length){
 		async_data_read_finalize(callid, data, length);
 		return EOVERFLOW;
 	}
-
-	// send the data
 	return async_data_read_finalize(callid, data, data_length);
 }
 
 void refresh_answer(ipc_call_t * answer, int * answer_count){
-
 	if(answer_count){
 		*answer_count = 0;
 	}
-
 	if(answer){
 		IPC_SET_RETVAL(*answer, 0);
Index: uspace/srv/net/net/net.c
===================================================================
--- uspace/srv/net/net/net.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/net/net.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -66,20 +66,11 @@
 #include "net_messages.h"
 
+/** Networking module name.
+ */
+#define NAME	"Networking"
+
 /** File read buffer size.
  */
 #define BUFFER_SIZE	256
-
-/** Networking module name.
- */
-#define NAME	"Networking"
-
-/** 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);
 
 /** Prints the module name.
@@ -97,20 +88,7 @@
 int module_start(async_client_conn_t client_connection);
 
-/** 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 read_configuration_file(const char * directory, const char * filename, measured_strings_ref configuration);
 
 /** \todo
@@ -123,16 +101,4 @@
  */
 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.
@@ -160,28 +126,41 @@
 int startup(void);
 
+/** 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);
+
+/** 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);
+
+/** Networking module global data.
+ */
+net_globals_t	net_globals;
+
+DEVICE_MAP_IMPLEMENT(netifs, netif_t)
+
 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){
-		return ENOMEM;
-	}
-	// 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 device_assign_devno();
-}
 
 void module_print_name(void){
@@ -208,9 +187,43 @@
 }
 
-int net_connect_module(services_t service){
-	return EOK;
-}
-
-void net_free_settings(measured_string_ref settings, char * data){
+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
+	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
+	return net_initialize_build(client_connection);
+}
+
+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_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);
 }
 
@@ -222,5 +235,4 @@
 		*data = NULL;
 	}
-
 	for(index = 0; index < count; ++ index){
 		setting = measured_strings_find(netif_conf, configuration[index].value, 0);
@@ -239,45 +251,9 @@
 }
 
-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;
-
-	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
-	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
-	return net_initialize_build(client_connection);
+void net_free_settings(measured_string_ref settings, char * data){
+}
+
+int net_connect_module(services_t service){
+	return EOK;
 }
 
@@ -312,73 +288,4 @@
 	}
 	return ENOTSUP;
-}
-
-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);
 }
 
@@ -434,4 +341,94 @@
 }
 
+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 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){
+		return ENOMEM;
+	}
+	// 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 device_assign_devno();
+}
+
+int read_configuration(void){
+	// read the general configuration file
+	return read_configuration_file(CONF_DIR, CONF_GENERAL_FILE, &net_globals.configuration);
+}
+
 int read_netif_configuration(const char * name, netif_ref netif){
 	// read the netif configuration file
@@ -455,5 +452,4 @@
 		return EINVAL;
 	}
-
 	// optional network interface layer
 	setting = measured_strings_find(&netif->configuration, CONF_NIL, 0);
@@ -467,5 +463,4 @@
 		netif->nil = NULL;
 	}
-
 	// mandatory internet layer
 	setting = measured_strings_find(&netif->configuration, CONF_IL, 0);
@@ -475,6 +470,6 @@
 		return EINVAL;
 	}
-
-	// hardware configuration
+	// end of the static loopback initialization
+	// startup the loopback interface
 	setting = measured_strings_find(&netif->configuration, CONF_IRQ, 0);
 	irq = setting ? strtol(setting->value, NULL, 10) : 0;
@@ -482,6 +477,4 @@
 	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);
@@ -495,6 +488,4 @@
 		internet_service = netif->driver->service;
 	}
-
-	// inter-network layer startup
 	switch(netif->il->service){
 		case SERVICE_IP:
@@ -534,5 +525,4 @@
 		}
 		ERROR_PROPAGATE(measured_strings_initialize(&netif->configuration));
-
 		// read configuration files
 		if(ERROR_OCCURRED(read_netif_configuration(conf_files[i], netif))){
@@ -541,5 +531,4 @@
 			return ERROR_CODE;
 		}
-
 		// mandatory name
 		setting = measured_strings_find(&netif->configuration, CONF_NAME, 0);
@@ -551,5 +540,4 @@
 		}
 		netif->name = setting->value;
-
 		// add to the netifs map
 		index = netifs_add(&net_globals.netifs, netif->id, netif);
@@ -559,5 +547,4 @@
 			return index;
 		}
-
 		// add to the netif names map
 		if(ERROR_OCCURRED(char_map_add(&net_globals.netif_names, netif->name, 0, index))
@@ -568,5 +555,4 @@
 			return ERROR_CODE;
 		}
-
 		// increment modules' usage
 		++ netif->driver->usage;
Index: uspace/srv/net/net/net.h
===================================================================
--- uspace/srv/net/net/net.h	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/net/net.h	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -52,11 +52,23 @@
 /*@{*/
 
+/** Loopback network interface module name.
+ */
+#define LO_NAME				"lo"
+
+/** Loopback network interface module full path filename.
+ */
+#define LO_FILENAME			"/srv/lo"
+
+/** DP8390 network interface module name.
+ */
+#define DP8390_NAME			"dp8390"
+
 /** DP8390 network interface module full path filename.
  */
 #define DP8390_FILENAME		"/srv/dp8390"
 
-/** DP8390 network interface module name.
- */
-#define DP8390_NAME			"dp8390"
+/** Ethernet module name.
+ */
+#define ETHERNET_NAME		"ethernet"
 
 /** Ethernet module full path filename.
@@ -66,5 +78,13 @@
 /** Ethernet module name.
  */
-#define ETHERNET_NAME		"ethernet"
+#define NILDUMMY_NAME		"nildummy"
+
+/** Ethernet module full path filename.
+ */
+#define NILDUMMY_FILENAME	"/srv/nildummy"
+
+/** IP module name.
+ */
+#define IP_NAME				"ip"
 
 /** IP module full path filename.
@@ -72,24 +92,4 @@
 #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"
-
 /*@}*/
 
@@ -98,32 +98,32 @@
 /*@{*/
 
+/** 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"
+
 /** Internet protocol module name configuration label.
  */
 #define CONF_IL				"IL"
 
+/** Interrupt number configuration label.
+ */
+#define CONF_IRQ			"IRQ"
+
 /** 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"
-
 /*@}*/
 
@@ -135,4 +135,14 @@
  */
 #define CONF_GENERAL_FILE	"general"
+
+/** 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;
 
 /** Type definition of the networking module global data.
@@ -141,13 +151,9 @@
 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;
+/** Present network interfaces.
+ *  Maps devices to the networking device specific data.
+ *  @see device.h
+ */
+DEVICE_MAP_DECLARE(netifs, netif_t)
 
 /** Configuration settings.
@@ -157,39 +163,16 @@
 GENERIC_CHAR_MAP_DECLARE(measured_strings, measured_string_t)
 
-/** Present network interfaces.
- *  Maps devices to the networking device specific data.
- *  @see device.h
- */
-DEVICE_MAP_DECLARE(netifs, netif_t)
-
-/** Networking module global variables.
- */
-struct net_globals{
-	/** Global configuration.
-	 */
-	measured_strings_t configuration;
-	/** Available modules.
-	 */
-	modules_t modules;
-	/** Network interface structure indices by names.
-	 */
-	char_map_t netif_names;
-	/** Present network interfaces.
-	 */
-	netifs_t netifs;
-};
-
 /** Present network interface device.
  */
 struct netif{
-	/** Configuration.
-	 */
-	measured_strings_t configuration;
+	/** System-unique network interface identifier.
+	 */
+	device_id_t id;
 	/** Serving network interface driver module index.
 	 */
 	module_ref driver;
-	/** System-unique network interface identifier.
-	 */
-	device_id_t id;
+	/** Serving link layer module index.
+	 */
+	module_ref nil;
 	/** Serving internet layer module index.
 	 */
@@ -198,7 +181,24 @@
 	 */
 	char * name;
-	/** Serving link layer module index.
-	 */
-	module_ref nil;
+	/** Configuration.
+	 */
+	measured_strings_t configuration;
+};
+
+/** Networking module global variables.
+ */
+struct net_globals{
+	/** Present network interfaces.
+	 */
+	netifs_t netifs;
+	/** Network interface structure indices by names.
+	 */
+	char_map_t netif_names;
+	/** Available modules.
+	 */
+	modules_t modules;
+	/** Global configuration.
+	 */
+	measured_strings_t configuration;
 };
 
@@ -211,4 +211,23 @@
  */
 int add_configuration(measured_strings_ref configuration, const char * name, const char * value);
+
+/** 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);
+
+/** 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 module message.
@@ -224,23 +243,4 @@
 int 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);
-
 #endif
 
Index: uspace/srv/net/net/net_bundle.c
===================================================================
--- uspace/srv/net/net/net_bundle.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/net/net_bundle.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -60,23 +60,4 @@
 extern net_globals_t	net_globals;
 
-int net_initialize_build(async_client_conn_t client_connection){
-	ERROR_DECLARE;
-
-	ipcarg_t phonehash;
-
-	ERROR_PROPAGATE(REGISTER_ME(SERVICE_IP, &phonehash));
-	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_get_id(), ip_connect_module));
-	ERROR_PROPAGATE(ip_initialize(client_connection));
-	ERROR_PROPAGATE(REGISTER_ME(SERVICE_ARP, &phonehash));
-	ERROR_PROPAGATE(arp_initialize(client_connection));
-	ERROR_PROPAGATE(REGISTER_ME(SERVICE_ICMP, &phonehash));
-	ERROR_PROPAGATE(icmp_initialize(client_connection));
-	ERROR_PROPAGATE(REGISTER_ME(SERVICE_UDP, &phonehash));
-	ERROR_PROPAGATE(udp_initialize(client_connection));
-	ERROR_PROPAGATE(REGISTER_ME(SERVICE_TCP, &phonehash));
-	ERROR_PROPAGATE(tcp_initialize(client_connection));
-	return EOK;
-}
-
 int 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)
@@ -117,4 +98,23 @@
 }
 
+int net_initialize_build(async_client_conn_t client_connection){
+	ERROR_DECLARE;
+
+	ipcarg_t phonehash;
+
+	ERROR_PROPAGATE(REGISTER_ME(SERVICE_IP, &phonehash));
+	ERROR_PROPAGATE(add_module(NULL, &net_globals.modules, IP_NAME, IP_FILENAME, SERVICE_IP, task_get_id(), ip_connect_module));
+	ERROR_PROPAGATE(ip_initialize(client_connection));
+	ERROR_PROPAGATE(REGISTER_ME(SERVICE_ARP, &phonehash));
+	ERROR_PROPAGATE(arp_initialize(client_connection));
+	ERROR_PROPAGATE(REGISTER_ME(SERVICE_ICMP, &phonehash));
+	ERROR_PROPAGATE(icmp_initialize(client_connection));
+	ERROR_PROPAGATE(REGISTER_ME(SERVICE_UDP, &phonehash));
+	ERROR_PROPAGATE(udp_initialize(client_connection));
+	ERROR_PROPAGATE(REGISTER_ME(SERVICE_TCP, &phonehash));
+	ERROR_PROPAGATE(tcp_initialize(client_connection));
+	return EOK;
+}
+
 /** @}
  */
Index: uspace/srv/net/net/net_remote.c
===================================================================
--- uspace/srv/net/net/net_remote.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/net/net_remote.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -50,6 +50,10 @@
 #include "net_messages.h"
 
-int net_connect_module(services_t service){
-	return connect_to_service(SERVICE_NETWORKING);
+int net_get_device_conf_req(int net_phone, device_id_t device_id, measured_string_ref * configuration, size_t count, char ** data){
+	return generic_translate_req(net_phone, NET_NET_GET_DEVICE_CONF, device_id, 0, * configuration, count, configuration, data);
+}
+
+int net_get_conf_req(int net_phone, measured_string_ref * configuration, size_t count, char ** data){
+	return generic_translate_req(net_phone, NET_NET_GET_DEVICE_CONF, 0, 0, * configuration, count, configuration, data);
 }
 
@@ -63,10 +67,6 @@
 }
 
-int net_get_conf_req(int net_phone, measured_string_ref * configuration, size_t count, char ** data){
-	return generic_translate_req(net_phone, NET_NET_GET_DEVICE_CONF, 0, 0, * configuration, count, configuration, data);
-}
-
-int net_get_device_conf_req(int net_phone, device_id_t device_id, measured_string_ref * configuration, size_t count, char ** data){
-	return generic_translate_req(net_phone, NET_NET_GET_DEVICE_CONF, device_id, 0, * configuration, count, configuration, data);
+int net_connect_module(services_t service){
+	return connect_to_service(SERVICE_NETWORKING);
 }
 
Index: uspace/srv/net/net/net_standalone.c
===================================================================
--- uspace/srv/net/net/net_standalone.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/net/net_standalone.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -53,4 +53,12 @@
 extern net_globals_t	net_globals;
 
+int 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);
+	}
+}
+
 int net_initialize_build(async_client_conn_t client_connection){
 	ERROR_DECLARE;
@@ -75,12 +83,4 @@
 }
 
-int 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);
-	}
-}
-
 /** @}
  */
Index: uspace/srv/net/net/start/netstart.c
===================================================================
--- uspace/srv/net/net/start/netstart.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/net/start/netstart.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -76,18 +76,14 @@
 	int net_phone;
 
-	// print the module label
 	printf("Task %d - ", task_get_id());
 	printf("%s\n", NAME);
-
 	// run self tests
 	ERROR_PROPAGATE(self_test());
-
-	// start the networking service
+	// start net service
 	if(! spawn("/srv/net")){
 		fprintf(stderr, "Could not spawn net\n");
 		return EINVAL;
 	}
-
-	// start the networking
+	// start net
 	net_phone = connect_to_service(SERVICE_NETWORKING);
 	if(ERROR_OCCURRED(ipc_call_sync_0_0(net_phone, NET_NET_STARTUP))){
Index: uspace/srv/net/netif/dp8390/dp8390_module.c
===================================================================
--- uspace/srv/net/netif/dp8390/dp8390_module.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/netif/dp8390/dp8390_module.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -193,7 +193,5 @@
 	dep->de_int_pending = 0;
 //	remove debug print:
-#ifdef CONFIG_DEBUG
 	printf("I%d: 0x%x\n", device_id, IPC_GET_ISR(call));
-#endif
 	dp_check_ints(dep, IPC_GET_ISR(call));
 	if(dep->received_queue){
@@ -204,9 +202,7 @@
 		fibril_rwlock_write_unlock(&netif_globals.lock);
 //	remove debug dump:
-#ifdef CONFIG_DEBUG
 	uint8_t * data;
 	data = packet_get_data(received);
 	printf("Receiving packet:\n\tid\t= %d\n\tlength\t= %d\n\tdata\t= %.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX\n\t\t%.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX\n", packet_get_id(received), packet_get_data_length(received), data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19], data[20], data[21], data[22], data[23], data[24], data[25], data[26], data[27], data[28], data[29], data[30], data[31], data[32], data[33], data[34], data[35], data[36], data[37], data[38], data[39], data[40], data[41], data[42], data[43], data[44], data[45], data[46], data[47], data[48], data[49], data[50], data[51], data[52], data[53], data[54], data[55], data[56], data[57], data[58], data[59]);
-#endif
 		nil_received_msg(phone, device_id, received, NULL);
 	}else{
@@ -271,9 +267,8 @@
 		next = pq_detach(packet);
 //		remove debug dump:
-#ifdef CONFIG_DEBUG
 		uint8_t * data;
 		data = packet_get_data(packet);
 		printf("Sending packet:\n\tid\t= %d\n\tlength\t= %d\n\tdata\t= %.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX\n\t\t%.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX\n", packet_get_id(packet), packet_get_data_length(packet), data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19], data[20], data[21], data[22], data[23], data[24], data[25], data[26], data[27], data[28], data[29], data[30], data[31], data[32], data[33], data[34], data[35], data[36], data[37], data[38], data[39], data[40], data[41], data[42], data[43], data[44], data[45], data[46], data[47], data[48], data[49], data[50], data[51], data[52], data[53], data[54], data[55], data[56], data[57], data[58], data[59]);
-#endif
+
 		if(do_pwrite(dep, packet, FALSE) != EBUSY){
 			netif_pq_release(packet_get_id(packet));
Index: uspace/srv/net/self_test.c
===================================================================
--- uspace/srv/net/self_test.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/self_test.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -57,14 +57,30 @@
  *  @param[in] result The expected result.
  */
-#define TEST(name, function_call, result);	{								\
-	printf("\n\t%s", (name)); 												\
-	if((function_call) != (result)){										\
-		printf("\tERROR\n");												\
-		error = 1;															\
-	}else{																	\
-		printf("\tOK\n");													\
-	}																		\
+#define TEST(name, function_call, result);	{	\
+	printf("\n\t%s", (name)); 					\
+	if((function_call) != (result)){			\
+		printf("\tERROR\n");						\
+		error = 1;									\
+	}else{											\
+		printf("\tOK\n");							\
+	}												\
 }
 
+#if NET_SELF_TEST_INT_MAP
+
+	INT_MAP_DECLARE(int_map, int);
+
+	INT_MAP_IMPLEMENT(int_map, int);
+
+#endif
+
+#if NET_SELF_TEST_GENERIC_FIELD
+
+	GENERIC_FIELD_DECLARE(int_field, int)
+
+	GENERIC_FIELD_IMPLEMENT(int_field, int)
+
+#endif
+
 #if NET_SELF_TEST_GENERIC_CHAR_MAP
 
@@ -72,20 +88,4 @@
 
 	GENERIC_CHAR_MAP_IMPLEMENT(int_char_map, int)
-
-#endif
-
-#if NET_SELF_TEST_GENERIC_FIELD
-
-	GENERIC_FIELD_DECLARE(int_field, int)
-
-	GENERIC_FIELD_IMPLEMENT(int_field, int)
-
-#endif
-
-#if NET_SELF_TEST_INT_MAP
-
-	INT_MAP_DECLARE(int_map, int);
-
-	INT_MAP_IMPLEMENT(int_map, int);
 
 #endif
@@ -101,4 +101,13 @@
 
 	error = 0;
+
+#if NET_SELF_TEST_MEASURED_STRINGS
+	measured_string_ref string;
+
+	printf("\nMeasured strings test");
+	string = measured_string_create_bulk("I am a measured string!", 0);
+	printf("\n%x, %s at %x of %d", string, string->value, string->value, string->length);
+	printf("\nOK");
+#endif
 
 #if NET_SELF_TEST_CHAR_MAP
@@ -151,180 +160,4 @@
 #endif
 
-#if NET_SELF_TEST_CRC
-	uint32_t value;
-
-	printf("\nCRC computation test");
-	value = ~ compute_crc32(~ 0, "123456789", 8 * 9);
-	TEST("123456789", value, 0xCBF43926);
-	printf("\t=> %X", value);
-	value = ~ compute_crc32(~ 0, "1", 8);
-	TEST("1", value, 0x83DCEFB7);
-	printf("\t=> %X", value);
-	value = ~ compute_crc32(~ 0, "12", 8 * 2);
-	TEST("12", value, 0x4F5344CD);
-	printf("\t=> %X", value);
-	value = ~ compute_crc32(~ 0, "123", 8 * 3);
-	TEST("123", value, 0x884863D2);
-	printf("\t=> %X", value);
-	value = ~ compute_crc32(~ 0, "1234", 8 * 4);
-	TEST("1234", value, 0x9BE3E0A3);
-	printf("\t=> %X", value);
-	value = ~ compute_crc32(~ 0, "12345678", 8 * 8);
-	TEST("12345678", value, 0x9AE0DAAF);
-	printf("\t=> %X", value);
-	value = ~ compute_crc32(~ 0, "ahoj pane", 8 * 9);
-	TEST("ahoj pane", value, 0x5FC3D706);
-	printf("\t=> %X", value);
-
-	if(error){
-		return EINVAL;
-	}
-
-#endif
-
-#if NET_SELF_TEST_DYNAMIC_FIFO
-	dyn_fifo_t fifo;
-
-	printf("\nDynamic fifo test");
-	TEST("add 1 einval", dyn_fifo_push(&fifo, 1, 0), EINVAL);
-	TEST("initialize", dyn_fifo_initialize(&fifo, 1), EOK);
-	TEST("add 1 eok", dyn_fifo_push(&fifo, 1, 0), EOK);
-	TEST("pop 1", dyn_fifo_pop(&fifo), 1);
-	TEST("pop enoent", dyn_fifo_pop(&fifo), ENOENT);
-	TEST("add 2 eok", dyn_fifo_push(&fifo, 2, 1), EOK);
-	TEST("add 3 enomem", dyn_fifo_push(&fifo, 3, 1), ENOMEM);
-	TEST("add 3 eok", dyn_fifo_push(&fifo, 3, 0), EOK);
-	TEST("pop 2", dyn_fifo_pop(&fifo), 2);
-	TEST("pop 3", dyn_fifo_pop(&fifo), 3);
-	TEST("add 4 eok", dyn_fifo_push(&fifo, 4, 2), EOK);
-	TEST("add 5 eok", dyn_fifo_push(&fifo, 5, 2), EOK);
-	TEST("add 6 enomem", dyn_fifo_push(&fifo, 6, 2), ENOMEM);
-	TEST("add 6 eok", dyn_fifo_push(&fifo, 6, 5), EOK);
-	TEST("add 7 eok", dyn_fifo_push(&fifo, 7, 5), EOK);
-	TEST("pop 4", dyn_fifo_pop(&fifo), 4);
-	TEST("pop 5", dyn_fifo_pop(&fifo), 5);
-	TEST("add 8 eok", dyn_fifo_push(&fifo, 8, 5), EOK);
-	TEST("add 9 eok", dyn_fifo_push(&fifo, 9, 5), EOK);
-	TEST("add 10 eok", dyn_fifo_push(&fifo, 10, 6), EOK);
-	TEST("add 11 eok", dyn_fifo_push(&fifo, 11, 6), EOK);
-	TEST("pop 6", dyn_fifo_pop(&fifo), 6);
-	TEST("pop 7", dyn_fifo_pop(&fifo), 7);
-	TEST("add 12 eok", dyn_fifo_push(&fifo, 12, 6), EOK);
-	TEST("add 13 eok", dyn_fifo_push(&fifo, 13, 6), EOK);
-	TEST("add 14 enomem", dyn_fifo_push(&fifo, 14, 6), ENOMEM);
-	TEST("add 14 eok", dyn_fifo_push(&fifo, 14, 8), EOK);
-	TEST("pop 8", dyn_fifo_pop(&fifo), 8);
-	TEST("pop 9", dyn_fifo_pop(&fifo), 9);
-	TEST("pop 10", dyn_fifo_pop(&fifo), 10);
-	TEST("pop 11", dyn_fifo_pop(&fifo), 11);
-	TEST("pop 12", dyn_fifo_pop(&fifo), 12);
-	TEST("pop 13", dyn_fifo_pop(&fifo), 13);
-	TEST("pop 14", dyn_fifo_pop(&fifo), 14);
-	TEST("destroy", dyn_fifo_destroy(&fifo), EOK);
-	TEST("add 15 einval", dyn_fifo_push(&fifo, 1, 0), EINVAL);
-	if(error){
-		return EINVAL;
-	}
-
-#endif
-
-#if NET_SELF_TEST_GENERIC_CHAR_MAP
-	int_char_map_t icm;
-
-	x = (int *) malloc(sizeof(int));
-	y = (int *) malloc(sizeof(int));
-	z = (int *) malloc(sizeof(int));
-	u = (int *) malloc(sizeof(int));
-	v = (int *) malloc(sizeof(int));
-	w = (int *) malloc(sizeof(int));
-
-	icm.magic = 0;
-	printf("\nGeneric char map test");
-	TEST("add ucho z einval", int_char_map_add(&icm, "ucho", 0, z), EINVAL);
-	TEST("initialize", int_char_map_initialize(&icm), EOK);
-	printf("\n\texclude bla null");
-	int_char_map_exclude(&icm, "bla", 0);
-	TEST("find bla null", int_char_map_find(&icm, "bla", 0), NULL);
-	TEST("add bla x eok", int_char_map_add(&icm, "bla", 0, x), EOK);
-	TEST("find bla x", int_char_map_find(&icm, "bla", 0), x);
-	TEST("add bla y eexists", int_char_map_add(&icm, "bla", 0, y), EEXISTS);
-	printf("\n\texclude bla y");
-	int_char_map_exclude(&icm, "bla", 0);
-	printf("\n\texclude bla null");
-	int_char_map_exclude(&icm, "bla", 0);
-	TEST("add blabla v eok", int_char_map_add(&icm, "blabla", 0, v), EOK);
-	TEST("find blabla v", int_char_map_find(&icm, "blabla", 0), v);
-	TEST("add bla w eok", int_char_map_add(&icm, "bla", 0, w), EOK);
-	TEST("find bla w", int_char_map_find(&icm, "bla", 0), w);
-	printf("\n\texclude bla");
-	int_char_map_exclude(&icm, "bla", 0);
-	TEST("find bla null", int_char_map_find(&icm, "bla", 0), NULL);
-	TEST("find blabla v", int_char_map_find(&icm, "blabla", 0), v);
-	TEST("add auto u eok", int_char_map_add(&icm, "auto", 0, u), EOK);
-	TEST("find auto u", int_char_map_find(&icm, "auto", 0), u);
-	printf("\n\tdestroy");
-	int_char_map_destroy(&icm);
-	TEST("add ucho z einval", int_char_map_add(&icm, "ucho", 0, z), EINVAL);
-	printf("\nOK");
-
-	if(error){
-		return EINVAL;
-	}
-
-#endif
-
-#if NET_SELF_TEST_GENERIC_FIELD
-	int_field_t gf;
-
-	x = (int *) malloc(sizeof(int));
-	y = (int *) malloc(sizeof(int));
-	z = (int *) malloc(sizeof(int));
-	u = (int *) malloc(sizeof(int));
-	v = (int *) malloc(sizeof(int));
-	w = (int *) malloc(sizeof(int));
-
-	gf.magic = 0;
-	printf("\nGeneric field test");
-	TEST("add x einval", int_field_add(&gf, x), EINVAL);
-	TEST("count -1", int_field_count(&gf), -1);
-	TEST("initialize", int_field_initialize(&gf), EOK);
-	TEST("count 0", int_field_count(&gf), 0);
-	TEST("get 1 null", int_field_get_index(&gf, 1), NULL);
-	TEST("add x 0", int_field_add(&gf, x), 0);
-	TEST("get 0 x", int_field_get_index(&gf, 0), x);
-	int_field_exclude_index(&gf, 0);
-	TEST("get 0 null", int_field_get_index(&gf, 0), NULL);
-	TEST("add y 1", int_field_add(&gf, y), 1);
-	TEST("get 1 y", int_field_get_index(&gf, 1), y);
-	TEST("add z 2", int_field_add(&gf, z), 2);
-	TEST("get 2 z", int_field_get_index(&gf, 2), z);
-	TEST("get 1 y", int_field_get_index(&gf, 1), y);
-	TEST("count 3", int_field_count(&gf), 3);
-	TEST("add u 3", int_field_add(&gf, u), 3);
-	TEST("get 3 u", int_field_get_index(&gf, 3), u);
-	TEST("add v 4", int_field_add(&gf, v), 4);
-	TEST("get 4 v", int_field_get_index(&gf, 4), v);
-	TEST("add w 5", int_field_add(&gf, w), 5);
-	TEST("get 5 w", int_field_get_index(&gf, 5), w);
-	TEST("count 6", int_field_count(&gf), 6);
-	int_field_exclude_index(&gf, 1);
-	TEST("get 1 null", int_field_get_index(&gf, 1), NULL);
-	TEST("get 3 u", int_field_get_index(&gf, 3), u);
-	int_field_exclude_index(&gf, 7);
-	TEST("get 3 u", int_field_get_index(&gf, 3), u);
-	TEST("get 5 w", int_field_get_index(&gf, 5), w);
-	int_field_exclude_index(&gf, 4);
-	TEST("get 4 null", int_field_get_index(&gf, 4), NULL);
-	printf("\n\tdestroy");
-	int_field_destroy(&gf);
-	TEST("count -1", int_field_count(&gf), -1);
-	printf("\nOK");
-
-	if(error){
-		return EINVAL;
-	}
-
-#endif
-
 #if NET_SELF_TEST_INT_MAP
 	int_map_t im;
@@ -383,11 +216,178 @@
 #endif
 
-#if NET_SELF_TEST_MEASURED_STRINGS
-	measured_string_ref string;
-
-	printf("\nMeasured strings test");
-	string = measured_string_create_bulk("I am a measured string!", 0);
-	printf("\n%x, %s at %x of %d", string, string->value, string->value, string->length);
+#if NET_SELF_TEST_GENERIC_FIELD
+	int_field_t gf;
+
+	x = (int *) malloc(sizeof(int));
+	y = (int *) malloc(sizeof(int));
+	z = (int *) malloc(sizeof(int));
+	u = (int *) malloc(sizeof(int));
+	v = (int *) malloc(sizeof(int));
+	w = (int *) malloc(sizeof(int));
+
+	gf.magic = 0;
+	printf("\nGeneric field test");
+	TEST("add x einval", int_field_add(&gf, x), EINVAL);
+	TEST("count -1", int_field_count(&gf), -1);
+	TEST("initialize", int_field_initialize(&gf), EOK);
+	TEST("count 0", int_field_count(&gf), 0);
+	TEST("get 1 null", int_field_get_index(&gf, 1), NULL);
+	TEST("add x 0", int_field_add(&gf, x), 0);
+	TEST("get 0 x", int_field_get_index(&gf, 0), x);
+	int_field_exclude_index(&gf, 0);
+	TEST("get 0 null", int_field_get_index(&gf, 0), NULL);
+	TEST("add y 1", int_field_add(&gf, y), 1);
+	TEST("get 1 y", int_field_get_index(&gf, 1), y);
+	TEST("add z 2", int_field_add(&gf, z), 2);
+	TEST("get 2 z", int_field_get_index(&gf, 2), z);
+	TEST("get 1 y", int_field_get_index(&gf, 1), y);
+	TEST("count 3", int_field_count(&gf), 3);
+	TEST("add u 3", int_field_add(&gf, u), 3);
+	TEST("get 3 u", int_field_get_index(&gf, 3), u);
+	TEST("add v 4", int_field_add(&gf, v), 4);
+	TEST("get 4 v", int_field_get_index(&gf, 4), v);
+	TEST("add w 5", int_field_add(&gf, w), 5);
+	TEST("get 5 w", int_field_get_index(&gf, 5), w);
+	TEST("count 6", int_field_count(&gf), 6);
+	int_field_exclude_index(&gf, 1);
+	TEST("get 1 null", int_field_get_index(&gf, 1), NULL);
+	TEST("get 3 u", int_field_get_index(&gf, 3), u);
+	int_field_exclude_index(&gf, 7);
+	TEST("get 3 u", int_field_get_index(&gf, 3), u);
+	TEST("get 5 w", int_field_get_index(&gf, 5), w);
+	int_field_exclude_index(&gf, 4);
+	TEST("get 4 null", int_field_get_index(&gf, 4), NULL);
+	printf("\n\tdestroy");
+	int_field_destroy(&gf);
+	TEST("count -1", int_field_count(&gf), -1);
 	printf("\nOK");
+
+	if(error){
+		return EINVAL;
+	}
+
+#endif
+
+#if NET_SELF_TEST_GENERIC_CHAR_MAP
+	int_char_map_t icm;
+
+	x = (int *) malloc(sizeof(int));
+	y = (int *) malloc(sizeof(int));
+	z = (int *) malloc(sizeof(int));
+	u = (int *) malloc(sizeof(int));
+	v = (int *) malloc(sizeof(int));
+	w = (int *) malloc(sizeof(int));
+
+	icm.magic = 0;
+	printf("\nGeneric char map test");
+	TEST("add ucho z einval", int_char_map_add(&icm, "ucho", 0, z), EINVAL);
+	TEST("initialize", int_char_map_initialize(&icm), EOK);
+	printf("\n\texclude bla null");
+	int_char_map_exclude(&icm, "bla", 0);
+	TEST("find bla null", int_char_map_find(&icm, "bla", 0), NULL);
+	TEST("add bla x eok", int_char_map_add(&icm, "bla", 0, x), EOK);
+	TEST("find bla x", int_char_map_find(&icm, "bla", 0), x);
+	TEST("add bla y eexists", int_char_map_add(&icm, "bla", 0, y), EEXISTS);
+	printf("\n\texclude bla y");
+	int_char_map_exclude(&icm, "bla", 0);
+	printf("\n\texclude bla null");
+	int_char_map_exclude(&icm, "bla", 0);
+	TEST("add blabla v eok", int_char_map_add(&icm, "blabla", 0, v), EOK);
+	TEST("find blabla v", int_char_map_find(&icm, "blabla", 0), v);
+	TEST("add bla w eok", int_char_map_add(&icm, "bla", 0, w), EOK);
+	TEST("find bla w", int_char_map_find(&icm, "bla", 0), w);
+	printf("\n\texclude bla");
+	int_char_map_exclude(&icm, "bla", 0);
+	TEST("find bla null", int_char_map_find(&icm, "bla", 0), NULL);
+	TEST("find blabla v", int_char_map_find(&icm, "blabla", 0), v);
+	TEST("add auto u eok", int_char_map_add(&icm, "auto", 0, u), EOK);
+	TEST("find auto u", int_char_map_find(&icm, "auto", 0), u);
+	printf("\n\tdestroy");
+	int_char_map_destroy(&icm);
+	TEST("add ucho z einval", int_char_map_add(&icm, "ucho", 0, z), EINVAL);
+	printf("\nOK");
+
+	if(error){
+		return EINVAL;
+	}
+
+#endif
+
+#if NET_SELF_TEST_CRC
+	uint32_t value;
+
+	printf("\nCRC computation test");
+	value = ~ compute_crc32(~ 0, "123456789", 8 * 9);
+	TEST("123456789", value, 0xCBF43926);
+	printf("\t=> %X", value);
+	value = ~ compute_crc32(~ 0, "1", 8);
+	TEST("1", value, 0x83DCEFB7);
+	printf("\t=> %X", value);
+	value = ~ compute_crc32(~ 0, "12", 8 * 2);
+	TEST("12", value, 0x4F5344CD);
+	printf("\t=> %X", value);
+	value = ~ compute_crc32(~ 0, "123", 8 * 3);
+	TEST("123", value, 0x884863D2);
+	printf("\t=> %X", value);
+	value = ~ compute_crc32(~ 0, "1234", 8 * 4);
+	TEST("1234", value, 0x9BE3E0A3);
+	printf("\t=> %X", value);
+	value = ~ compute_crc32(~ 0, "12345678", 8 * 8);
+	TEST("12345678", value, 0x9AE0DAAF);
+	printf("\t=> %X", value);
+	value = ~ compute_crc32(~ 0, "ahoj pane", 8 * 9);
+	TEST("ahoj pane", value, 0x5FC3D706);
+	printf("\t=> %X", value);
+
+	if(error){
+		return EINVAL;
+	}
+
+#endif
+
+#if NET_SELF_TEST_DYNAMIC_FIFO
+	dyn_fifo_t fifo;
+
+	printf("\nDynamic fifo test");
+	TEST("add 1 einval", dyn_fifo_push(&fifo, 1, 0), EINVAL);
+	TEST("initialize", dyn_fifo_initialize(&fifo, 1), EOK);
+	TEST("add 1 eok", dyn_fifo_push(&fifo, 1, 0), EOK);
+	TEST("pop 1", dyn_fifo_pop(&fifo), 1);
+	TEST("pop enoent", dyn_fifo_pop(&fifo), ENOENT);
+	TEST("add 2 eok", dyn_fifo_push(&fifo, 2, 1), EOK);
+	TEST("add 3 enomem", dyn_fifo_push(&fifo, 3, 1), ENOMEM);
+	TEST("add 3 eok", dyn_fifo_push(&fifo, 3, 0), EOK);
+	TEST("pop 2", dyn_fifo_pop(&fifo), 2);
+	TEST("pop 3", dyn_fifo_pop(&fifo), 3);
+	TEST("add 4 eok", dyn_fifo_push(&fifo, 4, 2), EOK);
+	TEST("add 5 eok", dyn_fifo_push(&fifo, 5, 2), EOK);
+	TEST("add 6 enomem", dyn_fifo_push(&fifo, 6, 2), ENOMEM);
+	TEST("add 6 eok", dyn_fifo_push(&fifo, 6, 5), EOK);
+	TEST("add 7 eok", dyn_fifo_push(&fifo, 7, 5), EOK);
+	TEST("pop 4", dyn_fifo_pop(&fifo), 4);
+	TEST("pop 5", dyn_fifo_pop(&fifo), 5);
+	TEST("add 8 eok", dyn_fifo_push(&fifo, 8, 5), EOK);
+	TEST("add 9 eok", dyn_fifo_push(&fifo, 9, 5), EOK);
+	TEST("add 10 eok", dyn_fifo_push(&fifo, 10, 6), EOK);
+	TEST("add 11 eok", dyn_fifo_push(&fifo, 11, 6), EOK);
+	TEST("pop 6", dyn_fifo_pop(&fifo), 6);
+	TEST("pop 7", dyn_fifo_pop(&fifo), 7);
+	TEST("add 12 eok", dyn_fifo_push(&fifo, 12, 6), EOK);
+	TEST("add 13 eok", dyn_fifo_push(&fifo, 13, 6), EOK);
+	TEST("add 14 enomem", dyn_fifo_push(&fifo, 14, 6), ENOMEM);
+	TEST("add 14 eok", dyn_fifo_push(&fifo, 14, 8), EOK);
+	TEST("pop 8", dyn_fifo_pop(&fifo), 8);
+	TEST("pop 9", dyn_fifo_pop(&fifo), 9);
+	TEST("pop 10", dyn_fifo_pop(&fifo), 10);
+	TEST("pop 11", dyn_fifo_pop(&fifo), 11);
+	TEST("pop 12", dyn_fifo_pop(&fifo), 12);
+	TEST("pop 13", dyn_fifo_pop(&fifo), 13);
+	TEST("pop 14", dyn_fifo_pop(&fifo), 14);
+	TEST("destroy", dyn_fifo_destroy(&fifo), EOK);
+	TEST("add 15 einval", dyn_fifo_push(&fifo, 1, 0), EINVAL);
+	if(error){
+		return EINVAL;
+	}
+
 #endif
 
Index: uspace/srv/net/tl/icmp/icmp.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/tl/icmp/icmp.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -41,5 +41,4 @@
 #include <fibril_synch.h>
 #include <stdint.h>
-#include <string.h>
 
 #include <ipc/ipc.h>
Index: uspace/srv/net/tl/icmp/icmp_client.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp_client.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/tl/icmp/icmp_client.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -37,8 +37,5 @@
 
 #include <errno.h>
-
-#ifdef CONFIG_DEBUG
-	#include <stdio.h>
-#endif
+//#include <stdio.h>
 
 #include <sys/types.h>
@@ -73,7 +70,5 @@
 	}
 	// remove debug dump
-#ifdef CONFIG_DEBUG
-	printf("ICMP error %d (%d) in packet %d\n", header->type, header->code, packet_get_id(packet));
-#endif
+//	printf("ICMP error %d (%d) in packet %d\n", header->type, header->code, packet_get_id(packet));
 	return sizeof(icmp_header_t);
 }
Index: uspace/srv/net/tl/tcp/tcp.c
===================================================================
--- uspace/srv/net/tl/tcp/tcp.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/tl/tcp/tcp.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -1241,7 +1241,4 @@
 	}
 
-	// release the application phone
-	ipc_hangup(app_phone);
-
 	printf("release\n");
 	// release all local sockets
@@ -1280,10 +1277,9 @@
 					// TODO release as connection lost
 					//tcp_refresh_socket_data(socket_data);
-					fibril_rwlock_write_unlock(socket_data->local_lock);
 				}else{
 					// retransmit
-//					tcp_retransmit_packet(socket, socket_data, timeout->sequence_number);
-					fibril_rwlock_write_unlock(socket_data->local_lock);
-				}
+					tcp_retransmit_packet(socket, socket_data, timeout->sequence_number);
+				}
+				fibril_rwlock_write_unlock(socket_data->local_lock);
 			}else{
 				fibril_mutex_lock(&socket_data->operation.mutex);
Index: uspace/srv/net/tl/udp/udp.c
===================================================================
--- uspace/srv/net/tl/udp/udp.c	(revision 60ab6c32bdd1487d23ce71b9720e1b79f4c121ed)
+++ uspace/srv/net/tl/udp/udp.c	(revision 71b00dcceb98187a198867584792b49778d8e886)
@@ -508,7 +508,4 @@
 	}
 
-	// release the application phone
-	ipc_hangup(app_phone);
-
 	// release all local sockets
 	socket_cores_release(udp_globals.net_phone, &local_sockets, &udp_globals.sockets, NULL);
