Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

test003block.c File Reference

This program tests the low-level block transfer and authentication functions. More...

#include <stdio.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <signal.h>
#include "libcomm.h"
#include <unistd.h>

Defines

#define PORT   1235
 Port on which the server is listening and the client trys to connect. More...

#define bufsize   8192
 How much random bytes should be transfered? More...

#define threadid   1234
 The ID which identifies the thread of the block_call() function. More...


Functions

 main (int argc, char *argv[])
 test0001sockts: see test0001sockts.c. More...

 client_test_program (char *server, int port, int auth)
 test0001sockts: see test0001sockts.c, Client Test Programm. More...

 block_call_do_test (int fd, int id, unsigned int type, char *buf, unsigned int size, int term)
 testfunction which ist called from block_call() if a message/datablock has received. More...

 block_call_term_test (int fd, int id)
 testfunction which ist called from block_call() if a the connection terminates. More...

 socket_accept_do_test (int fd, int id, char *pip, struct sockaddr_in their_addr, int term)
 testfunction which ist called from socket_accept() if someone has connected. More...

 server_test_program (int port, int mode)
 test0001sockts: see test0001sockts.c, Server Test Programm. More...


Detailed Description

This program tests the low-level block transfer and authentication functions.


Define Documentation

#define bufsize   8192
 

How much random bytes should be transfered?

#define PORT   1235
 

Port on which the server is listening and the client trys to connect.

#define threadid   1234
 

The ID which identifies the thread of the block_call() function.

This value can be coosen arbitrary and is passwd to all called functions.


Function Documentation

block_call_do_test int    fd,
int    id,
unsigned int    type,
char *    buf,
unsigned int    size,
int    term
 

testfunction which ist called from block_call() if a message/datablock has received.

block_call_term_test int    fd,
int    id
 

testfunction which ist called from block_call() if a the connection terminates.

client_test_program char *    server,
int    port,
int    auth
 

test0001sockts: see test0001sockts.c, Client Test Programm.

The client test program generates a block of n*(bufsize) random bytes, sents theses bytes to the server, receive a block from server, invert it and compare it with generated block.

BUGS: Receives only one block. If not all data ready and function resv() do noct block, data get lost. Test fails.

Parameters:
server  (char *) contains the server name
port  (int) specifies the port on the server
auth  (int) 0: normale test; 1: do authentification before run test.

main int    argc,
char *    argv[]
 

test0001sockts: see test0001sockts.c.

server_test_program int    port,
int    mode
 

test0001sockts: see test0001sockts.c, Server Test Programm.

The server test program binds a port and waits for connections. If someone connects it reads n*(bufsize) bytes, invert all bits of these bytes and send all back.

BUGS: Receives only one block. If not all data ready and function resv() do noct block, data get lost. Test fails.

Parameters:
port  (int) specify the port to bind.
mode  (int) select the mode of receiving a message/datablock: 0: blocked mode, use block_receive(); 1: poll mode, poll with block_receive_poll(); 2: call function block_call_do_test() if a block is received, use block_call(); 3: call socket_accept_do_test() if someone has connected. This function calls block_call() which does the same like in 2, use socket_accept(); 4: testing authenication by using socket_md5auth(). After this do the same as in 0.

socket_accept_do_test int    fd,
int    id,
char *    pip,
struct sockaddr_in    their_addr,
int    term
 

testfunction which ist called from socket_accept() if someone has connected.


Generated on Mon Apr 25 10:53:26 2005 for Hofmeier_FYP:libcomm by doxygen1.2.15