Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ignorable reindent
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 9 Apr 2012 01:53:56 +0000 (15:53 -1000)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 9 Apr 2012 01:54:23 +0000 (15:54 -1000)
src/surf/surf_routing_dijkstra.c
src/surf/surf_routing_floyd.c
src/surf/surf_routing_full.c
src/surf/surf_routing_generic.c
src/surf/surf_routing_rulebased.c
src/surf/surf_routing_vivaldi.c

index bcc8a22..e4ea7de 100644 (file)
@@ -65,7 +65,7 @@ static void graph_edge_data_free(void *e) // FIXME: useless code dupplication
 /* Utility functions */
 
 static xbt_node_t route_graph_new_node(as_dijkstra_t as,
 /* Utility functions */
 
 static xbt_node_t route_graph_new_node(as_dijkstra_t as,
-                                       int id, int graph_id)
+    int id, int graph_id)
 {
   xbt_node_t node = NULL;
   graph_node_data_t data = NULL;
 {
   xbt_node_t node = NULL;
   graph_node_data_t data = NULL;
@@ -79,7 +79,7 @@ static xbt_node_t route_graph_new_node(as_dijkstra_t as,
   elm = xbt_new0(struct graph_node_map_element, 1);
   elm->node = node;
   xbt_dict_set_ext(as->graph_node_map, (char *) (&id), sizeof(int),
   elm = xbt_new0(struct graph_node_map_element, 1);
   elm->node = node;
   xbt_dict_set_ext(as->graph_node_map, (char *) (&id), sizeof(int),
-                   (xbt_set_elm_t) elm, NULL);
+      (xbt_set_elm_t) elm, NULL);
 
   return node;
 }
 
   return node;
 }
@@ -88,29 +88,29 @@ static graph_node_map_element_t
 graph_node_map_search(as_dijkstra_t as, int id)
 {
   graph_node_map_element_t elm = (graph_node_map_element_t)
 graph_node_map_search(as_dijkstra_t as, int id)
 {
   graph_node_map_element_t elm = (graph_node_map_element_t)
-      xbt_dict_get_or_null_ext(as->graph_node_map,
-                               (char *) (&id),
-                               sizeof(int));
+          xbt_dict_get_or_null_ext(as->graph_node_map,
+              (char *) (&id),
+              sizeof(int));
   return elm;
 }
 
 /* Parsing */
 
 static void route_new_dijkstra(as_dijkstra_t as, int src_id,
   return elm;
 }
 
 /* Parsing */
 
 static void route_new_dijkstra(as_dijkstra_t as, int src_id,
-                               int dst_id, route_t e_route)
+    int dst_id, route_t e_route)
 {
   XBT_DEBUG("Load Route from \"%d\" to \"%d\"", src_id, dst_id);
   xbt_node_t src = NULL;
   xbt_node_t dst = NULL;
 
   graph_node_map_element_t src_elm = (graph_node_map_element_t)
 {
   XBT_DEBUG("Load Route from \"%d\" to \"%d\"", src_id, dst_id);
   xbt_node_t src = NULL;
   xbt_node_t dst = NULL;
 
   graph_node_map_element_t src_elm = (graph_node_map_element_t)
-      xbt_dict_get_or_null_ext(as->graph_node_map,
-                               (char *) (&src_id),
-                               sizeof(int));
+          xbt_dict_get_or_null_ext(as->graph_node_map,
+              (char *) (&src_id),
+              sizeof(int));
   graph_node_map_element_t dst_elm = (graph_node_map_element_t)
   graph_node_map_element_t dst_elm = (graph_node_map_element_t)
-      xbt_dict_get_or_null_ext(as->graph_node_map,
-                               (char *) (&dst_id),
-                               sizeof(int));
+          xbt_dict_get_or_null_ext(as->graph_node_map,
+              (char *) (&dst_id),
+              sizeof(int));
 
 
   if (src_elm)
 
 
   if (src_elm)
@@ -159,7 +159,7 @@ static void add_loopback_dijkstra(as_dijkstra_t as) {
       route_t e_route = xbt_new0(s_route_t, 1);
       e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
       xbt_dynar_push(e_route->link_list,
       route_t e_route = xbt_new0(s_route_t, 1);
       e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
       xbt_dynar_push(e_route->link_list,
-                     &global_routing->loopback);
+          &global_routing->loopback);
       xbt_graph_new_edge(as->route_graph, node, node, e_route);
     }
   }
       xbt_graph_new_edge(as->route_graph, node, node, e_route);
     }
   }
