const char *name;
const char *desc;
AS_t (*create) ();
- void (*end) ();
+ void (*end) (AS_t as);
} s_routing_model_description_t, *routing_model_description_t;
typedef struct s_route {
(void *) info);
if (current_routing->routing->end)
- (*(current_routing->routing->end)) ();
+ (*(current_routing->routing->end)) (current_routing);
current_routing = current_routing->routing_father;
}
}
/* Global vars */
extern routing_global_t global_routing;
-extern AS_t current_routing;
-extern routing_model_description_t current_routing_model;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf -- dijkstra routing logic");
return model_dijkstra_both_create(1);
}
-void model_dijkstra_both_end(void)
+void model_dijkstra_both_end(AS_t as)
{
- as_dijkstra_t routing =
- (as_dijkstra_t) current_routing;
+ as_dijkstra_t THIS = (as_dijkstra_t) as;
xbt_node_t node = NULL;
unsigned int cursor2;
xbt_dynar_t nodes = NULL;
/* Create the topology graph */
- if(!routing->route_graph)
- routing->route_graph = xbt_graph_new_graph(1, NULL);
- if(!routing->graph_node_map)
- routing->graph_node_map = xbt_dict_new();
+ if(!THIS->route_graph)
+ THIS->route_graph = xbt_graph_new_graph(1, NULL);
+ if(!THIS->graph_node_map)
+ THIS->graph_node_map = xbt_dict_new();
- if (routing->cached && !routing->route_cache)
- routing->route_cache = xbt_dict_new();
+ if (THIS->cached && !THIS->route_cache)
+ THIS->route_cache = xbt_dict_new();
/* Add the loopback if needed */
- if (current_routing->hierarchy == SURF_ROUTING_BASE)
- add_loopback_dijkstra(routing);
+ if (as->hierarchy == SURF_ROUTING_BASE)
+ add_loopback_dijkstra(THIS);
/* initialize graph indexes in nodes after graph has been built */
- nodes = xbt_graph_get_nodes(routing->route_graph);
+ nodes = xbt_graph_get_nodes(THIS->route_graph);
xbt_dynar_foreach(nodes, cursor2, node) {
graph_node_data_t data = xbt_graph_node_get_data(node);
}
route_extended_t e_route =
- generic_new_extended_route(current_routing->hierarchy, route, 1);
+ generic_new_extended_route(asg->hierarchy, route, 1);
route_new_dijkstra(as, *src_id, *dst_id, e_route);
}
/* Global vars */
extern routing_global_t global_routing;
-extern AS_t current_routing;
-extern routing_model_description_t current_routing_model;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf");
return (AS_t)new_component;
}
-void model_floyd_end(void)
+void model_floyd_end(AS_t current_routing)
{
as_floyd_t as =
/* Global vars */
extern routing_global_t global_routing;
-extern AS_t current_routing;
-extern routing_model_description_t current_routing_model;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
return (AS_t) new_component;
}
-void model_full_end(void)
+void model_full_end(AS_t current_routing)
{
unsigned int i;
route_extended_t e_route;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
-extern AS_t current_routing;
-
AS_t routmod_generic_create(size_t childsize) {
AS_t new_component = xbt_malloc0(childsize);
}
-void generic_parse_PU(AS_t rc, const char *name)
+void generic_parse_PU(AS_t as, const char *name)
{
XBT_DEBUG("Load process unit \"%s\"", name);
int *id = xbt_new0(int, 1);
xbt_dict_t _to_index;
- _to_index = current_routing->to_index;
+ _to_index = as->to_index;
*id = xbt_dict_length(_to_index);
xbt_dict_set(_to_index, name, id, xbt_free);
}
-void generic_parse_AS(AS_t rc, const char *name)
+void generic_parse_AS(AS_t as, const char *name)
{
XBT_DEBUG("Load Autonomous system \"%s\"", name);
int *id = xbt_new0(int, 1);
xbt_dict_t _to_index;
- _to_index = current_routing->to_index;
+ _to_index = as->to_index;
*id = xbt_dict_length(_to_index);
xbt_dict_set(_to_index, name, id, xbt_free);
}
/* Global vars */
extern routing_global_t global_routing;
-extern AS_t current_routing;
-extern routing_model_description_t current_routing_model;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_none, surf, "Routing part of surf");
/* ************************************************************************** */
/* *************************** FLOYD ROUTING ******************************** */
AS_t model_floyd_create(void); /* create structures for floyd routing model */
-void model_floyd_end(void); /* finalize the creation of floyd routing model */
+void model_floyd_end(AS_t as); /* finalize the creation of floyd routing model */
void model_floyd_parse_route(AS_t rc, const char *src,
const char *dst, route_extended_t route);
AS_t model_dijkstra_both_create(int cached); /* create by calling dijkstra or dijkstracache */
AS_t model_dijkstra_create(void); /* create structures for dijkstra routing model */
AS_t model_dijkstracache_create(void); /* create structures for dijkstracache routing model */
-void model_dijkstra_both_end(void); /* finalize the creation of dijkstra routing model */
+void model_dijkstra_both_end(AS_t as); /* finalize the creation of dijkstra routing model */
void model_dijkstra_both_parse_route (AS_t rc, const char *src,
const char *dst, route_extended_t route);
/* ************************************************************************** */
/* *************************** FULL ROUTING ********************************* */
AS_t model_full_create(void); /* create structures for full routing model */
-void model_full_end(void); /* finalize the creation of full routing model */
+void model_full_end(AS_t as); /* finalize the creation of full routing model */
void model_full_set_route( /* Set the route and ASroute between src and dst */
AS_t rc, const char *src, const char *dst, route_extended_t route);
/* Global vars */
extern routing_global_t global_routing;
-extern AS_t current_routing;
-extern routing_model_description_t current_routing_model;
extern xbt_dynar_t link_list;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_rulebased, surf, "Routing part of surf");