Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ uspace/lib/c/Makefile	(revision c6533a794620411b83c209fe9e2c6bb24cedc08c)
@@ -118,8 +118,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/net/icmp_api.c
===================================================================
--- uspace/lib/c/generic/net/icmp_api.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(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 bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(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/packet.c
===================================================================
--- uspace/lib/c/generic/net/packet.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(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/include/ipc/net.h
===================================================================
--- uspace/lib/c/include/ipc/net.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ uspace/lib/c/include/ipc/net.h	(revision c6533a794620411b83c209fe9e2c6bb24cedc08c)
@@ -40,5 +40,4 @@
 #include <ipc/services.h>
 #include <net/device.h>
-#include <net/packet.h>
 
 /** Return a value indicating whether the value is in the interval.
Index: uspace/lib/c/include/net/icmp_api.h
===================================================================
--- uspace/lib/c/include/net/icmp_api.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(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 bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(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 bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(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/packet.h
===================================================================
--- uspace/lib/c/include/net/packet.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(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 bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(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
-
-/** @}
- */
Index: uspace/lib/net/Makefile
===================================================================
--- uspace/lib/net/Makefile	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ uspace/lib/net/Makefile	(revision c6533a794620411b83c209fe9e2c6bb24cedc08c)
@@ -33,24 +33,5 @@
 
 SOURCES = \
-	generic/generic.c \
-	generic/net_remote.c \
-	generic/net_checksum.c \
-	generic/packet_client.c \
-	generic/packet_remote.c \
-	generic/protocol_map.c \
-	adt/module_map.c \
-	nil/nil_remote.c \
-	nil/nil_skel.c \
-	il/il_remote.c \
-	il/il_skel.c \
-	il/ip_remote.c \
-	il/ip_client.c \
-	il/arp_remote.c \
-	tl/icmp_remote.c \
-	tl/icmp_client.c \
-	tl/socket_core.c \
-	tl/tl_common.c \
-	tl/tl_remote.c \
-	tl/tl_skel.c
+	tl/socket_core.c
 
 include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/net/adt/module_map.c
===================================================================
--- uspace/lib/net/adt/module_map.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,145 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Character string to module map implementation.
- */
-
-#include <malloc.h>
-#include <task.h>
-#include <unistd.h>
-#include <errno.h>
-#include <net/modules.h>
-#include <adt/generic_char_map.h>
-#include <adt/module_map.h>
-
-GENERIC_CHAR_MAP_IMPLEMENT(modules, module_t)
-
-/** Add module to the module map.
- *
- * @param[out] module         Module structure added.
- * @param[in]  modules        Module map.
- * @param[in]  name           Module name.
- * @param[in]  filename       Full path filename.
- * @param[in]  service        Module service.
- * @param[in]  task_id        Module current task identifier.
- *                            Zero means not running.
- * @param[in]  connect_module Module connecting function.
- *
- * @return EOK on success.
- * @return ENOMEM if there is not enough memory left.
- *
- */
-int add_module(module_t **module, modules_t *modules, const uint8_t *name,
-    const uint8_t *filename, services_t service, task_id_t task_id,
-    connect_module_t connect_module)
-{
-	module_t *tmp_module;
-	int rc;
-	
-	tmp_module = (module_t *) malloc(sizeof(module_t));
-	if (!tmp_module)
-		return ENOMEM;
-	
-	tmp_module->task_id = task_id;
-	tmp_module->sess = NULL;
-	tmp_module->usage = 0;
-	tmp_module->name = name;
-	tmp_module->filename = filename;
-	tmp_module->service = service;
-	tmp_module->connect_module = connect_module;
-	
-	rc = modules_add(modules, tmp_module->name, 0, tmp_module);
-	if (rc != EOK) {
-		free(tmp_module);
-		return rc;
-	}
-	
-	if (module)
-		*module = tmp_module;
-	
-	return EOK;
-}
-
-/** Search and return the specified module.
- *
- * If the module is not running, the module filaname is spawned.
- * If the module is not connected, the connect_function is called.
- *
- * @param[in] modules Module map.
- * @param[in] name    Module name.
- *
- * @return The running module found. It does not have to be
- *         connected.
- * @return NULL if there is no such module.
- *
- */
-module_t *get_running_module(modules_t *modules, uint8_t *name)
-{
-	module_t *module = modules_find(modules, name, 0);
-	if (!module)
-		return NULL;
-	
-	if (!module->task_id) {
-		module->task_id = net_spawn(module->filename);
-		if (!module->task_id)
-			return NULL;
-	}
-	
-	if (!module->sess)
-		module->sess = module->connect_module(module->service);
-	
-	return module;
-}
-
-/** Start the given module.
- *
- * @param[in] fname The module full or relative path filename.
- *
- * @return The new module task identifier on success.
- * @return Zero if there is no such module.
- *
- */
-task_id_t net_spawn(const uint8_t *fname)
-{
-	task_id_t id;
-	int rc;
-	
-	rc = task_spawnl(&id, (const char *) fname, (const char *) fname, NULL);
-	if (rc != EOK)
-		return 0;
-	
-	return id;
-}
-
-/** @}
- */
Index: uspace/lib/net/generic/generic.c
===================================================================
--- uspace/lib/net/generic/generic.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,287 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Generic communication interfaces for networking.
- */
-
-#include <generic.h>
-#include <async.h>
-#include <ipc/services.h>
-#include <net/device.h>
-#include <adt/measured_strings.h>
-#include <net/packet.h>
-
-/** Notify the module about the device state change.
- *
- * @param[in] sess      Service module session.
- * @param[in] message   Service specific message.
- * @param[in] device_id Device identifier.
- * @param[in] state     New device state.
- * @param[in] target    Target module service.
- *
- * @return EOK on success.
- *
- */
-int generic_device_state_msg_remote(async_sess_t *sess, sysarg_t message,
-    nic_device_id_t device_id, sysarg_t state, services_t target)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	async_msg_3(exch, message, (sysarg_t) device_id, state, target);
-	async_exchange_end(exch);
-	
-	return EOK;
-}
-
-/** Notify a module about the device.
- *
- * @param[in] sess      Service module session.
- * @param[in] message   Service specific message.
- * @param[in] device_id Device identifier.
- * @param[in] service   Device module service.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the specific service
- *         message.
- *
- */
-int generic_device_req_remote(async_sess_t *sess, sysarg_t message,
-    nic_device_id_t device_id, services_t service)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	int rc = async_req_3_0(exch, message, (sysarg_t) device_id, 0,
-	    (sysarg_t) service);
-	async_exchange_end(exch);
-	
-	return rc;
-}
-
-/** Returns the address.
- *
- * @param[in] sess      Service module session.
- * @param[in] message   Service specific message.
- * @param[in] device_id Device identifier.
- * @param[out] address  Desired address.
- * @param[out] data     Address data container.
- *
- * @return EOK on success.
- * @return EBADMEM if the address parameter and/or the data
- *         parameter is NULL.
- * @return Other error codes as defined for the specific service
- *         message.
- *
- */
-int generic_get_addr_req(async_sess_t *sess, sysarg_t message,
-    nic_device_id_t device_id, uint8_t *address, size_t max_len)
-{
-	aid_t aid;
-	ipc_call_t result;
-	
-	assert(address != NULL);
-	
-	/* Request the address */
-	async_exch_t *exch = async_exchange_begin(sess);
-	aid = async_send_1(exch, message, (sysarg_t) device_id, &result);
-	
-	sysarg_t ipcrc;
-	int rc = async_data_read_start(exch, address, max_len);
-	async_exchange_end(exch);
-	
-	if (rc != EOK) {
-		async_wait_for(aid, &ipcrc);
-		return rc;
-	}
-	
-	async_wait_for(aid, &ipcrc);
-	if (ipcrc == EOK) {
-		return IPC_GET_ARG1(result);
-	} else {
-		return (int) ipcrc;
-	}
-}
-
-/** Return the device packet dimension for sending.
- *
- * @param[in] sess              Service module session.
- * @param[in] message           Service specific message.
- * @param[in] device_id         Device identifier.
- * @param[out] packet_dimension Packet dimension.
- *
- * @return EOK on success.
- * @return EBADMEM if the packet_dimension parameter is NULL.
- * @return Other error codes as defined for the specific service
- *         message.
- *
- */
-int generic_packet_size_req_remote(async_sess_t *sess, sysarg_t message,
-    nic_device_id_t device_id, packet_dimension_t *packet_dimension)
-{
-	if (!packet_dimension)
-		return EBADMEM;
-	
-	sysarg_t addr_len;
-	sysarg_t prefix;
-	sysarg_t content;
-	sysarg_t suffix;
-	
-	async_exch_t *exch = async_exchange_begin(sess);
-	sysarg_t result = async_req_1_4(exch, message, (sysarg_t) device_id,
-	    &addr_len, &prefix, &content, &suffix);
-	async_exchange_end(exch);
-	
-	packet_dimension->prefix = (size_t) prefix;
-	packet_dimension->content = (size_t) content;
-	packet_dimension->suffix = (size_t) suffix;
-	packet_dimension->addr_len = (size_t) addr_len;
-	
-	return (int) result;
-}
-
-/** Pass the packet queue to the module.
- *
- * @param[in] sess      Service module session.
- * @param[in] message   Service specific message.
- * @param[in] device_id Device identifier.
- * @param[in] packet_id Received packet or the received packet queue
- *                      identifier.
- * @param[in] target    Target module service.
- * @param[in] error     Error module service.
- *
- * @return EOK on success.
- *
- */
-int generic_received_msg_remote(async_sess_t *sess, sysarg_t message,
-    nic_device_id_t device_id, packet_id_t packet_id, services_t target,
-    services_t error)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	
-	if (error) {
-		async_msg_4(exch, message, (sysarg_t) device_id,
-		    (sysarg_t) packet_id, (sysarg_t) target, (sysarg_t) error);
-	} else {
-		async_msg_3(exch, message, (sysarg_t) device_id,
-		    (sysarg_t) packet_id, (sysarg_t) target);
-	}
-	
-	async_exchange_end(exch);
-	
-	return EOK;
-}
-
-/** Send the packet queue.
- *
- * @param[in] sess      Service module session.
- * @param[in] message   Service specific message.
- * @param[in] device_id Device identifier.
- * @param[in] packet_id Packet or the packet queue identifier.
- * @param[in] sender    Sending module service.
- * @param[in] error     Error module service.
- *
- * @return EOK on success.
- *
- */
-int generic_send_msg_remote(async_sess_t *sess, sysarg_t message,
-    nic_device_id_t device_id, packet_id_t packet_id, services_t sender,
-    services_t error)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	
-	if (error) {
-		async_msg_4(exch, message, (sysarg_t) device_id,
-		    (sysarg_t) packet_id, (sysarg_t) sender, (sysarg_t) error);
-	} else {
-		async_msg_3(exch, message, (sysarg_t) device_id,
-		    (sysarg_t) packet_id, (sysarg_t) sender);
-	}
-	
-	async_exchange_end(exch);
-	
-	return EOK;
-}
-
-/** Translates the given strings.
- *
- * Allocates and returns the needed memory block as the data parameter.
- *
- * @param[in] sess          Service module session.
- * @param[in] message       Service specific message.
- * @param[in] device_id     Device identifier.
- * @param[in] service       Module service.
- * @param[in] configuration Key strings.
- * @param[in] count         Number of configuration keys.
- * @param[out] translation  Translated values.
- * @param[out] data         Translation data container.
- *
- * @return EOK on success.
- * @return EINVAL if the configuration parameter is NULL.
- * @return EINVAL if the count parameter is zero.
- * @return EBADMEM if the translation or the data parameters are
- *         NULL.
- * @return Other error codes as defined for the specific service
- *         message.
- *
- */
-int generic_translate_req(async_sess_t *sess, sysarg_t message,
-    nic_device_id_t device_id, services_t service,
-    measured_string_t *configuration, size_t count,
-    measured_string_t **translation, uint8_t **data)
-{
-	if ((!configuration) || (count == 0))
-		return EINVAL;
-	
-	if ((!translation) || (!data))
-		return EBADMEM;
-	
-	/* Request the translation */
-	async_exch_t *exch = async_exchange_begin(sess);
-	aid_t message_id = async_send_3(exch, message, (sysarg_t) device_id,
-	    (sysarg_t) count, (sysarg_t) service, NULL);
-	measured_strings_send(exch, configuration, count);
-	int rc = measured_strings_return(exch, translation, data, count);
-	async_exchange_end(exch);
-	
-	sysarg_t result;
-	async_wait_for(message_id, &result);
-	
-	/* If not successful */
-	if ((rc == EOK) && (result != EOK)) {
-		/* Clear the data */
-		free(*translation);
-		free(*data);
-	}
-	
-	return (int) result;
-}
-
-/** @}
- */
Index: uspace/lib/net/generic/net_checksum.c
===================================================================
--- uspace/lib/net/generic/net_checksum.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,224 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * General CRC and checksum computation implementation.
- */
-
-#include <sys/types.h>
-
-#include <net_checksum.h>
-
-/** Big-endian encoding CRC divider. */
-#define CRC_DIVIDER_BE  0x04c11db7
-
-/** Little-endian encoding CRC divider. */
-#define CRC_DIVIDER_LE  0xedb88320
-
-/** Compacts the computed checksum to the 16 bit number adding the carries.
- *
- * @param[in] sum	Computed checksum.
- * @return		Compacted computed checksum to the 16 bits.
- */
-uint16_t compact_checksum(uint32_t sum)
-{
-	/* Shorten to the 16 bits */
-	while (sum >> 16)
-		sum = (sum & 0xffff) + (sum >> 16);
-
-	return (uint16_t) sum;
-}
-
-/** Computes sum of the 2 byte fields.
- *
- * Padds one zero (0) byte if odd.
- *
- * @param[in] seed	Initial value. Often used as 0 or ~0.
- * @param[in] data	Pointer to the beginning of data to process.
- * @param[in] length	Length of the data in bytes.
- * @return		The computed checksum of the length bytes of the data.
- */
-uint32_t compute_checksum(uint32_t seed, uint8_t *data, size_t length)
-{
-	size_t index;
-
-	/* Sum all the 16 bit fields */
-	for (index = 0; index + 1 < length; index += 2)
-		seed += (data[index] << 8) + data[index + 1];
-
-	/* Last odd byte with zero padding */
-	if (index + 1 == length)
-		seed += data[index] << 8;
-
-	return seed;
-}
-
-/** Computes CRC32 value in the big-endian environment.
- *
- * @param[in] seed	Initial value. Often used as 0 or ~0.
- * @param[in] data	Pointer to the beginning of data to process.
- * @param[in] length	Length of the data in bits.
- * @return		The computed CRC32 of the length bits of the data.
- */
-uint32_t compute_crc32_be(uint32_t seed, uint8_t * data, size_t length)
-{
-	size_t index;
-
-	/* Process full bytes */
-	while (length >= 8) {
-		/* Add the data */
-		seed ^= (*data) << 24;
-		
-		/* For each added bit */
-		for (index = 0; index < 8; ++index) {
-			/* If the first bit is set */
-			if (seed & 0x80000000) {
-				/* Shift and divide the checksum */
-				seed = (seed << 1) ^ ((uint32_t) CRC_DIVIDER_BE);
-			} else {
-				/* Shift otherwise */
-				seed <<= 1;
-			}
-		}
-		
-		/* Move to the next byte */
-		++data;
-		length -= 8;
-	}
-
-	/* Process the odd bits */
-	if (length > 0) {
-		/* Add the data with zero padding */
-		seed ^= ((*data) & (0xff << (8 - length))) << 24;
-		
-		/* For each added bit */
-		for (index = 0; index < length; ++index) {
-			/* If the first bit is set */
-			if (seed & 0x80000000) {
-				/* Shift and divide the checksum */
-				seed = (seed << 1) ^ ((uint32_t) CRC_DIVIDER_BE);
-			} else {
-				/* Shift otherwise */
-				seed <<= 1;
-			}
-		}
-	}
-
-	return seed;
-}
-
-/** Computes CRC32 value in the little-endian environment.
- *
- * @param[in] seed	Initial value. Often used as 0 or ~0.
- * @param[in] data	Pointer to the beginning of data to process.
- * @param[in] length	Length of the data in bits.
- * @return		The computed CRC32 of the length bits of the data.
- */
-uint32_t compute_crc32_le(uint32_t seed, uint8_t * data, size_t length)
-{
-	size_t index;
-
-	/* Process full bytes */
-	while (length >= 8) {
-		/* Add the data */
-		seed ^= (*data);
-		
-		/* For each added bit */
-		for (index = 0; index < 8; ++index) {
-			/* If the last bit is set */
-			if (seed & 1) {
-				/* Shift and divide the checksum */
-				seed = (seed >> 1) ^ ((uint32_t) CRC_DIVIDER_LE);
-			} else {
-				/* Shift otherwise */
-				seed >>= 1;
-			}
-		}
-		
-		/* Move to the next byte */
-		++data;
-		length -= 8;
-	}
-
-	/* Process the odd bits */
-	if (length > 0) {
-		/* Add the data with zero padding */
-		seed ^= (*data) >> (8 - length);
-		
-		for (index = 0; index < length; ++index) {
-			/* If the last bit is set */
-			if (seed & 1) {
-				/* Shift and divide the checksum */
-				seed = (seed >> 1) ^ ((uint32_t) CRC_DIVIDER_LE);
-			} else {
-				/* Shift otherwise */
-				seed >>= 1;
-			}
-		}
-	}
-
-	return seed;
-}
-
-/** Returns or flips the checksum if zero.
- *
- * @param[in] checksum	The computed checksum.
- * @return		The internet protocol header checksum.
- * @return		0xFFFF if the computed checksum is zero.
- */
-uint16_t flip_checksum(uint16_t checksum)
-{
-	/* Flip, zero is returned as 0xFFFF (not flipped) */
-	checksum = ~checksum;
-	return checksum ? checksum : IP_CHECKSUM_ZERO;
-}
-
-/** Compute the IP header checksum.
- *
- * To compute the checksum of a new packet, the checksum header field must be
- * zero. To check the checksum of a received packet, the checksum may be left
- * set. Zero will be returned in this case if valid.
- *
- * @param[in] data	The header data.
- * @param[in] length	The header length in bytes.
- * @return		The internet protocol header checksum.
- * @return		0xFFFF if the computed checksum is zero.
- */
-uint16_t ip_checksum(uint8_t *data, size_t length)
-{
-	/* Compute, compact and flip the data checksum */
-	return flip_checksum(compact_checksum(compute_checksum(0, data,
-	    length)));
-}
-
-/** @}
- */
Index: uspace/lib/net/generic/net_remote.c
===================================================================
--- uspace/lib/net/generic/net_remote.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,170 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Networking interface implementation for remote modules.
- * @see net_interface.h
- */
-
-#include <ipc/services.h>
-#include <ipc/net_net.h>
-#include <malloc.h>
-#include <async.h>
-#include <devman.h>
-#include <generic.h>
-#include <net/modules.h>
-#include <net/device.h>
-#include <net_interface.h>
-#include <adt/measured_strings.h>
-
-/** Connect to the networking module.
- *
- * @return Networking module session on success.
- *
- */
-async_sess_t *net_connect_module(void)
-{
-	return connect_to_service(SERVICE_NETWORKING);
-}
-
-/** Free the received settings.
- *
- * @param[in] settings Received settings.
- * @param[in] data     Received settings data.
- *
- * @see net_get_device_conf_req()
- * @see net_get_conf_req()
- *
- */
-void net_free_settings(measured_string_t *settings, uint8_t *data)
-{
-	if (settings)
-		free(settings);
-	if (data)
-		free(data);
-}
-
-/** Return the global configuration.
- *
- * The configuration names are read and the appropriate settings are set
- * instead. Call net_free_settings() function to release the returned
- * configuration.
- *
- * @param[in]     sess          Networking module session.
- * @param[in,out] configuration Requested configuration. The names are
- *                              read and the appropriate settings are set
- *                              instead.
- *
- * @param[in]     count         Configuration entries count.
- * @param[in,out] data          Configuration and settings data.
- *
- * @return EOK on success.
- * @return EINVAL if the configuration is NULL.
- * @return EINVAL if the count is zero.
- * @return Other error codes as defined for the
- *         generic_translate_req() function.
- *
- */
-int net_get_conf_req(async_sess_t *sess, measured_string_t **configuration,
-    size_t count, uint8_t **data)
-{
-	return generic_translate_req(sess, NET_NET_GET_CONF, 0, 0,
-	    *configuration, count, configuration, data);
-}
-
-/** Return the device specific configuration.
- *
- * Return the global configuration if the device specific is not found.
- * The configuration names are read and the appropriate settings are set
- * instead. Call net_free_settings() function to release the returned
- * configuration.
- *
- * @param[in]     sess          The networking module session.
- * @param[in]     device_id     Device identifier.
- * @param[in,out] configuration Requested device configuration. The names
- *                              are read and the appropriate settings are
- *                              set instead.
- * @param[in]     count         Configuration entries count.
- * @param[in,out] data          Configuration and settings data.
- *
- * @return EOK on success.
- * @return EINVAL if the configuration is NULL.
- * @return EINVAL if the count is zero.
- * @return Other error codes as defined for the
- *         generic_translate_req() function.
- *
- */
-int net_get_device_conf_req(async_sess_t *sess, nic_device_id_t device_id,
-    measured_string_t **configuration, size_t count, uint8_t **data)
-{
-	return generic_translate_req(sess, NET_NET_GET_DEVICE_CONF,
-	    device_id, 0, *configuration, count, configuration, data);
-}
-
-int net_get_devices_req(async_sess_t *sess, measured_string_t **devices,
-    size_t *count, uint8_t **data)
-{
-	if ((!devices) || (!count))
-		return EBADMEM;
-	
-	async_exch_t *exch = async_exchange_begin(sess);
-	
-	int rc = async_req_0_1(exch, NET_NET_GET_DEVICES_COUNT, count);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		return rc;
-	}
-	
-	if (*count == 0) {
-		async_exchange_end(exch);
-		*data = NULL;
-		return EOK;
-	}
-	
-	aid_t message_id = async_send_0(exch, NET_NET_GET_DEVICES, NULL);
-	rc = measured_strings_return(exch, devices, data, *count);
-	
-	async_exchange_end(exch);
-	
-	sysarg_t result;
-	async_wait_for(message_id, &result);
-	
-	if ((rc == EOK) && (result != EOK)) {
-		free(*devices);
-		free(*data);
-	}
-	
-	return (int) result;
-}
-
-/** @}
- */
Index: uspace/lib/net/generic/packet_client.c
===================================================================
--- uspace/lib/net/generic/packet_client.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,294 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Packet client implementation.
- */
-
-#include <errno.h>
-#include <mem.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <packet_client.h>
-#include <packet_remote.h>
-
-#include <net/packet.h>
-#include <net/packet_header.h>
-
-/** Copies the specified data to the beginning of the actual packet content.
- *
- * Pushes the content end if needed.
- *
- * @param[in] packet	The packet to be filled.
- * @param[in] data	The data to be copied.
- * @param[in] length	The length of the copied data.
- * @return		EOK on success.
- * @return		EINVAL if the packet is not valid.
- * @return		ENOMEM if there is not enough memory left.
- */
-int packet_copy_data(packet_t *packet, const void *data, size_t length)
-{
-	if (!packet_is_valid(packet))
-		return EINVAL;
-
-	if (packet->data_start + length >= packet->length)
-		return ENOMEM;
-
-	memcpy((void *) packet + packet->data_start, data, length);
-	if (packet->data_start + length > packet->data_end) 
-		packet->data_end = packet->data_start + length;
-
-	return EOK;
-}
-
-/** Allocates the specified space right before the actual packet content and
- * returns its pointer.
- *
- * @param[in] packet	The packet to be used.
- * @param[in] length	The space length to be allocated at the beginning of the
- *			packet content.
- * @return		The pointer to the allocated memory.
- * @return		NULL if there is not enough memory left.
- */
-void *packet_prefix(packet_t *packet, size_t length)
-{
-	if ((!packet_is_valid(packet)) ||
-	    (packet->data_start - sizeof(packet_t) -
-	    2 * (packet->dest_addr - packet->src_addr) < length)) {
-		return NULL;
-	}
-
-	packet->data_start -= length;
-	return (void *) packet + packet->data_start;
-}
-
-/** Allocates the specified space right after the actual packet content and
- * returns its pointer.
- *
- * @param[in] packet	The packet to be used.
- * @param[in] length	The space length to be allocated at the end of the
- *			 packet content.
- * @return		The pointer to the allocated memory.
- * @return		NULL if there is not enough memory left.
- */
-void *packet_suffix(packet_t *packet, size_t length)
-{
-	if ((!packet_is_valid(packet)) ||
-	    (packet->data_end + length >= packet->length)) {
-		return NULL;
-	}
-
-	packet->data_end += length;
-	return (void *) packet + packet->data_end - length;
-}
-
-/** Trims the actual packet content by the specified prefix and suffix lengths.
- *
- * @param[in] packet	The packet to be trimmed.
- * @param[in] prefix	The prefix length to be removed from the beginning of
- *			the packet content.
- * @param[in] suffix	The suffix length to be removed from the end of the
- *			packet content.
- * @return		EOK on success.
- * @return		EINVAL if the packet is not valid.
- * @return		ENOMEM if there is not enough memory left.
- */
-int packet_trim(packet_t *packet, size_t prefix, size_t suffix)
-{
-	if (!packet_is_valid(packet))
-		return EINVAL;
-
-	if (prefix + suffix > PACKET_DATA_LENGTH(packet))
-		return ENOMEM;
-
-	packet->data_start += prefix;
-	packet->data_end -= suffix;
-	return EOK;
-}
-
-/** Returns the packet identifier.
- *
- * @param[in] packet	The packet.
- * @return		The packet identifier.
- * @return		Zero if the packet is not valid.
- */
-packet_id_t packet_get_id(const packet_t *packet)
-{
-	return packet_is_valid(packet) ? packet->packet_id : 0;
-}
-
-/** Returns the stored packet addresses and their length.
- *
- * @param[in] packet	The packet.
- * @param[out] src	The source address. May be NULL if not desired.
- * @param[out] dest	The destination address. May be NULL if not desired.
- * @return		The stored addresses length.
- * @return		Zero if the addresses are not present.
- * @return		EINVAL if the packet is not valid.
- */
-int packet_get_addr(const packet_t *packet, uint8_t **src, uint8_t **dest)
-{
-	if (!packet_is_valid(packet))
-		return EINVAL;
-	if (!packet->addr_len)
-		return 0;
-	if (src)
-		*src = (void *) packet + packet->src_addr;
-	if (dest)
-		*dest = (void *) packet + packet->dest_addr;
-
-	return packet->addr_len;
-}
-
-/** Returns the packet content length.
- *
- * @param[in] packet	The packet.
- * @return		The packet content length in bytes.
- * @return		Zero if the packet is not valid.
- */
-size_t packet_get_data_length(const packet_t *packet)
-{
-	if (!packet_is_valid(packet))
-		return 0;
-
-	return PACKET_DATA_LENGTH(packet);
-}
-
-/** Returns the pointer to the beginning of the packet content.
- *
- * @param[in] packet	The packet.
- * @return		The pointer to the beginning of the packet content.
- * @return		NULL if the packet is not valid.
- */
-void *packet_get_data(const packet_t *packet)
-{
-	if (!packet_is_valid(packet))
-		return NULL;
-
-	return (void *) packet + packet->data_start;
-}
-
-/** Sets the packet addresses.
- *
- * @param[in] packet	The packet.
- * @param[in] src	The new source address. May be NULL.
- * @param[in] dest	The new destination address. May be NULL.
- * @param[in] addr_len	The addresses length.
- * @return		EOK on success.
- * @return		EINVAL if the packet is not valid.
- * @return		ENOMEM if there is not enough memory left.
- */
-int
-packet_set_addr(packet_t *packet, const uint8_t *src, const uint8_t *dest,
-    size_t addr_len)
-{
-	size_t padding;
-	size_t allocated;
-
-	if (!packet_is_valid(packet))
-		return EINVAL;
-
-	allocated = PACKET_MAX_ADDRESS_LENGTH(packet);
-	if (allocated < addr_len)
-		return ENOMEM;
-
-	padding = allocated - addr_len;
-	packet->addr_len = addr_len;
-
-	if (src) {
-		memcpy((void *) packet + packet->src_addr, src, addr_len);
-		if (padding)
-			bzero((void *) packet + packet->src_addr + addr_len,
-			    padding);
-	} else {
-		bzero((void *) packet + packet->src_addr, allocated);
-	}
-
-	if (dest) {
-		memcpy((void *) packet + packet->dest_addr, dest, addr_len);
-		if (padding)
-			bzero((void *) packet + packet->dest_addr + addr_len,
-			    padding);
-	} else {
-		bzero((void *) packet + packet->dest_addr, allocated);
-	}
-
-	return EOK;
-}
-
-/** Return the packet copy.
- *
- * Copy the addresses, data, order and metric values.
- * Queue placement is not copied.
- *
- * @param[in] sess   Packet server module session.
- * @param[in] packet Original packet.
- *
- * @return Packet copy.
- * @return NULL on error.
- *
- */
-packet_t *packet_get_copy(async_sess_t *sess, packet_t *packet)
-{
-	if (!packet_is_valid(packet))
-		return NULL;
-	
-	/* Get a new packet */
-	packet_t *copy = packet_get_4_remote(sess, PACKET_DATA_LENGTH(packet),
-	    PACKET_MAX_ADDRESS_LENGTH(packet), packet->max_prefix,
-	    PACKET_MIN_SUFFIX(packet));
-	
-	if (!copy)
-		return NULL;
-	
-	/* Get addresses */
-	uint8_t *src = NULL;
-	uint8_t *dest = NULL;
-	size_t addrlen = packet_get_addr(packet, &src, &dest);
-	
-	/* Copy data */
-	if ((packet_copy_data(copy, packet_get_data(packet),
-	    PACKET_DATA_LENGTH(packet)) == EOK) &&
-	    /* Copy addresses if present */
-	    ((addrlen <= 0) ||
-	    (packet_set_addr(copy, src, dest, addrlen) == EOK))) {
-		copy->order = packet->order;
-		copy->metric = packet->metric;
-		return copy;
-	} else {
-		pq_release_remote(sess, copy->packet_id);
-		return NULL;
-	}
-}
-
-/** @}
- */
Index: uspace/lib/net/generic/packet_remote.c
===================================================================
--- uspace/lib/net/generic/packet_remote.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,229 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Packet client interface implementation for remote modules.
- * @see packet_client.h
- */
-
-#include <async.h>
-#include <errno.h>
-#include <ipc/packet.h>
-#include <sys/mman.h>
-
-#include <packet_client.h>
-#include <packet_remote.h>
-
-#include <net/packet.h>
-#include <net/packet_header.h>
-
-/** Obtain the packet from the packet server as the shared memory block.
- *
- * Create the local packet mapping as well.
- *
- * @param[in]  sess      Packet server module session.
- * @param[out] packet    Packet reference pointer to store the received
- *                       packet reference.
- * @param[in]  packet_id Packet identifier.
- * @param[in]  size      Packet total size in bytes.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the pm_add() function.
- * @return Other error codes as defined for the async_share_in_start()
- *         function.
- *
- */
-static int packet_return(async_sess_t *sess, packet_t **packet,
-    packet_id_t packet_id, size_t size)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	ipc_call_t answer;
-	aid_t message = async_send_1(exch, NET_PACKET_GET, packet_id, &answer);
-	int rc = async_share_in_start_0_0(exch, size, (void *) packet);
-	async_exchange_end(exch);
-	
-	sysarg_t result;
-	async_wait_for(message, &result);
-	
-	if (rc != EOK)
-		return rc;
-	
-	if (packet == (void *) -1)
-		return ENOMEM;
-	
-	rc = pm_add(*packet);
-	if (rc != EOK) {
-		munmap(*packet, size);
-		return rc;
-	}
-	
-	return result;
-}
-
-/** Translate the packet identifier to the packet reference.
- *
- * Try to find mapping first. The packet server is asked to share
- * the packet if the mapping is not present.
- *
- * @param[in]  sess      Packet server module session.
- * @param[out] packet    Packet reference.
- * @param[in]  packet_id Packet identifier.
- *
- * @return EOK on success.
- * @return EINVAL if the packet parameter is NULL.
- * @return Other error codes as defined for the NET_PACKET_GET_SIZE
- *         message.
- * @return Other error codes as defined for the packet_return()
- *         function.
- *
- */
-int packet_translate_remote(async_sess_t *sess, packet_t **packet,
-    packet_id_t packet_id)
-{
-	if (!packet)
-		return EINVAL;
-	
-	*packet = pm_find(packet_id);
-	if (*packet == NULL) {
-		async_exch_t *exch = async_exchange_begin(sess);
-		sysarg_t size;
-		int rc = async_req_1_1(exch, NET_PACKET_GET_SIZE, packet_id,
-		    &size);
-		async_exchange_end(exch);
-		
-		if (rc != EOK)
-			return rc;
-		
-		rc = packet_return(sess, packet, packet_id, size);
-		if (rc != EOK)
-			return rc;
-	}
-	
-	if ((*packet != NULL) && ((*packet)->next)) {
-		packet_t *next;
-		return packet_translate_remote(sess, &next, (*packet)->next);
-	}
-	
-	return EOK;
-}
-
-/** Obtain the packet of given dimensions.
- *
- * Contact the packet server to return the appropriate packet.
- *
- * @param[in] sess        Packet server module session.
- * @param[in] addr_len    Source and destination addresses maximal length
- *                        in bytes.
- * @param[in] max_prefix  Maximal prefix length in bytes.
- * @param[in] max_content Maximal content length in bytes.
- * @param[in] max_suffix  Maximal suffix length in bytes.
- *
- * @return The packet reference.
- * @return NULL on error.
- *
- */
-packet_t *packet_get_4_remote(async_sess_t *sess, size_t max_content,
-    size_t addr_len, size_t max_prefix, size_t max_suffix)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	sysarg_t packet_id;
-	sysarg_t size;
-	int rc = async_req_4_2(exch, NET_PACKET_CREATE_4, max_content, addr_len,
-	    max_prefix, max_suffix, &packet_id, &size);
-	async_exchange_end(exch);
-	
-	if (rc != EOK)
-		return NULL;
-	
-	packet_t *packet = pm_find(packet_id);
-	if (!packet) {
-		rc = packet_return(sess, &packet, packet_id, size);
-		if (rc != EOK)
-			return NULL;
-	}
-	
-	return packet;
-}
-
-/** Obtain the packet of given content size.
- *
- * Contact the packet server to return the appropriate packet.
- *
- * @param[in] sess    Packet server module session.
- * @param[in] content Maximal content length in bytes.
- *
- * @return The packet reference.
- * @return NULL on error.
- *
- */
-packet_t *packet_get_1_remote(async_sess_t *sess, size_t content)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	sysarg_t packet_id;
-	sysarg_t size;
-	int rc = async_req_1_2(exch, NET_PACKET_CREATE_1, content, &packet_id,
-	    &size);
-	async_exchange_end(exch);
-	
-	if (rc != EOK)
-		return NULL;
-	
-	packet_t *packet = pm_find(packet_id);
-	if (!packet) {
-		rc = packet_return(sess, &packet, packet_id, size);
-		if (rc != EOK)
-			return NULL;
-	}
-	
-	return packet;
-}
-
-/** Release the packet queue.
- *
- * All packets in the queue are marked as free for use.
- * The packet queue may be one packet only.
- * The module should not use the packets after this point until they are
- * received or obtained again.
- *
- * @param[in] sess      Packet server module session.
- * @param[in] packet_id Packet identifier.
- *
- */
-void pq_release_remote(async_sess_t *sess, packet_id_t packet_id)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	async_msg_1(exch, NET_PACKET_RELEASE, packet_id);
-	async_exchange_end(exch);
-}
-
-/** @}
- */
Index: uspace/lib/net/generic/protocol_map.c
===================================================================
--- uspace/lib/net/generic/protocol_map.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-#include <protocol_map.h>
-#include <ethernet_lsap.h>
-#include <ethernet_protocols.h>
-#include <net_hardware.h>
-
-#include <ipc/services.h>
-
-/** Maps the internetwork layer service to the network interface layer type.
- *
- * @param[in] nil	Network interface layer service.
- * @param[in] il	Internetwork layer service.
- * @return		Network interface layer type of the internetworking
- *			layer service.
- * @return		Zero if mapping is not found.
- */
-eth_type_t protocol_map(services_t nil, services_t il)
-{
-	switch (nil) {
-	case SERVICE_ETHERNET:
-	case SERVICE_NILDUMMY:
-		switch (il) {
-		case SERVICE_IP:
-			return ETH_P_IP;
-		case SERVICE_ARP:
-			return ETH_P_ARP;
-		default:
-			return 0;
-		}
-	default:
-		return 0;
-	}
-}
-
-/** Maps the network interface layer type to the internetwork layer service.
- *
- * @param[in] nil	Network interface layer service.
- * @param[in] protocol	Network interface layer type.
- * @return		Internetwork layer service of the network interface
- *			layer type.
- * @return		Zero if mapping is not found.
- */
-services_t protocol_unmap(services_t nil, int protocol)
-{
-	switch (nil) {
-	case SERVICE_ETHERNET:
-	case SERVICE_NILDUMMY:
-		switch (protocol) {
-		case ETH_P_IP:
-			return SERVICE_IP;
-		case ETH_P_ARP:
-			return SERVICE_ARP;
-		default:
-			return 0;
-		}
-	default:
-		return 0;
-	}
-}
-
-/** Maps the link service access point identifier to the Ethernet protocol
- * identifier.
- *
- * @param[in] lsap	Link service access point identifier.
- * @return		Ethernet protocol identifier of the link service access
- *			point identifier.
- * @return		ETH_LSAP_NULL if mapping is not found.
- */
-eth_type_t lsap_map(eth_lsap_t lsap)
-{
-	switch (lsap) {
-	case ETH_LSAP_IP:
-		return ETH_P_IP;
-	case ETH_LSAP_ARP:
-		return ETH_P_ARP;
-	default:
-		return ETH_LSAP_NULL;
-	}
-}
-
-/** Maps the Ethernet protocol identifier to the link service access point
- * identifier.
- *
- * @param[in] ethertype	Ethernet protocol identifier.
- * @return		Link service access point identifier.
- * @return		Zero if mapping is not found.
- */
-eth_lsap_t lsap_unmap(eth_type_t ethertype)
-{
-	switch (ethertype) {
-	case ETH_P_IP:
-		return ETH_LSAP_IP;
-	case ETH_P_ARP:
-		return ETH_LSAP_ARP;
-	default:
-		return 0;
-	}
-}
-
-/** Maps the network interface layer services to the hardware types.
- *
- * @param[in] nil	The network interface service.
- * @return		The hardware type of the network interface service.
- * @return		Zero if mapping is not found.
- */
-hw_type_t hardware_map(services_t nil)
-{
-	switch (nil) {
-	case SERVICE_ETHERNET:
-		return HW_ETHER;
-	default:
-		return 0;
-	}
-}
-
-/** @}
- */
Index: uspace/lib/net/il/arp_remote.c
===================================================================
--- uspace/lib/net/il/arp_remote.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,188 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * ARP interface implementation for remote modules.
- * @see arp_interface.h
- */
-
-#include <arp_interface.h>
-#include <generic.h>
-#include <ipc/services.h>
-#include <ipc/arp.h>
-#include <net/modules.h>
-#include <net/device.h>
-#include <adt/measured_strings.h>
-#include <async.h>
-#include <errno.h>
-
-/** Connect to the ARP module.
- *
- * @return ARP module session on success.
- *
- */
-async_sess_t *arp_connect_module(services_t service)
-{
-	// FIXME: Get rid of the useless argument
-	return connect_to_service(SERVICE_ARP);
-}
-
-/** Cleans the cache.
- *
- * @param[in] sess ARP module session.
- *
- * @return EOK on success.
- *
- */
-int arp_clean_cache_req(async_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	int rc = async_req_0_0(exch, NET_ARP_CLEAN_CACHE);
-	async_exchange_end(exch);
-	
-	return rc;
-}
-
-/** Clear the given protocol address from the cache.
- *
- * @param[in] sess      ARP module session.
- * @param[in] device_id Device identifier.
- * @param[in] protocol  Requesting protocol service.
- * @param[in] address   Protocol address to be cleared.
- *
- * @return EOK on success.
- * @return ENOENT if the mapping is not found.
- *
- */
-int arp_clear_address_req(async_sess_t *sess, nic_device_id_t device_id,
-    services_t protocol, measured_string_t *address)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	aid_t message_id = async_send_2(exch, NET_ARP_CLEAR_ADDRESS,
-	    (sysarg_t) device_id, protocol, NULL);
-	measured_strings_send(exch, address, 1);
-	async_exchange_end(exch);
-	
-	sysarg_t result;
-	async_wait_for(message_id, &result);
-	
-	return (int) result;
-}
-
-/** Clear the device cache.
- *
- * @param[in] sess      ARP module session.
- * @param[in] device_id Device identifier.
- *
- * @return EOK on success.
- * @return ENOENT if the device is not found.
- *
- */
-int arp_clear_device_req(async_sess_t *sess, nic_device_id_t device_id)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	int rc = async_req_1_0(exch, NET_ARP_CLEAR_DEVICE,
-	    (sysarg_t) device_id);
-	async_exchange_end(exch);
-	
-	return rc;
-}
-
-/** Register new device and the requesting protocol service.
- *
- * Connect to the network interface layer service.
- * Determine the device broadcast address, its address lengths and packet size.
- *
- * @param[in] sess      ARP module session.
- * @param[in] device_id New device identifier.
- * @param[in] protocol  Requesting protocol service.
- * @param[in] netif     Underlying device network interface layer service.
- * @param[in] address   Local requesting protocol address of the device.
- *
- * @return EOK on success.
- * @return EEXIST if the device is already used.
- * @return ENOMEM if there is not enough memory left.
- * @return ENOENT if the network interface service is not known.
- * @return EREFUSED if the network interface service is not
- *         responding.
- * @return Other error codes as defined for the
- *         nil_packet_get_size() function.
- * @return Other error codes as defined for the nil_get_addr()
- *         function.
- * @return Other error codes as defined for the
- *         nil_get_broadcast_addr() function.
- *
- */
-int arp_device_req(async_sess_t *sess, nic_device_id_t device_id,
-    services_t protocol, services_t netif, measured_string_t *address)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	aid_t message_id = async_send_3(exch, NET_ARP_DEVICE,
-	    (sysarg_t) device_id, protocol, netif, NULL);
-	measured_strings_send(exch, address, 1);
-	async_exchange_end(exch);
-	
-	sysarg_t result;
-	async_wait_for(message_id, &result);
-
-	return (int) result;
-}
-
-/** Translate the given protocol address to the network interface address.
- *
- * Broadcast the ARP request if the mapping is not found.
- * Allocate and returns the needed memory block as the data parameter.
- *
- * @param[in]  sess        ARP module session.
- * @param[in]  device_id   Device identifier.
- * @param[in]  protocol    Requesting protocol service.
- * @param[in]  address     Local requesting protocol address.
- * @param[out] translation Translation of the local protocol address.
- * @param[out] data        Allocated raw translation data container.
- *
- * @return EOK on success.
- * @return EINVAL if the address parameter is NULL.
- * @return EBADMEM if the translation or the data parameters are
- *         NULL.
- * @return ENOENT if the mapping is not found.
- *
- */
-int arp_translate_req(async_sess_t *sess, nic_device_id_t device_id,
-    services_t protocol, measured_string_t *address,
-    measured_string_t **translation, uint8_t **data)
-{
-	return generic_translate_req(sess, NET_ARP_TRANSLATE, device_id,
-	    protocol, address, 1, translation, data);
-}
-
-/** @}
- */
Index: uspace/lib/net/il/il_remote.c
===================================================================
--- uspace/lib/net/il/il_remote.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Internetwork layer module interface for the underlying network interface
- * layer.
- */
-
-#include <il_remote.h>
-#include <generic.h>
-#include <packet_client.h>
-#include <ipc/services.h>
-#include <ipc/il.h>
-#include <net/device.h>
-#include <net/packet.h>
-
-/** Notify the internetwork layer modules about the device state change.
- *
- * @param[in] sess      Internetwork layer module session.
- * @param[in] device_id Device identifier.
- * @param[in] state     New device state.
- * @param[in] target    Target internetwork module service to be
- *                      delivered to.
- *
- * @return EOK on success.
- *
- */
-int il_device_state_msg(async_sess_t *sess, nic_device_id_t device_id,
-    nic_device_state_t state, services_t target)
-{
-	return generic_device_state_msg_remote(sess, NET_IL_DEVICE_STATE,
-	    device_id, state, target);
-}
-
-/** Notify the internetwork layer modules about the received packet/s.
- *
- * @param[in] sess      Internetwork layer module session.
- * @param[in] device_id Device identifier.
- * @param[in] packet    Received packet or the received packet queue.
- * @param[in] target    Target internetwork module service to be
- *                      delivered to.
- *
- * @return EOK on success.
- *
- */
-int il_received_msg(async_sess_t *sess, nic_device_id_t device_id,
-    packet_t *packet, services_t target)
-{
-	return generic_received_msg_remote(sess, NET_IL_RECEIVED, device_id,
-	    packet_get_id(packet), target, 0);
-}
-
-/** Notify the internetwork layer modules about the mtu change.
- *
- * @param[in] sess      Internetwork layer module session.
- * @param[in] device_id Device identifier.
- * @param[in] mtu       New MTU value.
- * @param[in] target    Target internetwork module service to be
- *                      delivered to.
- *
- * @return EOK on success.
- *
- */
-int il_mtu_changed_msg(async_sess_t *sess, nic_device_id_t device_id, size_t mtu,
-    services_t target)
-{
-	return generic_device_state_msg_remote(sess, NET_IL_MTU_CHANGED,
-	    device_id, mtu, target);
-}
-
-/** Notify IL layer modules about address change (implemented by ARP)
- *
- */
-int il_addr_changed_msg(async_sess_t *sess, nic_device_id_t device_id,
-    size_t addr_len, const uint8_t *address)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	
-	aid_t message_id = async_send_1(exch, NET_IL_ADDR_CHANGED,
-			(sysarg_t) device_id, NULL);
-	int rc = async_data_write_start(exch, address, addr_len);
-	
-	async_exchange_end(exch);
-	
-	sysarg_t res;
-    async_wait_for(message_id, &res);
-    if (rc != EOK)
-		return rc;
-	
-    return (int) res;
-}
-
-/** @}
- */
Index: uspace/lib/net/il/il_skel.c
===================================================================
--- uspace/lib/net/il/il_skel.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Internetworking layer module skeleton implementation.
- * @see il_skel.h
- */
-
-#include <bool.h>
-#include <errno.h>
-#include <ns.h>
-#include <il_skel.h>
-#include <net_interface.h>
-#include <net/modules.h>
-
-/** Default thread for new connections.
- *
- * @param[in] iid   The initial message identifier.
- * @param[in] icall The initial message call structure.
- *
- */
-static void il_client_connection(ipc_callid_t iid, ipc_call_t *icall,
-    void *arg)
-{
-	/*
-	 * Accept the connection by answering
-	 * the initial IPC_M_CONNECT_ME_TO call.
-	 */
-	async_answer_0(iid, EOK);
-	
-	while (true) {
-		ipc_call_t answer;
-		size_t count;
-		
-		/* Clear the answer structure */
-		refresh_answer(&answer, &count);
-		
-		/* Fetch the next message */
-		ipc_call_t call;
-		ipc_callid_t callid = async_get_call(&call);
-		
-		/* Process the message */
-		int res = il_module_message(callid, &call, &answer,
-		    &count);
-		
-		/*
-		 * End if told to either by the message or the processing
-		 * result.
-		 */
-		if ((!IPC_GET_IMETHOD(call)) || (res == EHANGUP))
-			return;
-		
-		/* Answer the message */
-		answer_call(callid, res, &answer, count);
-	}
-}
-
-/** Start the internetworking layer module.
- *
- * Initialize the client connection serving function, initialize
- * the module, register the module service and start the async
- * manager, processing IPC messages in an infinite loop.
- *
- * @param[in] service Service identification.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the pm_init() function.
- * @return Other error codes as defined for the il_initialize()
- *         function.
- *
- */
-int il_module_start(sysarg_t service)
-{
-	async_set_client_connection(il_client_connection);
-	async_sess_t *sess = net_connect_module();
-	if (!sess)
-		return ENOENT;
-	
-	int rc = pm_init();
-	if (rc != EOK)
-		return rc;
-	
-	rc = il_initialize(sess);
-	if (rc != EOK)
-		goto out;
-	
-	rc = service_register(service);
-	if (rc != EOK)
-		goto out;
-	
-	async_manager();
-	
-out:
-	pm_destroy();
-	return rc;
-}
-
-/** @}
- */
Index: uspace/lib/net/il/ip_client.c
===================================================================
--- uspace/lib/net/il/ip_client.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,268 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * IP client interface implementation.
- * @see ip_client.h
- */
-
-#include <errno.h>
-#include <sys/types.h>
-
-#include <ip_client.h>
-#include <packet_client.h>
-#include <ip_header.h>
-
-#include <net/packet.h>
-
-/** Returns the IP header length.
- *
- * @param[in] packet	The packet.
- * @return		The IP header length in bytes.
- * @return		Zero if there is no IP header.
- */
-size_t ip_client_header_length(packet_t *packet)
-{
-	ip_header_t *header;
-
-	header = (ip_header_t *) packet_get_data(packet);
-	if (!header || (packet_get_data_length(packet) < sizeof(ip_header_t)))
-		return 0;
-
-	return IP_HEADER_LENGTH(header);
-}
-
-/** Constructs the IPv4 pseudo header.
- *
- * @param[in] protocol	The transport protocol.
- * @param[in] src	The source address.
- * @param[in] srclen	The source address length.
- * @param[in] dest	The destination address.
- * @param[in] destlen	The destination address length.
- * @param[in] data_length The data length to be set.
- * @param[out] header	The constructed IPv4 pseudo header.
- * @param[out] headerlen The length of the IP pseudo header in bytes.
- * @return		EOK on success.
- * @return		EBADMEM if the header and/or the headerlen parameter is
- *			NULL.
- * @return		EINVAL if the source address and/or the destination
- *			address parameter is NULL.
- * @return		EINVAL if the source address length is less than struct
- *			sockaddr length.
- * @return		EINVAL if the source address length differs from the
- *			destination address length.
- * @return		EINVAL if the source address family differs from the
- *			destination family.
- * @return		EAFNOSUPPORT if the address family is not supported.
- * @return		ENOMEM if there is not enough memory left.
- */
-int
-ip_client_get_pseudo_header(ip_protocol_t protocol, struct sockaddr *src,
-    socklen_t srclen, struct sockaddr *dest, socklen_t destlen,
-    size_t data_length, void **header, size_t *headerlen)
-{
-	ipv4_pseudo_header_t *header_in;
-	struct sockaddr_in *address_in;
-
-	if (!header || !headerlen)
-		return EBADMEM;
-
-	if (!src || !dest || srclen <= 0 ||
-	    (((size_t) srclen < sizeof(struct sockaddr))) ||
-	    (srclen != destlen) || (src->sa_family != dest->sa_family)) {
-		return EINVAL;
-	}
-
-	switch (src->sa_family) {
-	case AF_INET:
-		if (srclen != sizeof(struct sockaddr_in))
-			return EINVAL;
-		
-		*headerlen = sizeof(*header_in);
-		header_in = (ipv4_pseudo_header_t *) malloc(*headerlen);
-		if (!header_in)
-			return ENOMEM;
-
-		bzero(header_in, *headerlen);
-		address_in = (struct sockaddr_in *) dest;
-		header_in->destination_address = address_in->sin_addr.s_addr;
-		address_in = (struct sockaddr_in *) src;
-		header_in->source_address = address_in->sin_addr.s_addr;
-		header_in->protocol = protocol;
-		header_in->data_length = htons(data_length);
-		*header = header_in;
-		return EOK;
-
-	// TODO IPv6
-#if 0
-	case AF_INET6:
-		if (addrlen != sizeof(struct sockaddr_in6))
-			return EINVAL;
-
-		address_in6 = (struct sockaddr_in6 *) addr;
-		return EOK;
-#endif
-
-	default:
-		return EAFNOSUPPORT;
-	}
-}
-
-/** Prepares the packet to be transfered via IP.
- *
- * The IP header is prefixed.
- *
- * @param[in,out] packet The packet to be prepared.
- * @param[in] protocol	The transport protocol.
- * @param[in] ttl	The time to live counter. The IPDEFTTL is set if zero.
- * @param[in] tos	The type of service.
- * @param[in] dont_fragment The value indicating whether fragmentation is
- *			disabled.
- * @param[in] ipopt_length The prefixed IP options length in bytes.
- * @return		EOK on success.
- * @return		ENOMEM if there is not enough memory left in the packet.
- */
-int
-ip_client_prepare_packet(packet_t *packet, ip_protocol_t protocol, ip_ttl_t ttl,
-    ip_tos_t tos, int dont_fragment, size_t ipopt_length)
-{
-	ip_header_t *header;
-	uint8_t *data;
-	size_t padding;
-
-	/*
-	 * Compute the padding if IP options are set
-	 * multiple of 4 bytes
-	 */
-	padding =  ipopt_length % 4;
-	if (padding) {
-		padding = 4 - padding;
-		ipopt_length += padding;
-	}
-
-	/* Prefix the header */
-	data = (uint8_t *) packet_prefix(packet, sizeof(ip_header_t) + padding);
-	if (!data)
-		return ENOMEM;
-
-	/* Add the padding */
-	while (padding--)
-		data[sizeof(ip_header_t) + padding] = IPOPT_NOOP;
-
-	/* Set the header */
-	header = (ip_header_t *) data;
-	SET_IP_HEADER_LENGTH(header,
-	    (IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) + ipopt_length)));
-	header->ttl = (ttl ? ttl : IPDEFTTL);
-	header->tos = tos;
-	header->protocol = protocol;
-
-	if (dont_fragment)
-		SET_IP_HEADER_FLAGS(header, IPFLAG_DONT_FRAGMENT);
-
-	return EOK;
-}
-
-/** Processes the received IP packet.
- *
- * Fills set header fields.
- * Returns the prefixed IP header length.
- *
- * @param[in] packet	The received packet.
- * @param[out] protocol	The transport protocol. May be NULL if not desired.
- * @param[out] ttl	The time to live counter. May be NULL if not desired.
- * @param[out] tos	The type of service. May be NULL if not desired.
- * @param[out] dont_fragment The value indicating whether the fragmentation is
- *			disabled. May be NULL if not desired.
- * @param[out] ipopt_length The IP options length in bytes. May be NULL if not
- *			desired.
- * @return		The prefixed IP header length in bytes on success.
- * @return		ENOMEM if the packet is too short to contain the IP
- *			header.
- */
-int
-ip_client_process_packet(packet_t *packet, ip_protocol_t *protocol,
-    ip_ttl_t *ttl, ip_tos_t *tos, int *dont_fragment, size_t *ipopt_length)
-{
-	ip_header_t *header;
-
-	header = (ip_header_t *) packet_get_data(packet);
-	if (!header || (packet_get_data_length(packet) < sizeof(ip_header_t)))
-		return ENOMEM;
-
-	if (protocol)
-		*protocol = header->protocol;
-	if (ttl)
-		*ttl = header->ttl;
-	if (tos)
-		*tos = header->tos;
-	if (dont_fragment)
-		*dont_fragment = GET_IP_HEADER_FLAGS(header) & IPFLAG_DONT_FRAGMENT;
-	if (ipopt_length) {
-		*ipopt_length = IP_HEADER_LENGTH(header) - sizeof(ip_header_t);
-		return sizeof(ip_header_t);
-	} else {
-		return IP_HEADER_LENGTH(header);
-	}
-}
-
-/** Updates the IPv4 pseudo header data length field.
- *
- * @param[in,out] header The IPv4 pseudo header to be updated.
- * @param[in] headerlen	The length of the IP pseudo header in bytes.
- * @param[in] data_length The data length to be set.
- * @return		EOK on success.
- * @return		EBADMEM if the header parameter is NULL.
- * @return		EINVAL if the headerlen parameter is not IPv4 pseudo
- *			header length.
- */
-int
-ip_client_set_pseudo_header_data_length(void *header, size_t headerlen,
-    size_t data_length)
-{
-	ipv4_pseudo_header_t *header_in;
-
-	if (!header)
-		return EBADMEM;
-
-	if (headerlen == sizeof(ipv4_pseudo_header_t)) {
-		header_in = (ipv4_pseudo_header_t *) header;
-		header_in->data_length = htons(data_length);
-		return EOK;
-	// TODO IPv6
-	} else {
-		return EINVAL;
-	}
-}
-
-/** @}
- */
Index: uspace/lib/net/il/ip_remote.c
===================================================================
--- uspace/lib/net/il/ip_remote.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,270 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- *
- * IP interface implementation for remote modules.
- *
- * @see ip_interface.h
- * @see il_remote.h
- *
- */
-
-#include <ip_remote.h>
-#include <ip_interface.h>
-#include <packet_client.h>
-#include <generic.h>
-#include <ipc/services.h>
-#include <ipc/il.h>
-#include <ipc/ip.h>
-#include <net/modules.h>
-#include <net/device.h>
-#include <net/inet.h>
-
-/** Add a route to the device routing table.
- *
- * The target network is routed using this device.
- *
- * @param[in] sess      IP module sessions.
- * @param[in] device_id Device identifier.
- * @param[in] address   Target network address.
- * @param[in] netmask   Target network mask.
- * @param[in] gateway   Target network gateway. Not used if zero.
- *
- */
-int ip_add_route_req_remote(async_sess_t *sess, nic_device_id_t device_id,
-    in_addr_t address, in_addr_t netmask, in_addr_t gateway)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	int rc = async_req_4_0(exch, NET_IP_ADD_ROUTE,
-	    (sysarg_t) device_id, (sysarg_t) gateway.s_addr,
-	    (sysarg_t) address.s_addr, (sysarg_t) netmask.s_addr);
-	async_exchange_end(exch);
-	
-	return rc;
-}
-
-/** Create bidirectional connection with the ip module service and register
- * the message receiver.
- *
- * @param[in] service  IP module service.
- * @param[in] protocol Transport layer protocol.
- * @param[in] me       Rquesting module service.
- * @param[in] receiver Message receiver. Used for remote connection.
- *
- * @return Session to the needed service.
- * @return NULL on failure.
- *
- */
-async_sess_t *ip_bind_service(services_t service, int protocol, services_t me,
-    async_client_conn_t receiver)
-{
-	return bind_service(service, (sysarg_t) protocol, me, service,
-	    receiver);
-}
-
-/** Connect to the IP module.
- *
- * @return The IP module session.
- *
- */
-async_sess_t *ip_connect_module(services_t service)
-{
-	// FIXME: Get rid of the useless argument
-	return connect_to_service(SERVICE_IP);
-}
-
-/** Register the new device.
- *
- * Register itself as the ip packet receiver.
- * If the device uses ARP registers also the new ARP device.
- *
- * @param[in] sess      IP module session.
- * @param[in] device_id New device identifier.
- *
- * @return EOK on success.
- * @return ENOMEM if there is not enough memory left.
- * @return EINVAL if the device configuration is invalid.
- * @return ENOTSUP if the device uses IPv6.
- * @return ENOTSUP if the device uses DHCP.
- * @return Other error codes as defined for the
- *         net_get_device_conf_req() function.
- * @return Other error codes as defined for the arp_device_req()
- *         function.
- *
- */
-int ip_device_req(async_sess_t *sess, nic_device_id_t device_id,
-    services_t service)
-{
-	return generic_device_req_remote(sess, NET_IP_DEVICE, device_id,
-	    service);
-}
-
-/** Return the device identifier and the IP pseudo header based on the
- * destination address.
- *
- * @param[in] sess        IP module session.
- * @param[in] protocol    Transport protocol.
- * @param[in] destination Destination address.
- * @param[in] addrlen     Destination address length.
- * @param[out] device_id  Device identifier.
- * @param[out] header     Constructed IP pseudo header.
- * @param[out] headerlen  IP pseudo header length.
- *
- */
-int ip_get_route_req_remote(async_sess_t *sess, ip_protocol_t protocol,
-    const struct sockaddr *destination, socklen_t addrlen,
-    nic_device_id_t *device_id, void **header, size_t *headerlen)
-{
-	if ((!destination) || (addrlen == 0))
-		return EINVAL;
-	
-	if ((!device_id) || (!header) || (!headerlen))
-		return EBADMEM;
-	
-	*header = NULL;
-	
-	async_exch_t *exch = async_exchange_begin(sess);
-	
-	ipc_call_t answer;
-	aid_t message_id = async_send_1(exch, NET_IP_GET_ROUTE,
-	    (sysarg_t) protocol, &answer);
-	
-	if ((async_data_write_start(exch, destination, addrlen) == EOK) &&
-	    (async_data_read_start(exch, headerlen, sizeof(*headerlen)) == EOK) &&
-	    (*headerlen > 0)) {
-		*header = malloc(*headerlen);
-		if (*header) {
-			if (async_data_read_start(exch, *header,
-			    *headerlen) != EOK)
-				free(*header);
-		}
-	}
-	
-	async_exchange_end(exch);
-	
-	sysarg_t result;
-	async_wait_for(message_id, &result);
-	
-	if ((result != EOK) && *header)
-		free(*header);
-	else
-		*device_id = IPC_GET_DEVICE(answer);
-	
-	return (int) result;
-}
-
-/** Return the device packet dimension for sending.
- *
- * @param[in] sess              IP module session.
- * @param[in] device_id         Device identifier.
- * @param[out] packet_dimension Packet dimension.
- *
- * @return EOK on success.
- * @return ENOENT if there is no such device.
- * @return Other error codes as defined for the
- *         generic_packet_size_req_remote() function.
- *
- */
-int ip_packet_size_req_remote(async_sess_t *sess, nic_device_id_t device_id,
-    packet_dimension_t *packet_dimension)
-{
-	return generic_packet_size_req_remote(sess, NET_IP_PACKET_SPACE,
-	    device_id, packet_dimension);
-}
-
-/** Notify the IP module about the received error notification packet.
- *
- * @param[in] sess      IP module session.
- * @param[in] device_id Device identifier.
- * @param[in] packet    Received packet or the received packet queue.
- * @param[in] target    Target internetwork module service to be
- *                      delivered to.
- * @param[in] error     Packet error reporting service. Prefixes the
- *                      received packet.
- *
- * @return EOK on success.
- *
- */
-int ip_received_error_msg_remote(async_sess_t *sess, nic_device_id_t device_id,
-    packet_t *packet, services_t target, services_t error)
-{
-	return generic_received_msg_remote(sess, NET_IP_RECEIVED_ERROR,
-	    device_id, packet_get_id(packet), target, error);
-}
-
-/** Send the packet queue.
- *
- * The packets may get fragmented if needed.
- *
- * @param[in] sess      IP module session.
- * @param[in] device_id Device identifier.
- * @param[in] packet    Packet fragments as a packet queue. All the
- *                      packets have to have the same destination address.
- * @param[in] sender    Sending module service.
- * @param[in] error     Packet error reporting service. Prefixes the
- *                      received packet.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the generic_send_msg()
- *         function.
- *
- */
-int ip_send_msg_remote(async_sess_t *sess, nic_device_id_t device_id,
-    packet_t *packet, services_t sender, services_t error)
-{
-	return generic_send_msg_remote(sess, NET_IP_SEND, device_id,
-	    packet_get_id(packet), sender, error);
-}
-
-/** Set the default gateway.
- *
- * This gateway is used if no other route is found.
- *
- * @param[in] sess      IP module session.
- * @param[in] device_id Device identifier.
- * @param[in] gateway   Default gateway.
- *
- */
-int ip_set_gateway_req_remote(async_sess_t *sess, nic_device_id_t device_id,
-    in_addr_t gateway)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	int rc = async_req_2_0(exch, NET_IP_SET_GATEWAY,
-	    (sysarg_t) device_id, (sysarg_t) gateway.s_addr);
-	async_exchange_end(exch);
-	
-	return rc;
-}
-
-/** @}
- */
Index: uspace/lib/net/include/adt/module_map.h
===================================================================
--- uspace/lib/net/include/adt/module_map.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(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 libnet
- * @{
- */
-
-/** @file
- * Character string to module map.
- */
-
-#ifndef LIBNET_MODULES_MAP_H_
-#define LIBNET_MODULES_MAP_H_
-
-#include <task.h>
-#include <async.h>
-#include <net/modules.h>
-#include <adt/generic_char_map.h>
-
-/** Type definition of the module structure.
- * @see module_struct
- */
-typedef struct module_struct module_t;
-
-/** Module map.
- * Sorted by module names.
- * @see generic_char_map.h
- */
-GENERIC_CHAR_MAP_DECLARE(modules, module_t)
-
-/** Module structure. */
-struct module_struct {
-	/** Module task identifier if running. */
-	task_id_t task_id;
-	/** Module service identifier. */
-	services_t service;
-	/** Module session if running and connected. */
-	async_sess_t *sess;
-	/** Usage counter. */
-	int usage;
-	/** Module name. */
-	const uint8_t *name;
-	/** Module full path filename. */
-	const uint8_t *filename;
-	/** Connecting function. */
-	connect_module_t *connect_module;
-};
-
-extern int add_module(module_t **, modules_t *, const uint8_t *,
-    const uint8_t *, services_t, task_id_t, connect_module_t *);
-extern module_t *get_running_module(modules_t *, uint8_t *);
-extern task_id_t net_spawn(const uint8_t *);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/arp_interface.h
===================================================================
--- uspace/lib/net/include/arp_interface.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(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 libnet
- * @{
- */
-
-#ifndef LIBNET_ARP_INTERFACE_H_
-#define LIBNET_ARP_INTERFACE_H_
-
-#include <adt/measured_strings.h>
-#include <task.h>
-#include <ipc/services.h>
-#include <net/device.h>
-#include <net/socket.h>
-#include <async.h>
-
-/** @name ARP module interface
- * This interface is used by other modules.
- */
-/*@{*/
-
-extern int arp_device_req(async_sess_t *, nic_device_id_t, services_t, services_t,
-    measured_string_t *);
-extern int arp_translate_req(async_sess_t *, nic_device_id_t, services_t,
-    measured_string_t *, measured_string_t **, uint8_t **);
-extern int arp_clear_device_req(async_sess_t *, nic_device_id_t);
-extern int arp_clear_address_req(async_sess_t *, nic_device_id_t, services_t,
-    measured_string_t *);
-extern int arp_clean_cache_req(async_sess_t *);
-extern async_sess_t *arp_connect_module(services_t);
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/ethernet_lsap.h
===================================================================
--- uspace/lib/net/include/ethernet_lsap.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Link service access point identifiers.
- */
-
-#ifndef LIBNET_ETHERNET_LSAP_H_
-#define LIBNET_ETHERNET_LSAP_H_
-
-#include <sys/types.h>
-
-/** Ethernet LSAP type definition. */
-typedef uint8_t eth_lsap_t;
-
-/** @name Ethernet LSAP values definitions */
-/*@{*/
-
-/** Null LSAP LSAP identifier. */
-#define ETH_LSAP_NULL	0x00
-/** ARPANET Internet Protocol (IP) LSAP identifier. */
-#define ETH_LSAP_IP	0x06
-/** ARPANET Address Resolution Protocol (ARP) LSAP identifier. */
-#define ETH_LSAP_ARP	0x98
-/** SubNetwork Access Protocol (SNAP) LSAP identifier. */
-#define ETH_LSAP_SNAP	0xAA
-/** Global LSAP LSAP identifier. */
-#define ETH_LSAP_GLSAP	0xFF
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/ethernet_protocols.h
===================================================================
--- uspace/lib/net/include/ethernet_protocols.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Ethernet protocol numbers according to the on-line IANA - Ethernet numbers
- * http://www.iana.org/assignments/ethernet-numbers
- * cited January 17 2009.
- */
-
-#ifndef LIBNET_ETHERNET_PROTOCOLS_H_
-#define LIBNET_ETHERNET_PROTOCOLS_H_
-
-#include <sys/types.h>
-
-/** Ethernet protocol type definition. */
-typedef uint16_t eth_type_t;
-
-/** @name Ethernet protocols definitions */
-/*@{*/
-
-/** Ethernet minimal protocol number.
- * According to the IEEE 802.3 specification.
- */
-#define ETH_MIN_PROTO		0x0600 /* 1536 */
-
-/** Internet IP (IPv4) ethernet protocol type. */
-#define ETH_P_IP		0x0800
-
-/** ARP ethernet protocol type. */
-#define ETH_P_ARP		0x0806
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/generic.h
===================================================================
--- uspace/lib/net/include/generic.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Generic communication interfaces for networking.
- */
-
-#ifndef LIBNET_GENERIC_H_
-#define LIBNET_GENERIC_H_
-
-#include <ipc/services.h>
-#include <net/device.h>
-#include <adt/measured_strings.h>
-#include <net/packet.h>
-#include <async.h>
-
-extern int generic_device_state_msg_remote(async_sess_t *, sysarg_t,
-    nic_device_id_t, sysarg_t, services_t);
-extern int generic_device_req_remote(async_sess_t *, sysarg_t, nic_device_id_t,
-    services_t);
-extern int generic_get_addr_req(async_sess_t *, sysarg_t, nic_device_id_t,
-    uint8_t *address, size_t max_length);
-extern int generic_packet_size_req_remote(async_sess_t *, sysarg_t,
-    nic_device_id_t, packet_dimension_t *);
-extern int generic_received_msg_remote(async_sess_t *, sysarg_t,
-    nic_device_id_t, packet_id_t, services_t, services_t);
-extern int generic_send_msg_remote(async_sess_t *, sysarg_t, nic_device_id_t,
-    packet_id_t, services_t, services_t);
-extern int generic_translate_req(async_sess_t *, sysarg_t, nic_device_id_t,
-    services_t, measured_string_t *, size_t, measured_string_t **, uint8_t **);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/icmp_client.h
===================================================================
--- uspace/lib/net/include/icmp_client.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * ICMP client interface.
- */
-
-#ifndef LIBNET_ICMP_CLIENT_H_
-#define LIBNET_ICMP_CLIENT_H_
-
-#include <net/icmp_codes.h>
-#include <net/packet.h>
-
-extern int icmp_client_process_packet(packet_t *, icmp_type_t *, icmp_code_t *,
-    icmp_param_t *, icmp_param_t *);
-extern size_t icmp_client_header_length(packet_t *);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/icmp_header.h
===================================================================
--- uspace/lib/net/include/icmp_header.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,104 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- *  @{
- */
-
-/** @file
- * ICMP header definition.
- * Based on the RFC 792.
- */
-
-#ifndef LIBNET_ICMP_HEADER_H_
-#define LIBNET_ICMP_HEADER_H_
-
-#include <sys/types.h>
-
-#include <net/in.h>
-#include <net/icmp_codes.h>
-
-/** ICMP header size in bytes. */
-#define ICMP_HEADER_SIZE  sizeof(icmp_header_t)
-
-/** Echo specific data. */
-typedef struct icmp_echo {
-	/** Message idintifier. */
-	icmp_param_t identifier;
-	/** Message sequence number. */
-	icmp_param_t sequence_number;
-} __attribute__((packed)) icmp_echo_t;
-
-/** Internet control message header. */
-typedef struct icmp_header {
-	/** The type of the message. */
-	uint8_t type;
-	
-	/**
-	 * The error code for the datagram reported by the ICMP message.
-	 * The interpretation is dependent on the message type.
-	 */
-	uint8_t code;
-	
-	/**
-	 * The checksum is the 16-bit ones's complement of the one's complement
-	 * sum of the ICMP message starting with the ICMP Type. For computing
-	 * the checksum, the checksum field should be zero. If the checksum does
-	 * not match the contents, the datagram is discarded.
-	 */
-	uint16_t checksum;
-	
-	/** Message specific data. */
-	union {
-		/** Echo specific data. */
-		icmp_echo_t echo;
-		/** Proposed gateway value. */
-		in_addr_t gateway;
-		
-		/** Fragmentation needed specific data. */
-		struct {
-			/** Reserved field. Must be zero. */
-			icmp_param_t reserved;
-			/** Proposed MTU. */
-			icmp_param_t mtu;
-		} frag;
-		
-		/** Parameter problem specific data. */
-		struct {
-			/** Problem pointer. */
-			icmp_param_t pointer;
-			/** Reserved field. Must be zero. */
-			icmp_param_t reserved;
-		} param;
-	} un;
-} __attribute__((packed)) icmp_header_t;
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/icmp_remote.h
===================================================================
--- uspace/lib/net/include/icmp_remote.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- *  @{
- */
-
-#ifndef LIBNET_ICMP_REMOTE_H_
-#define LIBNET_ICMP_REMOTE_H_
-
-#include <net/socket_codes.h>
-#include <sys/types.h>
-#include <net/device.h>
-#include <adt/measured_strings.h>
-#include <net/packet.h>
-#include <net/inet.h>
-#include <net/ip_codes.h>
-#include <net/icmp_codes.h>
-#include <net/icmp_common.h>
-#include <async.h>
-
-/** @name ICMP module interface
- * This interface is used by other modules.
- */
-/*@{*/
-
-extern int icmp_destination_unreachable_msg(async_sess_t *, icmp_code_t,
-    icmp_param_t, packet_t *);
-extern int icmp_source_quench_msg(async_sess_t *, packet_t *);
-extern int icmp_time_exceeded_msg(async_sess_t *, icmp_code_t, packet_t *);
-extern int icmp_parameter_problem_msg(async_sess_t *, icmp_code_t, icmp_param_t,
-    packet_t *);
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/il_remote.h
===================================================================
--- uspace/lib/net/include/il_remote.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Internetwork layer module interface for the underlying network interface
- * layer. This interface is always called by the remote modules.
- */
-
-#ifndef LIBNET_IL_REMOTE_H_
-#define LIBNET_IL_REMOTE_H_
-
-#include <ipc/services.h>
-#include <sys/types.h>
-#include <net/device.h>
-#include <net/packet.h>
-#include <async.h>
-
-/** @name Internetwork layer module interface
- * This interface is used by other modules.
- */
-/*@{*/
-
-extern int il_device_state_msg(async_sess_t *, nic_device_id_t,
-    nic_device_state_t, services_t);
-extern int il_received_msg(async_sess_t *, nic_device_id_t, packet_t *,
-    services_t);
-extern int il_mtu_changed_msg(async_sess_t *, nic_device_id_t, size_t,
-    services_t);
-extern int il_addr_changed_msg(async_sess_t *, nic_device_id_t, size_t,
-    const uint8_t *);
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/il_skel.h
===================================================================
--- uspace/lib/net/include/il_skel.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-#ifndef LIBNET_IL_SKEL_H_
-#define LIBNET_IL_SKEL_H_
-
-/** @file
- * Internetwork layer module skeleton.
- * The skeleton has to be part of each internetwork layer module.
- */
-
-#include <ipc/services.h>
-#include <adt/measured_strings.h>
-#include <net/device.h>
-#include <net/packet.h>
-#include <async.h>
-
-/** Module initialization.
- *
- * This has to be implemented in user code.
- *
- * @param[in] sess Networking module session.
- *
- * @return EOK on success.
- * @return Other error codes as defined for each specific module
- *         initialize function.
- *
- */
-extern int il_initialize(async_sess_t *sess);
-
-/** Process the internetwork layer module message.
- *
- * This has to be implemented in user code.
- *
- * @param[in]  callid Message identifier.
- * @param[in]  call   Message parameters.
- * @param[out] answer Answer.
- * @param[out] count  Number of arguments of the answer.
- *
- * @return EOK on success.
- * @return Other error codes as defined for each specific module.
- *
- */
-extern int il_module_message(ipc_callid_t callid, ipc_call_t *call,
-    ipc_call_t *answer, size_t *answer_count);
-
-extern int il_module_start(sysarg_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/ip_client.h
===================================================================
--- uspace/lib/net/include/ip_client.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * IP client interface.
- */
-
-#ifndef LIBNET_IP_CLIENT_H_
-#define LIBNET_IP_CLIENT_H_
-
-#include <net/socket_codes.h>
-#include <sys/types.h>
-
-#include <net/packet.h>
-#include <net/ip_codes.h>
-#include <ip_interface.h>
-
-extern int ip_client_prepare_packet(packet_t *, ip_protocol_t, ip_ttl_t,
-    ip_tos_t, int, size_t);
-extern int ip_client_process_packet(packet_t *, ip_protocol_t *, ip_ttl_t *,
-    ip_tos_t *, int *, size_t *);
-extern size_t ip_client_header_length(packet_t *);
-extern int ip_client_set_pseudo_header_data_length(void *, size_t, size_t);
-extern int ip_client_get_pseudo_header(ip_protocol_t, struct sockaddr *,
-    socklen_t, struct sockaddr *, socklen_t, size_t, void **, size_t *);
-
-// TODO ipopt manipulation
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/ip_header.h
===================================================================
--- uspace/lib/net/include/ip_header.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,223 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet 
- * @{
- */
-
-/** @file
- * IP header and options definitions.
- * Based on the RFC 791.
- */
-
-#ifndef LIBNET_IP_HEADER_H_
-#define LIBNET_IP_HEADER_H_
-
-#include <byteorder.h>
-#include <sys/types.h>
-
-/** Returns the fragment offest high bits.
- * @param[in] length The prefixed data total length.
- */
-#define IP_COMPUTE_FRAGMENT_OFFSET_HIGH(length) \
-	((((length) / 8U) & 0x1f00) >> 8)
-
-/** Returns the fragment offest low bits.
- * @param[in] length The prefixed data total length.
- */
-#define IP_COMPUTE_FRAGMENT_OFFSET_LOW(length) \
-	(((length) / 8U) & 0xff)
-
-/** Returns the IP header length.
- * @param[in] length The IP header length in bytes.
- */
-#define IP_COMPUTE_HEADER_LENGTH(length) \
-	((uint8_t) ((length) / 4U))
-
-/** Returns the fragment offest.
- * @param[in] header The IP packet header.
- */
-#define IP_FRAGMENT_OFFSET(header) \
-	(((GET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header) << 8) + \
-	    (header)->fragment_offset_low) * 8U)
-
-/** Returns the IP packet header checksum.
- *  @param[in] header The IP packet header.
- */
-#define IP_HEADER_CHECKSUM(header) \
-	(htons(ip_checksum((uint8_t *) (header), IP_HEADER_LENGTH(header))))
-
-/** Returns the actual IP packet data length.
- * @param[in] header The IP packet header.
- */
-#define IP_HEADER_DATA_LENGTH(header) \
-	(IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header))
-
-/** Returns the actual IP header length in bytes.
- * @param[in] header The IP packet header.
- */
-#define IP_HEADER_LENGTH(header) \
-	(GET_IP_HEADER_LENGTH(header) * 4U)
-
-/** Returns the actual IP packet total length.
- * @param[in] header The IP packet header.
- */
-#define IP_TOTAL_LENGTH(header) \
-	ntohs((header)->total_length)
-
-/** @name IP flags definitions */
-/*@{*/
-
-/** Fragment flag field shift. */
-#define IPFLAG_FRAGMENT_SHIFT	1
-
-/** Fragmented flag field shift. */
-#define IPFLAG_FRAGMENTED_SHIFT	0
-
-/** Don't fragment flag value.
- * Permits the packet fragmentation.
- */
-#define IPFLAG_DONT_FRAGMENT	(0x1 << IPFLAG_FRAGMENT_SHIFT)
-
-/** Last fragment flag value.
- * Indicates the last packet fragment.
- */
-#define IPFLAG_LAST_FRAGMENT	(0x0 << IPFLAG_FRAGMENTED_SHIFT)
-
-/** May fragment flag value.
- * Allows the packet fragmentation.
- */
-#define IPFLAG_MAY_FRAGMENT	(0x0 << IPFLAG_FRAGMENT_SHIFT)
-
-/** More fragments flag value.
- * Indicates that more packet fragments follow.
- */
-#define IPFLAG_MORE_FRAGMENTS	(0x1 << IPFLAG_FRAGMENTED_SHIFT)
-
-/*@}*/
-
-/** Type definition of the internet header.
- * @see ip_header
- */
-typedef struct ip_header ip_header_t;
-
-/** Type definition of the internet option header.
- * @see ip_header
- */
-typedef struct ip_option ip_option_t;
-
-/** Type definition of the internet version 4 pseudo header.
- * @see ipv4_pseudo_header
- */
-typedef struct ipv4_pseudo_header ipv4_pseudo_header_t;
-
-/** Internet header.
- *
- * The variable options should be included after the header itself and
- * indicated by the increased header length value.
- */
-struct ip_header {
-	uint8_t vhl; /* version, header_length */
-
-#define GET_IP_HEADER_VERSION(header) \
-	(((header)->vhl & 0xf0) >> 4)
-#define SET_IP_HEADER_VERSION(header, version) \
-	((header)->vhl = \
-	 ((version & 0x0f) << 4) | ((header)->vhl & 0x0f))
-
-#define GET_IP_HEADER_LENGTH(header) \
-	((header)->vhl & 0x0f)
-#define SET_IP_HEADER_LENGTH(header, length) \
-	((header)->vhl = \
-	 (length & 0x0f) | ((header)->vhl & 0xf0))
-
-	uint8_t tos;
-	uint16_t total_length;
-	uint16_t identification;
-
-	uint8_t ffoh; /* flags, fragment_offset_high */
-
-#define GET_IP_HEADER_FLAGS(header) \
-	(((header)->ffoh & 0xe0) >> 5)
-#define SET_IP_HEADER_FLAGS(header, flags) \
-	((header)->ffoh = \
-	 ((flags & 0x07) << 5) | ((header)->ffoh & 0x1f))
-
-#define GET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header) \
-	((header)->ffoh & 0x1f)
-#define SET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header, fragment_offset_high) \
-	((header)->ffoh = \
-	 (fragment_offset_high & 0x1f) | ((header)->ffoh & 0xe0))
-
-	uint8_t fragment_offset_low;
-	uint8_t ttl;
-	uint8_t protocol;
-	uint16_t header_checksum;
-	uint32_t source_address;
-	uint32_t destination_address;
-} __attribute__ ((packed));
-
-/** Internet option header.
- *
- * Only type field is always valid.
- * Other fields' validity depends on the option type.
- */
-struct ip_option {
-	uint8_t type;
-	uint8_t length;
-	uint8_t pointer;
-
-	uint8_t of; /* overflow, flags */
-
-#define GET_IP_OPTION_OVERFLOW(option) \
-	(((option)->of & 0xf0) >> 4)
-#define SET_IP_OPTION_OVERFLOW(option, overflow) \
-	((option)->of = \
-	 ((overflow & 0x0f) << 4) | ((option)->of & 0x0f))
-
-#define GET_IP_OPTION_FLAGS(option) \
-	((option)->of & 0x0f)
-#define SET_IP_OPTION_FLAGS(option, flags) \
-	((option)->of = \
-	 (flags & 0x0f) | ((option)->of & 0xf0))
-
-} __attribute__ ((packed));
-
-/** Internet version 4 pseudo header. */
-struct ipv4_pseudo_header {
-	uint32_t source_address;
-	uint32_t destination_address;
-	uint8_t reserved;
-	uint8_t protocol;
-	uint16_t data_length;
-} __attribute__ ((packed));
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/ip_interface.h
===================================================================
--- uspace/lib/net/include/ip_interface.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet 
- * @{
- */
-
-#ifndef LIBNET_IP_INTERFACE_H_
-#define LIBNET_IP_INTERFACE_H_
-
-#include <net/socket_codes.h>
-#include <ipc/services.h>
-#include <net/device.h>
-#include <net/packet.h>
-#include <net/in.h>
-#include <net/ip_codes.h>
-#include <ip_remote.h>
-#include <async.h>
-
-#define ip_received_error_msg  ip_received_error_msg_remote
-#define ip_set_gateway_req     ip_set_gateway_req_remote
-#define ip_packet_size_req     ip_packet_size_req_remote
-#define ip_add_route_req       ip_add_route_req_remote
-#define ip_send_msg            ip_send_msg_remote
-#define ip_get_route_req       ip_get_route_req_remote
-
-/** @name IP module interface
- * This interface is used by other modules.
- */
-/*@{*/
-
-/** The transport layer notification function type definition.
- *
- * Notify the transport layer modules about the received packet/s.
- *
- * @param[in] device_id Device identifier.
- * @param[in] packet    Received packet or the received packet queue.
- * @param[in] receiver  Receiving module service.
- * @param[in] error     Packet error reporting service. Prefixes the
- *                      received packet.
- *
- * @return EOK on success.
- *
- */
-typedef int (*tl_received_msg_t)(nic_device_id_t device_id, packet_t *packet,
-    services_t receiver, services_t error);
-
-extern async_sess_t *ip_bind_service(services_t, int, services_t, async_client_conn_t);
-extern async_sess_t *ip_connect_module(services_t);
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/ip_remote.h
===================================================================
--- uspace/lib/net/include/ip_remote.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-#ifndef LIBNET_IP_REMOTE_H_
-#define LIBNET_IP_REMOTE_H_
-
-#include <ipc/services.h>
-#include <net/ip_codes.h>
-#include <net/inet.h>
-#include <net/in.h>
-#include <net/packet.h>
-#include <net/device.h>
-#include <net/socket.h>
-#include <async.h>
-
-extern int ip_set_gateway_req_remote(async_sess_t *, nic_device_id_t, in_addr_t);
-extern int ip_packet_size_req_remote(async_sess_t *, nic_device_id_t,
-    packet_dimension_t *);
-extern int ip_received_error_msg_remote(async_sess_t *, nic_device_id_t, packet_t *,
-    services_t, services_t);
-extern int ip_device_req(async_sess_t *, nic_device_id_t, services_t);
-extern int ip_add_route_req_remote(async_sess_t *, nic_device_id_t, in_addr_t,
-    in_addr_t, in_addr_t);
-extern int ip_send_msg_remote(async_sess_t *, nic_device_id_t, packet_t *,
-    services_t, services_t);
-extern int ip_get_route_req_remote(async_sess_t *, ip_protocol_t,
-    const struct sockaddr *, socklen_t, nic_device_id_t *, void **, size_t *);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/net_checksum.h
===================================================================
--- uspace/lib/net/include/net_checksum.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-/** @file
- * General CRC and checksum computation.
- */
-
-#ifndef LIBNET_CHECKSUM_H_
-#define LIBNET_CHECKSUM_H_
-
-#include <byteorder.h>
-#include <sys/types.h>
-
-/** IP checksum value for computed zero checksum.
- *
- * Zero is returned as 0xFFFF (not flipped)
- *
- */
-#define IP_CHECKSUM_ZERO  0xffffU
-
-#ifdef __BE__
-
-#define compute_crc32(seed, data, length) \
-	compute_crc32_be(seed, (uint8_t *) data, length)
-
-#endif
-
-#ifdef __LE__
-
-#define compute_crc32(seed, data, length) \
-	compute_crc32_le(seed, (uint8_t *) data, length)
-
-#endif
-
-extern uint32_t compute_crc32_le(uint32_t, uint8_t *, size_t);
-extern uint32_t compute_crc32_be(uint32_t, uint8_t *, size_t);
-extern uint32_t compute_checksum(uint32_t, uint8_t *, size_t);
-extern uint16_t compact_checksum(uint32_t);
-extern uint16_t flip_checksum(uint16_t);
-extern uint16_t ip_checksum(uint8_t *, size_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/net_hardware.h
===================================================================
--- uspace/lib/net/include/net_hardware.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Hardware types according to the on-line IANA - Address Resolution Protocol
- * (ARP) Parameters
- * http://www.iana.org/assignments/arp-parameters/arp-parameters.xml,
- * cited January 14 2009.
- */
-
-#ifndef LIBNET_NET_HARDWARE_H_
-#define LIBNET_NET_HARDWARE_H_
-
-#include <sys/types.h>
-
-/** Network interface layer type type definition. */
-typedef uint8_t hw_type_t;
-
-/** @name Network interface layer types definitions */
-/*@{*/
-
-/** Ethernet (10Mb) hardware type. */
-#define HW_ETHER		1
-
-/*@}*/
-
-#endif
-
-/** @}
- */
-
Index: uspace/lib/net/include/net_interface.h
===================================================================
--- uspace/lib/net/include/net_interface.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- *  @{
- */
-
-#ifndef LIBNET_NET_INTERFACE_H_
-#define LIBNET_NET_INTERFACE_H_
-
-#include <ipc/services.h>
-#include <net/device.h>
-#include <adt/measured_strings.h>
-#include <async.h>
-#include <devman.h>
-
-/** @name Networking module interface
- * This interface is used by other modules.
- */
-/*@{*/
-
-extern int net_get_device_conf_req(async_sess_t *, nic_device_id_t,
-    measured_string_t **, size_t, uint8_t **);
-extern int net_get_conf_req(async_sess_t *, measured_string_t **, size_t,
-    uint8_t **);
-extern void net_free_settings(measured_string_t *, uint8_t *);
-extern int net_get_devices_req(async_sess_t *, measured_string_t **, size_t *,
-    uint8_t **);
-extern async_sess_t *net_connect_module(void);
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/nil_remote.h
===================================================================
--- uspace/lib/net/include/nil_remote.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup netif
- * @{
- */
-
-#ifndef __NET_NIL_REMOTE_H__
-#define __NET_NIL_REMOTE_H__
-
-#include <ipc/loc.h>
-#include <net/device.h>
-#include <net/packet.h>
-#include <devman.h>
-#include <generic.h>
-#include <async.h>
-#include <sys/types.h>
-
-#define nil_bind_service(service, device_id, me, receiver) \
-	bind_service(service, device_id, me, 0, receiver)
-
-#define nil_packet_size_req(sess, device_id, packet_dimension) \
-	generic_packet_size_req_remote(sess, NET_NIL_PACKET_SPACE, \
-	    device_id, packet_dimension)
-
-#define nil_get_addr_req(sess, device_id, address, data) \
-	generic_get_addr_req(sess, NET_NIL_ADDR, device_id, address, data)
-
-#define nil_get_broadcast_addr_req(sess, device_id, address, data) \
-	generic_get_addr_req(sess, NET_NIL_BROADCAST_ADDR, device_id, \
-	    address, data)
-
-#define nil_send_msg(sess, device_id, packet, sender) \
-	generic_send_msg_remote(sess, NET_NIL_SEND, device_id, \
-	    packet_get_id(packet), sender, 0)
-
-extern int nil_device_req(async_sess_t *, nic_device_id_t, devman_handle_t,
-    size_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/nil_skel.h
===================================================================
--- uspace/lib/net/include/nil_skel.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,116 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Network interface layer modules common skeleton.
- * All network interface layer modules have to implement this interface.
- */
-
-#ifndef LIBNET_NIL_SKEL_H_
-#define LIBNET_NIL_SKEL_H_
-
-#include <ipc/services.h>
-#include <adt/measured_strings.h>
-#include <net/device.h>
-#include <net/packet.h>
-#include <async.h>
-
-/** Module initialization.
- *
- * This has to be implemented in user code.
- *
- * @param[in] sess Networking module session.
- *
- * @return EOK on success.
- * @return Other error codes as defined for each specific module
- *         initialize function.
- *
- */
-extern int nil_initialize(async_sess_t *sess);
-
-/** Notify the network interface layer about the device state change.
- *
- * This has to be implemented in user code.
- *
- * @param[in] device_id Device identifier.
- * @param[in] state     New device state.
- *
- * @return EOK on success.
- * @return Other error codes as defined for each specific module
- *         device state function.
- *
- */
-extern int nil_device_state_msg_local(nic_device_id_t device_id, sysarg_t state);
-
-/** Pass the packet queue to the network interface layer.
- *
- * Process and redistribute the received packet queue to the registered
- * upper layers.
- *
- * This has to be implemented in user code.
- *
- * @param[in] device_id Source device identifier.
- * @param[in] packet    Received packet or the received packet queue.
- *
- * @return EOK on success.
- * @return Other error codes as defined for each specific module
- *         received function.
- *
- */
-extern int nil_received_msg_local(nic_device_id_t device_id, packet_t *packet);
-
-/** Message processing function.
- *
- * This has to be implemented in user code.
- *
- * @param[in]  callid Message identifier.
- * @param[in]  call   Message parameters.
- * @param[out] answer Message answer parameters.
- * @param[out] count  Message answer arguments.
- *
- * @return EOK on success.
- * @return ENOTSUP if the message is not known.
- * @return Other error codes as defined for each specific module
- *         message function.
- *
- * @see IS_NET_NIL_MESSAGE()
- *
- */
-extern int nil_module_message(ipc_callid_t callid, ipc_call_t *call,
-    ipc_call_t *answer, size_t *count);
-
-extern int nil_module_start(sysarg_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/packet_client.h
===================================================================
--- uspace/lib/net/include/packet_client.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,118 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- *  @{
- */
-
-/** @file
- * Packet client.
- *
- * To function correctly, initialization of the packet map by the pm_init()
- * function has to happen at the first place. The module should not send the
- * packet messages to the packet server but use the functions provided. The
- * packet map should be released by the pm_destroy() function during the module
- * termination. The packets and the packet queues can't be locked at all. The
- * processing modules should process them sequentially - by passing the packets
- * to the next module and stopping using the passed ones.
- *
- * @see packet.h
- */
-
-#ifndef LIBNET_PACKET_CLIENT_H_
-#define LIBNET_PACKET_CLIENT_H_
-
-#include <net/packet.h>
-#include <async.h>
-
-/** @name Packet client interface */
-/*@{*/
-
-/** Allocates the specified type right before the actual packet content and
- * returns its pointer.
- *
- * The wrapper of the packet_prepend() function.
- *
- * @param[in] packet	The packet to be used.
- * @param[in] type	The type to be allocated at the beginning of the packet
- *			content.
- * @return		The typed pointer to the allocated memory.
- * @return		NULL if the packet is not valid.
- * @return		NULL if there is not enough memory left.
- */
-#define PACKET_PREFIX(packet, type) \
-	(type *) packet_prefix((packet), sizeof(type))
-
-/** Allocates the specified type right after the actual packet content and
- * returns its pointer.
- *
- * The wrapper of the packet_append() function.
- *
- * @param[in] packet	The packet to be used.
- * @param[in] type	The type to be allocated at the end of the packet
- *			content.
- * @return		The typed pointer to the allocated memory.
- * @return		NULL if the packet is not valid.
- * @return		NULL if there is not enough memory left.
- */
-#define PACKET_SUFFIX(packet, type) \
-	(type *) packet_suffix((packet), sizeof(type))
-
-/** Trims the actual packet content by the specified prefix and suffix types.
- *
- * The wrapper of the packet_trim() function.
- *
- * @param[in] packet	The packet to be trimmed.
- * @param[in] prefix	The type of the prefix to be removed from the beginning
- *			of the packet content.
- * @param[in] suffix	The type of the suffix to be removed from the end of
- *			the packet content.
- * @return		EOK on success.
- * @return		EINVAL if the packet is not valid.
- * @return		ENOMEM if there is not enough memory left.
- */
-#define PACKET_TRIM(packet, prefix, suffix) \
-	packet_trim((packet), sizeof(prefix), sizeof(suffix))
-
-extern void *packet_prefix(packet_t *, size_t);
-extern void *packet_suffix(packet_t *, size_t);
-extern int packet_trim(packet_t *, size_t, size_t);
-extern int packet_copy_data(packet_t *, const void *, size_t);
-extern packet_id_t packet_get_id(const packet_t *);
-extern size_t packet_get_data_length(const packet_t *);
-extern void *packet_get_data(const packet_t *);
-extern int packet_get_addr(const packet_t *, uint8_t **, uint8_t **);
-extern int packet_set_addr(packet_t *, const uint8_t *, const uint8_t *, size_t);
-extern packet_t *packet_get_copy(async_sess_t *, packet_t *);
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/packet_remote.h
===================================================================
--- uspace/lib/net/include/packet_remote.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(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 libnet
- * @{
- */
-
-#ifndef LIBNET_PACKET_REMOTE_H_
-#define LIBNET_PACKET_REMOTE_H_
-
-#include <net/packet.h>
-#include <sys/types.h>
-#include <async.h>
-
-extern int packet_translate_remote(async_sess_t *, packet_t **, packet_id_t);
-extern packet_t *packet_get_4_remote(async_sess_t *, size_t, size_t, size_t,
-    size_t);
-extern packet_t *packet_get_1_remote(async_sess_t *, size_t);
-extern void pq_release_remote(async_sess_t *, packet_id_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/protocol_map.h
===================================================================
--- uspace/lib/net/include/protocol_map.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(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 libnet
- * @{
- */
-
-/** @file
- * Internetwork layer services - network interface layer service type
- * translation.
- */
-
-#ifndef LIBNET_PROTOCOL_MAP_H_
-#define LIBNET_PROTOCOL_MAP_H_
-
-#include <ethernet_lsap.h>
-#include <ethernet_protocols.h>
-#include <net_hardware.h>
-
-#include <ipc/services.h>
-
-extern eth_type_t protocol_map(services_t, services_t);
-extern services_t protocol_unmap(services_t, int);
-extern eth_type_t lsap_map(eth_lsap_t);
-extern eth_lsap_t lsap_unmap(eth_type_t);
-extern hw_type_t hardware_map(services_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/socket_core.h
===================================================================
--- uspace/lib/net/include/socket_core.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ uspace/lib/net/include/socket_core.h	(revision c6533a794620411b83c209fe9e2c6bb24cedc08c)
@@ -44,5 +44,4 @@
 #include <net/in.h>
 #include <net/device.h>
-#include <net/packet.h>
 #include <async.h>
 
@@ -80,6 +79,4 @@
 	/** Bound port. */
 	int port;
-	/** Received packets queue. */
-	dyn_fifo_t received;
 	/** Sockets for acceptance queue. */
 	dyn_fifo_t accepted;
@@ -118,5 +115,4 @@
 extern int socket_destroy(async_sess_t *, int, socket_cores_t *,
     socket_ports_t *, void (*)(socket_core_t *));
-extern int socket_reply_packets(packet_t *, size_t *);
 extern socket_core_t *socket_port_find(socket_ports_t *, int, const uint8_t *,
     size_t);
Index: uspace/lib/net/include/tl_common.h
===================================================================
--- uspace/lib/net/include/tl_common.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2008 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Transport layer common functions.
- */
-
-#ifndef LIBNET_TL_COMMON_H_
-#define LIBNET_TL_COMMON_H_
-
-#include <ipc/services.h>
-#include <net/socket_codes.h>
-#include <net/packet.h>
-#include <net/device.h>
-#include <net/inet.h>
-#include <async.h>
-
-/** Device packet dimensions.
- * Maps devices to the packet dimensions.
- * @see device.h
- */
-DEVICE_MAP_DECLARE(packet_dimensions, packet_dimension_t);
-
-extern int tl_get_ip_packet_dimension(async_sess_t *, packet_dimensions_t *,
-    nic_device_id_t, packet_dimension_t **);
-extern int tl_get_address_port(const struct sockaddr *, int, uint16_t *);
-extern int tl_update_ip_packet_dimension(packet_dimensions_t *, nic_device_id_t,
-    size_t);
-extern int tl_set_address_port(struct sockaddr *, int, uint16_t);
-extern int tl_prepare_icmp_packet(async_sess_t *, async_sess_t *, packet_t *,
-    services_t);
-extern int tl_socket_read_packet_data(async_sess_t *, packet_t **, size_t,
-    const packet_dimension_t *, const struct sockaddr *, socklen_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/tl_remote.h
===================================================================
--- uspace/lib/net/include/tl_remote.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Transport layer module interface for the underlying internetwork layer.
- */
-
-#ifndef LIBNET_TL_REMOTE_H_
-#define LIBNET_TL_REMOTE_H_
-
-#include <ipc/services.h>
-#include <ipc/tl.h>
-#include <generic.h>
-#include <net/device.h>
-#include <net/packet.h>
-#include <packet_client.h>
-#include <async.h>
-
-/** @name Transport layer module interface
- * This interface is used by other modules.
- */
-/*@{*/
-
-extern int tl_received_msg(async_sess_t *, nic_device_id_t, packet_t *,
-    services_t, services_t);
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/tl_skel.h
===================================================================
--- uspace/lib/net/include/tl_skel.h	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-#ifndef LIBNET_TL_SKEL_H_
-#define LIBNET_TL_SKEL_H_
-
-/** @file
- * Transport layer module skeleton.
- * The skeleton has to be part of each transport layer module.
- */
-
-#include <fibril_synch.h>
-#include <ipc/services.h>
-#include <adt/measured_strings.h>
-#include <net/device.h>
-#include <net/packet.h>
-#include <async.h>
-
-/** Module initialization.
- *
- * This has to be implemented in user code.
- *
- * @param[in] sess Networking module session.
- *
- * @return EOK on success.
- * @return Other error codes as defined for each specific module
- *         initialize function.
- *
- */
-extern int tl_initialize(async_sess_t *sess);
-
-/** Per-connection module initialization.
- *
- * This has to be implemented in user code.
- *
- */
-extern void tl_connection(void);
-
-/** Process the transport layer module message.
- *
- * This has to be implemented in user code.
- *
- * @param[in]  callid Message identifier.
- * @param[in]  call   Message parameters.
- * @param[out] answer Answer.
- * @param[out] count  Number of arguments of the answer.
- *
- * @return EOK on success.
- * @return Other error codes as defined for each specific module.
- *
- */
-extern int tl_message(ipc_callid_t, ipc_call_t *,
-    ipc_call_t *, size_t *);
-
-extern int tl_module_start(sysarg_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/nil/nil_remote.c
===================================================================
--- uspace/lib/net/nil/nil_remote.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Network interface layer interface implementation for remote modules.
- * @see nil_remote.h
- */
-
-#include <ipc/loc.h>
-#include <nil_remote.h>
-#include <generic.h>
-#include <net/device.h>
-#include <net/packet.h>
-#include <packet_client.h>
-#include <ipc/nil.h>
-
-int nil_device_req(async_sess_t *sess, nic_device_id_t device_id,
-    service_id_t sid, size_t mtu)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	int rc = async_req_3_0(exch, NET_NIL_DEVICE, (sysarg_t) device_id,
-	    (sysarg_t) sid, (sysarg_t) mtu);
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** @}
- */
Index: uspace/lib/net/nil/nil_skel.c
===================================================================
--- uspace/lib/net/nil/nil_skel.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Network interface layer module skeleton implementation.
- * @see nil_skel.h
- */
-
-#include <bool.h>
-#include <errno.h>
-#include <ns.h>
-#include <nil_skel.h>
-#include <net_interface.h>
-#include <net/modules.h>
-
-/** Default thread for new connections.
- *
- * @param[in] iid   The initial message identifier.
- * @param[in] icall The initial message call structure.
- *
- */
-static void nil_client_connection(ipc_callid_t iid, ipc_call_t *icall,
-    void *arg)
-{
-	/*
-	 * Accept the connection by answering
-	 * the initial IPC_M_CONNECT_ME_TO call.
-	 */
-	async_answer_0(iid, EOK);
-	
-	while (true) {
-		ipc_call_t answer;
-		size_t count;
-		
-		/* Clear the answer structure */
-		refresh_answer(&answer, &count);
-		
-		/* Fetch the next message */
-		ipc_call_t call;
-		ipc_callid_t callid = async_get_call(&call);
-		
-		/* Process the message */
-		int res = nil_module_message(callid, &call, &answer,
-		    &count);
-		
-		/*
-		 * End if told to either by the message or the processing
-		 * result.
-		 */
-		if ((!IPC_GET_IMETHOD(call)) || (res == EHANGUP))
-			return;
-		
-		/* Answer the message */
-		answer_call(callid, res, &answer, count);
-	}
-}
-
-/** Start the network interface layer module.
- *
- * Initialize the client connection serving function, initialize
- * the module, register the module service and start the async
- * manager, processing IPC messages in an infinite loop.
- *
- * @param[in] service Service identification.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the pm_init() function.
- * @return Other error codes as defined for the nil_initialize()
- *         function.
- *
- */
-int nil_module_start(sysarg_t service)
-{
-	async_set_client_connection(nil_client_connection);
-	async_sess_t *sess = net_connect_module();
-	if (!sess)
-		return ENOENT;
-	
-	int rc = pm_init();
-	if (rc != EOK)
-		return rc;
-	
-	rc = nil_initialize(sess);
-	if (rc != EOK)
-		goto out;
-	
-	rc = service_register(service);
-	if (rc != EOK)
-		goto out;
-	
-	async_manager();
-	
-out:
-	pm_destroy();
-	return rc;
-}
-
-/** @}
- */
Index: uspace/lib/net/tl/icmp_client.c
===================================================================
--- uspace/lib/net/tl/icmp_client.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * ICMP client interface implementation.
- * @see icmp_client.h
- */
-
-#include <icmp_client.h>
-#include <icmp_header.h>
-#include <packet_client.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <net/icmp_codes.h>
-#include <net/packet.h>
-
-/** Processes the received packet prefixed with an ICMP header.
- *
- * @param[in] packet	The received packet.
- * @param[out] type	The ICMP header type.
- * @param[out] code	The ICMP header code.
- * @param[out] pointer	The ICMP header pointer.
- * @param[out] mtu	The ICMP header MTU.
- * @return		The ICMP header length.
- * @return		Zero if the packet contains no data.
- */
-int icmp_client_process_packet(packet_t *packet, icmp_type_t *type,
-    icmp_code_t *code, icmp_param_t *pointer, icmp_param_t *mtu)
-{
-	icmp_header_t *header;
-
-	header = (icmp_header_t *) packet_get_data(packet);
-	if (!header ||
-	    (packet_get_data_length(packet) < sizeof(icmp_header_t))) {
-		return 0;
-	}
-
-	if (type)
-		*type = header->type;
-	if (code)
-		*code = header->code;
-	if (pointer)
-		*pointer = header->un.param.pointer;
-	if (mtu)
-		*mtu = header->un.frag.mtu;
-
-	return sizeof(icmp_header_t);
-}
-
-/** Returns the ICMP header length.
- *
- * @param[in] packet	The packet.
- * @return		The ICMP header length in bytes.
- */
-size_t icmp_client_header_length(packet_t *packet)
-{
-	if (packet_get_data_length(packet) < sizeof(icmp_header_t))
-		return 0;
-
-	return sizeof(icmp_header_t);
-}
-
-/** @}
- */
Index: uspace/lib/net/tl/icmp_remote.c
===================================================================
--- uspace/lib/net/tl/icmp_remote.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,152 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- *  @{
- */
-
-/** @file
- * ICMP interface implementation for remote modules.
- * @see icmp_remote.h
- */
-
-#include <icmp_remote.h>
-#include <net/modules.h>
-#include <packet_client.h>
-#include <ipc/services.h>
-#include <ipc/icmp.h>
-#include <sys/types.h>
-#include <async.h>
-#include <errno.h>
-
-/** Send the Destination Unreachable error notification packet.
- *
- * Beginning of the packet is sent as the notification packet data.
- * The source and the destination addresses should be set in the original
- * packet.
- *
- * @param[in] sess   ICMP module session.
- * @param[in] code   Error specific code.
- * @param[in] mtu    Error MTU value.
- * @param[in] packet Original packet.
- *
- * @return EOK on success.
- * @return EPERM if the ICMP error notifications are disabled.
- * @return ENOMEM if there is not enough memory left.
- *
- */
-int icmp_destination_unreachable_msg(async_sess_t *sess, icmp_code_t code,
-    icmp_param_t mtu, packet_t *packet)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	async_msg_3(exch, NET_ICMP_DEST_UNREACH, (sysarg_t) code,
-	    (sysarg_t) packet_get_id(packet), (sysarg_t) mtu);
-	async_exchange_end(exch);
-	
-	return EOK;
-}
-
-/** Send the Source Quench error notification packet.
- *
- * Beginning of the packet is sent as the notification packet data.
- * The source and the destination addresses should be set in the original
- * packet.
- *
- * @param[in] sess   ICMP module session.
- * @param[in] packet Original packet.
- *
- * @return EOK on success.
- * @return EPERM if the ICMP error notifications are disabled.
- * @return ENOMEM if there is not enough memory left.
- *
- */
-int icmp_source_quench_msg(async_sess_t *sess, packet_t *packet)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	async_msg_2(exch, NET_ICMP_SOURCE_QUENCH, 0,
-	    (sysarg_t) packet_get_id(packet));
-	async_exchange_end(exch);
-	
-	return EOK;
-}
-
-/** Send the Time Exceeded error notification packet.
- *
- * Beginning of the packet is sent as the notification packet data.
- * The source and the destination addresses should be set in the original
- * packet.
- *
- * @param[in] sess   ICMP module session.
- * @param[in] code   Error specific code.
- * @param[in] packet Original packet.
- *
- * @return EOK on success.
- * @return EPERM if the ICMP error notifications are disabled.
- * @return ENOMEM if there is not enough memory left.
- *
- */
-int icmp_time_exceeded_msg(async_sess_t *sess, icmp_code_t code,
-    packet_t *packet)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	async_msg_2(exch, NET_ICMP_TIME_EXCEEDED, (sysarg_t) code,
-	    (sysarg_t) packet_get_id(packet));
-	async_exchange_end(exch);
-	
-	return EOK;
-}
-
-/** Send the Parameter Problem error notification packet.
- *
- * Beginning of the packet is sent as the notification packet data.
- * The source and the destination addresses should be set in the original
- * packet.
- *
- * @param[in] sess    ICMP module session.
- * @param[in] code    Error specific code.
- * @param[in] pointer Problematic parameter offset.
- * @param[in] packet  Original packet.
- *
- * @return EOK on success.
- * @return EPERM if the ICMP error notifications are disabled.
- * @return ENOMEM if there is not enough memory left.
- *
- */
-int icmp_parameter_problem_msg(async_sess_t *sess, icmp_code_t code,
-    icmp_param_t pointer, packet_t *packet)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	async_msg_3(exch, NET_ICMP_PARAMETERPROB, (sysarg_t) code,
-	    (sysarg_t) packet_get_id(packet), (sysarg_t) pointer);
-	async_exchange_end(exch);
-	
-	return EOK;
-}
-
-/** @}
- */
Index: uspace/lib/net/tl/socket_core.c
===================================================================
--- uspace/lib/net/tl/socket_core.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ uspace/lib/net/tl/socket_core.c	(revision c6533a794620411b83c209fe9e2c6bb24cedc08c)
@@ -36,10 +36,7 @@
 
 #include <socket_core.h>
-#include <packet_client.h>
-#include <packet_remote.h>
 #include <net/socket_codes.h>
 #include <net/in.h>
 #include <net/inet.h>
-#include <net/packet.h>
 #include <net/modules.h>
 #include <stdint.h>
@@ -92,10 +89,4 @@
 	}
 	
-	/* Release all received packets */
-	int packet_id;
-	while ((packet_id = dyn_fifo_pop(&socket->received)) >= 0)
-		pq_release_remote(sess, packet_id);
-	
-	dyn_fifo_destroy(&socket->received);
 	dyn_fifo_destroy(&socket->accepted);
 	
@@ -448,20 +439,13 @@
 	socket->key_length = 0;
 	socket->specific_data = specific_data;
-	rc = dyn_fifo_initialize(&socket->received, SOCKET_INITIAL_RECEIVED_SIZE);
+	
+	rc = dyn_fifo_initialize(&socket->accepted, SOCKET_INITIAL_ACCEPTED_SIZE);
 	if (rc != EOK) {
 		free(socket);
 		return rc;
 	}
-	
-	rc = dyn_fifo_initialize(&socket->accepted, SOCKET_INITIAL_ACCEPTED_SIZE);
-	if (rc != EOK) {
-		dyn_fifo_destroy(&socket->received);
-		free(socket);
-		return rc;
-	}
 	socket->socket_id = *socket_id;
 	rc = socket_cores_add(local_sockets, socket->socket_id, socket);
 	if (rc < 0) {
-		dyn_fifo_destroy(&socket->received);
 		dyn_fifo_destroy(&socket->accepted);
 		free(socket);
@@ -506,87 +490,4 @@
 	socket_destroy_core(sess, socket, local_sockets, global_sockets,
 	    socket_release);
-	
-	return EOK;
-}
-
-/** Replies the packet or the packet queue data to the application via the
- * socket.
- *
- * Uses the current message processing fibril.
- *
- * @param[in] packet	The packet to be transfered.
- * @param[out] length	The total data length.
- * @return		EOK on success.
- * @return		EBADMEM if the length parameter is NULL.
- * @return		ENOMEM if there is not enough memory left.
- * @return		Other error codes as defined for the data_reply()
- *			function.
- */
-int socket_reply_packets(packet_t *packet, size_t *length)
-{
-	packet_t *next_packet;
-	size_t fragments;
-	size_t *lengths;
-	size_t index;
-	int rc;
-
-	if (!length)
-		return EBADMEM;
-
-	next_packet = pq_next(packet);
-	if (!next_packet) {
-		/* Write all if only one fragment */
-		rc = data_reply(packet_get_data(packet),
-		    packet_get_data_length(packet));
-		if (rc != EOK)
-			return rc;
-		/* Store the total length */
-		*length = packet_get_data_length(packet);
-	} else {
-		/* Count the packet fragments */
-		fragments = 1;
-		next_packet = pq_next(packet);
-		while ((next_packet = pq_next(next_packet)))
-			++fragments;
-		
-		/* Compute and store the fragment lengths */
-		lengths = (size_t *) malloc(sizeof(size_t) * fragments +
-		    sizeof(size_t));
-		if (!lengths)
-			return ENOMEM;
-		
-		lengths[0] = packet_get_data_length(packet);
-		lengths[fragments] = lengths[0];
-		next_packet = pq_next(packet);
-		
-		for (index = 1; index < fragments; ++index) {
-			lengths[index] = packet_get_data_length(next_packet);
-			lengths[fragments] += lengths[index];
-			next_packet = pq_next(packet);
-		}
-		
-		/* Write the fragment lengths */
-		rc = data_reply(lengths, sizeof(int) * (fragments + 1));
-		if (rc != EOK) {
-			free(lengths);
-			return rc;
-		}
-		next_packet = packet;
-		
-		/* Write the fragments */
-		for (index = 0; index < fragments; ++index) {
-			rc = data_reply(packet_get_data(next_packet),
-			    lengths[index]);
-			if (rc != EOK) {
-				free(lengths);
-				return rc;
-			}
-			next_packet = pq_next(next_packet);
-		}
-		
-		/* Store the total length */
-		*length = lengths[fragments];
-		free(lengths);
-	}
 	
 	return EOK;
Index: uspace/lib/net/tl/tl_common.c
===================================================================
--- uspace/lib/net/tl/tl_common.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,333 +1,0 @@
-/*
- * Copyright (c) 2008 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Transport layer common functions implementation.
- * @see tl_common.h
- */
-
-#include <tl_common.h>
-#include <packet_client.h>
-#include <packet_remote.h>
-#include <icmp_remote.h>
-#include <ip_remote.h>
-#include <ip_interface.h>
-#include <tl_remote.h>
-#include <net/socket_codes.h>
-#include <net/in.h>
-#include <net/in6.h>
-#include <net/inet.h>
-#include <net/device.h>
-#include <net/packet.h>
-#include <async.h>
-#include <ipc/services.h>
-#include <errno.h>
-
-DEVICE_MAP_IMPLEMENT(packet_dimensions, packet_dimension_t);
-
-/** Gets the address port.
- *
- * Supports AF_INET and AF_INET6 address families.
- *
- * @param[in,out] addr	The address to be updated.
- * @param[in] addrlen	The address length.
- * @param[out] port	The set port.
- * @return		EOK on success.
- * @return		EINVAL if the address length does not match the address
- *			family.
- * @return		EAFNOSUPPORT if the address family is not supported.
- */
-int
-tl_get_address_port(const struct sockaddr *addr, int addrlen, uint16_t *port)
-{
-	const struct sockaddr_in *address_in;
-	const struct sockaddr_in6 *address_in6;
-
-	if ((addrlen <= 0) || ((size_t) addrlen < sizeof(struct sockaddr)))
-		return EINVAL;
-
-	switch (addr->sa_family) {
-	case AF_INET:
-		if (addrlen != sizeof(struct sockaddr_in))
-			return EINVAL;
-
-		address_in = (struct sockaddr_in *) addr;
-		*port = ntohs(address_in->sin_port);
-		break;
-	
-	case AF_INET6:
-		if (addrlen != sizeof(struct sockaddr_in6))
-			return EINVAL;
-
-		address_in6 = (struct sockaddr_in6 *) addr;
-		*port = ntohs(address_in6->sin6_port);
-		break;
-	
-	default:
-		return EAFNOSUPPORT;
-	}
-
-	return EOK;
-}
-
-/** Get IP packet dimensions.
- *
- * Try to search a cache and query the IP module if not found.
- * The reply is cached then.
- *
- * @param[in]  sess              IP module session.
- * @param[in]  packet_dimensions Packet dimensions cache.
- * @param[in]  device_id         Device identifier.
- * @param[out] packet_dimension  IP packet dimensions.
- *
- * @return EOK on success.
- * @return EBADMEM if the packet_dimension parameter is NULL.
- * @return ENOMEM if there is not enough memory left.
- * @return EINVAL if the packet_dimensions cache is not valid.
- * @return Other codes as defined for the ip_packet_size_req()
- *         function.
- *
- */
-int tl_get_ip_packet_dimension(async_sess_t *sess,
-    packet_dimensions_t *packet_dimensions, nic_device_id_t device_id,
-    packet_dimension_t **packet_dimension)
-{
-	if (!packet_dimension)
-		return EBADMEM;
-	
-	*packet_dimension = packet_dimensions_find(packet_dimensions,
-	    device_id);
-	if (!*packet_dimension) {
-		/* Ask for and remember them if not found */
-		*packet_dimension = malloc(sizeof(**packet_dimension));
-		if (!*packet_dimension)
-			return ENOMEM;
-		
-		int rc = ip_packet_size_req(sess, device_id, *packet_dimension);
-		if (rc != EOK) {
-			free(*packet_dimension);
-			return rc;
-		}
-		
-		rc = packet_dimensions_add(packet_dimensions, device_id,
-		    *packet_dimension);
-		if (rc < 0) {
-			free(*packet_dimension);
-			return rc;
-		}
-	}
-	
-	return EOK;
-}
-
-/** Updates IP device packet dimensions cache.
- *
- * @param[in,out] packet_dimensions The packet dimensions cache.
- * @param[in] device_id	The device identifier.
- * @param[in] content	The new maximum content size.
- * @return		EOK on success.
- * @return		ENOENT if the packet dimension is not cached.
- */
-int tl_update_ip_packet_dimension(packet_dimensions_t *packet_dimensions,
-    nic_device_id_t device_id, size_t content)
-{
-	packet_dimension_t *packet_dimension;
-
-	packet_dimension = packet_dimensions_find(packet_dimensions, device_id);
-	if (!packet_dimension)
-		return ENOENT;
-
-	packet_dimension->content = content;
-
-	if (device_id != NIC_DEVICE_INVALID_ID) {
-		packet_dimension = packet_dimensions_find(packet_dimensions,
-		    NIC_DEVICE_INVALID_ID);
-
-		if (packet_dimension) {
-			if (packet_dimension->content >= content)
-				packet_dimension->content = content;
-			else
-				packet_dimensions_exclude(packet_dimensions,
-				    NIC_DEVICE_INVALID_ID, free);
-		}
-	}
-
-	return EOK;
-}
-
-/** Sets the address port.
- *
- * Supports AF_INET and AF_INET6 address families.
- *
- * @param[in,out] addr	The address to be updated.
- * @param[in] addrlen	The address length.
- * @param[in] port	The port to be set.
- * @return		EOK on success.
- * @return		EINVAL if the address length does not match the address
- *			family.
- * @return		EAFNOSUPPORT if the address family is not supported.
- */
-int tl_set_address_port(struct sockaddr * addr, int addrlen, uint16_t port)
-{
-	struct sockaddr_in *address_in;
-	struct sockaddr_in6 *address_in6;
-	size_t length;
-
-	if (addrlen < 0)
-		return EINVAL;
-	
-	length = (size_t) addrlen;
-	if (length < sizeof(struct sockaddr))
-		return EINVAL;
-
-	switch (addr->sa_family) {
-	case AF_INET:
-		if (length != sizeof(struct sockaddr_in))
-			return EINVAL;
-		address_in = (struct sockaddr_in *) addr;
-		address_in->sin_port = htons(port);
-		return EOK;
-	
-	case AF_INET6:
-		if (length != sizeof(struct sockaddr_in6))
-				return EINVAL;
-		address_in6 = (struct sockaddr_in6 *) addr;
-		address_in6->sin6_port = htons(port);
-		return EOK;
-	
-	default:
-		return EAFNOSUPPORT;
-	}
-}
-
-/** Prepares the packet for ICMP error notification.
- *
- * Keep the first packet and release all the others.
- * Release all the packets on error.
- *
- * @param[in] packet_sess Packet server module session.
- * @param[in] icmp_sess   ICMP module phone.
- * @param[in] packet      Packet to be send.
- * @param[in] error       Packet error reporting service. Prefixes the
- *                        received packet.
- *
- * @return EOK on success.
- * @return ENOENT if no packet may be sent.
- *
- */
-int tl_prepare_icmp_packet(async_sess_t *packet_sess, async_sess_t *icmp_sess,
-    packet_t *packet, services_t error)
-{
-	/* Detach the first packet and release the others */
-	packet_t *next = pq_detach(packet);
-	if (next)
-		pq_release_remote(packet_sess, packet_get_id(next));
-	
-	uint8_t *src;
-	int length = packet_get_addr(packet, &src, NULL);
-	if ((length > 0) && (!error) && (icmp_sess) &&
-	    /*
-	     * Set both addresses to the source one (avoids the source address
-	     * deletion before setting the destination one)
-	     */
-	    (packet_set_addr(packet, src, src, (size_t) length) == EOK)) {
-		return EOK;
-	} else
-		pq_release_remote(packet_sess, packet_get_id(packet));
-	
-	return ENOENT;
-}
-
-/** Receives data from the socket into a packet.
- *
- * @param[in]  sess      Packet server module session.
- * @param[out] packet    New created packet.
- * @param[in]  prefix    Reserved packet data prefix length.
- * @param[in]  dimension Packet dimension.
- * @param[in]  addr      Destination address.
- * @param[in]  addrlen   Address length.
- *
- * @return Number of bytes received.
- * @return EINVAL if the client does not send data.
- * @return ENOMEM if there is not enough memory left.
- * @return Other error codes as defined for the
- *         async_data_read_finalize() function.
- *
- */
-int tl_socket_read_packet_data(async_sess_t *sess, packet_t **packet,
-    size_t prefix, const packet_dimension_t *dimension,
-    const struct sockaddr *addr, socklen_t addrlen)
-{
-	ipc_callid_t callid;
-	size_t length;
-	void *data;
-	int rc;
-
-	if (!dimension)
-		return EINVAL;
-
-	/* Get the data length */
-	if (!async_data_write_receive(&callid, &length))
-		return EINVAL;
-
-	/* Get a new packet */
-	*packet = packet_get_4_remote(sess, length, dimension->addr_len,
-	    prefix + dimension->prefix, dimension->suffix);
-	if (!packet)
-		return ENOMEM;
-
-	/* Allocate space in the packet */
-	data = packet_suffix(*packet, length);
-	if (!data) {
-		pq_release_remote(sess, packet_get_id(*packet));
-		return ENOMEM;
-	}
-
-	/* Read the data into the packet */
-	rc = async_data_write_finalize(callid, data, length);
-	if (rc != EOK) {
-		pq_release_remote(sess, packet_get_id(*packet));
-		return rc;
-	}
-	
-	/* Set the packet destination address */
-	rc = packet_set_addr(*packet, NULL, (uint8_t *) addr, addrlen);
-	if (rc != EOK) {
-		pq_release_remote(sess, packet_get_id(*packet));
-		return rc;
-	}
-
-	return (int) length;
-}
-
-/** @}
- */
Index: uspace/lib/net/tl/tl_remote.c
===================================================================
--- uspace/lib/net/tl/tl_remote.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-#include <tl_remote.h>
-#include <generic.h>
-#include <packet_client.h>
-#include <ipc/services.h>
-#include <ipc/tl.h>
-#include <net/device.h>
-#include <net/packet.h>
-#include <async.h>
-
-/** Notify the remote transport layer modules about the received packet/s.
- *
- * @param[in] sess      Transport layer module session.
- * @param[in] device_id Device identifier.
- * @param[in] packet    Received packet or the received packet queue.
- *                      The packet queue is used to carry a fragmented
- *                      datagram. The first packet contains the headers,
- *                      the others contain only data.
- * @param[in] target    Target transport layer module service to be
- *                      delivered to.
- * @param[in] error     Packet error reporting service. Prefixes the
- *                      received packet.
- *
- * @return EOK on success.
- *
- */
-int tl_received_msg(async_sess_t *sess, nic_device_id_t device_id, packet_t *packet,
-    services_t target, services_t error)
-{
-	return generic_received_msg_remote(sess, NET_TL_RECEIVED, device_id,
-	    packet_get_id(packet), target, error);
-}
-
-/** @}
- */
Index: uspace/lib/net/tl/tl_skel.c
===================================================================
--- uspace/lib/net/tl/tl_skel.c	(revision bf31e3f1ebd6e88e0c8425f109e42ccd92b6c9b3)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnet
- * @{
- */
-
-/** @file
- * Transport layer module skeleton implementation.
- * @see tl_skel.h
- */
-
-#include <bool.h>
-#include <errno.h>
-#include <ns.h>
-#include <tl_skel.h>
-#include <net_interface.h>
-#include <net/modules.h>
-
-/** Default thread for new connections.
- *
- * @param[in] iid   The initial message identifier.
- * @param[in] icall The initial message call structure.
- * @param[in] arg   Local argument.
- *
- */
-static void tl_client_connection(ipc_callid_t iid, ipc_call_t *icall,
-    void *arg)
-{
-	/*
-	 * Accept the connection by answering
-	 * the initial IPC_M_CONNECT_ME_TO call.
-	 */
-	async_answer_0(iid, EOK);
-	
-	/* Per-connection initialization */
-	tl_connection();
-	
-	while (true) {
-		ipc_call_t answer;
-		size_t count;
-		
-		/* Clear the answer structure */
-		refresh_answer(&answer, &count);
-		
-		/* Fetch the next message */
-		ipc_call_t call;
-		ipc_callid_t callid = async_get_call(&call);
-		
-		/* Process the message */
-		int res = tl_message(callid, &call, &answer, &count);
-		
-		/*
-		 * End if told to either by the message or the processing
-		 * result.
-		 */
-		if ((!IPC_GET_IMETHOD(call)) || (res == EHANGUP))
-			return;
-		
-		/* Answer the message */
-		answer_call(callid, res, &answer, count);
-	}
-}
-
-/** Start the trasport layer module.
- *
- * Initialize the client connection serving function, initialize
- * the module, register the module service and start the async
- * manager, processing IPC messages in an infinite loop.
- *
- * @param[in] service Service identification.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the pm_init() function.
- * @return Other error codes as defined for the il_initialize()
- *         function.
- * @return Other error codes as defined for the REGISTER_ME() macro
- *         function.
- *
- */
-int tl_module_start(sysarg_t service)
-{
-	async_set_client_connection(tl_client_connection);
-	async_sess_t *sess = net_connect_module();
-	if (!sess)
-		return ENOENT;
-	
-	int rc = pm_init();
-	if (rc != EOK)
-		return rc;
-	
-	rc = tl_initialize(sess);
-	if (rc != EOK)
-		goto out;
-	
-	rc = service_register(service);
-	if (rc != EOK)
-		goto out;
-	
-	task_retval(0);
-	async_manager();
-	
-out:
-	pm_destroy();
-	return rc;
-}
-
-/** @}
- */
