Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
merge structures route_t and route_extended_t.
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 14 Nov 2011 15:31:41 +0000 (16:31 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 14 Nov 2011 20:20:18 +0000 (21:20 +0100)
All this added complexity to save 2 pointers was a bit too much for
me. Yeah, YMMV, but I prefer it this way.

12 files changed:
src/instr/instr_routing.c
src/surf/surf_private.h
src/surf/surf_routing.c
src/surf/surf_routing_cluster.c
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_none.c
src/surf/surf_routing_private.h
src/surf/surf_routing_rulebased.c
src/surf/surf_routing_vivaldi.c

index 051b266..d0d7750 100644 (file)
@@ -137,11 +137,11 @@ static void recursiveGraphExtraction (AS_t rc, container_t container, xbt_dict_t
                 child2->kind == INSTR_AS &&
                 strcmp(child1_name, child2_name) != 0){
 
-        route_extended_t route = rc->get_route (rc, child1_name, child2_name);
+        route_t route = rc->get_route (rc, child1_name, child2_name);
         unsigned int cpt;
         void *link;
         container_t previous = getContainerByName(route->src_gateway);
-        xbt_dynar_foreach (route->generic_route.link_list, cpt, link) {
+        xbt_dynar_foreach (route->link_list, cpt, link) {
           char *link_name = ((link_CM02_t)link)->lmm_resource.generic_resource.name;
           container_t current = getContainerByName(link_name);
           linkContainers (container, previous, current, filter);
@@ -439,11 +439,11 @@ static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xb
                 child2->kind == INSTR_AS &&
                 strcmp(child1_name, child2_name) != 0){
 
-        route_extended_t route = rc->get_route (rc, child1_name, child2_name);
+        route_t route = rc->get_route (rc, child1_name, child2_name);
         unsigned int cpt;
         void *link;
         xbt_node_t current, previous = new_xbt_graph_node(graph, route->src_gateway, nodes);
-        xbt_dynar_foreach (route->generic_route.link_list, cpt, link) {
+        xbt_dynar_foreach (route->link_list, cpt, link) {
           char *link_name = ((link_CM02_t)link)->lmm_resource.generic_resource.name;
           current = new_xbt_graph_node(graph, link_name, nodes);
           //previous -> current
index 6908940..f8a7447 100644 (file)
@@ -112,13 +112,9 @@ typedef struct s_model_type {
 
 typedef struct s_route {
   xbt_dynar_t link_list;
-} s_route_t, *route_t;
-
-typedef struct s_route_extended {
-  s_route_t generic_route;
   char *src_gateway;
   char *dst_gateway;
-} s_route_extended_t, *route_extended_t;
+} s_route_t, *route_t;
 
 /* This enum used in the routing structure helps knowing in which situation we are. */
 typedef enum {
@@ -136,14 +132,13 @@ typedef struct s_as {
   struct s_as *routing_father;
   xbt_dict_t routing_sons;
 
-  route_extended_t(*get_route) (AS_t as,
+  route_t(*get_route) (AS_t as,
                                 const char *src, const char *dst);
   double(*get_latency) (AS_t as,
                         const char *src, const char *dst,
-                        route_extended_t e_route);
+                        route_t e_route);
   xbt_dynar_t(*get_onelink_routes) (AS_t as);
-  route_extended_t(*get_bypass_route) (AS_t as,
-                                       const char *src, const char *dst);
+  route_t(*get_bypass_route) (AS_t as, const char *src, const char *dst);
   void (*finalize) (AS_t as);
 
 
@@ -154,11 +149,11 @@ typedef struct s_as {
   void (*parse_PU) (AS_t as, const char *name); /* A host or a router, whatever */
   void (*parse_AS) (AS_t as, const char *name);
   void (*parse_route) (AS_t as, const char *src,
-                     const char *dst, route_extended_t route);
+                     const char *dst, route_t route);
   void (*parse_ASroute) (AS_t as, const char *src,
-                       const char *dst, route_extended_t route);
+                       const char *dst, route_t route);
   void (*parse_bypassroute) (AS_t as, const char *src,
-                           const char *dst, route_extended_t e_route);
+                           const char *dst, route_t e_route);
 } s_as_t;
 
 typedef struct s_network_element_info {
index 3c055e2..a72e440 100644 (file)
@@ -225,8 +225,8 @@ static void routing_parse_link_ctn(void)
  */
 static void routing_parse_E_route(void)
 {
-  route_extended_t route = xbt_new0(s_route_extended_t, 1);
-  route->generic_route.link_list = link_list;
+  route_t route = xbt_new0(s_route_t, 1);
+  route->link_list = link_list;
   xbt_assert(current_routing->parse_route,
              "no defined method \"set_route\" in \"%s\"",
              current_routing->name);
@@ -241,8 +241,8 @@ static void routing_parse_E_route(void)
  */
 static void routing_parse_E_ASroute(void)
 {
-  route_extended_t e_route = xbt_new0(s_route_extended_t, 1);
-  e_route->generic_route.link_list = link_list;
+  route_t e_route = xbt_new0(s_route_t, 1);
+  e_route->link_list = link_list;
   e_route->src_gateway = xbt_strdup(gw_src);
   e_route->dst_gateway = xbt_strdup(gw_dst);
   xbt_assert(current_routing->parse_ASroute,
@@ -261,8 +261,8 @@ static void routing_parse_E_ASroute(void)
  */
 static void routing_parse_E_bypassRoute(void)
 {
-  route_extended_t e_route = xbt_new0(s_route_extended_t, 1);
-  e_route->generic_route.link_list = link_list;
+  route_t e_route = xbt_new0(s_route_t, 1);
+  e_route->link_list = link_list;
   e_route->src_gateway = xbt_strdup(gw_src);
   e_route->dst_gateway = xbt_strdup(gw_dst);
   xbt_assert(current_routing->parse_bypassroute,
@@ -477,11 +477,11 @@ static void _get_route_and_latency(const char *src, const char *dst,
 
   if (src_father == dst_father) {       /* SURF_ROUTING_BASE */
 
-    route_extended_t e_route = NULL;
+    route_t e_route = NULL;
     if (route) {
       e_route = common_father->get_route(common_father, src, dst);
       xbt_assert(e_route, "no route between \"%s\" and \"%s\"", src, dst);
-      *route = e_route->generic_route.link_list;
+      *route = e_route->link_list;
     }
     if (latency) {
       *latency = common_father->get_latency(common_father, src, dst, e_route);
@@ -496,14 +496,14 @@ static void _get_route_and_latency(const char *src, const char *dst,
 
   } else {                      /* SURF_ROUTING_RECURSIVE */
 
-    route_extended_t e_route_bypass = NULL;
+    route_t e_route_bypass = NULL;
     if (common_father->get_bypass_route)
       e_route_bypass = common_father->get_bypass_route(common_father, src, dst);
 
     xbt_assert(!latency || !e_route_bypass,
                "Bypass cannot work yet with get_latency");
 
-    route_extended_t e_route_cnt = e_route_bypass
+    route_t e_route_cnt = e_route_bypass
         ? e_route_bypass : common_father->get_route(common_father,
                                                     src_father->name,
                                                     dst_father->name);
@@ -554,7 +554,7 @@ static void _get_route_and_latency(const char *src, const char *dst,
     }
 
     if (route) {
-      xbt_dynar_foreach(e_route_cnt->generic_route.link_list, cpt, link) {
+      xbt_dynar_foreach(e_route_cnt->link_list, cpt, link) {
         xbt_dynar_push(*route, &link);
       }
     }
@@ -582,7 +582,7 @@ static void _get_route_and_latency(const char *src, const char *dst,
       }
     }
 
-    generic_free_extended_route(e_route_cnt);
+    generic_free_route(e_route_cnt);
   }
 }
 
index ccdfea6..444ddb3 100644 (file)
@@ -23,7 +23,7 @@ typedef struct {
 static xbt_dict_t cluster_host_link = NULL;
 
 /* Business methods */
-static route_extended_t cluster_get_route(AS_t as,
+static route_t cluster_get_route(AS_t as,
                                           const char *src,
                                           const char *dst) {
 
@@ -40,9 +40,9 @@ static route_extended_t cluster_get_route(AS_t as,
          info = xbt_dict_get_or_null(cluster_host_link,dst);
          if(info) xbt_dynar_push_as(links_list,void*,info->link_down); //link_down
 
-         route_extended_t new_e_route = NULL;
-         new_e_route = xbt_new0(s_route_extended_t, 1);
-         new_e_route->generic_route.link_list = links_list;
+         route_t new_e_route = NULL;
+         new_e_route = xbt_new0(s_route_t, 1);
+         new_e_route->link_list = links_list;
 
          return new_e_route;
 }
index 4e51e93..3de1ad1 100644 (file)
@@ -51,11 +51,11 @@ static void graph_node_map_elem_free(void *e)
   xbt_free(elm);
 }
 
-static void graph_edge_data_free(void *e)
+static void graph_edge_data_free(void *e) // FIXME: useless code dupplication
 {
-  route_extended_t e_route = (route_extended_t) e;
+  route_t e_route = (route_t) e;
   if (e_route) {
-    xbt_dynar_free(&(e_route->generic_route.link_list));
+    xbt_dynar_free(&(e_route->link_list));
     xbt_free(e_route->src_gateway);
     xbt_free(e_route->dst_gateway);
     xbt_free(e_route);
@@ -97,7 +97,7 @@ graph_node_map_search(as_dijkstra_t as, int id)
 /* Parsing */
 
 static void route_new_dijkstra(as_dijkstra_t as, int src_id,
-                               int dst_id, route_extended_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;
@@ -156,19 +156,16 @@ static void add_loopback_dijkstra(as_dijkstra_t as) {
     }
 
     if (!found) {
-      route_extended_t e_route = xbt_new0(s_route_extended_t, 1);
-      e_route->src_gateway = NULL;
-      e_route->dst_gateway = NULL;
-      e_route->generic_route.link_list =
-          xbt_dynar_new(global_routing->size_of_link, NULL);
-      xbt_dynar_push(e_route->generic_route.link_list,
+      route_t e_route = xbt_new0(s_route_t, 1);
+      e_route->link_list = xbt_dynar_new(global_routing->size_of_link, NULL);
+      xbt_dynar_push(e_route->link_list,
                      &global_routing->loopback);
       xbt_graph_new_edge(as->route_graph, node, node, e_route);
     }
   }
 }
 
-static route_extended_t dijkstra_get_route(AS_t as_generic,
+static route_t dijkstra_get_route(AS_t as_generic,
         const char *src,
         const char *dst);
 
@@ -182,12 +179,11 @@ static xbt_dynar_t dijkstra_get_onelink_routes(AS_t as)
          char *k1, *d1, *k2, *d2;
          xbt_dict_foreach(as->to_index, c1, k1, d1) {
            xbt_dict_foreach(as->to_index, c2, k2, d2) {
-             route_extended_t route = dijkstra_get_route(as, k1, k2);
+             route_t route = dijkstra_get_route(as, k1, k2);
              if (route) {
-               if (xbt_dynar_length(route->generic_route.link_list) == 1) {
+               if (xbt_dynar_length(route->link_list) == 1) {
                  void *link =
-                     *(void **) xbt_dynar_get_ptr(route->generic_route.link_list,
-                                                  0);
+                     *(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) {
@@ -206,7 +202,7 @@ static xbt_dynar_t dijkstra_get_onelink_routes(AS_t as)
          return ret;
 }
 
-static route_extended_t dijkstra_get_route(AS_t asg,
+static route_t dijkstra_get_route(AS_t asg,
                                            const char *src,
                                            const char *dst)
 {
@@ -227,9 +223,8 @@ static route_extended_t dijkstra_get_route(AS_t asg,
               src, dst);
 
   /* create a result route */
-  route_extended_t new_e_route = xbt_new0(s_route_extended_t, 1);
-  new_e_route->generic_route.link_list =
-      xbt_dynar_new(global_routing->size_of_link, NULL);
+  route_t new_e_route = xbt_new0(s_route_t, 1);
+  new_e_route->link_list = xbt_dynar_new(global_routing->size_of_link, NULL);
   new_e_route->src_gateway = NULL;
   new_e_route->dst_gateway = NULL;
 
@@ -238,7 +233,7 @@ static route_extended_t dijkstra_get_route(AS_t asg,
   int dst_node_id = 0;
   int *nodeid = NULL;
   int v;
-  route_extended_t e_route;
+  route_t e_route;
   int size = 0;
   unsigned int cpt;
   void *link;
@@ -270,11 +265,11 @@ static route_extended_t dijkstra_get_route(AS_t asg,
     xbt_assert(edge != NULL, "no route between host %d and %d", *src_id,
                 *dst_id);
 
-    e_route = (route_extended_t) xbt_graph_edge_get_data(edge);
+    e_route = (route_t) xbt_graph_edge_get_data(edge);
 
-    links = e_route->generic_route.link_list;
+    links = e_route->link_list;
     xbt_dynar_foreach(links, cpt, link) {
-      xbt_dynar_unshift(new_e_route->generic_route.link_list, &link);
+      xbt_dynar_unshift(new_e_route->link_list, &link);
     }
 
     return new_e_route;
@@ -328,9 +323,8 @@ static route_extended_t dijkstra_get_route(AS_t asg,
         xbt_node_t u_node = xbt_graph_edge_get_target(edge);
         graph_node_data_t data = xbt_graph_node_get_data(u_node);
         int u_id = data->graph_id;
-        route_extended_t tmp_e_route =
-            (route_extended_t) xbt_graph_edge_get_data(edge);
-        int cost_v_u = (tmp_e_route->generic_route.link_list)->used;    /* count of links, old model assume 1 */
+        route_t tmp_e_route = (route_t) xbt_graph_edge_get_data(edge);
+        int cost_v_u = (tmp_e_route->link_list)->used;    /* count of links, old model assume 1 */
 
         if (cost_v_u + cost_arr[*v_id] < cost_arr[u_id]) {
           pred_arr[u_id] = *v_id;
@@ -364,7 +358,7 @@ static route_extended_t dijkstra_get_route(AS_t asg,
 
     prev_gw_src = gw_src;
 
-    e_route = (route_extended_t) xbt_graph_edge_get_data(edge);
+    e_route = (route_t) xbt_graph_edge_get_data(edge);
     gw_src = e_route->src_gateway;
     gw_dst = e_route->dst_gateway;
 
@@ -380,15 +374,14 @@ static route_extended_t dijkstra_get_route(AS_t asg,
       links = e_route_as_to_as;
       int pos = 0;
       xbt_dynar_foreach(links, cpt, link) {
-        xbt_dynar_insert_at(new_e_route->generic_route.link_list, pos,
-                            &link);
+        xbt_dynar_insert_at(new_e_route->link_list, pos, &link);
         pos++;
       }
     }
 
-    links = e_route->generic_route.link_list;
+    links = e_route->link_list;
     xbt_dynar_foreach(links, cpt, link) {
-      xbt_dynar_unshift(new_e_route->generic_route.link_list, &link);
+      xbt_dynar_unshift(new_e_route->link_list, &link);
     }
     size++;
   }
@@ -485,7 +478,7 @@ void model_dijkstra_both_end(AS_t as)
 
 }
 void model_dijkstra_both_parse_route (AS_t asg, const char *src,
-                     const char *dst, route_extended_t route)
+                     const char *dst, route_t route)
 {
        as_dijkstra_t as = (as_dijkstra_t) asg;
        int *src_id, *dst_id;
@@ -519,7 +512,6 @@ void model_dijkstra_both_parse_route (AS_t asg, const char *src,
                  xbt_die("The src_gateway '%s' does not exist!",route->src_gateway);
        }
 
-       route_extended_t e_route =
-               generic_new_extended_route(asg->hierarchy, route, 1);
+       route_t e_route = generic_new_extended_route(asg->hierarchy, route, 1);
        route_new_dijkstra(as, *src_id, *dst_id, e_route);
 }
index 87d2bfa..f75470d 100644 (file)
@@ -22,11 +22,10 @@ typedef struct {
   /* vars for calculate the floyd algorith. */
   int *predecessor_table;
   double *cost_table;
-  route_extended_t *link_table;
+  route_t *link_table;
 } s_as_floyd_t, *as_floyd_t;
 
-static route_extended_t floyd_get_route(AS_t asg,
-                                        const char *src, const char *dst);
+static route_t floyd_get_route(AS_t asg, const char *src, const char *dst);
 
 /* Business methods */
 static xbt_dynar_t floyd_get_onelink_routes(AS_t asg)
@@ -37,12 +36,11 @@ static xbt_dynar_t floyd_get_onelink_routes(AS_t asg)
   char *k1, *d1, *k2, *d2;
   xbt_dict_foreach(asg->to_index, c1, k1, d1) {
     xbt_dict_foreach(asg->to_index, c2, k2, d2) {
-      route_extended_t route = floyd_get_route(asg, k1, k2);
+      route_t route = floyd_get_route(asg, k1, k2);
       if (route) {
-        if (xbt_dynar_length(route->generic_route.link_list) == 1) {
+        if (xbt_dynar_length(route->link_list) == 1) {
           void *link =
-              *(void **) xbt_dynar_get_ptr(route->generic_route.link_list,
-                                           0);
+              *(void **) xbt_dynar_get_ptr(route->link_list, 0);
           onelink_t onelink = xbt_new0(s_onelink_t, 1);
           onelink->link_ptr = link;
           if (asg->hierarchy == SURF_ROUTING_BASE) {
@@ -60,8 +58,7 @@ static xbt_dynar_t floyd_get_onelink_routes(AS_t asg)
   return ret;
 }
 
-static route_extended_t floyd_get_route(AS_t asg,
-                                        const char *src, const char *dst)
+static route_t floyd_get_route(AS_t asg, const char *src, const char *dst)
 {
   xbt_assert(asg && src
               && dst,
@@ -81,11 +78,8 @@ static route_extended_t floyd_get_route(AS_t asg,
               src, dst);
 
   /* create a result route */
-  route_extended_t new_e_route = xbt_new0(s_route_extended_t, 1);
-  new_e_route->generic_route.link_list =
-      xbt_dynar_new(global_routing->size_of_link, NULL);
-  new_e_route->src_gateway = NULL;
-  new_e_route->dst_gateway = NULL;
+  route_t new_e_route = xbt_new0(s_route_t, 1);
+  new_e_route->link_list = xbt_dynar_new(global_routing->size_of_link, NULL);
 
   int first = 1;
   int pred = *dst_id;
@@ -106,7 +100,7 @@ static route_extended_t floyd_get_route(AS_t asg,
 
     prev_gw_src = gw_src;
 
-    route_extended_t e_route = TO_FLOYD_LINK(pred, prev_pred);
+    route_t e_route = TO_FLOYD_LINK(pred, prev_pred);
     gw_src = e_route->src_gateway;
     gw_dst = e_route->dst_gateway;
 
@@ -122,15 +116,14 @@ static route_extended_t floyd_get_route(AS_t asg,
       links = e_route_as_to_as;
       int pos = 0;
       xbt_dynar_foreach(links, cpt, link) {
-        xbt_dynar_insert_at(new_e_route->generic_route.link_list, pos,
-                            &link);
+        xbt_dynar_insert_at(new_e_route->link_list, pos, &link);
         pos++;
       }
     }
 
-    links = e_route->generic_route.link_list;
+    links = e_route->link_list;
     xbt_dynar_foreach(links, cpt, link) {
-      xbt_dynar_unshift(new_e_route->generic_route.link_list, &link);
+      xbt_dynar_unshift(new_e_route->link_list, &link);
     }
     first = 0;
 
@@ -156,7 +149,7 @@ static void floyd_finalize(AS_t rc)
     /* Delete link_table */
     for (i = 0; i < table_size; i++)
       for (j = 0; j < table_size; j++)
-        generic_free_extended_route(TO_FLOYD_LINK(i, j));
+        generic_free_route(TO_FLOYD_LINK(i, j));
     xbt_free(as->link_table);
     /* Delete bypass dict */
     xbt_dict_free(&as->generic_routing.bypassRoutes);
@@ -197,7 +190,7 @@ void model_floyd_end(AS_t current_routing)
                /* 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_extended_t, table_size * table_size);    /* actual link between src and dst */
+               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++)
@@ -211,15 +204,14 @@ void model_floyd_end(AS_t current_routing)
        /* Add the loopback if needed */
        if (current_routing->hierarchy == SURF_ROUTING_BASE) {
                for (i = 0; i < table_size; i++) {
-                 route_extended_t e_route = TO_FLOYD_LINK(i, i);
+                 route_t e_route = TO_FLOYD_LINK(i, i);
                  if (!e_route) {
-                       e_route = xbt_new0(s_route_extended_t, 1);
+                       e_route = xbt_new0(s_route_t, 1);
                        e_route->src_gateway = NULL;
                        e_route->dst_gateway = NULL;
-                       e_route->generic_route.link_list =
+                       e_route->link_list =
                                xbt_dynar_new(global_routing->size_of_link, NULL);
-                       xbt_dynar_push(e_route->generic_route.link_list,
-                                                  &global_routing->loopback);
+                       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;
@@ -251,7 +243,7 @@ static int surf_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,
-        const char *dst, route_extended_t route)
+        const char *dst, route_t route)
 {
        as_floyd_t as = (as_floyd_t) rc;
 
@@ -271,7 +263,7 @@ void model_floyd_parse_route(AS_t rc, const char *src,
                /* 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_extended_t, table_size * table_size);    /* actual link between src and dst */
+               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++)
@@ -292,14 +284,14 @@ void model_floyd_parse_route(AS_t rc, const char *src,
                char * link_name;
                unsigned int cpt;
                xbt_dynar_t link_route_to_test = xbt_dynar_new(global_routing->size_of_link, NULL);
-               xbt_dynar_foreach(route->generic_route.link_list,cpt,link_name)
+               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_id, *dst_id)->generic_route.link_list,
+                         (void*)TO_FLOYD_LINK(*src_id, *dst_id)->link_list,
                          (void*)link_route_to_test,
                          (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp),
                          "The route between \"%s\" and \"%s\" already exists", src,dst);
@@ -320,7 +312,7 @@ void model_floyd_parse_route(AS_t rc, const char *src,
                        generic_new_extended_route(rc->hierarchy, route, 1);
            TO_FLOYD_PRED(*src_id, *dst_id) = *src_id;
            TO_FLOYD_COST(*src_id, *dst_id) =
-                       ((TO_FLOYD_LINK(*src_id, *dst_id))->generic_route.link_list)->used;   /* count of links, old model assume 1 */
+                       ((TO_FLOYD_LINK(*src_id, *dst_id))->link_list)->used;   /* count of links, old model assume 1 */
        }
 
        if( A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES
@@ -336,15 +328,15 @@ void model_floyd_parse_route(AS_t rc, const char *src,
                        char * link_name;
                        unsigned int i;
                        xbt_dynar_t link_route_to_test = xbt_dynar_new(global_routing->size_of_link, NULL);
-                       for(i=xbt_dynar_length(route->generic_route.link_list) ;i>0 ;i--)
+                       for(i=xbt_dynar_length(route->link_list) ;i>0 ;i--)
                        {
-                               link_name = xbt_dynar_get_as(route->generic_route.link_list,i-1,void *);
+                               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_id, *src_id)->generic_route.link_list,
+                                 (void*)TO_FLOYD_LINK(*dst_id, *src_id)->link_list,
                              (void*)link_route_to_test,
                                  (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp),
                                  "The route between \"%s\" and \"%s\" already exists", src,dst);
@@ -369,7 +361,7 @@ void model_floyd_parse_route(AS_t rc, const char *src,
                                generic_new_extended_route(rc->hierarchy, route, 0);
                    TO_FLOYD_PRED(*dst_id, *src_id) = *dst_id;
                    TO_FLOYD_COST(*dst_id, *src_id) =
-                               ((TO_FLOYD_LINK(*dst_id, *src_id))->generic_route.link_list)->used;   /* count of links, old model assume 1 */
+                               ((TO_FLOYD_LINK(*dst_id, *src_id))->link_list)->used;   /* count of links, old model assume 1 */
                }
        }
 }
index 9d42e98..464b4b2 100644 (file)
@@ -17,7 +17,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
 
 typedef struct s_routing_component_full {
   s_as_t generic_routing;
-  route_extended_t *routing_table;
+  route_t *routing_table;
 } s_routing_component_full_t, *routing_component_full_t;
 
 /* Business methods */
@@ -37,11 +37,11 @@ static xbt_dynar_t full_get_onelink_routes(AS_t rc)
                   && dst_id,
                   "Ask for route \"from\"(%s)  or \"to\"(%s) no found in the local table",
                   k1, k2);
-      route_extended_t route = TO_ROUTE_FULL(*src_id, *dst_id);
+      route_t route = TO_ROUTE_FULL(*src_id, *dst_id);
       if (route) {
-        if (xbt_dynar_length(route->generic_route.link_list) == 1) {
+        if (xbt_dynar_length(route->link_list) == 1) {
           void *link =
-              *(void **) xbt_dynar_get_ptr(route->generic_route.link_list,
+              *(void **) xbt_dynar_get_ptr(route->link_list,
                                            0);
           onelink_t onelink = xbt_new0(s_onelink_t, 1);
           onelink->link_ptr = link;
@@ -61,7 +61,7 @@ static xbt_dynar_t full_get_onelink_routes(AS_t rc)
   return ret;
 }
 
-static route_extended_t full_get_route(AS_t rc,
+static route_t full_get_route(AS_t rc,
                                        const char *src, const char *dst)
 {
   xbt_assert(rc && src
@@ -80,21 +80,21 @@ static route_extended_t full_get_route(AS_t rc,
               "Ask for route \"from\"(%s)  or \"to\"(%s) no found in the local table",
               src, dst);
 
-  route_extended_t e_route = NULL;
-  route_extended_t new_e_route = NULL;
+  route_t e_route = NULL;
+  route_t new_e_route = NULL;
   void *link;
   unsigned int cpt = 0;
 
   e_route = TO_ROUTE_FULL(*src_id, *dst_id);
 
   if (e_route) {
-    new_e_route = xbt_new0(s_route_extended_t, 1);
+    new_e_route = xbt_new0(s_route_t, 1);
     new_e_route->src_gateway = xbt_strdup(e_route->src_gateway);
     new_e_route->dst_gateway = xbt_strdup(e_route->dst_gateway);
-    new_e_route->generic_route.link_list =
+    new_e_route->link_list =
         xbt_dynar_new(global_routing->size_of_link, NULL);
-    xbt_dynar_foreach(e_route->generic_route.link_list, cpt, link) {
-      xbt_dynar_push(new_e_route->generic_route.link_list, &link);
+    xbt_dynar_foreach(e_route->link_list, cpt, link) {
+      xbt_dynar_push(new_e_route->link_list, &link);
     }
   }
   return new_e_route;
@@ -109,7 +109,7 @@ static void full_finalize(AS_t rc)
     /* Delete routing table */
     for (i = 0; i < table_size; i++)
       for (j = 0; j < table_size; j++)
-        generic_free_extended_route(TO_ROUTE_FULL(i, j));
+        generic_free_route(TO_ROUTE_FULL(i, j));
     xbt_free(routing->routing_table);
     model_generic_finalize(rc);
   }
@@ -135,7 +135,7 @@ AS_t model_full_create(void)
 void model_full_end(AS_t current_routing)
 {
   unsigned int i;
-  route_extended_t e_route;
+  route_t e_route;
 
   /* set utils vars */
   routing_component_full_t routing =
@@ -144,19 +144,18 @@ void model_full_end(AS_t current_routing)
 
   /* Create table if necessary */
   if(!routing->routing_table)
-         routing->routing_table = xbt_new0(route_extended_t, table_size * table_size);
+         routing->routing_table = xbt_new0(route_t, table_size * table_size);
 
   /* Add the loopback if needed */
   if (current_routing->hierarchy == SURF_ROUTING_BASE) {
     for (i = 0; i < table_size; i++) {
       e_route = TO_ROUTE_FULL(i, i);
       if (!e_route) {
-        e_route = xbt_new0(s_route_extended_t, 1);
+        e_route = xbt_new0(s_route_t, 1);
         e_route->src_gateway = NULL;
         e_route->dst_gateway = NULL;
-        e_route->generic_route.link_list =
-            xbt_dynar_new(global_routing->size_of_link, NULL);
-        xbt_dynar_push(e_route->generic_route.link_list,
+        e_route->link_list = xbt_dynar_new(global_routing->size_of_link, NULL);
+        xbt_dynar_push(e_route->link_list,
                        &global_routing->loopback);
         TO_ROUTE_FULL(i, i) = e_route;
       }
@@ -169,7 +168,7 @@ static int surf_pointer_resource_cmp(const void *a, const void *b) {
 }
 
 void model_full_set_route(AS_t rc, const char *src,
-               const char *dst, route_extended_t route)
+               const char *dst, route_t route)
 {
        int *src_id, *dst_id;
        src_id = xbt_dict_get_or_null(rc->to_index, src);
@@ -180,26 +179,26 @@ void model_full_set_route(AS_t rc, const char *src,
        xbt_assert(src_id, "Network elements %s not found", src);
        xbt_assert(dst_id, "Network elements %s not found", dst);
 
-       xbt_assert(!xbt_dynar_is_empty(route->generic_route.link_list),
+       xbt_assert(!xbt_dynar_is_empty(route->link_list),
                          "Invalid count of links, must be greater than zero (%s,%s)",
                          src, dst);
 
        if(!routing->routing_table)
-               routing->routing_table = xbt_new0(route_extended_t, table_size * table_size);
+               routing->routing_table = xbt_new0(route_t, table_size * table_size);
 
        if(TO_ROUTE_FULL(*src_id, *dst_id))
        {
                char * link_name;
                unsigned int i;
                xbt_dynar_t link_route_to_test = xbt_dynar_new(global_routing->size_of_link, NULL);
-               xbt_dynar_foreach(route->generic_route.link_list,i,link_name)
+               xbt_dynar_foreach(route->link_list,i,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_ROUTE_FULL(*src_id, *dst_id)->generic_route.link_list,
+                         (void*)TO_ROUTE_FULL(*src_id, *dst_id)->link_list,
                          (void*)link_route_to_test,
                          (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp),
                          "The route between \"%s\" and \"%s\" already exists. If you are trying to define a reverse route, you must set the symmetrical=no attribute to your routes tags.", src,dst);
@@ -217,7 +216,7 @@ void model_full_set_route(AS_t rc, const char *src,
                                  xbt_die("The src_gateway '%s' does not exist!",route->src_gateway);
                  }
              TO_ROUTE_FULL(*src_id, *dst_id) = generic_new_extended_route(rc->hierarchy,route,1);
-             xbt_dynar_shrink(TO_ROUTE_FULL(*src_id, *dst_id)->generic_route.link_list, 0);
+             xbt_dynar_shrink(TO_ROUTE_FULL(*src_id, *dst_id)->link_list, 0);
        }
 
        if( A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES
@@ -235,15 +234,15 @@ void model_full_set_route(AS_t rc, const char *src,
                        char * link_name;
                        unsigned int i;
                        xbt_dynar_t link_route_to_test = xbt_dynar_new(global_routing->size_of_link, NULL);
-                       for(i=xbt_dynar_length(route->generic_route.link_list) ;i>0 ;i--)
+                       for(i=xbt_dynar_length(route->link_list) ;i>0 ;i--)
                        {
-                               link_name = xbt_dynar_get_as(route->generic_route.link_list,i-1,void *);
+                               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_ROUTE_FULL(*dst_id, *src_id)->generic_route.link_list,
+                                 (void*)TO_ROUTE_FULL(*dst_id, *src_id)->link_list,
                              (void*)link_route_to_test,
                                  (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp),
                                  "The route between \"%s\" and \"%s\" already exists", src,dst);
@@ -256,10 +255,9 @@ void model_full_set_route(AS_t rc, const char *src,
                                  XBT_DEBUG("Load ASroute from \"%s(%s)\" to \"%s(%s)\"", dst,
                                         route->src_gateway, src, route->dst_gateway);
                      TO_ROUTE_FULL(*dst_id, *src_id) = generic_new_extended_route(rc->hierarchy,route,0);
-                     xbt_dynar_shrink(TO_ROUTE_FULL(*dst_id, *src_id)->generic_route.link_list, 0);
+                     xbt_dynar_shrink(TO_ROUTE_FULL(*dst_id, *src_id)->link_list, 0);
                }
        }
 
-       if (rc->hierarchy == SURF_ROUTING_BASE) generic_free_route((route_t)route) ;
-       else generic_free_extended_route((route_extended_t)route);
+       generic_free_route((route_t)route) ;
 }
index a9f4e7c..6be5386 100644 (file)
@@ -62,27 +62,27 @@ void generic_parse_AS(AS_t as, const char *name)
 
 void generic_parse_bypassroute(AS_t rc,
                              const char *src, const char *dst,
-                             route_extended_t e_route)
+                             route_t e_route)
 {
   XBT_DEBUG("Load bypassRoute from \"%s\" to \"%s\"", src, dst);
   xbt_dict_t dict_bypassRoutes = rc->bypassRoutes;
   char *route_name;
 
   route_name = bprintf("%s#%s", src, dst);
-  xbt_assert(!xbt_dynar_is_empty(e_route->generic_route.link_list),
+  xbt_assert(!xbt_dynar_is_empty(e_route->link_list),
              "Invalid count of links, must be greater than zero (%s,%s)",
              src, dst);
   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, dst, e_route->dst_gateway);
 
-  route_extended_t new_e_route =
+  route_t new_e_route =
       generic_new_extended_route(SURF_ROUTING_RECURSIVE, e_route, 0);
-  xbt_dynar_free(&(e_route->generic_route.link_list));
+  xbt_dynar_free(&(e_route->link_list));
   xbt_free(e_route);
 
   xbt_dict_set(dict_bypassRoutes, route_name, new_e_route,
-               (void (*)(void *)) generic_free_extended_route);
+               (void (*)(void *)) generic_free_route);
   xbt_free(route_name);
 }
 
@@ -91,7 +91,7 @@ void generic_parse_bypassroute(AS_t rc,
 
 double generic_get_link_latency(AS_t rc,
                                 const char *src, const char *dst,
-                                route_extended_t route)
+                                route_t route)
 {
   int need_to_clean = route ? 0 : 1;
   void *link;
@@ -100,11 +100,11 @@ double generic_get_link_latency(AS_t rc,
 
   route = route ? route : rc->get_route(rc, src, dst);
 
-  xbt_dynar_foreach(route->generic_route.link_list, i, link) {
+  xbt_dynar_foreach(route->link_list, i, link) {
     latency += surf_network_model->extension.network.get_link_latency(link);
   }
   if (need_to_clean)
-    generic_free_extended_route(route);
+    generic_free_route(route);
   return latency;
 }
 
@@ -113,7 +113,7 @@ xbt_dynar_t generic_get_onelink_routes(AS_t rc)
   xbt_die("\"generic_get_onelink_routes\" not implemented yet");
 }
 
-route_extended_t generic_get_bypassroute(AS_t rc,
+route_t generic_get_bypassroute(AS_t rc,
                                          const char *src, const char *dst)
 {
   xbt_dict_t dict_bypassRoutes = rc->bypassRoutes;
@@ -174,7 +174,7 @@ route_extended_t generic_get_bypassroute(AS_t rc,
   int max_index = max(max_index_src, max_index_dst);
   int i, max;
 
-  route_extended_t e_route_bypass = NULL;
+  route_t e_route_bypass = NULL;
 
   for (max = 0; max <= max_index; max++) {
     for (i = 0; i < max; i++) {
@@ -221,18 +221,18 @@ route_extended_t generic_get_bypassroute(AS_t rc,
   xbt_dynar_free(&path_src);
   xbt_dynar_free(&path_dst);
 
-  route_extended_t new_e_route = NULL;
+  route_t new_e_route = NULL;
 
   if (e_route_bypass) {
     void *link;
     unsigned int cpt = 0;
-    new_e_route = xbt_new0(s_route_extended_t, 1);
+    new_e_route = xbt_new0(s_route_t, 1);
     new_e_route->src_gateway = xbt_strdup(e_route_bypass->src_gateway);
     new_e_route->dst_gateway = xbt_strdup(e_route_bypass->dst_gateway);
-    new_e_route->generic_route.link_list =
+    new_e_route->link_list =
         xbt_dynar_new(global_routing->size_of_link, NULL);
-    xbt_dynar_foreach(e_route_bypass->generic_route.link_list, cpt, link) {
-      xbt_dynar_push(new_e_route->generic_route.link_list, &link);
+    xbt_dynar_foreach(e_route_bypass->link_list, cpt, link) {
+      xbt_dynar_push(new_e_route->link_list, &link);
     }
   }
 
@@ -277,22 +277,19 @@ generic_new_route(e_surf_routing_hierarchy_t hierarchy, void *data, int order)
   return new_route;
 }
 
-route_extended_t
+route_t
 generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy,
                            void *data, int order)
 {
 
   char *link_name;
-  route_extended_t e_route, new_e_route;
+  route_t e_route, new_e_route;
   route_t route;
   unsigned int cpt;
   xbt_dynar_t links = NULL, links_id = NULL;
 
-  new_e_route = xbt_new0(s_route_extended_t, 1);
-  new_e_route->generic_route.link_list =
-      xbt_dynar_new(global_routing->size_of_link, NULL);
-  new_e_route->src_gateway = NULL;
-  new_e_route->dst_gateway = NULL;
+  new_e_route = xbt_new0(s_route_t, 1);
+  new_e_route->link_list = xbt_dynar_new(global_routing->size_of_link, NULL);
 
   xbt_assert(hierarchy == SURF_ROUTING_BASE
              || hierarchy == SURF_ROUTING_RECURSIVE,
@@ -305,17 +302,17 @@ generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy,
 
   } else if (hierarchy == SURF_ROUTING_RECURSIVE) {
 
-    e_route = (route_extended_t) data;
+    e_route = (route_t) data;
     xbt_assert(e_route->src_gateway
                && e_route->dst_gateway, "bad gateway, is null");
-    links = e_route->generic_route.link_list;
+    links = e_route->link_list;
 
     /* remeber not erase the gateway names */
     new_e_route->src_gateway = strdup(e_route->src_gateway);
     new_e_route->dst_gateway = strdup(e_route->dst_gateway);
   }
 
-  links_id = new_e_route->generic_route.link_list;
+  links_id = new_e_route->link_list;
 
   xbt_dynar_foreach(links, cpt, link_name) {
 
@@ -336,20 +333,12 @@ void generic_free_route(route_t route)
 {
   if (route) {
     xbt_dynar_free(&(route->link_list));
+    xbt_free(route->src_gateway);
+    xbt_free(route->dst_gateway);
     xbt_free(route);
   }
 }
 
-void generic_free_extended_route(route_extended_t e_route)
-{
-  if (e_route) {
-    xbt_dynar_free(&(e_route->generic_route.link_list));
-    xbt_free(e_route->src_gateway);
-    xbt_free(e_route->dst_gateway);
-    xbt_free(e_route);
-  }
-}
-
 static AS_t generic_as_exist(AS_t find_from,
                                             AS_t to_find)
 {
index f4d9516..66d6c43 100644 (file)
@@ -12,13 +12,13 @@ static xbt_dynar_t none_get_onelink_routes(AS_t rc) {
   return NULL;
 }
 
-static route_extended_t none_get_route(AS_t rc,
+static route_t none_get_route(AS_t rc,
                                        const char *src, const char *dst)
 {
   return NULL;
 }
 
-static route_extended_t none_get_bypass_route(AS_t rc,
+static route_t none_get_bypass_route(AS_t rc,
                                               const char *src,
                                               const char *dst) {
   return NULL;
index c12b6e3..a7fbeae 100644 (file)
@@ -32,29 +32,28 @@ void model_generic_finalize(AS_t as);
 void generic_parse_PU(AS_t rc, const char *name);
 void generic_parse_AS(AS_t rc, const char *name);
 void generic_parse_bypassroute(AS_t rc, const char *src, const char *dst,
-                               route_extended_t e_route);
+                               route_t e_route);
 
 /* ************************************************************************** */
 /* *************** GENERIC BUSINESS METHODS (declarations) ****************** */
 
 double generic_get_link_latency(AS_t rc, const char *src, const char *dst,
-                                                                               route_extended_t e_route);
+                                                                               route_t e_route);
 xbt_dynar_t generic_get_onelink_routes(AS_t rc);
-route_extended_t generic_get_bypassroute(AS_t rc,
+route_t generic_get_bypassroute(AS_t rc,
                                                 const char *src,
                                                 const char *dst);
 
 /* ************************************************************************** */
 /* ****************** GENERIC AUX FUNCTIONS (declarations) ****************** */
 
-route_extended_t
+route_t
 generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy,
                            void *data, int order);
 route_t
 generic_new_route(e_surf_routing_hierarchy_t hierarchy,
                            void *data, int order);
 void generic_free_route(route_t route);
-void generic_free_extended_route(route_extended_t e_route);
 AS_t
 generic_autonomous_system_exist(AS_t rc, char *element);
 AS_t
@@ -68,7 +67,7 @@ void generic_src_dst_check(AS_t rc, const char *src,
 AS_t model_floyd_create(void);  /* create structures for floyd routing model */
 void model_floyd_end(AS_t as);      /* finalize the creation of floyd routing model */
 void model_floyd_parse_route(AS_t rc, const char *src,
-        const char *dst, route_extended_t route);
+        const char *dst, route_t route);
 
 /* ************************************************** */
 /* ************** RULE-BASED ROUTING **************** */
@@ -97,14 +96,14 @@ AS_t model_dijkstra_create(void);       /* create structures for dijkstra routin
 AS_t model_dijkstracache_create(void);  /* create structures for dijkstracache routing model */
 void model_dijkstra_both_end(AS_t as);      /* finalize the creation of dijkstra routing model */
 void model_dijkstra_both_parse_route (AS_t rc, const char *src,
-                     const char *dst, route_extended_t route);
+                     const char *dst, route_t route);
 
 /* ************************************************************************** */
 /* *************************** FULL ROUTING ********************************* */
 AS_t model_full_create(void);   /* create structures for full routing model */
 void model_full_end(AS_t as);       /* finalize the creation of full routing model */
 void model_full_set_route(     /* Set the route and ASroute between src and dst */
-               AS_t rc, const char *src, const char *dst, route_extended_t route);
+               AS_t rc, const char *src, const char *dst, route_t route);
 
 
 #endif                          /* _SURF_SURF_ROUTING_PRIVATE_H */
index 110c288..3c55f26 100644 (file)
@@ -84,7 +84,7 @@ static void model_rulebased_parse_AS(AS_t rc,
 
 static void model_rulebased_parse_route(AS_t rc,
                                       const char *src, const char *dst,
-                                      route_extended_t route)
+                                      route_t route)
 {
   routing_component_rulebased_t routing =
       (routing_component_rulebased_t) rc;
@@ -93,7 +93,7 @@ static void model_rulebased_parse_route(AS_t rc,
   int erroffset;
 
   if(!strcmp(rc->model_desc->name,"Vivaldi")){
-         if(!xbt_dynar_is_empty(route->generic_route.link_list))
+         if(!xbt_dynar_is_empty(route->link_list))
                  xbt_die("You can't have link_ctn with Model Vivaldi.");
   }
 
@@ -105,14 +105,14 @@ static void model_rulebased_parse_route(AS_t rc,
   xbt_assert(ruleroute->re_src,
               "PCRE compilation failed at offset %d (\"%s\"): %s\n",
               erroffset, dst, error);
-  ruleroute->re_str_link = route->generic_route.link_list;
+  ruleroute->re_str_link = route->link_list;
   xbt_dynar_push(routing->list_route, &ruleroute);
   xbt_free(route);
 }
 
 static void model_rulebased_parse_ASroute(AS_t rc,
                                         const char *src, const char *dst,
-                                        route_extended_t route)
+                                        route_t route)
 {
   routing_component_rulebased_t routing =
       (routing_component_rulebased_t) rc;
@@ -121,7 +121,7 @@ static void model_rulebased_parse_ASroute(AS_t rc,
   int erroffset;
 
   if(!strcmp(rc->model_desc->name,"Vivaldi")){
-         if(!xbt_dynar_is_empty(route->generic_route.link_list))
+         if(!xbt_dynar_is_empty(route->link_list))
                  xbt_die("You can't have link_ctn with Model Vivaldi.");
   }
 
@@ -136,7 +136,7 @@ static void model_rulebased_parse_ASroute(AS_t rc,
               "PCRE compilation failed at offset %d (\"%s\"): %s\n",
               erroffset, dst, error);
   ruleroute_e->generic_rule_route.re_str_link =
-      route->generic_route.link_list;
+      route->link_list;
   ruleroute_e->re_src_gateway = route->src_gateway;
   ruleroute_e->re_dst_gateway = route->dst_gateway;
   xbt_dynar_push(routing->list_ASroute, &ruleroute_e);
@@ -148,7 +148,7 @@ static void model_rulebased_parse_ASroute(AS_t rc,
 static void model_rulebased_parse_bypassroute(AS_t rc,
                                             const char *src,
                                             const char *dst,
-                                            route_extended_t e_route)
+                                            route_t e_route)
 {
   xbt_die("bypass routing not supported for Route-Based model");
 }
@@ -211,7 +211,7 @@ static char *remplace(char *value, const char **src_list, int src_size,
   return memcpy(res, result, i_res);
 }
 
-static route_extended_t rulebased_get_route(AS_t rc,
+static route_t rulebased_get_route(AS_t rc,
                                             const char *src,
                                             const char *dst);
 static xbt_dynar_t rulebased_get_onelink_routes(AS_t rc)
@@ -240,9 +240,9 @@ static xbt_dynar_t rulebased_get_onelink_routes(AS_t rc)
   }
 
   xbt_dict_foreach(routing->dict_processing_units, c1, k1, d1) {
-    route_extended_t route = rulebased_get_route (rc, router, k1);
+    route_t route = rulebased_get_route (rc, router, k1);
 
-    int number_of_links = xbt_dynar_length(route->generic_route.link_list);
+    int number_of_links = xbt_dynar_length(route->link_list);
 
     if(number_of_links == 1) {
                //loopback
@@ -253,7 +253,7 @@ static xbt_dynar_t rulebased_get_onelink_routes(AS_t rc)
                }
 
                void *link_ptr;
-               xbt_dynar_get_cpy (route->generic_route.link_list, 1, &link_ptr);
+               xbt_dynar_get_cpy (route->link_list, 1, &link_ptr);
                onelink_t onelink = xbt_new0 (s_onelink_t, 1);
                onelink->src = xbt_strdup (k1);
                onelink->dst = xbt_strdup (router);
@@ -265,7 +265,7 @@ static xbt_dynar_t rulebased_get_onelink_routes(AS_t rc)
 }
 
 /* Business methods */
-static route_extended_t rulebased_get_route(AS_t rc,
+static route_t rulebased_get_route(AS_t rc,
                                             const char *src,
                                             const char *dst)
 {
@@ -339,14 +339,14 @@ static route_extended_t rulebased_get_route(AS_t rc,
       break;
   }
 
-  route_extended_t new_e_route = NULL;
+  route_t new_e_route = NULL;
   if (rc_src >= 0 && rc_dst >= 0) {
-    new_e_route = xbt_new0(s_route_extended_t, 1);
-    new_e_route->generic_route.link_list = links_list;
+    new_e_route = xbt_new0(s_route_t, 1);
+    new_e_route->link_list = links_list;
   } else if (!strcmp(src, dst) && are_processing_units) {
-    new_e_route = xbt_new0(s_route_extended_t, 1);
+    new_e_route = xbt_new0(s_route_t, 1);
     xbt_dynar_push(links_list, &(global_routing->loopback));
-    new_e_route->generic_route.link_list = links_list;
+    new_e_route->link_list = links_list;
   } else {
     xbt_dynar_free(&link_list);
   }
@@ -370,10 +370,7 @@ static route_extended_t rulebased_get_route(AS_t rc,
   return new_e_route;
 }
 
-static route_extended_t rulebased_get_bypass_route(AS_t rc,
-                                                   const char *src,
-                                                   const char *dst)
-{
+static route_t rulebased_get_bypass_route(AS_t rc, const char *src, const char *dst) {
   return NULL;
 }
 
index 029b1ff..bffcb4f 100644 (file)
@@ -8,19 +8,17 @@
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_vivaldi, surf, "Routing part of surf");
 
 /* Business methods */
-static route_extended_t vivaldi_get_route(AS_t rc,
-                                            const char *src,
-                                            const char *dst)
+static route_t vivaldi_get_route(AS_t rc, const char *src, const char *dst)
 {
          xbt_assert(rc && src
                      && dst,
                      "Invalid params for \"get_route\" function at AS \"%s\"",
                      rc->name);
 
-         route_extended_t new_e_route = xbt_new0(s_route_extended_t, 1);
+         route_t new_e_route = xbt_new0(s_route_t, 1);
          new_e_route->src_gateway = ROUTER_PEER(src);
          new_e_route->dst_gateway = ROUTER_PEER(dst);
-         new_e_route->generic_route.link_list =  xbt_dynar_new(0, NULL);
+         new_e_route->link_list =  xbt_dynar_new(0, NULL);
          return new_e_route;
 }
 
@@ -56,14 +54,14 @@ static double base_vivaldi_get_latency (const char *src, const char *dst)
   return euclidean_dist / 1000;
 }
 
-static double vivaldi_get_link_latency (AS_t rc,const char *src, const char *dst, route_extended_t e_route)
+static double vivaldi_get_link_latency (AS_t rc,const char *src, const char *dst, route_t e_route)
 {
   if(routing_get_network_element_type(src) == SURF_NETWORK_ELEMENT_AS) {
          int need_to_clean = e_route?0:1;
          double latency;
          e_route = e_route ? e_route : rc->get_route(rc, src, dst);
          latency = base_vivaldi_get_latency(e_route->src_gateway,e_route->dst_gateway);
-         if(need_to_clean) generic_free_extended_route(e_route);
+         if(need_to_clean) generic_free_route(e_route);
          return latency;
   } else {
          return base_vivaldi_get_latency(src,dst);