Index: uspace/srv/net/tl/tcp/tcp.c
===================================================================
--- uspace/srv/net/tl/tcp/tcp.c	(revision 24ab58b348754b301fea741628d74d49704735d6)
+++ uspace/srv/net/tl/tcp/tcp.c	(revision 6c39a9074d1bf9a23bf5243a2c35b2a8549f41d3)
@@ -51,4 +51,5 @@
 #include <adt/dynamic_fifo.h>
 #include <packet/packet_client.h>
+#include <packet_remote.h>
 #include <net_checksum.h>
 #include <in.h>
@@ -68,4 +69,6 @@
 #include <tl_common.h>
 #include <tl_messages.h>
+#include <tl_local.h>
+#include <tl_interface.h>
 
 #include "tcp.h"
@@ -421,5 +424,5 @@
 			break;
 		default:
-			pq_release(tcp_globals.net_phone, packet_get_id(packet));
+			pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 	}
 
@@ -473,5 +476,5 @@
 			// release the acknowledged packets
 			next_packet = pq_next(packet);
-			pq_release(tcp_globals.net_phone, packet_get_id(packet));
+			pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 			packet = next_packet;
 			offset -= length;
@@ -517,5 +520,5 @@
 			next_packet = pq_next(next_packet);
 			pq_insert_after(tmp_packet, next_packet);
-			pq_release(tcp_globals.net_phone, packet_get_id(tmp_packet));
+			pq_release_remote(tcp_globals.net_phone, packet_get_id(tmp_packet));
 		}
 		assert(new_sequence_number + total_length == socket_data->next_incoming + socket_data->window);
@@ -548,5 +551,5 @@
 					socket_data->incoming = next_packet;
 				}
-				pq_release(tcp_globals.net_phone, packet_get_id(packet));
+				pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 				packet = next_packet;
 				continue;
@@ -568,5 +571,5 @@
 				if(length <= 0){
 					// remove the empty packet
-					pq_release(tcp_globals.net_phone, packet_get_id(packet));
+					pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 					packet = next_packet;
 					continue;
@@ -595,5 +598,5 @@
 				}
 				// remove the duplicit or corrupted packet
-				pq_release(tcp_globals.net_phone, packet_get_id(packet));
+				pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 				packet = next_packet;
 				continue;
@@ -617,6 +620,6 @@
 		if(ERROR_OCCURRED(pq_add(&socket_data->incoming, packet, new_sequence_number, length))){
 			// remove the corrupted packets
-			pq_release(tcp_globals.net_phone, packet_get_id(packet));
-			pq_release(tcp_globals.net_phone, packet_get_id(next_packet));
+			pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
+			pq_release_remote(tcp_globals.net_phone, packet_get_id(next_packet));
 		}else{
 			while(next_packet){
@@ -626,5 +629,5 @@
 				if(ERROR_OCCURRED(pq_set_order(next_packet, new_sequence_number, length))
 					|| ERROR_OCCURRED(pq_insert_after(packet, next_packet))){
-					pq_release(tcp_globals.net_phone, packet_get_id(next_packet));
+					pq_release_remote(tcp_globals.net_phone, packet_get_id(next_packet));
 				}
 				next_packet = tmp_packet;
@@ -634,5 +637,5 @@
 		printf("unexpected\n");
 		// release duplicite or restricted
-		pq_release(tcp_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 	}
 
@@ -679,5 +682,5 @@
 	// queue the received packet
 	if(ERROR_OCCURRED(dyn_fifo_push(&socket->received, packet_get_id(packet), SOCKET_MAX_RECEIVED_SIZE))
-		|| ERROR_OCCURRED(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, socket_data->device_id, &packet_dimension))){
+	    || ERROR_OCCURRED(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, socket_data->device_id, &packet_dimension))){
 		return tcp_release_and_return(packet, ERROR_CODE);
 	}
@@ -710,5 +713,5 @@
 		next_packet = pq_detach(packet);
 		if(next_packet){
-			pq_release(tcp_globals.net_phone, packet_get_id(next_packet));
+			pq_release_remote(tcp_globals.net_phone, packet_get_id(next_packet));
 		}
 		// trim if longer than the header
@@ -780,5 +783,5 @@
 				free(socket_data->addr);
 				free(socket_data);
-				pq_release(tcp_globals.net_phone, packet_get_id(packet));
+				pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 				return ERROR_CODE;
 			}
@@ -846,5 +849,5 @@
 			next_packet = pq_detach(packet);
 			if(next_packet){
-				pq_release(tcp_globals.net_phone, packet_get_id(next_packet));
+				pq_release_remote(tcp_globals.net_phone, packet_get_id(next_packet));
 			}
 			// trim if longer than the header
@@ -895,5 +898,5 @@
 
 		socket_data->next_incoming = ntohl(header->sequence_number);// + 1;
