+static void add_route(void)
+{
+ xbt_ex_t e;
+ int nb_link = 0;
+ unsigned int cpt = 0;
+ int link_list_capacity = 0;
+ link_CM02_t *link_list = NULL;
+ char* link;
+
+ if (routing_table == NULL) create_routing_table();
+
+ link_list_capacity = xbt_dynar_length(links);
+ link_list = xbt_new(link_CM02_t, link_list_capacity);
+
+ src_id = atoi(xbt_dynar_get_as(keys, 0, char*));
+ dst_id = atoi(xbt_dynar_get_as(keys, 1, char*));
+
+ link = NULL;
+ xbt_dynar_foreach (links, cpt, link) {
+ TRY {
+ link_list[nb_link++] = xbt_dict_get(link_set, link);
+ }
+ CATCH(e) {
+ RETHROW1("Link %s not found (dict raised this exception: %s)", link);
+ }
+ }
+ route_new(src_id, dst_id, link_list, nb_link);
+
+}
+
+static void count_hosts(void)
+{
+ host_number++;
+}
+
+static void define_callbacks(const char *file)
+{
+ /* Figuring out the network links */
+ surfxml_add_callback(STag_surfxml_host_cb_list, count_hosts);
+ surfxml_add_callback(STag_surfxml_link_cb_list, parse_link_init);
+ surfxml_add_callback(STag_surfxml_prop_cb_list, parse_properties);
+ surfxml_add_callback(STag_surfxml_route_cb_list, parse_route_set_endpoints);
+ surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, parse_route_elem);
+ surfxml_add_callback(ETag_surfxml_route_cb_list, parse_route_set_route);
+ surfxml_add_callback(STag_surfxml_platform_cb_list, init_route_table);
+ surfxml_add_callback(ETag_surfxml_platform_cb_list, add_route);
+ surfxml_add_callback(ETag_surfxml_platform_cb_list, add_loopback);
+}
+