Index: uspace/app/nettest1/nettest.c
===================================================================
--- uspace/app/nettest1/nettest.c	(revision d9e2e0e5da784f24fff54521848626ccafc45bdc)
+++ uspace/app/nettest1/nettest.c	(revision 3d459fcecedd05c16f0147a90e81b3f544b21bc3)
@@ -28,9 +28,9 @@
 
 /** @addtogroup nettest
- *  @{
+ * @{
  */
 
 /** @file
- *  Networking test support functions implementation.
+ * Networking test support functions implementation.
  */
 
@@ -43,69 +43,118 @@
 #include "print_error.h"
 
-int sockets_create(int verbose, int * socket_ids, int sockets, int family, sock_type_t type){
-	int index;
-
-	if(verbose){
+
+/** Creates new sockets.
+ *
+ * @param[in] verbose A value indicating whether to print out verbose information.
+ * @param[out] socket_ids A field to store the socket identifiers.
+ * @param[in] sockets The number of sockets to create. Should be at most the size of the field.
+ * @param[in] family The socket address family.
+ * @param[in] type The socket type.
+ * @returns EOK on success.
+ * @returns Other error codes as defined for the socket() function.
+ */
+int sockets_create(int verbose, int *socket_ids, int sockets, int family, sock_type_t type)
+{
+	int index;
+
+	if (verbose)
 		printf("Create\t");
-	}
-	fflush(stdout);
-	for(index = 0; index < sockets; ++ index){
+		
+	fflush(stdout);
+	
+	for (index = 0; index < sockets; index++) {
 		socket_ids[index] = socket(family, type, 0);
-		if(socket_ids[index] < 0){
+		if (socket_ids[index] < 0) {
 			printf("Socket %d (%d) error:\n", index, socket_ids[index]);
 			socket_print_error(stderr, socket_ids[index], "Socket create: ", "\n");
 			return socket_ids[index];
 		}
-		if(verbose){
-			print_mark(index);
-		}
-	}
-	return EOK;
-}
-
-int sockets_close(int verbose, int * socket_ids, int sockets){
-	ERROR_DECLARE;
-
-	int index;
-
-	if(verbose){
+		if (verbose)
+			print_mark(index);
+	}
+	
+	return EOK;
+}
+
+/** Closes sockets.
+ *
+ * @param[in] verbose A value indicating whether to print out verbose information.
+ * @param[in] socket_ids A field of stored socket identifiers.
+ * @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ * @returns EOK on success.
+ * @returns Other error codes as defined for the closesocket() function.
+ */
+int sockets_close(int verbose, int *socket_ids, int sockets)
+{
+	ERROR_DECLARE;
+
+	int index;
+
+	if (verbose)
 		printf("\tClose\t");
-	}
-	fflush(stdout);
-	for(index = 0; index < sockets; ++ index){
-		if(ERROR_OCCURRED(closesocket(socket_ids[index]))){
+
+	fflush(stdout);
+	
+	for (index = 0; index < sockets; index++) {
+		if (ERROR_OCCURRED(closesocket(socket_ids[index]))) {
 			printf("Socket %d (%d) error:\n", index, socket_ids[index]);
 			socket_print_error(stderr, ERROR_CODE, "Socket close: ", "\n");
 			return ERROR_CODE;
 		}
-		if(verbose){
-			print_mark(index);
-		}
-	}
-	return EOK;
-}
-
-int sockets_connect(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen){
-	ERROR_DECLARE;
-
-	int index;
-
-	if(verbose){
+		if (verbose)
+			print_mark(index);
+	}
+	
+	return EOK;
+}
+
+/** Connects sockets.
+ *
+ * @param[in] verbose A value indicating whether to print out verbose information.
+ * @param[in] socket_ids A field of stored socket identifiers.
+ * @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ * @param[in] address The destination host address to connect to.
+ * @param[in] addrlen The length of the destination address in bytes.
+ * @returns EOK on success.
+ * @returns Other error codes as defined for the connect() function.
+ */
+int sockets_connect(int verbose, int *socket_ids, int sockets, struct sockaddr *address, socklen_t addrlen)
+{
+	ERROR_DECLARE;
+
+	int index;
+
+	if (verbose)
 		printf("\tConnect\t");
-	}
-	fflush(stdout);
-	for(index = 0; index < sockets; ++ index){
-		if(ERROR_OCCURRED(connect(socket_ids[index], address, addrlen))){
+	
+	fflush(stdout);
+	
+	for (index = 0; index < sockets; index++) {
+		if (ERROR_OCCURRED(connect(socket_ids[index], address, addrlen))) {
 			socket_print_error(stderr, ERROR_CODE, "Socket connect: ", "\n");
 			return ERROR_CODE;
 		}
-		if(verbose){
-			print_mark(index);
-		}
-	}
-	return EOK;
-}
-
-int sockets_sendto(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t addrlen, char * data, int size, int messages){
+		if (verbose)
+			print_mark(index);
+	}
+	
+	return EOK;
+}
+
+/** Sends data via sockets.
+ *
+ * @param[in] verbose A value indicating whether to print out verbose information.
+ * @param[in] socket_ids A field of stored socket identifiers.
+ * @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ * @param[in] address The destination host address to send data to.
+ * @param[in] addrlen The length of the destination address in bytes.
+ * @param[in] data The data to be sent.
+ * @param[in] size The data size in bytes.
+ * @param[in] messages The number of datagrams per socket to be sent.
+ * @returns EOK on success.
+ * @returns Other error codes as defined for the sendto() function.
+ */
+int sockets_sendto(int verbose, int *socket_ids, int sockets, struct sockaddr *address, socklen_t addrlen, char *data, int size, int messages)
+{
 	ERROR_DECLARE;
 
@@ -113,11 +162,12 @@
 	int message;
 
-	if(verbose){
+	if (verbose)
 		printf("\tSendto\t");
-	}
-	fflush(stdout);
-	for(index = 0; index < sockets; ++ index){
-		for(message = 0; message < messages; ++ message){
-			if(ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, addrlen))){
+
+	fflush(stdout);
+	
+	for (index = 0; index < sockets; index++) {
+		for (message = 0; message < messages; message++) {
+			if (ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, addrlen))) {
 				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
 				socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
@@ -125,24 +175,39 @@
 			}
 		}
-		if(verbose){
-			print_mark(index);
-		}
-	}
-	return EOK;
-}
-
-int sockets_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages){
+		if (verbose)
+			print_mark(index);
+	}
+	
+	return EOK;
+}
+
+/** Receives data via sockets.
+ *
+ * @param[in] verbose A value indicating whether to print out verbose information.
+ * @param[in] socket_ids A field of stored socket identifiers.
+ * @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ * @param[in] address The source host address of received datagrams.
+ * @param[in,out] addrlen The maximum length of the source address in bytes. The actual size of the source address is set instead.
+ * @param[out] data The received data.
+ * @param[in] size The maximum data size in bytes.
+ * @param[in] messages The number of datagrams per socket to be received.
+ * @returns EOK on success.
+ * @returns Other error codes as defined for the recvfrom() function.
+ */
+int sockets_recvfrom(int verbose, int *socket_ids, int sockets, struct sockaddr *address, socklen_t *addrlen, char *data, int size, int messages)
+{
 	int value;
 	int index;
 	int message;
 
-	if(verbose){
+	if (verbose)
 		printf("\tRecvfrom\t");
-	}
-	fflush(stdout);
-	for(index = 0; index < sockets; ++ index){
-		for(message = 0; message < messages; ++ message){
+	
+	fflush(stdout);
+	
+	for (index = 0; index < sockets; index++) {
+		for (message = 0; message < messages; message++) {
 			value = recvfrom(socket_ids[index], data, size, 0, address, addrlen);
-			if(value < 0){
+			if (value < 0) {
 				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
 				socket_print_error(stderr, value, "Socket receive: ", "\n");
@@ -150,12 +215,28 @@
 			}
 		}
-		if(verbose){
-			print_mark(index);
-		}
-	}
-	return EOK;
-}
-
-int sockets_sendto_recvfrom(int verbose, int * socket_ids, int sockets, struct sockaddr * address, socklen_t * addrlen, char * data, int size, int messages){
+		if (verbose)
+			print_mark(index);
+	}
+	return EOK;
+}
+
+/** Sends and receives data via sockets.
+ *
+ * Each datagram is sent and a reply read consequently.
+ * The next datagram is sent after the reply is received.
+ *
+ * @param[in] verbose A value indicating whether to print out verbose information.
+ * @param[in] socket_ids A field of stored socket identifiers.
+ * @param[in] sockets The number of sockets in the field. Should be at most the size of the field.
+ * @param[in,out] address The destination host address to send data to. The source host address of received datagrams is set instead.
+ * @param[in] addrlen The length of the destination address in bytes.
+ * @param[in,out] data The data to be sent. The received data are set instead.
+ * @param[in] size The data size in bytes.
+ * @param[in] messages The number of datagrams per socket to be received.
+ * @returns EOK on success.
+ * @returns Other error codes as defined for the recvfrom() function.
+ */
+int sockets_sendto_recvfrom(int verbose, int *socket_ids, int sockets, struct sockaddr *address, socklen_t *addrlen, char *data, int size, int messages)
+{
 	ERROR_DECLARE;
 
@@ -164,11 +245,12 @@
 	int message;
 
-	if(verbose){
+	if (verbose)
 		printf("\tSendto and recvfrom\t");
-	}
-	fflush(stdout);
-	for(index = 0; index < sockets; ++ index){
-		for(message = 0; message < messages; ++ message){
-			if(ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, * addrlen))){
+
+	fflush(stdout);
+	
+	for (index = 0; index < sockets; index++) {
+		for (message = 0; message < messages; message++) {
+			if (ERROR_OCCURRED(sendto(socket_ids[index], data, size, 0, address, *addrlen))) {
 				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
 				socket_print_error(stderr, ERROR_CODE, "Socket send: ", "\n");
@@ -176,5 +258,5 @@
 			}
 			value = recvfrom(socket_ids[index], data, size, 0, address, addrlen);
-			if(value < 0){
+			if (value < 0) {
 				printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message);
 				socket_print_error(stderr, value, "Socket receive: ", "\n");
@@ -182,17 +264,23 @@
 			}
 		}
-		if(verbose){
-			print_mark(index);
-		}
-	}
-	return EOK;
-}
-
-void print_mark(int index){
-	if((index + 1) % 10){
+		if (verbose)
+			print_mark(index);
+	}
+	
+	return EOK;
+}
+
+/** Prints a mark.
+ *
+ * If the index is a multiple of ten, a different mark is printed.
+ *
+ * @param[in] index The index of the mark to be printed.
+ */
+void print_mark(int index)
+{
+	if ((index + 1) % 10)
 		printf("*");
-	}else{
+	else
 		printf("|");
-	}
 	fflush(stdout);
 }
