Index: uspace/lib/net/include/arp_interface.h
===================================================================
--- uspace/lib/net/include/arp_interface.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/lib/net/include/arp_interface.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -29,11 +29,4 @@
 /** @addtogroup arp
  *  @{
- */
-
-/** @file
- *  ARP module interface.
- *  The same interface is used for standalone remote modules as well as for bundle modules.
- *  The standalone remote modules have to be compiled with the arp_remote.c source file.
- *  The bundle modules with the arp.c source file.
  */
 
Index: uspace/lib/net/include/icmp_interface.h
===================================================================
--- uspace/lib/net/include/icmp_interface.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/lib/net/include/icmp_interface.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -29,11 +29,4 @@
 /** @addtogroup icmp
  *  @{
- */
-
-/** @file
- *  ICMP module interface.
- *  The same interface is used for standalone remote modules as well as for bundle modules.
- *  The standalone remote modules have to be compiled with the icmp_remote.c source file.
- *  The bundle modules with the icmp.c source file.
  */
 
Index: uspace/lib/net/include/il_interface.h
===================================================================
--- uspace/lib/net/include/il_interface.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/lib/net/include/il_interface.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -32,6 +32,6 @@
 
 /** @file
- *  Internetwork layer module interface for the underlying network interface layer.
- *  This interface is always called by the standalone remote modules.
+ * Internetwork layer module interface for the underlying network interface layer.
+ * This interface is always called by the remote modules.
  */
 
@@ -50,39 +50,63 @@
 
 /** @name Internetwork layer module interface
- *  This interface is used by other modules.
+ * This interface is used by other modules.
  */
 /*@{*/
 
-/** Notifies the internetwork layer modules about the device state change.
- *  @param[in] il_phone The internetwork layer module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] state The new device state.
- *  @param[in] target The target internetwork module service to be delivered to.
- *  @returns EOK on success.
+/** Notify the internetwork layer modules about the device state change.
+ *
+ * @param[in] il_phone  The internetwork layer module phone used for
+ *                      (semi)remote calls.
+ * @param[in] device_id The device identifier.
+ * @param[in] state     The new device state.
+ * @param[in] target    The target internetwork module service to be
+ *                      delivered to.
+ *
+ * @return EOK on success.
+ *
  */
