/*
 * *******************************************
 *   Function:
 *         Main 
 *   Description:
 *       Main program , starts a shell 
 *       and accepts user commands.  
 *   Parameters:
 *       argv - current node name and itc 
 *       script file     
 *
 *
 * *******************************************
 *
 */
int main( int argc , char *argv[])
{
    
    const char * prompt="nfd>";
    char user_inp[BUF_MAX];  
    int current_node_id  ;  
    if ( argc <=  2 )
    { 
           printf("\n Usage : %s <nodeid>  itc_script_file " , argv[0]);
           exit(EXIT_FAILURE);    

    }
    
    memset(user_inp,0 , BUF_MAX);    
    current_node_id  = atoi(argv[1]);
    __current_node = current_node_id;
    init_transport_layer();  
    while (TRUE )
    {
        printf("%s" , prompt); 
        fgets(user_inp , BUF_MAX-2 ,stdin);
        handle_input(user_inp , argv[2] , current_node_id);   
        memset(user_inp,0 , BUF_MAX);    
          
    }   
}
/*
 * *******************************************
 *   Function:
 *            handle_start_server
 *    Description:
 *            handle the start_server 
 *            command 
 *
 *    Parameters:
 *            itc_file - Name of config file 
 *            node_id - current node id 
 *            inp_pointer - pointer to input
 *            string 
 *            thread - id of thread to be 
 *            created 
 *
 * *******************************************
 *
 */
void handle_start_server(char *itc_file  , int node_id , char *inp_pointer, pthread_t *thread)
{

  read_config_file(itc_file);   
  pthread_create(thread,NULL ,server_thread, &node_id);
  init_transport_layer(); 

  
   

}
예제 #3
0
파일: main.c 프로젝트: benpicco/RIOT-old
void init_tl (char *str)
	{
	init_transport_layer();
	}