Index: uspace/lib/net/Makefile
===================================================================
--- uspace/lib/net/Makefile	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/Makefile	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -33,4 +33,5 @@
 
 SOURCES = \
+	generic/generic.c \
 	generic/net_remote.c \
 	generic/net_checksum.c \
Index: uspace/lib/net/generic/generic.c
===================================================================
--- uspace/lib/net/generic/generic.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
+++ uspace/lib/net/generic/generic.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -0,0 +1,265 @@
+/*
+ * 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 communication interfaces for networking.
+ */
+
+#include <generic.h>
+
+#include <async.h>
+#include <ipc/ipc.h>
+#include <ipc/services.h>
+
+#include <net/device.h>
+#include <adt/measured_strings.h>
+#include <net/packet.h>
+
+/** Notify the module about the device state change.
+ *
+ * @param[in] phone	The service module phone.
+ * @param[in] message	The service specific message.
+ * @param[in] device_id	The device identifier.
+ * @param[in] state	The new device state.
+ * @param[in] target	The target module service.
+ * @return		EOK on success.
+ *
+ */
+int
+generic_device_state_msg_remote(int phone, int message, device_id_t device_id,
+    int state, services_t target)
+{
+	async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id,
+	    (ipcarg_t) state, target);
+	
+	return EOK;
+}
+
+/** Notify a module about the device.
+ *
+ * @param[in] phone	The service module phone.
+ * @param[in] message	The service specific message.
+ * @param[in] device_id	The device identifier.
+ * @param[in] arg2	The second argument of the message.
+ * @param[in] service	The device module service.
+ * @return		EOK on success.
+ * @return		Other error codes as defined for the specific service
+ *			 message.
+ *
+ */
+int
+generic_device_req_remote(int phone, int message, device_id_t device_id,
+    int arg2, services_t service)
+{
+	return (int) async_req_3_0(phone, (ipcarg_t) message,
+	    (ipcarg_t) device_id, (ipcarg_t) arg2, (ipcarg_t) service);
+}
+
+/** Returns the address.
+ *
+ * @param[in] phone	The service module phone.
+ * @param[in] message	The service specific message.
+ * @param[in] device_id	The device identifier.
+ * @param[out] address	The desired address.
+ * @param[out] data	The address data container.
+ * @returns		EOK on success.
+ * @returns		EBADMEM if the address parameter and/or the data
+ *			parameter is NULL.
+ * @returns		Other error codes as defined for the specific service
+ *			message.
+ */
+int
+generic_get_addr_req(int phone, int message, device_id_t device_id,
+    measured_string_ref *address, char ** data)
+{
+	aid_t message_id;
+	ipcarg_t result;
+	int string;
+
+	if (!address || !data)
+		return EBADMEM;
+
+	// request the address
+	message_id = async_send_1(phone, (ipcarg_t) message,
+	    (ipcarg_t) device_id, NULL);
+	string = measured_strings_return(phone, address, data, 1);
+	async_wait_for(message_id, &result);
+
+	// if not successful
+	if ((string == EOK) && (result != EOK)) {
+		// clear the data
+		free(*address);
+		free(*data);
+	}
+	
+	return (int) result;
+}
+
+/** Return the device packet dimension for sending.
+ *
+ * @param[in] phone	The service module phone.
+ * @param[in] message	The service specific message.
+ * @param[in] device_id	The device identifier.
+ * @param[out] packet_dimension The packet dimension.
+ * @return		EOK on success.
+ * @return		EBADMEM if the packet_dimension parameter is NULL.
+ * @return		Other error codes as defined for the specific service
+ *			message.
+ */
+int
+generic_packet_size_req_remote(int phone, int message, device_id_t device_id,
+    packet_dimension_ref packet_dimension)
+{
+	if (!packet_dimension)
+		return EBADMEM;
+	
+	ipcarg_t addr_len;
+	ipcarg_t prefix;
+	ipcarg_t content;
+	ipcarg_t suffix;
+	
+	ipcarg_t result = async_req_1_4(phone, (ipcarg_t) message,
+	    (ipcarg_t) device_id, &addr_len, &prefix, &content, &suffix);
+	
+	packet_dimension->prefix = (size_t) prefix;
+	packet_dimension->content = (size_t) content;
+	packet_dimension->suffix = (size_t) suffix;
+	packet_dimension->addr_len = (size_t) addr_len;
+	
+	return (int) result;
+}
+
+/** Pass the packet queue to the module.
+ *
+ * @param[in] phone	The service module phone.
+ * @param[in] message	The service specific message.
+ * @param[in] device_id	The device identifier.
+ * @param[in] packet_id	The received packet or the received packet queue
+ *			identifier.
+ * @param[in] target	The target module service.
+ * @param[in] error	The error module service.
+ * @return		EOK on success.
+ */
+int
+generic_received_msg_remote(int phone, int message, device_id_t device_id,
+    packet_id_t packet_id, services_t target, services_t error)
+{
+	if (error) {
+		async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id,
+		    (ipcarg_t) packet_id, (ipcarg_t) target, (ipcarg_t) error);
+	} else {
+		async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id,
+		    (ipcarg_t) packet_id, (ipcarg_t) target);
+	}
+	
+	return EOK;
+}
+
+/** Send the packet queue.
+ *
+ * @param[in] phone	The service module phone.
+ * @param[in] message	The service specific message.
+ * @param[in] device_id	The device identifier.
+ * @param[in] packet_id	The packet or the packet queue identifier.
+ * @param[in] sender	The sending module service.
+ * @param[in] error	The error module service.
+ * @return		EOK on success.
+ *
+ */
+int
+generic_send_msg_remote(int phone, int message, device_id_t device_id,
+    packet_id_t packet_id, services_t sender, services_t error)
+{
+	if (error) {
+		async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id,
+		    (ipcarg_t) packet_id, (ipcarg_t) sender, (ipcarg_t) error);
+	} else {
+		async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id,
+		    (ipcarg_t) packet_id, (ipcarg_t) sender);
+	}
+	
+	return EOK;
+}
+
+/** Translates the given strings.
+ *
+ * Allocates and returns the needed memory block as the data parameter.
+ *
+ * @param[in] phone	The service module phone.
+ * @param[in] message	The service specific message.
+ * @param[in] device_id	The device identifier.
+ * @param[in] service	The module service.
+ * @param[in] configuration The key strings.
+ * @param[in] count	The number of configuration keys.
+ * @param[out] translation The translated values.
+ * @param[out] data	The translation data container.
+ * @returns		EOK on success.
+ * @returns		EINVAL if the configuration parameter is NULL.
+ * @returns		EINVAL if the count parameter is zero.
+ * @returns		EBADMEM if the translation or the data parameters are
+ *			NULL.
+ * @returns		Other error codes as defined for the specific service
+ *			message.
+ */
+int
+generic_translate_req(int phone, int message, device_id_t device_id,
+    services_t service, measured_string_ref configuration, size_t count,
+    measured_string_ref *translation, char **data)
+{
+	aid_t message_id;
+	ipcarg_t result;
+	int string;
+
+	if (!configuration || (count == 0))
+		return EINVAL;
+	if (!translation || !data)
+		return EBADMEM;
+
+	// request the translation
+	message_id = async_send_3(phone, (ipcarg_t) message,
+	    (ipcarg_t) device_id, (ipcarg_t) count, (ipcarg_t) service, NULL);
+	measured_strings_send(phone, configuration, count);
+	string = measured_strings_return(phone, translation, data, count);
+	async_wait_for(message_id, &result);
+
+	// if not successful
+	if ((string == EOK) && (result != EOK)) {
+		// clear the data
+		free(*translation);
+		free(*data);
+	}
+
+	return (int) result;
+}
+
+/** @}
+ */
Index: uspace/lib/net/generic/net_remote.c
===================================================================
--- uspace/lib/net/generic/net_remote.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/generic/net_remote.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -40,5 +40,5 @@
 #include <malloc.h>
 
