Index: uspace/app/netecho/print_error.c
===================================================================
--- uspace/app/netecho/print_error.c	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ uspace/app/netecho/print_error.c	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -38,5 +38,5 @@
 #include <errno.h>
 
-#include <icmp_codes.h>
+#include <net/icmp_codes.h>
 
 #include "print_error.h"
Index: uspace/app/ping/ping.c
===================================================================
--- uspace/app/ping/ping.c	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ uspace/app/ping/ping.c	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -45,5 +45,5 @@
 #include <arg_parse.h>
 
-#include <icmp_api.h>
+#include <net/icmp_api.h>
 #include <net/in.h>
 #include <net/in6.h>
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ uspace/lib/c/Makefile	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -100,4 +100,6 @@
 	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 \
Index: uspace/lib/c/generic/net/icmp_api.c
===================================================================
--- uspace/lib/c/generic/net/icmp_api.c	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
+++ uspace/lib/c/generic/net/icmp_api.c	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2009 Lukas Mejdrech
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup 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/ipc.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] icmp_phone The ICMP module phone used for (semi)remote calls.
+ * @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.
+ * @returns		ICMP_ECHO on success.
+ * @returns		ETIMEOUT if the reply has not arrived before the
+ *			timeout.
+ * @returns		ICMP type of the received error notification.
+ * @returns		EINVAL if the addrlen parameter is less or equal to
+ *			zero.
+ * @returns		ENOMEM if there is not enough memory left.
+ * @returns		EPARTY if there was an internal error.
+ */
+int
+icmp_echo_msg(int icmp_phone, 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;
+	ipcarg_t result;
+
+	if (addrlen <= 0)
+		return EINVAL;
+
+	message_id = async_send_5(icmp_phone, NET_ICMP_ECHO, size, timeout, ttl,
+	    tos, (ipcarg_t) dont_fragment, NULL);
+
+	// send the address
+	async_data_write_start(icmp_phone, addr, (size_t) addrlen);
+
+	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 753bca36deef6be542a11061ac60bd262f76f43f)
+++ uspace/lib/c/generic/net/icmp_common.c	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -0,0 +1,67 @@
+/*
+ * 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>
+
+/** Connects to the ICMP module.
+ *
+ * @param service	The ICMP module service. Ignored parameter.
+ * @param[in] timeout	The connection timeout in microseconds. No timeout if
+ *			set to zero.
+ * @returns		The ICMP module phone on success.
+ * @returns		ETIMEOUT if the connection timeouted.
+ */
+int icmp_connect_module(services_t service, suseconds_t timeout)
+{
+	int phone;
+
+	phone = connect_to_service_timeout(SERVICE_ICMP, timeout);
+	if (phone >= 0)
+		async_req_0_0(phone, NET_ICMP_INIT);
+
+	return phone;
+}
+
+/** @}
+ */
Index: uspace/lib/c/include/ipc/icmp.h
===================================================================
--- uspace/lib/c/include/ipc/icmp.h	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
+++ uspace/lib/c/include/ipc/icmp.h	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2009 Lukas Mejdrech
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+
+/** @file
+ * ICMP module messages.
+ * @see icmp_interface.h
+ */
+
+#ifndef LIBC_ICMP_MESSAGES_
+#define LIBC_ICMP_MESSAGES_
+
+#include <ipc/ipc.h>
+#include <ipc/net.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+#include <net/icmp_codes.h>
+
+/** ICMP module messages. */
+typedef enum {
+	/** Sends echo request. @see icmp_echo() */
+	NET_ICMP_ECHO = NET_ICMP_FIRST,
+	
+	/**
+	 * Sends destination unreachable error message.
+	 * @see icmp_destination_unreachable_msg()
+	 */
+	NET_ICMP_DEST_UNREACH,
+	
+	/**
+	 * Sends source quench error message.
+	 * @see icmp_source_quench_msg()
+	 */
+	NET_ICMP_SOURCE_QUENCH,
+	
+	/**
+	 * Sends time exceeded error message.
+	 * @see icmp_time_exceeded_msg()
+	 */
+	NET_ICMP_TIME_EXCEEDED,
+	
+	/**
+	 * Sends parameter problem error message.
+	 * @see icmp_parameter_problem_msg()
+	 */
+	NET_ICMP_PARAMETERPROB,
+	
+	/** Initializes new connection. */
+	NET_ICMP_INIT
+} icmp_messages;
+
+/** @name ICMP specific message parameters definitions */
+/*@{*/
+
+/** Returns the ICMP code message parameter.
+ *
+ * @param[in] call	The message call structure.
+ */
+#define ICMP_GET_CODE(call) \
+	({ \
+		icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); \
+		code; \
+	})
+
+/** Returns the ICMP link MTU message parameter.
+ *
+ * @param[in] call	The message call structure.
+ */
+#define ICMP_GET_MTU(call) \
+	({ \
+		icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); \
+		mtu; \
+	})
+
+/** Returns the pointer message parameter.
+ *
+ * @param[in] call	The message call structure.
+ */
+#define ICMP_GET_POINTER(call) \
+	({ \
+		icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); \
+		pointer; \
+	})
+
+/** Returns the size message parameter.
+ *
+ * @param[in] call	The message call structure.
+ */
+#define ICMP_GET_SIZE(call) \
+	({ \
+		size_t size = (size_t) IPC_GET_ARG1(call); \
+		size; \
+	})
+
+/** Returns the timeout message parameter.
+ *
+ * @param[in] call	The message call structure.
+ */
+#define ICMP_GET_TIMEOUT(call) \
+	({ \
+		suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); \
+		timeout; \
+	})
+
+/** Returns the time to live message parameter.
+ *
+ * @param[in] call	The message call structure.
+ */
+#define ICMP_GET_TTL(call) \
+	({ \
+		ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); \
+		ttl; \
+	})
+
+/** Returns the type of service message parameter.
+ *
+ * @param[in] call	The message call structure.
+ */
+#define ICMP_GET_TOS(call) \
+	({ \
+		ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); \
+		tos; \
+	})
+
+/** Returns the dont fragment message parameter.
+ *
+ * @param[in] call	The message call structure.
+ */
+#define ICMP_GET_DONT_FRAGMENT(call) \
+	({ \
+		int dont_fragment = (int) IPC_GET_ARG5(call); \
+		dont_fragment; \
+	})
+
+/*@}*/
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/include/net/icmp_api.h
===================================================================
--- uspace/lib/c/include/net/icmp_api.h	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
+++ uspace/lib/c/include/net/icmp_api.h	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -0,0 +1,64 @@
+/*
+ * 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/packet.h>
+#include <net/ip_codes.h>
+#include <net/icmp_codes.h>
+#include <net/icmp_common.h>
+
+/** @name ICMP module application interface
+ * This interface is used by other application modules.
+ */
+/*@{*/
+
+extern int icmp_echo_msg(int, 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 753bca36deef6be542a11061ac60bd262f76f43f)
+++ uspace/lib/c/include/net/icmp_codes.h	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -0,0 +1,280 @@
+/*
+ * 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_
+
+/** 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 753bca36deef6be542a11061ac60bd262f76f43f)
+++ uspace/lib/c/include/net/icmp_common.h	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -0,0 +1,51 @@
+/*
+ * 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>
+
+/** Default timeout for incoming connections in microseconds. */
+#define ICMP_CONNECT_TIMEOUT	(1 * 1000 * 1000)
+
+extern int icmp_connect_module(services_t, suseconds_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/icmp_client.h
===================================================================
--- uspace/lib/net/include/icmp_client.h	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ uspace/lib/net/include/icmp_client.h	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -38,5 +38,5 @@
 #define __NET_ICMP_CLIENT_H__
 
-#include <icmp_codes.h>
+#include <net/icmp_codes.h>
 #include <net/packet.h>
 
Index: uspace/lib/net/include/icmp_header.h
===================================================================
--- uspace/lib/net/include/icmp_header.h	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ uspace/lib/net/include/icmp_header.h	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -42,5 +42,5 @@
 
 #include <net/in.h>
-#include <icmp_codes.h>
+#include <net/icmp_codes.h>
 
 /** ICMP header size in bytes.
Index: uspace/lib/net/include/icmp_interface.h
===================================================================
--- uspace/lib/net/include/icmp_interface.h	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ uspace/lib/net/include/icmp_interface.h	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -42,6 +42,6 @@
 #include <net/inet.h>
 #include <net/ip_codes.h>
-#include <icmp_codes.h>
-#include <icmp_common.h>
+#include <net/icmp_codes.h>
+#include <net/icmp_common.h>
 
 /** @name ICMP module interface
Index: uspace/lib/net/tl/icmp_client.c
===================================================================
--- uspace/lib/net/tl/icmp_client.c	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ uspace/lib/net/tl/icmp_client.c	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -43,5 +43,5 @@
 #include <sys/types.h>
 
-#include <icmp_codes.h>
+#include <net/icmp_codes.h>
 #include <icmp_client.h>
 #include <net/packet.h>
Index: uspace/lib/net/tl/icmp_remote.c
===================================================================
--- uspace/lib/net/tl/icmp_remote.c	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ uspace/lib/net/tl/icmp_remote.c	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -40,4 +40,5 @@
 #include <ipc/ipc.h>
 #include <ipc/services.h>
+#include <ipc/icmp.h>
 #include <sys/types.h>
 
@@ -46,5 +47,4 @@
 #include <icmp_interface.h>
 #include <packet_client.h>
-#include <icmp_messages.h>
 
 int icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code, icmp_param_t mtu, packet_t packet){
Index: uspace/lib/socket/Makefile
===================================================================
--- uspace/lib/socket/Makefile	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ uspace/lib/socket/Makefile	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -33,6 +33,4 @@
 
 SOURCES = \
-	generic/icmp_common.c \
-	generic/icmp_api.c \
 	packet/packet_server.c
 
Index: uspace/lib/socket/generic/icmp_api.c
===================================================================
--- uspace/lib/socket/generic/icmp_api.c	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ 	(revision )
@@ -1,69 +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 icmp
- *  @{
- */
-
-/** @file
- *  ICMP application interface implementation.
- *  @see icmp_api.h
- */
-
-#include <net/socket_codes.h>
-#include <net/inet.h>
-#include <async.h>
-
-#include <ipc/ipc.h>
-#include <ipc/services.h>
-
-#include <sys/types.h>
-
-#include <net/modules.h>
-#include <icmp_api.h>
-#include <net/ip_codes.h>
-#include <icmp_messages.h>
-
-int icmp_echo_msg(int icmp_phone, 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;
-	ipcarg_t result;
-
-	if(addrlen <= 0){
-		return EINVAL;
-	}
-	message_id = async_send_5(icmp_phone, NET_ICMP_ECHO, size, timeout, ttl, tos, (ipcarg_t) dont_fragment, NULL);
-	// send the address
-	async_data_write_start(icmp_phone, addr, (size_t) addrlen);
-	// timeout version may cause inconsistency - there is also an inner timer
-	// return async_wait_timeout(message_id, &result, timeout);
-	async_wait_for(message_id, &result);
-	return (int) result;
-}
-
-/** @}
- */
Index: uspace/lib/socket/generic/icmp_common.c
===================================================================
--- uspace/lib/socket/generic/icmp_common.c	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ 	(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 icmp
- *  @{
- */
-
-/** @file
- *  ICMP common interface implementation.
- *  @see icmp_common.h
- */
-
-#include <async.h>
-#include <ipc/services.h>
-
-#include <net/modules.h>
-#include <icmp_common.h>
-#include <icmp_messages.h>
-
-int icmp_connect_module(services_t service, suseconds_t timeout){
-	int phone;
-
-	phone = connect_to_service_timeout(SERVICE_ICMP, timeout);
-	if(phone >= 0){
-		async_req_0_0(phone, NET_ICMP_INIT);
-	}
-	return phone;
-}
-
-/** @}
- */
Index: uspace/lib/socket/include/icmp_api.h
===================================================================
--- uspace/lib/socket/include/icmp_api.h	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ 	(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 icmp
- *  @{
- */
-
-/** @file
- *  ICMP module application interface.
- */
-
-#ifndef __NET_ICMP_API_H__
-#define __NET_ICMP_API_H__
-
-#include <net/socket_codes.h>
-#include <net/inet.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-#include <net_device.h>
-#include <adt/measured_strings.h>
-#include <net/packet.h>
-#include <net/ip_codes.h>
-#include <icmp_codes.h>
-#include <icmp_common.h>
-
-/** @name ICMP module application interface
- *  This interface is used by other application modules.
- */
-/*@{*/
-
-/** 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 occurres.
- *  @param[in] icmp_phone The ICMP module phone used for (semi)remote calls.
- *  @param[in] size The message data length in bytes.
- *  @param[in] timeout The timeout in miliseconds.
- *  @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.
- *  @returns ICMP_ECHO on success.
- *  @returns ETIMEOUT if the reply has not arrived before the timeout.
- *  @returns ICMP type of the received error notification. 
- *  @returns EINVAL if the addrlen parameter is less or equal to zero (<=0).
- *  @returns ENOMEM if there is not enough memory left.
- *  @returns EPARTY if there was an internal error.
- */
-extern int icmp_echo_msg(int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen);
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/lib/socket/include/icmp_codes.h
===================================================================
--- uspace/lib/socket/include/icmp_codes.h	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ 	(revision )
@@ -1,347 +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 icmp
- *  @{
- */
-
-/** @file
- *  ICMP types and codes according to the on-line IANA - ICMP Type Numbers - <http://http://www.iana.org/assignments/icmp-parameters>, cited September 14 2009.
- */
-
-#ifndef __NET_ICMP_CODES_H__
-#define __NET_ICMP_CODES_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/socket/include/icmp_common.h
===================================================================
--- uspace/lib/socket/include/icmp_common.h	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ 	(revision )
@@ -1,59 +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 icmp
- *  @{
- */
-
-/** @file
- *  ICMP module common interface.
- */
-
-#ifndef __NET_ICMP_COMMON_H__
-#define __NET_ICMP_COMMON_H__
-
-#include <ipc/services.h>
-
-#include <sys/time.h>
-
-/** Default timeout for incoming connections in microseconds.
- */
-#define ICMP_CONNECT_TIMEOUT	(1 * 1000 * 1000)
-
-/** Connects to the ICMP module.
- *  @param service The ICMP module service. Ignored parameter.
- *  @param[in] timeout The connection timeout in microseconds. No timeout if set to zero (0).
- *  @returns The ICMP module phone on success.
- *  @returns ETIMEOUT if the connection timeouted.
- */
-extern int icmp_connect_module(services_t service, suseconds_t timeout);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/socket/include/icmp_messages.h
===================================================================
--- uspace/lib/socket/include/icmp_messages.h	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ 	(revision )
@@ -1,132 +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 icmp
- *  @{
- */
-
-/** @file
- *  ICMP module messages.
- *  @see icmp_interface.h
- */
-
-#ifndef __NET_ICMP_MESSAGES__
-#define __NET_ICMP_MESSAGES__
-
-#include <ipc/ipc.h>
-#include <ipc/net.h>
-#include <sys/types.h>
-
-#include <icmp_codes.h>
-
-/** ICMP module messages.
- */
-typedef enum{
-	/** Sends echo request.
-	 *  @see icmp_echo()
-	 */
-	NET_ICMP_ECHO = NET_ICMP_FIRST,
-	/** Sends destination unreachable error message.
-	 *  @see icmp_destination_unreachable_msg()
-	 */
-	NET_ICMP_DEST_UNREACH,
-	/** Sends source quench error message.
-	 *  @see icmp_source_quench_msg()
-	 */
-	NET_ICMP_SOURCE_QUENCH,
-	/** Sends time exceeded error message.
-	 *  @see icmp_time_exceeded_msg()
-	 */
-	NET_ICMP_TIME_EXCEEDED,
-	/** Sends parameter problem error message.
-	 *  @see icmp_parameter_problem_msg()
-	 */
-	NET_ICMP_PARAMETERPROB,
-	/** Initializes new connection.
-	 */
-	NET_ICMP_INIT
-} icmp_messages;
-
-/** @name ICMP specific message parameters definitions
- */
-/*@{*/
-
-/** Returns the ICMP code message parameter.
- *  @param[in] call The message call structure.
- */
-#define ICMP_GET_CODE(call) \
-	({icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); code;})
-
-/** Returns the ICMP link MTU message parameter.
- *  @param[in] call The message call structure.
- */
-#define ICMP_GET_MTU(call) \
-	({icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); mtu;})
-
-/** Returns the pointer message parameter.
- *  @param[in] call The message call structure.
- */
-#define ICMP_GET_POINTER(call) \
-	({icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); pointer;})
-
-/** Returns the size message parameter.
- *  @param[in] call The message call structure.
- */
-#define ICMP_GET_SIZE(call) \
-	({size_t size = (size_t) IPC_GET_ARG1(call); size;})
-
-/** Returns the timeout message parameter.
- *  @param[in] call The message call structure.
- */
-#define ICMP_GET_TIMEOUT(call) \
-	(({suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); timeout;}))
-
-/** Returns the time to live message parameter.
- *  @param[in] call The message call structure.
- */
-#define ICMP_GET_TTL(call) \
-	({ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); ttl;})
-
-/** Returns the type of service message parameter.
- *  @param[in] call The message call structure.
- */
-#define ICMP_GET_TOS(call) \
-	({ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); tos;})
-
-/** Returns the dont fragment message parameter.
- *  @param[in] call The message call structure.
- */
-#define ICMP_GET_DONT_FRAGMENT(call) \
-	({int dont_fragment = (int) IPC_GET_ARG5(call); dont_fragment;})
-
-/*@}*/
-
-#endif
-
-/** @}
- */
Index: uspace/srv/net/il/ip/ip.c
===================================================================
--- uspace/srv/net/il/ip/ip.c	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ uspace/srv/net/il/ip/ip.c	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -58,5 +58,5 @@
 #include <net_device.h>
 #include <icmp_client.h>
-#include <icmp_codes.h>
+#include <net/icmp_codes.h>
 #include <icmp_interface.h>
 #include <il_interface.h>
Index: uspace/srv/net/tl/icmp/icmp.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp.c	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ uspace/srv/net/tl/icmp/icmp.c	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -44,4 +44,5 @@
 #include <ipc/ipc.h>
 #include <ipc/services.h>
+#include <ipc/icmp.h>
 #include <sys/time.h>
 #include <sys/types.h>
@@ -59,8 +60,8 @@
 #include <packet_remote.h>
 #include <net_checksum.h>
-#include <icmp_api.h>
+#include <net/icmp_api.h>
 #include <icmp_client.h>
-#include <icmp_codes.h>
-#include <icmp_common.h>
+#include <net/icmp_codes.h>
+#include <net/icmp_common.h>
 #include <icmp_interface.h>
 #include <il_interface.h>
@@ -71,5 +72,4 @@
 #include <tl_interface.h>
 #include <tl_local.h>
-#include <icmp_messages.h>
 #include <icmp_header.h>
 
Index: uspace/srv/net/tl/icmp/icmp.h
===================================================================
--- uspace/srv/net/tl/icmp/icmp.h	(revision f3b405144d240cabac21367749e140e31fa2144b)
+++ uspace/srv/net/tl/icmp/icmp.h	(revision 753bca36deef6be542a11061ac60bd262f76f43f)
@@ -40,5 +40,5 @@
 #include <fibril_synch.h>
 
-#include <icmp_codes.h>
+#include <net/icmp_codes.h>
 #include <adt/int_map.h>
 #include <icmp_header.h>
