Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/Makefile	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -88,4 +88,7 @@
 	generic/task.c \
 	generic/futex.c \
+	generic/inet.c \
+	generic/inetcfg.c \
+	generic/inetping.c \
 	generic/io/asprintf.c \
 	generic/io/io.c \
@@ -98,4 +101,6 @@
 	generic/io/printf_core.c \
 	generic/io/console.c \
+	generic/iplink.c \
+	generic/iplink_srv.c \
 	generic/malloc.c \
 	generic/sysinfo.c \
@@ -109,5 +114,4 @@
 	generic/adt/hash_set.c \
 	generic/adt/dynamic_fifo.c \
-	generic/adt/measured_strings.c \
 	generic/adt/char_map.c \
 	generic/adt/prodcons.c \
@@ -119,8 +123,5 @@
 	generic/vfs/canonify.c \
 	generic/net/inet.c \
-	generic/net/icmp_common.c \
-	generic/net/icmp_api.c \
 	generic/net/modules.c \
-	generic/net/packet.c \
 	generic/net/socket_client.c \
 	generic/net/socket_parse.c \
Index: uspace/lib/c/generic/adt/measured_strings.c
===================================================================
--- uspace/lib/c/generic/adt/measured_strings.c	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,421 +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 libc
- *  @{
- */
-
-/** @file
- * Character string with measured length implementation.
- * @see measured_strings.h
- */
-
-#include <adt/measured_strings.h>
-#include <malloc.h>
-#include <mem.h>
-#include <unistd.h>
-#include <errno.h>
-#include <async.h>
-
-/** Creates a new measured string bundled with a copy of the given string
- * itself as one memory block.
- *
- * If the measured string is being freed, whole memory block is freed.
- * The measured string should be used only as a constant.
- *
- * @param[in] string	The initial character string to be stored.
- * @param[in] length	The length of the given string without the terminating
- *			zero ('\0') character. If the length is zero, the actual
- *			length is computed. The given length is used and
- *			appended with the terminating zero ('\0') character
- *			otherwise.
- * @return		The new bundled character string with measured length.
- * @return		NULL if there is not enough memory left.
- */
-measured_string_t *
-measured_string_create_bulk(const uint8_t *string, size_t length)
-{
-	measured_string_t *new;
-
-	if (length == 0) {
-		while (string[length])
-			length++;
-	}
-	new = (measured_string_t *) malloc(sizeof(measured_string_t) +
-	    (sizeof(uint8_t) * (length + 1)));
-	if (!new)
-		return NULL;
-
-	new->length = length;
-	new->value = ((uint8_t *) new) + sizeof(measured_string_t);
-	/* Append terminating zero explicitly - to be safe */
-	memcpy(new->value, string, new->length);
-	new->value[new->length] = '\0';
-
-	return new;
-}
-
-/** Copies the given measured string with separated header and data parts.
- *
- * @param[in] source	The source measured string to be copied.
- * @return		The copy of the given measured string.
- * @return		NULL if the source parameter is NULL.
- * @return		NULL if there is not enough memory left.
- */
-measured_string_t *measured_string_copy(measured_string_t *source)
-{
-	measured_string_t *new;
-
-	if (!source)
-		return NULL;
-
-	new = (measured_string_t *) malloc(sizeof(measured_string_t));
-	if (new) {
-		new->value = (uint8_t *) malloc(source->length + 1);
-		if (new->value) {
-			new->length = source->length;
-			memcpy(new->value, source->value, new->length);
-			new->value[new->length] = '\0';
-			return new;
-		}
-		free(new);
-	}
-
-	return NULL;
-}
-
-/** Receives a measured strings array from a calling module.
- *
- * Creates the array and the data memory blocks.
- * This method should be used only while processing IPC messages as the array
- * size has to be negotiated in advance.
- *
- *  @param[out] strings	The received measured strings array.
- *  @param[out] data	The measured strings data. This memory block stores the
- *			actual character strings.
- *  @param[in] count	The size of the measured strings array.
- *  @return		EOK on success.
- *  @return		EINVAL if the strings or data parameter is NULL.
- *  @return		EINVAL if the count parameter is zero (0).
- *  @return		EINVAL if the sent array differs in size.
- *  @return		EINVAL if there is inconsistency in sent measured
- *			strings' lengths (should not occur).
- *  @return		ENOMEM if there is not enough memory left.
- *  @return		Other error codes as defined for the
- *			async_data_write_finalize() function.
- */
-int
-measured_strings_receive(measured_string_t **strings, uint8_t **data,
-    size_t count)
-{
-	size_t *lengths;
-	size_t index;
-	size_t length;
-	uint8_t *next;
-	ipc_callid_t callid;
-	int rc;
-
-	if ((!strings) || (!data) || (count <= 0))
-		return EINVAL;
-
-	lengths = (size_t *) malloc(sizeof(size_t) * (count + 1));
-	if (!lengths)
-		return ENOMEM;
-
-	if ((!async_data_write_receive(&callid, &length)) ||
-	    (length != sizeof(size_t) * (count + 1))) {
-		free(lengths);
-		return EINVAL;
-	}
-	rc = async_data_write_finalize(callid, lengths, length);
-	if (rc != EOK) {
-		free(lengths);
-		return rc;
-	}
-
-	*data = malloc(lengths[count]);
-	if (!*data) {
-		free(lengths);
-		return ENOMEM;
-	}
-	(*data)[lengths[count] - 1] = '\0';
-
-	*strings = (measured_string_t *) malloc(sizeof(measured_string_t) *
-	    count);
-	if (!*strings) {
-		free(lengths);
-		free(*data);
-		return ENOMEM;
-	}
-
-	next = *data;
-	for (index = 0; index < count; index++) {
-		(*strings)[index].length = lengths[index];
-		if (lengths[index] > 0) {
-			if (!async_data_write_receive(&callid, &length) ||
-			    (length != lengths[index])) {
-				free(*data);
-				free(*strings);
-				free(lengths);
-				return EINVAL;
-			}
-			rc = async_data_write_finalize(callid, next,
-			    lengths[index]);
-			if (rc != EOK) {
-				free(*data);
-				free(*strings);
-				free(lengths);
-				return rc;
-			}
-			(*strings)[index].value = next;
-			next += lengths[index];
-			*next++ = '\0';
-		} else {
-			(*strings)[index].value = NULL;
-		}
-	}
-
-	free(lengths);
-	return EOK;
-}
-
-/** Computes the lengths of the measured strings in the given array.
- *
- * @param[in] strings	The measured strings array to be processed.
- * @param[in] count	The measured strings array size.
- * @return		The computed sizes array.
- * @return		NULL if there is not enough memory left.
- */
-static size_t *prepare_lengths(const measured_string_t *strings, size_t count)
-{
-	size_t *lengths;
-	size_t index;
-	size_t length;
-
-	lengths = (size_t *) malloc(sizeof(size_t) * (count + 1));
-	if (!lengths)
-		return NULL;
-
-	length = 0;
-	for (index = 0; index < count; index++) {
-		lengths[index] = strings[index].length;
-		length += lengths[index] + 1;
-	}
-	lengths[count] = length;
-	return lengths;
-}
-
-/** Replies the given measured strings array to a calling module.
- *
- * This method should be used only while processing IPC messages as the array
- * size has to be negotiated in advance.
- *
- * @param[in] strings	The measured strings array to be transferred.
- * @param[in] count	The measured strings array size.
- * @return		EOK on success.
- * @return		EINVAL if the strings parameter is NULL.
- * @return		EINVAL if the count parameter is zero (0).
- * @return		EINVAL if the calling module does not accept the given
- *			array size.
- * @return		EINVAL if there is inconsistency in sent measured
- *			strings' lengths (should not occur).
- * @return		Other error codes as defined for the
- *			async_data_read_finalize() function.
- */
-int measured_strings_reply(const measured_string_t *strings, size_t count)
-{
-	size_t *lengths;
-	size_t index;
-	size_t length;
-	ipc_callid_t callid;
-	int rc;
-
-	if ((!strings) || (count <= 0))
-		return EINVAL;
-
-	lengths = prepare_lengths(strings, count);
-	if (!lengths)
-		return ENOMEM;
-
-	if (!async_data_read_receive(&callid, &length) ||
-	    (length != sizeof(size_t) * (count + 1))) {
-		free(lengths);
-		return EINVAL;
-	}
-	rc = async_data_read_finalize(callid, lengths, length);
-	if (rc != EOK) {
-		free(lengths);
-		return rc;
-	}
-	free(lengths);
-
-	for (index = 0; index < count; index++) {
-		if (strings[index].length > 0) {
-			if (!async_data_read_receive(&callid, &length) ||
-			    (length != strings[index].length)) {
-				return EINVAL;
-			}
-			rc = async_data_read_finalize(callid,
-			    strings[index].value, strings[index].length);
-			if (rc != EOK)
-				return rc;
-		}
-	}
-
-	return EOK;
-}
-
-/** Receives a measured strings array from another module.
- *
- * Creates the array and the data memory blocks.
- * This method should be used only following other IPC messages as the array
- * size has to be negotiated in advance.
- *
- * @param[in] exch	Exchange.
- * @param[out] strings	The returned measured strings array.
- * @param[out] data	The measured strings data. This memory block stores the
- *			actual character strings.
- * @param[in] count	The size of the measured strings array.
- * @return		EOK on success.
- * @return		EINVAL if the strings or data parameter is NULL.
- * @return		EINVAL if the exch or count parameter is invalid.
- * @return		EINVAL if the sent array differs in size.
- * @return		ENOMEM if there is not enough memory left.
- * @return		Other error codes as defined for the
- *			async_data_read_start() function.
- */
-int measured_strings_return(async_exch_t *exch, measured_string_t **strings,
-    uint8_t **data, size_t count)
-{
-	size_t *lengths;
-	size_t index;
-	uint8_t *next;
-	int rc;
-
-	if ((exch == NULL) || (!strings) || (!data) || (count <= 0))
-		return EINVAL;
-
-	lengths = (size_t *) malloc(sizeof(size_t) * (count + 1));
-	if (!lengths)
-		return ENOMEM;
-
-	rc = async_data_read_start(exch, lengths,
-	    sizeof(size_t) * (count + 1));
-	if (rc != EOK) {
-		free(lengths);
-		return rc;
-	}
-
-	*data = malloc(lengths[count]);
-	if (!*data) {
-		free(lengths);
-		return ENOMEM;
-	}
-
-	*strings = (measured_string_t *) malloc(sizeof(measured_string_t) *
-	    count);
-	if (!*strings) {
-		free(lengths);
-		free(*data);
-		return ENOMEM;
-	}
-
-	next = *data;
-	for (index = 0; index < count; index++) {
-		(*strings)[index].length = lengths[index];
-		if (lengths[index] > 0) {
-			rc = async_data_read_start(exch, next, lengths[index]);
-			if (rc != EOK) {
-			    	free(lengths);
-				free(data);
-				free(strings);
-				return rc;
-			}
-			(*strings)[index].value = next;
-			next += lengths[index];
-			*next++ = '\0';
-		} else {
-			(*strings)[index].value = NULL;
-		}
-	}
-
-	free(lengths);
-	return EOK;
-}
-
-/** Sends the given measured strings array to another module.
- *
- * This method should be used only following other IPC messages as the array
- * size has to be negotiated in advance.
- *
- * @param[in] exch	Exchange.
- * @param[in] strings	The measured strings array to be transferred.
- * @param[in] count	The measured strings array size.
- * @return		EOK on success.
- * @return		EINVAL if the strings parameter is NULL.
- * @return		EINVAL if the exch or count parameter is invalid.
- * @return		Other error codes as defined for the
- *			async_data_write_start() function.
- */
-int measured_strings_send(async_exch_t *exch, const measured_string_t *strings,
-    size_t count)
-{
-	size_t *lengths;
-	size_t index;
-	int rc;
-
-	if ((exch == NULL) || (!strings) || (count <= 0))
-		return EINVAL;
-
-	lengths = prepare_lengths(strings, count);
-	if (!lengths)
-		return ENOMEM;
-
-	rc = async_data_write_start(exch, lengths,
-	    sizeof(size_t) * (count + 1));
-	if (rc != EOK) {
-		free(lengths);
-		return rc;
-	}
-
-	free(lengths);
-
-	for (index = 0; index < count; index++) {
-		if (strings[index].length > 0) {
-			rc = async_data_write_start(exch, strings[index].value,
-			    strings[index].length);
-			if (rc != EOK)
-				return rc;
-		}
-	}
-
-	return EOK;
-}
-
-/** @}
- */
Index: uspace/lib/c/generic/async.c
===================================================================
--- uspace/lib/c/generic/async.c	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/generic/async.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -189,4 +189,10 @@
 	/** If reply was received. */
 	bool done;
+
+	/** If the message / reply should be discarded on arrival. */
+	bool forget;
+
+	/** If already destroyed. */
+	bool destroyed;
 	
 	/** Pointer to where the answer data is stored. */
@@ -240,4 +246,52 @@
 /** Identifier of the incoming connection handled by the current fibril. */
 static fibril_local connection_t *fibril_connection;
+
+static void to_event_initialize(to_event_t *to)
+{
+	struct timeval tv = { 0, 0 };
+
+	to->inlist = false;
+	to->occurred = false;
+	link_initialize(&to->link);
+	to->expires = tv;
+}
+
+static void wu_event_initialize(wu_event_t *wu)
+{
+	wu->inlist = false;
+	link_initialize(&wu->link);
+}
+
+void awaiter_initialize(awaiter_t *aw)
+{
+	aw->fid = 0;
+	aw->active = false;
+	to_event_initialize(&aw->to_event);
+	wu_event_initialize(&aw->wu_event);
+}
+
+static amsg_t *amsg_create(void)
+{
+	amsg_t *msg;
+
+	msg = malloc(sizeof(amsg_t));
+	if (msg) {
+		msg->done = false;
+		msg->forget = false;
+		msg->destroyed = false;
+		msg->dataptr = NULL;
+		msg->retval = (sysarg_t) EINVAL;
+		awaiter_initialize(&msg->wdata);
+	}
+
+	return msg;
+}
+
+static void amsg_destroy(amsg_t *msg)
+{
+	assert(!msg->destroyed);
+	msg->destroyed = true;
+	free(msg);
+}
 
 static void *default_client_data_constructor(void)
@@ -892,5 +946,5 @@
 	
 	switch (IPC_GET_IMETHOD(*call)) {
-	case IPC_M_CONNECT_ME:
+	case IPC_M_CLONE_ESTABLISH:
 	case IPC_M_CONNECT_ME_TO:
 		/* Open new connection with fibril, etc. */
@@ -963,4 +1017,5 @@
 		
 		suseconds_t timeout;
+		unsigned int flags = SYNCH_FLAGS_NONE;
 		if (!list_empty(&timeout_list)) {
 			awaiter_t *waiter = list_get_instance(
@@ -973,17 +1028,30 @@
 				futex_up(&async_futex);
 				handle_expired_timeouts();
-				continue;
-			} else
+				/*
+				 * Notice that even if the event(s) already
+				 * expired (and thus the other fibril was
+				 * supposed to be running already),
+				 * we check for incoming IPC.
+				 *
+				 * Otherwise, a fibril that continuously
+				 * creates (almost) expired events could
+				 * prevent IPC retrieval from the kernel.
+				 */
+				timeout = 0;
+				flags = SYNCH_FLAGS_NON_BLOCKING;
+
+			} else {
 				timeout = tv_sub(&waiter->to_event.expires, &tv);
-		} else
+				futex_up(&async_futex);
+			}
+		} else {
+			futex_up(&async_futex);
 			timeout = SYNCH_NO_TIMEOUT;
-		
-		futex_up(&async_futex);
+		}
 		
 		atomic_inc(&threads_in_ipc_wait);
 		
 		ipc_call_t call;
-		ipc_callid_t callid = ipc_wait_cycle(&call, timeout,
-		    SYNCH_FLAGS_NONE);
+		ipc_callid_t callid = ipc_wait_cycle(&call, timeout, flags);
 		
 		atomic_dec(&threads_in_ipc_wait);