-#include <net_messages.h>
+#include <generic.h>
 #include <net/modules.h>
 #include <net/device.h>
Index: uspace/lib/net/generic/packet_client.c
===================================================================
--- uspace/lib/net/generic/packet_client.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/generic/packet_client.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -43,5 +43,4 @@
 #include <packet_client.h>
 
-#include <net_messages.h>
 #include <net/packet.h>
 #include <net/packet_header.h>
Index: uspace/lib/net/generic/packet_remote.c
===================================================================
--- uspace/lib/net/generic/packet_remote.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/generic/packet_remote.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -43,5 +43,4 @@
 #include <sys/mman.h>
 
-#include <net_messages.h>
 #include <packet_client.h>
 #include <packet_remote.h>
Index: uspace/lib/net/il/arp_remote.c
===================================================================
--- uspace/lib/net/il/arp_remote.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/il/arp_remote.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -36,4 +36,8 @@
  */
 
+#include <arp_interface.h>
+#include <arp_messages.h>
+#include <generic.h>
+
 #include <async.h>
 #include <errno.h>
@@ -41,10 +45,7 @@
 #include <ipc/services.h>
 
-#include <net_messages.h>
 #include <net/modules.h>
 #include <net/device.h>
-#include <arp_interface.h>
 #include <adt/measured_strings.h>