@@ -170,41 +170,41 @@ static void dijkstra_get_route_and_latency(AS_t as_generic,
 
 static xbt_dynar_t dijkstra_get_onelink_routes(AS_t as)
 {
 
 static xbt_dynar_t dijkstra_get_onelink_routes(AS_t as)
 {
-         xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
-      route_t route = xbt_new0(s_route_t,1);
-      route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
-
-         int src,dst;
-         network_element_t src_elm, dst_elm;
-         size_t table_size = xbt_dynar_length(as->index_network_elm);
-         for(src=0; src < table_size; src++) {
-           for(dst=0; dst< table_size; dst++) {
-             xbt_dynar_reset(route->link_list);
-             src_elm = xbt_dynar_get_as(as->index_network_elm,src,network_element_t);
-             dst_elm = xbt_dynar_get_as(as->index_network_elm,dst,network_element_t);
-             dijkstra_get_route_and_latency(as, src_elm, dst_elm,route, NULL);
-
-             if (xbt_dynar_length(route->link_list) == 1) {
-               void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0);
-               onelink_t onelink = xbt_new0(s_onelink_t, 1);
-               onelink->link_ptr = link;
-               if (as->hierarchy == SURF_ROUTING_BASE) {
-                 onelink->src = src_elm;
-                 onelink->dst = dst_elm;
-               } else if (as->hierarchy == SURF_ROUTING_RECURSIVE) {
-                 onelink->src = route->src_gateway;
-                 onelink->dst = route->dst_gateway;
-               }
-               xbt_dynar_push(ret, &onelink);
-             }
-           }
-         }
-         return ret;
+  xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
+  route_t route = xbt_new0(s_route_t,1);
+  route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
+
+  int src,dst;
+  network_element_t src_elm, dst_elm;
+  size_t table_size = xbt_dynar_length(as->index_network_elm);
+  for(src=0; src < table_size; src++) {
+    for(dst=0; dst< table_size; dst++) {
+      xbt_dynar_reset(route->link_list);
+      src_elm = xbt_dynar_get_as(as->index_network_elm,src,network_element_t);
+      dst_elm = xbt_dynar_get_as(as->index_network_elm,dst,network_element_t);
+      dijkstra_get_route_and_latency(as, src_elm, dst_elm,route, NULL);
+
+      if (xbt_dynar_length(route->link_list) == 1) {
+        void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0);
+        onelink_t onelink = xbt_new0(s_onelink_t, 1);
+        onelink->link_ptr = link;
+        if (as->hierarchy == SURF_ROUTING_BASE) {
+          onelink->src = src_elm;
+          onelink->dst = dst_elm;
+        } else if (as->hierarchy == SURF_ROUTING_RECURSIVE) {
+          onelink->src = route->src_gateway;
+          onelink->dst = route->dst_gateway;
+        }
+        xbt_dynar_push(ret, &onelink);
+      }
+    }
+  }
+  return ret;
 }
 
 static void dijkstra_get_route_and_latency(AS_t asg,
     network_element_t src, network_element_t dst,
 }
 
 static void dijkstra_get_route_and_latency(AS_t asg,
     network_element_t src, network_element_t dst,
-                               route_t route, double *lat)
+    route_t route, double *lat)
 {
 
   /* set utils vars */
 {
 
   /* set utils vars */
@@ -237,9 +237,9 @@ static void dijkstra_get_route_and_latency(AS_t asg,
       graph_node_map_search(as, *dst_id);
 
   src_node_id = ((graph_node_data_t)
       graph_node_map_search(as, *dst_id);
 
   src_node_id = ((graph_node_data_t)
-                 xbt_graph_node_get_data(src_elm->node))->graph_id;
+      xbt_graph_node_get_data(src_elm->node))->graph_id;
   dst_node_id = ((graph_node_data_t)
   dst_node_id = ((graph_node_data_t)
-                 xbt_graph_node_get_data(dst_elm->node))->graph_id;
+      xbt_graph_node_get_data(dst_elm->node))->graph_id;
 
   /* if the src and dst are the same */
   if (src_node_id == dst_node_id) {
 
   /* if the src and dst are the same */
   if (src_node_id == dst_node_id) {
@@ -266,8 +266,8 @@ static void dijkstra_get_route_and_latency(AS_t asg,
   if (as->cached) {
     /*check if there is a cached predecessor list avail */
     elm = (route_cache_element_t)
   if (as->cached) {
     /*check if there is a cached predecessor list avail */
     elm = (route_cache_element_t)
-        xbt_dict_get_or_null_ext(as->route_cache, (char *) (&src_id),
-                                 sizeof(int));
+            xbt_dict_get_or_null_ext(as->route_cache, (char *) (&src_id),
+                sizeof(int));
   }
 
   if (elm) {                    /* cached mode and cache hit */
   }
 
   if (elm) {                    /* cached mode and cache hit */
@@ -390,7 +390,7 @@ static void dijkstra_get_route_and_latency(AS_t asg,
     elm->pred_arr = pred_arr;
     elm->size = size;
     xbt_dict_set_ext(as->route_cache, (char *) (&src_id), sizeof(int),
     elm->pred_arr = pred_arr;
     elm->size = size;
     xbt_dict_set_ext(as->route_cache, (char *) (&src_id), sizeof(int),
-                     (xbt_set_elm_t) elm, NULL);
+        (xbt_set_elm_t) elm, NULL);
   }
 
   if (!as->cached)
   }
 
   if (!as->cached)
@@ -415,7 +415,7 @@ static void dijkstra_finalize(AS_t asg)
 AS_t model_dijkstra_both_create(int cached)
 {
   as_dijkstra_t new_component = (as_dijkstra_t)
 AS_t model_dijkstra_both_create(int cached)
 {
   as_dijkstra_t new_component = (as_dijkstra_t)
-      model_generic_create_sized(sizeof(s_as_dijkstra_t));
+          model_generic_create_sized(sizeof(s_as_dijkstra_t));
 
   new_component->generic_routing.parse_route = model_dijkstra_both_parse_route;
   new_component->generic_routing.parse_ASroute = model_dijkstra_both_parse_route;
 
   new_component->generic_routing.parse_route = model_dijkstra_both_parse_route;
   new_component->generic_routing.parse_ASroute = model_dijkstra_both_parse_route;
@@ -448,12 +448,12 @@ void model_dijkstra_both_end(AS_t as)
 
   /* Create the topology graph */
   if(!THIS_AS->route_graph)
 
   /* Create the topology graph */
   if(!THIS_AS->route_graph)
-  THIS_AS->route_graph = xbt_graph_new_graph(1, NULL);
+    THIS_AS->route_graph = xbt_graph_new_graph(1, NULL);
   if(!THIS_AS->graph_node_map)
   if(!THIS_AS->graph_node_map)
-  THIS_AS->graph_node_map = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
+    THIS_AS->graph_node_map = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
 
   if (THIS_AS->cached && !THIS_AS->route_cache)
 
   if (THIS_AS->cached && !THIS_AS->route_cache)
-  THIS_AS->route_cache = xbt_dict_new_homogeneous(&route_cache_elem_free);
+    THIS_AS->route_cache = xbt_dict_new_homogeneous(&route_cache_elem_free);
 
   /* Add the loopback if needed */
   if (global_routing->loopback && as->hierarchy == SURF_ROUTING_BASE)
 
   /* Add the loopback if needed */
   if (global_routing->loopback && as->hierarchy == SURF_ROUTING_BASE)
@@ -469,73 +469,73 @@ void model_dijkstra_both_end(AS_t as)
 
 }
 void model_dijkstra_both_parse_route (AS_t asg, const char *src,
 
 }
 void model_dijkstra_both_parse_route (AS_t asg, const char *src,
-                     const char *dst, route_t route)
+    const char *dst, route_t route)
 {
 {
-    int as_route = 0;
+  int as_route = 0;
+  if(!route->dst_gateway && !route->src_gateway)
+    XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
+  else{
+    XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
+        route->src_gateway->name, dst, route->dst_gateway->name);
+    as_route = 1;
+    if(route->dst_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
+      xbt_die("The dst_gateway '%s' does not exist!",route->dst_gateway->name);
+    if(route->src_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
+      xbt_die("The src_gateway '%s' does not exist!",route->src_gateway->name);
+  }
+
+  as_dijkstra_t as = (as_dijkstra_t) asg;
+  network_element_t src_net_elm, dst_net_elm;
+
+  src_net_elm = xbt_lib_get_or_null(host_lib, src, ROUTING_HOST_LEVEL);
+  dst_net_elm = xbt_lib_get_or_null(host_lib, dst, ROUTING_HOST_LEVEL);
+  if (!src_net_elm)
+    src_net_elm = xbt_lib_get_or_null(as_router_lib, src, ROUTING_ASR_LEVEL);
+  if (!dst_net_elm)
+    dst_net_elm = xbt_lib_get_or_null(as_router_lib, dst, ROUTING_ASR_LEVEL);
+
+  xbt_assert(src_net_elm, "Network elements %s not found", src);
+  xbt_assert(dst_net_elm, "Network elements %s not found", dst);
+
+  /* Create the topology graph */
+  if(!as->route_graph)
+    as->route_graph = xbt_graph_new_graph(1, NULL);
+  if(!as->graph_node_map)
+    as->graph_node_map = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
+
+  if (as->cached && !as->route_cache)
+    as->route_cache = xbt_dict_new_homogeneous(&route_cache_elem_free);
+
+  route_t e_route = generic_new_extended_route(asg->hierarchy, route, 1);
+  route_new_dijkstra(as, src_net_elm->id, dst_net_elm->id, e_route);
+
+  // Symmetrical YES
+  if ( (A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES && as_route == 0)
+      || (A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES && as_route == 1)
+  )
+  {
     if(!route->dst_gateway && !route->src_gateway)
     if(!route->dst_gateway && !route->src_gateway)
-      XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
-    else{
-      XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
-             route->src_gateway->name, dst, route->dst_gateway->name);
-      as_route = 1;
-      if(route->dst_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
-          xbt_die("The dst_gateway '%s' does not exist!",route->dst_gateway->name);
-      if(route->src_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
-          xbt_die("The src_gateway '%s' does not exist!",route->src_gateway->name);
-    }
+      XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst, src);
+    else
+      XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
+          route->dst_gateway->name, src, route->src_gateway->name);
+
+    xbt_dynar_t nodes = xbt_graph_get_nodes(as->route_graph);
+    xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src_net_elm->id, xbt_node_t);
+    xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst_net_elm->id, xbt_node_t);
+    xbt_edge_t edge =
+        xbt_graph_get_edge(as->route_graph, node_e_v, node_s_v);
 
 
-       as_dijkstra_t as = (as_dijkstra_t) asg;
-    network_element_t src_net_elm, dst_net_elm;
-
-    src_net_elm = xbt_lib_get_or_null(host_lib, src, ROUTING_HOST_LEVEL);
-    dst_net_elm = xbt_lib_get_or_null(host_lib, dst, ROUTING_HOST_LEVEL);
-    if (!src_net_elm)
-      src_net_elm = xbt_lib_get_or_null(as_router_lib, src, ROUTING_ASR_LEVEL);
-    if (!dst_net_elm)
-      dst_net_elm = xbt_lib_get_or_null(as_router_lib, dst, ROUTING_ASR_LEVEL);
-
-    xbt_assert(src_net_elm, "Network elements %s not found", src);
-    xbt_assert(dst_net_elm, "Network elements %s not found", dst);
-
-    /* Create the topology graph */
-       if(!as->route_graph)
-       as->route_graph = xbt_graph_new_graph(1, NULL);
-       if(!as->graph_node_map)
-       as->graph_node_map = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
-
-       if (as->cached && !as->route_cache)
-       as->route_cache = xbt_dict_new_homogeneous(&route_cache_elem_free);
-
-       route_t e_route = generic_new_extended_route(asg->hierarchy, route, 1);
-       route_new_dijkstra(as, src_net_elm->id, dst_net_elm->id, e_route);
-
-       // Symmetrical YES
-    if ( (A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES && as_route == 0)
-         || (A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES && as_route == 1)
-       )
-    {
-      if(!route->dst_gateway && !route->src_gateway)
-        XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst, src);
-      else
-        XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
-               route->dst_gateway->name, src, route->src_gateway->name);
-
-      xbt_dynar_t nodes = xbt_graph_get_nodes(as->route_graph);
-      xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src_net_elm->id, xbt_node_t);
-      xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst_net_elm->id, xbt_node_t);
-      xbt_edge_t edge =
-          xbt_graph_get_edge(as->route_graph, node_e_v, node_s_v);
-
-      if (edge)
-        THROWF(arg_error,0,"(AS)Route from '%s' to '%s' already exists",src,dst);
-
-      if (route->dst_gateway && route->src_gateway) {
-        network_element_t gw_tmp;
-        gw_tmp = route->src_gateway;
-        route->src_gateway = route->dst_gateway;
-        route->dst_gateway = gw_tmp;
-      }
-      route_t link_route_back = generic_new_extended_route(asg->hierarchy, route, 0);
-      route_new_dijkstra(as, dst_net_elm->id, src_net_elm->id, link_route_back);
+    if (edge)
+      THROWF(arg_error,0,"(AS)Route from '%s' to '%s' already exists",src,dst);
+
+    if (route->dst_gateway && route->src_gateway) {
+      network_element_t gw_tmp;
+      gw_tmp = route->src_gateway;
+      route->src_gateway = route->dst_gateway;
+      route->dst_gateway = gw_tmp;
     }
     }
+    route_t link_route_back = generic_new_extended_route(asg->hierarchy, route, 0);
+    route_new_dijkstra(as, dst_net_elm->id, src_net_elm->id, link_route_back);
+  }
 }
 }
index 6ee25f3..d0ecbd4 100644 (file)
@@ -96,9 +96,9 @@ static void floyd_get_route_and_latency(AS_t asg, network_element_t src, network
     if (pred == -1)             /* if no pred in route -> no route to host */
       break;
     xbt_assert(TO_FLOYD_LINK(pred, prev_pred),
     if (pred == -1)             /* if no pred in route -> no route to host */
       break;
     xbt_assert(TO_FLOYD_LINK(pred, prev_pred),
-                "Invalid link for the route between \"%s\" or \"%s\"",
-                src->name,
-                dst->name);
+        "Invalid link for the route between \"%s\" or \"%s\"",
+        src->name,
+        dst->name);
 
     prev_gw_src = gw_src;
 
 
     prev_gw_src = gw_src;
 
@@ -182,62 +182,62 @@ AS_t model_floyd_create(void)
 void model_floyd_end(AS_t current_routing)
 {
 
 void model_floyd_end(AS_t current_routing)
 {
 
-       as_floyd_t as =
-         ((as_floyd_t) current_routing);
-
-       unsigned int i, j, a, b, c;
-
-       /* set the size of table routing */
-       size_t table_size = xbt_dynar_length(as->generic_routing.index_network_elm);
-
-       if(!as->link_table)
-       {
-               /* Create Cost, Predecessor and Link tables */
-               as->cost_table = xbt_new0(double, table_size * table_size);       /* link cost from host to host */
-               as->predecessor_table = xbt_new0(int, table_size * table_size);  /* predecessor host numbers */
-               as->link_table = xbt_new0(route_t, table_size * table_size);    /* actual link between src and dst */
-
-               /* Initialize costs and predecessors */
-               for (i = 0; i < table_size; i++)
-               for (j = 0; j < table_size; j++) {
-                 TO_FLOYD_COST(i, j) = DBL_MAX;
-                 TO_FLOYD_PRED(i, j) = -1;
-                 TO_FLOYD_LINK(i, j) = NULL;       /* fixed, missing in the previous version */
-               }
-       }
-
-       /* Add the loopback if needed */
-       if (global_routing->loopback && current_routing->hierarchy == SURF_ROUTING_BASE) {
-               for (i = 0; i < table_size; i++) {
-                 route_t e_route = TO_FLOYD_LINK(i, i);
-                 if (!e_route) {
-                       e_route = xbt_new0(s_route_t, 1);
-                       e_route->src_gateway = NULL;
-                       e_route->dst_gateway = NULL;
-                       e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
-                       xbt_dynar_push(e_route->link_list, &global_routing->loopback);
-                       TO_FLOYD_LINK(i, i) = e_route;
-                       TO_FLOYD_PRED(i, i) = i;
-                       TO_FLOYD_COST(i, i) = 1;
-                 }
-               }
-       }
-       /* Calculate path costs */
-       for (c = 0; c < table_size; c++) {
-               for (a = 0; a < table_size; a++) {
-                 for (b = 0; b < table_size; b++) {
-                       if (TO_FLOYD_COST(a, c) < DBL_MAX && TO_FLOYD_COST(c, b) < DBL_MAX) {
-                         if (TO_FLOYD_COST(a, b) == DBL_MAX ||
-                                 (TO_FLOYD_COST(a, c) + TO_FLOYD_COST(c, b) <
-                                  TO_FLOYD_COST(a, b))) {
-                               TO_FLOYD_COST(a, b) =
-                                       TO_FLOYD_COST(a, c) + TO_FLOYD_COST(c, b);
-                               TO_FLOYD_PRED(a, b) = TO_FLOYD_PRED(c, b);
-                         }
-                       }
-                 }
-               }
-       }
+  as_floyd_t as =
+      ((as_floyd_t) current_routing);
+
+  unsigned int i, j, a, b, c;
+
+  /* set the size of table routing */
+  size_t table_size = xbt_dynar_length(as->generic_routing.index_network_elm);
+
+  if(!as->link_table)
+  {
+    /* Create Cost, Predecessor and Link tables */
+    as->cost_table = xbt_new0(double, table_size * table_size);       /* link cost from host to host */
+    as->predecessor_table = xbt_new0(int, table_size * table_size);  /* predecessor host numbers */
+    as->link_table = xbt_new0(route_t, table_size * table_size);    /* actual link between src and dst */
+
+    /* Initialize costs and predecessors */
+    for (i = 0; i < table_size; i++)
+      for (j = 0; j < table_size; j++) {
+        TO_FLOYD_COST(i, j) = DBL_MAX;
+        TO_FLOYD_PRED(i, j) = -1;
+        TO_FLOYD_LINK(i, j) = NULL;       /* fixed, missing in the previous version */
+      }
+  }
+
+  /* Add the loopback if needed */
+  if (global_routing->loopback && current_routing->hierarchy == SURF_ROUTING_BASE) {
+    for (i = 0; i < table_size; i++) {
+      route_t e_route = TO_FLOYD_LINK(i, i);
+      if (!e_route) {
+        e_route = xbt_new0(s_route_t, 1);
+        e_route->src_gateway = NULL;
+        e_route->dst_gateway = NULL;
+        e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
+        xbt_dynar_push(e_route->link_list, &global_routing->loopback);
+        TO_FLOYD_LINK(i, i) = e_route;
+        TO_FLOYD_PRED(i, i) = i;
+        TO_FLOYD_COST(i, i) = 1;
+      }
+    }
+  }
+  /* Calculate path costs */
+  for (c = 0; c < table_size; c++) {
+    for (a = 0; a < table_size; a++) {
+      for (b = 0; b < table_size; b++) {
+        if (TO_FLOYD_COST(a, c) < DBL_MAX && TO_FLOYD_COST(c, b) < DBL_MAX) {
+          if (TO_FLOYD_COST(a, b) == DBL_MAX ||
+              (TO_FLOYD_COST(a, c) + TO_FLOYD_COST(c, b) <
+                  TO_FLOYD_COST(a, b))) {
+            TO_FLOYD_COST(a, b) =
+                TO_FLOYD_COST(a, c) + TO_FLOYD_COST(c, b);
+            TO_FLOYD_PRED(a, b) = TO_FLOYD_PRED(c, b);
+          }
+        }
+      }
+    }
+  }
 }
 
 static int floyd_pointer_resource_cmp(const void *a, const void *b) {
 }
 
 static int floyd_pointer_resource_cmp(const void *a, const void *b) {
@@ -247,128 +247,128 @@ static int floyd_pointer_resource_cmp(const void *a, const void *b) {
 //FIXME: kill dupplicates in next function with full routing
 
 void model_floyd_parse_route(AS_t rc, const char *src,
 //FIXME: kill dupplicates in next function with full routing
 
 void model_floyd_parse_route(AS_t rc, const char *src,
-        const char *dst, route_t route)
+    const char *dst, route_t route)
 {
 {
-    int as_route = 0;
-    as_floyd_t as = (as_floyd_t) rc;
-
-       /* set the size of table routing */
-       size_t table_size = xbt_dynar_length(rc->index_network_elm);
-    network_element_t src_net_elm, dst_net_elm;
-
-    src_net_elm = xbt_lib_get_or_null(host_lib, src, ROUTING_HOST_LEVEL);
-    dst_net_elm = xbt_lib_get_or_null(host_lib, dst, ROUTING_HOST_LEVEL);
-    if (!src_net_elm)
-      src_net_elm = xbt_lib_get_or_null(as_router_lib, src, ROUTING_ASR_LEVEL);
-    if (!dst_net_elm)
-      dst_net_elm = xbt_lib_get_or_null(as_router_lib, dst, ROUTING_ASR_LEVEL);
-
-       xbt_assert(src_net_elm, "Network elements %s not found", src);
-       xbt_assert(dst_net_elm, "Network elements %s not found", dst);
-
-       if(!as->link_table)
-       {
-          int i,j;
-               /* Create Cost, Predecessor and Link tables */
-               as->cost_table = xbt_new0(double, table_size * table_size);       /* link cost from host to host */
-               as->predecessor_table = xbt_new0(int, table_size * table_size);  /* predecessor host numbers */
-               as->link_table = xbt_new0(route_t, table_size * table_size);    /* actual link between src and dst */
-
-               /* Initialize costs and predecessors */
-               for (i = 0; i < table_size; i++)
-               for (j = 0; j < table_size; j++) {
-                 TO_FLOYD_COST(i, j) = DBL_MAX;
-                 TO_FLOYD_PRED(i, j) = -1;
-                 TO_FLOYD_LINK(i, j) = NULL;       /* fixed, missing in the previous version */
-               }
-       }
-    if(!route->dst_gateway && !route->src_gateway)
-      XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
-    else{
-        as_route = 1;
-        XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
-             route->src_gateway->name, dst, route->dst_gateway->name);
-        if(route->dst_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
-            xbt_die("The dst_gateway '%s' does not exist!",route->dst_gateway->name);
-        if(route->src_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
-            xbt_die("The src_gateway '%s' does not exist!",route->src_gateway->name);
+  int as_route = 0;
+  as_floyd_t as = (as_floyd_t) rc;
+
+  /* set the size of table routing */
+  size_t table_size = xbt_dynar_length(rc->index_network_elm);
+  network_element_t src_net_elm, dst_net_elm;
+
+  src_net_elm = xbt_lib_get_or_null(host_lib, src, ROUTING_HOST_LEVEL);
+  dst_net_elm = xbt_lib_get_or_null(host_lib, dst, ROUTING_HOST_LEVEL);
+  if (!src_net_elm)
+    src_net_elm = xbt_lib_get_or_null(as_router_lib, src, ROUTING_ASR_LEVEL);
+  if (!dst_net_elm)
+    dst_net_elm = xbt_lib_get_or_null(as_router_lib, dst, ROUTING_ASR_LEVEL);
+
+  xbt_assert(src_net_elm, "Network elements %s not found", src);
+  xbt_assert(dst_net_elm, "Network elements %s not found", dst);
+
+  if(!as->link_table)
+  {
+    int i,j;
+    /* Create Cost, Predecessor and Link tables */
+    as->cost_table = xbt_new0(double, table_size * table_size);       /* link cost from host to host */
+    as->predecessor_table = xbt_new0(int, table_size * table_size);  /* predecessor host numbers */
+    as->link_table = xbt_new0(route_t, table_size * table_size);    /* actual link between src and dst */
+
+    /* Initialize costs and predecessors */
+    for (i = 0; i < table_size; i++)
+      for (j = 0; j < table_size; j++) {
+        TO_FLOYD_COST(i, j) = DBL_MAX;
+        TO_FLOYD_PRED(i, j) = -1;
+        TO_FLOYD_LINK(i, j) = NULL;       /* fixed, missing in the previous version */
+      }
+  }
+  if(!route->dst_gateway && !route->src_gateway)
+    XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
+  else{
+    as_route = 1;
+    XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", src,
+        route->src_gateway->name, dst, route->dst_gateway->name);
+    if(route->dst_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
+      xbt_die("The dst_gateway '%s' does not exist!",route->dst_gateway->name);
+    if(route->src_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
+      xbt_die("The src_gateway '%s' does not exist!",route->src_gateway->name);
+  }
+
+  if(TO_FLOYD_LINK(src_net_elm->id, dst_net_elm->id))
+  {
+
+    char * link_name;
+    unsigned int cpt;
+    xbt_dynar_t link_route_to_test = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
+    xbt_dynar_foreach(route->link_list,cpt,link_name)
+    {
+      void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
+      xbt_assert(link,"Link : '%s' doesn't exists.",link_name);
+      xbt_dynar_push(link_route_to_test,&link);
     }
     }
+    xbt_assert(!xbt_dynar_compare(
+        (void*)TO_FLOYD_LINK(src_net_elm->id, dst_net_elm->id)->link_list,
+        (void*)link_route_to_test,
+        (int_f_cpvoid_cpvoid_t) floyd_pointer_resource_cmp),
+        "The route between \"%s\" and \"%s\" already exists", src,dst);
+  }
+  else
+  {
+    TO_FLOYD_LINK(src_net_elm->id, dst_net_elm->id) =
+        generic_new_extended_route(rc->hierarchy, route, 1);
+    TO_FLOYD_PRED(src_net_elm->id, dst_net_elm->id) = src_net_elm->id;
+    TO_FLOYD_COST(src_net_elm->id, dst_net_elm->id) =
+        ((TO_FLOYD_LINK(src_net_elm->id, dst_net_elm->id))->link_list)->used;   /* count of links, old model assume 1 */
+  }
+
+  if ( (A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES && as_route == 0)
+      || (A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES && as_route == 1)
+  )
+  {
+    if(TO_FLOYD_LINK(dst_net_elm->id, src_net_elm->id))
+    {
+      if(!route->dst_gateway && !route->src_gateway)
+        XBT_DEBUG("See Route from \"%s\" to \"%s\"", dst, src);
+      else
+        XBT_DEBUG("See ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
+            route->src_gateway->name, src, route->dst_gateway->name);
+      char * link_name;
+      unsigned int i;
+      xbt_dynar_t link_route_to_test = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
+      for(i=xbt_dynar_length(route->link_list) ;i>0 ;i--)
+      {
+        link_name = xbt_dynar_get_as(route->link_list,i-1,void *);
+        void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
+        xbt_assert(link,"Link : '%s' doesn't exists.",link_name);
+        xbt_dynar_push(link_route_to_test,&link);
+      }
+      xbt_assert(!xbt_dynar_compare(
+          (void*)TO_FLOYD_LINK(dst_net_elm->id, src_net_elm->id)->link_list,
+          (void*)link_route_to_test,
+          (int_f_cpvoid_cpvoid_t) floyd_pointer_resource_cmp),
+          "The route between \"%s\" and \"%s\" already exists", src,dst);
+    }
+    else
+    {
+      if(route->dst_gateway && route->src_gateway)
+      {
+        network_element_t gw_src = route->src_gateway;
+        network_element_t gw_dst = route->dst_gateway;
+        route->src_gateway = gw_dst;
+        route->dst_gateway = gw_src;
+      }
 
 
-       if(TO_FLOYD_LINK(src_net_elm->id, dst_net_elm->id))
-       {
-
-               char * link_name;
-               unsigned int cpt;
-               xbt_dynar_t link_route_to_test = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
-               xbt_dynar_foreach(route->link_list,cpt,link_name)
-               {
-                       void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
-                       xbt_assert(link,"Link : '%s' doesn't exists.",link_name);
-                       xbt_dynar_push(link_route_to_test,&link);
-               }
-               xbt_assert(!xbt_dynar_compare(
-                         (void*)TO_FLOYD_LINK(src_net_elm->id, dst_net_elm->id)->link_list,
-                         (void*)link_route_to_test,
-                         (int_f_cpvoid_cpvoid_t) floyd_pointer_resource_cmp),
-                         "The route between \"%s\" and \"%s\" already exists", src,dst);
-       }
-       else
-       {
-           TO_FLOYD_LINK(src_net_elm->id, dst_net_elm->id) =
-                       generic_new_extended_route(rc->hierarchy, route, 1);
-           TO_FLOYD_PRED(src_net_elm->id, dst_net_elm->id) = src_net_elm->id;
-           TO_FLOYD_COST(src_net_elm->id, dst_net_elm->id) =
-                       ((TO_FLOYD_LINK(src_net_elm->id, dst_net_elm->id))->link_list)->used;   /* count of links, old model assume 1 */
-       }
-
-    if ( (A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES && as_route == 0)
-         || (A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES && as_route == 1)
-       )
-       {
-               if(TO_FLOYD_LINK(dst_net_elm->id, src_net_elm->id))
-               {
-                       if(!route->dst_gateway && !route->src_gateway)
-                         XBT_DEBUG("See Route from \"%s\" to \"%s\"", dst, src);
-                       else
-                         XBT_DEBUG("See ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
-                                        route->src_gateway->name, src, route->dst_gateway->name);
-                       char * link_name;
-                       unsigned int i;
-                       xbt_dynar_t link_route_to_test = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
-                       for(i=xbt_dynar_length(route->link_list) ;i>0 ;i--)
-                       {
-                               link_name = xbt_dynar_get_as(route->link_list,i-1,void *);
-                               void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
-                               xbt_assert(link,"Link : '%s' doesn't exists.",link_name);
-                               xbt_dynar_push(link_route_to_test,&link);
-                       }
-                       xbt_assert(!xbt_dynar_compare(
-                                 (void*)TO_FLOYD_LINK(dst_net_elm->id, src_net_elm->id)->link_list,
-                             (void*)link_route_to_test,
-                                 (int_f_cpvoid_cpvoid_t) floyd_pointer_resource_cmp),
-                                 "The route between \"%s\" and \"%s\" already exists", src,dst);
-               }
-               else
-               {
-                       if(route->dst_gateway && route->src_gateway)
-                       {
-                         network_element_t gw_src = route->src_gateway;
-                         network_element_t gw_dst = route->dst_gateway;
-                          route->src_gateway = gw_dst;
-                          route->dst_gateway = gw_src;
-                       }
-
-                       if(!route->dst_gateway && !route->src_gateway)
-                         XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst, src);
-                       else
-                         XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
-                                        route->src_gateway->name, src, route->dst_gateway->name);
-
-                   TO_FLOYD_LINK(dst_net_elm->id, src_net_elm->id) =
-                               generic_new_extended_route(rc->hierarchy, route, 0);
-                   TO_FLOYD_PRED(dst_net_elm->id, src_net_elm->id) = dst_net_elm->id;
-                   TO_FLOYD_COST(dst_net_elm->id, src_net_elm->id) =
-                               ((TO_FLOYD_LINK(dst_net_elm->id, src_net_elm->id))->link_list)->used;   /* count of links, old model assume 1 */
-               }
-       }
+      if(!route->dst_gateway && !route->src_gateway)
+        XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst, src);
+      else
+        XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
+            route->src_gateway->name, src, route->dst_gateway->name);
+
+      TO_FLOYD_LINK(dst_net_elm->id, src_net_elm->id) =
+          generic_new_extended_route(rc->hierarchy, route, 0);
+      TO_FLOYD_PRED(dst_net_elm->id, src_net_elm->id) = dst_net_elm->id;
+      TO_FLOYD_COST(dst_net_elm->id, src_net_elm->id) =
+          ((TO_FLOYD_LINK(dst_net_elm->id, src_net_elm->id))->link_list)->used;   /* count of links, old model assume 1 */
+    }
+  }
 }
 }
index 40c1c97..9e1b99c 100644 (file)
@@ -60,7 +60,7 @@ static xbt_dynar_t full_get_onelink_routes(AS_t rc)
 
 static void full_get_route_and_latency(AS_t rc,
     network_element_t src, network_element_t dst,
 
 static void full_get_route_and_latency(AS_t rc,
     network_element_t src, network_element_t dst,
-                                       route_t res, double *lat)
+    route_t res, double *lat)
 {
   XBT_DEBUG("full_get_route_and_latency from %s[%d] to %s[%d]",
       src->name,
 {
   XBT_DEBUG("full_get_route_and_latency from %s[%d] to %s[%d]",
       src->name,
@@ -109,7 +109,7 @@ static void full_finalize(AS_t rc)
 AS_t model_full_create(void)
 {
   routing_component_full_t new_component = (routing_component_full_t)
 AS_t model_full_create(void)
 {
   routing_component_full_t new_component = (routing_component_full_t)
-      model_generic_create_sized(sizeof(s_routing_component_full_t));
+          model_generic_create_sized(sizeof(s_routing_component_full_t));
 
   new_component->generic_routing.parse_route = model_full_set_route;
   new_component->generic_routing.parse_ASroute = model_full_set_route;
 
   new_component->generic_routing.parse_route = model_full_set_route;
   new_component->generic_routing.parse_ASroute = model_full_set_route;
@@ -157,7 +157,7 @@ static int full_pointer_resource_cmp(const void *a, const void *b)
 }
 
 void model_full_set_route(AS_t rc, const char *src,
 }
 
 void model_full_set_route(AS_t rc, const char *src,
-                          const char *dst, route_t route)
+    const char *dst, route_t route)
 {
   network_element_t src_net_elm, dst_net_elm;
   int as_route = 0;
 {
   network_element_t src_net_elm, dst_net_elm;
   int as_route = 0;
@@ -175,8 +175,8 @@ void model_full_set_route(AS_t rc, const char *src,
   size_t table_size = xbt_dynar_length(routing->generic_routing.index_network_elm);
 
   xbt_assert(!xbt_dynar_is_empty(route->link_list),
   size_t table_size = xbt_dynar_length(routing->generic_routing.index_network_elm);
 
   xbt_assert(!xbt_dynar_is_empty(route->link_list),
-             "Invalid count of links, must be greater than zero (%s,%s)",
-             src, dst);
+      "Invalid count of links, must be greater than zero (%s,%s)",
+      src, dst);
 
   if (!routing->routing_table)
     routing->routing_table = xbt_new0(route_t, table_size * table_size);
 
   if (!routing->routing_table)
     routing->routing_table = xbt_new0(route_t, table_size * table_size);
@@ -192,49 +192,49 @@ void model_full_set_route(AS_t rc, const char *src,
       xbt_dynar_push(link_route_to_test, &link);
     }
     if (xbt_dynar_compare(TO_ROUTE_FULL(src_net_elm->id, dst_net_elm->id)->link_list,
       xbt_dynar_push(link_route_to_test, &link);
     }
     if (xbt_dynar_compare(TO_ROUTE_FULL(src_net_elm->id, dst_net_elm->id)->link_list,
-                          link_route_to_test, full_pointer_resource_cmp)) {
+        link_route_to_test, full_pointer_resource_cmp)) {
       surf_parse_error("A route between \"%s\" and \"%s\" already exists "
       surf_parse_error("A route between \"%s\" and \"%s\" already exists "
-                       "with a different content. "
-                       "If you are trying to define a reverse route, "
-                       "you must set the symmetrical=no attribute to "
-                       "your routes tags.", src, dst);
+          "with a different content. "
+          "If you are trying to define a reverse route, "
+          "you must set the symmetrical=no attribute to "
+          "your routes tags.", src, dst);
     } else {
       surf_parse_warn("Ignoring the identical redefinition of the route "
     } else {
       surf_parse_warn("Ignoring the identical redefinition of the route "
-                      "between \"%s\" and \"%s\"", src, dst);
+          "between \"%s\" and \"%s\"", src, dst);
     }
   } else {
     if (!route->dst_gateway && !route->src_gateway)
       XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
     else {
     }
   } else {
     if (!route->dst_gateway && !route->src_gateway)
       XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
     else {
-// FIXME We can call a gw wich is down the current AS (cf g5k.xml) but not upper.
-//      AS_t subas = xbt_dict_get_or_null(rc->routing_sons, src);
-//      if (subas == NULL)
-//        surf_parse_error("The source of an ASroute must be a sub-AS "
-//                         "declared within the current AS, "
-//                         "but '%s' is not an AS within '%s'", src, rc->name);
-//      if (subas->to_index
-//          && xbt_dict_get_or_null(subas->to_index, route->src_gateway) == NULL)
-//        surf_parse_error("In an ASroute, source gateway must be part of "
-//                         "the source sub-AS (in particular, being in a "
-//                         "sub-sub-AS is not allowed), "
-//                         "but '%s' is not in '%s'.",
-//                         route->src_gateway, subas->name);
-//
-//      subas = xbt_dict_get_or_null(rc->routing_sons, dst);
-//      if (subas == NULL)
-//        surf_parse_error("The destination of an ASroute must be a sub-AS "
-//                         "declared within the current AS, "
-//                         "but '%s' is not an AS within '%s'", dst, rc->name);
-//      if (subas->to_index
-//          && xbt_dict_get_or_null(subas->to_index, route->dst_gateway) == NULL)
-//        surf_parse_error("In an ASroute, destination gateway must be "
-//                         "part of the destination sub-AS (in particular, "
-//                         "in a sub-sub-AS is not allowed), "
-//                         "but '%s' is not in '%s'.",
-//                         route->dst_gateway, subas->name);
+      // FIXME We can call a gw wich is down the current AS (cf g5k.xml) but not upper.
+      //      AS_t subas = xbt_dict_get_or_null(rc->routing_sons, src);
+      //      if (subas == NULL)
+      //        surf_parse_error("The source of an ASroute must be a sub-AS "
+      //                         "declared within the current AS, "
+      //                         "but '%s' is not an AS within '%s'", src, rc->name);
+      //      if (subas->to_index
+      //          && xbt_dict_get_or_null(subas->to_index, route->src_gateway) == NULL)
+      //        surf_parse_error("In an ASroute, source gateway must be part of "
+      //                         "the source sub-AS (in particular, being in a "
+      //                         "sub-sub-AS is not allowed), "
+      //                         "but '%s' is not in '%s'.",
+      //                         route->src_gateway, subas->name);
+      //
+      //      subas = xbt_dict_get_or_null(rc->routing_sons, dst);
+      //      if (subas == NULL)
+      //        surf_parse_error("The destination of an ASroute must be a sub-AS "
+      //                         "declared within the current AS, "
+      //                         "but '%s' is not an AS within '%s'", dst, rc->name);
+      //      if (subas->to_index
+      //          && xbt_dict_get_or_null(subas->to_index, route->dst_gateway) == NULL)
+      //        surf_parse_error("In an ASroute, destination gateway must be "
+      //                         "part of the destination sub-AS (in particular, "
+      //                         "in a sub-sub-AS is not allowed), "
+      //                         "but '%s' is not in '%s'.",
+      //                         route->dst_gateway, subas->name);
       as_route = 1;
       XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"",
       as_route = 1;
       XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"",
-                src, route->src_gateway->name, dst, route->dst_gateway->name);
+          src, route->src_gateway->name, dst, route->dst_gateway->name);
       if (route->dst_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
         xbt_die("The dst_gateway '%s' does not exist!", route->dst_gateway->name);
       if (route->src_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
       if (route->dst_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
         xbt_die("The dst_gateway '%s' does not exist!", route->dst_gateway->name);
       if (route->src_gateway->rc_type == SURF_NETWORK_ELEMENT_NULL)
@@ -246,8 +246,8 @@ void model_full_set_route(AS_t rc, const char *src,
   }
 
   if ( (A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES && as_route == 0)
   }
 
   if ( (A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES && as_route == 0)
-       || (A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES && as_route == 1)
-     ) {
+      || (A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES && as_route == 1)
+  ) {
     if (route->dst_gateway && route->src_gateway) {
       network_element_t gw_tmp;
       gw_tmp = route->src_gateway;
     if (route->dst_gateway && route->src_gateway) {
       network_element_t gw_tmp;
       gw_tmp = route->src_gateway;
@@ -266,16 +266,16 @@ void model_full_set_route(AS_t rc, const char *src,
         xbt_dynar_push(link_route_to_test, &link);
       }
       xbt_assert(!xbt_dynar_compare(TO_ROUTE_FULL(dst_net_elm->id, src_net_elm->id)->link_list,
         xbt_dynar_push(link_route_to_test, &link);
       }
       xbt_assert(!xbt_dynar_compare(TO_ROUTE_FULL(dst_net_elm->id, src_net_elm->id)->link_list,
-                                    link_route_to_test,
-                                    full_pointer_resource_cmp),
-                 "The route between \"%s\" and \"%s\" already exists", src,
-                 dst);
+          link_route_to_test,
+          full_pointer_resource_cmp),
+          "The route between \"%s\" and \"%s\" already exists", src,
+          dst);
     } else {
       if (!route->dst_gateway && !route->src_gateway)
         XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst, src);
       else
         XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"",
     } else {
       if (!route->dst_gateway && !route->src_gateway)
         XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dst, src);
       else
         XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"",
-                  dst, route->src_gateway->name, src, route->dst_gateway->name);
+            dst, route->src_gateway->name, src, route->dst_gateway->name);
       TO_ROUTE_FULL(dst_net_elm->id, src_net_elm->id) =
           generic_new_extended_route(rc->hierarchy, route, 0);
       xbt_dynar_shrink(TO_ROUTE_FULL(dst_net_elm->id, src_net_elm->id)->link_list, 0);
       TO_ROUTE_FULL(dst_net_elm->id, src_net_elm->id) =
           generic_new_extended_route(rc->hierarchy, route, 0);
       xbt_dynar_shrink(TO_ROUTE_FULL(dst_net_elm->id, src_net_elm->id)->link_list, 0);
index 143f981..0660db8 100644 (file)
@@ -53,8 +53,8 @@ int generic_parse_AS(AS_t as, network_element_t elm)
 }
 
 void generic_parse_bypassroute(AS_t rc,
 }
 
 void generic_parse_bypassroute(AS_t rc,
-                             const char *src, const char *dst,
-                             route_t e_route)
+    const char *src, const char *dst,
+    route_t e_route)
 {
   if(e_route->dst_gateway)
     XBT_DEBUG("Load bypassASroute from \"%s\" to \"%s\"", src, dst);
 {
   if(e_route->dst_gateway)
     XBT_DEBUG("Load bypassASroute from \"%s\" to \"%s\"", src, dst);
@@ -65,11 +65,11 @@ void generic_parse_bypassroute(AS_t rc,
 
   route_name = bprintf("%s#%s", src, dst);
   xbt_assert(!xbt_dynar_is_empty(e_route->link_list),
 
   route_name = bprintf("%s#%s", src, dst);
   xbt_assert(!xbt_dynar_is_empty(e_route->link_list),
-             "Invalid count of links, must be greater than zero (%s,%s)",
-             src, dst);
+      "Invalid count of links, must be greater than zero (%s,%s)",
+      src, dst);
   xbt_assert(!xbt_dict_get_or_null(dict_bypassRoutes, route_name),
   xbt_assert(!xbt_dict_get_or_null(dict_bypassRoutes, route_name),
-             "The bypass route between \"%s\"(\"%s\") and \"%s\"(\"%s\") already exists",
-             src, e_route->src_gateway->name, dst, e_route->dst_gateway->name);
+      "The bypass route between \"%s\"(\"%s\") and \"%s\"(\"%s\") already exists",
+      src, e_route->src_gateway->name, dst, e_route->dst_gateway->name);
 
   route_t new_e_route = NULL;
   if(e_route->dst_gateway)
 
   route_t new_e_route = NULL;
   if(e_route->dst_gateway)
@@ -121,7 +121,7 @@ route_t generic_get_bypassroute(AS_t rc, network_element_t src, network_element_
 
     if (src == NULL || dst == NULL)
       xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
 
     if (src == NULL || dst == NULL)
       xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
-              src->name, dst->name, rc->name);
+          src->name, dst->name, rc->name);
 
     src_as = src->rc_component;
     dst_as = dst->rc_component;
 
     src_as = src->rc_component;
     dst_as = dst->rc_component;
@@ -164,10 +164,10 @@ route_t generic_get_bypassroute(AS_t rc, network_element_t src, network_element_
       for (i = 0; i < max; i++) {
         if (i <= max_index_src && max <= max_index_dst) {
           char *route_name = bprintf("%s#%s",
       for (i = 0; i < max; i++) {
         if (i <= max_index_src && max <= max_index_dst) {
           char *route_name = bprintf("%s#%s",
-                                     (*(AS_t *)
-                                      (xbt_dynar_get_ptr(path_src, i)))->name,
-                                     (*(AS_t *)
-                                      (xbt_dynar_get_ptr(path_dst, max)))->name);
+              (*(AS_t *)
+                  (xbt_dynar_get_ptr(path_src, i)))->name,
+                  (*(AS_t *)
+                      (xbt_dynar_get_ptr(path_dst, max)))->name);
           e_route_bypass = xbt_dict_get_or_null(dict_bypassRoutes, route_name);
           xbt_free(route_name);
         }
           e_route_bypass = xbt_dict_get_or_null(dict_bypassRoutes, route_name);
           xbt_free(route_name);
         }
@@ -175,10 +175,10 @@ route_t generic_get_bypassroute(AS_t rc, network_element_t src, network_element_
           break;
         if (max <= max_index_src && i <= max_index_dst) {
           char *route_name = bprintf("%s#%s",
           break;
         if (max <= max_index_src && i <= max_index_dst) {
           char *route_name = bprintf("%s#%s",
-                                     (*(AS_t *)
-                                      (xbt_dynar_get_ptr(path_src, max)))->name,
-                                     (*(AS_t *)
-                                      (xbt_dynar_get_ptr(path_dst, i)))->name);
+              (*(AS_t *)
+                  (xbt_dynar_get_ptr(path_src, max)))->name,
+                  (*(AS_t *)
+                      (xbt_dynar_get_ptr(path_dst, i)))->name);
           e_route_bypass = xbt_dict_get_or_null(dict_bypassRoutes, route_name);
           xbt_free(route_name);
         }
           e_route_bypass = xbt_dict_get_or_null(dict_bypassRoutes, route_name);
           xbt_free(route_name);
         }
@@ -191,10 +191,10 @@ route_t generic_get_bypassroute(AS_t rc, network_element_t src, network_element_
 
       if (max <= max_index_src && max <= max_index_dst) {
         char *route_name = bprintf("%s#%s",
 
       if (max <= max_index_src && max <= max_index_dst) {
         char *route_name = bprintf("%s#%s",
-                                   (*(AS_t *)
-                                    (xbt_dynar_get_ptr(path_src, max)))->name,
-                                   (*(AS_t *)
-                                    (xbt_dynar_get_ptr(path_dst, max)))->name);
+            (*(AS_t *)
+                (xbt_dynar_get_ptr(path_src, max)))->name,
+                (*(AS_t *)
+                    (xbt_dynar_get_ptr(path_dst, max)))->name);
         e_route_bypass = xbt_dict_get_or_null(dict_bypassRoutes, route_name);
         xbt_free(route_name);
       }
         e_route_bypass = xbt_dict_get_or_null(dict_bypassRoutes, route_name);
         xbt_free(route_name);
       }
@@ -230,7 +230,7 @@ route_t generic_get_bypassroute(AS_t rc, network_element_t src, network_element_
 /* change a route containing link names into a route containing link entities */
 route_t
 generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy,
 /* change a route containing link names into a route containing link entities */
 route_t
 generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy,
-                           route_t routearg, int change_order) {
+    route_t routearg, int change_order) {
 
   route_t result;
   char *link_name;
 
   route_t result;
   char *link_name;
@@ -240,8 +240,8 @@ generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy,
   result->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
 
   xbt_assert(hierarchy == SURF_ROUTING_BASE
   result->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
 
   xbt_assert(hierarchy == SURF_ROUTING_BASE
-             || hierarchy == SURF_ROUTING_RECURSIVE,
-             "The hierarchy of this AS is neither BASIC nor RECURSIVE, I'm lost here.");
+      || hierarchy == SURF_ROUTING_RECURSIVE,
+      "The hierarchy of this AS is neither BASIC nor RECURSIVE, I'm lost here.");
 
   if (hierarchy == SURF_ROUTING_RECURSIVE) {
 
 
   if (hierarchy == SURF_ROUTING_RECURSIVE) {
 
@@ -277,7 +277,7 @@ void generic_free_route(route_t route)
 }
 
 static AS_t generic_as_exist(AS_t find_from,
 }
 
 static AS_t generic_as_exist(AS_t find_from,
-                                            AS_t to_find)
+    AS_t to_find)
 {
   //return to_find; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
   xbt_dict_cursor_t cursor = NULL;
 {
   //return to_find; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
   xbt_dict_cursor_t cursor = NULL;
@@ -303,8 +303,8 @@ generic_autonomous_system_exist(AS_t rc, char *element)
   xbt_dict_cursor_t cursor = NULL;
   char *key;
   element_as = ((network_element_t)
   xbt_dict_cursor_t cursor = NULL;
   char *key;
   element_as = ((network_element_t)
-                xbt_lib_get_or_null(as_router_lib, element,
-                                    ROUTING_ASR_LEVEL))->rc_component;
+      xbt_lib_get_or_null(as_router_lib, element,
+          ROUTING_ASR_LEVEL))->rc_component;
   result = ((AS_t) - 1);
   if (element_as != rc)
     result = generic_as_exist(rc, element_as);
   result = ((AS_t) - 1);
   if (element_as != rc)
     result = generic_as_exist(rc, element_as);
@@ -327,8 +327,8 @@ generic_processing_units_exist(AS_t rc, char *element)
 {
   AS_t element_as;
   element_as = ((network_element_t)
 {
   AS_t element_as;
   element_as = ((network_element_t)
-                xbt_lib_get_or_null(host_lib,
-                                    element, ROUTING_HOST_LEVEL))->rc_component;
+      xbt_lib_get_or_null(host_lib,
+          element, ROUTING_HOST_LEVEL))->rc_component;
   if (element_as == rc)
     return element_as;
   return generic_as_exist(rc, element_as);
   if (element_as == rc)
     return element_as;
   return generic_as_exist(rc, element_as);
@@ -359,10 +359,10 @@ void generic_src_dst_check(AS_t rc, network_element_t src,
 
   if (rc != dst_as)
     xbt_die
 
   if (rc != dst_as)
     xbt_die
-        ("The routing component of src'%s' and dst'%s' is not the same as the network elements belong (%s?=%s?=%s)",
-            src->name,
-            dst->name,
-            src_as->name,
-            dst_as->name,
-            rc->name);
+    ("The routing component of src'%s' and dst'%s' is not the same as the network elements belong (%s?=%s?=%s)",
+        src->name,
+        dst->name,
+        src_as->name,
+        dst_as->name,
+        rc->name);
 }
 }
index 11c7258..788e87a 100644 (file)
@@ -21,7 +21,7 @@ typedef struct {
 
 typedef struct s_rule_route s_rule_route_t, *rule_route_t;
 typedef struct s_rule_route_extended s_rule_route_extended_t,
 
 typedef struct s_rule_route s_rule_route_t, *rule_route_t;
 typedef struct s_rule_route_extended s_rule_route_extended_t,
-    *rule_route_extended_t;
+*rule_route_extended_t;
 
 struct s_rule_route {
   xbt_dynar_t re_str_link;      // dynar of char*
 
 struct s_rule_route {
   xbt_dynar_t re_str_link;      // dynar of char*
@@ -77,8 +77,8 @@ static int model_rulebased_parse_AS(AS_t rc, network_element_t elm)
 }
 
 static void model_rulebased_parse_route(AS_t rc,
 }
 
 static void model_rulebased_parse_route(AS_t rc,
-                                      const char *src, const char *dst,
-                                      route_t route)
+    const char *src, const char *dst,
+    route_t route)
 {
   AS_rulebased_t routing = (AS_rulebased_t) rc;
   rule_route_t ruleroute = xbt_new0(s_rule_route_t, 1);
 {
   AS_rulebased_t routing = (AS_rulebased_t) rc;
   rule_route_t ruleroute = xbt_new0(s_rule_route_t, 1);
@@ -86,18 +86,18 @@ static void model_rulebased_parse_route(AS_t rc,
   int erroffset;
 
   if(!strcmp(rc->model_desc->name,"Vivaldi")){
   int erroffset;
 
   if(!strcmp(rc->model_desc->name,"Vivaldi")){
-         if(!xbt_dynar_is_empty(route->link_list))
-                 xbt_die("You can't have link_ctn with Model Vivaldi.");
+    if(!xbt_dynar_is_empty(route->link_list))
+      xbt_die("You can't have link_ctn with Model Vivaldi.");
   }
 
   ruleroute->re_src = pcre_compile(src, 0, &error, &erroffset, NULL);
   xbt_assert(ruleroute->re_src,
   }
 
   ruleroute->re_src = pcre_compile(src, 0, &error, &erroffset, NULL);
   xbt_assert(ruleroute->re_src,
-              "PCRE compilation failed at offset %d (\"%s\"): %s\n",
-              erroffset, src, error);
+      "PCRE compilation failed at offset %d (\"%s\"): %s\n",
+      erroffset, src, error);
   ruleroute->re_dst = pcre_compile(dst, 0, &error, &erroffset, NULL);
   xbt_assert(ruleroute->re_src,
   ruleroute->re_dst = pcre_compile(dst, 0, &error, &erroffset, NULL);
   xbt_assert(ruleroute->re_src,
-              "PCRE compilation failed at offset %d (\"%s\"): %s\n",
-              erroffset, dst, error);
+      "PCRE compilation failed at offset %d (\"%s\"): %s\n",
+      erroffset, dst, error);
 
   ruleroute->re_str_link = route->link_list;
   route->link_list = NULL; // Don't free it twice in each container
 
   ruleroute->re_str_link = route->link_list;
   route->link_list = NULL; // Don't free it twice in each container
@@ -106,8 +106,8 @@ static void model_rulebased_parse_route(AS_t rc,
 }
 
 static void model_rulebased_parse_ASroute(AS_t rc,
 }
 
 static void model_rulebased_parse_ASroute(AS_t rc,
-                                        const char *src, const char *dst,
-                                        route_t route)
+    const char *src, const char *dst,
+    route_t route)
 {
   AS_rulebased_t routing = (AS_rulebased_t) rc;
   rule_route_extended_t ruleroute_e = xbt_new0(s_rule_route_extended_t, 1);
 {
   AS_rulebased_t routing = (AS_rulebased_t) rc;
   rule_route_extended_t ruleroute_e = xbt_new0(s_rule_route_extended_t, 1);
@@ -115,20 +115,20 @@ static void model_rulebased_parse_ASroute(AS_t rc,
   int erroffset;
 
   if(!strcmp(rc->model_desc->name,"Vivaldi")){
   int erroffset;
 
   if(!strcmp(rc->model_desc->name,"Vivaldi")){
-         if(!xbt_dynar_is_empty(route->link_list))
-                 xbt_die("You can't have link_ctn with Model Vivaldi.");
+    if(!xbt_dynar_is_empty(route->link_list))
+      xbt_die("You can't have link_ctn with Model Vivaldi.");
   }
 
   ruleroute_e->generic_rule_route.re_src =
       pcre_compile(src, 0, &error, &erroffset, NULL);
   xbt_assert(ruleroute_e->generic_rule_route.re_src,
   }
 
   ruleroute_e->generic_rule_route.re_src =
       pcre_compile(src, 0, &error, &erroffset, NULL);
   xbt_assert(ruleroute_e->generic_rule_route.re_src,
-              "PCRE compilation failed at offset %d (\"%s\"): %s\n",
-              erroffset, src, error);
+      "PCRE compilation failed at offset %d (\"%s\"): %s\n",
+      erroffset, src, error);
   ruleroute_e->generic_rule_route.re_dst =
       pcre_compile(dst, 0, &error, &erroffset, NULL);
   xbt_assert(ruleroute_e->generic_rule_route.re_src,
   ruleroute_e->generic_rule_route.re_dst =
       pcre_compile(dst, 0, &error, &erroffset, NULL);
   xbt_assert(ruleroute_e->generic_rule_route.re_src,
-              "PCRE compilation failed at offset %d (\"%s\"): %s\n",
-              erroffset, dst, error);
+      "PCRE compilation failed at offset %d (\"%s\"): %s\n",
+      erroffset, dst, error);
   ruleroute_e->generic_rule_route.re_str_link =
       route->link_list;
   ruleroute_e->re_src_gateway = xbt_strdup((char *)route->src_gateway); // DIRTY HACK possible only
   ruleroute_e->generic_rule_route.re_str_link =
       route->link_list;
   ruleroute_e->re_src_gateway = xbt_strdup((char *)route->src_gateway); // DIRTY HACK possible only
@@ -141,9 +141,9 @@ static void model_rulebased_parse_ASroute(AS_t rc,
 }
 
 static void model_rulebased_parse_bypassroute(AS_t rc,
 }
 
 static void model_rulebased_parse_bypassroute(AS_t rc,
-                                            const char *src,
-                                            const char *dst,
-                                            route_t e_route)
+    const char *src,
+    const char *dst,
+    route_t e_route)
 {
   xbt_die("bypass routing not supported for Route-Based model");
 }
 {
   xbt_die("bypass routing not supported for Route-Based model");
 }
@@ -152,7 +152,7 @@ static void model_rulebased_parse_bypassroute(AS_t rc,
 #define OVECCOUNT 30            /* should be a multiple of 3 */
 
 static char *remplace(char *value, const char **src_list, int src_size,
 #define OVECCOUNT 30            /* should be a multiple of 3 */
 
 static char *remplace(char *value, const char **src_list, int src_size,
-                      const char **dst_list, int dst_size)
+    const char **dst_list, int dst_size)
 {
   char result[BUFFER_SIZE];
   int i_res = 0;
 {
   char result[BUFFER_SIZE];
   int i_res = 0;
@@ -163,7 +163,7 @@ static char *remplace(char *value, const char **src_list, int src_size,
       i++;                      /* skip the '$' */
       if (value[i] < '0' || value[i] > '9')
         xbt_die("bad string parameter, no number indication, at offset: "
       i++;                      /* skip the '$' */
       if (value[i] < '0' || value[i] > '9')
         xbt_die("bad string parameter, no number indication, at offset: "
-                "%d (\"%s\")", i, value);
+            "%d (\"%s\")", i, value);
 
       /* solve the number */
       int number = value[i++] - '0';
 
       /* solve the number */
       int number = value[i++] - '0';
@@ -177,18 +177,18 @@ static char *remplace(char *value, const char **src_list, int src_size,
         param_list = src_list;
         param_size = src_size;
       } else if (value[i] == 'd' && value[i + 1] == 's'
         param_list = src_list;
         param_size = src_size;
       } else if (value[i] == 'd' && value[i + 1] == 's'
-                 && value[i + 2] == 't') {
+          && value[i + 2] == 't') {
         param_list = dst_list;
         param_size = dst_size;
       } else {
         xbt_die("bad string parameter, support only \"src\" and \"dst\", "
         param_list = dst_list;
         param_size = dst_size;
       } else {
         xbt_die("bad string parameter, support only \"src\" and \"dst\", "
-                "at offset: %d (\"%s\")", i, value);
+            "at offset: %d (\"%s\")", i, value);
       }
       i += 3;
 
       xbt_assert(number < param_size,
       }
       i += 3;
 
       xbt_assert(number < param_size,
-                 "bad string parameter, not enough length param_size, "
-                 "at offset: %d (\"%s\") %d %d", i, value, param_size, number);
+          "bad string parameter, not enough length param_size, "
+          "at offset: %d (\"%s\") %d %d", i, value, param_size, number);
 
       const char *param = param_list[number];
       int j = 0;
 
       const char *param = param_list[number];
       int j = 0;
@@ -199,7 +199,7 @@ static char *remplace(char *value, const char **src_list, int src_size,
     }
     if (i_res >= BUFFER_SIZE)
       xbt_die("solving string \"%s\", small buffer size (%d)",
     }
     if (i_res >= BUFFER_SIZE)
       xbt_die("solving string \"%s\", small buffer size (%d)",
-              value, BUFFER_SIZE);
+          value, BUFFER_SIZE);
   }
   result[i_res++] = '\0';
   char *res = xbt_malloc(i_res);
   }
   result[i_res++] = '\0';
   char *res = xbt_malloc(i_res);
@@ -208,13 +208,13 @@ static char *remplace(char *value, const char **src_list, int src_size,
 
 static void rulebased_get_route_and_latency(AS_t rc,
     network_element_t src, network_element_t dst,
 
 static void rulebased_get_route_and_latency(AS_t rc,
     network_element_t src, network_element_t dst,
-                                route_t res,double*lat);
+    route_t res,double*lat);
 static xbt_dynar_t rulebased_get_onelink_routes(AS_t rc)
 {
   xbt_dynar_t ret = xbt_dynar_new (sizeof(onelink_t), xbt_free);
   //We have already bypass cluster routes with network NS3
   if(!strcmp(surf_network_model->name,"network NS3"))
 static xbt_dynar_t rulebased_get_onelink_routes(AS_t rc)
 {
   xbt_dynar_t ret = xbt_dynar_new (sizeof(onelink_t), xbt_free);
   //We have already bypass cluster routes with network NS3
   if(!strcmp(surf_network_model->name,"network NS3"))
-       return ret;
+    return ret;
 
   char *k1;
 
 
   char *k1;
 
@@ -239,20 +239,20 @@ static xbt_dynar_t rulebased_get_onelink_routes(AS_t rc)
     int number_of_links = xbt_dynar_length(route->link_list);
 
     if(number_of_links == 1) {
     int number_of_links = xbt_dynar_length(route->link_list);
 
     if(number_of_links == 1) {
-               //loopback
+      //loopback
     }
     else{
     }
     else{
-               if (number_of_links != 2) {
-                 xbt_die ("rulebased_get_onelink_routes works only if the AS is a cluster, sorry.");
-               }
-
-               void *link_ptr;
-               xbt_dynar_get_cpy (route->link_list, 1, &link_ptr);
-               onelink_t onelink = xbt_new0 (s_onelink_t, 1);
-               onelink->src = host;
-               onelink->dst = router;
-               onelink->link_ptr = link_ptr;
-               xbt_dynar_push (ret, &onelink);
+      if (number_of_links != 2) {
+        xbt_die ("rulebased_get_onelink_routes works only if the AS is a cluster, sorry.");
+      }
+
+      void *link_ptr;
+      xbt_dynar_get_cpy (route->link_list, 1, &link_ptr);
+      onelink_t onelink = xbt_new0 (s_onelink_t, 1);
+      onelink->src = host;
+      onelink->dst = router;
+      onelink->link_ptr = link_ptr;
+      xbt_dynar_push (ret, &onelink);
     }
   }
   return ret;
     }
   }
   return ret;
@@ -261,13 +261,13 @@ static xbt_dynar_t rulebased_get_onelink_routes(AS_t rc)
 /* Business methods */
 static void rulebased_get_route_and_latency(AS_t rc,
     network_element_t src, network_element_t dst,
 /* Business methods */
 static void rulebased_get_route_and_latency(AS_t rc,
     network_element_t src, network_element_t dst,
-                                route_t route, double *lat)
+    route_t route, double *lat)
 {
   XBT_DEBUG("rulebased_get_route_and_latency from '%s' to '%s'",src->name,dst->name);
   xbt_assert(rc && src
 {
   XBT_DEBUG("rulebased_get_route_and_latency from '%s' to '%s'",src->name,dst->name);
   xbt_assert(rc && src
-              && dst,
-              "Invalid params for \"get_route\" function at AS \"%s\"",
-              rc->name);
+      && dst,
+      "Invalid params for \"get_route\" function at AS \"%s\"",
+      rc->name);
 
   /* set utils vars */
   AS_rulebased_t routing = (AS_rulebased_t) rc;
 
   /* set utils vars */
   AS_rulebased_t routing = (AS_rulebased_t) rc;
@@ -302,11 +302,11 @@ static void rulebased_get_route_and_latency(AS_t rc,
   xbt_dynar_foreach(rule_list, cpt, ruleroute) {
     rc_src =
         pcre_exec(ruleroute->re_src, NULL, src_name, src_length, 0, 0,
   xbt_dynar_foreach(rule_list, cpt, ruleroute) {
     rc_src =
         pcre_exec(ruleroute->re_src, NULL, src_name, src_length, 0, 0,
-                  ovector_src, OVECCOUNT);
+            ovector_src, OVECCOUNT);
     if (rc_src >= 0) {
       rc_dst =
           pcre_exec(ruleroute->re_dst, NULL, dst_name, dst_length, 0, 0,
     if (rc_src >= 0) {
       rc_dst =
           pcre_exec(ruleroute->re_dst, NULL, dst_name, dst_length, 0, 0,
-                    ovector_dst, OVECCOUNT);
+              ovector_dst, OVECCOUNT);
       if (rc_dst >= 0) {
         res = pcre_get_substring_list(src_name, ovector_src, rc_src, &list_src);
         xbt_assert(!res, "error solving substring list for src \"%s\"", src_name);
       if (rc_dst >= 0) {
         res = pcre_get_substring_list(src_name, ovector_src, rc_src, &list_src);
         xbt_assert(!res, "error solving substring list for src \"%s\"", src_name);
@@ -317,7 +317,7 @@ static void rulebased_get_route_and_latency(AS_t rc,
           char *new_link_name =
               remplace(link_name, list_src, rc_src, list_dst, rc_dst);
           void *link =
           char *new_link_name =
               remplace(link_name, list_src, rc_src, list_dst, rc_dst);
           void *link =
-                         xbt_lib_get_or_null(link_lib, new_link_name, SURF_LINK_LEVEL);
+              xbt_lib_get_or_null(link_lib, new_link_name, SURF_LINK_LEVEL);
           if (link) {
             xbt_dynar_push(route->link_list, &link);
             if (lat)
           if (link) {
             xbt_dynar_push(route->link_list, &link);
             if (lat)
@@ -349,29 +349,29 @@ static void rulebased_get_route_and_latency(AS_t rc,
     char *gw_src_name = remplace(ruleroute_extended->re_src_gateway, list_src, rc_src,
         list_dst, rc_dst);
     route->src_gateway = xbt_lib_get_or_null(host_lib, gw_src_name,
     char *gw_src_name = remplace(ruleroute_extended->re_src_gateway, list_src, rc_src,
         list_dst, rc_dst);
     route->src_gateway = xbt_lib_get_or_null(host_lib, gw_src_name,
-                                             ROUTING_HOST_LEVEL);
+        ROUTING_HOST_LEVEL);
     route->src_gateway = xbt_lib_get_or_null(host_lib, gw_src_name,
     route->src_gateway = xbt_lib_get_or_null(host_lib, gw_src_name,
-                                             ROUTING_HOST_LEVEL);
+        ROUTING_HOST_LEVEL);
     if (!route->src_gateway)
       route->src_gateway = xbt_lib_get_or_null(as_router_lib, gw_src_name,
     if (!route->src_gateway)
       route->src_gateway = xbt_lib_get_or_null(as_router_lib, gw_src_name,
-                                               ROUTING_ASR_LEVEL);
+          ROUTING_ASR_LEVEL);
     if (!route->src_gateway)
       route->src_gateway = xbt_lib_get_or_null(as_router_lib, gw_src_name,
     if (!route->src_gateway)
       route->src_gateway = xbt_lib_get_or_null(as_router_lib, gw_src_name,
-                                               ROUTING_ASR_LEVEL);
+          ROUTING_ASR_LEVEL);
     xbt_free(gw_src_name);
 
     char *gw_dst_name = remplace(ruleroute_extended->re_dst_gateway, list_src, rc_src,
         list_dst, rc_dst);
     route->dst_gateway = xbt_lib_get_or_null(host_lib, gw_dst_name,
     xbt_free(gw_src_name);
 
     char *gw_dst_name = remplace(ruleroute_extended->re_dst_gateway, list_src, rc_src,
         list_dst, rc_dst);
     route->dst_gateway = xbt_lib_get_or_null(host_lib, gw_dst_name,
-                                             ROUTING_HOST_LEVEL);
+        ROUTING_HOST_LEVEL);
     route->dst_gateway = xbt_lib_get_or_null(host_lib, gw_dst_name,
     route->dst_gateway = xbt_lib_get_or_null(host_lib, gw_dst_name,
-                                             ROUTING_HOST_LEVEL);
+        ROUTING_HOST_LEVEL);
     if (!route->dst_gateway)
       route->dst_gateway = xbt_lib_get_or_null(as_router_lib, gw_dst_name,
     if (!route->dst_gateway)
       route->dst_gateway = xbt_lib_get_or_null(as_router_lib, gw_dst_name,
-                                               ROUTING_ASR_LEVEL);
+          ROUTING_ASR_LEVEL);
     if (!route->dst_gateway)
       route->dst_gateway = xbt_lib_get_or_null(as_router_lib, gw_dst_name,
     if (!route->dst_gateway)
       route->dst_gateway = xbt_lib_get_or_null(as_router_lib, gw_dst_name,
-                                               ROUTING_ASR_LEVEL);
+          ROUTING_ASR_LEVEL);
     xbt_free(gw_dst_name);
   }
 
     xbt_free(gw_dst_name);
   }
 
@@ -400,7 +400,7 @@ static void rulebased_finalize(AS_t rc)
 AS_t model_rulebased_create(void) {
 
   AS_rulebased_t new_component = (AS_rulebased_t)
 AS_t model_rulebased_create(void) {
 
   AS_rulebased_t new_component = (AS_rulebased_t)
-      model_generic_create_sized(sizeof(s_AS_rulebased_t));
+          model_generic_create_sized(sizeof(s_AS_rulebased_t));
 
   new_component->generic_routing.parse_PU = model_rulebased_parse_PU;
   new_component->generic_routing.parse_AS = model_rulebased_parse_AS;
 
   new_component->generic_routing.parse_PU = model_rulebased_parse_PU;
   new_component->generic_routing.parse_AS = model_rulebased_parse_AS;
@@ -415,7 +415,7 @@ AS_t model_rulebased_create(void) {
   new_component->list_route = xbt_dynar_new(sizeof(rule_route_t), &rule_route_free);
   new_component->list_ASroute =
       xbt_dynar_new(sizeof(rule_route_extended_t),
   new_component->list_route = xbt_dynar_new(sizeof(rule_route_t), &rule_route_free);
   new_component->list_ASroute =
       xbt_dynar_new(sizeof(rule_route_extended_t),
-                    &rule_route_extended_free);
+          &rule_route_extended_free);
 
   return (AS_t) new_component;
 }
 
   return (AS_t) new_component;
 }
index 97c122d..caa5cc4 100644 (file)
@@ -65,7 +65,7 @@ static void vivaldi_get_route_and_latency(
   free(tmp_dst_name);
 
   euclidean_dist = sqrt (euclidean_dist_comp(0,src_ctn,dst_ctn)+euclidean_dist_comp(1,src_ctn,dst_ctn))
   free(tmp_dst_name);
 
   euclidean_dist = sqrt (euclidean_dist_comp(0,src_ctn,dst_ctn)+euclidean_dist_comp(1,src_ctn,dst_ctn))
-                  + fabs(xbt_dynar_get_as(src_ctn, 2, double))+fabs(xbt_dynar_get_as(dst_ctn, 2, double));
+                      + fabs(xbt_dynar_get_as(src_ctn, 2, double))+fabs(xbt_dynar_get_as(dst_ctn, 2, double));
 
   if (lat)
     *lat += euclidean_dist / 1000; //From .ms to .s
 
   if (lat)
     *lat += euclidean_dist / 1000; //From .ms to .s
@@ -75,7 +75,7 @@ static void vivaldi_get_route_and_latency(
 /* Creation routing model functions */
 AS_t model_vivaldi_create(void)
 {
 /* Creation routing model functions */
 AS_t model_vivaldi_create(void)
 {
-         AS_t new_component = model_rulebased_create();
-         new_component->get_route_and_latency = vivaldi_get_route_and_latency;
-         return new_component;
+  AS_t new_component = model_rulebased_create();
+  new_component->get_route_and_latency = vivaldi_get_route_and_latency;
+  return new_component;
 }
 }