Пример #1
0
void dispose(Macierz* m, MemoryManager* man){
    int i;
    for(i=0;i<m->height;i++){
        deallocation(m->tab[i],man);
    }
    deallocation(m,man);
}
Пример #2
0
int main(int argc, const char * argv[]) {
    Node *node1 = initListItem(1);
    Node *node2 = initListItem(2);
    Node *node3 = initListItem(3);
    Node *node4 = initListItem(4);
    Node *node5 = initListItem(5);
    Node *newNode = initListItem(6);
    insertToTheEnd(node1, node2);
    insertToTheEnd(node1, node3);
    insertToTheEnd(node1, node4);
    insertToTheEnd(node1, node5);

    printf("All values in the list: ");
    listAll(node1);
    
    int valueUserInput;
    printf("Input the value to find:");
    scanf("%d", &valueUserInput);
    
    Node *searchResult = searchValue(node1, valueUserInput);
    if (searchResult == NULL) {
        printf("%d is not found in this list!\n", valueUserInput);
    } else {
        printf("Search result %d found at %p\n", searchResult->value, searchResult);
        printf("%p\n", node2);
    }
    
    insertToTheEnd(node1, newNode);
    listAll(node1);
    
    removeListItem(node1, node2);
    listAll(node1);
    
    deallocation(node1);
    
    return 0;
}
/**
 * \fn main (void)
 * \brief Configuration creation and deletion. 
 * \return EXIT_SUCCESS status code: ok. 
 * \return EXIT_FAILURE status code: error.
 */
