1 /* Copyright (c) 2009 The SimGrid team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "surf_private.h"
10 #include "xbt/config.h"
11 #include "xbt/graph.h"
14 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route,surf,"Routing part of surf");// FIXME: connect this under windows
16 routing_t used_routing = NULL;
18 /* Prototypes of each model */
19 static void routing_model_full_create(size_t size_of_link,void *loopback);
20 static void routing_model_floyd_create(size_t size_of_link, void*loopback);
21 static void routing_model_dijkstra_create(size_t size_of_link, void*loopback);
22 static void routing_model_dijkstracache_create(size_t size_of_link, void*loopback);
23 static void routing_model_none_create(size_t size_of_link, void*loopback);
25 /* Definition of each model */
29 void (*fun)(size_t,void*);
31 struct model_type models[] =
32 { {"Full", "Full routing data (fast, large memory requirements, fully expressive)", routing_model_full_create },
33 {"Floyd", "Floyd routing data (slow initialization, fast lookup, lesser memory requirements, shortest path routing only)", routing_model_floyd_create },
34 {"Dijkstra", "Dijkstra routing data (fast initialization, slow lookup, small memory requirements, shortest path routing only)", routing_model_dijkstra_create },
35 {"DijkstraCache", "Dijkstra routing data (fast initialization, fast lookup, small memory requirements, shortest path routing only)", routing_model_dijkstracache_create },
36 {"none", "No routing (usable with Constant network only)", routing_model_none_create },
40 void routing_model_create(size_t size_of_links, void* loopback) {
42 char * wanted=xbt_cfg_get_string(_surf_cfg_set,"routing");
44 for (cpt=0;models[cpt].name;cpt++) {
45 if (!strcmp(wanted,models[cpt].name)) {
46 (*(models[cpt].fun))(size_of_links,loopback);
50 fprintf(stderr,"Routing model %s not found. Existing models:\n",wanted);
51 for (cpt=0;models[cpt].name;cpt++)
52 if (!strcmp(wanted,models[cpt].name))
53 fprintf(stderr," %s: %s\n",models[cpt].name,models[cpt].desc);
57 /* ************************************************************************** */
58 /* *************************** FULL ROUTING ********************************* */
60 s_routing_t generic_routing;
61 xbt_dynar_t *routing_table;
64 } s_routing_full_t,*routing_full_t;
66 #define ROUTE_FULL(i,j) ((routing_full_t)used_routing)->routing_table[(i)+(j)*(used_routing)->host_count]
71 static void routing_full_parse_Shost(void) {
72 int *val = xbt_malloc(sizeof(int));
73 DEBUG2("Seen host %s (#%d)",A_surfxml_host_id,used_routing->host_count);
74 *val = used_routing->host_count++;
75 xbt_dict_set(used_routing->host_id,A_surfxml_host_id,val,xbt_free);
77 static int src_id = -1;
78 static int dst_id = -1;
79 static void routing_full_parse_Sroute_set_endpoints(void)
81 src_id = *(int*)xbt_dict_get(used_routing->host_id,A_surfxml_route_src);
82 dst_id = *(int*)xbt_dict_get(used_routing->host_id,A_surfxml_route_dst);
83 DEBUG4("Route %s %d -> %s %d",A_surfxml_route_src,src_id,A_surfxml_route_dst,dst_id);
84 route_action = A_surfxml_route_action;
86 static void routing_full_parse_Eroute(void)
89 if (src_id != -1 && dst_id != -1) {
90 name = bprintf("%x#%x", src_id, dst_id);
91 manage_route(route_table, name, route_action, 0);
97 static void routing_full_parse_end(void) {
98 routing_full_t routing = (routing_full_t) used_routing;
100 unsigned int cpt = 0;
101 xbt_dict_cursor_t cursor = NULL;
102 char *key, *data, *end;
103 const char *sep = "#";
104 xbt_dynar_t links, keys;
105 char *link_name = NULL;
108 int host_count = routing->generic_routing.host_count;
110 /* Create the routing table */
111 routing->routing_table = xbt_new0(xbt_dynar_t, host_count * host_count);
112 for (i=0;i<host_count;i++)
113 for (j=0;j<host_count;j++)
114 ROUTE_FULL(i,j) = xbt_dynar_new(routing->size_of_link,NULL);
116 /* Put the routes in position */
117 xbt_dict_foreach(route_table, cursor, key, data) {
119 links = (xbt_dynar_t) data;
120 keys = xbt_str_split_str(key, sep);
122 src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 16);
123 dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 16);
124 xbt_dynar_free(&keys);
126 DEBUG4("Handle %d %d (from %d hosts): %ld links",
127 src_id,dst_id,routing->generic_routing.host_count,xbt_dynar_length(links));
128 xbt_dynar_foreach(links, cpt, link_name) {
129 void* link = xbt_dict_get_or_null(surf_network_model->resource_set, link_name);
131 xbt_dynar_push(ROUTE_FULL(src_id,dst_id),&link);
133 THROW1(mismatch_error,0,"Link %s not found", link_name);
137 /* Add the loopback if needed */
138 for (i = 0; i < host_count; i++)
139 if (!xbt_dynar_length(ROUTE_FULL(i, i)))
140 xbt_dynar_push(ROUTE_FULL(i,i),&routing->loopback);
142 /* Shrink the dynar routes (save unused slots) */
143 for (i=0;i<host_count;i++)
144 for (j=0;j<host_count;j++)
145 xbt_dynar_shrink(ROUTE_FULL(i,j),0);
151 static xbt_dynar_t routing_full_get_route(int src,int dst) {
152 return ROUTE_FULL(src,dst);
155 static void routing_full_finalize(void) {
156 routing_full_t routing = (routing_full_t)used_routing;
160 for (i = 0; i < used_routing->host_count; i++)
161 for (j = 0; j < used_routing->host_count; j++)
162 xbt_dynar_free(&ROUTE_FULL(i, j));
163 free(routing->routing_table);
164 xbt_dict_free(&used_routing->host_id);
170 static void routing_model_full_create(size_t size_of_link,void *loopback) {
171 /* initialize our structure */
172 routing_full_t routing = xbt_new0(s_routing_full_t,1);
173 routing->generic_routing.name = "Full";
174 routing->generic_routing.host_count = 0;
175 routing->generic_routing.get_route = routing_full_get_route;
176 routing->generic_routing.finalize = routing_full_finalize;
177 routing->size_of_link = size_of_link;
178 routing->loopback = loopback;
180 /* Set it in position */
181 used_routing = (routing_t) routing;
183 /* Setup the parsing callbacks we need */
184 routing->generic_routing.host_id = xbt_dict_new();
185 surfxml_add_callback(STag_surfxml_host_cb_list, &routing_full_parse_Shost);
186 surfxml_add_callback(ETag_surfxml_platform_cb_list, &routing_full_parse_end);
187 surfxml_add_callback(STag_surfxml_route_cb_list,
188 &routing_full_parse_Sroute_set_endpoints);
189 surfxml_add_callback(ETag_surfxml_route_cb_list, &routing_full_parse_Eroute);
192 /* ************************************************************************** */
193 /* *************************** FLOYD ROUTING ********************************* */
195 s_routing_t generic_routing;
197 int *predecessor_table;
202 } s_routing_floyd_t,*routing_floyd_t;
206 #define FLOYD_COST(i,j) ((routing_floyd_t)used_routing)->cost_table[(i)+(j)*(used_routing)->host_count]
207 #define FLOYD_PRED(i,j) ((routing_floyd_t)used_routing)->predecessor_table[(i)+(j)*(used_routing)->host_count]
208 #define FLOYD_LINK(i,j) ((routing_floyd_t)used_routing)->link_table[(i)+(j)*(used_routing)->host_count]
210 static void routing_floyd_parse_end(void) {
212 routing_floyd_t routing = (routing_floyd_t) used_routing;
214 unsigned int cpt = 0;
215 void* link_list = NULL;
216 xbt_dict_cursor_t cursor = NULL;
217 char *key,*data, *end;
218 const char *sep = "#";
219 xbt_dynar_t links, keys;
220 char *link_name = NULL;
224 int host_count = routing->generic_routing.host_count;
226 /* Create Cost, Predecessor and Link tables */
227 routing->cost_table = xbt_new0(double, host_count * host_count); //link cost from host to host
228 routing->predecessor_table = xbt_new0(int, host_count*host_count); //predecessor host numbers
229 routing->link_table = xbt_new0(void*,host_count*host_count); //actual link between src and dst
231 /* Initialize costs and predecessors*/
232 for(i = 0; i<host_count;i++)
233 for(j = 0; j<host_count;j++) {
234 FLOYD_COST(i,j) = DBL_MAX;
235 FLOYD_PRED(i,j) = -1;
238 /* Put the routes in position */
239 xbt_dict_foreach(route_table, cursor, key, data) {
241 links = (xbt_dynar_t)data;
242 keys = xbt_str_split_str(key, sep);
245 src_id = strtol(xbt_dynar_get_as(keys, 0, char*), &end, 16);
246 dst_id = strtol(xbt_dynar_get_as(keys, 1, char*), &end, 16);
247 xbt_dynar_free(&keys);
249 DEBUG4("Handle %d %d (from %d hosts): %ld links",
250 src_id,dst_id,routing->generic_routing.host_count,xbt_dynar_length(links));
251 xbt_assert3(xbt_dynar_length(links) == 1, "%ld links in route between host %d and %d, should be 1", xbt_dynar_length(links), src_id, dst_id);
253 xbt_dynar_foreach (links, cpt, link_name) {
254 void* link = xbt_dict_get_or_null(surf_network_model->resource_set, link_name);
258 THROW1(mismatch_error,0,"Link %s not found", link_name);
262 FLOYD_LINK(src_id,dst_id) = link_list;
263 FLOYD_PRED(src_id, dst_id) = src_id;
266 FLOYD_COST(src_id, dst_id) = 1; // assume 1 for now
270 /* Add the loopback if needed */
271 for (i = 0; i < host_count; i++)
272 if (!FLOYD_PRED(i, i)) {
273 FLOYD_PRED(i, i) = i;
274 FLOYD_COST(i, i) = 1;
275 FLOYD_LINK(i, i) = routing->loopback;
279 //Calculate path costs
281 for(c=0;c<host_count;c++) {
282 for(a=0;a<host_count;a++) {
283 for(b=0;b<host_count;b++) {
284 if(FLOYD_COST(a,c) < DBL_MAX && FLOYD_COST(c,b) < DBL_MAX) {
285 if(FLOYD_COST(a,b) == DBL_MAX || (FLOYD_COST(a,c)+FLOYD_COST(c,b) < FLOYD_COST(a,b))) {
286 FLOYD_COST(a,b) = FLOYD_COST(a,c)+FLOYD_COST(c,b);
287 FLOYD_PRED(a,b) = FLOYD_PRED(c,b);
298 static xbt_dynar_t routing_floyd_get_route(int src_id,int dst_id) {
300 routing_floyd_t routing = (routing_floyd_t) used_routing;
305 xbt_dynar_t link_list = xbt_dynar_new(routing->size_of_link, NULL);
309 pred = FLOYD_PRED(src_id, pred);
311 if(pred == -1) // if no pred in route -> no route to host
314 xbt_dynar_unshift(link_list, &FLOYD_LINK(pred,prev_pred));
316 } while(pred != src_id);
318 xbt_assert2(pred != -1, "no route from host %d to %d", src_id, dst_id);
323 static void routing_floyd_finalize_route(xbt_dynar_t route) {
324 xbt_dynar_free(&route);
327 static void routing_floyd_finalize(void) {
328 routing_floyd_t routing = (routing_floyd_t)used_routing;
331 free(routing->link_table);
332 free(routing->cost_table);
333 free(routing->predecessor_table);
334 xbt_dict_free(&used_routing->host_id);
340 static void routing_model_floyd_create(size_t size_of_link,void *loopback) {
341 /* initialize our structure */
342 routing_floyd_t routing = xbt_new0(s_routing_floyd_t,1);
343 routing->generic_routing.name = "Floyd";
344 routing->generic_routing.host_count = 0;
345 routing->generic_routing.host_id = xbt_dict_new();
346 routing->generic_routing.get_route = routing_floyd_get_route;
347 routing->generic_routing.finalize = routing_floyd_finalize;
348 routing->generic_routing.finalize_route = routing_floyd_finalize_route;
349 routing->size_of_link = size_of_link;
350 routing->loopback = loopback;
352 /* Set it in position */
353 used_routing = (routing_t) routing;
355 /* Setup the parsing callbacks we need */
356 surfxml_add_callback(STag_surfxml_host_cb_list, &routing_full_parse_Shost);
357 surfxml_add_callback(ETag_surfxml_platform_cb_list, &routing_floyd_parse_end);
358 surfxml_add_callback(STag_surfxml_route_cb_list,
359 &routing_full_parse_Sroute_set_endpoints);
360 surfxml_add_callback(ETag_surfxml_route_cb_list, &routing_full_parse_Eroute);
364 /* ************************************************************************** */
365 /* ********** Dijkstra & Dijkstra Cached ROUTING **************************** */
367 s_routing_t generic_routing;
368 xbt_graph_t route_graph;
369 xbt_set_t graph_node_map;
370 xbt_set_t route_cache;
374 } s_routing_dijkstra_t,*routing_dijkstra_t;
377 typedef struct graph_node_data {
379 int graph_id; //used for caching internal id's
380 } s_graph_node_data_t, * graph_node_data_t;
382 typedef struct graph_node_map_element {
386 } s_graph_node_map_element_t, * graph_node_map_element_t;
388 typedef struct route_cache_element {
393 } s_route_cache_element_t, * route_cache_element_t;
398 static void route_cache_elem_free(void *e) {
399 route_cache_element_t elm=(route_cache_element_t)e;
408 static void graph_node_map_elem_free(void *e) {
409 graph_node_map_element_t elm = (graph_node_map_element_t)e;
420 static xbt_node_t route_graph_new_node(int id, int graph_id) {
421 routing_dijkstra_t routing = (routing_dijkstra_t) used_routing;
423 graph_node_data_t data = xbt_new0(struct graph_node_data, sizeof(struct graph_node_data));
425 data->graph_id = graph_id;
426 xbt_node_t node = xbt_graph_new_node(routing->route_graph, data);
428 graph_node_map_element_t elm = xbt_new0(struct graph_node_map_element, sizeof(struct graph_node_map_element));
430 elm->name = bprintf("%d",id);
433 xbt_set_add(routing->graph_node_map, (xbt_set_elm_t)elm, &graph_node_map_elem_free);
438 static graph_node_map_element_t graph_node_map_search(int id) {
439 routing_dijkstra_t routing = (routing_dijkstra_t) used_routing;
441 char * id_str = bprintf("%d",id);
442 graph_node_map_element_t elm = (graph_node_map_element_t)xbt_set_get_by_name_or_null(routing->graph_node_map, id_str);
451 static void route_new_dijkstra(int src_id, int dst_id, void* link) {
452 routing_dijkstra_t routing = (routing_dijkstra_t) used_routing;
454 xbt_node_t src = NULL;
455 xbt_node_t dst = NULL;
456 char * src_id_str = bprintf("%d",src_id);
457 char * dst_id_str = bprintf("%d",dst_id);
458 graph_node_map_element_t src_elm = (graph_node_map_element_t)xbt_set_get_by_name_or_null(routing->graph_node_map, src_id_str);
459 graph_node_map_element_t dst_elm = (graph_node_map_element_t)xbt_set_get_by_name_or_null(routing->graph_node_map, dst_id_str);
469 //add nodes if they don't exist in the graph
470 if(src_id == dst_id && src == NULL && dst == NULL) {
471 src = route_graph_new_node(src_id, -1);
475 src = route_graph_new_node(src_id, -1);
479 dst = route_graph_new_node(dst_id, -1);
483 //add link as edge to graph
484 xbt_graph_new_edge(routing->route_graph, src, dst, link);
488 static void add_loopback_dijkstra(void) {
489 routing_dijkstra_t routing = (routing_dijkstra_t) used_routing;
491 xbt_dynar_t nodes = xbt_graph_get_nodes(routing->route_graph);
493 xbt_node_t node = NULL;
494 unsigned int cursor2;
495 xbt_dynar_foreach(nodes, cursor2, node) {
496 xbt_dynar_t out_edges = xbt_graph_node_get_outedges(node);
497 xbt_edge_t edge = NULL;
501 xbt_dynar_foreach(out_edges, cursor, edge) {
502 xbt_node_t other_node = xbt_graph_edge_get_target(edge);
503 if(other_node == node) {
510 xbt_graph_new_edge(routing->route_graph, node, node, &routing->loopback);
514 static void routing_dijkstra_parse_end(void) {
515 routing_dijkstra_t routing = (routing_dijkstra_t) used_routing;
517 unsigned int cpt = 0;
518 xbt_dict_cursor_t cursor = NULL;
519 char *key, *data, *end;
520 const char *sep = "#";
521 xbt_dynar_t links, keys;
522 char *link_name = NULL;
524 /* Create the topology graph */
525 routing->route_graph = xbt_graph_new_graph(1, NULL);
526 routing->graph_node_map = xbt_set_new();
528 routing->route_cache = xbt_set_new();
531 /* Put the routes in position */
532 xbt_dict_foreach(route_table, cursor, key, data) {
534 links = (xbt_dynar_t) data;
535 keys = xbt_str_split_str(key, sep);
537 src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 16);
538 dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 16);
539 xbt_dynar_free(&keys);
541 DEBUG4("Handle %d %d (from %d hosts): %ld links",
542 src_id,dst_id,routing->generic_routing.host_count,xbt_dynar_length(links));
544 xbt_assert3(xbt_dynar_length(links) == 1, "%ld links in route between host %d and %d, should be 1", xbt_dynar_length(links), src_id, dst_id);
546 xbt_dynar_foreach(links, cpt, link_name) {
547 void* link = xbt_dict_get_or_null(surf_network_model->resource_set, link_name);
549 route_new_dijkstra(src_id,dst_id,link);
551 THROW1(mismatch_error,0,"Link %s not found", link_name);
556 /* Add the loopback if needed */
557 add_loopback_dijkstra();
559 /* initialize graph indexes in nodes after graph has been built */
560 xbt_dynar_t nodes = xbt_graph_get_nodes(routing->route_graph);
562 xbt_node_t node = NULL;
563 unsigned int cursor2;
564 xbt_dynar_foreach(nodes, cursor2, node) {
565 graph_node_data_t data = xbt_graph_node_get_data(node);
566 data->graph_id = cursor2;
574 static xbt_dynar_t routing_dijkstra_get_route(int src_id,int dst_id) {
576 routing_dijkstra_t routing = (routing_dijkstra_t) used_routing;
577 int * pred_arr = NULL;
579 xbt_dynar_t nodes = xbt_graph_get_nodes(routing->route_graph);
581 /*Use the graph_node id mapping set to quickly find the nodes */
582 graph_node_map_element_t src_elm = graph_node_map_search(src_id);
583 graph_node_map_element_t dst_elm = graph_node_map_search(dst_id);
584 xbt_assert2(src_elm != NULL && dst_elm != NULL, "src %d or dst %d does not exist", src_id, dst_id);
585 int src_node_id = ((graph_node_data_t)xbt_graph_node_get_data(src_elm->node))->graph_id;
586 int dst_node_id = ((graph_node_data_t)xbt_graph_node_get_data(dst_elm->node))->graph_id;
588 route_cache_element_t elm = NULL;
589 if(routing->cached) {
590 /*check if there is a cached predecessor list avail */
591 char * src_id_str = bprintf("%d",src_id);
592 elm = (route_cache_element_t)xbt_set_get_by_name_or_null(routing->route_cache, src_id_str);
596 if(elm) { //cached mode and cache hit
597 pred_arr = elm->pred_arr;
598 } else { //not cached mode or cache miss
599 double * cost_arr = NULL;
600 xbt_heap_t pqueue = NULL;
603 int nr_nodes = xbt_dynar_length(nodes);
604 cost_arr = xbt_new0(double, nr_nodes); //link cost from src to other hosts
605 pred_arr = xbt_new0(int, nr_nodes); //predecessors in path from src
606 pqueue = xbt_heap_new(nr_nodes, free);
609 cost_arr[src_node_id] = 0.0;
611 for(i = 0; i < nr_nodes; i++) {
612 if(i != src_node_id) {
613 cost_arr[i] = DBL_MAX;
618 //initialize priority queue
619 int * nodeid = xbt_new0(int, 1);
621 xbt_heap_push(pqueue, nodeid, cost_arr[i]);
625 // apply dijkstra using the indexes from the graph's node array
626 while(xbt_heap_size(pqueue) > 0) {
627 int * v_id = xbt_heap_pop(pqueue);
628 xbt_node_t v_node = xbt_dynar_get_as(nodes, *v_id, xbt_node_t);
629 xbt_dynar_t out_edges = xbt_graph_node_get_outedges(v_node);
630 xbt_edge_t edge = NULL;
633 xbt_dynar_foreach(out_edges, cursor, edge) {
634 xbt_node_t u_node = xbt_graph_edge_get_target(edge);
635 graph_node_data_t data = xbt_graph_node_get_data(u_node);
636 int u_id = data->graph_id;
637 int cost_v_u = 1; //fixed link cost for now
639 if(cost_v_u + cost_arr[*v_id] < cost_arr[u_id]) {
640 pred_arr[u_id] = *v_id;
641 cost_arr[u_id] = cost_v_u + cost_arr[*v_id];
642 int * nodeid = xbt_new0(int, 1);
644 xbt_heap_push(pqueue, nodeid, cost_arr[u_id]);
648 //free item popped from pqueue
653 xbt_heap_free(pqueue);
657 //compose route path with links
658 xbt_dynar_t link_list = xbt_dynar_new(routing->size_of_link, NULL);
662 for(v = dst_node_id; v != src_node_id; v = pred_arr[v]) {
663 xbt_node_t node_pred_v = xbt_dynar_get_as(nodes, pred_arr[v], xbt_node_t);
664 xbt_node_t node_v = xbt_dynar_get_as(nodes, v, xbt_node_t);
665 xbt_edge_t edge = xbt_graph_get_edge(routing->route_graph, node_pred_v, node_v);
667 xbt_assert2(edge != NULL, "no route between host %d and %d", src_id, dst_id);
669 void * link = xbt_graph_edge_get_data(edge);
670 xbt_dynar_unshift(link_list, &link);
675 if(routing->cached && elm == NULL) {
676 //add to predecessor list of the current src-host to cache
677 elm = xbt_new0(struct route_cache_element, sizeof(struct route_cache_element));
678 elm->name = bprintf("%d",src_id);
680 elm->pred_arr = pred_arr;
682 xbt_set_add(routing->route_cache, (xbt_set_elm_t)elm, &route_cache_elem_free);
691 static void routing_dijkstra_finalize_route(xbt_dynar_t route) {
692 xbt_dynar_free(&route);
695 static void routing_dijkstra_finalize(void) {
696 routing_dijkstra_t routing = (routing_dijkstra_t)used_routing;
699 xbt_graph_free_graph(routing->route_graph, &free, NULL, &free);
700 xbt_set_free(&routing->graph_node_map);
702 xbt_set_free(&routing->route_cache);
703 xbt_dict_free(&used_routing->host_id);
712 static void routing_model_dijkstraboth_create(size_t size_of_link,void *loopback, int cached) {
713 /* initialize our structure */
714 routing_dijkstra_t routing = xbt_new0(s_routing_dijkstra_t,1);
715 routing->generic_routing.name = "Dijkstra";
716 routing->generic_routing.host_count = 0;
717 routing->generic_routing.get_route = routing_dijkstra_get_route;
718 routing->generic_routing.finalize = routing_dijkstra_finalize;
719 routing->generic_routing.finalize_route = routing_dijkstra_finalize_route;
720 routing->size_of_link = size_of_link;
721 routing->loopback = loopback;
722 routing->cached = cached;
724 /* Set it in position */
725 used_routing = (routing_t) routing;
727 /* Setup the parsing callbacks we need */
728 routing->generic_routing.host_id = xbt_dict_new();
729 surfxml_add_callback(STag_surfxml_host_cb_list, &routing_full_parse_Shost);
730 surfxml_add_callback(ETag_surfxml_platform_cb_list, &routing_dijkstra_parse_end);
731 surfxml_add_callback(STag_surfxml_route_cb_list,
732 &routing_full_parse_Sroute_set_endpoints);
733 surfxml_add_callback(ETag_surfxml_route_cb_list, &routing_full_parse_Eroute);
736 static void routing_model_dijkstra_create(size_t size_of_link,void *loopback) {
737 routing_model_dijkstraboth_create(size_of_link, loopback, 0);
740 static void routing_model_dijkstracache_create(size_t size_of_link,void *loopback) {
741 routing_model_dijkstraboth_create(size_of_link, loopback, 1);
744 /* ************************************************** */
745 /* ********** NO ROUTING **************************** */
747 static void routing_none_finalize(void) {
749 xbt_dict_free(&used_routing->host_id);
755 static void routing_model_none_create(size_t size_of_link,void *loopback) {
756 routing_t routing = xbt_new0(s_routing_t,1);
757 INFO0("Null routing");
758 routing->name = "none";
759 routing->host_count = 0;
760 routing->host_id = xbt_dict_new();
761 routing->get_route = NULL;
762 routing->finalize = routing_none_finalize;
764 /* Set it in position */
765 used_routing = (routing_t) routing;