Index: uspace/lib/net/tl/tl_common.c
===================================================================
--- uspace/lib/net/tl/tl_common.c	(revision e526f08e005a95740d8b5d3b30f7cdf1db353104)
+++ uspace/lib/net/tl/tl_common.c	(revision b14b71e4c383761942ffe166e7deed2e27aa7360)
@@ -27,12 +27,20 @@
  */
 
-/** @addtogroup net_tl
- *  @{
+/** @addtogroup libnet 
+ * @{
  */
 
 /** @file
- *  Transport layer common functions implementation.
- *  @see tl_common.h
- */
+ * Transport layer common functions implementation.
+ * @see tl_common.h
+ */
+
+#include <tl_common.h>
+#include <packet_client.h>
+#include <packet_remote.h>
+#include <icmp_interface.h>
+#include <ip_remote.h>
+#include <ip_interface.h>
+#include <tl_interface.h>
 
 #include <net/socket_codes.h>
@@ -40,4 +48,7 @@
 #include <net/in6.h>
 #include <net/inet.h>
+#include <net/device.h>
+#include <net/packet.h>
+
 #include <async.h>
 #include <ipc/services.h>
@@ -45,16 +56,18 @@
 #include <err.h>
 
-#include <net/packet.h>
-#include <packet_client.h>
-#include <packet_remote.h>
-#include <net/device.h>
-#include <icmp_interface.h>
-#include <ip_remote.h>
-#include <ip_interface.h>
-#include <tl_interface.h>
-#include <tl_common.h>
-
 DEVICE_MAP_IMPLEMENT(packet_dimensions, packet_dimension_t);
 
+/** Gets the address port.
+ *
+ * Supports AF_INET and AF_INET6 address families.
+ *
+ * @param[in,out] addr	The address to be updated.
+ * @param[in] addrlen	The address length.
+ * @param[out] port	The set port.
+ * @returns		EOK on success.
+ * @returns		EINVAL if the address length does not match the address
+ *			family.
+ * @returns		EAFNOSUPPORT if the address family is not supported.
+ */
 int
 tl_get_address_port(const struct sockaddr *addr, int addrlen, uint16_t *port)
@@ -74,11 +87,13 @@
 		*port = ntohs(address_in->sin_port);
 		break;
+	
 	case AF_INET6:
 		if (addrlen != sizeof(struct sockaddr_in6))
-				return EINVAL;
+			return EINVAL;
 
 		address_in6 = (struct sockaddr_in6 *) addr;
 		*port = ntohs(address_in6->sin6_port);
 		break;
+	
 	default:
 		return EAFNOSUPPORT;
@@ -93,17 +108,17 @@
  * 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.
- *
- * @return EOK on success.
- * @return EBADMEM if the packet_dimension parameter is NULL.
- * @return ENOMEM if there is not enough memory left.
- * @return EINVAL if the packet_dimensions cache is not valid.
- * @return Other codes as defined for the ip_packet_size_req() function.
- *
- */
-int tl_get_ip_packet_dimension(int ip_phone,
+ * @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.
+ * @return		EOK on success.
+ * @return		EBADMEM if the packet_dimension parameter is NULL.
+ * @return		ENOMEM if there is not enough memory left.
+ * @return		EINVAL if the packet_dimensions cache is not valid.
+ * @return		Other codes as defined for the ip_packet_size_req()
+ *			function.
+ */
+int
+tl_get_ip_packet_dimension(int ip_phone,
     packet_dimensions_ref packet_dimensions, device_id_t device_id,
     packet_dimension_ref *packet_dimension)
@@ -139,4 +154,12 @@
 }
 
+/** Updates IP device packet dimensions cache.
+ *
+ * @param[in,out] packet_dimensions The packet dimensions cache.
+ * @param[in] device_id	The device identifier.
+ * @param[in] content	The new maximum content size.
+ * @returns		EOK on success.
+ * @return		ENOENT if the packet dimension is not cached.
+ */
 int
 tl_update_ip_packet_dimension(packet_dimensions_ref packet_dimensions,
@@ -148,4 +171,5 @@
 	if (!packet_dimension)
 		return ENOENT;
+
 	packet_dimension->content = content;
 
@@ -160,5 +184,4 @@
 				packet_dimensions_exclude(packet_dimensions,
 				    DEVICE_INVALID_ID);
-
 		}
 	}
@@ -167,4 +190,16 @@
 }
 
+/** Sets the address port.
+ *
+ * Supports AF_INET and AF_INET6 address families.
+ *
+ * @param[in,out] addr	The address to be updated.
+ * @param[in] addrlen	The address length.
+ * @param[in] port	The port to be set.
+ * @returns		EOK on success.
+ * @returns		EINVAL if the address length does not match the address
+ *			family.
+ * @returns		EAFNOSUPPORT if the address family is not supported.
+ */
 int tl_set_address_port(struct sockaddr * addr, int addrlen, uint16_t port)
 {
@@ -187,4 +222,5 @@
 		address_in->sin_port = htons(port);
 		return EOK;
+	
 	case AF_INET6:
 		if (length != sizeof(struct sockaddr_in6))
@@ -193,4 +229,5 @@
 		address_in6->sin6_port = htons(port);
 		return EOK;
+	
 	default:
 		return EAFNOSUPPORT;
@@ -198,4 +235,17 @@
 }
 
+/** Prepares the packet for ICMP error notification.
+ *
+ * Keeps the first packet and releases all the others.
+ * Releases all the packets on error.
+ *
+ * @param[in] packet_phone The packet server module phone.
+ * @param[in] icmp_phone The ICMP module phone.
+ * @param[in] packet	The packet to be send.
+ * @param[in] error	The packet error reporting service. Prefixes the
+ *			received packet.
+ * @returns		EOK on success.
+ * @returns		ENOENT if no packet may be sent.
+ */
 int
 tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t packet,
@@ -223,4 +273,18 @@
 }
 
+/** Receives data from the socket into a packet.
+ *
+ * @param[in] packet_phone The packet server module phone.
+ * @param[out] packet	The new created packet.
+ * @param[in] prefix	Reserved packet data prefix length.
+ * @param[in] dimension	The packet dimension.
+ * @param[in] addr	The destination address.
+ * @param[in] addrlen	The address length.
+ * @returns		Number of bytes received.
+ * @returns		EINVAL if the client does not send data.
+ * @returns		ENOMEM if there is not enough memory left.
+ * @returns		Other error codes as defined for the
+ *			async_data_read_finalize() function.
+ */
 int
 tl_socket_read_packet_data(int packet_phone, packet_ref packet, size_t prefix,