int main (void){ // char *arge[] permet d'utiliser les redirections avec la fonction popen
  /* BOUCLES */
  int i=0;
  
  /* CONFIGURATION */
  int nbConfigurations                = 0;
  ConfigurationName *tabConfigurations = NULL;
  int configurationChoisie            = 0;
  int nb_circles                      = 0;
  char racinePython[ROOT_SIZE]        = "";
  MACaddress *tabMAC                  = NULL;
  char **counters_names               = NULL; // Le nom de chaque compteurs est stocké dans un tableau de chaine de caractères 
  
  /* MENU */
  int choixMenu                       = 0;
  
  printf("Management of the plugwise configurations :\n");
  printf("\n");
  
  // MENU CONFIGURATIONS
  printf("What do you want to do?\n");
  printf("1: Create a new configuration\n");
  printf("2: Delete a configuration\n");
  
  printf("Your choice: ");
  scanf("%d",&choixMenu);
  printf("\n");
  
  if ((choixMenu != 1) && (choixMenu !=2))
    {
      perror("Error : your choice is not possible !\n");
      return EXIT_FAILURE;
    } 
  
  // Because the source code was make for another program
  choixMenu++;
  
  /// CHOIX 1 : CREATION D'UNE NOUVELLE CONFIGURATION :
  if(choixMenu==2)
    {
      allocation_configurations_names(1, &tabConfigurations);
      write_static_data(choixMenu, 1, tabConfigurations, racinePython, &nb_circles);      
      
      mac_adress_dynamic_allocation(nb_circles,&tabMAC);
      counters_names_dynamic_allocation(nb_circles,&counters_names); 
      write_dynamic_data(choixMenu, nb_circles, tabMAC, counters_names);
      
      free(tabConfigurations);
      deallocation(nb_circles, &tabMAC, &counters_names);
    }
  
  /// CHOIX 2 : SUPPRIMER UNE CONFIGURATION :
  else
    { 
      /// 1. On récupère le nombre et les noms des configurations
      nbConfigurations = nb_configurations();
      allocation_configurations_names(nbConfigurations, &tabConfigurations);
      save_configurations_names(nbConfigurations, tabConfigurations);
      
      /// 2. On demande à l'utilisateur de choisir la configuration à supprimer
      configurationChoisie = configuration_choice(choixMenu, nbConfigurations, tabConfigurations);
      
      /// 3. On récupère les données de la configuration
      system("touch configurations.tmp");
      i=1;
      while(i <= nbConfigurations){
	if(i != configurationChoisie){
	  
	  // Récupération des données
	  static_data_recovery(choixMenu, i, tabConfigurations, racinePython,&nb_circles);
	  mac_adress_dynamic_allocation(nb_circles,&tabMAC);
	  counters_names_dynamic_allocation(nb_circles,&counters_names); 
	  dynamic_data_recovery(i, nb_circles, tabMAC, counters_names);
	  
	  // Permutation fichiers
	  system("mv configurations.txt configurations.txt.tmp");
	  system("mv configurations.tmp configurations.txt");
	  
	  // Ecriture des données
	  write_static_data(choixMenu, i, tabConfigurations, racinePython, &nb_circles);      
	  write_dynamic_data(choixMenu, nb_circles, tabMAC, counters_names);
	  
	  system("mv configurations.txt configurations.tmp");
	  system("mv configurations.txt.tmp configurations.txt");
	}
	i++;
      }
      
      /// 4. On libère la mémoire et renomme le fichier temporaire en configurations.txt
      free(tabConfigurations);
      deallocation(nb_circles, &tabMAC, &counters_names);
      system("rm configurations.txt");
      system("mv configurations.tmp configurations.txt");
    } 

  return EXIT_SUCCESS;
}
Пример #4
0
void ProcessEvent(unsigned int me, simtime_t now, int event_type, event_content_type *event_content, unsigned int size, void *ptr) {

    char *parameter, *value;
    channel *c;
    int w;

    event_content_type new_event_content;

    new_event_content.cell = -1;
    new_event_content.channel = -1;
    new_event_content.call_term_time = -1;

    simtime_t handoff_time;
    simtime_t timestamp = 0;

    lp_state_type *state;
    state = (lp_state_type*)ptr;

    if(state != NULL) {
        state->lvt = now;
        state->executed_events++;
    }


    switch(event_type) {

    case INIT:

        // Initialize the LP's state
        state = (lp_state_type *)malloc(sizeof(lp_state_type));
        if (state == NULL) {
            printf("Out of memory!\n");
            exit(EXIT_FAILURE);
        }

        SetState(state);

        bzero(state, sizeof(lp_state_type));
        state->channel_counter = CHANNELS_PER_CELL;

        // Read runtime parameters
        if(IsParameterPresent(event_content, "pcs_statistics"))
            pcs_statistics = true;

        if(IsParameterPresent(event_content, "ta"))
            state->ref_ta = state->ta = GetParameterDouble(event_content, "ta");
        else
            state->ref_ta = state->ta = TA;

        if(IsParameterPresent(event_content, "ta_duration"))
            state->ta_duration = GetParameterDouble(event_content, "ta_duration");
        else
            state->ta_duration = TA_DURATION;

        if(IsParameterPresent(event_content, "ta_change"))
            state->ta_change = GetParameterDouble(event_content, "ta_change");
        else
            state->ta_change = TA_CHANGE;

        if(IsParameterPresent(event_content, "channels_per_cell"))
            state->channels_per_cell = GetParameterInt(event_content, "channels_per_cell");
        else
            state->channels_per_cell = CHANNELS_PER_CELL;

        if(IsParameterPresent(event_content, "complete_calls"))
            complete_calls = GetParameterInt(event_content, "complete_calls");

        state->fading_recheck = IsParameterPresent(event_content, "fading_recheck");
        state->variable_ta = IsParameterPresent(event_content, "variable_ta");


        // Show current configuration, only once
        if(me == 0) {
            printf("CURRENT CONFIGURATION:\ncomplete calls: %d\nTA: %f\nta_duration: %f\nta_change: %f\nchannels_per_cell: %d\nfading_recheck: %d\nvariable_ta: %d\n",
                   complete_calls, state->ta, state->ta_duration, state->ta_change, state->channels_per_cell, state->fading_recheck, state->variable_ta);
            fflush(stdout);
        }

        state->channel_counter = state->channels_per_cell;

        // Setup channel state
        state->channel_state = malloc(sizeof(unsigned int) * 2 * (CHANNELS_PER_CELL / BITS + 1));
        for (w = 0; w < state->channel_counter / (sizeof(int) * 8) + 1; w++)
            state->channel_state[w] = 0;

        // Start the simulation
        timestamp = (simtime_t) (20 * Random());
        ScheduleNewEvent(me, timestamp, START_CALL, NULL, 0);

        // If needed, start the first fading recheck
//			if (state->fading_recheck) {
        timestamp = (simtime_t) (FADING_RECHECK_FREQUENCY * Random());
        ScheduleNewEvent(me, timestamp, FADING_RECHECK, NULL, 0);
//			}

        break;


    case START_CALL:

        state->arriving_calls++;

        if (state->channel_counter == 0) {
            state->blocked_on_setup++;
        } else {

            state->channel_counter--;

            new_event_content.channel = allocation(state);
            new_event_content.from = me;
            new_event_content.sent_at = now;

            // Determine call duration
            switch (DURATION_DISTRIBUTION) {

            case UNIFORM:
                new_event_content.call_term_time = now + (simtime_t)(state->ta_duration * Random());
                break;

            case EXPONENTIAL:
                new_event_content.call_term_time = now + (simtime_t)(Expent(state->ta_duration));
                break;

            default:
                new_event_content.call_term_time = now + (simtime_t) (5 * Random() );
            }

            // Determine whether the call will be handed-off or not
            switch (CELL_CHANGE_DISTRIBUTION) {

            case UNIFORM:

                handoff_time  = now + (simtime_t)((state->ta_change) * Random());
                break;

            case EXPONENTIAL:
                handoff_time = now + (simtime_t)(Expent(state->ta_change));
                break;

            default:
                handoff_time = now + (simtime_t)(5 * Random());

            }

            if(new_event_content.call_term_time <=  handoff_time) {
                ScheduleNewEvent(me, new_event_content.call_term_time, END_CALL, &new_event_content, sizeof(new_event_content));
            } else {
                new_event_content.cell = FindReceiver(TOPOLOGY_HEXAGON);
                ScheduleNewEvent(me, handoff_time, HANDOFF_LEAVE, &new_event_content, sizeof(new_event_content));
            }
        }


        if (state->variable_ta)
            state->ta = recompute_ta(state->ref_ta, now);

        // Determine the time at which a new call will be issued
        switch (DISTRIBUTION) {

        case UNIFORM:
            timestamp= now + (simtime_t)(state->ta * Random());
            break;

        case EXPONENTIAL:
            timestamp= now + (simtime_t)(Expent(state->ta));
            break;

        default:
            timestamp= now + (simtime_t) (5 * Random());

        }

        ScheduleNewEvent(me, timestamp, START_CALL, NULL, 0);

        break;

    case END_CALL:

        state->channel_counter++;
        state->complete_calls++;
        deallocation(me, state, event_content->channel, event_content, now);

        break;

    case HANDOFF_LEAVE:

        state->channel_counter++;
        state->leaving_handoffs++;
        deallocation(me, state, event_content->channel, event_content, now);

        new_event_content.call_term_time =  event_content->call_term_time;
        ScheduleNewEvent(event_content->cell, now, HANDOFF_RECV, &new_event_content, sizeof(new_event_content));
        break;

    case HANDOFF_RECV:
        state->arriving_handoffs++;
        state->arriving_calls++;

        if (state->channel_counter == 0)
            state->blocked_on_handoff++;
        else {
            state->channel_counter--;

            new_event_content.channel = allocation(state);
            new_event_content.call_term_time = event_content->call_term_time;

            switch (CELL_CHANGE_DISTRIBUTION) {
            case UNIFORM:
                handoff_time  = now + (simtime_t)((state->ta_change) * Random());

                break;
            case EXPONENTIAL:
                handoff_time = now + (simtime_t)(Expent( state->ta_change ));

                break;
            default:
                handoff_time = now+
                               (simtime_t) (5 * Random());
            }

            if(new_event_content.call_term_time < handoff_time ) {
                ScheduleNewEvent(me, new_event_content.call_term_time, END_CALL, &new_event_content, sizeof(new_event_content));
            } else {
                new_event_content.cell = FindReceiver(TOPOLOGY_HEXAGON);
                ScheduleNewEvent(me, handoff_time, HANDOFF_LEAVE, &new_event_content, sizeof(new_event_content));
            }
        }


        break;


    case FADING_RECHECK:

        /*
        			if(state->check_fading)
        				state->check_fading = false;
        			else
        				state->check_fading = true;
        */

        fading_recheck(state);

        timestamp = now + (simtime_t) (FADING_RECHECK_FREQUENCY );
        ScheduleNewEvent(me, timestamp, FADING_RECHECK, NULL, 0);

        break;


    default:
        fprintf(stdout, "PCS: Unknown event type! (me = %d - event type = %d)\n", me, event_type);
        abort();

    }
}
Пример #5
0
void ProcessEvent(unsigned int me, simtime_t now, int event_type, event_content_type *event_content, unsigned int size, void * ptr) {
	int w;

	event_content_type new_event_content;

	new_event_content.cell = -1;
	new_event_content.second_cell = -1;
	new_event_content.channel = -1;
	new_event_content.call_term_time = -1;
	
	simtime_t handoff_time;
	simtime_t timestamp=0;
	
	lp_state_type * pointer;
	pointer = (lp_state_type*)ptr;

	switch(event_type) {
		
		case INIT:
		
			pointer = (lp_state_type *)malloc(sizeof(lp_state_type));
			if (pointer == NULL){
				printf("ERROR in malloc!\n");
				exit(EXIT_FAILURE);
			}

		
			SetState(pointer);
			
//			pointer->channels = NULL;
			pointer->contatore_canali = CHANNELS_PER_CELL;
			pointer->cont_chiamate_entranti = -1;
			pointer->cont_chiamate_complete = 0;
			pointer->cont_handoff_uscita = 0;
			pointer->cont_bloccate_in_partenza = 0;
			pointer->cont_bloccate_in_handoff  = 0;
			pointer->handoffs_entranti = 0;
//			power_management = true;
//			variable_ta = true;
//			fading_recheck = true;

			// INIT is not considered as an event
			pointer->contatore_eventi = 0;
//			pointer->time = now;


			// Load the predefined values
//			variable_ta = true;
			complete_calls = COMPLETE_CALLS;
			ta = TA;
			ta_durata = TA_DURATA;
			ta_cambio = TA_CAMBIO;
			channels_per_cell = CHANNELS_PER_CELL;
			power_management = true;

			// Read runtime parameters
			char **arguments = (char **)event_content;
			for(w = 0; w < size; w += 2) {

				if(strcmp(arguments[w],"complete-calls") == 0) {
					complete_calls = parseInt(arguments[w + 1]);
				} else if(strcmp(arguments[w],"ta") == 0) {
					ta = parseDouble(arguments[w + 1]);
				} else if(strcmp(arguments[w],"ta-durata") == 0) {
					ta_durata = parseDouble(arguments[w + 1]);
				} else if(strcmp(arguments[w],"ta-cambio") == 0) {
					ta_cambio = parseDouble(arguments[w + 1]);
				} else if(strcmp(arguments[w],"channels-per-cell") == 0) {
					channels_per_cell = parseInt(arguments[w + 1]);
				} else if(strcmp(arguments[w],"complete-time") == 0) {
					complete_time = parseInt(arguments[w + 1]);
				} else if(strcmp(arguments[w],"no-power-management") == 0) {
					w -= 1;
					power_management = false;
				} else if(strcmp(arguments[w],"power-management") == 0) {
					w -= 1;
					power_management = true;
				} else if(strcmp(arguments[w],"variable-ta") == 0) {
					w -= 1;
					variable_ta = true;
				} else if(strcmp(arguments[w],"fading-recheck") == 0) {
					fading_recheck = true;
				} else if(strcmp(arguments[w],"complete-time") == 0) {
					complete_time = parseInt(arguments[w + 1]);
				}
			}
			ref_ta = ta;

			// Show current configuration, only once
			if(me == 0) {
				printf("CURRENT CONFIGURATION:\nCOMPLETE CALLS: %d\nTA: %f\nTA_DURATA: %f\nTA_CAMBIO: %f\nCHANNELS_PER_CELL: %d\nCOMPLETE_TIME: %d\n",
					complete_calls, ta, ta_durata, ta_cambio, channels_per_cell, complete_time);
				printf("POWER MANAGMENT: %d\nFADING RECHECK: %d\nVARIABLE TA: %d\n",
					power_management, fading_recheck, variable_ta);
				fflush(stdout);
			}

			pointer->contatore_canali = channels_per_cell;

			for (w = 0; w < pointer->contatore_canali / (sizeof(int) * 8) + 1; w++)
				pointer->channel_state[w] = 0;
			
			pointer->buff_topology = (_PCS_routing*)malloc(sizeof(_PCS_routing));
			if(pointer->buff_topology == NULL){
				printf("Chiamata a malloc errata sulla topologia della rete!\n");
				exit(EXIT_FAILURE);
			}
	
			set_my_topology(me, pointer->buff_topology);

			timestamp = (simtime_t) (20 * Random());	
			ScheduleNewEvent(me, timestamp, START_CALL, NULL, 0);
			
			if (fading_recheck) {
				timestamp = now + (simtime_t) (FADING_RECHECK_FREQUENCY); 
				ScheduleNewEvent(me, timestamp, FADING_RECHECK, NULL, 0);
			}

			break;

	
		case START_CALL:
			pointer->time = now;
			

			//make_copy(pointer->cont_chiamate_entranti, pointer->cont_chiamate_entranti+1);
			pointer->cont_chiamate_entranti++;
			//make_copy(pointer->contatore_eventi, pointer->contatore_eventi+1);
			pointer->contatore_eventi++;
			
			if (pointer->contatore_canali == 0) {
				//make_copy(pointer->cont_bloccate_in_partenza, pointer->cont_bloccate_in_partenza+1);
				pointer->cont_bloccate_in_partenza++;
			} else {
						
				pointer->contatore_canali--;
				//make_copy(pointer->contatore_canali, pointer->contatore_canali-1);
				
				#ifdef ACCURATE_SIMULATION
				new_event_content.channel = allocation(me, pointer);
				#endif
				
				// Determine call duration
				switch (DISTRIBUZIONE_DURATA) {
	
					case UNIFORME:
						new_event_content.call_term_time = now+
			       			(simtime_t) (ta_durata * Random());

						break;

					case ESPONENZIALE:
						new_event_content.call_term_time = now +
 						(simtime_t)( Expent(ta_durata ));

						break;

					default:
								
 						new_event_content.call_term_time = now+
						(simtime_t) (5 * Random() );	
						}
			
				// Determine whether the call will be handed-off or not
				switch (DISTRIBUZIONE_CAMBIOCELLA) {

					case UNIFORME:
						
						handoff_time  = now+ 
			       			(simtime_t) ((ta_cambio) * Random() );
						break;

					case ESPONENZIALE:
						handoff_time = now+ 
			       			(simtime_t)( Expent( ta_cambio ));
						break;

					default:
						handoff_time = now+ 
			       			(simtime_t) (5 * Random() );
					
				}
			
				if( new_event_content.call_term_time <=  handoff_time) {
				    ScheduleNewEvent(me,new_event_content.call_term_time,END_CALL,&new_event_content,sizeof(new_event_content));

				} else {
					new_event_content.cell = __FindReceiver(me,pointer);
							
					new_event_content.second_cell = -1;
			
					ScheduleNewEvent(me,handoff_time,HANDOFF_LEAVE,&new_event_content,sizeof(new_event_content));

//					#ifdef PRE_SCHEDULING
					new_event_content.call_term_time = new_event_content.call_term_time;
					ScheduleNewEvent(new_event_content.cell,handoff_time,HANDOFF_RECV,&new_event_content,sizeof(new_event_content));
//					#endif
				}
			} // if (pointer->contatore_canali == 0) 


			if (variable_ta)
				ta = recompute_ta(ref_ta, now);

			// Determine the time at which the call will end						
			switch (DISTRIBUZIONE) {   

				case UNIFORME:
					timestamp= now+ 
			   		(simtime_t) (ta * Random() );
					break;
	
				case ESPONENZIALE:
					timestamp= now+ 
			   		(simtime_t)( Expent( ta ));
					break;

				default:
					timestamp= now+	
			   		(simtime_t) (5 * Random());		
						
			}

			ScheduleNewEvent(me, timestamp, START_CALL, NULL, 0);

			break;

		case END_CALL:
		
			pointer->time = now;
//			make_copy(pointer->contatore_eventi, pointer->contatore_eventi+1);
			pointer->contatore_eventi++;
			//make_copy(pointer->contatore_canali, pointer->contatore_canali+1);
			pointer->contatore_canali++;
			//make_copy(pointer->cont_chiamate_complete, pointer->cont_chiamate_complete+1);
			pointer->cont_chiamate_complete++;
			#ifdef ACCURATE_SIMULATION
			deallocation(me, pointer, event_content->channel);
			#endif
			
			break;

		case HANDOFF_LEAVE:

			pointer->time = now;
			//make_copy(pointer->contatore_eventi, pointer->contatore_eventi+1);
			pointer->contatore_eventi++;
			//make_copy(pointer->contatore_canali, pointer->contatore_canali+1);
			pointer->contatore_canali++;
			//make_copy(pointer->cont_handoff_uscita, pointer->cont_handoff_uscita+1);
			pointer->cont_handoff_uscita++;
			#ifdef ACCURATE_SIMULATION
			deallocation(me, pointer, event_content->channel);
			#endif
			
//			#ifndef PRE_SCHEDULING
//			new_event_content.call_term_time =  event_content->call_term_time + 0.00005;
//			ScheduleNewEvent(event_content->cell, now + 0.00003 , HANDOFF_RECV, &new_event_content, sizeof(new_event_content));
//			#endif
			break;

        	case HANDOFF_RECV:
			pointer->time = now;
			//handoff_counter++;
			//make_copy(pointer->handoffs_entranti, pointer->handoffs_entranti+1);
			pointer->handoffs_entranti++;
			//make_copy(pointer->cont_chiamate_entranti, pointer->cont_chiamate_entranti+1);
			//make_copy(pointer->contatore_eventi, pointer->contatore_eventi+1);
			pointer->contatore_eventi++;
			pointer->cont_chiamate_entranti++;
			
			if (pointer->contatore_canali == 0) 
				//make_copy(pointer->cont_bloccate_in_handoff, pointer->cont_bloccate_in_handoff+1);
				pointer->cont_bloccate_in_handoff++;
			else {
				//make_copy(pointer->contatore_canali, pointer->contatore_canali-1);
				pointer->contatore_canali--;
				
				#ifdef ACCURATE_SIMULATION
				new_event_content.channel = allocation(me, pointer);
				#endif
				
				new_event_content.call_term_time = event_content->call_term_time; 
				
				switch (DISTRIBUZIONE_CAMBIOCELLA) {
					case UNIFORME:
						handoff_time  = now+ 
			    			(simtime_t) ((ta_cambio) * Random());
			
						break;
					case ESPONENZIALE:
						handoff_time = now+ 
			    			(simtime_t)( Expent( ta_cambio ));
			
						break;
					default:
						handoff_time = now+ 
			    			(simtime_t) (5 * Random());
				}
				
				
				if (Random() < 0.5) handoff_time *= 10;
				
				if( new_event_content.call_term_time <=  handoff_time ) {
					ScheduleNewEvent(me , new_event_content.call_term_time, END_CALL, &new_event_content, sizeof(new_event_content));


				} else {
					new_event_content.cell = __FindReceiver(me,ptr);
					
					#ifdef  NO_UNCERTAINTY
						new_event_content.second_cell = -1;
					#endif
					ScheduleNewEvent(me , new_event_content.call_term_time, HANDOFF_LEAVE, &new_event_content, sizeof(new_event_content));

				}
			}
			

			break;


		case FADING_RECHECK:

//			pointer->time = now;
			if (pointer->check_fading == true) {
				//make_copy(pointer->check_fading, false);
				pointer->check_fading = false;
			} else {
				//make_copy(pointer->check_fading, true);
				pointer->check_fading = true;
			}

			timestamp = now + (simtime_t) (FADING_RECHECK_FREQUENCY);
			ScheduleNewEvent(me, timestamp, FADING_RECHECK, NULL, 0);
				
			break;

      		default: 
			fprintf(stderr, " pointer simulation: error - inconsistent event (me = %d - event type = %d)\n", me, event_type);
			break;
	} // switch(event->type) 
}
Пример #6
0
/**
 * \fn main (void)
 * \brief Configuration creation and deletion. 
 * \return EXIT_SUCCESS status code: ok. 
 * \return EXIT_FAILURE status code: error.
 */