-#include <arp_messages.h>
 
 int arp_connect_module(services_t service){
Index: uspace/lib/net/il/ip_remote.c
===================================================================
--- uspace/lib/net/il/ip_remote.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/il/ip_remote.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -40,15 +40,16 @@
  */
 
+#include <ip_remote.h>
+#include <ip_interface.h>
+#include <ip_messages.h>
+#include <il_messages.h>
+#include <packet_client.h>
+#include <generic.h>
+
 #include <ipc/services.h>
 
-#include <net_messages.h>
 #include <net/modules.h>
 #include <net/device.h>
 #include <net/inet.h>
-#include <ip_interface.h>
-#include <packet_client.h>
-#include <il_messages.h>
-#include <ip_messages.h>
-#include <ip_remote.h>
 
 /** Add a route to the device routing table.
Index: uspace/lib/net/include/arp_interface.h
===================================================================
--- uspace/lib/net/include/arp_interface.h	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/include/arp_interface.h	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -35,5 +35,10 @@
 
 #include <adt/measured_strings.h>
+#include <task.h>
+
+#include <ipc/services.h>
+
 #include <net/device.h>
+#include <net/socket.h>
 
 /** @name ARP module interface
Index: uspace/lib/net/include/generic.h
===================================================================
--- uspace/lib/net/include/generic.h	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
+++ uspace/lib/net/include/generic.h	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -0,0 +1,65 @@
+/*
+ * 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 communication interfaces for networking.
+ */
+
+#ifndef NET_GENERIC_H_
+#define NET_GENERIC_H_
+
+#include <async.h>
+#include <ipc/ipc.h>
+#include <ipc/services.h>
+
+#include <net/device.h>
+#include <adt/measured_strings.h>
+#include <net/packet.h>
+
+extern int generic_device_state_msg_remote(int, int, device_id_t, int,
+    services_t);
+extern int generic_device_req_remote(int, int, device_id_t, int, services_t);
+extern int generic_get_addr_req(int, int, device_id_t, measured_string_ref *,
+    char **);
+extern int generic_packet_size_req_remote(int, int, device_id_t,
+    packet_dimension_ref);
+extern int generic_received_msg_remote(int, int, device_id_t, packet_id_t,
+    services_t, services_t);
+extern int generic_send_msg_remote(int, int, device_id_t, packet_id_t,
+    services_t, services_t);
+extern int generic_translate_req(int, int, device_id_t, services_t,
+    measured_string_ref, size_t, measured_string_ref *, char **);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/il_interface.h
===================================================================
--- uspace/lib/net/include/il_interface.h	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/include/il_interface.h	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -39,13 +39,13 @@
 #define __NET_IL_INTERFACE_H__
 
-#include <async.h>
+#include <generic.h>
 
 #include <ipc/services.h>
 
-#include <net_messages.h>
 #include <net/device.h>
 #include <net/packet.h>
+#include <il_messages.h>
+
 #include <packet_client.h>
-#include <il_messages.h>
 
 /** @name Internetwork layer module interface
Index: uspace/lib/net/include/ip_remote.h
===================================================================
--- uspace/lib/net/include/ip_remote.h	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/include/ip_remote.h	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -34,5 +34,4 @@
 #define __NET_IP_REMOTE_H__
 
-#include <async.h>
 #include <ipc/services.h>
 
@@ -40,4 +39,7 @@
 #include <net/inet.h>
 #include <net/in.h>
+#include <net/packet.h>
+#include <net/device.h>
+#include <net/socket.h>
 
 extern int ip_set_gateway_req_remote(int, device_id_t, in_addr_t);
Index: uspace/lib/net/include/netif_remote.h
===================================================================
--- uspace/lib/net/include/netif_remote.h	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/include/netif_remote.h	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -34,7 +34,7 @@
 #define __NET_NETIF_REMOTE_H__
 
-#include <async.h>
-#include <fibril_synch.h>
-#include <ipc/ipc.h>
+#include <ipc/services.h>
+#include <adt/measured_strings.h>
+#include <net/device.h>
 
 extern int netif_get_addr_req_remote(int, device_id_t, measured_string_ref *,
Index: uspace/lib/net/include/nil_interface.h
===================================================================
--- uspace/lib/net/include/nil_interface.h	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/include/nil_interface.h	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -39,9 +39,7 @@
 #include <ipc/ipc.h>
 
-#include <net_messages.h>
-#include <adt/measured_strings.h>
-#include <net/packet.h>
+#include <generic.h>
 #include <nil_messages.h>
-#include <net/device.h>
+#include <nil_remote.h>
 
 #define nil_bind_service(service, device_id, me, receiver) \
@@ -67,8 +65,4 @@
 	    netif_service)
 
-
-#include <nil_remote.h>
-#include <packet/packet_server.h>
-
 #define nil_device_state_msg  nil_device_state_msg_remote
 #define nil_received_msg      nil_received_msg_remote
Index: uspace/lib/net/include/nil_remote.h
===================================================================
--- uspace/lib/net/include/nil_remote.h	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/include/nil_remote.h	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -34,7 +34,7 @@
 #define __NET_NIL_REMOTE_H__
 
-#include <async.h>
-#include <fibril_synch.h>
-#include <ipc/ipc.h>
+#include <ipc/services.h>
+#include <net/device.h>
+#include <net/packet.h>
 
 extern int nil_device_state_msg_remote(int, device_id_t, int);
Index: uspace/lib/net/include/tl_interface.h
===================================================================
--- uspace/lib/net/include/tl_interface.h	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/include/tl_interface.h	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -41,5 +41,5 @@
 #include <ipc/services.h>
 
-#include <net_messages.h>
+#include <generic.h>
 #include <net/device.h>
 #include <net/packet.h>
Index: uspace/lib/net/netif/netif_local.c
===================================================================
--- uspace/lib/net/netif/netif_local.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/netif/netif_local.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -44,5 +44,5 @@
 #include <err.h>
 
-#include <net_messages.h>
+#include <generic.h>
 #include <net/modules.h>
 #include <net/packet.h>
Index: uspace/lib/net/netif/netif_remote.c
===================================================================
--- uspace/lib/net/netif/netif_remote.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/netif/netif_remote.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -44,5 +44,5 @@
 #include <netif_remote.h>
 #include <netif_messages.h>
-#include <net_messages.h>
+#include <generic.h>
 
 int netif_get_addr_req_remote(int netif_phone, device_id_t device_id,
Index: uspace/lib/net/nil/nil_remote.c
===================================================================
--- uspace/lib/net/nil/nil_remote.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/nil/nil_remote.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -36,11 +36,11 @@
  */
 
-#include <net_messages.h>
+#include <nil_remote.h>
+#include <nil_interface.h>
+#include <nil_messages.h>
+#include <generic.h>
 #include <net/device.h>
-#include <nil_interface.h>
 #include <net/packet.h>
 #include <packet_client.h>
-#include <nil_messages.h>
-#include <nil_remote.h>
 
 /** Notify the network interface layer about the device state change.
Index: uspace/lib/net/tl/icmp_remote.c
===================================================================
--- uspace/lib/net/tl/icmp_remote.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/net/tl/icmp_remote.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -43,5 +43,4 @@
 #include <sys/types.h>
 
-#include <net_messages.h>
 #include <net/modules.h>
 #include <icmp_interface.h>
Index: uspace/lib/socket/include/net_messages.h
===================================================================
--- uspace/lib/socket/include/net_messages.h	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ 	(revision )
@@ -1,254 +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
- *  Networking common message definitions.
- */
-
-#ifndef __NET_MESSAGES_H__
-#define __NET_MESSAGES_H__
-
-#include <async.h>
-#include <ipc/ipc.h>
-#include <ipc/services.h>
-
-#include <net/device.h>
-#include <adt/measured_strings.h>
-#include <net/packet.h>
-
-/** Notify the module about the device state change.
- *
- * @param[in] phone     The service module phone.
- * @param[in] message   The service specific message.
- * @param[in] device_id The device identifier.
- * @param[in] state     The new device state.
- * @param[in] target    The target module service.
- *
- * @return EOK on success.
- *
- */
-static inline int generic_device_state_msg_remote(int phone, int message,
-    device_id_t device_id, int state, services_t target)
-{
-	async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id,
-	    (ipcarg_t) state, target);
-	
-	return EOK;
-}
-
-/** Notify a module about the device.
- *
- * @param[in] phone     The service module phone.
- * @param[in] message   The service specific message.
- * @param[in] device_id The device identifier.
- * @param[in] arg2      The second argument of the message.
- * @param[in] service   The device module service.
- *
- * @return EOK on success.
- * @return Other error codes as defined for the specific service message.
- *
- */
-static inline int generic_device_req_remote(int phone, int message,
-    device_id_t device_id, int arg2, services_t service)
-{
-	return (int) async_req_3_0(phone, (ipcarg_t) message, (ipcarg_t) device_id,
-	    (ipcarg_t) arg2, (ipcarg_t) service);
-}
-
-/** Returns the address.
- *  @param[in] phone The service module phone.
- *  @param[in] message The service specific message.
- *  @param[in] device_id The device identifier.
- *  @param[out] address The desired address.
- *  @param[out] data The address data container.
- *  @returns EOK on success.
- *  @returns EBADMEM if the address parameter and/or the data parameter is NULL.
- *  @returns Other error codes as defined for the specific service message.
- */
-static inline int generic_get_addr_req(int phone, int message, device_id_t device_id, measured_string_ref * address, char ** data){
-	aid_t message_id;
-	ipcarg_t result;
-	int string;
-
-	if(!(address && data)){
-		return EBADMEM;
-	}
-
-	// request the address
-	message_id = async_send_1(phone, (ipcarg_t) message, (ipcarg_t) device_id, NULL);
-	string = measured_strings_return(phone, address, data, 1);
-	async_wait_for(message_id, &result);
-
-	// if not successful
-	if((string == EOK) && (result != EOK)){
-		// clear the data
-		free(*address);
-		free(*data);
-	}
-	return (int) result;
-}
-
-/** Return the device packet dimension for sending.
- *
- * @param[in]  phone            The service module phone.
- * @param[in]  message          The service specific message.
- * @param[in]  device_id        The device identifier.
- * @param[out] packet_dimension The packet dimension.
- *
- * @return EOK on success.
- * @return EBADMEM if the packet_dimension parameter is NULL.
- * @return Other error codes as defined for the specific service message.
- *
- */
-static inline int generic_packet_size_req_remote(int phone, int message,
-    device_id_t device_id, packet_dimension_ref packet_dimension)
-{
-	if (!packet_dimension)
-		return EBADMEM;
-	
-	ipcarg_t addr_len;
-	ipcarg_t prefix;
-	ipcarg_t content;
-	ipcarg_t suffix;
-	
-	ipcarg_t result = async_req_1_4(phone, (ipcarg_t) message,
-	    (ipcarg_t) device_id, &addr_len, &prefix, &content, &suffix);
-	
-	packet_dimension->prefix = (size_t) prefix;
-	packet_dimension->content = (size_t) content;
-	packet_dimension->suffix = (size_t) suffix;
-	packet_dimension->addr_len = (size_t) addr_len;
-	
-	return (int) result;
-}
-
-/** Pass the packet queue to the module.
- *
- * @param[in] phone     The service module phone.
- * @param[in] message   The service specific message.
- * @param[in] device_id The device identifier.
- * @param[in] packet_id The received packet or the received packet queue
- *                      identifier.
- * @param[in] target    The target module service.
- * @param[in] error     The error module service.
- *
- * @return EOK on success.
- *
- */
-static inline int generic_received_msg_remote(int phone, int message,
-    device_id_t device_id, packet_id_t packet_id, services_t target,
-    services_t error)
-{
-	if (error)
-		async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id,
-		    (ipcarg_t) packet_id, (ipcarg_t) target, (ipcarg_t) error);
-	else
-		async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id,
-		    (ipcarg_t) packet_id, (ipcarg_t) target);
-	
-	return EOK;
-}
-
-/** Send the packet queue.
- *
- * @param[in] phone     The service module phone.
- * @param[in] message   The service specific message.
- * @param[in] device_id The device identifier.
- * @param[in] packet_id The packet or the packet queue identifier.
- * @param[in] sender    The sending module service.
- * @param[in] error     The error module service.
- *
- * @return EOK on success.
- *
- */
-static inline int generic_send_msg_remote(int phone, int message,
-    device_id_t device_id, packet_id_t packet_id, services_t sender,
-    services_t error)
-{
-	if (error)
-		async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id,
-		    (ipcarg_t) packet_id, (ipcarg_t) sender, (ipcarg_t) error);
-	else
-		async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id,
-		    (ipcarg_t) packet_id, (ipcarg_t) sender);
-	
-	return EOK;
-}
-
-/** Translates the given strings.
- *  Allocates and returns the needed memory block as the data parameter.
- *  @param[in] phone The service module phone.
- *  @param[in] message The service specific message.
- *  @param[in] device_id The device identifier.
- *  @param[in] service The module service.
- *  @param[in] configuration The key strings.
- *  @param[in] count The number of configuration keys.
- *  @param[out] translation The translated values.
- *  @param[out] data The translation data container.
- *  @returns EOK on success.
- *  @returns EINVAL if the configuration parameter is NULL.
- *  @returns EINVAL if the count parameter is zero (0).
- *  @returns EBADMEM if the translation or the data parameters are NULL.
- *  @returns Other error codes as defined for the specific service message.
- */
-static inline int generic_translate_req(int phone, int message, device_id_t device_id, services_t service, measured_string_ref configuration, size_t count, measured_string_ref * translation, char ** data){
-	aid_t message_id;
-	ipcarg_t result;
-	int string;
-
-	if(!(configuration && (count > 0))){
-		return EINVAL;
-	}
-	if(!(translation && data)){
-		return EBADMEM;
-	}
-
-	// request the translation
-	message_id = async_send_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) count, (ipcarg_t) service, NULL);
-	measured_strings_send(phone, configuration, count);
-	string = measured_strings_return(phone, translation, data, count);
-	async_wait_for(message_id, &result);
-
-	// if not successful
-	if((string == EOK) && (result != EOK)){
-		// clear the data
-		free(*translation);
-		free(*data);
-	}
-
-	return (int) result;
-}
-
-#endif
-
-/** @}
- */
Index: uspace/lib/socket/packet/packet_server.c
===================================================================
--- uspace/lib/socket/packet/packet_server.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/lib/socket/packet/packet_server.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -46,9 +46,10 @@
 #include <ipc/ipc.h>
 #include <ipc/packet.h>
