int main(int argc, char **argv) { /* Se prezinta etapele cronologice ale simularii unei retele de rutere prin implementarea unui program care va fi capabil sa ruleze un algoritm de rutare SPF (shortest path first) minimalist si sa se adapteze la schimbarile din retea in cadrul aceluiasi algoritm si sa ruteze o serie de mesaje date ca input. Se pot adauga sau sterge legaturi in retea */ int noRouters; ifstream infile(argv[1]); infile >> noRouters; init_api(argc, argv); init_sim(argc, argv); loop { trigger_events(); process_messages(noRouters); update_routing_table(noRouters); api_update_state(); if (api_simulation_ended()) break; } clean_sim(); clean_api(); return 0; }
int main(int argc, char **argv) { Network network; // pastreaza informatii despre intreaga retea init_api(argc, argv); init_sim(&network, argv); loop { trigger_events(&network); process_messages(&network); update_routing_table(&network); api_update_state(); if (api_simulation_ended()) break; } clean_sim(&network); clean_api(); return 0; }