int main (void){ 
  /* BOUCLES */
  int i=0;
  
  /* CONFIGURATION */
  int nbConfigurations                = 0;
  ConfigurationName *tabConfigurations = NULL;
  int chosenConfiguration             = 0;
  int nb_circles                      = 0;
  char pythonRoot[ROOT_SIZE]        = "";
  MACaddress *tabMAC                  = NULL;
  char **counters_names               = NULL; // the name of each counters is saved in a table of strings
  
  /* MENU */
  int menuChoice                       = 0;
  
  printf("Management of the plugwise configurations :\n");
  printf("\n");
  
  // MENU CONFIGURATIONS
  printf("What do you want to do?\n");
  printf("1: Create a new configuration\n");
  printf("2: Delete a configuration\n");
  
  printf("Your choice: ");
  scanf("%d",&menuChoice);
  printf("\n");
  
  if ((menuChoice != 1) && (menuChoice !=2))
    {
      perror("Error : your choice is not possible !\n");
      return EXIT_FAILURE;
    } 
  
  // Because the source code was made for another program (TO CHANGE)
  menuChoice++;
  
  /// <h2>CHOICE 1 : CREATION OF A NEW CONFIGURATION :</h2>
  if(menuChoice==2)
    {
      allocation_configurations_names(1, &tabConfigurations);
      write_static_data(menuChoice, 1, tabConfigurations, pythonRoot, &nb_circles);      
      
      mac_adress_dynamic_allocation(nb_circles,&tabMAC);
      counters_names_dynamic_allocation(nb_circles,&counters_names); 
      write_dynamic_data(menuChoice, nb_circles, tabMAC, counters_names);
      
      free(tabConfigurations);
      deallocation(nb_circles, &tabMAC, &counters_names);
    }
  
  /// <h2>CHOICE 2 : DELETE A CONFIGURATION:</h2>
  else
    { 
      /// <h3>1. We save the number and the name of the configurations</h3>
      nbConfigurations = nb_configurations();
      allocation_configurations_names(nbConfigurations, &tabConfigurations);
      save_configurations_names(nbConfigurations, tabConfigurations);
      
      /// <h3>2. We ask the user to chose the configuration to delete</h3>
      chosenConfiguration = configuration_choice(menuChoice, nbConfigurations, tabConfigurations);
      
      /// <h3>3. We save the configuration data</h3>
      system("touch configurations.tmp");
      i=1;
      while(i <= nbConfigurations){
	if(i != chosenConfiguration){
	  
	  // Data recovery
	  static_data_recovery(menuChoice, i, tabConfigurations, pythonRoot,&nb_circles);
	  mac_adress_dynamic_allocation(nb_circles,&tabMAC);
	  counters_names_dynamic_allocation(nb_circles,&counters_names); 
	  dynamic_data_recovery(i, nb_circles, tabMAC, counters_names);
	  
	  // Files permutation
	  system("mv configurations.txt configurations.txt.tmp");
	  system("mv configurations.tmp configurations.txt");
	  
	  // Data writing
	  write_static_data(menuChoice, i, tabConfigurations, pythonRoot, &nb_circles);      
	  write_dynamic_data(menuChoice, nb_circles, tabMAC, counters_names);
	  
	  system("mv configurations.txt configurations.tmp");
	  system("mv configurations.txt.tmp configurations.txt");
	}
	i++;
      }
      
      /// <h3>4. We release the memory and rename the temporary file in configurations.txt</h3>
      free(tabConfigurations);
      deallocation(nb_circles, &tabMAC, &counters_names);
      system("rm configurations.txt");
      system("mv configurations.tmp configurations.txt");
    } 
  
  return EXIT_SUCCESS;
}