Esempio n. 1
0
void main()
{
  int ret;
  E_init();
  system("clear");
  sp_time test_timeout;
  test_timeout.sec = 5;
  test_timeout.usec = 0;
  strncpy(Spread_name, "10080", 5);
  ret = SP_connect_timeout( Spread_name, User, 0, 1, &Mbox, Private_group, test_timeout );
        if( ret != ACCEPT_SESSION ) 
        {
                SP_error( ret );
                Bye();
        }
        printf("Connected to %s with private group %s\n", Spread_name, Private_group );

  E_attach_fd( 0, READ_FD, User_command, 0, NULL, LOW_PRIORITY );
  E_attach_fd( Mbox, READ_FD, Read_message, 0, NULL, HIGH_PRIORITY );
  show_menu();
  for(;;)
  {
    E_handle_events();
    User_command();
  }
  exit (0);
}
Esempio n. 2
0
void create_control_socket(const char *filename) {
  int fd;
  if((fd = serv_listen(filename)) < 0) {
    wack_alarm(PRINT, "disabling wackatrl support.");
    return;
  }
  E_attach_fd(fd, READ_FD, handle_control_connect, 0, NULL, HIGH_PRIORITY);
}
Esempio n. 3
0
File: client.c Progetto: Ezran/cs437
int main( int argc, char *argv[] )
{
        int	    ret;
        int     mver, miver, pver;
        sp_time test_timeout;

        test_timeout.sec = 5;
        test_timeout.usec = 0;
        server_num = 0;

        set_max_msgs(25);

        if (!SP_version( &mver, &miver, &pver)) 
        {
	          printf("main: Illegal variables passed to SP_version()\n");
	          Bye();
	    }
	    printf("Spread library version is %d.%d.%d\n", mver, miver, pver);

	    ret = SP_connect_timeout( SPREAD_NAME, NULL, 0, 1, &Mbox, Private_group, test_timeout );
	    if( ret != ACCEPT_SESSION ) 
	    {
		    SP_error( ret );
		    Bye();
	    }
	    printf("Client: connected to %s with private group %s\n", SPREAD_NAME, Private_group );

	    E_init();

	    E_attach_fd( 0, READ_FD, User_command, 0, NULL, LOW_PRIORITY );

	    E_attach_fd( Mbox, READ_FD, Read_message, 0, NULL, HIGH_PRIORITY );

	    Print_menu();

	    printf("\n > ");
	    fflush(stdout);

	    E_handle_events();

	    return( 0 );
}
Esempio n. 4
0
void handle_control_connect(int fd, int code, void *data) {
  int nfd, ret, ioctl_cmd;
  control_state *state;
  nfd = serv_accept(fd);
  if(nfd < 0) {
    wack_alarm(PRINT, "error receiving wackatrl session");
    return;
  }
  ioctl_cmd = 1;
#ifdef WIN32
  ret = ioctlsocket(nfd, FIONBIO, &ioctl_cmd);
#else
  ret = ioctl(nfd, FIONBIO, &ioctl_cmd);
#endif
  wack_alarm(WACK_DEBUG, "starting wackatrl session");
  state = calloc(1, sizeof(control_state));
  state->operation = READ_COMMAND;
  state->state = READ_FD;
  E_attach_fd(nfd, READ_FD, handle_control_session,
		0, (void *)state, HIGH_PRIORITY);
  E_attach_fd(nfd, WRITE_FD, handle_control_session,
		0, (void *)state, HIGH_PRIORITY);
  E_deactivate_fd(nfd, WRITE_FD);
}
Esempio n. 5
0
/* 5 = Terminate */
int main(int argc, char **argv)
{
	/* Variables */
  unsigned char      ttl_val;
  int                c, ret, num_groups;
  int complete = 0;
  int				response[10];
  char             sender[MAX_GROUP_NAME];
  int              service_type = 0;
  int               rts = 0;
  char mess_buf[MAX_MESS_LEN];
  struct timeval    timeout, start_time, end_time;
  struct initializers *i=malloc(sizeof(struct initializers));
  struct packet_structure *p=malloc(sizeof(struct packet_structure));
  
  sp_time test_timeout;
  sp_time delta_time;
  int16            mess_type;
  int              endian_mismatch=0;
  char             target_groups[MAX_MEMBERS][MAX_GROUP_NAME];
  i->debug = 0; /*Turn on for testing */
  strcpy(group, "shamil22");
  parseargs(argc, argv, i);
  setup(i); /*Setup ports and wait for start process */
     
  printf("Waiting to start.\n");
  while(!rts) { 
    ret = SP_receive( Mbox, &service_type, sender, 100, &num_groups, target_groups, 
                &mess_type, &endian_mismatch, sizeof(mess_buf), mess_buf );
    if (ret > 0) {
      i->packet = (struct packet_structure *)mess_buf; 
      if (i->packet->type == 2) {
         rts =1;
      }
    }
  }
  printf("Begin!\n");
  gettimeofday(&start_time, NULL);          
  starttime1=start_time.tv_sec+(start_time.tv_usec/1000000.0);
  delta_time.sec = 0; delta_time.usec =0;
  E_queue( send_data, 0, NULL, delta_time );
  E_attach_fd( Mbox, READ_FD, receive_packet, 0, NULL, HIGH_PRIORITY );
  printf("Handling events.\n");
  //send_data(); /*Send first chunk of message*/
  E_handle_events();
   
  return 0;  
}
Esempio n. 6
0
void    Spread_reconnect(int ret){

  if(ret != -8 && ret != -11 && ret != -2)
    wack_alarm(EXIT, "Spread_reconnnect: Unexpected Error (%d)", ret);
  
  wack_alarm(PRINT,"connecting to %s", Spread_name);
    
  Clean_up();

  if(Mbox >= 0) {
    SP_disconnect(Mbox);
    E_detach_fd( Mbox, READ_FD );
    Mbox = -1;
  }
  /* connecting to the relevant Spread daemon, asking for group info */
  if(spread_lock) {
    handle_reconnect(0, NULL);
    return;
  }
  ret = SP_connect( Spread_name, User, 0, 1, &Mbox, Private_group ) ;
  if(ret == ACCEPT_SESSION) {
    ret = SP_join( Mbox, Spread_group );  
    if( ret < 0 ) {
      SP_error( ret );
      SP_disconnect( Mbox );
      Mbox = -1;
      wack_alarm(PRINT, "Spread join on reconnect failed [%d].", ret);
      handle_reconnect(0, NULL);
      return;
    }
  } else {
    wack_alarm(PRINT, "Spread connect failed [%d].", ret);
    handle_reconnect(0, NULL);
    return;
  }

  /* State initializations */
  State = BOOT;
  Old_maturity = 0;
  Maturity = 0;
  E_queue( Turn_mature, 0, 0, Maturity_timeout );
  My.num_allocated = 0;
  
  strcpy(My.private_group_name, Private_group);

  E_attach_fd( Mbox, READ_FD, Handle_network, 0, NULL, HIGH_PRIORITY );
  E_set_active_threshold( HIGH_PRIORITY );
}
Esempio n. 7
0
void	Prot_init(void)
{
	int	i, num_bcast, num_token;
        channel *bcast_channels;
        channel *token_channels;

	Mem_init_object( PACK_HEAD_OBJ, sizeof( packet_header ), MAX_PACKETS_IN_STRUCT, 0 );
	Mem_init_object( PACKET_BODY, sizeof( packet_body ), MAX_PACKETS_IN_STRUCT, 0 );
	Mem_init_object( TOKEN_HEAD_OBJ, sizeof( token_header ), 10, 0 );
	Mem_init_object( TOKEN_BODY_OBJ, sizeof( token_body ), 10, 0 );
	Mem_init_object( SCATTER, sizeof( scatter ), 200+MAX_PROCS_RING, 0 );

	My = Conf_my();
	My_index = Conf_proc_by_id( My.id, &My );
	GlobalStatus.my_id = My.id;
	GlobalStatus.packet_delivered = 0;

	for( i=0; i < MAX_PROCS_RING+1; i++ )
		Up_queue[i].exist = 0;

	for( i=0; i < MAX_PACKETS_IN_STRUCT; i++ )
		Packets[i].exist = 0;

        if ( Conf_debug_initial_sequence() ) {
            Highest_seq 	 = INITIAL_SEQUENCE_NEAR_WRAP;
            Highest_fifo_seq     = INITIAL_SEQUENCE_NEAR_WRAP;
            My_aru	    	 = INITIAL_SEQUENCE_NEAR_WRAP;
            Aru		         = INITIAL_SEQUENCE_NEAR_WRAP;
            Set_aru		 = INITIAL_SEQUENCE_NEAR_WRAP -1;
            Last_discarded	 = INITIAL_SEQUENCE_NEAR_WRAP;
            Last_delivered	 = INITIAL_SEQUENCE_NEAR_WRAP;
        } else {
            Highest_seq 	 = 0;
            Highest_fifo_seq     = 0;
            My_aru	    	 = 0;
            Aru		         = 0;
            Set_aru		 = -1;
            Last_discarded	 = 0;
            Last_delivered	 = 0;
        }

	New_pack.num_elements = 2;
	New_pack.elements[0].len = sizeof(packet_header);
	New_pack.elements[0].buf = (char *) new(PACK_HEAD_OBJ);
	New_pack.elements[1].len = sizeof(packet_body);
	New_pack.elements[1].buf = (char *) new(PACKET_BODY);

	New_token.num_elements	= 2;
	New_token.elements[0].len = sizeof(token_header);
	New_token.elements[0].buf = (char *) new(TOKEN_HEAD_OBJ);
	New_token.elements[1].len = sizeof(token_body);
	New_token.elements[1].buf = (char *) new(TOKEN_BODY_OBJ);

	Send_pack.num_elements = 2;
	Send_pack.elements[0].len = sizeof(packet_header);

	Token = (token_header *)New_token.elements[0].buf;
	Last_token = new(TOKEN_HEAD_OBJ);
	Last_token->type = 0; 
	Last_token->seq = 0;
	Last_token->aru = 0;
	Last_token->flow_control = 0;
        Last_token->conf_hash = 0;

	Hurry_pack.num_elements = 1;
	Hurry_pack.elements[0].len = sizeof(packet_header);
	Hurry_pack.elements[0].buf = (char *) new(PACKET_BODY);
	Hurry_head = (packet_header *)Hurry_pack.elements[0].buf;
	Hurry_head->proc_id = My.id;
	Hurry_head->type = HURRY_TYPE;

	Net_init();

        bcast_channels = Net_bcast_channel();
        token_channels = Net_token_channel();
        Net_num_channels( &num_bcast, &num_token);
        for ( i = 0; i < num_bcast; i++) {
            E_attach_fd( *bcast_channels, READ_FD, Prot_handle_bcast, 0, NULL, HIGH_PRIORITY );
            bcast_channels++;
        }
        for ( i = 0; i < num_token; i++) {
            E_attach_fd( *token_channels, READ_FD, Prot_handle_token, 0, NULL, MEDIUM_PRIORITY );
            token_channels++;
        }

	FC_init( );
	Memb_init();

	Net_set_membership( Reg_membership );

}
Esempio n. 8
0
static	void	User_command()
{
	char	command[130];
	char	mess[MAX_MESSLEN];
	char	group[80];
	char	groups[10][MAX_GROUP_NAME];
	int	num_groups;
	unsigned int	mess_len;
	int	ret;
	int	i;

	for( i=0; i < sizeof(command); i++ ) command[i] = 0;
	if( fgets( command, 130, stdin ) == NULL ) 
            Bye();

	switch( command[0] )
	{
		case 'j':
			ret = sscanf( &command[2], "%s", group );
			if( ret < 1 ) 
			{
				printf(" invalid group \n");
				break;
			}
			ret = SP_join( Mbox, group );
			if( ret < 0 ) SP_error( ret );

			break;

		case 'l':
			ret = sscanf( &command[2], "%s", group );
			if( ret < 1 ) 
			{
				printf(" invalid group \n");
				break;
			}
			ret = SP_leave( Mbox, group );
			if( ret < 0 ) SP_error( ret );

			break;

		case 's':
			num_groups = sscanf(&command[2], "%s%s%s%s%s%s%s%s%s%s", 
						groups[0], groups[1], groups[2], groups[3], groups[4],
						groups[5], groups[6], groups[7], groups[8], groups[9] );
			if( num_groups < 1 ) 
			{
				printf(" invalid group \n");
				break;
			}
			printf("enter message: ");
			if (fgets(mess, 200, stdin) == NULL)
				Bye();
			mess_len = strlen( mess );
#ifdef _REENTRANT
#ifdef __bsdi__		/* bsdi bug - doing a close when another thread blocks on the socket causes a seg fault */
	ret = send( Mbox, mess, 0, 0 );
	if( ret < 0 )
	{
		SP_error( CONNECTION_CLOSED );
		Bye();
	}
#endif /* __bsdi__ */
#endif /* _REENTRANT */
			ret= SP_multigroup_multicast( Mbox, SAFE_MESS, num_groups, (const char (*)[MAX_GROUP_NAME]) groups, 1, mess_len, mess );
			if( ret < 0 ) 
			{
				SP_error( ret );
				Bye();
			}
			Num_sent++;

			break;

		case 'b':
			ret=sscanf( &command[2], "%s", group );
			if( ret != 1 ) strcpy( group, "dummy_group_name" );
			printf("enter size of each message: ");
			if (fgets(mess, 200, stdin) == NULL)
				Bye();
			ret=sscanf(mess, "%u", &mess_len );
			if( ret !=1 ) mess_len = Previous_len;
                        if( mess_len > MAX_MESSLEN ) mess_len = MAX_MESSLEN;
			Previous_len = mess_len;
			printf("sending 10 messages of %u bytes\n", mess_len );
			for( i=0; i<10; i++ )
			{
				Num_sent++;
				sprintf( mess, "mess num %d ", Num_sent );
#ifdef _REENTRANT
#ifdef __bsdi__		/* bsdi bug - doing a close when another thread blocks on the socket causes a seg fault */
	ret = send( Mbox, mess, 0,0 );
	if( ret < 0 )
	{
		SP_error( CONNECTION_CLOSED );
		Bye();
	}
#endif /* __bsdi__ */
#endif /* _REENTRANT */
				ret= SP_multicast( Mbox, FIFO_MESS, group, 2, mess_len, mess );

				if( ret < 0 ) 
				{
					SP_error( ret );
					Bye();
				}
				printf("sent message %d (total %d)\n", i+1, Num_sent );
			}
			break;
#ifndef _REENTRANT
		case 'r':

			Read_message();
			break;

		case 'p':

			ret = SP_poll( Mbox );
			printf("Polling sais: %d\n", ret );
			break;

		case 'e':

			E_attach_fd( Mbox, READ_FD, Read_message, 0, NULL, HIGH_PRIORITY );

			break;

		case 'd':

			E_detach_fd( Mbox, READ_FD );

			break;
#endif	/* _REENTRANT */
		case 'q':
			Bye();
			break;

		default:
			printf("\nUnknown commnad\n");
			Print_menu();

			break;
	}
	printf("\nUser> ");
	fflush(stdout);

}
Esempio n. 9
0
int main( int argc, char *argv[] )
{
	int	ret;
#ifdef SPREAD_VERSION
        int     mver, miver, pver;
#endif
        sp_time test_timeout;

        test_timeout.sec = 5;
        test_timeout.usec = 0;

	Usage( argc, argv );
#ifdef SPREAD_VERSION
        if (!SP_version( &mver, &miver, &pver)) 
        {
	  printf("main: Illegal variables passed to SP_version()\n");
	  Bye();
	}
	printf("Spread library version is %d.%d.%d\n", mver, miver, pver);
#else
        printf("Spread library version is %1.2f\n", SP_version() );
#endif
#ifdef  ENABLE_PASSWORD
        if (Use_Pword)
        {
                strncpy(Pword_user.username, Pword_username, 32);
                Pword_user.username[32] = '\0';
                strncpy(Pword_user.password, Pword_password, 8);
                Pword_user.password[8] = '\0';
                SP_set_auth_method("PWORD", pword_authenticate, &Pword_user);
        } 
#endif
	ret = SP_connect_timeout( Spread_name, User, 0, 1, &Mbox, Private_group, test_timeout );
	if( ret != ACCEPT_SESSION ) 
	{
		SP_error( ret );
		Bye();
	}
	printf("User: connected to %s with private group %s\n", Spread_name, Private_group );

#ifndef	_REENTRANT
	E_init();
	E_attach_fd( 0, READ_FD, User_command, 0, NULL, LOW_PRIORITY );

	E_attach_fd( Mbox, READ_FD, Read_message, 0, NULL, HIGH_PRIORITY );
#endif	/* _REENTRANT */

	Print_menu();

	printf("\nUser> ");
	fflush(stdout);

	Num_sent = 0;

#ifdef	_REENTRANT

#ifndef		ARCH_PC_WIN95
		ret = pthread_create( &Read_pthread, NULL, Read_thread_routine, 0 );
#else		/* ARCH_PC_WIN95 */
		Read_pthread = CreateThread( NULL, 0, Read_thread_routine, NULL, 0, &ret );
#endif		/* ARCH_PC_WIN95 */

	for(;;)
	{
		User_command();
#ifdef __bsdi__
		/* bug in BSDI */
		sched_yield();
#endif
	}

#else	/* _REENTRANT */

#ifndef		ARCH_PC_WIN95
		E_handle_events();
#else		/* ARCH_PC_WIN95 */
		for(;;)
			User_command();
#endif		/* ARCH_PC_WIN95 */

#endif	/* _REENTRANT */

	return( 0 );
}
Esempio n. 10
0
int main( int argc, char *argv[] )
{
	int	i;
#ifdef _REENTRANT
        int     ret;
#endif
	fclose(stderr);

	Alarm_set_types( NONE ); 

	Alarmp( SPLOG_PRINT, SYSTEM, "/===========================================================================\\\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| The Spread Toolkit.                                                       |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| Copyright (c) 1993-2014 Spread Concepts LLC                               |\n"); 
	Alarmp( SPLOG_PRINT, SYSTEM, "| All rights reserved.                                                      |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| The Spread package is licensed under the Spread Open-Source License.      |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| You may only use this software in compliance with the License.            |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| A copy of the license can be found at http://www.spread.org/license       |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "| This product uses software developed by Spread Concepts LLC for use       |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "| in the Spread toolkit. For more information about Spread,                 |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "| see http://www.spread.org                                                 |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF     |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| ANY KIND, either express or implied.                                      |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| Creators:                                                                 |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "|    Yair Amir             [email protected]                              |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "|    Michal Miskin-Amir    [email protected]                        |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "|    Jonathan Stanton      [email protected]                      |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "|    John Schultz          [email protected]                      |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| Contributors:                                                             |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "|    Amy Babay            [email protected] - accelerated ring protocol.     |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "|    Ryan Caudy           [email protected] - contribution to process groups.|\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "|    Claudiu Danilov      [email protected] - scalable, wide-area support.    |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "|    Cristina Nita-Rotaru [email protected] - GC security.                |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "|    Theo Schlossnagle    [email protected] - Perl, autoconf, old skiplist   |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "|    Dan Schoenblum   [email protected] - Java Interface Developer.       |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| Special thanks to the following for discussions and ideas:                |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "|    Ken Birman, Danny Dolev, Jacob Green, Mike Goodrich, Ben Laurie,       |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "|    David Shaw, Gene Tsudik, Robbert VanRenesse.                           |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "| Partial funding provided by the Defense Advanced Research Project Agency  |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "| (DARPA) and the National Security Agency (NSA) 2000-2004. The Spread      |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "| toolkit is not necessarily endorsed by DARPA or the NSA.                  |\n");
        Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| For a full list of contributors, see Readme.txt in the distribution.      |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| WWW:     www.spread.org     www.spreadconcepts.com                        |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| Contact: [email protected]                                          |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "|                                                                           |\n");
	Alarmp( SPLOG_PRINT, SYSTEM, "| Version %d.%02d.%02d Built %-17s                                   |\n", 
		(int)SP_MAJOR_VERSION, (int)SP_MINOR_VERSION, (int)SP_PATCH_VERSION, Spread_build_date );
	Alarmp( SPLOG_PRINT, SYSTEM, "\\===========================================================================/\n");

#ifdef ARCH_PC_WIN95
        ret = WSAStartup( MAKEWORD(2,0), &WSAData );
        if( ret != 0 )
            Alarm( EXIT, "sptmonitor: main: winsock initialization error %d\n", ret );
#endif	/* ARCH_PC_WIN95 */

	Usage( argc, argv );
        
        Alarm_set_interactive();
        read_configuration();

        initialize_locks();

	for( i=0; i < Conf_num_procs( &Cn ); i++ )
		Partition[i] = 0;

	for( i=0; i < Conf_num_procs( &Cn ); i++ )
		Status_vector[i] = 0;

	Pack_scat.elements[0].len = sizeof( packet_header );
	Pack_scat.elements[0].buf = (char *)&Pack;

	Pack.proc_id = My.id;
	Pack.seq = My_port;
	Pack.memb_id.proc_id = 15051963;

	Report_scat.num_elements = 2;
	Report_scat.elements[0].buf = (char *)&Report_pack;
	Report_scat.elements[0].len = sizeof(packet_header);
	Report_scat.elements[1].buf = (char *)&GlobalStatus;
	Report_scat.elements[1].len = sizeof(status);

        SendChan = DL_init_channel( SEND_CHANNEL , My_port, 0, 0 );

        Report_socket = DL_init_channel( RECV_CHANNEL, My_port, 0, 0 );

	E_init(); /* both reentrent and non-reentrant code uses events */

#ifndef	_REENTRANT
	E_attach_fd( 0, READ_FD, User_command, 0, NULL, LOW_PRIORITY );

        E_attach_fd( Report_socket, READ_FD, Report_message, 0, NULL, HIGH_PRIORITY );
#endif	/* _REENTRANT */

        
	Print_menu();

#ifdef	_REENTRANT

#ifndef	        ARCH_PC_WIN95
	ret = pthread_create( &Read_thread, NULL, Read_thread_routine, 0 );
	ret = pthread_create( &Status_thread, NULL, Status_send_thread_routine, 0 );
	ret = pthread_create( &Partition_thread, NULL, Partition_send_thread_routine, 0 );
#else		/* ARCH_PC_WIN95 */
	Read_thread = CreateThread( NULL, 0, Read_thread_routine, NULL, 0, &ret );
	Status_thread = CreateThread( NULL, 0, Status_send_thread_routine, NULL, 0, &ret );
	Partition_thread = CreateThread( NULL, 0, Partition_send_thread_routine, NULL, 0, &ret );
#endif		/* ARCH_PC_WIN95 */

	for(;;)
	{
		User_command();
	}

#else	/*! _REENTRANT */

	E_handle_events();

#endif	/* _REENTRANT */

	return 0;
}