+#include <ipc/net.h>
+
 #include <net/packet.h>
 #include <net/packet_header.h>
+
 #include <packet/packet_server.h>
-
-#include <net_messages.h>
 #include <packet/packet_local.h>
 
Index: uspace/srv/hw/netif/dp8390/dp8390_module.c
===================================================================
--- uspace/srv/hw/netif/dp8390/dp8390_module.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/srv/hw/netif/dp8390/dp8390_module.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -44,5 +44,4 @@
 #include <ipc/services.h>
 
-#include <net_messages.h>
 #include <net/modules.h>
 #include <packet_client.h>
Index: uspace/srv/net/il/arp/arp.c
===================================================================
--- uspace/srv/net/il/arp/arp.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/srv/net/il/arp/arp.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -45,8 +45,8 @@
 #include <ipc/ipc.h>
 #include <ipc/services.h>
+#include <ipc/net.h>
 #include <byteorder.h>
 #include <err.h>
 
-#include <net_messages.h>
 #include <net/modules.h>
 #include <net/device.h>
Index: uspace/srv/net/il/ip/ip.c
===================================================================
--- uspace/srv/net/il/ip/ip.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/srv/net/il/ip/ip.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -44,4 +44,5 @@
 #include <ipc/ipc.h>
 #include <ipc/services.h>