@@ -1100,9 +1168,13 @@
 	
 	msg->done = true;
-	if (!msg->wdata.active) {
+
+	if (msg->forget) {
+		assert(msg->wdata.active);
+		amsg_destroy(msg);
+	} else if (!msg->wdata.active) {
 		msg->wdata.active = true;
 		fibril_add_ready(msg->wdata.fid);
 	}
-	
+
 	futex_up(&async_futex);
 }
@@ -1131,17 +1203,9 @@
 		return 0;
 	
-	amsg_t *msg = malloc(sizeof(amsg_t));
+	amsg_t *msg = amsg_create();
 	if (msg == NULL)
 		return 0;
 	
-	msg->done = false;
 	msg->dataptr = dataptr;
-	
-	msg->wdata.to_event.inlist = false;
-	
-	/*
-	 * We may sleep in the next method,
-	 * but it will use its own means
-	 */
 	msg->wdata.active = true;
 	
@@ -1177,18 +1241,9 @@
 		return 0;
 	
-	amsg_t *msg = malloc(sizeof(amsg_t));
-	
+	amsg_t *msg = amsg_create();
 	if (msg == NULL)
 		return 0;
 	
-	msg->done = false;
 	msg->dataptr = dataptr;
-	
-	msg->wdata.to_event.inlist = false;
-	
-	/*
-	 * We may sleep in the next method,
-	 * but it will use its own means
-	 */
 	msg->wdata.active = true;
 	
@@ -1213,4 +1268,8 @@
 	
 	futex_down(&async_futex);
+
+	assert(!msg->forget);
+	assert(!msg->destroyed);
+
 	if (msg->done) {
 		futex_up(&async_futex);
@@ -1231,8 +1290,12 @@
 		*retval = msg->retval;
 	
-	free(msg);
+	amsg_destroy(msg);
 }
 
 /** Wait for a message sent by the async framework, timeout variant.
+ *
+ * If the wait times out, the caller may choose to either wait again by calling
+ * async_wait_for() or async_wait_timeout(), or forget the message via
+ * async_forget().
  *
  * @param amsgid  Hash of the message to wait for.
@@ -1249,10 +1312,10 @@
 	
 	amsg_t *msg = (amsg_t *) amsgid;
-	
-	/* TODO: Let it go through the event read at least once */
-	if (timeout < 0)
-		return ETIMEOUT;
-	
+
 	futex_down(&async_futex);
+
+	assert(!msg->forget);
+	assert(!msg->destroyed);
+
 	if (msg->done) {
 		futex_up(&async_futex);
@@ -1260,7 +1323,31 @@
 	}
 	
+	/*
+	 * Negative timeout is converted to zero timeout to avoid
+	 * using tv_add with negative augmenter.
+	 */
+	if (timeout < 0)
+		timeout = 0;
+
 	gettimeofday(&msg->wdata.to_event.expires, NULL);
 	tv_add(&msg->wdata.to_event.expires, timeout);
 	
+	/*
+	 * Current fibril is inserted as waiting regardless of the
+	 * "size" of the timeout.
+	 *
+	 * Checking for msg->done and immediately bailing out when
+	 * timeout == 0 would mean that the manager fibril would never
+	 * run (consider single threaded program).
+	 * Thus the IPC answer would be never retrieved from the kernel.
+	 *
+	 * Notice that the actual delay would be very small because we
+	 * - switch to manager fibril
+	 * - the manager sees expired timeout
+	 * - and thus adds us back to ready queue
+	 * - manager switches back to some ready fibril
+	 *   (prior it, it checks for incoming IPC).
+	 *
+	 */
 	msg->wdata.fid = fibril_get_id();
 	msg->wdata.active = false;
@@ -1279,8 +1366,32 @@
 		*retval = msg->retval;
 	
-	free(msg);
+	amsg_destroy(msg);
 	
 	return 0;
 }
+ 
+/** Discard the message / reply on arrival.
+ *
+ * The message will be marked to be discarded once the reply arrives in
+ * reply_received(). It is not allowed to call async_wait_for() or
+ * async_wait_timeout() on this message after a call to this function.
+ *
+ * @param amsgid  Hash of the message to forget.
+ */
+void async_forget(aid_t amsgid)
+{
+	amsg_t *msg = (amsg_t *) amsgid;
+
+	assert(msg);
+	assert(!msg->forget);
+	assert(!msg->destroyed);
+
+	futex_down(&async_futex);
+	if (msg->done)
+		amsg_destroy(msg);
+	else 
+		msg->forget = true;
+	futex_up(&async_futex);
+}
 
 /** Wait for specified time.
@@ -1293,11 +1404,9 @@
 void async_usleep(suseconds_t timeout)
 {
-	amsg_t *msg = malloc(sizeof(amsg_t));
-	
+	amsg_t *msg = amsg_create();
 	if (!msg)
 		return;
 	
 	msg->wdata.fid = fibril_get_id();
-	msg->wdata.active = false;
 	
 	gettimeofday(&msg->wdata.to_event.expires, NULL);
@@ -1313,5 +1422,5 @@
 	/* Futex is up automatically after fibril_switch() */
 	
-	free(msg);
+	amsg_destroy(msg);
 }
 
@@ -1559,7 +1668,7 @@
 }
 
-/** Wrapper for making IPC_M_CONNECT_ME calls using the async framework.
- *
- * Ask through for a cloned connection to some service.
+/** Wrapper for making IPC_M_CLONE_ESTABLISH calls using the async framework.
+ *
+ * Ask for a cloned connection to some service.
  *
  * @param mgmt Exchange management style.
@@ -1569,5 +1678,5 @@
  *
  */
