Index: uspace/lib/socket/Makefile
===================================================================
--- uspace/lib/socket/Makefile	(revision c5b59cee008cd899135ed0a623096d8886843e8c)
+++ uspace/lib/socket/Makefile	(revision 0402bda5d398fe22b00721b43066b197408016dd)
@@ -42,8 +42,5 @@
 	packet/packet.c \
 	packet/packet_client.c \
-	packet/packet_server.c \
-	adt/dynamic_fifo.c \
-	adt/measured_strings.c \
-	adt/char_map.c
+	packet/packet_server.c 
 
 include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/socket/adt/char_map.c
===================================================================
--- uspace/lib/socket/adt/char_map.c	(revision c5b59cee008cd899135ed0a623096d8886843e8c)
+++ 	(revision )
@@ -1,234 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup net
- *  @{
- */
-
-/** @file
- *  Character string to integer map implementation.
- *  @see char_map.h
- */
-
-#include <errno.h>
-#include <malloc.h>
-#include <mem.h>
-#include <unistd.h>
-
-#include <adt/char_map.h>
-
-/** Internal magic value for a&nbsp;consistency check.
- */
-#define CHAR_MAP_MAGIC_VALUE	0x12345611
-
-/** Adds the value with the key to the map.
- *  Creates new nodes to map the key.
- *  @param[in,out] map The character string to integer map.
- *  @param[in] identifier The key zero ('\\0') terminated character string. The key character string is processed until the first terminating zero ('\\0') character after the given length is found.
- *  @param[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\\0') character is found.
- *  @param[in] value The integral value to be stored for the key character string.
- *  @returns EOK on success.
- *  @returns ENOMEM if there is not enough memory left.
- *  @returns EEXIST if the key character string is already used.
- */
-int char_map_add_item(char_map_ref map, const char * identifier, size_t length, const int value);
-
-/** Returns the node assigned to the key from the map.
- *  @param[in] map The character string to integer map.
- *  @param[in] identifier The key zero ('\\0') terminated character string. The key character string is processed until the first terminating zero ('\\0') character after the given length is found.
- *  @param[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\\0') character is found.
- *  @returns The node holding the integral value assigned to the key character string.
- *  @returns NULL if the key is not assigned a&nbsp;node.
- */
-char_map_ref char_map_find_node(const char_map_ref map, const char * identifier, const size_t length);
-
-/** Returns the value assigned to the map.
- *  @param[in] map The character string to integer map.
- *  @returns The integral value assigned to the map.
- *  @returns CHAR_MAP_NULL if the map is not assigned a&nbsp;value.
- */
-int char_map_get_value(const char_map_ref map);
-
-/** Checks if the map is valid.
- *  @param[in] map The character string to integer map.
- *  @returns TRUE if the map is valid.
- *  @returns FALSE otherwise.
- */
-int char_map_is_valid(const char_map_ref map);
-
-int char_map_add(char_map_ref map, const char * identifier, size_t length, const int value){
-	if(char_map_is_valid(map) && (identifier) && ((length) || (*identifier))){
-		int index;
-
-		for(index = 0; index < map->next; ++ index){
-			if(map->items[index]->c == * identifier){
-				++ identifier;
-				if((length > 1) || ((length == 0) && (*identifier))){
-					return char_map_add(map->items[index], identifier, length ? length - 1 : 0, value);
-				}else{
-					if(map->items[index]->value != CHAR_MAP_NULL){
-						return EEXISTS;
-					}
-					map->items[index]->value = value;
-					return EOK;
-				}
-			}
-		}
-		return char_map_add_item(map, identifier, length, value);
-	}
-	return EINVAL;
-}
-
-int char_map_add_item(char_map_ref map, const char * identifier, size_t length, const int value){
-	if(map->next == (map->size - 1)){
-		char_map_ref *tmp;
-
-		tmp = (char_map_ref *) realloc(map->items, sizeof(char_map_ref) * 2 * map->size);
-		if(! tmp){
-			return ENOMEM;
-		}
-		map->size *= 2;
-		map->items = tmp;
-	}
-	map->items[map->next] = (char_map_ref) malloc(sizeof(char_map_t));
-	if(! map->items[map->next]){
-		return ENOMEM;
-	}
-	if(char_map_initialize(map->items[map->next]) != EOK){
-		free(map->items[map->next]);
-		map->items[map->next] = NULL;
-		return ENOMEM;
-	}
-	map->items[map->next]->c = * identifier;
-	++ identifier;
-	++ map->next;
-	if((length > 1) || ((length == 0) && (*identifier))){
-		map->items[map->next - 1]->value = CHAR_MAP_NULL;
-		return char_map_add_item(map->items[map->next - 1], identifier, length ? length - 1 : 0, value);
-	}else{
-		map->items[map->next - 1]->value = value;
-	}
-	return EOK;
-}
-
-void char_map_destroy(char_map_ref map){
-	if(char_map_is_valid(map)){
-		int index;
-
-		map->magic = 0;
-		for(index = 0; index < map->next; ++ index){
-			char_map_destroy(map->items[index]);
-		}
-		free(map->items);
-		map->items = NULL;
-	}
-}
-
-int char_map_exclude(char_map_ref map, const char * identifier, size_t length){
-	char_map_ref node;
-
-	node = char_map_find_node(map, identifier, length);
-	if(node){
-		int value;
-
-		value = node->value;
-		node->value = CHAR_MAP_NULL;
-		return value;
-	}
-	return CHAR_MAP_NULL;
-}
-
-int char_map_find(const char_map_ref map, const char * identifier, size_t length){
-	char_map_ref node;
-
-	node = char_map_find_node(map, identifier, length);
-	return node ? node->value : CHAR_MAP_NULL;
-}
-
-char_map_ref char_map_find_node(const char_map_ref map, const char * identifier, size_t length){
-	if(! char_map_is_valid(map)){
-		return NULL;
-	}
-	if(length || (*identifier)){
-		int index;
-
-		for(index = 0; index < map->next; ++ index){
-			if(map->items[index]->c == * identifier){
-				++ identifier;
-				if(length == 1){
-					return map->items[index];
-				}
-				return char_map_find_node(map->items[index], identifier, length ? length - 1 : 0);
-			}
-		}
-		return NULL;
-	}
-	return map;
-}
-
-int char_map_get_value(const char_map_ref map){
-	return char_map_is_valid(map) ? map->value : CHAR_MAP_NULL;
-}
-
-int char_map_initialize(char_map_ref map){
-	if(! map){
-		return EINVAL;
-	}
-	map->c = '\0';
-	map->value = CHAR_MAP_NULL;
-	map->size = 2;
-	map->next = 0;
-	map->items = malloc(sizeof(char_map_ref) * map->size);
-	if(! map->items){
-		map->magic = 0;
-		return ENOMEM;
-	}
-	map->items[map->next] = NULL;
-	map->magic = CHAR_MAP_MAGIC_VALUE;
-	return EOK;
-}
-
-int char_map_is_valid(const char_map_ref map){
-	return map && (map->magic == CHAR_MAP_MAGIC_VALUE);
-}
-
-int char_map_update(char_map_ref map, const char * identifier, const size_t length, const int value){
-	char_map_ref node;
-
-//	if(! char_map_is_valid(map)) return EINVAL;
-	node = char_map_find_node(map, identifier, length);
-	if(node){
-		node->value = value;
-		return EOK;
-	}else{
-		return char_map_add(map, identifier, length, value);
-	}
-}
-
-/** @}
- */
Index: uspace/lib/socket/adt/dynamic_fifo.c
===================================================================
--- uspace/lib/socket/adt/dynamic_fifo.c	(revision c5b59cee008cd899135ed0a623096d8886843e8c)
+++ 	(revision )
@@ -1,151 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup net
- *  @{
- */
-
-/** @file
- *  Dynamic first in first out positive integer queue implementation.
- */
-
-#include <errno.h>
-#include <malloc.h>
-#include <mem.h>
-
-#include <adt/dynamic_fifo.h>
-
-/** Internal magic value for a&nbsp;consistency check.
- */
-#define DYN_FIFO_MAGIC_VALUE	0x58627659
-
-/** Returns the next queue index.
- *  The queue field is circular.
- *  @param[in] fifo The dynamic queue.
- *  @param[in] index The actual index to be shifted.
- */
-#define NEXT_INDEX(fifo, index)	(((index) + 1) % ((fifo)->size + 1))
-
-/** Checks if the queue is valid.
- *  @param[in] fifo The dynamic queue.
- *  @returns TRUE if the queue is valid.
- *  @returns FALSE otherwise.
- */
-static int dyn_fifo_is_valid(dyn_fifo_ref fifo){
-	return fifo && (fifo->magic_value == DYN_FIFO_MAGIC_VALUE);
-}
-
-int dyn_fifo_initialize(dyn_fifo_ref fifo, int size){
-	if(! fifo){
-		return EBADMEM;
-	}
-	if(size <= 0){
-		return EINVAL;
-	}
-	fifo->items = (int *) malloc(sizeof(int) * size + 1);
-	if(! fifo->items){
-		return ENOMEM;
-	}
-	fifo->size = size;
-	fifo->head = 0;
-	fifo->tail = 0;
-	fifo->magic_value = DYN_FIFO_MAGIC_VALUE;
-	return EOK;
-}
-
-int dyn_fifo_push(dyn_fifo_ref fifo, int value, int max_size){
-	int * new_items;
-
-	if(! dyn_fifo_is_valid(fifo)){
-		return EINVAL;
-	}
-	if(NEXT_INDEX(fifo, fifo->tail) == fifo->head){
-		if((max_size > 0) && ((fifo->size * 2) > max_size)){
-			if(fifo->size >= max_size){
-				return ENOMEM;
-			}
-		}else{
-			max_size = fifo->size * 2;
-		}
-		new_items = realloc(fifo->items, sizeof(int) * max_size + 1);
-		if(! new_items){
-			return ENOMEM;
-		}
-		fifo->items = new_items;
-		if(fifo->tail < fifo->head){
-			if(fifo->tail < max_size - fifo->size){
-				memcpy(fifo->items + fifo->size + 1, fifo->items, fifo->tail * sizeof(int));
-				fifo->tail += fifo->size + 1;
-			}else{
-				memcpy(fifo->items + fifo->size + 1, fifo->items, (max_size - fifo->size) * sizeof(int));
-				memcpy(fifo->items, fifo->items + max_size - fifo->size, fifo->tail - max_size + fifo->size);
-				fifo->tail -= max_size - fifo->size;
-			}
-		}
-		fifo->size = max_size;
-	}
-	fifo->items[fifo->tail] = value;
-	fifo->tail = NEXT_INDEX(fifo, fifo->tail);
-	return EOK;
-}
-
-int dyn_fifo_pop(dyn_fifo_ref fifo){
-	int value;
-
-	if(! dyn_fifo_is_valid(fifo)){
-		return EINVAL;
-	}
-	if(fifo->head == fifo->tail){
-		return ENOENT;
-	}
-	value = fifo->items[fifo->head];
-	fifo->head = NEXT_INDEX(fifo, fifo->head);
-	return value;
-}
-
-int dyn_fifo_value(dyn_fifo_ref fifo){
-	if(! dyn_fifo_is_valid(fifo)){
-		return EINVAL;
-	}
-	if(fifo->head == fifo->tail){
-		return ENOENT;
-	}
-	return fifo->items[fifo->head];
-}
-
-int dyn_fifo_destroy(dyn_fifo_ref fifo){
-	if(! dyn_fifo_is_valid(fifo)){
-		return EINVAL;
-	}
-	free(fifo->items);
-	fifo->magic_value = 0;
-	return EOK;
-}
-
-/** @}
- */
Index: uspace/lib/socket/adt/measured_strings.c
===================================================================
--- uspace/lib/socket/adt/measured_strings.c	(revision c5b59cee008cd899135ed0a623096d8886843e8c)
+++ 	(revision )
@@ -1,284 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup net
- *  @{
- */
-
-/** @file
- *  Character string with measured length implementation.
- *  @see measured_strings.h
- */
-
-#include <malloc.h>
-#include <mem.h>
-#include <unistd.h>
-#include <errno.h>
-#include <err.h>
-
-#include <ipc/ipc.h>
-
-#include <net_modules.h>
-#include <adt/measured_strings.h>
-
-measured_string_ref measured_string_create_bulk(const char * string, size_t length){
-	measured_string_ref new;
-
-	if(length == 0){
-		while(string[length]){
-			++ length;
-		}
-	}
-	new = (measured_string_ref) malloc(sizeof(measured_string_t) + (sizeof(char) * (length + 1)));
-	if(! new){
-		return NULL;
-	}
-	new->length = length;
-	new->value = ((char *) new) + sizeof(measured_string_t);
-	// append terminating zero explicitly - to be safe
-	memcpy(new->value, string, new->length);
-	new->value[new->length] = '\0';
-	return new;
-}
-
-measured_string_ref measured_string_copy(measured_string_ref source){
-	measured_string_ref new;
-
-	if(! source){
-		return NULL;
-	}
-	new = (measured_string_ref) malloc(sizeof(measured_string_t));
-	if(new){
-		new->value = (char *) malloc(source->length + 1);
-		if(new->value){
-			new->length = source->length;
-			memcpy(new->value, source->value, new->length);
-			new->value[new->length] = '\0';
-			return new;
-		}else{
-			free(new);
-		}
-	}
-	return NULL;
-}
-
-int measured_strings_receive(measured_string_ref * strings, char ** data, size_t count){
-	ERROR_DECLARE;
-
-	size_t * lengths;
-	size_t index;
-	size_t length;
-	char * next;
-	ipc_callid_t callid;
-
-	if((! strings) || (! data) || (count <= 0)){
-		return EINVAL;
-	}
-	lengths = (size_t *) malloc(sizeof(size_t) * (count + 1));
-	if(! lengths){
-		return ENOMEM;
-	}
-	if((! async_data_write_receive(&callid, &length))
-		|| (length != sizeof(size_t) * (count + 1))){
-		free(lengths);
-		return EINVAL;
-	}
-	if(ERROR_OCCURRED(async_data_write_finalize(callid, lengths, sizeof(size_t) * (count + 1)))){
-		free(lengths);
-		return ERROR_CODE;
-	}
-	*data = malloc(lengths[count]);
-	if(!(*data)){
-		return ENOMEM;
-	}
-	(*data)[lengths[count] - 1] = '\0';
-	*strings = (measured_string_ref) malloc(sizeof(measured_string_t) * count);
-	if(!(*strings)){
-		free(lengths);
-		free(*data);
-		return ENOMEM;
-	}
-	next = * data;
-	for(index = 0; index < count; ++ index){
-		(*strings)[index].length = lengths[index];
-		if(lengths[index] > 0){
-			if((! async_data_write_receive(&callid, &length))
-				|| (length != lengths[index])){
-				free(*data);
-				free(*strings);
-				free(lengths);
-				return EINVAL;
-			}
-			ERROR_PROPAGATE(async_data_write_finalize(callid, next, lengths[index]));
-			(*strings)[index].value = next;
-			next += lengths[index];
-			*next = '\0';
-			++ next;
-		}else{
-			(*strings)[index].value = NULL;
-		}
-	}
-	free(lengths);
-	return EOK;
-}
-
-/** Computes the lengths of the measured strings in the given array.
- *  @param[in] strings The measured strings array to be processed.
- *  @param[in] count The measured strings array size.
- *  @returns The computed sizes array.
- *  @returns NULL if there is not enough memory left.
- */
-static size_t * prepare_lengths(const measured_string_ref strings, size_t count){
-	size_t * lengths;
-	size_t index;
-	size_t length;
-
-	lengths = (size_t *) malloc(sizeof(size_t) * (count + 1));
-	if(! lengths){
-		return NULL;
-	}
-	length = 0;
-	for(index = 0; index < count; ++ index){
-		lengths[index] = strings[index].length;
-		length += lengths[index] + 1;
-	}
-	lengths[count] = length;
-	return lengths;
-}
-
-int measured_strings_reply(const measured_string_ref strings, size_t count){
-	ERROR_DECLARE;
-
-	size_t * lengths;
-	size_t index;
-	size_t length;
-	ipc_callid_t callid;
-
-	if((! strings) || (count <= 0)){
-		return EINVAL;
-	}
-	lengths = prepare_lengths(strings, count);
-	if(! lengths){
-		return ENOMEM;
-	}
-	if((! async_data_read_receive(&callid, &length))
-		|| (length != sizeof(size_t) * (count + 1))){
-		free(lengths);
-		return EINVAL;
-	}
-	if(ERROR_OCCURRED(async_data_read_finalize(callid, lengths, sizeof(size_t) * (count + 1)))){
-		free(lengths);
-		return ERROR_CODE;
-	}
-	free(lengths);
-	for(index = 0; index < count; ++ index){
-		if(strings[index].length > 0){
-			if((! async_data_read_receive(&callid, &length))
-				|| (length != strings[index].length)){
-				return EINVAL;
-			}
-			ERROR_PROPAGATE(async_data_read_finalize(callid, strings[index].value, strings[index].length));
-		}
-	}
-	return EOK;
-}
-
-int measured_strings_return(int phone, measured_string_ref * strings, char ** data, size_t count){
-	ERROR_DECLARE;
-
-	size_t * lengths;
-	size_t index;
-	char * next;
-
-	if((phone <= 0) || (! strings) || (! data) || (count <= 0)){
-		return EINVAL;
-	}
-	lengths = (size_t *) malloc(sizeof(size_t) * (count + 1));
-	if(! lengths){
-		return ENOMEM;
-	}
-	if(ERROR_OCCURRED(async_data_read_start(phone, lengths, sizeof(size_t) * (count + 1)))){
-		free(lengths);
-		return ERROR_CODE;
-	}
-	*data = malloc(lengths[count]);
-	if(!(*data)){
-		return ENOMEM;
-	}
-	*strings = (measured_string_ref) malloc(sizeof(measured_string_t) * count);
-	if(!(*strings)){
-		free(lengths);
-		free(*data);
-		return ENOMEM;
-	}
-	next = * data;
-	for(index = 0; index < count; ++ index){
-		(*strings)[index].length = lengths[index];
-		if(lengths[index] > 0){
-			ERROR_PROPAGATE(async_data_read_start(phone, next, lengths[index]));
-			(*strings)[index].value = next;
-			next += lengths[index];
-			*next = '\0';
-			++ next;
-		}else{
-			(*strings)[index].value = NULL;
-		}
-	}
-	free(lengths);
-	return EOK;
-}
-
-int measured_strings_send(int phone, const measured_string_ref strings, size_t count){
-	ERROR_DECLARE;
-
-	size_t * lengths;
-	size_t index;
-
-	if((phone <= 0) || (! strings) || (count <= 0)){
-		return EINVAL;
-	}
-	lengths = prepare_lengths(strings, count);
-	if(! lengths){
-		return ENOMEM;
-	}
-	if(ERROR_OCCURRED(async_data_write_start(phone, lengths, sizeof(size_t) * (count + 1)))){
-		free(lengths);
-		return ERROR_CODE;
-	}
-	free(lengths);
-	for(index = 0; index < count; ++ index){
-		if(strings[index].length > 0){
-			ERROR_PROPAGATE(async_data_write_start(phone, strings[index].value, strings[index].length));
-		}
-	}
-	return EOK;
-}
-
-/** @}
- */
-
Index: uspace/lib/socket/include/adt/char_map.h
===================================================================
--- uspace/lib/socket/include/adt/char_map.h	(revision c5b59cee008cd899135ed0a623096d8886843e8c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup net
- *  @{
- */
-
-/** @file
- *  Character string to integer map.
- */
-
-#ifndef __CHAR_MAP_H__
-#define __CHAR_MAP_H__
-
-/** Invalid assigned value used also if an&nbsp;entry does not exist.
- */
-#define CHAR_MAP_NULL	(-1)
-
-/** Type definition of the character string to integer map.
- *  @see char_map
- */
-typedef struct char_map	char_map_t;
-
-/** Type definition of the character string to integer map pointer.
- *  @see char_map
- */
-typedef char_map_t *	char_map_ref;
-
-/** Character string to integer map item.
- *  This structure recursivelly contains itself as a&nbsp;character by character tree.
- *  The actually mapped character string consists o fall the parent characters and the actual one.
- */
-struct	char_map{
-	/** Actually mapped character.
-	 */
-	char c;
-	/** Stored integral value.
-	 */
-	int value;
-	/** Next character array size.
-	 */
-	int size;
-	/** First free position in the next character array.
-	 */
-	int next;
-	/** Next character array.
-	 */
-	char_map_ref * items;
-	/** Consistency check magic value.
-	 */
-	int magic;
-};
-
-/** Adds the value with the key to the map.
- *  @param[in,out] map The character string to integer map.
- *  @param[in] identifier The key zero ('\\0') terminated character string. The key character string is processed until the first terminating zero ('\\0') character after the given length is found.
- *  @param[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\\0') character is found.
- *  @param[in] value The integral value to be stored for the key character string.
- *  @returns EOK on success.
- *  @returns EINVAL if the map is not valid.
- *  @returns EINVAL if the identifier parameter is NULL.
- *  @returns EINVAL if the length parameter zero (0) and the identifier parameter is an empty character string (the first character is the terminating zero ('\\0') character.
- *  @returns EEXIST if the key character string is already used.
- *  @returns Other error codes as defined for the char_map_add_item() function.
- */
-extern int char_map_add(char_map_ref map, const char * identifier, size_t length, const int value);
-
-/** Clears and destroys the map.
- *  @param[in,out] map The character string to integer map.
- */
-extern void char_map_destroy(char_map_ref map);
-
-/** Excludes the value assigned to the key from the map.
- *  The entry is cleared from the map.
- *  @param[in,out] map The character string to integer map.
- *  @param[in] identifier The key zero ('\\0') terminated character string. The key character string is processed until the first terminating zero ('\\0') character after the given length is found.
- *  @param[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\\0') character is found.
- *  @returns The integral value assigned to the key character string.
- *  @returns CHAR_MAP_NULL if the key is not assigned a&nbsp;value.
- */
-extern int char_map_exclude(char_map_ref map, const char * identifier, size_t length);
-
-/** Returns the value assigned to the key from the map.
- *  @param[in] map The character string to integer map.
- *  @param[in] identifier The key zero ('\\0') terminated character string. The key character string is processed until the first terminating zero ('\\0') character after the given length is found.
- *  @param[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\\0') character is found.
- *  @returns The integral value assigned to the key character string.
- *  @returns CHAR_MAP_NULL if the key is not assigned a&nbsp;value.
- */
-extern int char_map_find(const char_map_ref map, const char * identifier, size_t length);
-
-/** Initializes the map.
- *  @param[in,out] map The character string to integer map.
- *  @returns EOK on success.
- *  @returns EINVAL if the map parameter is NULL.
- *  @returns ENOMEM if there is not enough memory left.
- */
-extern int char_map_initialize(char_map_ref map);
-
-/** Adds or updates the value with the key to the map.
- *  @param[in,out] map The character string to integer map.
- *  @param[in] identifier The key zero ('\\0') terminated character string. The key character string is processed until the first terminating zero ('\\0') character after the given length is found.
- *  @param[in] length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\\0') character is found.
- *  @param[in] value The integral value to be stored for the key character string.
- *  @returns EOK on success.
- *  @returns EINVAL if the map is not valid.
- *  @returns EINVAL if the identifier parameter is NULL.
- *  @returns EINVAL if the length parameter zero (0) and the identifier parameter is an empty character string (the first character is the terminating zero ('\\0) character.
- *  @returns EEXIST if the key character string is already used.
- *  @returns Other error codes as defined for the char_map_add_item() function.
- */
-extern int char_map_update(char_map_ref map, const char * identifier, size_t length, const int value);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/socket/include/adt/dynamic_fifo.h
===================================================================
--- uspace/lib/socket/include/adt/dynamic_fifo.h	(revision c5b59cee008cd899135ed0a623096d8886843e8c)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup net
- *  @{
- */
-
-/** @file
- *  Dynamic first in first out positive integer queue.
- *  Possitive integer values only.
- */
-
-#ifndef __NET_DYNAMIC_FIFO_H__
-#define __NET_DYNAMIC_FIFO_H__
-
-/** Type definition of the dynamic fifo queue.
- *  @see dyn_fifo
- */
-typedef struct dyn_fifo	dyn_fifo_t;
-
-/** Type definition of the dynamic fifo queue pointer.
- *  @see dyn_fifo
- */
-typedef dyn_fifo_t *	dyn_fifo_ref;
-
-/** Dynamic first in first out positive integer queue.
- *  Possitive integer values only.
- *  The queue automatically resizes if needed.
- */
-struct dyn_fifo{
-	/** Stored item field.
-	 */
-	int *	items;
-	/** Actual field size.
-	 */
-	int size;
-	/** First item in the queue index.
-	 */
-	int head;
-	/** Last item in the queue index.
-	 */
-	int tail;
-	/** Consistency check magic value.
-	 */
-	int magic_value;
-};
-
-/** Initializes the dynamic queue.
- *  @param[in,out] fifo The dynamic queue.
- *  @param[in] size The initial queue size.
- *  @returns EOK on success.
- *  @returns EINVAL if the queue is not valid.
- *  @returns EBADMEM if the fifo parameter is NULL.
- *  @returns ENOMEM if there is not enough memory left.
- */
-extern int dyn_fifo_initialize(dyn_fifo_ref fifo, int size);
-
-/** Appends a new item to the queue end.
- *  @param[in,out] fifo The dynamic queue.
- *  @param[in] value The new item value. Should be positive.
- *  @param[in] max_size The maximum queue size. The queue is not resized beyound this limit. May be zero or negative (<=0) to indicate no limit.
- *  @returns EOK on success.
- *  @returns EINVAL if the queue is not valid.
- *  @returns ENOMEM if there is not enough memory left.
- */
-extern int dyn_fifo_push(dyn_fifo_ref fifo, int value, int max_size);
-
-/** Returns and excludes the first item in the queue.
- *  @param[in,out] fifo The dynamic queue.
- *  @returns Value of the first item in the queue.
- *  @returns EINVAL if the queue is not valid.
- *  @returns ENOENT if the queue is empty.
- */
-extern int dyn_fifo_pop(dyn_fifo_ref fifo);
-
-/** Returns and keeps the first item in the queue.
- *  @param[in,out] fifo The dynamic queue.
- *  @returns Value of the first item in the queue.
- *  @returns EINVAL if the queue is not valid.
- *  @returns ENOENT if the queue is empty.
- */
-extern int dyn_fifo_value(dyn_fifo_ref fifo);
-
-/** Clears and destroys the queue.
- *  @param[in,out] fifo The dynamic queue.
- *  @returns EOK on success.
- *  @returns EINVAL if the queue is not valid.
- */
-extern int dyn_fifo_destroy(dyn_fifo_ref fifo);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/socket/include/adt/generic_char_map.h
===================================================================
--- uspace/lib/socket/include/adt/generic_char_map.h	(revision c5b59cee008cd899135ed0a623096d8886843e8c)
+++ 	(revision )
@@ -1,160 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup net
- *  @{
- */
-
-/** @file
- *  Character string to generic type map.
- */
-
-#ifndef __GENERIC_CHAR_MAP_H__
-#define __GENERIC_CHAR_MAP_H__
-
-#include <unistd.h>
-#include <errno.h>
-#include <err.h>
-
-#include <adt/char_map.h>
-#include <adt/generic_field.h>
-
-/** Internal magic value for a&nbsp;map consistency check.
- */
-#define GENERIC_CHAR_MAP_MAGIC_VALUE	0x12345622
-
-/** Character string to generic type map declaration.
- *  @param[in] name Name of the map.
- *  @param[in] type Inner object type.
- */
-#define GENERIC_CHAR_MAP_DECLARE(name, type)									\
-																				\
-GENERIC_FIELD_DECLARE(name##_items, type)										\
-																				\
-typedef	struct name		name##_t;												\
-typedef	name##_t *		name##_ref;												\
-																				\
-struct	name{																	\
-	char_map_t names;														\
-	name##_items_t values;														\
-	int magic;														\
-};																				\
-																				\
-int name##_add(name##_ref map, const char * name, const size_t length, type * value);	\
-int name##_count(name##_ref map);												\
-void name##_destroy(name##_ref map);											\
-void name##_exclude(name##_ref map, const char * name, const size_t length);	\
-type * name##_find(name##_ref map, const char * name, const size_t length);		\
-int name##_initialize(name##_ref map);											\
-int name##_is_valid(name##_ref map);
-
-/** Character string to generic type map implementation.
- *  Should follow declaration with the same parameters.
- *  @param[in] name Name of the map.
- *  @param[in] type Inner object type.
- */
-#define GENERIC_CHAR_MAP_IMPLEMENT(name, type)									\
-																				\
-GENERIC_FIELD_IMPLEMENT(name##_items, type)										\
-																				\
-int name##_add(name##_ref map, const char * name, const size_t length, type * value){	\
-	ERROR_DECLARE;																\
-																				\
-	int index;																	\
-																				\
-	if(! name##_is_valid(map)){													\
-		return EINVAL;															\
-	}																			\
-	index = name##_items_add(&map->values, value);								\
-	if(index < 0){																\
-		return index;															\
-	}																			\
-	if(ERROR_OCCURRED(char_map_add(&map->names, name, length, index))){			\
-		name##_items_exclude_index(&map->values, index);						\
-		return ERROR_CODE;														\
-	}																			\
-	return EOK;																	\
-}																				\
-																				\
-int name##_count(name##_ref map){												\
-	return name##_is_valid(map) ? name##_items_count(&map->values) : -1;		\
-}																				\
-																				\
-void name##_destroy(name##_ref map){											\
-	if(name##_is_valid(map)){													\
-		char_map_destroy(&map->names);											\
-		name##_items_destroy(&map->values);										\
-	}																			\
-}																				\
-																				\
-void name##_exclude(name##_ref map, const char * name, const size_t length){	\
-	if(name##_is_valid(map)){													\
-		int index;																\
-																				\
-		index = char_map_exclude(&map->names, name, length);					\
-		if(index != CHAR_MAP_NULL){												\
-			name##_items_exclude_index(&map->values, index);					\
-		}																		\
-	}																			\
-}																				\
-																				\
-type * name##_find(name##_ref map, const char * name, const size_t length){		\
-	if(name##_is_valid(map)){													\
-		int index;																\
-																				\
-		index = char_map_find(&map->names, name, length);						\
-		if(index != CHAR_MAP_NULL){												\
-			return name##_items_get_index(&map->values, index);					\
-		}																		\
-	}																			\
-	return NULL;																\
-}																				\
-																				\
-int name##_initialize(name##_ref map){											\
-	ERROR_DECLARE;																\
-																				\
-	if(! map){																	\
-		return EINVAL;															\
-	}																			\
-	ERROR_PROPAGATE(char_map_initialize(&map->names));							\
-	if(ERROR_OCCURRED(name##_items_initialize(&map->values))){					\
-		char_map_destroy(&map->names);											\
-		return ERROR_CODE;														\
-	}																			\
-	map->magic = GENERIC_CHAR_MAP_MAGIC_VALUE;									\
-	return EOK;																	\
-}																				\
-																				\
-int name##_is_valid(name##_ref map){											\
-	return map && (map->magic == GENERIC_CHAR_MAP_MAGIC_VALUE);					\
-}
-
-#endif
-
-/** @}
- */
Index: uspace/lib/socket/include/adt/generic_field.h
===================================================================
--- uspace/lib/socket/include/adt/generic_field.h	(revision c5b59cee008cd899135ed0a623096d8886843e8c)
+++ 	(revision )
@@ -1,160 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup net
- *  @{
- */
-
-/** @file
- *  Generic type field.
- */
-
-#ifndef __GENERIC_FIELD_H__
-#define __GENERIC_FIELD_H__
-
-#include <errno.h>
-#include <malloc.h>
-#include <mem.h>
-#include <unistd.h>
-
-/** Internal magic value for a&nbsp;field consistency check.
- */
-#define GENERIC_FIELD_MAGIC_VALUE		0x55667788
-
-/** Generic type field declaration.
- *  @param[in] name Name of the field.
- *  @param[in] type Inner object type.
- */
-#define GENERIC_FIELD_DECLARE(name, type)										\
-																				\
-typedef	struct name		name##_t;												\
-typedef	name##_t *		name##_ref;												\
-																				\
-struct	name{																	\
-	int size;																	\
-	int next;																	\
-	type **	items;																\
-	int magic;																	\
-};																				\
-																				\
-int name##_add(name##_ref field, type * value);									\
-int name##_count(name##_ref field);												\
-void name##_destroy(name##_ref field);											\
-void name##_exclude_index(name##_ref field, int index);							\
-type ** name##_get_field(name##_ref field);										\
-type * name##_get_index(name##_ref field, int index);							\
-int name##_initialize(name##_ref field);										\
-int name##_is_valid(name##_ref field);
-
-/** Generic type field implementation.
- *  Should follow declaration with the same parameters.
- *  @param[in] name Name of the field.
- *  @param[in] type Inner object type.
- */
-#define GENERIC_FIELD_IMPLEMENT(name, type)										\
-																				\
-int name##_add(name##_ref field, type * value){									\
-	if(name##_is_valid(field)){													\
-		if(field->next == (field->size - 1)){									\
-			type **	tmp;														\
-																				\
-			tmp = (type **) realloc(field->items, sizeof(type *) * 2 * field->size);	\
-			if(! tmp){															\
-				return ENOMEM;													\
-			}																	\
-			field->size *= 2;													\
-			field->items = tmp;													\
-		}																		\
-		field->items[field->next] = value;										\
-		++ field->next;															\
-		field->items[field->next] = NULL;										\
-		return field->next - 1;													\
-	}																			\
-	return EINVAL;																\
-}																				\
-																				\
-int name##_count(name##_ref field){												\
-	return name##_is_valid(field) ? field->next : -1;							\
-}																				\
-																				\
-void name##_destroy(name##_ref field){											\
-	if(name##_is_valid(field)){													\
-		int index;																\
-																				\
-		field->magic = 0;														\
-		for(index = 0; index < field->next; ++ index){							\
-			if(field->items[index]){											\
-				free(field->items[index]);										\
-			}																	\
-		}																		\
-		free(field->items);														\
-	}																			\
-}																				\
-																				\
-void name##_exclude_index(name##_ref field, int index){							\
-	if(name##_is_valid(field) && (index >= 0) && (index < field->next) && (field->items[index])){	\
-		free(field->items[index]);												\
-		field->items[index] = NULL;												\
-	}																			\
-}																				\
-																				\
-type * name##_get_index(name##_ref field, int index){							\
-	if(name##_is_valid(field) && (index >= 0) && (index < field->next) && (field->items[index])){	\
-		return field->items[index];												\
-	}																			\
-	return NULL;																\
-}																				\
-																				\
-type ** name##_get_field(name##_ref field){										\
-	return name##_is_valid(field) ? field->items : NULL;						\
-}																				\
-																				\
-int name##_initialize(name##_ref field){										\
-	if(! field){																\
-		return EINVAL;															\
-	}																			\
-	field->size = 2;															\
-	field->next = 0;															\
-	field->items = (type **) malloc(sizeof(type *) * field->size);				\
-	if(! field->items){															\
-		return ENOMEM;															\
-	}																			\
-	field->items[field->next] = NULL;											\
-	field->magic = GENERIC_FIELD_MAGIC_VALUE;									\
-	return EOK;																	\
-}																				\
-																				\
-int name##_is_valid(name##_ref field){											\
-	return field && (field->magic == GENERIC_FIELD_MAGIC_VALUE);				\
-}
-
-#endif
-
-/** @}
- */
-
Index: uspace/lib/socket/include/adt/int_map.h
===================================================================
--- uspace/lib/socket/include/adt/int_map.h	(revision c5b59cee008cd899135ed0a623096d8886843e8c)
+++ 	(revision )
@@ -1,247 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup net
- *  @{
- */
-
-/** @file
- *  Integer to generic type map.
- */
-
-#ifndef __NET_INT_MAP_H__
-#define __NET_INT_MAP_H__
-
-#include <errno.h>
-#include <malloc.h>
-#include <mem.h>
-#include <unistd.h>
-
-/** Internal magic value for a&nbsp;map consistency check.
- */
-#define INT_MAP_MAGIC_VALUE			0x11223344
-
-/** Internal magic value for an item consistency check.
- */
-#define INT_MAP_ITEM_MAGIC_VALUE	0x55667788
-
-/** Integer to generic type map declaration.
- *  @param[in] name Name of the map.
- *  @param[in] type Inner object type.
- */
-#define INT_MAP_DECLARE(name, type)												\
-																				\
-typedef	struct name			name##_t;											\
-typedef	name##_t *			name##_ref;											\
-typedef	struct name##_item	name##_item_t;										\
-typedef	name##_item_t *		name##_item_ref;									\
-																				\
-struct	name##_item{															\
-	int key;																\
-	type * value;																\
-	int magic;																\
-};																				\
-																				\
-struct	name{																	\
-	int size;														\
-	int next;														\
-	name##_item_ref items;														\
-	int magic;														\
-};																				\
-																				\
-int name##_add(name##_ref map, int key, type * value);							\
-void name##_clear(name##_ref map);												\
-int name##_count(name##_ref map);												\
-void name##_destroy(name##_ref map);											\
-void name##_exclude(name##_ref map, int key);									\
-void name##_exclude_index(name##_ref map, int index);							\
-type * name##_find(name##_ref map, int key);									\
-int name##_update(name##_ref map, int key, int new_key);						\
-type * name##_get_index(name##_ref map, int index);								\
-int name##_initialize(name##_ref map);											\
-int name##_is_valid(name##_ref map);											\
-void name##_item_destroy(name##_item_ref item);									\
-int name##_item_is_valid(name##_item_ref item);
-
-/** Integer to generic type map implementation.
- *  Should follow declaration with the same parameters.
- *  @param[in] name Name of the map.
- *  @param[in] type Inner object type.
- */
-#define INT_MAP_IMPLEMENT(name, type)											\
-																				\
-int name##_add(name##_ref map, int key, type * value){							\
-	if(name##_is_valid(map)){													\
-		if(map->next == (map->size - 1)){										\
-			name##_item_ref tmp;												\
-																				\
-			tmp = (name##_item_ref) realloc(map->items, sizeof(name##_item_t) * 2 * map->size);	\
-			if(! tmp){															\
-				return ENOMEM;													\
-			}																	\
-			map->size *= 2;														\
-			map->items = tmp;													\
-		}																		\
-		map->items[map->next].key = key;										\
-		map->items[map->next].value = value;									\
-		map->items[map->next].magic = INT_MAP_ITEM_MAGIC_VALUE;					\
-		++ map->next;															\
-		map->items[map->next].magic = 0;										\
-		return map->next - 1;													\
-	}																			\
-	return EINVAL;																\
-}																				\
-																				\
-void name##_clear(name##_ref map){												\
-	if(name##_is_valid(map)){													\
-		int index;																\
-																				\
-/*		map->magic = 0;*/														\
-		for(index = 0; index < map->next; ++ index){							\
-			if(name##_item_is_valid(&(map->items[index]))){						\
-				name##_item_destroy(&(map->items[index]));						\
-			}																	\
-		}																		\
-		map->next = 0;															\
-		map->items[map->next].magic = 0;										\
-/*		map->magic = INT_MAP_MAGIC_VALUE;*/										\
-	}																			\
-}																				\
-																				\
-int name##_count(name##_ref map){												\
-	return name##_is_valid(map) ? map->next : -1;								\
-}																				\
-																				\
-void name##_destroy(name##_ref map){											\
-	if(name##_is_valid(map)){													\
-		int index;																\
-																				\
-		map->magic = 0;															\
-		for(index = 0; index < map->next; ++ index){							\
-			if(name##_item_is_valid(&(map->items[index]))){						\
-				name##_item_destroy(&(map->items[index]));						\
-			}																	\
-		}																		\
-		free(map->items);														\
-	}																			\
-}																				\
-																				\
-void name##_exclude(name##_ref map, int key){									\
-	if(name##_is_valid(map)){													\
-		int index;																\
-																				\
-		for(index = 0; index < map->next; ++ index){							\
-			if(name##_item_is_valid(&(map->items[index])) && (map->items[index].key == key)){	\
-				name##_item_destroy(&(map->items[index]));						\
-			}																	\
-		}																		\
-	}																			\
-}																				\
-																				\
-void name##_exclude_index(name##_ref map, int index){							\
-	if(name##_is_valid(map) && (index >= 0) && (index < map->next) && name##_item_is_valid(&(map->items[index]))){	\
-		name##_item_destroy(&(map->items[index]));								\
-	}																			\
-}																				\
-																				\
-type * name##_find(name##_ref map, int key){									\
-	if(name##_is_valid(map)){													\
-		int index;																\
-																				\
-		for(index = 0; index < map->next; ++ index){							\
-			if(name##_item_is_valid(&(map->items[index])) && (map->items[index].key == key)){	\
-				return map->items[index].value;									\
-			}																	\
-		}																		\
-	}																			\
-	return NULL;																\
-}																				\
-																				\
-int name##_update(name##_ref map, int key, int new_key){						\
-	if(name##_is_valid(map)){													\
-		int index;																\
-																				\
-		for(index = 0; index < map->next; ++ index){							\
-			if(name##_item_is_valid(&(map->items[index]))){						\
-				if(map->items[index].key == new_key){							\
-					return EEXIST;												\
-				}else if(map->items[index].key == key){							\
-					map->items[index].key = new_key;							\
-					return EOK;													\
-				}																\
-			}																	\
-		}																		\
-	}																			\
-	return ENOENT;																\
-}																				\
-																				\
-type * name##_get_index(name##_ref map, int index){								\
-	if(name##_is_valid(map) && (index >= 0) && (index < map->next) && name##_item_is_valid(&(map->items[index]))){	\
-		return map->items[index].value;											\
-	}																			\
-	return NULL;																\
-}																				\
-																				\
-int name##_initialize(name##_ref map){											\
-	if(! map){																	\
-		return EINVAL;															\
-	}																			\
-	map->size = 2;																\
-	map->next = 0;																\
-	map->items = (name##_item_ref) malloc(sizeof(name##_item_t) * map->size);	\
-	if(! map->items){															\
-		return ENOMEM;															\
-	}																			\
-	map->items[map->next].magic = 0;											\
-	map->magic = INT_MAP_MAGIC_VALUE;											\
-	return EOK;																	\
-}																				\
-																				\
-int name##_is_valid(name##_ref map){											\
-	return map && (map->magic == INT_MAP_MAGIC_VALUE);							\
-}																				\
-																				\
-void name##_item_destroy(name##_item_ref item){									\
-	if(name##_item_is_valid(item)){												\
-		item->magic = 0;														\
-		if(item->value){														\
-			free(item->value);													\
-			item->value = NULL;													\
-		}																		\
-	}																			\
-}																				\
-																				\
-int name##_item_is_valid(name##_item_ref item){									\
-	return item && (item->magic == INT_MAP_ITEM_MAGIC_VALUE);					\
-}
-
-#endif
-
-/** @}
- */
-
Index: uspace/lib/socket/include/adt/measured_strings.h
===================================================================
--- uspace/lib/socket/include/adt/measured_strings.h	(revision c5b59cee008cd899135ed0a623096d8886843e8c)
+++ 	(revision )
@@ -1,144 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup net
- *  @{
- */
-
-/** @file
- *  Character string with measured length.
- *  The structure has been designed for serialization of character strings between modules.
- */
-
-#ifndef __MEASURED_STRINGS_H__
-#define __MEASURED_STRINGS_H__
-
-#include <sys/types.h>
-
-/** Type definition of the character string with measured length.
- *  @see measured_string
- */
-typedef struct measured_string	measured_string_t;
-
-/** Type definition of the character string with measured length pointer.
- *  @see measured_string
- */
-typedef measured_string_t *		measured_string_ref;
-
-/** Character string with measured length.
- *  This structure has been designed for serialization of character strings between modules.
- */
-struct	measured_string{
-	/** Character string data.
-	 */
-	char * value;
-	/** Character string length.
-	 */
-	size_t length;
-};
-
-/** Creates a&nbsp;new measured string bundled with a&nbsp;copy of the given string itself as one memory block.
- *  If the measured string is being freed, whole memory block is freed.
- *  The measured string should be used only as a&nbsp;constant.
- *  @param[in] string The initial character string to be stored.
- *  @param[in] length The length of the given string without the terminating zero ('/0') character. If the length is zero (0), the actual length is computed. The given length is used and appended with the terminating zero ('\\0') character otherwise.
- *  @returns The new bundled character string with measured length.
- *  @returns NULL if there is not enough memory left.
- */
-extern measured_string_ref measured_string_create_bulk(const char * string, size_t length);
-
-/** Copies the given measured string with separated header and data parts.
- *  @param[in] source The source measured string to be copied.
- *  @returns The copy of the given measured string.
- *  @returns NULL if the source parameter is NULL.
- *  @returns NULL if there is not enough memory left.
- */
-extern measured_string_ref measured_string_copy(measured_string_ref source);
-
-/** Receives a&nbsp;measured strings array from a&nbsp;calling module.
- *  Creates the array and the data memory blocks.
- *  This method should be used only while processing IPC messages as the array size has to be negotiated in advance.
- *  @param[out] strings The received measured strings array.
- *  @param[out] data The measured strings data. This memory block stores the actual character strings.
- *  @param[in] count The size of the measured strings array.
- *  @returns EOK on success.
- *  @returns EINVAL if the strings or data parameter is NULL.
- *  @returns EINVAL if the count parameter is zero (0).
- *  @returns EINVAL if the sent array differs in size.
- *  @returns EINVAL if there is inconsistency in sent measured strings' lengths (should not occur).
- *  @returns ENOMEM if there is not enough memory left.
- *  @returns Other error codes as defined for the async_data_write_finalize() function.
- */
-extern int measured_strings_receive(measured_string_ref * strings, char ** data, size_t count);
-
-/** Replies the given measured strings array to a&nbsp;calling module.
- *  This method should be used only while processing IPC messages as the array size has to be negotiated in advance.
- *  @param[in] strings The measured strings array to be transferred.
- *  @param[in] count The measured strings array size.
- *  @returns EOK on success.
- *  @returns EINVAL if the strings parameter is NULL.
- *  @returns EINVAL if the count parameter is zero (0).
- *  @returns EINVAL if the calling module does not accept the given array size.
- *  @returns EINVAL if there is inconsistency in sent measured strings' lengths (should not occur).
- *  @returns Other error codes as defined for the async_data_read_finalize() function.
- */
-extern int measured_strings_reply(const measured_string_ref strings, size_t count);
-
-/** Receives a&nbsp;measured strings array from another module.
- *  Creates the array and the data memory blocks.
- *  This method should be used only following other IPC messages as the array size has to be negotiated in advance.
- *  @param[in] phone The other module phone.
- *  @param[out] strings The returned measured strings array.
- *  @param[out] data The measured strings data. This memory block stores the actual character strings.
- *  @param[in] count The size of the measured strings array.
- *  @returns EOK on success.
- *  @returns EINVAL if the strings or data parameter is NULL.
- *  @returns EINVAL if the phone or count parameter is not positive (<=0).
- *  @returns EINVAL if the sent array differs in size.
- *  @returns ENOMEM if there is not enough memory left.
- *  @returns Other error codes as defined for the async_data_read_start() function.
- */
-extern int measured_strings_return(int phone, measured_string_ref * strings, char ** data, size_t count);
-
-/** Sends the given measured strings array to another module.
- *  This method should be used only following other IPC messages as the array size has to be negotiated in advance.
- *  @param[in] phone The other module phone.
- *  @param[in] strings The measured strings array to be transferred.
- *  @param[in] count The measured strings array size.
- *  @returns EOK on success.
- *  @returns EINVAL if the strings parameter is NULL.
- *  @returns EINVAL if the phone or count parameter is not positive (<=0).
- *  @returns Other error codes as defined for the async_data_write_start() function.
- */
-extern int measured_strings_send(int phone, const measured_string_ref strings, size_t count);
-
-#endif
-
-/** @}
- */
-