+#include <ipc/net.h>
 #include <sys/types.h>
 #include <byteorder.h>
@@ -52,11 +53,11 @@
 #include <net/inet.h>
 #include <net/modules.h>
-
-#include <net_messages.h>
+#include <net/device.h>
+#include <net/packet.h>
+#include <net/icmp_codes.h>
+
 #include <arp_interface.h>
 #include <net_checksum.h>
-#include <net/device.h>
 #include <icmp_client.h>
-#include <net/icmp_codes.h>
 #include <icmp_interface.h>
 #include <il_interface.h>
Index: uspace/srv/net/net/net.c
===================================================================
--- uspace/srv/net/net/net.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/srv/net/net/net.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -46,7 +46,7 @@
 
 #include <ipc/ipc.h>
+#include <ipc/net.h>
 #include <ipc/services.h>
 
-#include <net_messages.h>
 #include <net/modules.h>
 #include <adt/char_map.h>
Index: uspace/srv/net/netif/lo/lo.c
===================================================================
--- uspace/srv/net/netif/lo/lo.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/srv/net/netif/lo/lo.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -44,5 +44,4 @@
 #include <ipc/services.h>
 
-#include <net_messages.h>
 #include <net/modules.h>
 #include <adt/measured_strings.h>
Index: uspace/srv/net/nil/eth/eth.c
===================================================================
--- uspace/srv/net/nil/eth/eth.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/srv/net/nil/eth/eth.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -45,7 +45,7 @@
 
 #include <ipc/ipc.h>