-async_sess_t *async_connect_me(exch_mgmt_t mgmt, async_exch_t *exch)
+async_sess_t *async_clone_establish(exch_mgmt_t mgmt, async_exch_t *exch)
 {
 	if (exch == NULL) {
@@ -1584,6 +1693,6 @@
 	ipc_call_t result;
 	
-	amsg_t *msg = malloc(sizeof(amsg_t));
-	if (msg == NULL) {
+	amsg_t *msg = amsg_create();
+	if (!msg) {
 		free(sess);
 		errno = ENOMEM;
@@ -1591,16 +1700,8 @@
 	}
 	
-	msg->done = false;
 	msg->dataptr = &result;
-	
-	msg->wdata.to_event.inlist = false;
-	
-	/*
-	 * We may sleep in the next method,
-	 * but it will use its own means
-	 */
 	msg->wdata.active = true;
 	
-	ipc_call_async_0(exch->phone, IPC_M_CONNECT_ME, msg,
+	ipc_call_async_0(exch->phone, IPC_M_CLONE_ESTABLISH, msg,
 	    reply_received, true);
 	
@@ -1643,17 +1744,9 @@
 	ipc_call_t result;
 	
-	amsg_t *msg = malloc(sizeof(amsg_t));
-	if (msg == NULL)
+	amsg_t *msg = amsg_create();
+	if (!msg)
 		return ENOENT;
 	
-	msg->done = false;
 	msg->dataptr = &result;
-	
-	msg->wdata.to_event.inlist = false;
-	
-	/*
-	 * We may sleep in the next method,
-	 * but it will use its own means
-	 */
 	msg->wdata.active = true;
 	
@@ -2251,5 +2344,5 @@
 	    IPC_FF_ROUTE_FROM_ME);
 	if (retval != EOK) {
-		async_wait_for(msg, NULL);
+		async_forget(msg);
 		ipc_answer_0(callid, retval);
 		return retval;
@@ -2445,5 +2538,5 @@
 	    IPC_FF_ROUTE_FROM_ME);
 	if (retval != EOK) {
-		async_wait_for(msg, NULL);
+		async_forget(msg);
 		ipc_answer_0(callid, retval);
 		return retval;
Index: uspace/lib/c/generic/device/nic.c
===================================================================
--- uspace/lib/c/generic/device/nic.c	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/generic/device/nic.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -65,5 +65,5 @@
 	
 	if (retval != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return retval;
 	}
@@ -94,5 +94,5 @@
 	rc = async_connect_to_me(exch, 0, 0, 0, cfun, carg);
 	if (rc != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return rc;
 	}
Index: uspace/lib/c/generic/devman.c
===================================================================
--- uspace/lib/c/generic/devman.c	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/generic/devman.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -188,5 +188,5 @@
 	
 	if (retval != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return retval;
 	}
@@ -226,5 +226,5 @@
 	if (retval != EOK) {
 		devman_exchange_end(exch);
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return retval;
 	}
@@ -242,6 +242,6 @@
 		if (retval != EOK) {
 			devman_exchange_end(exch);
-			async_wait_for(req2, NULL);
-			async_wait_for(req, NULL);
+			async_forget(req2);
+			async_forget(req);
 			return retval;
 		}
@@ -250,5 +250,5 @@
 		if (retval != EOK) {
 			devman_exchange_end(exch);
-			async_wait_for(req, NULL);
+			async_forget(req);
 			return retval;
 		}
@@ -283,5 +283,5 @@
 	
 	if (retval != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return retval;
 	}
@@ -386,5 +386,5 @@
 	
 	if (retval != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return retval;
 	}
@@ -423,5 +423,5 @@
 	
 	if (dretval != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return dretval;
 	}
@@ -488,5 +488,5 @@
 	
 	if (rc != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return rc;
 	}
Index: uspace/lib/c/generic/fibril_synch.c
===================================================================
--- uspace/lib/c/generic/fibril_synch.c	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/generic/fibril_synch.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -112,8 +112,7 @@
 		awaiter_t wdata;
 
+		awaiter_initialize(&wdata);
 		wdata.fid = fibril_get_id();
-		wdata.active = false;
 		wdata.wu_event.inlist = true;
-		link_initialize(&wdata.wu_event.link);
 		list_append(&wdata.wu_event.link, &fm->waiters);
 		check_for_deadlock(&fm->oi);
@@ -205,8 +204,7 @@
 		awaiter_t wdata;
 
+		awaiter_initialize(&wdata);
 		wdata.fid = (fid_t) f;
-		wdata.active = false;
 		wdata.wu_event.inlist = true;
-		link_initialize(&wdata.wu_event.link);
 		f->flags &= ~FIBRIL_WRITER;
 		list_append(&wdata.wu_event.link, &frw->waiters);
@@ -233,8 +231,7 @@
 		awaiter_t wdata;
 
+		awaiter_initialize(&wdata);
 		wdata.fid = (fid_t) f;
-		wdata.active = false;
 		wdata.wu_event.inlist = true;
-		link_initialize(&wdata.wu_event.link);
 		f->flags |= FIBRIL_WRITER;
 		list_append(&wdata.wu_event.link, &frw->waiters);
@@ -375,13 +372,8 @@
 		return ETIMEOUT;
 
+	awaiter_initialize(&wdata);
 	wdata.fid = fibril_get_id();
-	wdata.active = false;
-	
 	wdata.to_event.inlist = timeout > 0;
-	wdata.to_event.occurred = false;
-	link_initialize(&wdata.to_event.link);
-
 	wdata.wu_event.inlist = true;
-	link_initialize(&wdata.wu_event.link);
 
 	futex_down(&async_futex);
Index: uspace/lib/c/generic/inet.c
===================================================================
--- uspace/lib/c/generic/inet.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
+++ uspace/lib/c/generic/inet.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2012 Jiri Svoboda
+ * 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.
+ */
+
+#include <async.h>
+#include <assert.h>
+#include <errno.h>
+#include <inet/inet.h>
+#include <ipc/inet.h>
+#include <ipc/services.h>
+#include <loc.h>
+
+static void inet_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
+
+static async_sess_t *inet_sess = NULL;
+static inet_ev_ops_t *inet_ev_ops = NULL;
+static uint8_t inet_protocol = 0;
+
+static int inet_callback_create(void)
+{
+	async_exch_t *exch = async_exchange_begin(inet_sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_0(exch, INET_CALLBACK_CREATE, &answer);
+	int rc = async_connect_to_me(exch, 0, 0, 0, inet_cb_conn, NULL);
+	async_exchange_end(exch);
+
+	if (rc != EOK)
+		return rc;
+
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	if (retval != EOK)
+		return retval;
+
+	return EOK;
+}
+
+static int inet_set_proto(uint8_t protocol)
+{
+	int rc;
+
+	async_exch_t *exch = async_exchange_begin(inet_sess);
+	rc = async_req_1_0(exch, INET_SET_PROTO, protocol);
+	async_exchange_end(exch);
+
+	return rc;
+}
+
+int inet_init(uint8_t protocol, inet_ev_ops_t *ev_ops)
+{
+	service_id_t inet_svc;
+	int rc;
+
+	assert(inet_sess == NULL);
+	assert(inet_ev_ops == NULL);
+	assert(inet_protocol == 0);
+
+	rc = loc_service_get_id(SERVICE_NAME_INET, &inet_svc,
+	    IPC_FLAG_BLOCKING);
+	if (rc != EOK)
+		return ENOENT;
+
+	inet_sess = loc_service_connect(EXCHANGE_SERIALIZE, inet_svc,
+	    IPC_FLAG_BLOCKING);
+	if (inet_sess == NULL)
+		return ENOENT;
+
+	if (inet_set_proto(protocol) != EOK) {
+		async_hangup(inet_sess);
+		inet_sess = NULL;
+		return EIO;
+	}
+
+	if (inet_callback_create() != EOK) {
+		async_hangup(inet_sess);
+		inet_sess = NULL;
+		return EIO;
+	}
+
+	inet_protocol = protocol;
+	inet_ev_ops = ev_ops;
+
+	return EOK;
+}
+
+int inet_send(inet_dgram_t *dgram, uint8_t ttl, inet_df_t df)
+{
+	async_exch_t *exch = async_exchange_begin(inet_sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_5(exch, INET_SEND, dgram->src.ipv4,
+	    dgram->dest.ipv4, dgram->tos, ttl, df, &answer);
+	int rc = async_data_write_start(exch, dgram->data, dgram->size);
+	async_exchange_end(exch);
+
+	if (rc != EOK) {
+		async_forget(req);
+		return rc;
+	}
+
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	if (retval != EOK)
+		return retval;
+
+	return EOK;
+}
+
+int inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
+{
+	sysarg_t local_addr;
+	async_exch_t *exch = async_exchange_begin(inet_sess);
+
+	int rc = async_req_2_1(exch, INET_GET_SRCADDR, remote->ipv4,
+	    tos, &local_addr);
+	async_exchange_end(exch);
+
+	if (rc != EOK)
+		return rc;
+
+	local->ipv4 = local_addr;
+	return EOK;
+}
+
+static void inet_ev_recv(ipc_callid_t callid, ipc_call_t *call)
+{
+	int rc;
+	inet_dgram_t dgram;
+
+	dgram.src.ipv4 = IPC_GET_ARG1(*call);
+	dgram.dest.ipv4 = IPC_GET_ARG2(*call);
+	dgram.tos = IPC_GET_ARG3(*call);
+
+	rc = async_data_write_accept(&dgram.data, false, 0, 0, 0, &dgram.size);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		return;
+	}
+
+	rc = inet_ev_ops->recv(&dgram);
+	async_answer_0(callid, rc);
+}
+
+static void inet_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
+{
+	while (true) {
+		ipc_call_t call;
+		ipc_callid_t callid = async_get_call(&call);
+
+		if (!IPC_GET_IMETHOD(call)) {
+			/* TODO: Handle hangup */
+			return;
+		}
+
+		switch (IPC_GET_IMETHOD(call)) {
+		case INET_EV_RECV:
+			inet_ev_recv(callid, &call);
+			break;
+		default:
+			async_answer_0(callid, ENOTSUP);
+		}
+	}
+}
+
+/** @}
+ */
Index: uspace/lib/c/generic/inetcfg.c
===================================================================
--- uspace/lib/c/generic/inetcfg.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
+++ uspace/lib/c/generic/inetcfg.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -0,0 +1,377 @@
+/*
+ * Copyright (c) 2012 Jiri Svoboda
+ * 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.
+ */
+
+#include <async.h>
+#include <assert.h>
+#include <errno.h>
+#include <inet/inetcfg.h>
+#include <ipc/inet.h>
+#include <ipc/services.h>
+#include <loc.h>
+#include <stdlib.h>
+#include <str.h>
+
+static async_sess_t *inetcfg_sess = NULL;
+
+static int inetcfg_get_ids_once(sysarg_t method, sysarg_t arg1,
+    sysarg_t *id_buf, size_t buf_size, size_t *act_size)
+{
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_1(exch, method, arg1, &answer);
+	int rc = async_data_read_start(exch, id_buf, buf_size);
+
+	async_exchange_end(exch);
+
+	if (rc != EOK) {
+		async_forget(req);
+		return rc;
+	}
+
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+
+	if (retval != EOK) {
+		return retval;
+	}
+
+	*act_size = IPC_GET_ARG1(answer);
+	return EOK;
+}
+
+/** Get list of IDs.
+ *
+ * Returns an allocated array of service IDs.
+ *
+ * @param method	IPC method
+ * @param arg1		IPC argument 1
+ * @param data		Place to store pointer to array of IDs
+ * @param count		Place to store number of IDs
+ * @return 		EOK on success or negative error code
+ */
+static int inetcfg_get_ids_internal(sysarg_t method, sysarg_t arg1,
+    sysarg_t **data, size_t *count)
+{
+	*data = NULL;
+	*count = 0;
+
+	size_t act_size = 0;
+	int rc = inetcfg_get_ids_once(method, arg1, NULL, 0,
+	    &act_size);
+	if (rc != EOK)
+		return rc;
+
+	size_t alloc_size = act_size;
+	service_id_t *ids = malloc(alloc_size);
+	if (ids == NULL)
+		return ENOMEM;
+
+	while (true) {
+		rc = inetcfg_get_ids_once(method, arg1, ids, alloc_size,
+		    &act_size);
+		if (rc != EOK)
+			return rc;
+
+		if (act_size <= alloc_size)
+			break;
+
+		alloc_size = act_size;
+		ids = realloc(ids, alloc_size);
+		if (ids == NULL)
+			return ENOMEM;
+	}
+
+	*count = act_size / sizeof(sysarg_t);
+	*data = ids;
+	return EOK;
+}
+
+int inetcfg_init(void)
+{
+	service_id_t inet_svc;
+	int rc;
+
+	assert(inetcfg_sess == NULL);
+
+	rc = loc_service_get_id(SERVICE_NAME_INETCFG, &inet_svc,
+	    IPC_FLAG_BLOCKING);
+	if (rc != EOK)
+		return ENOENT;
+
+	inetcfg_sess = loc_service_connect(EXCHANGE_SERIALIZE, inet_svc,
+	    IPC_FLAG_BLOCKING);
+	if (inetcfg_sess == NULL)
+		return ENOENT;
+
+	return EOK;
+}
+
+int inetcfg_addr_create_static(const char *name, inet_naddr_t *naddr,
+    sysarg_t link_id, sysarg_t *addr_id)
+{
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_3(exch, INETCFG_ADDR_CREATE_STATIC, naddr->ipv4,
+	    naddr->bits, link_id, &answer);
+	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
+
+	async_exchange_end(exch);
+
+	if (retval != EOK) {
+		async_forget(req);
+		return retval;
+	}
+
+	async_wait_for(req, &retval);
+	*addr_id = IPC_GET_ARG1(answer);
+
+	return retval;
+}
+
+int inetcfg_addr_delete(sysarg_t addr_id)
+{
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	int rc = async_req_1_0(exch, INETCFG_ADDR_DELETE, addr_id);
+	async_exchange_end(exch);
+
+	return rc;
+}
+
+int inetcfg_addr_get(sysarg_t addr_id, inet_addr_info_t *ainfo)
+{
+	ipc_call_t dreply;
+	sysarg_t dretval;
+	size_t act_size;
+	char name_buf[LOC_NAME_MAXLEN + 1];
+
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_1(exch, INETCFG_ADDR_GET, addr_id, &answer);
+	aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN, &dreply);
+	async_wait_for(dreq, &dretval);
+
+	async_exchange_end(exch);
+
+	if (dretval != EOK) {
+		async_forget(req);
+		return dretval;
+	}
+
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+
+	if (retval != EOK)
+		return retval;
+
+	act_size = IPC_GET_ARG2(dreply);
+	assert(act_size <= LOC_NAME_MAXLEN);
+	name_buf[act_size] = '\0';
+
+	ainfo->naddr.ipv4 = IPC_GET_ARG1(answer);
+	ainfo->naddr.bits = IPC_GET_ARG2(answer);
+	ainfo->ilink = IPC_GET_ARG3(answer);
+	ainfo->name = str_dup(name_buf);
+
+	return EOK;
+}
+
+int inetcfg_addr_get_id(const char *name, sysarg_t link_id, sysarg_t *addr_id)
+{
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_1(exch, INETCFG_ADDR_GET_ID, link_id, &answer);
+	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
+
+	async_exchange_end(exch);
+
+	if (retval != EOK) {
+		async_forget(req);
+		return retval;
+	}
+
+	async_wait_for(req, &retval);
+	*addr_id = IPC_GET_ARG1(answer);
+
+	return retval;
+}
+
+int inetcfg_get_addr_list(sysarg_t **addrs, size_t *count)
+{
+	return inetcfg_get_ids_internal(INETCFG_GET_ADDR_LIST,
+	    0, addrs, count);
+}
+
+int inetcfg_get_link_list(sysarg_t **links, size_t *count)
+{
+	return inetcfg_get_ids_internal(INETCFG_GET_LINK_LIST,
+	    0, links, count);
+}
+
+int inetcfg_get_sroute_list(sysarg_t **sroutes, size_t *count)
+{
+	return inetcfg_get_ids_internal(INETCFG_GET_SROUTE_LIST,
+	    0, sroutes, count);
+}
+
+int inetcfg_link_get(sysarg_t link_id, inet_link_info_t *linfo)
+{
+	ipc_call_t dreply;
+	sysarg_t dretval;
+	size_t act_size;
+	char name_buf[LOC_NAME_MAXLEN + 1];
+
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_1(exch, INETCFG_LINK_GET, link_id, &answer);
+	aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN, &dreply);
+	async_wait_for(dreq, &dretval);
+
+	async_exchange_end(exch);
+
+	if (dretval != EOK) {
+		async_forget(req);
+		return dretval;
+	}
+
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+
+	if (retval != EOK)
+		return retval;
+
+	act_size = IPC_GET_ARG2(dreply);
+	assert(act_size <= LOC_NAME_MAXLEN);
+	name_buf[act_size] = '\0';
+
+	linfo->name = str_dup(name_buf);
+	linfo->def_mtu = IPC_GET_ARG1(answer);
+
+	return EOK;
+}
+
+int inetcfg_sroute_create(const char *name, inet_naddr_t *dest,
+    inet_addr_t *router, sysarg_t *sroute_id)
+{
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_3(exch, INETCFG_SROUTE_CREATE,
+	    dest->ipv4, dest->bits, router->ipv4, &answer);
+	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
+
+	async_exchange_end(exch);
+
+	if (retval != EOK) {
+		async_forget(req);
+		return retval;
+	}
+
+	async_wait_for(req, &retval);
+	*sroute_id = IPC_GET_ARG1(answer);
+
+	return retval;
+}
+
+int inetcfg_sroute_delete(sysarg_t sroute_id)
+{
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	int rc = async_req_1_0(exch, INETCFG_SROUTE_DELETE, sroute_id);
+	async_exchange_end(exch);
+
+	return rc;
+}
+
+int inetcfg_sroute_get(sysarg_t sroute_id, inet_sroute_info_t *srinfo)
+{
+	ipc_call_t dreply;
+	sysarg_t dretval;
+	size_t act_size;
+	char name_buf[LOC_NAME_MAXLEN + 1];
+
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_1(exch, INETCFG_SROUTE_GET, sroute_id, &answer);
+	aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN, &dreply);
+	async_wait_for(dreq, &dretval);
+
+	async_exchange_end(exch);
+
+	if (dretval != EOK) {
+		async_forget(req);
+		return dretval;
+	}
+
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+
+	if (retval != EOK)
+		return retval;
+
+	act_size = IPC_GET_ARG2(dreply);
+	assert(act_size <= LOC_NAME_MAXLEN);
+	name_buf[act_size] = '\0';
+
+	srinfo->dest.ipv4 = IPC_GET_ARG1(answer);
+	srinfo->dest.bits = IPC_GET_ARG2(answer);
+	srinfo->router.ipv4 = IPC_GET_ARG3(answer);
+	srinfo->name = str_dup(name_buf);
+
+	return EOK;
+}
+
+int inetcfg_sroute_get_id(const char *name, sysarg_t *sroute_id)
+{
+	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_0(exch, INETCFG_SROUTE_GET_ID, &answer);
+	sysarg_t retval = async_data_write_start(exch, name, str_size(name));
+
+	async_exchange_end(exch);
+
+	if (retval != EOK) {
+		async_forget(req);
+		return retval;
+	}
+
+	async_wait_for(req, &retval);
+	*sroute_id = IPC_GET_ARG1(answer);
+
+	return retval;
+}
+
+/** @}
+ */
Index: uspace/lib/c/generic/inetping.c
===================================================================
--- uspace/lib/c/generic/inetping.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
+++ uspace/lib/c/generic/inetping.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012 Jiri Svoboda
+ * 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.
+ */
+
+#include <async.h>
+#include <assert.h>
+#include <errno.h>
+#include <inet/inetping.h>
+#include <ipc/inet.h>
+#include <ipc/services.h>
+#include <loc.h>
+#include <stdlib.h>
+#include <str.h>
+
+static void inetping_cb_conn(ipc_callid_t, ipc_call_t *, void *);
+static void inetping_ev_recv(ipc_callid_t, ipc_call_t *);
+
+static async_sess_t *inetping_sess = NULL;
+static inetping_ev_ops_t *inetping_ev_ops;
+
+int inetping_init(inetping_ev_ops_t *ev_ops)
+{
+	service_id_t inetping_svc;
+	int rc;
+
+	assert(inetping_sess == NULL);
+
+	inetping_ev_ops = ev_ops;
+
+	rc = loc_service_get_id(SERVICE_NAME_INETPING, &inetping_svc,
+	    IPC_FLAG_BLOCKING);
+	if (rc != EOK)
+		return ENOENT;
+
+	inetping_sess = loc_service_connect(EXCHANGE_SERIALIZE, inetping_svc,
+	    IPC_FLAG_BLOCKING);
+	if (inetping_sess == NULL)
+		return ENOENT;
+
+	async_exch_t *exch = async_exchange_begin(inetping_sess);
+
+	rc = async_connect_to_me(exch, 0, 0, 0, inetping_cb_conn, NULL);
+	async_exchange_end(exch);
+
+	if (rc != EOK) {
+		async_hangup(inetping_sess);
+		inetping_sess = NULL;
+		return rc;
+	}
+
+	return EOK;
+}
+
+int inetping_send(inetping_sdu_t *sdu)
+{
+	async_exch_t *exch = async_exchange_begin(inetping_sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_3(exch, INETPING_SEND, sdu->src.ipv4,
+	    sdu->dest.ipv4, sdu->seq_no, &answer);
+	sysarg_t retval = async_data_write_start(exch, sdu->data, sdu->size);
+
+	async_exchange_end(exch);
+
+	if (retval != EOK) {
+		async_forget(req);
+		return retval;
+	}
+
+	async_wait_for(req, &retval);
+	return retval;
+}
+
+int inetping_get_srcaddr(inet_addr_t *remote, inet_addr_t *local)
+{
+	sysarg_t local_addr;
+	async_exch_t *exch = async_exchange_begin(inetping_sess);
+
+	int rc = async_req_1_1(exch, INETPING_GET_SRCADDR, remote->ipv4,
+	    &local_addr);
+	async_exchange_end(exch);
+
+	if (rc != EOK)
+		return rc;
+
+	local->ipv4 = local_addr;
+	return EOK;
+}
+
+static void inetping_ev_recv(ipc_callid_t callid, ipc_call_t *call)
+{
+	int rc;
+	inetping_sdu_t sdu;
+
+	sdu.src.ipv4 = IPC_GET_ARG1(*call);
+	sdu.dest.ipv4 = IPC_GET_ARG2(*call);
+	sdu.seq_no = IPC_GET_ARG3(*call);
+
+	rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		return;
+	}
+
+	rc = inetping_ev_ops->recv(&sdu);
+	free(sdu.data);
+	async_answer_0(callid, rc);
+}
+
+static void inetping_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
+{
+	while (true) {
+		ipc_call_t call;
+		ipc_callid_t callid = async_get_call(&call);
+
+		if (!IPC_GET_IMETHOD(call)) {
+			/* TODO: Handle hangup */
+			return;
+		}
+
+		switch (IPC_GET_IMETHOD(call)) {
+		case INETPING_EV_RECV:
+			inetping_ev_recv(callid, &call);
+			break;
+		default:
+			async_answer_0(callid, ENOTSUP);
+		}
+	}
+}
+
+/** @}
+ */
Index: uspace/lib/c/generic/io/printf_core.c
===================================================================
--- uspace/lib/c/generic/io/printf_core.c	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/generic/io/printf_core.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -283,5 +283,5 @@
 	/* Print leading spaces. */
 	size_t strw = str_length(str);
-	if (precision == 0)
+	if ((precision == 0) || (precision > strw))
 		precision = strw;
 	
@@ -331,5 +331,5 @@
 	/* Print leading spaces. */
 	size_t strw = wstr_length(str);
-	if (precision == 0)
+	if ((precision == 0) || (precision > strw))
 		precision = strw;
 	
Index: uspace/lib/c/generic/ipc.c
===================================================================
--- uspace/lib/c/generic/ipc.c	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/generic/ipc.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -647,9 +647,9 @@
  *
  */
-int ipc_connect_me(int phoneid)
+int ipc_clone_establish(int phoneid)
 {
 	sysarg_t newphid;
-	int res = ipc_call_sync_0_5(phoneid, IPC_M_CONNECT_ME, NULL, NULL,
-	    NULL, NULL, &newphid);
+	int res = ipc_call_sync_0_5(phoneid, IPC_M_CLONE_ESTABLISH, NULL,
+	    NULL, NULL, NULL, &newphid);
 	if (res)
 		return res;
Index: uspace/lib/c/generic/iplink.c
===================================================================
--- uspace/lib/c/generic/iplink.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
+++ uspace/lib/c/generic/iplink.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2012 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/**
+ * @file
+ * @brief IP link client stub
+ */
+
+#include <async.h>
+#include <assert.h>
+#include <errno.h>
+#include <inet/iplink.h>
+#include <ipc/iplink.h>
+#include <ipc/services.h>
+#include <loc.h>
+#include <stdlib.h>
+
+static void iplink_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
+
+int iplink_open(async_sess_t *sess, iplink_ev_ops_t *ev_ops,
+    iplink_t **riplink)
+{
+	iplink_t *iplink = NULL;
+	int rc;
+
+	iplink = calloc(1, sizeof(iplink_t));
+	if (iplink == NULL)
+		return ENOMEM;
+
+	iplink->sess = sess;
+	iplink->ev_ops = ev_ops;
+
+	async_exch_t *exch = async_exchange_begin(sess);
+
+	rc = async_connect_to_me(exch, 0, 0, 0, iplink_cb_conn, iplink);
+	async_exchange_end(exch);
+
+	if (rc != EOK)
+		goto error;
+
+	*riplink = iplink;
+	return EOK;
+
+error:
+	if (iplink != NULL)
+		free(iplink);
+
+	return rc;
+}
+
+void iplink_close(iplink_t *iplink)
+{
+	/* XXX Synchronize with iplink_cb_conn */
+	free(iplink);
+}
+
+int iplink_send(iplink_t *iplink, iplink_sdu_t *sdu)
+{
+	async_exch_t *exch = async_exchange_begin(iplink->sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_2(exch, IPLINK_SEND, sdu->lsrc.ipv4,
+	    sdu->ldest.ipv4, &answer);
+	int rc = async_data_write_start(exch, sdu->data, sdu->size);
+	async_exchange_end(exch);
+
+	if (rc != EOK) {
+		async_forget(req);
+		return rc;
+	}
+
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	if (retval != EOK)
+		return retval;
+
+	return EOK;
+}
+
+int iplink_get_mtu(iplink_t *iplink, size_t *rmtu)
+{
+	sysarg_t mtu;
+	async_exch_t *exch = async_exchange_begin(iplink->sess);
+
+	int rc = async_req_0_1(exch, IPLINK_GET_MTU, &mtu);
+	async_exchange_end(exch);
+
+	if (rc != EOK)
+		return rc;
+
+	*rmtu = mtu;
+	return EOK;
+}
+
+int iplink_addr_add(iplink_t *iplink, iplink_addr_t *addr)
+{
+	async_exch_t *exch = async_exchange_begin(iplink->sess);
+
+	int rc = async_req_1_0(exch, IPLINK_ADDR_ADD, (sysarg_t)addr->ipv4);
+	async_exchange_end(exch);
+
+	return rc;
+}
+
+int iplink_addr_remove(iplink_t *iplink, iplink_addr_t *addr)
+{
+	async_exch_t *exch = async_exchange_begin(iplink->sess);
+
+	int rc = async_req_1_0(exch, IPLINK_ADDR_REMOVE, (sysarg_t)addr->ipv4);
+	async_exchange_end(exch);
+
+	return rc;
+}
+
+static void iplink_ev_recv(iplink_t *iplink, ipc_callid_t callid,
+    ipc_call_t *call)
+{
+	int rc;
+	iplink_sdu_t sdu;
+
+	sdu.lsrc.ipv4 = IPC_GET_ARG1(*call);
+	sdu.ldest.ipv4 = IPC_GET_ARG2(*call);
+
+	rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		return;
+	}
+
+	rc = iplink->ev_ops->recv(iplink, &sdu);
+	free(sdu.data);
+	async_answer_0(callid, rc);
+}
+
+static void iplink_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
+{
+	iplink_t *iplink = (iplink_t *)arg;
+
+	while (true) {
+		ipc_call_t call;
+		ipc_callid_t callid = async_get_call(&call);
+
+		if (!IPC_GET_IMETHOD(call)) {
+			/* TODO: Handle hangup */
+			return;
+		}
+
+		switch (IPC_GET_IMETHOD(call)) {
+		case IPLINK_EV_RECV:
+			iplink_ev_recv(iplink, callid, &call);
+			break;
+		default:
+			async_answer_0(callid, ENOTSUP);
+		}
+	}
+}
+
+/** @}
+ */
Index: uspace/lib/c/generic/iplink_srv.c
===================================================================
--- uspace/lib/c/generic/iplink_srv.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
+++ uspace/lib/c/generic/iplink_srv.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2012 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/**
+ * @file
+ * @brief IP link server stub
+ */
+#include <errno.h>
+#include <ipc/iplink.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+#include <inet/iplink_srv.h>
+
+static void iplink_get_mtu_srv(iplink_srv_t *srv, ipc_callid_t callid,
+    ipc_call_t *call)
+{
+	int rc;
+	size_t mtu;
+
+	rc = srv->ops->get_mtu(srv, &mtu);
+	async_answer_1(callid, rc, mtu);
+}
+
+static void iplink_addr_add_srv(iplink_srv_t *srv, ipc_callid_t callid,
+    ipc_call_t *call)
+{
+	int rc;
+	iplink_srv_addr_t addr;
+
+	addr.ipv4 = IPC_GET_ARG1(*call);
+
+	rc = srv->ops->addr_add(srv, &addr);
+	async_answer_0(callid, rc);
+}
+
+static void iplink_addr_remove_srv(iplink_srv_t *srv, ipc_callid_t callid,
+    ipc_call_t *call)
+{
+	int rc;
+	iplink_srv_addr_t addr;
+
+	addr.ipv4 = IPC_GET_ARG1(*call);
+
+	rc = srv->ops->addr_remove(srv, &addr);
+	async_answer_0(callid, rc);
+}
+
+static void iplink_send_srv(iplink_srv_t *srv, ipc_callid_t callid,
+    ipc_call_t *call)
+{
+	iplink_srv_sdu_t sdu;
+	int rc;
+
+	sdu.lsrc.ipv4 = IPC_GET_ARG1(*call);
+	sdu.ldest.ipv4 = IPC_GET_ARG2(*call);
+
+	rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		return;
+	}
+
+	rc = srv->ops->send(srv, &sdu);
+	free(sdu.data);
+	async_answer_0(callid, rc);
+}
+
+void iplink_srv_init(iplink_srv_t *srv)
+{
+	fibril_mutex_initialize(&srv->lock);
+	srv->connected = false;
+	srv->ops = NULL;
+	srv->arg = NULL;
+	srv->client_sess = NULL;
+}
+
+int iplink_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
+{
+	iplink_srv_t *srv = (iplink_srv_t *)arg;
+	int rc;
+
+	fibril_mutex_lock(&srv->lock);
+	if (srv->connected) {
+		fibril_mutex_unlock(&srv->lock);
+		async_answer_0(iid, EBUSY);
+		return EBUSY;
+	}
+
+	srv->connected = true;
+	fibril_mutex_unlock(&srv->lock);
+
+	/* Accept the connection */
+	async_answer_0(iid, EOK);
+
+	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
+	if (sess == NULL)
+		return ENOMEM;
+
+	srv->client_sess = sess;
+
+	rc = srv->ops->open(srv);
+	if (rc != EOK)
+		return rc;
+
+	while (true) {
+		ipc_call_t call;
+		ipc_callid_t callid = async_get_call(&call);
+		sysarg_t method = IPC_GET_IMETHOD(call);
+
+		if (!method) {
+			/* The other side has hung up */
+			async_answer_0(callid, EOK);
+			break;
+		}
+
+		switch (method) {
+		case IPLINK_GET_MTU:
+			iplink_get_mtu_srv(srv, callid, &call);
+			break;
+		case IPLINK_SEND:
+			iplink_send_srv(srv, callid, &call);
+			break;
+		case IPLINK_ADDR_ADD:
+			iplink_addr_add_srv(srv, callid, &call);
+			break;
+		case IPLINK_ADDR_REMOVE:
+			iplink_addr_remove_srv(srv, callid, &call);
+			break;
+		default:
+			async_answer_0(callid, EINVAL);
+		}
+	}
+
+	return srv->ops->close(srv);
+}
+
+int iplink_ev_recv(iplink_srv_t *srv, iplink_srv_sdu_t *sdu)
+{
+	if (srv->client_sess == NULL)
+		return EIO;
+
+	async_exch_t *exch = async_exchange_begin(srv->client_sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_2(exch, IPLINK_EV_RECV, sdu->lsrc.ipv4,
+	    sdu->ldest.ipv4, &answer);
+	int rc = async_data_write_start(exch, sdu->data, sdu->size);
+	async_exchange_end(exch);
+
+	if (rc != EOK) {
+		async_forget(req);
+		return rc;
+	}
+
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	if (retval != EOK)
+		return retval;
+
+	return EOK;
+}
+
+/** @}
+ */
Index: uspace/lib/c/generic/loader.c
===================================================================
--- uspace/lib/c/generic/loader.c	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/generic/loader.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -101,5 +101,5 @@
 	
 	if (rc != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return (int) rc;
 	}
@@ -139,5 +139,5 @@
 	
 	if (rc != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return (int) rc;
 	}
@@ -177,5 +177,5 @@
 	
 	if (rc != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return (int) rc;
 	}
@@ -236,5 +236,5 @@
 	
 	if (rc != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return (int) rc;
 	}
@@ -281,5 +281,5 @@
 
 	if (rc != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return (int) rc;
 	}
Index: uspace/lib/c/generic/loc.c
===================================================================
--- uspace/lib/c/generic/loc.c	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/generic/loc.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -246,5 +246,5 @@
 	
 	if (retval != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return retval;
 	}
@@ -285,5 +285,5 @@
 	
 	if (retval != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return retval;
 	}
@@ -352,5 +352,5 @@
 	
 	if (retval != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return retval;
 	}
@@ -401,5 +401,5 @@
 	
 	if (dretval != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return dretval;
 	}
@@ -471,5 +471,5 @@
 	
 	if (retval != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return retval;
 	}
@@ -520,5 +520,5 @@
 	
 	if (retval != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return retval;
 	}
@@ -683,5 +683,5 @@
 		
 		if (rc != EOK) {
-			async_wait_for(req, NULL);
+			async_forget(req);
 			free(devs);
 			return 0;
@@ -732,5 +732,5 @@
 		
 		if (rc != EOK) {
-			async_wait_for(req, NULL);
+			async_forget(req);
 			free(devs);
 			return 0;
@@ -760,5 +760,5 @@
 	
 	if (rc != EOK) {
-		async_wait_for(req, NULL);
+		async_forget(req);
 		return rc;
 	}
Index: uspace/lib/c/generic/net/icmp_api.c
===================================================================
--- uspace/lib/c/generic/net/icmp_api.c	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,100 +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 libc
- *  @{
- */
-
-/** @file
- * ICMP application interface implementation.
- * @see icmp_api.h
- */
-
-#include <net/icmp_api.h>
-#include <net/socket_codes.h>
-#include <net/inet.h>
-#include <net/modules.h>
-#include <net/ip_codes.h>
-#include <async.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <errno.h>
-#include <ipc/services.h>
-#include <ipc/icmp.h>
-
-/** Requests an echo message.
- *
- * Sends a packet with specified parameters to the target host and waits for the
- * reply upto the given timeout. Blocks the caller until the reply or the
- * timeout occurs.
- *
- * @param[in] sess The ICMP session.
- * @param[in] size	The message data length in bytes.
- * @param[in] timeout	The timeout in milliseconds.
- * @param[in] ttl	The time to live.
- * @param[in] tos	The type of service.
- * @param[in] dont_fragment The value indicating whether the datagram must not
- *			be fragmented. Is used as a MTU discovery.
- * @param[in] addr	The target host address.
- * @param[in] addrlen	The torget host address length.
- * @return		ICMP_ECHO on success.
- * @return		ETIMEOUT if the reply has not arrived before the
- *			timeout.
- * @return		ICMP type of the received error notification.
- * @return		EINVAL if the addrlen parameter is less or equal to
- *			zero.
- * @return		ENOMEM if there is not enough memory left.
- * @return		EPARTY if there was an internal error.
- */
-int
-icmp_echo_msg(async_sess_t *sess, size_t size, mseconds_t timeout, ip_ttl_t ttl,
-    ip_tos_t tos, int dont_fragment, const struct sockaddr *addr,
-    socklen_t addrlen)
-{
-	aid_t message_id;
-	sysarg_t result;
-
-	if (addrlen <= 0)
-		return EINVAL;
-	
-	async_exch_t *exch = async_exchange_begin(sess);
-	
-	message_id = async_send_5(exch, NET_ICMP_ECHO, size, timeout, ttl,
-	    tos, (sysarg_t) dont_fragment, NULL);
-	
-	/* Send the address */
-	async_data_write_start(exch, addr, (size_t) addrlen);
-	
-	async_exchange_end(exch);
-
-	async_wait_for(message_id, &result);
-	return (int) result;
-}
-
-/** @}
- */
Index: uspace/lib/c/generic/net/icmp_common.c
===================================================================
--- uspace/lib/c/generic/net/icmp_common.c	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,56 +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 libc
- *  @{
- */
-
-/** @file
- * ICMP common interface implementation.
- * @see icmp_common.h
- */
-
-#include <net/modules.h>
-#include <net/icmp_common.h>
-#include <ipc/services.h>
-#include <ipc/icmp.h>
-#include <sys/time.h>
-#include <async.h>
-
-/** Connect to the ICMP module.
- *
- * @return ICMP module session.
- *
- */
-async_sess_t *icmp_connect_module(void)
-{
-	return connect_to_service(SERVICE_ICMP);
-}
-
-/** @}
- */
Index: uspace/lib/c/generic/net/modules.c
===================================================================
--- uspace/lib/c/generic/net/modules.c	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/generic/net/modules.c	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -93,4 +93,17 @@
 }
 
+/** Connect to the needed module.
+ *
+ * @param[in] need Needed module service.
+ *
+ * @return Session to the needed service.
+ * @return NULL if the connection timeouted.
+ *
+ */
+static async_sess_t *connect_to_service(services_t need)
+{
+	return service_connect_blocking(EXCHANGE_SERIALIZE, need, 0, 0);
+}
+
 /** Create bidirectional connection with the needed module service and register
  * the message receiver.
@@ -129,49 +142,4 @@
 }
 
-/** Connect to the needed module.
- *
- * @param[in] need Needed module service.
- *
- * @return Session to the needed service.
- * @return NULL if the connection timeouted.
- *
- */
-async_sess_t *connect_to_service(services_t need)
-{
-	return service_connect_blocking(EXCHANGE_SERIALIZE, need, 0, 0);
-}
-
-/** Reply the data to the other party.
- *
- * @param[in] data        The data buffer to be sent.
- * @param[in] data_length The buffer length.
- *
- * @return EOK on success.
- * @return EINVAL if the client does not expect the data.
- * @return EOVERFLOW if the client does not expect all the data.
- *         Only partial data are transfered.
- * @return Other error codes as defined for the
- *         async_data_read_finalize() function.
- *
- */
-int data_reply(void *data, size_t data_length)
-{
-	size_t length;
-	ipc_callid_t callid;
-	
-	/* Fetch the request */
-	if (!async_data_read_receive(&callid, &length))
-		return EINVAL;
-	
-	/* Check the requested data size */
-	if (length < data_length) {
-		async_data_read_finalize(callid, data, length);
-		return EOVERFLOW;
-	}
-	
-	/* Send the data */
-	return async_data_read_finalize(callid, data, data_length);
-}
-
 /** Refresh answer structure and argument count.
  *
Index: uspace/lib/c/generic/net/packet.c
===================================================================
--- uspace/lib/c/generic/net/packet.c	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,451 +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 libc
- *  @{
- */
-
-/** @file
- *  Packet map and queue implementation.
- *  This file has to be compiled with both the packet server and the client.
- */
-
-#include <assert.h>
-#include <malloc.h>
-#include <mem.h>
-#include <fibril_synch.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <sys/mman.h>
-
-#include <adt/hash_table.h>
-#include <net/packet.h>
-#include <net/packet_header.h>
-
-/** Packet hash table size. */
-#define PACKET_HASH_TABLE_SIZE  128
-
-/** Packet map global data. */
-static struct {
-	/** Safety lock. */
-	fibril_rwlock_t lock;
-	/** Packet map. */
-	hash_table_t packet_map;
-	/** Packet map operations */
-	hash_table_operations_t operations;
-} pm_globals;
-
-typedef struct {
-	link_t link;
-	packet_t *packet;
-} pm_entry_t;
-
-/**
- * Hash function for the packet mapping hash table
- */
-static hash_index_t pm_hash(unsigned long key[])
-{
-	return (hash_index_t) key[0] % PACKET_HASH_TABLE_SIZE;
-}
-
-/**
- * Key compare function for the packet mapping hash table
- */
-static int pm_compare(unsigned long key[], hash_count_t keys, link_t *link)
-{
-	pm_entry_t *entry = list_get_instance(link, pm_entry_t, link);
-	return entry->packet->packet_id == key[0];
-}
-
-/**
- * Remove callback for the packet mapping hash table
- */
-static void pm_remove_callback(link_t *link)
-{
-	pm_entry_t *entry = list_get_instance(link, pm_entry_t, link);
-	free(entry);
-}
-
-/**
- * Wrapper used when destroying the whole table
- */
-static void pm_free_wrapper(link_t *link, void *ignored)
-{
-	pm_entry_t *entry = list_get_instance(link, pm_entry_t, link);
-	free(entry);
-}
-
-
-/** Initializes the packet map.
- *
- * @return		EOK on success.
- * @return		ENOMEM if there is not enough memory left.
- */
-int pm_init(void)
-{
-	int rc = EOK;
-
-	fibril_rwlock_initialize(&pm_globals.lock);
-	
-	fibril_rwlock_write_lock(&pm_globals.lock);
-	
-	pm_globals.operations.hash = pm_hash;
-	pm_globals.operations.compare = pm_compare;
-	pm_globals.operations.remove_callback = pm_remove_callback;
-
-	if (!hash_table_create(&pm_globals.packet_map, PACKET_HASH_TABLE_SIZE, 1,
-	    &pm_globals.operations))
-		rc = ENOMEM;
-	
-	fibril_rwlock_write_unlock(&pm_globals.lock);
-	
-	return rc;
-}
-
-/** Finds the packet mapping.
- *
- * @param[in] packet_id Packet identifier to be found.
- *
- * @return The found packet reference.
- * @return NULL if the mapping does not exist.
- *
- */
-packet_t *pm_find(packet_id_t packet_id)
-{
-	if (!packet_id)
-		return NULL;
-	
-	fibril_rwlock_read_lock(&pm_globals.lock);
-	
-	unsigned long key = packet_id;
-	link_t *link = hash_table_find(&pm_globals.packet_map, &key);
-	
-	packet_t *packet;
-	if (link != NULL) {
-		pm_entry_t *entry =
-		    hash_table_get_instance(link, pm_entry_t, link);
-		packet = entry->packet;
-	} else
-		packet = NULL;
-	
-	fibril_rwlock_read_unlock(&pm_globals.lock);
-	return packet;
-}
-
-/** Adds the packet mapping.
- *
- * @param[in] packet Packet to be remembered.
- *
- * @return EOK on success.
- * @return EINVAL if the packet is not valid.
- * @return ENOMEM if there is not enough memory left.
- *
- */
-int pm_add(packet_t *packet)
-{
-	if (!packet_is_valid(packet))
-		return EINVAL;
-	
-	fibril_rwlock_write_lock(&pm_globals.lock);
-	
-	pm_entry_t *entry = malloc(sizeof(pm_entry_t));
-	if (entry == NULL) {
-		fibril_rwlock_write_unlock(&pm_globals.lock);
-		return ENOMEM;
-	}
-	
-	entry->packet = packet;
-	
-	unsigned long key = packet->packet_id;
-	hash_table_insert(&pm_globals.packet_map, &key, &entry->link);
-	
-	fibril_rwlock_write_unlock(&pm_globals.lock);
-	
-	return EOK;
-}
-
-/** Remove the packet mapping
- *
- * @param[in] packet The packet to be removed
- *
- */
-void pm_remove(packet_t *packet)
-{
-	assert(packet_is_valid(packet));
-	
-	fibril_rwlock_write_lock(&pm_globals.lock);
-	
-	unsigned long key = packet->packet_id;
-	hash_table_remove(&pm_globals.packet_map, &key, 1);
-	
-	fibril_rwlock_write_unlock(&pm_globals.lock);
-}
-
-/** Release the packet map. */
-void pm_destroy(void)
-{
-	fibril_rwlock_write_lock(&pm_globals.lock);
-	hash_table_apply(&pm_globals.packet_map, pm_free_wrapper, NULL);
-	hash_table_destroy(&pm_globals.packet_map);
-	/* Leave locked */
-}
-
-/** Add packet to the sorted queue.
- *
- * The queue is sorted in the ascending order.
- * The packet is inserted right before the packets of the same order value.
- *
- * @param[in,out] first First packet of the queue. Sets the first
- *                      packet of the queue. The original first packet
- *                      may be shifted by the new packet.
- * @param[in] packet    Packet to be added.
- * @param[in] order     Packet order value.
- * @param[in] metric    Metric value of the packet.
- *
- * @return EOK on success.
- * @return EINVAL if the first parameter is NULL.
- * @return EINVAL if the packet is not valid.
- *
- */
-int pq_add(packet_t **first, packet_t *packet, size_t order, size_t metric)
-{
-	if ((!first) || (!packet_is_valid(packet)))
-		return EINVAL;
-	
-	pq_set_order(packet, order, metric);
-	if (packet_is_valid(*first)) {
-		packet_t *cur = *first;
-		
-		do {
-			if (cur->order < order) {
-				if (cur->next)
-					cur = pm_find(cur->next);
-				else {
-					cur->next = packet->packet_id;
-					packet->previous = cur->packet_id;
-					
-					return EOK;
-				}
-			} else {
-				packet->previous = cur->previous;
-				packet->next = cur->packet_id;
-				
-				cur->previous = packet->packet_id;
-				cur = pm_find(packet->previous);
-				
-				if (cur)
-					cur->next = packet->packet_id;
-				else
-					*first = packet;
-				
-				return EOK;
-			}
-		} while (packet_is_valid(cur));
-	}
-	
-	*first = packet;
-	return EOK;
-}
-
-/** Finds the packet with the given order.
- *
- * @param[in] first	The first packet of the queue.
- * @param[in] order	The packet order value.
- * @return		The packet with the given order.
- * @return		NULL if the first packet is not valid.
- * @return		NULL if the packet is not found.
- */
-packet_t *pq_find(packet_t *packet, size_t order)
-{
-	packet_t *item;
-
-	if (!packet_is_valid(packet))
-		return NULL;
-
-	item = packet;
-	do {
-		if (item->order == order)
-			return item;
-
-		item = pm_find(item->next);
-	} while (item && (item != packet) && packet_is_valid(item));
-
-	return NULL;
-}
-
-/** Inserts packet after the given one.
- *
- * @param[in] packet	The packet in the queue.
- * @param[in] new_packet The new packet to be inserted.
- * @return		EOK on success.
- * @return		EINVAL if etiher of the packets is invalid.
- */
-int pq_insert_after(packet_t *packet, packet_t *new_packet)
-{
-	packet_t *item;
-
-	if (!packet_is_valid(packet) || !packet_is_valid(new_packet))
-		return EINVAL;
-
-	new_packet->previous = packet->packet_id;
-	new_packet->next = packet->next;
-	item = pm_find(packet->next);
-	if (item)
-		item->previous = new_packet->packet_id;
-	packet->next = new_packet->packet_id;
-
-	return EOK;
-}
-
-/** Detach the packet from the queue.
- *
- * @param[in] packet	The packet to be detached.
- * @return		The next packet in the queue. If the packet is the first
- *			one of the queue, this becomes the new first one.
- * @return		NULL if there is no packet left.
- * @return		NULL if the packet is not valid.
- */
-packet_t *pq_detach(packet_t *packet)
-{
-	packet_t *next;
-	packet_t *previous;
-
-	if (!packet_is_valid(packet))
-		return NULL;
-
-	next = pm_find(packet->next);
-	if (next)
-		next->previous = packet->previous;
-	
-	previous = pm_find(packet->previous);
-	if (previous)
-		previous->next = packet->next ;
-	
-	packet->previous = 0;
-	packet->next = 0;
-	return next;
-}
-
-/** Sets the packet order and metric attributes.
- *
- * @param[in] packeti	The packet to be set.
- * @param[in] order	The packet order value.
- * @param[in] metric	The metric value of the packet.
- * @return		EOK on success.
- * @return		EINVAL if the packet is invalid.
- */
-int pq_set_order(packet_t *packet, size_t order, size_t metric)
-{
-	if (!packet_is_valid(packet))
-		return EINVAL;
-
-	packet->order = order;
-	packet->metric = metric;
-	return EOK;
-}
-
-/** Sets the packet order and metric attributes.
- *
- * @param[in] packet	The packet to be set.
- * @param[out] order	The packet order value.
- * @param[out] metric	The metric value of the packet.
- * @return		EOK on success.
- * @return		EINVAL if the packet is invalid.
- */
-int pq_get_order(packet_t *packet, size_t *order, size_t *metric)
-{
-	if (!packet_is_valid(packet))
-		return EINVAL;
-
-	if (order)
-		*order = packet->order;
-
-	if (metric)
-		*metric = packet->metric;
-
-	return EOK;
-}
-
-/** Releases the whole queue.
- *
- * Detaches all packets of the queue and calls the packet_release() for each of
- * them.
- *
- * @param[in] first	The first packet of the queue.
- * @param[in] packet_release The releasing function called for each of the
- *			packets after its detachment.
- */
-void pq_destroy(packet_t *first, void (*packet_release)(packet_t *packet))
-{
-	packet_t *actual;
-	packet_t *next;
-
-	actual = first;
-	while (packet_is_valid(actual)) {
-		next = pm_find(actual->next);
-		actual->next = 0;
-		actual->previous = 0;
-		if(packet_release)
-			packet_release(actual);
-		actual = next;
-	}
-}
-
-/** Returns the next packet in the queue.
- *
- * @param[in] packet	The packet queue member.
- * @return		The next packet in the queue.
- * @return		NULL if there is no next packet.
- * @return		NULL if the packet is not valid.
- */
-packet_t *pq_next(packet_t *packet)
-{
-	if (!packet_is_valid(packet))
-		return NULL;
-
-	return pm_find(packet->next);
-}
-
-/** Returns the previous packet in the queue.
- *
- * @param[in] packet	The packet queue member.
- * @return		The previous packet in the queue.
- * @return		NULL if there is no previous packet.
- * @return		NULL if the packet is not valid.
- */
-packet_t *pq_previous(packet_t *packet)
-{
-	if (!packet_is_valid(packet))
-		return NULL;
-
-	return pm_find(packet->previous);
-}
-
-/** @}
- */
Index: uspace/lib/c/generic/private/async.h
===================================================================
--- uspace/lib/c/generic/private/async.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/generic/private/async.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -81,4 +81,6 @@
 } awaiter_t;
 
+extern void awaiter_initialize(awaiter_t *);
+
 extern void __async_init(void);
 extern void async_insert_timeout(awaiter_t *);
Index: uspace/lib/c/include/adt/measured_strings.h
===================================================================
--- uspace/lib/c/include/adt/measured_strings.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,76 +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 libc
- *  @{
- */
-
-/** @file
- * Character string with measured length.
- * The structure has been designed for serialization of character strings
- * between modules.
- */
-
-#ifndef LIBC_MEASURED_STRINGS_H_
-#define LIBC_MEASURED_STRINGS_H_
-
-#include <sys/types.h>
-#include <async.h>
-
-/** Type definition of the character string with measured length.
- * @see measured_string
- */
-typedef struct measured_string measured_string_t;
-
-/** Character string with measured length.
- *
- * This structure has been designed for serialization of character strings
- * between modules.
- */
-struct measured_string {
-	/** Character string data. */
-	uint8_t *value;
-	/** Character string length. */
-	size_t length;
-};
-
-extern measured_string_t *measured_string_create_bulk(const uint8_t *, size_t);
-extern measured_string_t *measured_string_copy(measured_string_t *);
-
-extern int measured_strings_receive(measured_string_t **, uint8_t **, size_t);
-extern int measured_strings_reply(const measured_string_t *, size_t);
-
-extern int measured_strings_return(async_exch_t *, measured_string_t **,
-    uint8_t **, size_t);
-extern int measured_strings_send(async_exch_t *, const measured_string_t *,
-    size_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/async.h
===================================================================
--- uspace/lib/c/include/async.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/include/async.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -139,4 +139,5 @@
 extern void async_wait_for(aid_t, sysarg_t *);
 extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
+extern void async_forget(aid_t);
 
 extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t,
@@ -320,5 +321,5 @@
     sysarg_t *, sysarg_t *);
 
-extern async_sess_t *async_connect_me(exch_mgmt_t, async_exch_t *);
+extern async_sess_t *async_clone_establish(exch_mgmt_t, async_exch_t *);
 extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t,
     sysarg_t, sysarg_t);
Index: uspace/lib/c/include/inet/inet.h
===================================================================
--- uspace/lib/c/include/inet/inet.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
+++ uspace/lib/c/include/inet/inet.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2012 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_INET_INET_H_
+#define LIBC_INET_INET_H_
+
+#include <sys/types.h>
+
+#define INET_TTL_MAX 255
+
+typedef struct {
+	uint32_t ipv4;
+} inet_addr_t;
+
+typedef struct {
+	inet_addr_t src;
+	inet_addr_t dest;
+	uint8_t tos;
+	void *data;
+	size_t size;
+} inet_dgram_t;
+
+typedef struct {
+	int (*recv)(inet_dgram_t *);
+} inet_ev_ops_t;
+
+typedef enum {
+	INET_DF = 1
+} inet_df_t;
+
+extern int inet_init(uint8_t, inet_ev_ops_t *);
+extern int inet_send(inet_dgram_t *, uint8_t, inet_df_t);
+extern int inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/inet/inetcfg.h
===================================================================
--- uspace/lib/c/include/inet/inetcfg.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
+++ uspace/lib/c/include/inet/inetcfg.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_INET_INETCFG_H_
+#define LIBC_INET_INETCFG_H_
+
+#include <inet/inet.h>
+#include <sys/types.h>
+
+/** Network address */
+typedef struct {
+	/** Address */
+	uint32_t ipv4;
+	/** Number of valid bits in @c ipv4 */
+	int bits;
+} inet_naddr_t;
+
+/** Address object info */
+typedef struct {
+	/** Network address */
+	inet_naddr_t naddr;
+	/** Link service ID */
+	sysarg_t ilink;
+	/** Address object name */
+	char *name;
+} inet_addr_info_t;
+
+/** IP link info */
+typedef struct {
+	/** Link service name */
+	char *name;
+	/** Default MTU */
+	size_t def_mtu;
+} inet_link_info_t;
+
+/** Static route info */
+typedef struct {
+	/** Destination network address */
+	inet_naddr_t dest;
+	/** Router address */
+	inet_addr_t router;
+	/** Static route name */
+	char *name;
+} inet_sroute_info_t;
+
+extern int inetcfg_init(void);
+extern int inetcfg_addr_create_static(const char *, inet_naddr_t *, sysarg_t, sysarg_t *);
+extern int inetcfg_addr_delete(sysarg_t);
+extern int inetcfg_addr_get(sysarg_t, inet_addr_info_t *);
+extern int inetcfg_addr_get_id(const char *, sysarg_t, sysarg_t *);
+extern int inetcfg_get_addr_list(sysarg_t **, size_t *);
+extern int inetcfg_get_link_list(sysarg_t **, size_t *);
+extern int inetcfg_get_sroute_list(sysarg_t **, size_t *);
+extern int inetcfg_link_get(sysarg_t, inet_link_info_t *);
+extern int inetcfg_sroute_get(sysarg_t, inet_sroute_info_t *);
+extern int inetcfg_sroute_get_id(const char *, sysarg_t *);
+extern int inetcfg_sroute_create(const char *, inet_naddr_t *, inet_addr_t *,
+    sysarg_t *);
+extern int inetcfg_sroute_delete(sysarg_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/inet/inetping.h
===================================================================
--- uspace/lib/c/include/inet/inetping.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
+++ uspace/lib/c/include/inet/inetping.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_INET_INETPING_H_
+#define LIBC_INET_INETPING_H_
+
+#include <inet/inet.h>
+#include <sys/types.h>
+
+typedef struct {
+	inet_addr_t src;
+	inet_addr_t dest;
+	uint16_t seq_no;
+	void *data;
+	size_t size;
+} inetping_sdu_t;
+
+typedef struct inetping_ev_ops {
+	int (*recv)(inetping_sdu_t *);
+} inetping_ev_ops_t;
+
+extern int inetping_init(inetping_ev_ops_t *);
+extern int inetping_send(inetping_sdu_t *);
+extern int inetping_get_srcaddr(inet_addr_t *, inet_addr_t *);
+
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/inet/iplink.h
===================================================================
--- uspace/lib/c/include/inet/iplink.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
+++ uspace/lib/c/include/inet/iplink.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2012 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_INET_IPLINK_H_
+#define LIBC_INET_IPLINK_H_
+
+#include <async.h>
+#include <sys/types.h>
+
+struct iplink_ev_ops;
+
+typedef struct {
+	async_sess_t *sess;
+	struct iplink_ev_ops *ev_ops;
+} iplink_t;
+
+typedef struct {
+	uint32_t ipv4;
+} iplink_addr_t;
+
+/** IP link Service Data Unit */
+typedef struct {
+	/** Local source address */
+	iplink_addr_t lsrc;
+	/** Local destination address */
+	iplink_addr_t ldest;
+	/** Serialized IP packet */
+	void *data;
+	/** Size of @c data in bytes */
+	size_t size;
+} iplink_sdu_t;
+
+typedef struct iplink_ev_ops {
+	int (*recv)(iplink_t *, iplink_sdu_t *);
+} iplink_ev_ops_t;
+
+extern int iplink_open(async_sess_t *, iplink_ev_ops_t *, iplink_t **);
+extern void iplink_close(iplink_t *);
+extern int iplink_send(iplink_t *, iplink_sdu_t *);
+extern int iplink_addr_add(iplink_t *, iplink_addr_t *);
+extern int iplink_addr_remove(iplink_t *, iplink_addr_t *);
+extern int iplink_get_mtu(iplink_t *, size_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/inet/iplink_srv.h
===================================================================
--- uspace/lib/c/include/inet/iplink_srv.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
+++ uspace/lib/c/include/inet/iplink_srv.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2012 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_INET_IPLINK_SRV_H_
+#define LIBC_INET_IPLINK_SRV_H_
+
+#include <async.h>
+#include <fibril_synch.h>
+#include <bool.h>
+#include <sys/types.h>
+
+struct iplink_ops;
+
+typedef struct {
+	fibril_mutex_t lock;
+	bool connected;
+	struct iplink_ops *ops;
+	void *arg;
+	async_sess_t *client_sess;
+} iplink_srv_t;
+
+typedef struct {
+	uint32_t ipv4;
+} iplink_srv_addr_t;
+
+/** IP link Service Data Unit */
+typedef struct {
+	/** Local source address */
+	iplink_srv_addr_t lsrc;
+	/** Local destination address */
+	iplink_srv_addr_t ldest;
+	/** Serialized IP packet */
+	void *data;
+	/** Size of @c data in bytes */
+	size_t size;
+} iplink_srv_sdu_t;
+
+typedef struct iplink_ops {
+	int (*open)(iplink_srv_t *);
+	int (*close)(iplink_srv_t *);
+	int (*send)(iplink_srv_t *, iplink_srv_sdu_t *);
+	int (*get_mtu)(iplink_srv_t *, size_t *);
+	int (*addr_add)(iplink_srv_t *, iplink_srv_addr_t *);
+	int (*addr_remove)(iplink_srv_t *, iplink_srv_addr_t *);
+} iplink_ops_t;
+
+extern void iplink_srv_init(iplink_srv_t *);
+
+extern int iplink_conn(ipc_callid_t, ipc_call_t *, void *);
+extern int iplink_ev_recv(iplink_srv_t *, iplink_srv_sdu_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/ipc/arp.h
===================================================================
--- uspace/lib/c/include/ipc/arp.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,82 +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 libc
- * @{
- */
-
-/** @file
- * ARP module messages.
- * @see arp_interface.h
- */
-
-#ifndef LIBC_ARP_MESSAGES_
-#define LIBC_ARP_MESSAGES_
-
-#include <ipc/net.h>
-
-/** ARP module messages. */
-typedef enum {
-	/** Clean cache message.
-	 * @see arp_clean_cache()
-	 */
-	NET_ARP_CLEAN_CACHE = NET_ARP_FIRST,
-	/** Clear address cache message.
-	 * @see arp_clear_address_msg()
-	 */
-	NET_ARP_CLEAR_ADDRESS,
-	/** Clear device cache message.
-	 * @see arp_clear_device_req()
-	 */
-	NET_ARP_CLEAR_DEVICE,
-	/** New device message.
-	 * @see arp_device_req()
-	 */
-	NET_ARP_DEVICE,
-	/** Address translation message.
-	 * @see arp_translate_req()
-	 */
-	NET_ARP_TRANSLATE
-} arp_messages;
-
-/** @name ARP specific message parameters definitions */
-/*@{*/
-
-/** Return the protocol service message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define ARP_GET_NETIF(call) ((services_t) IPC_GET_ARG2(call))
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/ipc/icmp.h
===================================================================
--- uspace/lib/c/include/ipc/icmp.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,139 +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 libc
- * @{
- */
-
-/** @file
- * ICMP module messages.
- * @see icmp_remote.h
- */
-
-#ifndef LIBC_ICMP_MESSAGES_
-#define LIBC_ICMP_MESSAGES_
-
-#include <ipc/net.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <net/icmp_codes.h>
-
-/** ICMP module messages. */
-typedef enum {
-	/** Send echo request. @see icmp_echo() */
-	NET_ICMP_ECHO = NET_ICMP_FIRST,
-	
-	/**
-	 * Send destination unreachable error message.
-	 * @see icmp_destination_unreachable_msg()
-	 */
-	NET_ICMP_DEST_UNREACH,
-	
-	/**
-	 * Send source quench error message.
-	 * @see icmp_source_quench_msg()
-	 */
-	NET_ICMP_SOURCE_QUENCH,
-	
-	/**
-	 * Send time exceeded error message.
-	 * @see icmp_time_exceeded_msg()
-	 */
-	NET_ICMP_TIME_EXCEEDED,
-	
-	/**
-	 * Send parameter problem error message.
-	 * @see icmp_parameter_problem_msg()
-	 */
-	NET_ICMP_PARAMETERPROB
-} icmp_messages_t;
-
-/** @name ICMP specific message parameters definitions */
-/*@{*/
-
-/** Return the ICMP code message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define ICMP_GET_CODE(call)  ((icmp_code_t) IPC_GET_ARG1(call))
-
-/** Return the ICMP link MTU message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define ICMP_GET_MTU(call)  ((icmp_param_t) IPC_GET_ARG3(call))
-
-/** Return the pointer message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define ICMP_GET_POINTER(call)  ((icmp_param_t) IPC_GET_ARG3(call))
-
-/** Return the size message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define ICMP_GET_SIZE(call)  ((size_t) IPC_GET_ARG1(call))
-
-/** Return the timeout message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define ICMP_GET_TIMEOUT(call)  ((suseconds_t) IPC_GET_ARG2(call))
-
-/** Return the time to live message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define ICMP_GET_TTL(call)  ((ip_ttl_t) IPC_GET_ARG3(call))
-
-/** Return the type of service message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define ICMP_GET_TOS(call)  ((ip_tos_t) IPC_GET_ARG4(call))
-
-/** Return the dont fragment message parameter.
- *
- * @param[in] call Message call structure.
- */
-#define ICMP_GET_DONT_FRAGMENT(call)  ((int) IPC_GET_ARG5(call))
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/ipc/il.h
===================================================================
--- uspace/lib/c/include/ipc/il.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,90 +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 libc
- * @{
- */
-
-/** @file
- * Internetwork layer modules messages.
- * @see il_remote.h
- * @see ip_interface.h
- */
-
-#ifndef LIBC_IL_MESSAGES_H_
-#define LIBC_IL_MESSAGES_H_
-
-#include <ipc/net.h>
-
-/** Internet layer modules messages. */
-typedef enum {
-	/** Device state changed message.
-	 * @see il_device_state_msg()
-	 */
-	NET_IL_DEVICE_STATE = NET_IL_FIRST,
-	
-	/** Device MTU changed message.
-	 * @see il_mtu_changed_msg()
-	 */
-	NET_IL_MTU_CHANGED,
-	
-	/**
-	 * Device address changed message
-	 * @see il_addr_changed_msg()
-	 */
-	NET_IL_ADDR_CHANGED,
-
-	/** Packet received message.
-	 * @see il_received_msg()
-	 */
-	NET_IL_RECEIVED
-} il_messages;
-
-/** @name Internetwork layer specific message parameters definitions */
-/*@{*/
-
-/** Return the protocol number message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IL_GET_PROTO(call)  ((int) IPC_GET_ARG1(call))
-
-/** Return the registering service message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IL_GET_SERVICE(call)  ((services_t) IPC_GET_ARG2(call))
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/ipc/inet.h
===================================================================
--- uspace/lib/c/include/ipc/inet.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
+++ uspace/lib/c/include/ipc/inet.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2012 Jiri Svoboda
+ * 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 libcipc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_IPC_INET_H_
+#define LIBC_IPC_INET_H_
+
+#include <ipc/common.h>
+
+/** Inet ports */
+typedef enum {
+	/** Default port */
+	INET_PORT_DEFAULT = 1,
+	/** Configuration port */
+	INET_PORT_CFG,
+	/** Ping service port */
+	INET_PORT_PING
+} inet_port_t;
+
+/** Requests on Inet default port */
+typedef enum {
+	INET_CALLBACK_CREATE = IPC_FIRST_USER_METHOD,
+	INET_GET_SRCADDR,
+	INET_SEND,
+	INET_SET_PROTO
+} inet_request_t;
+
+/** Events on Inet default port */
+typedef enum {
+	INET_EV_RECV = IPC_FIRST_USER_METHOD
+} inet_event_t;
+
+/** Requests on Inet configuration port */
+typedef enum {
+	INETCFG_ADDR_CREATE_STATIC = IPC_FIRST_USER_METHOD,
+	INETCFG_ADDR_DELETE,
+	INETCFG_ADDR_GET,
+	INETCFG_ADDR_GET_ID,
+	INETCFG_GET_ADDR_LIST,
+	INETCFG_GET_LINK_LIST,
+	INETCFG_GET_SROUTE_LIST,
+	INETCFG_LINK_GET,
+	INETCFG_SROUTE_CREATE,
+	INETCFG_SROUTE_DELETE,
+	INETCFG_SROUTE_GET,
+	INETCFG_SROUTE_GET_ID
+} inetcfg_request_t;
+
+/** Events on Inet ping port */
+typedef enum {
+	INETPING_EV_RECV = IPC_FIRST_USER_METHOD
+} inetping_event_t;
+
+/** Requests on Inet ping port */
+typedef enum {
+	INETPING_SEND = IPC_FIRST_USER_METHOD,
+	INETPING_GET_SRCADDR
+} inetping_request_t;
+
+#endif
+
+/**
+ * @}
+ */
Index: uspace/lib/c/include/ipc/ip.h
===================================================================
--- uspace/lib/c/include/ipc/ip.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,141 +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 libc
- * @{
- */
-
-/** @file
- * IP module messages.
- * @see ip_interface.h
- */
-
-#ifndef LIBC_IP_MESSAGES_H_
-#define LIBC_IP_MESSAGES_H_
-
-#include <ipc/net.h>
-#include <net/in.h>
-#include <net/ip_codes.h>
-
-/** IP module messages. */
-typedef enum {
-	/** New device message.
-	 * @see ip_device_req()
-	 */
-	NET_IP_DEVICE = NET_IP_FIRST,
-	
-	/** Adds the routing entry.
-	 * @see ip_add_route()
-	 */
-	NET_IP_ADD_ROUTE,
-	
-	/** Gets the actual route information.
-	 * @see ip_get_route()
-	 */
-	NET_IP_GET_ROUTE,
-	
-	/** Processes the received error notification.
-	 * @see ip_received_error_msg()
-	 */
-	NET_IP_RECEIVED_ERROR,
-	
-	/** Sets the default gateway.
-	 * @see ip_set_default_gateway()
-	 */
-	NET_IP_SET_GATEWAY,
-	
-	/** Packet size message.
-	 * @see ip_packet_size_req()
-	 */
-	NET_IP_PACKET_SPACE,
-	
-	/** Packet send message.
-	 * @see ip_send_msg()
-	 */
-	NET_IP_SEND
-} ip_messages;
-
-/** @name IP specific message parameters definitions */
-/*@{*/
-
-/** Return the address message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IP_GET_ADDRESS(call) \
-	({ \
-		in_addr_t addr; \
-		addr.s_addr = IPC_GET_ARG3(call); \
-		addr; \
-	})
-
-/** Return the gateway message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IP_GET_GATEWAY(call) \
-	({ \
-		in_addr_t addr; \
-		addr.s_addr = IPC_GET_ARG2(call); \
-		addr; \
-	})
-
-/** Set the header length in the message answer.
- *
- * @param[out] answer Message answer structure.
- *
- */
-#define IP_SET_HEADERLEN(answer, value)  IPC_SET_ARG2(answer, (sysarg_t) (value))
-
-/** Return the network mask message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IP_GET_NETMASK(call) \
-	({ \
-		in_addr_t addr; \
-		addr.s_addr = IPC_GET_ARG4(call); \
-		addr; \
-	})
-
-/** Return the protocol message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IP_GET_PROTOCOL(call)  ((ip_protocol_t) IPC_GET_ARG1(call))
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/ipc/ipc.h
===================================================================
--- uspace/lib/c/include/ipc/ipc.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/include/ipc/ipc.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -254,7 +254,7 @@
     sysarg_t, sysarg_t, void *, ipc_async_callback_t, bool);
 
+extern int ipc_clone_establish(int);
 extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, task_id_t *,
     sysarg_t *);
-extern int ipc_connect_me(int);
 extern int ipc_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
 extern int ipc_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
Index: uspace/lib/c/include/ipc/iplink.h
===================================================================
--- uspace/lib/c/include/ipc/iplink.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
+++ uspace/lib/c/include/ipc/iplink.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012 Jiri Svoboda
+ * 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 libcipc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_IPC_IPLINK_H_
+#define LIBC_IPC_IPLINK_H_
+
+#include <ipc/common.h>
+
+typedef enum {
+	IPLINK_GET_MTU = IPC_FIRST_USER_METHOD,
+	IPLINK_SEND,
+	IPLINK_ADDR_ADD,
+	IPLINK_ADDR_REMOVE
+} iplink_request_t;
+
+typedef enum {
+	IPLINK_EV_RECV = IPC_FIRST_USER_METHOD
+} iplink_event_t;
+
+#endif
+
+/**
+ * @}
+ */
Index: uspace/lib/c/include/ipc/net.h
===================================================================
--- uspace/lib/c/include/ipc/net.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,389 +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 libcipc
- *  @{
- */
-
-/** @file
- *  Networking common message definitions.
- */
-
-#ifndef LIBC_NET_MESSAGES_H_
-#define LIBC_NET_MESSAGES_H_
-
-#include <ipc/services.h>
-#include <net/device.h>
-#include <net/packet.h>
-
-/** Return a value indicating whether the value is in the interval.
- *
- * @param[in] item            Value to be checked.
- * @param[in] first_inclusive First value in the interval inclusive.
- * @param[in] last_exclusive  First value after the interval.
- *
- */
-#define IS_IN_INTERVAL(item, first_inclusive, last_exclusive) \
-	(((item) >= (first_inclusive)) && ((item) < (last_exclusive)))
-
-/** @name Networking message counts */
-/*@{*/
-
-#define NET_ARP_COUNT     5   /**< Number of ARP messages. */
-#define NET_ETH_COUNT     0   /**< Number of Ethernet messages. */
-#define NET_ICMP_COUNT    6   /**< Number of ICMP messages. */
-#define NET_IL_COUNT      6   /**< Number of inter-network messages. */
-#define NET_IP_COUNT      4   /**< Number of IP messages. */
-#define NET_NET_COUNT     3   /**< Number of general networking messages. */
-#define NET_NETIF_COUNT   6   /**< Number of network interface driver messages. */
-#define NET_NIL_COUNT     7   /**< Number of network interface layer messages. */
-#define NET_PACKET_COUNT  5   /**< Number of packet management system messages. */
-#define NET_SOCKET_COUNT  14  /**< Number of socket messages. */
-#define NET_TCP_COUNT     0   /**< Number of TCP messages. */
-#define NET_TL_COUNT      1   /**< Number of transport layer messages. */
-#define NET_UDP_COUNT     0   /**< Number of UDP messages. */
-
-/*@}*/
-
-/** @name Networking message intervals
- */
-/*@{*/
-
-
-/** First networking message. */
-#define NET_FIRST  2000
-
-/** First network interface layer message. */
-#define NET_NETIF_FIRST  NET_FIRST
-
-/** Last network interface layer message. */
-#define NET_NETIF_LAST  (NET_NETIF_FIRST + NET_NETIF_COUNT)
-
-/** First general networking message. */
-#define NET_NET_FIRST  (NET_NETIF_LAST + 0)
-
-/** Last general networking message. */
-#define NET_NET_LAST  (NET_NET_FIRST + NET_NET_COUNT)
-
-/** First network interface layer message. */
-#define NET_NIL_FIRST  (NET_NET_LAST + 0)
-
-/** Last network interface layer message. */
-#define NET_NIL_LAST  (NET_NIL_FIRST + NET_NIL_COUNT)
-
-/** First Ethernet message. */
-#define NET_ETH_FIRST  (NET_NIL_LAST + 0)
-
-/** Last Ethernet message. */
-#define NET_ETH_LAST  (NET_ETH_FIRST + NET_ETH_COUNT)
-
-/** First inter-network message. */
-#define NET_IL_FIRST  (NET_ETH_LAST + 0)
-
-/** Last inter-network message. */
-#define NET_IL_LAST  (NET_IL_FIRST + NET_IL_COUNT)
-
-/** First IP message. */
-#define NET_IP_FIRST  (NET_IL_LAST + 0)
-
-/** Last IP message. */
-#define NET_IP_LAST  (NET_IP_FIRST + NET_IP_COUNT)
-
-/** First ARP message. */
-#define NET_ARP_FIRST  (NET_IP_LAST + 0)
-
-/** Last ARP message. */
-#define NET_ARP_LAST  (NET_ARP_FIRST + NET_ARP_COUNT)
-
-/** First ICMP message. */
-#define NET_ICMP_FIRST  (NET_ARP_LAST + 0)
-
-/** Last ICMP message. */
-#define NET_ICMP_LAST  (NET_ICMP_FIRST + NET_ICMP_COUNT)
-
-/** First ICMP message. */
-#define NET_TL_FIRST  (NET_ICMP_LAST + 0)
-
-/** Last ICMP message. */
-#define NET_TL_LAST  (NET_TL_FIRST + NET_TL_COUNT)
-
-/** First UDP message. */
-#define NET_UDP_FIRST  (NET_TL_LAST + 0)
-
-/** Last UDP message. */
-#define NET_UDP_LAST  (NET_UDP_FIRST + NET_UDP_COUNT)
-
-/** First TCP message. */
-#define NET_TCP_FIRST  (NET_UDP_LAST + 0)
-
-/** Last TCP message. */
-#define NET_TCP_LAST  (NET_TCP_FIRST + NET_TCP_COUNT)
-
-/** First socket message. */
-#define NET_SOCKET_FIRST  (NET_TCP_LAST + 0)
-
-/** Last socket message. */
-#define NET_SOCKET_LAST  (NET_SOCKET_FIRST + NET_SOCKET_COUNT)
-
-/** First packet management system message. */
-#define NET_PACKET_FIRST  (NET_SOCKET_LAST + 0)
-
-/** Last packet management system message. */
-#define NET_PACKET_LAST  (NET_PACKET_FIRST + NET_PACKET_COUNT)
-
-/** Last networking message. */
-#define NET_LAST  NET_PACKET_LAST
-
-/** Number of networking messages. */
-#define NET_COUNT  (NET_LAST - NET_FIRST)
-
-/** Check if the IPC call is a generic networking message.
- *
- * @param[in] call IPC call to be checked.
- *
- */
-#define IS_NET_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_FIRST, NET_LAST)
-
-/** Check if the IPC call is an ARP message.
- *
- * @param[in] call IPC call to be checked.
- *
- */
-#define IS_NET_ARP_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ARP_FIRST, NET_ARP_LAST)
-
-/** Check if the IPC call is an Ethernet message.
- *
- * @param[in] call IPC call to be checked.
- *
- */
-#define IS_NET_ETH_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ETH_FIRST, NET_ETH_LAST)
-
-/** Check if the IPC call is an ICMP message.
- *
- * @param[in] call IPC call to be checked.
- *
- */
-#define IS_NET_ICMP_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ICMP_FIRST, NET_ICMP_LAST)
-
-/** Check if the IPC call is an inter-network layer message.
- *
- * @param[in] call IPC call to be checked.
- *
- */
-#define IS_NET_IL_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_IL_FIRST, NET_IL_LAST)
-
-/** Check if the IPC call is an IP message.
- *
- * @param[in] call IPC call to be checked.
- *
- */
-#define IS_NET_IP_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_IP_FIRST, NET_IP_LAST)
-
-/** Check if the IPC call is a generic networking message.
- *
- * @param[in] call IPC call to be checked.
- *
- */
-#define IS_NET_NET_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_NET_FIRST, NET_NET_LAST)
-
-/** Check if the IPC call is a network interface layer message.
- *
- * @param[in] call IPC call to be checked.
- *
- */
-#define IS_NET_NIL_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_NIL_FIRST, NET_NIL_LAST)
-
-/** Check if the IPC call is a packet manaagement system message.
- *
- * @param[in] call IPC call to be checked.
- *
- */
-#define IS_NET_PACKET_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_PACKET_FIRST, NET_PACKET_LAST)
-
-/** Check if the IPC call is a socket message.
- *
- * @param[in] call IPC call to be checked.
- *
- */
-#define IS_NET_SOCKET_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
-
-/** Check if the IPC call is a TCP message.
- *
- * @param[in] call IPC call to be checked.
- *
- */
-#define IS_NET_TCP_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_TCP_FIRST, NET_TCP_LAST)
-
-/** Check if the IPC call is a transport layer message.
- *
- * @param[in] call IPC call to be checked.
- *
- */
-#define IS_NET_TL_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_TL_FIRST, NET_TL_LAST)
-
-/** Check if the IPC call is a UDP message.
- *
- * @param[in] call IPC call to be checked.
- *
- */
-#define IS_NET_UDP_MESSAGE(call) \
-	IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_UDP_FIRST, NET_UDP_LAST)
-
-/*@}*/
-
-/** @name Networking specific message arguments definitions */
-/*@{*/
-
-/** Return the device identifier message argument.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IPC_GET_DEVICE(call)  ((nic_device_id_t) IPC_GET_ARG1(call))
-
-/** Return the packet identifier message argument.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IPC_GET_PACKET(call)  ((packet_id_t) IPC_GET_ARG2(call))
-
-/** Return the count message argument.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IPC_GET_COUNT(call)  ((size_t) IPC_GET_ARG2(call))
-
-/** Return the device state message argument.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IPC_GET_STATE(call)  ((nic_device_state_t) IPC_GET_ARG2(call))
-
-/** Return the device handle argument
- *
- * @param[in] call Message call structure
- *
- */
-#define IPC_GET_DEVICE_HANDLE(call)  ((service_id_t) IPC_GET_ARG2(call))
-
-/** Return the device driver service message argument.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IPC_GET_SERVICE(call)  ((services_t) IPC_GET_ARG3(call))
-
-/** Return the target service message argument.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IPC_GET_TARGET(call)  ((services_t) IPC_GET_ARG3(call))
-
-/** Return the sender service message argument.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IPC_GET_SENDER(call)  ((services_t) IPC_GET_ARG3(call))
-
-/** Return the maximum transmission unit message argument.
- *
- * @param[in] call Message call structure.
- *
- */
-#define IPC_GET_MTU(call)  ((size_t) IPC_GET_ARG3(call))
-
-/** Return the error service message argument.
- &
- * @param[in] call Message call structure.
- *
- */
-#define IPC_GET_ERROR(call)  ((services_t) IPC_GET_ARG4(call))
-
-/** Set the device identifier in the message answer.
- *
- * @param[out] answer Message answer structure.
- * @param[in]  value  Value to set.
- *
- */
-#define IPC_SET_DEVICE(answer, value)  IPC_SET_ARG1(answer, (sysarg_t) (value))
-
-/** Set the minimum address length in the message answer.
- *
- * @param[out] answer Message answer structure.
- * @param[in]  value  Value to set.
- *
- */
-#define IPC_SET_ADDR(answer, value)  IPC_SET_ARG1(answer, (sysarg_t) (value))
-
-/** Set the minimum prefix size in the message answer.
- *
- * @param[out] answer Message answer structure.
- * @param[in]  value  Value to set.
- *
- */
-#define IPC_SET_PREFIX(answer, value)  IPC_SET_ARG2(answer, (sysarg_t) (value))
-
-/** Set the maximum content size in the message answer.
- *
- * @param[out] answer Message answer structure.
- * @param[in]  value  Value to set.
- *
- */
-#define IPC_SET_CONTENT(answer, value)  IPC_SET_ARG3(answer, (sysarg_t) (value))
-
-/** Set the minimum suffix size in the message answer.
- *
- * @param[out] answer Message answer structure.
- * @param[in]  value  Value to set.
- *
- */
-#define IPC_SET_SUFFIX(answer, value)  IPC_SET_ARG4(answer, (sysarg_t) (value))
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/ipc/net_net.h
===================================================================
--- uspace/lib/c/include/ipc/net_net.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,62 +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 libc
- * @{
- */
-
-/** @file
- * Networking subsystem central module messages.
- * @see net_interface.h
- */
-
-#ifndef LIBC_NET_NET_MESSAGES_H_
-#define LIBC_NET_NET_MESSAGES_H_
-
-#include <ipc/net.h>
-
-/** Networking subsystem central module messages. */
-typedef enum {
-	/** Return general configuration
-	 * @see net_get_conf_req()
-	 */
-	NET_NET_GET_CONF = NET_FIRST,
-	/** Return device specific configuration
-	 * @see net_get_device_conf_req()
-	 */
-	NET_NET_GET_DEVICE_CONF,
-	/** Return number of mastered devices */
-	NET_NET_GET_DEVICES_COUNT,
-	/** Return names and device IDs of all devices */
-	NET_NET_GET_DEVICES
-} net_messages;
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/ipc/netif.h
===================================================================
--- uspace/lib/c/include/ipc/netif.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,97 +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 libc
- * @{
- */
-
-/** @file
- * Network interface common module messages.
- */
-
-#ifndef LIBC_NETIF_MESSAGES_H_
-#define LIBC_NETIF_MESSAGES_H_
-
-#include <ipc/net.h>
-
-/** Network interface common module messages. */
-typedef enum {
-	/** Probe device message.
-	 * @see netif_probe_req()
-	 */
-	NET_NETIF_PROBE = NET_NETIF_FIRST,
-	
-	/** Send packet message.
-	 * @see netif_send_msg()
-	 */
-	NET_NETIF_SEND,
-	
-	/** Start device message.
-	 * @see netif_start_req()
-	 */
-	NET_NETIF_START,
-	
-	/** Get device usage statistics message.
-	 * @see netif_stats_req()
-	 */
-	NET_NETIF_STATS,
-	
-	/** Stop device message.
-	 * @see netif_stop_req()
-	 */
-	NET_NETIF_STOP,
-	
-	/** Get device address message.
-	 * @see netif_get_addr_req()
-	 */
-	NET_NETIF_GET_ADDR,
-} netif_messages;
-
-/** @name Network interface specific message parameters definitions */
-/*@{*/
-
-/** Return the interrupt number message parameter.
- *
- * @param[in] call Mmessage call structure.
- *
- */
-#define NETIF_GET_IRQ(call) ((int) IPC_GET_ARG2(call))
-
-/** Return the input/output address message parameter.
- *
- * @param[in] call Message call structure.
- *
- */
-#define NETIF_GET_IO(call) ((void *) IPC_GET_ARG3(call))
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/ipc/nil.h
===================================================================
--- uspace/lib/c/include/ipc/nil.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,77 +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 libc
- * @{
- */
-
-/** @file
- * Network interface layer module messages.
- */
-
-#ifndef LIBC_NIL_MESSAGES_H_
-#define LIBC_NIL_MESSAGES_H_
-
-#include <ipc/net.h>
-
-/** Network interface layer module messages. */
-typedef enum {
-	/** New device or update MTU message.
-	 * @see nil_device_req()
-	 */
-	NET_NIL_DEVICE = NET_NIL_FIRST,
-	/** Send packet queue message.
-	 * @see nil_send_msg()
-	 */
-	NET_NIL_SEND,
-	/** Packet size message.
-	 * @see nil_packet_size_req()
-	 */
-	NET_NIL_PACKET_SPACE,
-	/** Device local hardware address message.
-	 * @see nil_get_addr()
-	 */
-	NET_NIL_ADDR,
-	/** Device broadcast hardware address message.
-	 * @see nil_get_broadcast_addr()
-	 */
-	NET_NIL_BROADCAST_ADDR
-} nil_messages;
-
-/** @name Network interface layer specific message parameters definitions */
-/*@{*/
-
-/** Return the protocol service message parameter. */
-#define NIL_GET_PROTO(call)  ((services_t) IPC_GET_ARG2(call))
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/ipc/packet.h
===================================================================
--- uspace/lib/c/include/ipc/packet.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,92 +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 libc
- *  @{
- */
-
-/** @file
- *  Packet server module messages.
- */
-
-#ifndef LIBC_PACKET_MESSAGES_
-#define LIBC_PACKET_MESSAGES_
-
-#include <ipc/net.h>
-
-/** Packet server module messages. */
-typedef enum {
-	/** Create packet message with specified content length.
-	 * @see packet_get_1()
-	 */
-	NET_PACKET_CREATE_1 = NET_PACKET_FIRST,
-	
-	/**
-	 * Create packet message with specified address length, prefix, content
-	 * and suffix.
-	 * @see packet_get_4()
-	 */
-	NET_PACKET_CREATE_4,
-	
-	/** Get packet message.
-	 * @see packet_return() */
-	NET_PACKET_GET,
-	
-	/** Get packet size message.
-	 * @see packet_translate()
-	 */
-	NET_PACKET_GET_SIZE,
-	
-	/** Release packet message.
-	 * @see pq_release()
-	 */
-	NET_PACKET_RELEASE
-} packet_messages;
-
-/** Return the protocol service message parameter. */
-#define ARP_GET_PROTO(call)  ((services_t) IPC_GET_ARG2(call))
-
-/** Return the packet identifier message parameter. */
-#define IPC_GET_ID(call)  ((packet_id_t) IPC_GET_ARG1(call))
-
-/** Return the maximal content length message parameter. */
-#define IPC_GET_CONTENT(call)  ((size_t) IPC_GET_ARG1(call))
-
-/** Return the maximal address length message parameter. */
-#define IPC_GET_ADDR_LEN(call)  ((size_t) IPC_GET_ARG2(call))
-
-/** Return the maximal prefix length message parameter. */
-#define IPC_GET_PREFIX(call)  ((size_t) IPC_GET_ARG3(call))
-
-/** Return the maximal suffix length message parameter. */
-#define IPC_GET_SUFFIX(call)  ((size_t) IPC_GET_ARG4(call))
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/ipc/services.h
===================================================================
--- uspace/lib/c/include/ipc/services.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/include/ipc/services.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -48,13 +48,11 @@
 	SERVICE_IRC        = FOURCC('i', 'r', 'c', ' '),
 	SERVICE_CLIPBOARD  = FOURCC('c', 'l', 'i', 'p'),
-	SERVICE_NETWORKING = FOURCC('n', 'e', 't', ' '),
-	SERVICE_ETHERNET   = FOURCC('e', 't', 'h', ' '),
-	SERVICE_NILDUMMY   = FOURCC('n', 'i', 'l', 'd'),
-	SERVICE_IP         = FOURCC('i', 'p', 'v', '4'),
-	SERVICE_ARP        = FOURCC('a', 'r', 'p', ' '),
-	SERVICE_ICMP       = FOURCC('i', 'c', 'm', 'p'),
 	SERVICE_UDP        = FOURCC('u', 'd', 'p', ' '),
 	SERVICE_TCP        = FOURCC('t', 'c', 'p', ' ')
 } services_t;
+
+#define SERVICE_NAME_INET     "net/inet"
+#define SERVICE_NAME_INETCFG  "net/inetcfg"
+#define SERVICE_NAME_INETPING "net/inetping"
 
 #endif
Index: uspace/lib/c/include/ipc/socket.h
===================================================================
--- uspace/lib/c/include/ipc/socket.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/include/ipc/socket.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -38,10 +38,8 @@
 #define LIBC_SOCKET_MESSAGES_H_
 
-#include <ipc/net.h>
-
 /** Socket client messages. */
 typedef enum {
 	/** Creates a new socket. @see socket() */
-	NET_SOCKET = NET_SOCKET_FIRST,
+	NET_SOCKET = IPC_FIRST_USER_METHOD,
 	/** Binds the socket. @see bind() */
 	NET_SOCKET_BIND,
Index: uspace/lib/c/include/ipc/tl.h
===================================================================
--- uspace/lib/c/include/ipc/tl.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,54 +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 libc
- * @{
- */
-
-/** @file
- * Transport layer modules messages.
- * @see tl_interface.h
- */
-
-#ifndef LIBC_TL_MESSAGES_H_
-#define LIBC_TL_MESSAGES_H_
-
-#include <ipc/net.h>
-
-/** Transport layer modules messages. */
-typedef enum {
-	/** Packet received message.
-	 * @see tl_received_msg()
-	 */
-	NET_TL_RECEIVED = NET_TL_FIRST
-} tl_messages;
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/net/icmp_api.h
===================================================================
--- uspace/lib/c/include/net/icmp_api.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,63 +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 libc
- * @{
- */
-
-/** @file
- * ICMP module application interface.
- */
-
-#ifndef LIBC_ICMP_API_H_
-#define LIBC_ICMP_API_H_
-
-#include <net/socket_codes.h>
-#include <net/inet.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <adt/measured_strings.h>
-#include <net/ip_codes.h>
-#include <net/icmp_codes.h>
-#include <net/icmp_common.h>
-#include <async.h>
-
-/** @name ICMP module application interface
- * This interface is used by other application modules.
- */
-/*@{*/
-
-extern int icmp_echo_msg(async_sess_t *, size_t, mseconds_t, ip_ttl_t, ip_tos_t,
-    int, const struct sockaddr *, socklen_t);
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/net/icmp_codes.h
===================================================================
--- uspace/lib/c/include/net/icmp_codes.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,282 +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 libc
- *  @{
- */
-
-/** @file
- * ICMP types and codes according to the on-line IANA - ICMP Type Numbers
- *
- * http://www.iana.org/assignments/icmp-parameters>
- *
- * cited September 14 2009.
- */
-
-#ifndef LIBC_ICMP_CODES_H_
-#define LIBC_ICMP_CODES_H_
-
-#include <sys/types.h>
-
-/** ICMP type type definition. */
-typedef uint8_t icmp_type_t;
-
-/** ICMP code type definition. */
-typedef uint8_t icmp_code_t;
-
-/** ICMP parameter type definition. */
-typedef uint16_t icmp_param_t;
-
-/** @name ICMP types definitions */
-/*@{*/
-
-/** Echo Reply. */
-#define ICMP_ECHOREPLY		0
-
-/** Destination Unreachable. */
-#define ICMP_DEST_UNREACH	3
-
-/** Source Quench. */
-#define ICMP_SOURCE_QUENCH	4
-
-/** Redirect. */
-#define ICMP_REDIRECT		5
-
-/** Alternate Host Address. */
-#define ICMP_ALTERNATE_ADDR	6
-
-/** Echo Request. */
-#define ICMP_ECHO		8
-
-/** Router Advertisement. */
-#define ICMP_ROUTER_ADV		9
-
-/** Router solicitation. */
-#define ICMP_ROUTER_SOL		10
-
-/** Time Exceeded. */
-#define ICMP_TIME_EXCEEDED	11
-
-/** Parameter Problem. */
-#define ICMP_PARAMETERPROB	12
-
-/** Timestamp Request. */
-#define ICMP_TIMESTAMP		13
-
-/** Timestamp Reply. */
-#define ICMP_TIMESTAMPREPLY	14
-
-/** Information Request. */
-#define ICMP_INFO_REQUEST	15
-
-/** Information Reply. */
-#define ICMP_INFO_REPLY		16
-
-/** Address Mask Request. */
-#define ICMP_ADDRESS		17
-
-/** Address Mask Reply. */
-#define ICMP_ADDRESSREPLY	18
-
-/** Traceroute. */
-#define ICMP_TRACEROUTE		30
-
-/** Datagram Conversion Error. */
-#define ICMP_CONVERSION_ERROR	31
-
-/** Mobile Host Redirect. */
-#define ICMP_REDIRECT_MOBILE	32
-
-/** IPv6 Where-Are-You. */
-#define ICMP_IPV6_WHERE_ARE_YOU	33
-
-/** IPv6 I-Am-Here. */
-#define ICMP_IPV6_I_AM_HERE	34
-
-/** Mobile Registration Request. */
-#define ICMP_MOBILE_REQUEST	35
-
-/** Mobile Registration Reply. */
-#define ICMP_MOBILE_REPLY	36
-
-/** Domain name request. */
-#define ICMP_DN_REQUEST		37
-
-/** Domain name reply. */
-#define ICMP_DN_REPLY		38
-
-/** SKIP. */
-#define ICMP_SKIP		39
-
-/** Photuris. */
-#define ICMP_PHOTURIS		40
-
-/*@}*/
-
-/** @name ICMP_DEST_UNREACH codes definitions
- */
-/*@{*/
-
-/** Network Unreachable. */
-#define ICMP_NET_UNREACH	0
-
-/** Host Unreachable. */
-#define ICMP_HOST_UNREACH	1
-
-/** Protocol Unreachable. */
-#define ICMP_PROT_UNREACH	2
-
-/** Port Unreachable. */
-#define ICMP_PORT_UNREACH	3
-
-/** Fragmentation needed but the Do Not Fragment bit was set. */
-#define ICMP_FRAG_NEEDED	4
-
-/** Source Route failed. */
-#define ICMP_SR_FAILED		5
-
-/** Destination network unknown. */
-#define ICMP_NET_UNKNOWN	6
-
-/** Destination host unknown. */
-#define ICMP_HOST_UNKNOWN	7
-
-/** Source host isolated (obsolete). */
-#define ICMP_HOST_ISOLATED	8
-
-/** Destination network administratively prohibited. */
-#define ICMP_NET_ANO		9
-
-/** Destination host administratively prohibited. */
-#define ICMP_HOST_ANO		10
-
-/** Network unreachable for this type of service. */
-#define ICMP_NET_UNR_TOS	11
-
-/** Host unreachable for this type of service. */
-#define ICMP_HOST_UNR_TOS	12
-
-/** Communication administratively prohibited by filtering. */
-#define ICMP_PKT_FILTERED	13
-
-/** Host precedence violation. */
-#define ICMP_PREC_VIOLATION	14
-
-/** Precedence cutoff in effect. */
-#define ICMP_PREC_CUTOFF	15
-
-/*@}*/
-
-/** @name ICMP_REDIRECT codes definitions */
-/*@{*/
-
-/** Network redirect (or subnet). */
-#define ICMP_REDIR_NET		0
-
-/** Host redirect. */
-#define ICMP_REDIR_HOST		1
-
-/** Network redirect for this type of service. */
-#define ICMP_REDIR_NETTOS	2
-
-/** Host redirect for this type of service. */
-#define ICMP_REDIR_HOSTTOS	3
-
-/*@}*/
-
-/** @name ICMP_ALTERNATE_ADDRESS codes definitions */
-/*@{*/
-
-/** Alternate address for host. */
-#define ICMP_ALTERNATE_HOST	0
-
-/*@}*/
-
-/** @name ICMP_ROUTER_ADV codes definitions */
-/*@{*/
-
-/** Normal router advertisement. */
-#define ICMP_ROUTER_NORMAL	0
-
-/** Does not route common traffic. */
-#define ICMP_ROUTER_NO_NORMAL_TRAFFIC	16
-
-/*@}*/
-
-/** @name ICMP_TIME_EXCEEDED codes definitions */
-/*@{*/
-
-/** Transit TTL exceeded. */
-#define ICMP_EXC_TTL		0
-
-/** Reassembly TTL exceeded. */
-#define ICMP_EXC_FRAGTIME	1
-
-/*@}*/
-
-/** @name ICMP_PARAMETERPROB codes definitions */
-/*@{*/
-
-/** Pointer indicates the error. */
-#define ICMP_PARAM_POINTER	0
-
-/** Missing required option. */
-#define ICMP_PARAM_MISSING	1
-
-/** Bad length. */
-#define ICMP_PARAM_LENGTH	2
-
-/*@}*/
-
-/** @name ICMP_PHOTURIS codes definitions */
-/*@{*/
-
-/** Bad SPI. */
-#define ICMP_PHOTURIS_BAD_SPI			0
-
-/** Authentication failed. */
-#define ICMP_PHOTURIS_AUTHENTICATION		1
-
-/** Decompression failed. */
-#define ICMP_PHOTURIS_DECOMPRESSION		2
-
-/** Decryption failed. */
-#define ICMP_PHOTURIS_DECRYPTION		3
-
-/** Need authentication. */
-#define ICMP_PHOTURIS_NEED_AUTHENTICATION	4
-
-/** Need authorization. */
-#define ICMP_PHOTURIS_NEED_AUTHORIZATION	5
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/net/icmp_common.h
===================================================================
--- uspace/lib/c/include/net/icmp_common.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,49 +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 libc
- *  @{
- */
-
-/** @file
- * ICMP module common interface.
- */
-
-#ifndef LIBC_ICMP_COMMON_H_
-#define LIBC_ICMP_COMMON_H_
-
-#include <ipc/services.h>
-#include <sys/time.h>
-#include <async.h>
-
-extern async_sess_t *icmp_connect_module(void);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/net/in.h
===================================================================
--- uspace/lib/c/include/net/in.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/include/net/in.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -45,4 +45,6 @@
 #define INET_ADDRSTRLEN  (4 * 3 + 3 + 1)
 
+#define INADDR_ANY 0
+
 /** Type definition of the INET address.
  * @see in_addr
Index: uspace/lib/c/include/net/modules.h
===================================================================
--- uspace/lib/c/include/net/modules.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ uspace/lib/c/include/net/modules.h	(revision fa18523547f587da07046f2697155b9dae6897fa)
@@ -46,16 +46,7 @@
 #include <sys/time.h>
 
-/** Connect to module function type definition.
- *
- * @return Session to the service.
- *
- */
-typedef async_sess_t *connect_module_t(services_t);
-
 extern void answer_call(ipc_callid_t, int, ipc_call_t *, size_t);
 extern async_sess_t *bind_service(services_t, sysarg_t, sysarg_t, sysarg_t,
     async_client_conn_t);
-extern async_sess_t *connect_to_service(services_t);
-extern int data_reply(void *, size_t);
 extern void refresh_answer(ipc_call_t *, size_t *);
 
Index: uspace/lib/c/include/net/packet.h
===================================================================
--- uspace/lib/c/include/net/packet.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,94 +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 libc 
- *  @{
- */
-
-/** @file
- *  Packet map and queue.
- */
-
-#ifndef LIBC_PACKET_H_
-#define LIBC_PACKET_H_
-
-#include <sys/types.h>
-
-/** Packet identifier type.
- * Value zero is used as an invalid identifier.
- */
-typedef sysarg_t packet_id_t;
-
-/** Type definition of the packet.
- * @see packet
- */
-typedef struct packet packet_t;
-
-/** Type definition of the packet dimension.
- * @see packet_dimension
- */
-typedef struct packet_dimension packet_dimension_t;
-
-/** Packet dimension. */
-struct packet_dimension {
-	/** Reserved packet prefix length. */
-	size_t prefix;
-	/** Maximal packet content length. */
-	size_t content;
-	/** Reserved packet suffix length. */
-	size_t suffix;
-	/** Maximal packet address length. */
-	size_t addr_len;
-};
-
-/** @name Packet management system interface
- */
-/*@{*/
-
-extern packet_t *pm_find(packet_id_t);
-extern int pm_add(packet_t *);
-extern void pm_remove(packet_t *);
-extern int pm_init(void);
-extern void pm_destroy(void);
-
-extern int pq_add(packet_t **, packet_t *, size_t, size_t);
-extern packet_t *pq_find(packet_t *, size_t);
-extern int pq_insert_after(packet_t *, packet_t *);
-extern packet_t *pq_detach(packet_t *);
-extern int pq_set_order(packet_t *, size_t, size_t);
-extern int pq_get_order(packet_t *, size_t *, size_t *);
-extern void pq_destroy(packet_t *, void (*)(packet_t *));
-extern packet_t *pq_next(packet_t *);
-extern packet_t *pq_previous(packet_t *);
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/c/include/net/packet_header.h
===================================================================
--- uspace/lib/c/include/net/packet_header.h	(revision d3e3a717020b7bb877febfca11081c65ada79d28)
+++ 	(revision )
@@ -1,147 +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 libc 
- *  @{
- */
-
-/** @file
- * Packet header.
- */
-
-#ifndef LIBC_PACKET_HEADER_H_
-#define LIBC_PACKET_HEADER_H_
-
-#include <net/packet.h>
-
-/** Returns the actual packet data length.
- * @param[in] header	The packet header.
- */
-#define PACKET_DATA_LENGTH(header) \
-	((header)->data_end - (header)->data_start)
-
-/** Returns the maximum packet address length.
- * @param[in] header	The packet header.
- */
-#define PACKET_MAX_ADDRESS_LENGTH(header) \
-	((header)->dest_addr - (header)->src_addr)
-
-/** Returns the minimum packet suffix.
- *  @param[in] header	The packet header.
- */
-#define PACKET_MIN_SUFFIX(header) \
-	((header)->length - (header)->data_start - (header)->max_content)
-
-/** Packet integrity check magic value. */
-#define PACKET_MAGIC_VALUE	0x11227788
-
-/** Maximum total length of the packet */
-#define PACKET_MAX_LENGTH  65536
-
-/** Packet header. */
-struct packet {
-	/** Packet identifier. */
-	packet_id_t packet_id;
-
-	/**
-	 * Packet queue sorting value.
-	 * The packet queue is sorted the ascending order.
-	 */
-	size_t order;
-
-	/** Packet metric. */
-	size_t metric;
-	/** Previous packet in the queue. */
-	packet_id_t previous;
-	/** Next packet in the queue. */
-	packet_id_t next;
-
-	/**
-	 * Total length of the packet.
-	 * Contains the header, the addresses and the data of the packet.
-	 * Corresponds to the mapped sharable memory block.
-	 */
-	size_t length;
-
-	/** Offload info provided by the NIC */
-	uint32_t offload_info;
-
-	/** Mask which bits in offload info are valid */
-	uint32_t offload_mask;
-
-	/** Stored source and destination addresses length. */
-	size_t addr_len;
-
-	/**
-	 * Souce address offset in bytes from the beginning of the packet
-	 * header.
-	 */
-	size_t src_addr;
-
-	/**
-	 * Destination address offset in bytes from the beginning of the packet
-	 * header.
-	 */
-	size_t dest_addr;
-
-	/** Reserved data prefix length in bytes. */
-	size_t max_prefix;
-	/** Reserved content length in bytes. */
-	size_t max_content;
-
-	/**
-	 * Actual data start offset in bytes from the beginning of the packet
-	 * header.
-	 */
-	size_t data_start;
-
-	/**
-	 * Actual data end offset in bytes from the beginning of the packet
-	 * header.
-	 */
-	size_t data_end;
-
-	/** Integrity check magic value. */
-	int magic_value;
-};
-
-/** Returns whether the packet is valid.
- * @param[in] packet	The packet to be checked.
- * @return		True if the packet is not NULL and the magic value is
- *			correct.
- * @return		False otherwise.
- */
-static inline int packet_is_valid(const packet_t *packet)
-{
-	return packet && (packet->magic_value == PACKET_MAGIC_VALUE);
-}
-
-#endif
-
-/** @}
- */