-		pq_release(tcp_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 		socket_data->state = TCP_SOCKET_ESTABLISHED;
 		listening_socket = socket_cores_find(socket_data->local_sockets, socket_data->listening_socket_id);
@@ -981,5 +984,5 @@
 					// add to acknowledged or release
 					if(pq_add(&acknowledged, packet, 0, 0) != EOK){
-						pq_release(tcp_globals.net_phone, packet_get_id(packet));
+						pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 					}
 					packet = next;
@@ -990,5 +993,5 @@
 			// release acknowledged
 			if(acknowledged){
-				pq_release(tcp_globals.net_phone, packet_get_id(acknowledged));
+				pq_release_remote(tcp_globals.net_phone, packet_get_id(acknowledged));
 			}
 			return;
@@ -1006,5 +1009,5 @@
 }
 
-int tcp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
+int tcp_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
 	ERROR_DECLARE;
 
@@ -1019,5 +1022,5 @@
 		case NET_TL_RECEIVED:
 			//fibril_rwlock_read_lock(&tcp_globals.lock);
-			if(! ERROR_OCCURRED(packet_translate(tcp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
+			if(! ERROR_OCCURRED(packet_translate_remote(tcp_globals.net_phone, &packet, IPC_GET_PACKET(call)))){
 				ERROR_CODE = tcp_received_msg(IPC_GET_DEVICE(call), packet, SERVICE_TCP, IPC_GET_ERROR(call));
 			}
@@ -1111,5 +1114,5 @@
 					fibril_rwlock_write_unlock(&lock);
 					if(res == EOK){
-						if(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){
+						if (tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){
 							SOCKET_SET_DATA_FRAGMENT_SIZE(answer, ((packet_dimension->content < socket_data->data_fragment_size) ? packet_dimension->content : socket_data->data_fragment_size));
 						}
@@ -1565,5 +1568,5 @@
 			}else{
 				if(ERROR_OCCURRED(pq_insert_after(previous, copy))){
-					pq_release(tcp_globals.net_phone, packet_get_id(copy));
+					pq_release_remote(tcp_globals.net_phone, packet_get_id(copy));
 					return sending;
 				}
@@ -1597,5 +1600,5 @@
 	// adjust the pseudo header
 	if(ERROR_OCCURRED(ip_client_set_pseudo_header_data_length(socket_data->pseudo_header, socket_data->headerlen, packet_get_data_length(packet)))){
-		pq_release(tcp_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 		return NULL;
 	}
@@ -1604,5 +1607,5 @@
 	header = (tcp_header_ref) packet_get_data(packet);
 	if(! header){
-		pq_release(tcp_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 		return NULL;
 	}
@@ -1625,5 +1628,5 @@
 	// prepare the timeout
 		|| ERROR_OCCURRED(tcp_prepare_timeout(tcp_timeout, socket, socket_data, sequence_number, socket_data->state, socket_data->timeout, true))){
-		pq_release(tcp_globals.net_phone, packet_get_id(packet));
+		pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 		return NULL;
 	}
@@ -1750,5 +1753,5 @@
 		return NO_DATA;
 	}
-	ERROR_PROPAGATE(packet_translate(tcp_globals.net_phone, &packet, packet_id));
+	ERROR_PROPAGATE(packet_translate_remote(tcp_globals.net_phone, &packet, packet_id));
 
 	// reply the packets
@@ -1757,5 +1760,5 @@
 	// release the packet
 	dyn_fifo_pop(&socket->received);
-	pq_release(tcp_globals.net_phone, packet_get_id(packet));
+	pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 	// return the total length
 	return (int) length;
@@ -1889,5 +1892,5 @@
 	ERROR_PROPAGATE(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, socket_data->device_id, &packet_dimension));
 	// get a new packet
-	*packet = packet_get_4(tcp_globals.net_phone, TCP_HEADER_SIZE, packet_dimension->addr_len, packet_dimension->prefix, packet_dimension->suffix);
+	*packet = packet_get_4_remote(tcp_globals.net_phone, TCP_HEADER_SIZE, packet_dimension->addr_len, packet_dimension->prefix, packet_dimension->suffix);
 	if(! * packet){
 		return ENOMEM;
@@ -1993,11 +1996,7 @@
 
 int tcp_release_and_return(packet_t packet, int result){
-	pq_release(tcp_globals.net_phone, packet_get_id(packet));
+	pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
 	return result;
 }
-
-#ifdef CONFIG_NETWORKING_modular
-
-#include <tl_standalone.h>
 
 /** Default thread for new connections.
@@ -2027,5 +2026,6 @@
 		
 		/* Process the message */
-		int res = tl_module_message(callid, &call, &answer, &answer_count);
+		int res = tl_module_message_standalone(callid, &call, &answer,
+		    &answer_count);
 		
 		/* End if said to either by the message or the processing result */
@@ -2052,5 +2052,5 @@
 	
 	/* Start the module */
-	if (ERROR_OCCURRED(tl_module_start(tl_client_connection)))
+	if (ERROR_OCCURRED(tl_module_start_standalone(tl_client_connection)))
 		return ERROR_CODE;
 	
@@ -2058,6 +2058,4 @@
 }
 
-#endif /* CONFIG_NETWORKING_modular */
-
 /** @}
  */
