Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4749 → Rev 4748

/branches/network/uspace/srv/net/app/nettest2/nettest2.c
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/app/nettest2/Makefile
File deleted
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/branches/network/uspace/srv/net/app/nettest1/nettest1.c
26,12 → 26,12
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup nettest
/** @addtogroup echo
* @{
*/
 
/** @file
* Networking test 1 application - sockets.
* Networking test 1 application - UDP sockets.
*/
 
#include <malloc.h>
56,7 → 56,7
 
/** Packet data pattern.
*/
#define NETTEST1_TEXT "Networking test 1 - sockets"
#define NETTEST1_TEXT "Networking test 1 - UDP sockets"
 
/** Module entry point.
* Starts testing.
84,97 → 84,18
*/
int parse_socket_type( const char * name );
 
/** Refreshes the data.
* Fills the data block with the NETTEST1_TEXT pattern.
* @param data The data block. Output parameter.
* @param size The data block size in bytes. Input parameter
*/
void refresh_data( char * data, size_t size );
 
/** Creates new sockets.
* @param verbose A value indicating whether to print out verbose information. Input parameter.
* @param socket_ids A field to store the socket identifiers. Output parameter.
* @param sockets The number of sockets to create. Should be at most the size of the field. Input parameter.
* @param family The socket address family. Input parameter.
* @param type The socket type. Input parameter.
* @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 );
 
/** Closes sockets.
* @param verbose A value indicating whether to print out verbose information. Input parameter.
* @param socket_ids A field of stored socket identifiers. Input parameter.
* @param sockets The number of sockets in the field. Should be at most the size of the field. Input parameter.
* @returns EOK on success.
* @returns Other error codes as defined for the closesocket() function.
*/
int sockets_close( int verbose, int * socket_ids, int sockets );
 
/** Connects sockets.
* @param verbose A value indicating whether to print out verbose information. Input parameter.
* @param socket_ids A field of stored socket identifiers. Input parameter.
* @param sockets The number of sockets in the field. Should be at most the size of the field. Input parameter.
* @param address The destination host address to connect to. Input parameter.
* @param addrlen The length of the destination address in bytes. Input parameter.
* @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 );
 
/** Sends data via sockets.
* @param verbose A value indicating whether to print out verbose information. Input parameter.
* @param socket_ids A field of stored socket identifiers. Input parameter.
* @param sockets The number of sockets in the field. Should be at most the size of the field. Input parameter.
* @param address The destination host address to send data to. Input parameter.
* @param addrlen The length of the destination address in bytes. Input parameter.
* @param data The data to be sent. Input parameter.
* @param size The data size in bytes. Input parameter
* @param messages The number of datagrams per socket to be sent. Input parameter.
* @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 );
 
/** Receives data via sockets.
* @param verbose A value indicating whether to print out verbose information. Input parameter.
* @param socket_ids A field of stored socket identifiers. Input parameter.
* @param sockets The number of sockets in the field. Should be at most the size of the field. Input parameter.
* @param address The source host address of received datagrams. Input parameter.
* @param addrlen The maximum length of the source address in bytes. The actual size of the source address is set instead. Input/output parameter.
* @param data The received data. Output parameter.
* @param size The maximum data size in bytes. Input parameter
* @param messages The number of datagrams per socket to be received. Input parameter.
* @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 );
 
/** 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 verbose A value indicating whether to print out verbose information. Input parameter.
* @param socket_ids A field of stored socket identifiers. Input parameter.
* @param sockets The number of sockets in the field. Should be at most the size of the field. Input parameter.
* @param address The destination host address to send data to. The source host address of received datagrams is set instead. Input/output parameter.
* @param addrlen The length of the destination address in bytes. Input parameter.
* @param data The data to be sent. The received data are set instead. Input/output parameter.
* @param size The data size in bytes. Input parameter
* @param messages The number of datagrams per socket to be received. Input parameter.
* @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 );
 
/** Prints a mark.
* If the index is a multiple of ten, a different mark is printed.
* @param index The index of the mark to be printed. Input parameter.
*/
void print_mark( int index );
 
void print_help( void ){
printf(
"Network Networking test 1 aplication - sockets\n" \
"Network Networking test 1 aplication - UDP sockets\n" \
"Usage: echo [options] numeric_address\n" \
"Where options are:\n" \
"-f protocol_family | --family=protocol_family\n" \
184,16 → 105,16
"\tShow this application help.\n"
"\n" \
"-m count | --messages=count\n" \
"\tThe number of messages to send and receive per socket. The default is 10.\n" \
"\tThe number of messages to send and receive per socket. The default is 100.\n" \
"\n" \
"-n sockets | --sockets=count\n" \
"\tThe number of sockets to use. The default is 10.\n" \
"\tThe number of sockets to use. The default is 100.\n" \
"\n" \
"-p port_number | --port=port_number\n" \
"\tThe port number the application should send messages to. The default is 7.\n" \
"\n" \
"-s packet_size | --size=packet_size\n" \
"\tThe packet data size the application sends. The default is 28 bytes.\n" \
"\tThe packet data size the application sends. The default is 38 bytes.\n" \
"\n" \
"-v | --verbose\n" \
"\tShow all output messages.\n"
223,12 → 144,11
 
// fill the data
length = 0;
while( size > length + sizeof( NETTEST1_TEXT ) - 1 ){
memcpy( data + length, NETTEST1_TEXT, sizeof( NETTEST1_TEXT ) - 1 );
length += sizeof( NETTEST1_TEXT ) - 1;
while( size > length + sizeof( NETTEST1_TEXT )){
memcpy( data + length, NETTEST1_TEXT, sizeof( NETTEST1_TEXT ));
length += sizeof( NETTEST1_TEXT );
}
memcpy( data + length, NETTEST1_TEXT, size - length );
data[ size ] = '\0';
}
 
int sockets_create( int verbose, int * socket_ids, int sockets, int family, sock_type_t type ){
365,7 → 285,7
int main( int argc, char * argv[] ){
ERROR_DECLARE;
 
size_t size = 28;
size_t size = 38;
int verbose = 0;
sock_type_t type = SOCK_DGRAM;
int sockets = 10;
/branches/network/uspace/srv/net/Makefile
38,8 → 38,7
socket \
app/echo \
app/ping \
app/nettest1 \
app/nettest2
app/nettest1
 
DIRS_MODULAR = \
il/arp \
/branches/network/boot/arch/ia32/Makefile.inc
52,7 → 52,6
$(USPACEDIR)/srv/net/app/echo/echo \
$(USPACEDIR)/srv/net/app/ping/ping \
$(USPACEDIR)/srv/net/app/nettest1/nettest1 \
$(USPACEDIR)/srv/net/app/nettest2/nettest2 \
$(USPACEDIR)/srv/pci/pci \
$(USPACEDIR)/srv/fb/fb \
$(USPACEDIR)/srv/kbd/kbd \