- src_id = network_card_new(A_surfxml_route_src);
- dst_id = network_card_new(A_surfxml_route_dst);
- route_action = A_surfxml_route_action;
- route_link_list = xbt_dynar_new(sizeof(char *), &free_string);
-}
-
-static void parse_route_set_route(void)
-{
- char *name;
- if (src_id != -1 && dst_id != -1) {
- name = bprintf("%x#%x",src_id, dst_id);
- manage_route(route_table, name, route_action, 0);
- free(name);
- }
-}
-
-static void count_hosts(void)
-{
- host_number++;
-}
-
-
-static void add_traces(void) {
- xbt_dict_cursor_t cursor=NULL;
- char *trace_name,*elm;
-
- static int called = 0;
- if (called) return;
- called = 1;
-
- /* connect all traces relative to network */
- xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
- tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- link_Constant_t link = xbt_dict_get_or_null(link_set, elm);
-
- xbt_assert1(link, "Link %s undefined", elm);
- xbt_assert1(trace, "Trace %s undefined", trace_name);
-
- link->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
- }
-
- xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
- tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- link_Constant_t link = xbt_dict_get_or_null(link_set, elm);
-
- xbt_assert1(link, "Link %s undefined", elm);
- xbt_assert1(trace, "Trace %s undefined", trace_name);
-
- link->bw_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
- }
-
- xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
- tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- link_Constant_t link = xbt_dict_get_or_null(link_set, elm);
-
- xbt_assert1(link, "Link %s undefined", elm);
- xbt_assert1(trace, "Trace %s undefined", trace_name);
-
- link->lat_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
- }
-
- xbt_dict_free(&trace_connect_list_host_avail);
- xbt_dict_free(&trace_connect_list_power);
- xbt_dict_free(&trace_connect_list_link_avail);
- xbt_dict_free(&trace_connect_list_bandwidth);
- xbt_dict_free(&trace_connect_list_latency);
-
- xbt_dict_free(&traces_set_list);
-}
-
-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_data);
- surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces);
- surfxml_add_callback(STag_surfxml_set_cb_list, &parse_sets);
- surfxml_add_callback(STag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_endpoints);
- surfxml_add_callback(ETag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_route);
- surfxml_add_callback(STag_surfxml_foreach_cb_list, &parse_foreach);
- surfxml_add_callback(STag_surfxml_cluster_cb_list, &parse_cluster);
- surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_trace_init);
- surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_trace_finalize);
- surfxml_add_callback(STag_surfxml_trace_c_connect_cb_list, &parse_trace_c_connect);
-}
-
-static void *name_service(const char *name)
-{
- network_card_Constant_t card = xbt_dict_get_or_null(network_card_set, name);
- return card;
-}
-
-static const char *get_resource_name(void *resource_id)
-{
- return ((network_card_Constant_t) resource_id)->name;
-}
-
-static int resource_used(void *resource_id)
-{
- return lmm_constraint_used(network_maxmin_system,
- ((link_Constant_t) resource_id)->
- constraint);