+#include <ipc/net.h>
 #include <ipc/services.h>
 
-#include <net_messages.h>
 #include <net/modules.h>
 #include <net_checksum.h>
Index: uspace/srv/net/nil/nildummy/nildummy.c
===================================================================
--- uspace/srv/net/nil/nildummy/nildummy.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/srv/net/nil/nildummy/nildummy.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -43,7 +43,7 @@
 #include <err.h>
 #include <ipc/ipc.h>
+#include <ipc/net.h>
 #include <ipc/services.h>
 
-#include <net_messages.h>
 #include <net/modules.h>
 #include <net/device.h>
Index: uspace/srv/net/tl/icmp/icmp.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/srv/net/tl/icmp/icmp.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -44,4 +44,5 @@
 #include <ipc/ipc.h>
 #include <ipc/services.h>
+#include <ipc/net.h>
 #include <ipc/icmp.h>
 #include <sys/time.h>
@@ -55,5 +56,4 @@
 #include <net/inet.h>
 
-#include <net_messages.h>
 #include <net/modules.h>
 #include <packet_client.h>
Index: uspace/srv/net/tl/tcp/tcp.c
===================================================================
--- uspace/srv/net/tl/tcp/tcp.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/srv/net/tl/tcp/tcp.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -47,4 +47,5 @@
 #include <ipc/ipc.h>
 #include <ipc/services.h>
+#include <ipc/net.h>
 #include <ipc/socket.h>
 
@@ -56,5 +57,4 @@
 #include <net/modules.h>
 
-#include <net_messages.h>
 #include <adt/dynamic_fifo.h>
 #include <packet_client.h>
Index: uspace/srv/net/tl/udp/udp.c
===================================================================
--- uspace/srv/net/tl/udp/udp.c	(revision a3582791922a7e7b83cd5dee6c372bd9566d3a32)
+++ uspace/srv/net/tl/udp/udp.c	(revision 514ee46735ae99a559924fd69a01def4b9b49fff)
@@ -42,4 +42,5 @@
 #include <ipc/ipc.h>
 #include <ipc/services.h>
+#include <ipc/net.h>
 #include <ipc/socket.h>
 #include <errno.h>
@@ -53,5 +54,4 @@
 #include <net/modules.h>
 
-#include <net_messages.h>
 #include <adt/dynamic_fifo.h>
 #include <packet_client.h>
