xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
routing_component_full_t routing = (routing_component_full_t) rc;
- int table_size = xbt_dict_length(routing->generic_routing.to_index);
+ size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
xbt_dict_cursor_t c1 = NULL, c2 = NULL;
char *k1, *d1, *k2, *d2;
xbt_dict_foreach(routing->generic_routing.to_index, c1, k1, d1) {
/* set utils vars */
routing_component_full_t routing = (routing_component_full_t) rc;
- int table_size = xbt_dict_length(routing->generic_routing.to_index);
+ size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
generic_src_dst_check(rc, src, dst);
int *src_id = xbt_dict_get_or_null(routing->generic_routing.to_index, src);
static void full_finalize(routing_component_t rc)
{
routing_component_full_t routing = (routing_component_full_t) rc;
- int table_size = xbt_dict_length(routing->generic_routing.to_index);
+ size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
int i, j;
if (routing) {
/* Delete routing table */
new_component->generic_routing.finalize = full_finalize;
new_component->generic_routing.to_index = xbt_dict_new();
new_component->bypassRoutes = xbt_dict_new();
- new_component->parse_routes = xbt_dict_new();
+ new_component->generic_routing.parse_routes = xbt_dict_new();
return new_component;
}
/* set utils vars */
routing_component_full_t routing =
((routing_component_full_t) current_routing);
- int table_size = xbt_dict_length(routing->generic_routing.to_index);
+ size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
/* Create the routing table */
routing->routing_table =
xbt_new0(route_extended_t, table_size * table_size);
/* Put the routes in position */
- xbt_dict_foreach(routing->parse_routes, cursor, key, data) {
+ xbt_dict_foreach(routing->generic_routing.parse_routes, cursor, key, data) {
keys = xbt_str_split_str(key, sep);
src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 10);
dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 10);
}
/* delete the parse table */
- xbt_dict_foreach(routing->parse_routes, cursor, key, data) {
+ xbt_dict_foreach(routing->generic_routing.parse_routes, cursor, key, data) {
route = (route_t) data;
xbt_dynar_free(&(route->link_list));
xbt_free(data);
}
/* delete parse dict */
- xbt_dict_free(&(routing->parse_routes));
+ xbt_dict_free(&(routing->generic_routing.parse_routes));
/* Add the loopback if needed */
if (current_routing->hierarchy == SURF_ROUTING_BASE) {
int *predecessor_table;
route_extended_t *link_table; /* char* -> int* */
xbt_dict_t bypassRoutes;
- /* store data during the parse process */
- xbt_dict_t parse_routes;
} s_routing_component_floyd_t, *routing_component_floyd_t;
static route_extended_t floyd_get_route(routing_component_t rc,
xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
routing_component_floyd_t routing = (routing_component_floyd_t) rc;
- //int table_size = xbt_dict_length(routing->generic_routing.to_index);
+ //size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
xbt_dict_cursor_t c1 = NULL, c2 = NULL;
char *k1, *d1, *k2, *d2;
xbt_dict_foreach(routing->generic_routing.to_index, c1, k1, d1) {
/* set utils vars */
routing_component_floyd_t routing = (routing_component_floyd_t) rc;
- int table_size = xbt_dict_length(routing->generic_routing.to_index);
+ size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
generic_src_dst_check(rc, src, dst);
int *src_id = xbt_dict_get_or_null(routing->generic_routing.to_index, src);
static void floyd_finalize(routing_component_t rc)
{
routing_component_floyd_t routing = (routing_component_floyd_t) rc;
- int i, j, table_size;
+ int i, j;
+ size_t table_size;
if (routing) {
table_size = xbt_dict_length(routing->generic_routing.to_index);
/* Delete link_table */
new_component->generic_routing.finalize = floyd_finalize;
new_component->generic_routing.to_index = xbt_dict_new();
new_component->bypassRoutes = xbt_dict_new();
- new_component->parse_routes = xbt_dict_new();
+ new_component->generic_routing.parse_routes = xbt_dict_new();
return new_component;
}
unsigned int i, j, a, b, c;
/* set the size of inicial table */
- int table_size = xbt_dict_length(routing->generic_routing.to_index);
+ size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
/* Create Cost, Predecessor and Link tables */
cost_table = xbt_new0(double, table_size * table_size); /* link cost from host to host */
}
/* Put the routes in position */
- xbt_dict_foreach(routing->parse_routes, cursor, key, data) {
+ xbt_dict_foreach(routing->generic_routing.parse_routes, cursor, key, data) {
keys = xbt_str_split_str(key, sep);
src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 10);
dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 10);
}
/* delete the parse table */
- xbt_dict_foreach(routing->parse_routes, cursor, key, data) {
+ xbt_dict_foreach(routing->generic_routing.parse_routes, cursor, key, data) {
route_t route = (route_t) data;
xbt_dynar_free(&(route->link_list));
xbt_free(data);
}
/* delete parse dict */
- xbt_dict_free(&(routing->parse_routes));
+ xbt_dict_free(&(routing->generic_routing.parse_routes));
/* cleanup */
xbt_free(cost_table);
xbt_dict_t graph_node_map; /* map */
xbt_dict_t route_cache; /* use in cache mode */
int cached;
- xbt_dict_t parse_routes;
} s_routing_component_dijkstra_t, *routing_component_dijkstra_t;
new_component->cached = cached;
new_component->generic_routing.to_index = xbt_dict_new();
new_component->bypassRoutes = xbt_dict_new();
- new_component->parse_routes = xbt_dict_new();
+ new_component->generic_routing.parse_routes = xbt_dict_new();
return new_component;
}
routing->route_cache = xbt_dict_new();
/* Put the routes in position */
- xbt_dict_foreach(routing->parse_routes, cursor, key, data) {
+ xbt_dict_foreach(routing->generic_routing.parse_routes, cursor, key, data) {
keys = xbt_str_split_str(key, sep);
src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 10);
dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 10);
}
/* delete the parse table */
- xbt_dict_foreach(routing->parse_routes, cursor, key, data) {
+ xbt_dict_foreach(routing->generic_routing.parse_routes, cursor, key, data) {
route = (route_t) data;
xbt_dynar_free(&(route->link_list));
xbt_free(data);
}
/* delete parse dict */
- xbt_dict_free(&(routing->parse_routes));
+ xbt_dict_free(&(routing->generic_routing.parse_routes));
/* Add the loopback if needed */
if (current_routing->hierarchy == SURF_ROUTING_BASE)
const char *dst, route_t route)
{
DEBUG2("Load Route from \"%s\" to \"%s\"", src, dst);
- model_type_t modeltype = rc->routing;
xbt_dict_t _parse_routes;
xbt_dict_t _to_index;
char *route_name;
int *src_id, *dst_id;
_to_index = current_routing->to_index;
-
- if (modeltype == &routing_models[SURF_MODEL_FULL]) {
- _parse_routes = ((routing_component_full_t) rc)->parse_routes;
-
- } else if (modeltype == &routing_models[SURF_MODEL_FLOYD]) {
- _parse_routes = ((routing_component_floyd_t) rc)->parse_routes;
-
- } else if (modeltype == &routing_models[SURF_MODEL_DIJKSTRA] ||
- modeltype == &routing_models[SURF_MODEL_DIJKSTRACACHE]) {
- _parse_routes = ((routing_component_dijkstra_t) rc)->parse_routes;
-
- } else
- xbt_die("\"generic_set_route\" not supported");
+ //TODO
+ _parse_routes = current_routing->parse_routes;
src_id = xbt_dict_get_or_null(_to_index, src);
dst_id = xbt_dict_get_or_null(_to_index, dst);
{
DEBUG4("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
e_route->src_gateway, dst, e_route->dst_gateway);
- model_type_t modeltype = rc->routing;
+
xbt_dict_t _parse_routes;
xbt_dict_t _to_index;
char *route_name;
int *src_id, *dst_id;
_to_index = current_routing->to_index;
-
- if (modeltype == &routing_models[SURF_MODEL_FULL]) {
- _parse_routes = ((routing_component_full_t) rc)->parse_routes;
-
- } else if (modeltype == &routing_models[SURF_MODEL_FLOYD]) {
- _parse_routes = ((routing_component_floyd_t) rc)->parse_routes;
-
- } else if (modeltype == &routing_models[SURF_MODEL_DIJKSTRA] ||
- modeltype == &routing_models[SURF_MODEL_DIJKSTRACACHE]) {
- _parse_routes = ((routing_component_dijkstra_t) rc)->parse_routes;
-
- } else
- xbt_die("\"generic_set_route\" not supported");
+ //TODO
+ _parse_routes = current_routing->parse_routes;
src_id = xbt_dict_get_or_null(_to_index, src);
dst_id = xbt_dict_get_or_null(_to_index, dst);
route_extended_t e_route, new_e_route;
route_t route;
unsigned int cpt;
- xbt_dynar_t links, links_id;
+ xbt_dynar_t links = NULL, links_id = NULL;
new_e_route = xbt_new0(s_route_extended_t, 1);
new_e_route->generic_route.link_list =