-static inline int il_device_state_msg(int il_phone, device_id_t device_id, device_state_t state, services_t target){
-	return generic_device_state_msg(il_phone, NET_IL_DEVICE_STATE, device_id, state, target);
+static inline int il_device_state_msg(int il_phone, device_id_t device_id,
+    device_state_t state, services_t target)
+{
+	return generic_device_state_msg_remote(il_phone, NET_IL_DEVICE_STATE,
+	    device_id, state, target);
 }
 
-/** Notifies the internetwork layer modules about the received packet/s.
- *  @param[in] il_phone The internetwork layer module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The received packet or the received packet queue.
- *  @param[in] target The target internetwork module service to be delivered to.
- *  @returns EOK on success.
+/** Notify the internetwork layer modules about the received packet/s.
+ *
+ * @param[in] il_phone  The internetwork layer module phone used for
+ *                      (semi)remote calls.
+ * @param[in] device_id The device identifier.
+ * @param[in] packet    The received packet or the received packet queue.
+ * @param[in] target    The target internetwork module service to be
+ *                      delivered to.
+ *
+ * @return EOK on success.
+ *
  */
-inline static int il_received_msg(int il_phone, device_id_t device_id, packet_t packet, services_t target){
-	return generic_received_msg(il_phone, NET_IL_RECEIVED, device_id, packet_get_id(packet), target, 0);
+inline static int il_received_msg(int il_phone, device_id_t device_id,
+    packet_t packet, services_t target)
+{
+	return generic_received_msg_remote(il_phone, NET_IL_RECEIVED, device_id,
+	    packet_get_id(packet), target, 0);
 }
 
-/** Notifies the internetwork layer modules about the mtu change.
- *  @param[in] il_phone The internetwork layer module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] mtu The new mtu value.
- *  @param[in] target The target internetwork module service to be delivered to.
- *  @returns EOK on success.
+/** Notify the internetwork layer modules about the mtu change.
+ *
+ * @param[in] il_phone  The internetwork layer module phone used for
+ *                      (semi)remote calls.
+ * @param[in] device_id The device identifier.
+ * @param[in] mtu       The new mtu value.
+ * @param[in] target    The target internetwork module service to be
+ *                      delivered to.
+ *
+ * @return EOK on success.
+ *
  */
-inline static int il_mtu_changed_msg(int il_phone, device_id_t device_id, size_t mtu, services_t target){
-	return generic_device_state_msg(il_phone, NET_IL_MTU_CHANGED, device_id, (int) mtu, target);
+inline static int il_mtu_changed_msg(int il_phone, device_id_t device_id,
+    size_t mtu, services_t target)
+{
+	return generic_device_state_msg_remote(il_phone, NET_IL_MTU_CHANGED,
+	    device_id, (int) mtu, target);
 }
 
Index: uspace/lib/net/include/il_local.h
===================================================================
--- uspace/lib/net/include/il_local.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
+++ uspace/lib/net/include/il_local.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup il_local
+ *  @{
+ */
+
+#ifndef __IL_LOCAL_H__
+#define __IL_LOCAL_H__
+
+#include <ipc/ipc.h>
+#include <async.h>
+
+extern int il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
+    ipc_call_t *answer, int *answer_count);
+extern int il_module_start_standalone(async_client_conn_t client_connection);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/il_messages.h
===================================================================
--- uspace/lib/net/include/il_messages.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/lib/net/include/il_messages.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -28,11 +28,11 @@
 
 /** @addtogroup net_il
- *  @{
+ * @{
  */
 
 /** @file
- *  Internetwork layer modules messages.
- *  @see il_interface.h
- *  @see ip_interface.h
+ * Internetwork layer modules messages.
+ * @see il_interface.h
+ * @see ip_interface.h
  */
 
@@ -72,16 +72,19 @@
 
 /** @name Internetwork layer specific message parameters definitions
+ *
  */
 /*@{*/
 
-/** Returns the protocol number message parameter.
- *  @param[in] call The message call structure.
+/** Return the protocol number message parameter.
+ * @param[in] call The message call structure.
+ *
  */
-#define IL_GET_PROTO(call)		(int) IPC_GET_ARG1(*call)
+#define IL_GET_PROTO(call)  (int) IPC_GET_ARG1(*call)
 
-/** Returns the registering service message parameter.
- *  @param[in] call The message call structure.
+/** Return the registering service message parameter.
+ * @param[in] call The message call structure.
+ *
  */
-#define IL_GET_SERVICE(call)	(services_t) IPC_GET_ARG2(*call)
+#define IL_GET_SERVICE(call)  (services_t) IPC_GET_ARG2(*call)
 
 /*@}*/
Index: uspace/lib/net/include/il_standalone.h
===================================================================
--- uspace/lib/net/include/il_standalone.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup il_standalone
- *  @{
- */
-
-#ifndef __IL_STANDALONE_H__
-#define __IL_STANDALONE_H__
-
-#include <ipc/ipc.h>
-#include <async.h>
-
-extern int il_module_message(ipc_callid_t callid, ipc_call_t *call,
-    ipc_call_t *answer, int *answer_count);
-extern int il_module_start(async_client_conn_t client_connection);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/ip_client.h
===================================================================
--- uspace/lib/net/include/ip_client.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/lib/net/include/ip_client.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -87,5 +87,5 @@
  *  @returns EINVAL if the headerlen parameter is not IPv4 pseudo header length.
  */
-extern int ip_client_set_pseudo_header_data_length(ip_pseudo_header_ref header, size_t headerlen, size_t data_length);
+extern int ip_client_set_pseudo_header_data_length(void *header, size_t headerlen, size_t data_length);
 
 /** Constructs the IPv4 pseudo header.
@@ -107,5 +107,5 @@
  *  @returns ENOMEM if there is not enough memory left.
  */
-extern int ip_client_get_pseudo_header(ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, ip_pseudo_header_ref * header, size_t * headerlen);
+extern int ip_client_get_pseudo_header(ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, void **header, size_t * headerlen);
 
 // TODO ipopt manipulation
Index: uspace/lib/net/include/ip_interface.h
===================================================================
--- uspace/lib/net/include/ip_interface.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/lib/net/include/ip_interface.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -31,11 +31,4 @@
  */
 
-/** @file
- *  IP module interface.
- *  The same interface is used for standalone remote modules as well as for bundle modules.
- *  The standalone remote modules have to be compiled with the ip_remote.c source file.
- *  The bundle modules with the ip.c source file.
- */
-
 #ifndef __NET_IP_INTERFACE_H__
 #define __NET_IP_INTERFACE_H__
@@ -51,12 +44,34 @@
 #include <socket_codes.h>
 
+#ifdef CONFIG_IL_TL_BUNDLE
+
+#include <ip_local.h>
+
+#define ip_received_error_msg  ip_received_error_msg_local
+#define ip_set_gateway_req     ip_set_gateway_req_local
+#define ip_packet_size_req     ip_packet_size_req_local
+#define ip_device_req          ip_device_req_local
+#define ip_add_route_req       ip_add_route_req_local
+#define ip_send_msg            ip_send_msg_local
+#define ip_get_route_req       ip_get_route_req_local
+
+#else
+
+#include <ip_remote.h>
+
+#define ip_received_error_msg  ip_received_error_msg_remote
+#define ip_set_gateway_req     ip_set_gateway_req_remote
+#define ip_packet_size_req     ip_packet_size_req_remote
+#define ip_device_req          ip_device_req_remote
+#define ip_add_route_req       ip_add_route_req_remote
+#define ip_send_msg            ip_send_msg_remote
+#define ip_get_route_req       ip_get_route_req_remote
+
+#endif
+
 /** @name IP module interface
  *  This interface is used by other modules.
  */
 /*@{*/
-
-/** Type definition of the internet pseudo header pointer.
- */
-typedef void *		ip_pseudo_header_ref;
 
 /** The transport layer notification function type definition.
@@ -82,32 +97,4 @@
 extern int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg);
 
-/** Registers the new device.
- *  Registers itself as the ip packet receiver.
- *  If the device uses ARP registers also the new ARP device.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] device_id The new device identifier.
- *  @param[in] netif The underlying device network interface layer service.
- *  @returns EOK on success.
- *  @returns ENOMEM if there is not enough memory left.
- *  @returns EINVAL if the device configuration is invalid.
- *  @returns ENOTSUP if the device uses IPv6.
- *  @returns ENOTSUP if the device uses DHCP.
- *  @returns Other error codes as defined for the net_get_device_conf_req() function.
- *  @returns Other error codes as defined for the arp_device_req() function.
- */
-extern int ip_device_req(int, device_id_t, services_t);
-
-/** Sends the packet queue.
- *  The packets may get fragmented if needed.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The packet fragments as a~packet queue. All the packets have to have the same destination address.
- *  @param[in] sender The sending module service.
- *  @param[in] error The packet error reporting service. Prefixes the received packet.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the generic_send_msg() function.
- */
-extern int ip_send_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error);
-
 /** Connects to the IP module.
  *  @param service The IP module service. Ignored parameter.
@@ -117,53 +104,4 @@
 extern int ip_connect_module(services_t service);
 
-/** Adds a route to the device routing table.
- *  The target network is routed using this device.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] address The target network address.
- *  @param[in] netmask The target network mask.
- *  @param[in] gateway The target network gateway. Not used if zero.
- */
-extern int ip_add_route_req(int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway);
-
-/** Sets the default gateway.
- *  This gateway is used if no other route is found.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] gateway The default gateway.
- */
-extern int ip_set_gateway_req(int ip_phone, device_id_t device_id, in_addr_t gateway);
-
-/** Returns the device packet dimension for sending.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[out] packet_dimension The packet dimension.
- *  @returns EOK on success.
- *  @returns ENOENT if there is no such device.
- *  @returns Other error codes as defined for the generic_packet_size_req() function.
- */
-extern int ip_packet_size_req(int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension);
-
-/** Notifies the IP module about the received error notification packet.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The received packet or the received packet queue.
- *  @param[in] target The target internetwork module service to be delivered to.
- *  @param[in] error The packet error reporting service. Prefixes the received packet.
- *  @returns EOK on success.
- */
-extern int ip_received_error_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error);
-
-/** Returns the device identifier and the IP pseudo header based on the destination address.
- *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
- *  @param[in] protocol The transport protocol.
- *  @param[in] destination The destination address.
- *  @param[in] addrlen The destination address length.
- *  @param[out] device_id The device identifier.
- *  @param[out] header The constructed IP pseudo header.
- *  @param[out] headerlen The IP pseudo header length.
- */
-extern int ip_get_route_req(int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, ip_pseudo_header_ref * header, size_t * headerlen);
-
 /*@}*/
 
Index: uspace/lib/net/include/ip_local.h
===================================================================
--- uspace/lib/net/include/ip_local.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
+++ uspace/lib/net/include/ip_local.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -0,0 +1,61 @@
+/*
+ * 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 ip
+ * @{
+ */
+
+#ifndef __NET_IP_LOCAL_H__
+#define __NET_IP_LOCAL_H__
+
+#include <async.h>
+#include <ipc/services.h>
+
+#include <ip_codes.h>
+#include <inet.h>
+#include <in.h>
+#include <socket.h>
+
+extern int ip_received_error_msg_local(int, device_id_t, packet_t, services_t,
+    services_t);
+extern int ip_set_gateway_req_local(int, device_id_t, in_addr_t);
+extern int ip_packet_size_req_local(int, device_id_t, packet_dimension_ref);
+extern int ip_received_error_msg_local(int, device_id_t, packet_t, services_t,
+    services_t);
+extern int ip_device_req_local(int, device_id_t, services_t);
+extern int ip_add_route_req_local(int, device_id_t, in_addr_t, in_addr_t,
+    in_addr_t);
+extern int ip_send_msg_local(int, device_id_t, packet_t, services_t,
+    services_t);
+extern int ip_get_route_req_local(int, ip_protocol_t, const struct sockaddr *,
+    socklen_t, device_id_t *, void **, size_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/ip_remote.h
===================================================================
--- uspace/lib/net/include/ip_remote.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
+++ uspace/lib/net/include/ip_remote.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -0,0 +1,59 @@
+/*
+ * 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 ip
+ * @{
+ */
+
+#ifndef __NET_IP_REMOTE_H__
+#define __NET_IP_REMOTE_H__
+
+#include <async.h>
+#include <ipc/services.h>
+
+#include <ip_codes.h>
+#include <inet.h>
+#include <in.h>
+#include <socket.h>
+
+extern int ip_set_gateway_req_remote(int, device_id_t, in_addr_t);
+extern int ip_packet_size_req_remote(int, device_id_t, packet_dimension_ref);
+extern int ip_received_error_msg_remote(int, device_id_t, packet_t, services_t,
+    services_t);
+extern int ip_device_req_remote(int, device_id_t, services_t);
+extern int ip_add_route_req_remote(int, device_id_t, in_addr_t, in_addr_t,
+    in_addr_t);
+extern int ip_send_msg_remote(int, device_id_t, packet_t, services_t,
+    services_t);
+extern int ip_get_route_req_remote(int, ip_protocol_t, const struct sockaddr *,
+    socklen_t, device_id_t *, void **, size_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/net_interface.h
===================================================================
--- uspace/lib/net/include/net_interface.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/lib/net/include/net_interface.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -29,11 +29,4 @@
 /** @addtogroup net
  *  @{
- */
-
-/** @file
- *  Networking module interface.
- *  The same interface is used for standalone remote modules as well as for bundle modules.
- *  The standalone remote modules have to be compiled with the net_remote.c source file.
- *  The bundle networking module is compiled with the net_bundle.c source file and the choosen bundle module implementation source files.
  */
 
Index: uspace/lib/net/include/netif.h
===================================================================
--- uspace/lib/net/include/netif.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ 	(revision )
@@ -1,168 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup netif
- *  @{
- */
-
-/** @file
- *  Network interface module skeleton.
- *  The skeleton has to be part of each network interface module.
- *  The skeleton can be also part of the module bundled with the network interface layer.
- */
-
-#ifndef __NET_NETIF_H__
-#define __NET_NETIF_H__
-
-#include <async.h>
-#include <fibril_synch.h>
-
-#include <ipc/ipc.h>
-
-#include <net_err.h>
-#include <net_device.h>
-#include <packet/packet.h>
-
-/** Network interface module skeleton global data.
- */
-typedef struct netif_globals	netif_globals_t;
-
-/** Type definition of the device specific data.
- *  @see netif_device
- */
-typedef struct netif_device	device_t;
-
-/** Type definition of the device specific data pointer.
- *  @see netif_device
- */
-typedef device_t *			device_ref;
-
-/** Device map.
- *  Maps device identifiers to the network interface device specific data.
- *  @see device.h
- */
-DEVICE_MAP_DECLARE(device_map, device_t);
-
-/** Network interface device specific data.
- */
-struct	netif_device{
-	/** Device identifier.
-	 */
-	device_id_t device_id;
-	/** Receiving network interface layer phone.
-	 */
-	int nil_phone;
-	/** Actual device state.
-	 */
-	device_state_t state;
-	/** Driver specific data.
-	 */
-	void * specific;
-};
-
-/** Network interface module skeleton global data.
- */
-struct	netif_globals{
-	/** Networking module phone.
-	 */
-	int net_phone;
-	/**	Device map.
-	 */
-	device_map_t device_map;
-	/** Safety lock.
-	 */
-	fibril_rwlock_t lock;
-};
-
-extern netif_globals_t netif_globals;
-
-/**	Finds the device specific data.
- *  @param[in] device_id The device identifier.
- *  @param[out] device The device specific data.
- *  @returns EOK on success.
- *  @returns ENOENT if device is not found.
- *  @returns EPERM if the device is not initialized.
- */
-extern int find_device(device_id_t device_id, device_ref * device);
-
-/** Clears the usage statistics.
- *  @param[in] stats The usage statistics.
- */
-extern void null_device_stats(device_stats_ref stats);
-
-// prepared for future optimalizations
-/** Releases the given packet.
- *  @param[in] packet_id The packet identifier.
- */
-extern void netif_pq_release(packet_id_t packet_id);
-
-/** Allocates new packet to handle the given content size.
- *  @param[in] content The minimum content size.
- *  @returns The allocated packet.
- *  @returns NULL if there is an error.
- */
-extern packet_t netif_packet_get_1(size_t content);
-
-/** Process the netif module messages.
- *
- * @param[in]  name         Module name.
- * @param[in]  callid       The message identifier.
- * @param[in]  call         The message parameters.
- * @param[out] answer       The message answer parameters.
- * @param[out] answer_count The last parameter for the actual answer
- *                          in the answer parameter.
- *
- * @return EOK on success.
- * @return ENOTSUP if the message is not known.
- * @return Other error codes as defined for each specific module message function.
- *
- * @see netif_interface.h
- * @see IS_NET_NETIF_MESSAGE()
- *
- */
-extern int netif_message(const char *, ipc_callid_t, ipc_call_t *,
-    ipc_call_t *, int *);
-
-/** Initializes the netif module.
- *  The function has to be defined in each module.
- *  @param[in] net_client_connection The client connection functio to be registered.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module message function.
- */
-extern int netif_init_module(async_client_conn_t client_connection);
-
-/** Starts and maintains the netif module until terminated.
- *  @returns EOK after the module is terminated.
- */
-extern int netif_run_module(void);
-
-#endif
-
-/** @}
- */
-
Index: uspace/lib/net/include/netif_interface.h
===================================================================
--- uspace/lib/net/include/netif_interface.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/lib/net/include/netif_interface.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -28,12 +28,5 @@
 
 /** @addtogroup netif
- *  @{
- */
-
-/** @file
- *  Network interface module interface.
- *  The same interface is used for standalone remote modules as well as for bundle network interface layer modules.
- *  The standalone remote modules have to be compiled with the netif_remote.c source file.
- *  The bundle network interface layer modules are compiled with the netif_nil_bundle.c source file and the choosen network interface layer implementation source file.
+ * @{
  */
 
@@ -41,86 +34,36 @@
 #define __NET_NETIF_INTERFACE_H__
 
-#include <ipc/services.h>
+#ifdef CONFIG_NETIF_NIL_BUNDLE
 
-#include <net_messages.h>
-#include <adt/measured_strings.h>
-#include <packet/packet.h>
-#include <net_device.h>
+#include <netif_local.h>
+#include <netif_nil_bundle.h>
+#include <packet/packet_server.h>
 
-/** @name Network interface module interface
- *  This interface is used by other modules.
- */
-/*@{*/
+#define netif_module_message    netif_nil_module_message
+#define netif_module_start      netif_nil_module_start
+#define netif_get_addr_req      netif_get_addr_req_local
+#define netif_probe_req         netif_probe_req_local
+#define netif_send_msg          netif_send_msg_local
+#define netif_start_req         netif_start_req_local
+#define netif_stop_req          netif_stop_req_local
+#define netif_stats_req         netif_stats_req_local
+#define netif_bind_service      netif_bind_service_local
 
-/** Returns the device local hardware address.
- *  @param[in] netif_phone The network interface phone.
- *  @param[in] device_id The device identifier.
- *  @param[out] address The device local hardware address.
- *  @param[out] data The address data.
- *  @returns EOK on success.
- *  @returns EBADMEM if the address parameter is NULL.
- *  @returns ENOENT if there no such device.
- *  @returns Other error codes as defined for the netif_get_addr_message() function.
- */
-extern int netif_get_addr_req(int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data);
+#else /* CONFIG_NETIF_NIL_BUNDLE */
 
-/** Probes the existence of the device.
- *  @param[in] netif_phone The network interface phone.
- *  @param[in] device_id The device identifier.
- *  @param[in] irq The device interrupt number.
- *  @param[in] io The device input/output address.
- *  @returns EOK on success.
- *  @returns Other errro codes as defined for the netif_probe_message().
- */
-extern int netif_probe_req(int netif_phone, device_id_t device_id, int irq, int io);
+#include <netif_remote.h>
+#include <packet/packet_client.h>
 
-/** Sends the packet queue.
- *  @param[in] netif_phone The network interface phone.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The packet queue.
- *  @param[in] sender The sending module service.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the generic_send_msg() function.
- */
-extern int netif_send_msg(int netif_phone, device_id_t device_id, packet_t packet, services_t sender);
+#define netif_module_message    netif_module_message_standalone
+#define netif_module_start      netif_module_start_standalone
+#define netif_get_addr_req      netif_get_addr_req_remote
+#define netif_probe_req         netif_probe_req_remote
+#define netif_send_msg          netif_send_msg_remote
+#define netif_start_req         netif_start_req_remote
+#define netif_stop_req          netif_stop_req_remote
+#define netif_stats_req         netif_stats_req_remote
+#define netif_bind_service      netif_bind_service_remote
 
-/** Starts the device.
- *  @param[in] netif_phone The network interface phone.
- *  @param[in] device_id The device identifier.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the netif_start_message() function.
- */
-extern int netif_start_req(int netif_phone, device_id_t device_id);
-
-/** Stops the device.
- *  @param[in] netif_phone The network interface phone.
- *  @param[in] device_id The device identifier.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the netif_stop_message() function.
- */
-extern int netif_stop_req(int netif_phone, device_id_t device_id);
-
-/** Returns the device usage statistics.
- *  @param[in] netif_phone The network interface phone.
- *  @param[in] device_id The device identifier.
- *  @param[out] stats The device usage statistics.
- *  @returns EOK on success.
- */
-extern int netif_stats_req(int netif_phone, device_id_t device_id, device_stats_ref stats);
-
-/** Creates bidirectional connection with the network interface module and registers the message receiver.
- *  @param[in] service The network interface module service.
- *  @param[in] device_id The device identifier.
- *  @param[in] me The requesting module service.
- *  @param[in] receiver The message receiver.
- *  @returns The phone of the needed service.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the bind_service() function.
- */
-extern int netif_bind_service(services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver);
-
-/*@}*/
+#endif /* CONFIG_NETIF_NIL_BUNDLE */
 
 #endif
Index: uspace/lib/net/include/netif_local.h
===================================================================
--- uspace/lib/net/include/netif_local.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
+++ uspace/lib/net/include/netif_local.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2009 Lukas Mejdrech
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup netif
+ * @{
+ */
+
+/** @file
+ * Network interface module skeleton.
+ * The skeleton has to be part of each network interface module.
+ * The skeleton can be also part of the module bundled with the network interface layer.
+ */
+
+#ifndef __NET_NETIF_LOCAL_H__
+#define __NET_NETIF_LOCAL_H__
+
+#include <async.h>
+#include <fibril_synch.h>
+#include <ipc/ipc.h>
+#include <ipc/services.h>
+
+#include <adt/measured_strings.h>
+#include <net_err.h>
+#include <net_device.h>
+#include <packet/packet.h>
+
+/** Network interface device specific data.
+ *
+ */
+typedef struct {
+	device_id_t device_id;  /**< Device identifier. */
+	int nil_phone;          /**< Receiving network interface layer phone. */
+	device_state_t state;   /**< Actual device state. */
+	void *specific;         /**< Driver specific data. */
+} netif_device_t;
+
+/** Device map.
+ *
+ * Maps device identifiers to the network interface device specific data.
+ * @see device.h
+ *
+ */
+DEVICE_MAP_DECLARE(netif_device_map, netif_device_t);
+
+/** Network interface module skeleton global data.
+ *
+ */
+typedef struct {
+	int net_phone;                  /**< Networking module phone. */
+	netif_device_map_t device_map;  /**< Device map. */
+	fibril_rwlock_t lock;           /**< Safety lock. */
+} netif_globals_t;
+
+extern netif_globals_t netif_globals;
+
+/** Initialize the specific module.
+ *
+ * This function has to be implemented in user code.
+ *
+ */
+extern int netif_initialize(void);
+
+/** Probe the existence of the device.
+ *
+ * This has to be implemented in user code.
+ *
+ * @param[in] device_id The device identifier.
+ * @param[in] irq       The device interrupt number.
+ * @param[in] io        The device input/output address.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_probe_message(device_id_t device_id, int irq, uintptr_t io);
+
+/** Send the packet queue.
+ *
+ * This has to be implemented in user code.
+ *
+ * @param[in] device_id The device identifier.
+ * @param[in] packet    The packet queue.
+ * @param[in] sender    The sending module service.
+ *
+ * @return EOK on success.
+ * @return EFORWARD if the device is not active (in the NETIF_ACTIVE state).
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_send_message(device_id_t device_id, packet_t packet,
+    services_t sender);
+
+/** Start the device.
+ *
+ * This has to be implemented in user code.
+ *
+ * @param[in] device The device structure.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_start_message(netif_device_t *device);
+
+/** Stop the device.
+ *
+ * This has to be implemented in user code.
+ *
+ * @param[in] device The device structure.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_stop_message(netif_device_t *device);
+
+/** Return the device local hardware address.
+ *
+ * This has to be implemented in user code.
+ *
+ * @param[in]  device_id The device identifier.
+ * @param[out] address   The device local hardware address.
+ *
+ * @return EOK on success.
+ * @return EBADMEM if the address parameter is NULL.
+ * @return ENOENT if there no such device.
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_get_addr_message(device_id_t device_id,
+    measured_string_ref address);
+
+/** Process the netif driver specific message.
+ *
+ * This function is called for uncommon messages received by the netif
+ * skeleton. This has to be implemented in user code.
+ *
+ * @param[in]  callid       The message identifier.
+ * @param[in]  call         The message parameters.
+ * @param[out] answer       The message answer parameters.
+ * @param[out] answer_count The last parameter for the actual answer in
+ *                          the answer parameter.
+ *
+ * @return EOK on success.
+ * @return ENOTSUP if the message is not known.
+ * @return Other error codes as defined for the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_specific_message(ipc_callid_t callid, ipc_call_t *call,
+    ipc_call_t *answer, int *answer_count);
+
+/** Return the device usage statistics.
+ *
+ * This has to be implemented in user code.
+ *
+ * @param[in]  device_id The device identifier.
+ * @param[out] stats     The device usage statistics.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for the find_device() function.
+ * @return Other error codes as defined for the specific module message
+ *         implementation.
+ *
+ */
+extern int netif_get_device_stats(device_id_t device_id,
+    device_stats_ref stats);
+
+extern int netif_get_addr_req_local(int, device_id_t, measured_string_ref *,
+    char **);
+extern int netif_probe_req_local(int, device_id_t, int, int);
+extern int netif_send_msg_local(int, device_id_t, packet_t, services_t);
+extern int netif_start_req_local(int, device_id_t);
+extern int netif_stop_req_local(int, device_id_t);
+extern int netif_stats_req_local(int, device_id_t, device_stats_ref);
+extern int netif_bind_service_local(services_t, device_id_t, services_t,
+    async_client_conn_t);
+
+extern int find_device(device_id_t, netif_device_t **);
+extern void null_device_stats(device_stats_ref);
+extern void netif_pq_release(packet_id_t);
+extern packet_t netif_packet_get_1(size_t);
+extern int netif_init_module(async_client_conn_t);
+
+extern int netif_module_message_standalone(const char *, ipc_callid_t,
+    ipc_call_t *, ipc_call_t *, int *);
+extern int netif_module_start_standalone(async_client_conn_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/netif_messages.h
===================================================================
--- uspace/lib/net/include/netif_messages.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/lib/net/include/netif_messages.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -28,10 +28,9 @@
 
 /** @addtogroup netif
- *  @{
+ * @{
  */
 
 /** @file
- *  Network interface common module messages.
- *  @see netif_interface.h
+ * Network interface common module messages.
  */
 
@@ -76,12 +75,12 @@
 /*@{*/
 
-/** Returns the interrupt number message parameter.
- *  @param[in] call The message call structure.
+/** Return the interrupt number message parameter.
+ * @param[in] call The message call structure.
  */
 #define NETIF_GET_IRQ(call) \
 	({int irq = (int) IPC_GET_ARG2(*call); irq;})
 
-/** Returns the input/output address message parameter.
- *  @param[in] call The message call structure.
+/** Return the input/output address message parameter.
+ * @param[in] call The message call structure.
  */
 #define NETIF_GET_IO(call) \
Index: uspace/lib/net/include/netif_module.h
===================================================================
--- uspace/lib/net/include/netif_module.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ 	(revision )
@@ -1,125 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup netif
- *  @{
- */
-
-/** @file
- *  Network interface module interface.
- *  The interface has to be implemented by each network interface module.
- *  The interface is used by the network interface module skeleton.
- */
-
-#ifndef __NET_NETIF_MODULE_H__
-#define __NET_NETIF_MODULE_H__
-
-#include <ipc/ipc.h>
-#include <ipc/services.h>
-
-#include <adt/measured_strings.h>
-#include <packet/packet.h>
-#include <net_device.h>
-
-/** Initializes the specific module.
- */
-extern int netif_initialize(void);
-
-/** Probes the existence of the device.
- *  @param[in] device_id The device identifier.
- *  @param[in] irq The device interrupt number.
- *  @param[in] io The device input/output address.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_probe_message(device_id_t device_id, int irq, uintptr_t io);
-
-/** Sends the packet queue.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The packet queue.
- *  @param[in] sender The sending module service.
- *  @returns EOK on success.
- *  @returns EFORWARD if the device is not active (in the NETIF_ACTIVE state).
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_send_message(device_id_t device_id, packet_t packet, services_t sender);
-
-/** Starts the device.
- *  @param[in] device The device structure.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_start_message(device_ref device);
-
-/** Stops the device.
- *  @param[in] device The device structure.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_stop_message(device_ref device);
-
-/** Returns the device local hardware address.
- *  @param[in] device_id The device identifier.
- *  @param[out] address The device local hardware address.
- *  @returns EOK on success.
- *  @returns EBADMEM if the address parameter is NULL.
- *  @returns ENOENT if there no such device.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_get_addr_message(device_id_t device_id, measured_string_ref address);
-
-/** Processes the netif driver specific message.
- *  This function is called for uncommon messages received by the netif skeleton.
- *  @param[in] callid The message identifier.
- *  @param[in] call The message parameters.
- *  @param[out] answer The message answer parameters.
- *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
- *  @returns EOK on success.
- *  @returns ENOTSUP if the message is not known.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
-
-/** Returns the device usage statistics.
- *  @param[in] device_id The device identifier.
- *  @param[out] stats The device usage statistics.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the find_device() function.
- *  @returns Other error codes as defined for the specific module message implementation.
- */
-extern int netif_get_device_stats(device_id_t device_id, device_stats_ref stats);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/netif_remote.h
===================================================================
--- uspace/lib/net/include/netif_remote.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
+++ uspace/lib/net/include/netif_remote.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2009 Lukas Mejdrech
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup netif
+ * @{
+ */
+
+#ifndef __NET_NETIF_REMOTE_H__
+#define __NET_NETIF_REMOTE_H__
+
+#include <async.h>
+#include <fibril_synch.h>
+#include <ipc/ipc.h>
+
+extern int netif_get_addr_req_remote(int, device_id_t, measured_string_ref *,
+    char **);
+extern int netif_probe_req_remote(int, device_id_t, int, int);
+extern int netif_send_msg_remote(int, device_id_t, packet_t, services_t);
+extern int netif_start_req_remote(int, device_id_t);
+extern int netif_stop_req_remote(int, device_id_t);
+extern int netif_stats_req_remote(int, device_id_t, device_stats_ref);
+extern int netif_bind_service_remote(services_t, device_id_t, services_t,
+    async_client_conn_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/netif_standalone.h
===================================================================
--- uspace/lib/net/include/netif_standalone.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup netif_standalone
- *  @{
- */
-
-#ifndef __NETIF_STANDALONE_H__
-#define __NETIF_STANDALONE_H__
-
-#include <ipc/ipc.h>
-#include <async.h>
-
-extern int netif_module_message(const char *, ipc_callid_t, ipc_call_t *,
-    ipc_call_t *, int *);
-extern int netif_module_start(async_client_conn_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/nil_interface.h
===================================================================
--- uspace/lib/net/include/nil_interface.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/lib/net/include/nil_interface.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -31,12 +31,4 @@
  */
 
-/** @file
- *  Network interface layer module interface.
- *  The same interface is used for standalone remote device modules as well as for bundle device modules.
- *  The standalone remote device modules have to be compiled with the nil_remote.c source file.
- *  The bundle device modules with the appropriate network interface layer source file (eth.c etc.).
- *  The upper layers cannot be bundled with the network interface layer.
- */
-
 #ifndef __NET_NIL_INTERFACE_H__
 #define __NET_NIL_INTERFACE_H__
@@ -53,102 +45,44 @@
 #include <net_device.h>
 
-/** @name Network interface layer module interface
- *  This interface is used by other modules.
- */
-/*@{*/
+#define nil_bind_service(service, device_id, me, receiver) \
+	bind_service(service, device_id, me, 0, receiver)
 
-/** Returns the device local hardware address.
- *  @param[in] nil_phone The network interface layer phone.
- *  @param[in] device_id The device identifier.
- *  @param[out] address The device local hardware address.
- *  @param[out] data The address data.
- *  @returns EOK on success.
- *  @returns EBADMEM if the address parameter and/or the data parameter is NULL.
- *  @returns ENOENT if there no such device.
- *  @returns Other error codes as defined for the generic_get_addr_req() function.
- */
-#define nil_get_addr_req(nil_phone, device_id, address, data)	\
+#define nil_packet_size_req(nil_phone, device_id, packet_dimension) \
+	generic_packet_size_req_remote(nil_phone, NET_NIL_PACKET_SPACE, device_id, \
+	    packet_dimension)
+
+#define nil_get_addr_req(nil_phone, device_id, address, data) \
 	generic_get_addr_req(nil_phone, NET_NIL_ADDR, device_id, address, data)
 
-/** Returns the device broadcast hardware address.
- *  @param[in] nil_phone The network interface layer phone.
- *  @param[in] device_id The device identifier.
- *  @param[out] address The device broadcast hardware address.
- *  @param[out] data The address data.
- *  @returns EOK on success.
- *  @returns EBADMEM if the address parameter is NULL.
- *  @returns ENOENT if there no such device.
- *  @returns Other error codes as defined for the generic_get_addr_req() function.
- */
-#define nil_get_broadcast_addr_req(nil_phone, device_id, address, data)	\
-	generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, address, data)
+#define nil_get_broadcast_addr_req(nil_phone, device_id, address, data) \
+	generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, \
+	    address, data)
 
-/** Sends the packet queue.
- *  @param[in] nil_phone The network interface layer phone.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The packet queue.
- *  @param[in] sender The sending module service.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the generic_send_msg() function.
- */
-#define nil_send_msg(nil_phone, device_id, packet, sender)	\
-	generic_send_msg(nil_phone, NET_NIL_SEND, device_id, packet_get_id(packet), sender, 0)
+#define nil_send_msg(nil_phone, device_id, packet, sender) \
+	generic_send_msg_remote(nil_phone, NET_NIL_SEND, device_id, \
+	    packet_get_id(packet), sender, 0)
 
-/** Returns the device packet dimension for sending.
- *  @param[in] nil_phone The network interface layer phone.
- *  @param[in] device_id The device identifier.
- *  @param[out] packet_dimension The packet dimensions.
- *  @returns EOK on success.
- *  @returns ENOENT if there is no such device.
- *  @returns Other error codes as defined for the generic_packet_size_req() function.
- */
-#define nil_packet_size_req(nil_phone, device_id, packet_dimension)	\
-	generic_packet_size_req(nil_phone, NET_NIL_PACKET_SPACE, device_id, packet_dimension)
+#define nil_device_req(nil_phone, device_id, mtu, netif_service) \
+	generic_device_req_remote(nil_phone, NET_NIL_DEVICE, device_id, mtu, \
+	    netif_service)
 
-/** Registers new device or updates the MTU of an existing one.
- *  @param[in] nil_phone The network interface layer phone.
- *  @param[in] device_id The new device identifier.
- *  @param[in] mtu The device maximum transmission unit.
- *  @param[in] netif_service The device driver service.
- *  @returns EOK on success.
- *  @returns EEXIST if the device with the different service exists.
- *  @returns ENOMEM if there is not enough memory left.
- *  @returns Other error codes as defined for the generic_device_req() function.
- */
-#define nil_device_req(nil_phone, device_id, mtu, netif_service)	\
-	generic_device_req(nil_phone, NET_NIL_DEVICE, device_id, mtu, netif_service)
 
-/** Notifies the network interface layer about the device state change.
- *  @param[in] nil_phone The network interface layer phone.
- *  @param[in] device_id The device identifier.
- *  @param[in] state The new device state.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module device state function.
- */
-extern int nil_device_state_msg(int nil_phone, device_id_t device_id, int state);
+#ifdef CONFIG_NETIF_NIL_BUNDLE
 
-/** Passes the packet queue to the network interface layer.
- *  Processes and redistributes the received packet queue to the registered upper layers.
- *  @param[in] nil_phone The network interface layer phone.
- *  @param[in] device_id The source device identifier.
- *  @param[in] packet The received packet or the received packet queue.
- *  @param target The target service. Ignored parameter.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for each specific module received function.
- */
-extern int nil_received_msg(int nil_phone, device_id_t device_id, packet_t packet, services_t target);
+#include <nil_local.h>
+#include <packet/packet_server.h>
 
-/** Creates bidirectional connection with the network interface layer module and registers the message receiver.
- *  @param[in] service The network interface layer module service.
- *  @param[in] device_id The device identifier.
- *  @param[in] me The requesting module service.
- *  @param[in] receiver The message receiver.
- *  @returns The phone of the needed service.
- *  @returns EOK on success.
- *  @returns Other error codes as defined for the bind_service() function.
- */
-#define	nil_bind_service(service, device_id, me, receiver)	\
-	bind_service(service, device_id, me, 0, receiver);
-/*@}*/
+#define nil_device_state_msg  nil_device_state_msg_local
+#define nil_received_msg      nil_received_msg_local
+
+#else /* CONFIG_NETIF_NIL_BUNDLE */
+
+#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
+
+#endif /* CONFIG_NETIF_NIL_BUNDLE */
 
 #endif
Index: uspace/lib/net/include/nil_local.h
===================================================================
--- uspace/lib/net/include/nil_local.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
+++ uspace/lib/net/include/nil_local.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -0,0 +1,86 @@
+/*
+ * 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_nil
+ *  @{
+ */
+
+/** @file
+ * Network interface layer modules common skeleton.
+ * All network interface layer modules have to implement this interface.
+ */
+
+#ifndef __NET_NIL_LOCAL_H__
+#define __NET_NIL_LOCAL_H__
+
+#include <ipc/ipc.h>
+
+/** Module initialization.
+ *
+ * Is called by the module_start() function.
+ *
+ * @param[in] net_phone The networking moduel phone.
+ *
+ * @return EOK on success.
+ * @return Other error codes as defined for each specific module initialize function.
+ *
+ */
+extern int nil_initialize(int);
+
+extern int nil_device_state_msg_local(int, device_id_t, int);
+extern int nil_received_msg_local(int, device_id_t, packet_t, services_t);
+
+/** Message processing function.
+ *
+ * @param[in]  name         Module name.
+ * @param[in]  callid       The message identifier.
+ * @param[in]  call         The message parameters.
+ * @param[out] answer       The message answer parameters.
+ * @param[out] answer_count The last parameter for the actual answer
+ *                          in the answer parameter.
+ *
+ * @return EOK on success.
+ * @return ENOTSUP if the message is not known.
+ * @return Other error codes as defined for each specific
+ *         module message function.
+ *
+ * @see nil_interface.h
+ * @see IS_NET_NIL_MESSAGE()
+ *
+ */
+extern int nil_message_standalone(const char *, ipc_callid_t, ipc_call_t *, ipc_call_t *,
+    int *);
+
+extern int nil_module_message_standalone(const char *, ipc_callid_t,
+    ipc_call_t *, ipc_call_t *, int *);
+extern int nil_module_start_standalone(async_client_conn_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/nil_messages.h
===================================================================
--- uspace/lib/net/include/nil_messages.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/lib/net/include/nil_messages.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -28,10 +28,9 @@
 
 /** @addtogroup net_nil
- *  @{
+ * @{
  */
 
 /** @file
- *  Network interface layer module messages.
- *  @see nil_interface.h
+ * Network interface layer module messages.
  */
 
@@ -43,5 +42,5 @@
 #include <net_messages.h>
 
-/**  Network interface layer module messages.
+/** Network interface layer module messages.
  */
 typedef enum {
@@ -80,5 +79,5 @@
 /*@{*/
 
-/** Returns the protocol service message parameter.
+/** Return the protocol service message parameter.
  */
 #define NIL_GET_PROTO(call) \
Index: uspace/lib/net/include/nil_module.h
===================================================================
--- uspace/lib/net/include/nil_module.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ 	(revision )
@@ -1,79 +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_nil
- *  @{
- */
-
-/** @file
- *  Network interface layer modules common skeleton.
- *  All network interface layer modules have to implement this interface.
- */
-
-#ifndef __NET_NIL_MODULE_H__
-#define __NET_NIL_MODULE_H__
-
-#include <ipc/ipc.h>
-
-/** Module initialization.
- *
- * Is called by the module_start() function.
- *
- * @param[in] net_phone The networking moduel phone.
- *
- * @return EOK on success.
- * @return Other error codes as defined for each specific module initialize function.
- *
- */
-extern int nil_initialize(int);
-
-/** Message processing function.
- *
- * @param[in]  name         Module name.
- * @param[in]  callid       The message identifier.
- * @param[in]  call         The message parameters.
- * @param[out] answer       The message answer parameters.
- * @param[out] answer_count The last parameter for the actual answer
- *                          in the answer parameter.
- *
- * @return EOK on success.
- * @return ENOTSUP if the message is not known.
- * @return Other error codes as defined for each specific
- *         module message function.
- *
- * @see nil_interface.h
- * @see IS_NET_NIL_MESSAGE()
- *
- */
-extern int nil_message(const char *, ipc_callid_t, ipc_call_t *, ipc_call_t *,
-    int *);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/nil_remote.h
===================================================================
--- uspace/lib/net/include/nil_remote.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
+++ uspace/lib/net/include/nil_remote.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2009 Lukas Mejdrech
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup netif
+ * @{
+ */
+
+#ifndef __NET_NIL_REMOTE_H__
+#define __NET_NIL_REMOTE_H__
+
+#include <async.h>
+#include <fibril_synch.h>
+#include <ipc/ipc.h>
+
+extern int nil_device_state_msg_remote(int, device_id_t, int);
+extern int nil_received_msg_remote(int, device_id_t, packet_t, services_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/nil_standalone.h
===================================================================
--- uspace/lib/net/include/nil_standalone.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nil_standalone
- *  @{
- */
-
-#ifndef __NIL_STANDALONE_H__
-#define __NIL_STANDALONE_H__
-
-#include <ipc/ipc.h>
-#include <async.h>
-
-extern int nil_module_message(const char *, ipc_callid_t, ipc_call_t *,
-    ipc_call_t *, int *);
-extern int nil_module_start(async_client_conn_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/net/include/packet_remote.h
===================================================================
--- uspace/lib/net/include/packet_remote.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
+++ uspace/lib/net/include/packet_remote.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -0,0 +1,46 @@
+/*
+ * 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 packet
+ * @{
+ */
+
+#ifndef __NET_PACKET_REMOTE_H__
+#define __NET_PACKET_REMOTE_H__
+
+#include <packet/packet.h>
+
+extern int packet_translate_remote(int, packet_ref, packet_id_t);
+extern packet_t packet_get_4_remote(int, size_t, size_t, size_t, size_t);
+extern packet_t packet_get_1_remote(int, size_t);
+extern void pq_release_remote(int, packet_id_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/tl_common.h
===================================================================
--- uspace/lib/net/include/tl_common.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/lib/net/include/tl_common.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -49,4 +49,7 @@
 DEVICE_MAP_DECLARE(packet_dimensions, packet_dimension_t);
 
+extern int tl_get_ip_packet_dimension(int, packet_dimensions_ref,
+    device_id_t, packet_dimension_ref *);
+
 /** Gets the address port.
  *  Supports AF_INET and AF_INET6 address families.
@@ -59,19 +62,4 @@
  */
 extern int tl_get_address_port(const struct sockaddr * addr, int addrlen, uint16_t * port);
-
-/** Gets IP packet dimensions.
- *  Tries to search a cache and queries the IP module if not found.
- *  The reply is cached then.
- *  @param[in] ip_phone The IP moduel phone for (semi)remote calls.
- *  @param[in] packet_dimensions The packet dimensions cache.
- *  @param[in] device_id The device identifier.
- *  @param[out] packet_dimension The IP packet dimensions.
- *  @returns EOK on success.
- *  @returns EBADMEM if the packet_dimension parameter is NULL.
- *  @return ENOMEM if there is not enough memory left.
- *  @returns EINVAL if the packet_dimensions cache is not valid.
- *  @returns Other codes as defined for the ip_packet_size_req() function.
- */
-extern int tl_get_ip_packet_dimension(int ip_phone, packet_dimensions_ref packet_dimensions, device_id_t device_id, packet_dimension_ref * packet_dimension);
 
 /** Updates IP device packet dimensions cache.
Index: uspace/lib/net/include/tl_interface.h
===================================================================
--- uspace/lib/net/include/tl_interface.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/lib/net/include/tl_interface.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -32,5 +32,5 @@
 
 /** @file
- *  Transport layer module interface for the underlying internetwork layer.
+ * Transport layer module interface for the underlying internetwork layer.
  */
 
@@ -48,18 +48,29 @@
 
 /** @name Transport layer module interface
- *  This interface is used by other modules.
+ * This interface is used by other modules.
  */
 /*@{*/
 
-/** Notifies the remote transport layer modules about the received packet/s.
- *  @param[in] tl_phone The transport layer module phone used for remote calls.
- *  @param[in] device_id The device identifier.
- *  @param[in] packet The received packet or the received packet queue. The packet queue is used to carry a~fragmented datagram. The first packet contains the headers, the others contain only data.
- *  @param[in] target The target transport layer module service to be delivered to.
- *  @param[in] error The packet error reporting service. Prefixes the received packet.
- *  @returns EOK on success.
+/** Notify the remote transport layer modules about the received packet/s.
+ *
+ * @param[in] tl_phone  The transport layer module phone used for remote calls.
+ * @param[in] device_id The device identifier.
+ * @param[in] packet    The received packet or the received packet queue.
+ *                      The packet queue is used to carry a fragmented
+ *                      datagram. The first packet contains the headers,
+ *                      the others contain only data.
+ * @param[in] target    The target transport layer module service to be
+ *                      delivered to.
+ * @param[in] error     The packet error reporting service. Prefixes the
+ *                      received packet.
+ *
+ * @return EOK on success.
+ *
  */
-inline static int tl_received_msg(int tl_phone, device_id_t device_id, packet_t packet, services_t target, services_t error){
-	return generic_received_msg(tl_phone, NET_TL_RECEIVED, device_id, packet_get_id(packet), target, error);
+inline static int tl_received_msg(int tl_phone, device_id_t device_id,
+    packet_t packet, services_t target, services_t error)
+{
+	return generic_received_msg_remote(tl_phone, NET_TL_RECEIVED, device_id,
+	    packet_get_id(packet), target, error);
 }
 
Index: uspace/lib/net/include/tl_local.h
===================================================================
--- uspace/lib/net/include/tl_local.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
+++ uspace/lib/net/include/tl_local.h	(revision a1caa3c27369ee7de11fef02f3fe402749662c37)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010 Martin Decky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup tl_local
+ *  @{
+ */
+
+#ifndef __TL_LOCAL_H__
+#define __TL_LOCAL_H__
+
+#include <ipc/ipc.h>
+#include <async.h>
+
+extern int tl_module_message_standalone(ipc_callid_t, ipc_call_t *,
+    ipc_call_t *, int *);
+extern int tl_module_start_standalone(async_client_conn_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/net/include/tl_standalone.h
===================================================================
--- uspace/lib/net/include/tl_standalone.h	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tl_standalone
- *  @{
- */
-
-#ifndef __TL_STANDALONE_H__
-#define __TL_STANDALONE_H__
-
-#include <ipc/ipc.h>
-#include <async.h>
-
-extern int tl_module_message(ipc_callid_t callid, ipc_call_t *call,
-    ipc_call_t *answer, int *answer_count);
-extern int tl_module_start(async_client_conn_t client_connection);
-
-#endif
-
-/** @}
- */
