Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Completely remove route_t and replace by sg_platf_route_cbarg_t.
authornavarro <navarro@caraja.(none)>
Tue, 28 Aug 2012 12:51:46 +0000 (14:51 +0200)
committernavarro <navarro@caraja.(none)>
Tue, 28 Aug 2012 12:51:46 +0000 (14:51 +0200)
13 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
src/surf/surfxml_parse.c

index e305860..e19eddd 100644 (file)
@@ -144,7 +144,7 @@ static void recursiveGraphExtraction (AS_t rc, container_t container, xbt_dict_t
       if (strcmp (child1_name, child2_name) == 0) continue;
 
       //get the route
-      route_t route = xbt_new0(s_route_t,1);
+      sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
       route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
       rc->get_route_and_latency(rc, child1->net_elm, child2->net_elm,
                                 route, NULL);
@@ -160,8 +160,8 @@ static void recursiveGraphExtraction (AS_t rc, container_t container, xbt_dict_t
       unsigned int cpt;
       void *link;
       container_t current, previous;
-      if (route->src_gateway){
-        previous = PJ_container_get(route->src_gateway->name);
+      if (route->gw_src){
+        previous = PJ_container_get(route->gw_src->name);
       }else{
         previous = child1;
       }
@@ -172,8 +172,8 @@ static void recursiveGraphExtraction (AS_t rc, container_t container, xbt_dict_t
         linkContainers(previous, current, filter);
         previous = current;
       }
-      if (route->dst_gateway){
-        current = PJ_container_get(route->dst_gateway->name);
+      if (route->gw_dst){
+        current = PJ_container_get(route->gw_dst->name);
       }else{
         current = child2;
       }
@@ -505,7 +505,7 @@ static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xb
       if (strcmp (child1_name, child2_name) == 0) continue;
 
       //get the route
-      route_t route = xbt_new0(s_route_t,1);
+      sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
       route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
       rc->get_route_and_latency(rc, child1->net_elm, child2->net_elm,
                                 route, NULL);
@@ -518,8 +518,8 @@ static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xb
       unsigned int cpt;
       void *link;
       xbt_node_t current, previous;
-      if (route->src_gateway){
-        previous = new_xbt_graph_node(graph, route->src_gateway->name, nodes);
+      if (route->gw_src){
+        previous = new_xbt_graph_node(graph, route->gw_src->name, nodes);
       }else{
         previous = new_xbt_graph_node(graph, child1_name, nodes);
       }
@@ -531,8 +531,8 @@ static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xb
         //previous -> current
         previous = current;
       }
-      if (route->dst_gateway){
-        current = new_xbt_graph_node(graph, route->dst_gateway->name, nodes);
+      if (route->gw_dst){
+        current = new_xbt_graph_node(graph, route->gw_dst->name, nodes);
       }else{
         current = new_xbt_graph_node(graph, child2_name, nodes);
       }
index 6e87529..80ba539 100644 (file)
@@ -154,12 +154,6 @@ typedef struct s_model_type {
   void (*end) (AS_t as);
 } s_routing_model_description_t, *routing_model_description_t;
 
-typedef struct s_route {
-  xbt_dynar_t link_list;
-  sg_routing_edge_t src_gateway;
-  sg_routing_edge_t dst_gateway;
-} s_route_t, *route_t;
-
 /* This enum used in the routing structure helps knowing in which situation we are. */
 typedef enum {
   SURF_ROUTING_NULL = 0,   /**< Undefined type                                   */
@@ -178,10 +172,10 @@ typedef struct s_as {
   sg_routing_edge_t net_elem;
   xbt_dynar_t link_up_down_list;
 
-  void (*get_route_and_latency) (AS_t as, sg_routing_edge_t src, sg_routing_edge_t dst, route_t into, double *latency);
+  void (*get_route_and_latency) (AS_t as, sg_routing_edge_t src, sg_routing_edge_t dst, sg_platf_route_cbarg_t into, double *latency);
 
   xbt_dynar_t(*get_onelink_routes) (AS_t as);
-  route_t(*get_bypass_route) (AS_t as, sg_routing_edge_t src, sg_routing_edge_t dst, double *lat);
+  sg_platf_route_cbarg_t(*get_bypass_route) (AS_t as, sg_routing_edge_t src, sg_routing_edge_t dst, double *lat);
   void (*finalize) (AS_t as);
 
 
@@ -191,12 +185,9 @@ typedef struct s_as {
    * Of course, only the routing model of this AS is informed, not every ones */
   int (*parse_PU) (AS_t as, sg_routing_edge_t elm); /* A host or a router, whatever */
   int (*parse_AS) (AS_t as, sg_routing_edge_t elm);
-  void (*parse_route) (AS_t as, const char *src,
-                     const char *dst, route_t route);
-  void (*parse_ASroute) (AS_t as, const char *src,
-                       const char *dst, route_t route);
-  void (*parse_bypassroute) (AS_t as, const char *src,
-                           const char *dst, route_t e_route);
+  void (*parse_route) (AS_t as, sg_platf_route_cbarg_t route);
+  void (*parse_ASroute) (AS_t as, sg_platf_route_cbarg_t route);
+  void (*parse_bypassroute) (AS_t as, sg_platf_route_cbarg_t e_route);
 } s_as_t;
 
 struct s_routing_platf {
@@ -210,7 +201,7 @@ XBT_PUBLIC(void) routing_model_create(void *loopback);
 XBT_PUBLIC(void) routing_exit(void);
 XBT_PUBLIC(void) storage_register_callbacks(void);
 XBT_PUBLIC(void) routing_register_callbacks(void);
-XBT_PUBLIC(void) generic_free_route(route_t route); // FIXME rename to routing_route_free
+XBT_PUBLIC(void) generic_free_route(sg_platf_route_cbarg_t route); // FIXME rename to routing_route_free
  // FIXME: make previous function private to routing again?
 
 
index 327195d..e0d8795 100644 (file)
@@ -225,16 +225,11 @@ static void parse_S_router(sg_platf_router_cbarg_t router)
  */
 static void parse_E_route(sg_platf_route_cbarg_t route)
 {
-  route_t created_route = xbt_new0(s_route_t, 1);
-  created_route->link_list = route->link_list;
-
   xbt_assert(current_routing->parse_route,
              "no defined method \"set_route\" in \"%s\"",
              current_routing->name);
 
-  current_routing->parse_route(current_routing,
-      route->src, route->dst, created_route);
-  generic_free_route(created_route);
+  current_routing->parse_route(current_routing, route);
 }
 
 /**
@@ -242,16 +237,10 @@ static void parse_E_route(sg_platf_route_cbarg_t route)
  */
 static void parse_E_ASroute(sg_platf_route_cbarg_t ASroute)
 {
-  route_t e_route = xbt_new0(s_route_t, 1);
-  e_route->link_list = ASroute->link_list;
-  e_route->src_gateway = ASroute->gw_src;
-  e_route->dst_gateway = ASroute->gw_dst;
-
   xbt_assert(current_routing->parse_ASroute,
              "no defined method \"set_ASroute\" in \"%s\"",
              current_routing->name);
-  current_routing->parse_ASroute(current_routing, ASroute->src, ASroute->dst, e_route);
-  generic_free_route(e_route);
+  current_routing->parse_ASroute(current_routing, ASroute);
 }
 
 /**
@@ -259,14 +248,11 @@ static void parse_E_ASroute(sg_platf_route_cbarg_t ASroute)
  */
 static void parse_E_bypassRoute(sg_platf_route_cbarg_t route)
 {
-  route_t e_route = xbt_new0(s_route_t, 1);
-  e_route->link_list = route->link_list;
-
   xbt_assert(current_routing->parse_bypassroute,
              "Bypassing mechanism not implemented by routing '%s'",
              current_routing->name);
 
-  current_routing->parse_bypassroute(current_routing, route->src, route->dst, e_route);
+  current_routing->parse_bypassroute(current_routing, route);
 }
 
 /**
@@ -274,14 +260,10 @@ static void parse_E_bypassRoute(sg_platf_route_cbarg_t route)
  */
 static void parse_E_bypassASroute(sg_platf_route_cbarg_t ASroute)
 {
-  route_t e_route = xbt_new0(s_route_t, 1);
-  e_route->link_list = ASroute->link_list;
-  e_route->src_gateway = ASroute->gw_src;
-  e_route->dst_gateway = ASroute->gw_dst;
   xbt_assert(current_routing->parse_bypassroute,
              "Bypassing mechanism not implemented by routing '%s'",
              current_routing->name);
-  current_routing->parse_bypassroute(current_routing, ASroute->src, ASroute->dst, e_route);
+  current_routing->parse_bypassroute(current_routing, ASroute);
 }
 
 static void routing_parse_trace(sg_platf_trace_cbarg_t trace)
@@ -535,7 +517,7 @@ static void elements_father(sg_routing_edge_t src, sg_routing_edge_t dst,
 static void _get_route_and_latency(sg_routing_edge_t src, sg_routing_edge_t dst,
                                    xbt_dynar_t * links, double *latency)
 {
-  s_route_t route;
+  s_sg_platf_route_cbarg_t route;
   memset(&route,0,sizeof(route));
 
   XBT_DEBUG("Solve route/latency  \"%s\" to \"%s\"", src->name, dst->name);
@@ -548,7 +530,7 @@ static void _get_route_and_latency(sg_routing_edge_t src, sg_routing_edge_t dst,
       common_father->name,src_father->name,dst_father->name);
 
   /* Check whether a direct bypass is defined */
-  route_t e_route_bypass = NULL;
+  sg_platf_route_cbarg_t e_route_bypass = NULL;
   if (common_father->get_bypass_route)
     e_route_bypass = common_father->get_bypass_route(common_father, src, dst, latency);
 
@@ -578,11 +560,11 @@ static void _get_route_and_latency(sg_routing_edge_t src, sg_routing_edge_t dst,
                                        src_father_net_elm, dst_father_net_elm,
                                        &route, latency);
 
-  xbt_assert((route.src_gateway != NULL) && (route.dst_gateway != NULL),
+  xbt_assert((route.gw_src != NULL) && (route.gw_dst != NULL),
       "bad gateways for route from \"%s\" to \"%s\"", src->name, dst->name);
 
-  sg_routing_edge_t src_gateway_net_elm = route.src_gateway;
-  sg_routing_edge_t dst_gateway_net_elm = route.dst_gateway;
+  sg_routing_edge_t src_gateway_net_elm = route.gw_src;
+  sg_routing_edge_t dst_gateway_net_elm = route.gw_dst;
 
   /* If source gateway is not our source, we have to recursively find our way up to this point */
   if (src != src_gateway_net_elm)
index d30668d..37f2e32 100644 (file)
@@ -16,7 +16,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"
 /* Business methods */
 static void cluster_get_route_and_latency(AS_t as,
     sg_routing_edge_t src, sg_routing_edge_t dst,
-                                          route_t route, double *lat) {
+    sg_platf_route_cbarg_t route, double *lat) {
 
       s_surf_parsing_link_up_down_t info;
     XBT_DEBUG("cluster_get_route_and_latency from '%s'[%d] to '%s'[%d]",
index 2d7b1dd..7d7eac4 100644 (file)
@@ -53,7 +53,7 @@ static void graph_node_map_elem_free(void *e)
 
 static void graph_edge_data_free(void *e) // FIXME: useless code dupplication
 {
-  route_t e_route = (route_t) e;
+  sg_platf_route_cbarg_t e_route = (sg_platf_route_cbarg_t) e;
   if (e_route) {
     xbt_dynar_free(&(e_route->link_list));
     xbt_free(e_route);
@@ -95,7 +95,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_t e_route)
+    int dst_id, sg_platf_route_cbarg_t e_route)
 {
   XBT_DEBUG("Load Route from \"%d\" to \"%d\"", src_id, dst_id);
   xbt_node_t src = NULL;
@@ -154,7 +154,7 @@ static void add_loopback_dijkstra(as_dijkstra_t as) {
     }
 
     if (!found) {
-      route_t e_route = xbt_new0(s_route_t, 1);
+      sg_platf_route_cbarg_t e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
       e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
       xbt_dynar_push(e_route->link_list,
           &routing_platf->loopback);
@@ -164,12 +164,12 @@ static void add_loopback_dijkstra(as_dijkstra_t as) {
 }
 
 static void dijkstra_get_route_and_latency(AS_t as_generic,
-    sg_routing_edge_t src, sg_routing_edge_t dst, route_t route, double *lat);
+    sg_routing_edge_t src, sg_routing_edge_t dst, sg_platf_route_cbarg_t route, double *lat);
 
 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);
+  sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
   route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
 
   int src,dst;
@@ -190,8 +190,8 @@ static xbt_dynar_t dijkstra_get_onelink_routes(AS_t as)
           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;
+          onelink->src = route->gw_src;
+          onelink->dst = route->gw_dst;
         }
         xbt_dynar_push(ret, &onelink);
       }
@@ -202,7 +202,7 @@ static xbt_dynar_t dijkstra_get_onelink_routes(AS_t as)
 
 static void dijkstra_get_route_and_latency(AS_t asg,
     sg_routing_edge_t src, sg_routing_edge_t dst,
-    route_t route, double *lat)
+    sg_platf_route_cbarg_t route, double *lat)
 {
 
   /* set utils vars */
@@ -220,7 +220,7 @@ static void dijkstra_get_route_and_latency(AS_t asg,
   int dst_node_id = 0;
   int *nodeid = NULL;
   int v;
-  route_t e_route;
+  sg_platf_route_cbarg_t e_route;
   int size = 0;
   unsigned int cpt;
   void *link;
@@ -250,7 +250,7 @@ static void dijkstra_get_route_and_latency(AS_t asg,
     if (edge == NULL)
       THROWF(arg_error,0,"No route from '%s' to '%s'",src->name,dst->name);
 
-    e_route = (route_t) xbt_graph_edge_get_data(edge);
+    e_route = (sg_platf_route_cbarg_t) xbt_graph_edge_get_data(edge);
 
     links = e_route->link_list;
     xbt_dynar_foreach(links, cpt, link) {
@@ -309,7 +309,7 @@ static void dijkstra_get_route_and_latency(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_t tmp_e_route = (route_t) xbt_graph_edge_get_data(edge);
+        sg_platf_route_cbarg_t tmp_e_route = (sg_platf_route_cbarg_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]) {
@@ -345,9 +345,9 @@ static void dijkstra_get_route_and_latency(AS_t asg,
 
     prev_gw_src = gw_src;
 
-    e_route = (route_t) xbt_graph_edge_get_data(edge);
-    gw_src = e_route->src_gateway;
-    gw_dst = e_route->dst_gateway;
+    e_route = (sg_platf_route_cbarg_t) xbt_graph_edge_get_data(edge);
+    gw_src = e_route->gw_src;
+    gw_dst = e_route->gw_dst;
 
     if (v == dst_node_id)
       first_gw = gw_dst;
@@ -378,8 +378,8 @@ static void dijkstra_get_route_and_latency(AS_t asg,
   }
 
   if (asg->hierarchy == SURF_ROUTING_RECURSIVE) {
-    route->src_gateway = gw_src;
-    route->dst_gateway = first_gw;
+    route->gw_src = gw_src;
+    route->gw_dst = first_gw;
   }
 
   if (as->cached && elm == NULL) {
@@ -466,20 +466,22 @@ void model_dijkstra_both_end(AS_t as)
   }
 
 }
-void model_dijkstra_both_parse_route (AS_t asg, const char *src,
-    const char *dst, route_t route)
+void model_dijkstra_both_parse_route (AS_t asg, sg_platf_route_cbarg_t route)
 {
+  char *src = (char*)(route->src);
+  char *dst = (char*)(route->dst);
+
   int as_route = 0;
-  if(!route->dst_gateway && !route->src_gateway)
+  if(!route->gw_dst && !route->gw_src)
     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);
+        route->gw_src->name, dst, route->gw_dst->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);
+    if(route->gw_dst->rc_type == SURF_NETWORK_ELEMENT_NULL)
+      xbt_die("The gw_dst '%s' does not exist!",route->gw_dst->name);
+    if(route->gw_src->rc_type == SURF_NETWORK_ELEMENT_NULL)
+      xbt_die("The gw_src '%s' does not exist!",route->gw_src->name);
   }
 
   as_dijkstra_t as = (as_dijkstra_t) asg;
@@ -500,19 +502,19 @@ void model_dijkstra_both_parse_route (AS_t asg, const char *src,
   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);
+  sg_platf_route_cbarg_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->symmetrical == TRUE && as_route == 0)
+      || (route->symmetrical == TRUE && as_route == 1)
   )
   {
-    if(!route->dst_gateway && !route->src_gateway)
+    if(!route->gw_dst && !route->gw_src)
       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);
+          route->gw_dst->name, src, route->gw_src->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);
@@ -523,13 +525,14 @@ void model_dijkstra_both_parse_route (AS_t asg, const char *src,
     if (edge)
       THROWF(arg_error,0,"(AS)Route from '%s' to '%s' already exists",src,dst);
 
-    if (route->dst_gateway && route->src_gateway) {
+    if (route->gw_dst && route->gw_src) {
       sg_routing_edge_t gw_tmp;
-      gw_tmp = route->src_gateway;
-      route->src_gateway = route->dst_gateway;
-      route->dst_gateway = gw_tmp;
+      gw_tmp = route->gw_src;
+      route->gw_src = route->gw_dst;
+      route->gw_dst = gw_tmp;
     }
-    route_t link_route_back = generic_new_extended_route(asg->hierarchy, route, 0);
+    sg_platf_route_cbarg_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);
   }
+  xbt_dynar_free(&route->link_list);
 }
index bcb048e..5bce7d4 100644 (file)
@@ -22,17 +22,17 @@ typedef struct {
   /* vars for calculate the floyd algorith. */
   int *predecessor_table;
   double *cost_table;
-  route_t *link_table;
+  sg_platf_route_cbarg_t *link_table;
 } s_as_floyd_t, *as_floyd_t;
 
 static void floyd_get_route_and_latency(AS_t asg, sg_routing_edge_t src, sg_routing_edge_t dst,
-    route_t res, double *lat);
+    sg_platf_route_cbarg_t res, double *lat);
 
 /* Business methods */
 static xbt_dynar_t floyd_get_onelink_routes(AS_t asg)
 {
   xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
-  route_t route =   xbt_new0(s_route_t, 1);
+  sg_platf_route_cbarg_t route =   xbt_new0(s_sg_platf_route_cbarg_t, 1);
   route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
 
   int src,dst;
@@ -53,8 +53,8 @@ static xbt_dynar_t floyd_get_onelink_routes(AS_t asg)
           onelink->src = src_elm;
           onelink->dst = dst_elm;
         } else if (asg->hierarchy == SURF_ROUTING_RECURSIVE) {
-          onelink->src = route->src_gateway;
-          onelink->dst = route->dst_gateway;
+          onelink->src = route->gw_src;
+          onelink->dst = route->gw_dst;
         }
         xbt_dynar_push(ret, &onelink);
       }
@@ -65,7 +65,7 @@ static xbt_dynar_t floyd_get_onelink_routes(AS_t asg)
 }
 
 static void floyd_get_route_and_latency(AS_t asg, sg_routing_edge_t src, sg_routing_edge_t dst,
-    route_t res, double *lat)
+    sg_platf_route_cbarg_t res, double *lat)
 {
 
   /* set utils vars */
@@ -75,32 +75,32 @@ static void floyd_get_route_and_latency(AS_t asg, sg_routing_edge_t src, sg_rout
   generic_src_dst_check(asg, src, dst);
 
   /* create a result route */
-  xbt_dynar_t route_stack = xbt_dynar_new(sizeof(route_t), NULL);
+  xbt_dynar_t route_stack = xbt_dynar_new(sizeof(sg_platf_route_cbarg_t), NULL);
   int pred;
   int cur = dst->id;
   do {
     pred = TO_FLOYD_PRED(src->id, cur);
     if (pred == -1)
       THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name, dst->name);
-    xbt_dynar_push_as(route_stack, route_t, TO_FLOYD_LINK(pred, cur));
+    xbt_dynar_push_as(route_stack, sg_platf_route_cbarg_t, TO_FLOYD_LINK(pred, cur));
     cur = pred;
   } while (cur != src->id);
 
   if (asg->hierarchy == SURF_ROUTING_RECURSIVE) {
-    res->src_gateway = xbt_dynar_getlast_as(route_stack, route_t)->src_gateway;
-    res->dst_gateway = xbt_dynar_getfirst_as(route_stack, route_t)->dst_gateway;
+    res->gw_src = xbt_dynar_getlast_as(route_stack, sg_platf_route_cbarg_t)->gw_src;
+    res->gw_dst = xbt_dynar_getfirst_as(route_stack, sg_platf_route_cbarg_t)->gw_dst;
   }
 
   sg_routing_edge_t prev_dst_gw = NULL;
   while (!xbt_dynar_is_empty(route_stack)) {
-    route_t e_route = xbt_dynar_pop_as(route_stack, route_t);
+    sg_platf_route_cbarg_t e_route = xbt_dynar_pop_as(route_stack, sg_platf_route_cbarg_t);
     xbt_dynar_t links;
     sg_routing_link_t link;
     unsigned int cpt;
 
     if (asg->hierarchy == SURF_ROUTING_RECURSIVE && prev_dst_gw != NULL
-        && strcmp(prev_dst_gw->name, e_route->src_gateway->name)) {
-      routing_get_route_and_latency(prev_dst_gw, e_route->src_gateway,
+        && strcmp(prev_dst_gw->name, e_route->gw_src->name)) {
+      routing_get_route_and_latency(prev_dst_gw, e_route->gw_src,
                                     &res->link_list, lat);
     }
 
@@ -111,7 +111,7 @@ static void floyd_get_route_and_latency(AS_t asg, sg_routing_edge_t src, sg_rout
         *lat += surf_network_model->extension.network.get_link_latency(link);
     }
 
-    prev_dst_gw = e_route->dst_gateway;
+    prev_dst_gw = e_route->gw_dst;
   }
   xbt_dynar_free(&route_stack);
 }
@@ -166,7 +166,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_t, table_size * table_size);    /* actual link between src and dst */
+    as->link_table = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);    /* actual link between src and dst */
 
     /* Initialize costs and predecessors */
     for (i = 0; i < table_size; i++)
@@ -180,11 +180,11 @@ void model_floyd_end(AS_t current_routing)
   /* Add the loopback if needed */
   if (routing_platf->loopback && current_routing->hierarchy == SURF_ROUTING_BASE) {
     for (i = 0; i < table_size; i++) {
-      route_t e_route = TO_FLOYD_LINK(i, i);
+      sg_platf_route_cbarg_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 = xbt_new0(s_sg_platf_route_cbarg_t, 1);
+        e_route->gw_src = NULL;
+        e_route->gw_dst = NULL;
         e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
         xbt_dynar_push(e_route->link_list, &routing_platf->loopback);
         TO_FLOYD_LINK(i, i) = e_route;
@@ -217,9 +217,11 @@ 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,
-    const char *dst, route_t route)
+void model_floyd_parse_route(AS_t rc, sg_platf_route_cbarg_t route)
 {
+  char *src = (char*)(route->src);
+  char *dst = (char*)(route->dst);
+
   int as_route = 0;
   as_floyd_t as = (as_floyd_t) rc;
 
@@ -239,7 +241,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_t, table_size * table_size);    /* actual link between src and dst */
+    as->link_table = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);    /* actual link between src and dst */
 
     /* Initialize costs and predecessors */
     for (i = 0; i < table_size; i++)
@@ -249,16 +251,16 @@ void model_floyd_parse_route(AS_t rc, const char *src,
         TO_FLOYD_LINK(i, j) = NULL;       /* fixed, missing in the previous version */
       }
   }
-  if(!route->dst_gateway && !route->src_gateway)
+  if(!route->gw_dst && !route->gw_src)
     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);
+        route->gw_src->name, dst, route->gw_dst->name);
+    if(route->gw_dst->rc_type == SURF_NETWORK_ELEMENT_NULL)
+      xbt_die("The dst_gateway '%s' does not exist!",route->gw_dst->name);
+    if(route->gw_src->rc_type == SURF_NETWORK_ELEMENT_NULL)
+      xbt_die("The src_gateway '%s' does not exist!",route->gw_src->name);
   }
 
   if(TO_FLOYD_LINK(src_net_elm->id, dst_net_elm->id))
@@ -288,17 +290,17 @@ void model_floyd_parse_route(AS_t rc, const char *src,
         ((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 ( (route->symmetrical == TRUE && as_route == 0)
+      || (route->symmetrical == TRUE && as_route == 1)
   )
   {
     if(TO_FLOYD_LINK(dst_net_elm->id, src_net_elm->id))
     {
-      if(!route->dst_gateway && !route->src_gateway)
+      if(!route->gw_dst && !route->gw_src)
         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);
+            route->gw_src->name, src, route->gw_dst->name);
       char * link_name;
       unsigned int i;
       xbt_dynar_t link_route_to_test = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
@@ -317,19 +319,19 @@ void model_floyd_parse_route(AS_t rc, const char *src,
     }
     else
     {
-      if(route->dst_gateway && route->src_gateway)
+      if(route->gw_dst && route->gw_src)
       {
-        sg_routing_edge_t gw_src = route->src_gateway;
-        sg_routing_edge_t gw_dst = route->dst_gateway;
-        route->src_gateway = gw_dst;
-        route->dst_gateway = gw_src;
+        sg_routing_edge_t gw_src = route->gw_src;
+        sg_routing_edge_t gw_dst = route->gw_dst;
+        route->gw_src = gw_dst;
+        route->gw_dst = gw_src;
       }
 
-      if(!route->dst_gateway && !route->src_gateway)
+      if(!route->gw_src && !route->gw_dst)
         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);
+            route->gw_src->name, src, route->gw_dst->name);
 
       TO_FLOYD_LINK(dst_net_elm->id, src_net_elm->id) =
           generic_new_extended_route(rc->hierarchy, route, 0);
@@ -338,4 +340,5 @@ void model_floyd_parse_route(AS_t rc, const char *src,
           ((TO_FLOYD_LINK(dst_net_elm->id, src_net_elm->id))->link_list)->used;   /* count of links, old model assume 1 */
     }
   }
+  xbt_dynar_free(&route->link_list);
 }
index 25a2079..1544595 100644 (file)
@@ -18,7 +18,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_t *routing_table;
+  sg_platf_route_cbarg_t *routing_table;
 } s_routing_component_full_t, *routing_component_full_t;
 
 /* Business methods */
@@ -32,7 +32,7 @@ static xbt_dynar_t full_get_onelink_routes(AS_t rc)
 
   for(src=0; src < table_size; src++) {
     for(dst=0; dst< table_size; dst++) {
-      route_t route = TO_ROUTE_FULL(src, dst);
+      sg_platf_route_cbarg_t route = TO_ROUTE_FULL(src, dst);
       if (route) {
         if (xbt_dynar_length(route->link_list) == 1) {
           void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0);
@@ -44,8 +44,8 @@ static xbt_dynar_t full_get_onelink_routes(AS_t rc)
             onelink->dst = xbt_dynar_get_as(rc->index_network_elm,dst,sg_routing_edge_t);
             onelink->dst->id = dst;
           } else if (rc->hierarchy == SURF_ROUTING_RECURSIVE) {
-            onelink->src = route->src_gateway;
-            onelink->dst = route->dst_gateway;
+            onelink->src = route->gw_src;
+            onelink->dst = route->gw_dst;
           }
           xbt_dynar_push(ret, &onelink);
           XBT_DEBUG("Push route from '%d' to '%d'",
@@ -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,
     sg_routing_edge_t src, sg_routing_edge_t dst,
-    route_t res, double *lat)
+    sg_platf_route_cbarg_t res, double *lat)
 {
   XBT_DEBUG("full_get_route_and_latency from %s[%d] to %s[%d]",
       src->name,
@@ -72,15 +72,15 @@ static void full_get_route_and_latency(AS_t rc,
   routing_component_full_t routing = (routing_component_full_t) rc;
   size_t table_size = xbt_dynar_length(routing->generic_routing.index_network_elm);
 
-  route_t e_route = NULL;
+  sg_platf_route_cbarg_t e_route = NULL;
   void *link;
   unsigned int cpt = 0;
 
   e_route = TO_ROUTE_FULL(src->id, dst->id);
 
   if (e_route) {
-    res->src_gateway = e_route->src_gateway;
-    res->dst_gateway = e_route->dst_gateway;
+    res->gw_src = e_route->gw_src;
+    res->gw_dst = e_route->gw_dst;
     xbt_dynar_foreach(e_route->link_list, cpt, link) {
       xbt_dynar_push(res->link_list, &link);
       if (lat)
@@ -124,7 +124,7 @@ AS_t model_full_create(void)
 void model_full_end(AS_t current_routing)
 {
   unsigned int i;
-  route_t e_route;
+  sg_platf_route_cbarg_t e_route;
 
   /* set utils vars */
   routing_component_full_t routing =
@@ -133,16 +133,16 @@ void model_full_end(AS_t current_routing)
 
   /* Create table if necessary */
   if (!routing->routing_table)
-    routing->routing_table = xbt_new0(route_t, table_size * table_size);
+    routing->routing_table = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);
 
   /* Add the loopback if needed */
   if (routing_platf->loopback && 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_t, 1);
-        e_route->src_gateway = NULL;
-        e_route->dst_gateway = NULL;
+        e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
+        e_route->gw_src = NULL;
+        e_route->gw_dst = NULL;
         e_route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
         xbt_dynar_push(e_route->link_list, &routing_platf->loopback);
         TO_ROUTE_FULL(i, i) = e_route;
@@ -156,11 +156,12 @@ static int full_pointer_resource_cmp(const void *a, const void *b)
   return a != b;
 }
 
-void model_full_set_route(AS_t rc, const char *src,
-    const char *dst, route_t route)
+void model_full_set_route(AS_t rc, sg_platf_route_cbarg_t route)
 {
-  sg_routing_edge_t src_net_elm, dst_net_elm;
   int as_route = 0;
+  char *src = (char*)(route->src);
+  char *dst = (char*)(route->dst);
+  sg_routing_edge_t src_net_elm, dst_net_elm;
   src_net_elm = sg_routing_edge_by_name_or_null(src);
   dst_net_elm = sg_routing_edge_by_name_or_null(dst);
 
@@ -175,7 +176,7 @@ void model_full_set_route(AS_t rc, const char *src,
       src, dst);
 
   if (!routing->routing_table)
-    routing->routing_table = xbt_new0(route_t, table_size * table_size);
+    routing->routing_table = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);
 
   if (TO_ROUTE_FULL(src_net_elm->id, dst_net_elm->id)) {
     char *link_name;
@@ -199,7 +200,7 @@ void model_full_set_route(AS_t rc, const char *src,
           "between \"%s\" and \"%s\"", src, dst);
     }
   } else {
-    if (!route->dst_gateway && !route->src_gateway)
+    if (!route->gw_dst && !route->gw_dst)
       XBT_DEBUG("Load Route from \"%s\" to \"%s\"", src, dst);
     else {
       // FIXME We can call a gw which is down the current AS (cf g5k.xml) but not upper.
@@ -230,11 +231,11 @@ void model_full_set_route(AS_t rc, const char *src,
       //                         route->dst_gateway, subas->name);
       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);
+          src, route->gw_src->name, dst, route->gw_dst->name);
+      if (route->gw_dst->rc_type == SURF_NETWORK_ELEMENT_NULL)
+        xbt_die("The dst_gateway '%s' does not exist!", route->gw_dst->name);
+      if (route->gw_src->rc_type == SURF_NETWORK_ELEMENT_NULL)
+        xbt_die("The src_gateway '%s' does not exist!", route->gw_src->name);
     }
     TO_ROUTE_FULL(src_net_elm->id, dst_net_elm->id) =
         generic_new_extended_route(rc->hierarchy, route, 1);
@@ -244,11 +245,11 @@ void model_full_set_route(AS_t rc, const char *src,
   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->gw_dst && route->gw_src) {
       sg_routing_edge_t gw_tmp;
-      gw_tmp = route->src_gateway;
-      route->src_gateway = route->dst_gateway;
-      route->dst_gateway = gw_tmp;
+      gw_tmp = route->gw_src;
+      route->gw_src = route->gw_dst;
+      route->gw_dst = gw_tmp;
     }
     if (TO_ROUTE_FULL(dst_net_elm->id, src_net_elm->id)) {
       char *link_name;
@@ -267,14 +268,15 @@ void model_full_set_route(AS_t rc, const char *src,
           "The route between \"%s\" and \"%s\" already exists", src,
           dst);
     } else {
-      if (!route->dst_gateway && !route->src_gateway)
+      if (!route->gw_dst && !route->gw_src)
         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->gw_src->name, src, route->gw_dst->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);
     }
   }
+  xbt_dynar_free(&route->link_list);
 }
index 2ee5f75..a3dd35c 100644 (file)
@@ -52,11 +52,12 @@ int generic_parse_AS(AS_t as, sg_routing_edge_t elm)
   return xbt_dynar_length(as->index_network_elm)-1;
 }
 
-void generic_parse_bypassroute(AS_t rc,
-    const char *src, const char *dst,
-    route_t e_route)
+void generic_parse_bypassroute(AS_t rc, sg_platf_route_cbarg_t e_route)
 {
-  if(e_route->dst_gateway)
+  char *src = (char*)(e_route->src);
+  char *dst = (char*)(e_route->dst);
+
+  if(e_route->gw_dst)
     XBT_DEBUG("Load bypassASroute from \"%s\" to \"%s\"", src, dst);
   else
     XBT_DEBUG("Load bypassRoute from \"%s\" to \"%s\"", src, dst);
@@ -69,16 +70,15 @@ void generic_parse_bypassroute(AS_t rc,
       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->name, dst, e_route->dst_gateway->name);
+      src, e_route->gw_src->name, dst, e_route->gw_dst->name);
 
-  route_t new_e_route = NULL;
-  if(e_route->dst_gateway)
+  sg_platf_route_cbarg_t new_e_route = NULL;
+  if(e_route->gw_dst)
     new_e_route =  generic_new_extended_route(SURF_ROUTING_RECURSIVE, e_route, 1);
   else
     new_e_route =  generic_new_extended_route(SURF_ROUTING_BASE, e_route, 1);
 
   xbt_dynar_free(&(e_route->link_list));
-  xbt_free(e_route);
 
   xbt_dict_set(dict_bypassRoutes, route_name, new_e_route, NULL);
   no_bypassroute_declared = 0;
@@ -93,14 +93,14 @@ xbt_dynar_t generic_get_onelink_routes(AS_t rc) { // FIXME: kill that stub
   return NULL;
 }
 
-route_t generic_get_bypassroute(AS_t rc, sg_routing_edge_t src, sg_routing_edge_t dst, double *lat)
+sg_platf_route_cbarg_t generic_get_bypassroute(AS_t rc, sg_routing_edge_t src, sg_routing_edge_t dst, double *lat)
 {
   // If never set a bypass route return NULL without any further computations
   XBT_DEBUG("generic_get_bypassroute from %s to %s",src->name,dst->name);
   if(no_bypassroute_declared)
     return NULL;
 
-  route_t e_route_bypass = NULL;
+  sg_platf_route_cbarg_t e_route_bypass = NULL;
   xbt_dict_t dict_bypassRoutes = rc->bypassRoutes;
 
   if(dst->rc_component == rc && src->rc_component == rc ){
@@ -206,13 +206,13 @@ route_t generic_get_bypassroute(AS_t rc, sg_routing_edge_t src, sg_routing_edge_
     xbt_dynar_free(&path_dst);
   }
 
-  route_t new_e_route = NULL;
+  sg_platf_route_cbarg_t new_e_route = NULL;
   if (e_route_bypass) {
     void *link;
     unsigned int cpt = 0;
-    new_e_route = xbt_new0(s_route_t, 1);
-    new_e_route->src_gateway = e_route_bypass->src_gateway;
-    new_e_route->dst_gateway = e_route_bypass->dst_gateway;
+    new_e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
+    new_e_route->gw_src = e_route_bypass->gw_src;
+    new_e_route->gw_dst = e_route_bypass->gw_dst;
     new_e_route->link_list =
         xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
     xbt_dynar_foreach(e_route_bypass->link_list, cpt, link) {
@@ -228,15 +228,15 @@ route_t generic_get_bypassroute(AS_t rc, sg_routing_edge_t src, sg_routing_edge_
 /* ************************************************************************** */
 /* ************************* GENERIC AUX FUNCTIONS ************************** */
 /* change a route containing link names into a route containing link entities */
-route_t
+sg_platf_route_cbarg_t
 generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy,
-    route_t routearg, int change_order) {
+    sg_platf_route_cbarg_t routearg, int change_order) {
 
-  route_t result;
+  sg_platf_route_cbarg_t result;
   char *link_name;
   unsigned int cpt;
 
-  result = xbt_new0(s_route_t, 1);
+  result = xbt_new0(s_sg_platf_route_cbarg_t, 1);
   result->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
 
   xbt_assert(hierarchy == SURF_ROUTING_BASE
@@ -245,12 +245,12 @@ generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy,
 
   if (hierarchy == SURF_ROUTING_RECURSIVE) {
 
-    xbt_assert(routearg->src_gateway && routearg->dst_gateway,
+    xbt_assert(routearg->gw_src && routearg->gw_dst,
         "NULL is obviously a bad gateway");
 
     /* remeber not erase the gateway names */
-    result->src_gateway = routearg->src_gateway;
-    result->dst_gateway = routearg->dst_gateway;
+    result->gw_src = routearg->gw_src;
+    result->gw_dst = routearg->gw_dst;
   }
 
   xbt_dynar_foreach(routearg->link_list, cpt, link_name) {
@@ -268,7 +268,7 @@ generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy,
   return result;
 }
 
-void generic_free_route(route_t route)
+void generic_free_route(sg_platf_route_cbarg_t route)
 {
   if (route) {
     xbt_dynar_free(&route->link_list);
index 0342cfd..1f403c8 100644 (file)
@@ -13,12 +13,12 @@ static xbt_dynar_t none_get_onelink_routes(AS_t rc) {
 }
 
 static void none_get_route_and_latency(AS_t rc, sg_routing_edge_t src, sg_routing_edge_t dst,
-                                       route_t res,double *lat)
+    sg_platf_route_cbarg_t res,double *lat)
 {
   *lat = 0.0;
 }
 
-static route_t none_get_bypass_route(AS_t rc,
+static sg_platf_route_cbarg_t none_get_bypass_route(AS_t rc,
     sg_routing_edge_t src,
     sg_routing_edge_t dst, double *lat) {
   return NULL;
index 112a13d..5490781 100644 (file)
@@ -31,14 +31,13 @@ void model_generic_finalize(AS_t as);
 
 int generic_parse_PU(AS_t rc, sg_routing_edge_t elm);
 int generic_parse_AS(AS_t rc, sg_routing_edge_t elm);
-void generic_parse_bypassroute(AS_t rc, const char *src, const char *dst,
-                               route_t e_route);
+void generic_parse_bypassroute(AS_t rc, sg_platf_route_cbarg_t e_route);
 
 /* ************************************************************************** */
 /* *************** GENERIC BUSINESS METHODS (declarations) ****************** */
 
 xbt_dynar_t generic_get_onelink_routes(AS_t rc);
-route_t generic_get_bypassroute(AS_t rc,
+sg_platf_route_cbarg_t generic_get_bypassroute(AS_t rc,
     sg_routing_edge_t src,
     sg_routing_edge_t dst,
     double *lat);
@@ -49,8 +48,8 @@ route_t generic_get_bypassroute(AS_t rc,
 /* change a route containing link names into a route containing link entities.
  * If change_order is true, the links are put in reverse order in the
  * produced route */
-route_t generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy,
-                                   route_t data, int preserve_order);
+sg_platf_route_cbarg_t generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy,
+                                   sg_platf_route_cbarg_t data, int preserve_order);
 AS_t
 generic_autonomous_system_exist(AS_t rc, char *element);
 AS_t
@@ -63,8 +62,7 @@ void generic_src_dst_check(AS_t rc, sg_routing_edge_t src,
 /* *************************** FLOYD ROUTING ******************************** */
 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_t route);
+void model_floyd_parse_route(AS_t rc, sg_platf_route_cbarg_t route);
 
 /* ************************************************** */
 /* ************** RULE-BASED ROUTING **************** */
@@ -92,15 +90,14 @@ AS_t model_dijkstra_both_create(int cached);    /* create by calling dijkstra or
 AS_t model_dijkstra_create(void);       /* create structures for dijkstra routing model */
 AS_t model_dijkstracache_create(void);  /* create structures for dijkstracache routing model */
 void model_dijkstra_both_end(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_t route);
+void model_dijkstra_both_parse_route (AS_t rc, sg_platf_route_cbarg_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_t route);
+    AS_t rc, sg_platf_route_cbarg_t route);
 
 
 #endif                          /* _SURF_SURF_ROUTING_PRIVATE_H */
index 0f0d8eb..53d87be 100644 (file)
@@ -75,10 +75,11 @@ static int model_rulebased_parse_AS(AS_t rc, sg_routing_edge_t elm)
   return -1;
 }
 
-static void model_rulebased_parse_route(AS_t rc,
-    const char *src, const char *dst,
-    route_t route)
+static void model_rulebased_parse_route(AS_t rc, sg_platf_route_cbarg_t route)
 {
+  char *src = (char*)(route->src);
+  char *dst = (char*)(route->dst);
+
   AS_rulebased_t routing = (AS_rulebased_t) rc;
   rule_route_t ruleroute = xbt_new0(s_rule_route_t, 1);
   const char *error;
@@ -104,10 +105,11 @@ static void model_rulebased_parse_route(AS_t rc,
   xbt_dynar_push(routing->list_route, &ruleroute);
 }
 
-static void model_rulebased_parse_ASroute(AS_t rc,
-    const char *src, const char *dst,
-    route_t route)
+static void model_rulebased_parse_ASroute(AS_t rc, sg_platf_route_cbarg_t route)
 {
+  char *src = (char*)(route->src);
+  char *dst = (char*)(route->dst);
+
   AS_rulebased_t routing = (AS_rulebased_t) rc;
   rule_route_extended_t ruleroute_e = xbt_new0(s_rule_route_extended_t, 1);
   const char *error;
@@ -125,29 +127,26 @@ static void model_rulebased_parse_ASroute(AS_t rc,
       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,
+  xbt_assert(ruleroute_e->generic_rule_route.re_dst,
       "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->generic_rule_route.re_str_link = route->link_list;
 
   // DIRTY PERL HACK AHEAD: with the rulebased routing, the {src,dst}_gateway fields
   // store the provided name instead of the entity directly (routing_parse_E_ASroute knows)
   //
   // This is because the user will provide something like "^AS_(.*)$" instead of the proper name of a given entity
-  ruleroute_e->re_src_gateway = xbt_strdup((char *)route->src_gateway);
-  ruleroute_e->re_dst_gateway = xbt_strdup((char *)route->dst_gateway);
+  ruleroute_e->re_src_gateway = xbt_strdup((char *)route->gw_src);
+  ruleroute_e->re_dst_gateway = xbt_strdup((char *)route->gw_dst);
   xbt_dynar_push(routing->list_ASroute, &ruleroute_e);
 
   /* make sure that they don't get freed */
   route->link_list = NULL;
-  route->src_gateway = route->dst_gateway = NULL;
+  route->gw_src = route->gw_dst = NULL;
 }
 
-static void model_rulebased_parse_bypassroute(AS_t rc,
-    const char *src,
-    const char *dst,
-    route_t e_route)
+static void model_rulebased_parse_bypassroute(AS_t rc,  sg_platf_route_cbarg_t e_route)
 {
   xbt_die("bypass routing not supported for Route-Based model");
 }
@@ -212,7 +211,7 @@ static char *remplace(char *value, const char **src_list, int src_size,
 
 static void rulebased_get_route_and_latency(AS_t rc,
     sg_routing_edge_t src, sg_routing_edge_t dst,
-    route_t res,double*lat);
+    sg_platf_route_cbarg_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);
@@ -237,7 +236,7 @@ static xbt_dynar_t rulebased_get_onelink_routes(AS_t rc)
   sg_routing_edge_t host = NULL;
   xbt_lib_foreach(as_router_lib, cursor, k1, host){
     void *link_ptr;
-    route_t route = xbt_new0(s_route_t,1);
+    sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
     route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
     rulebased_get_route_and_latency (rc, router, host, route,NULL);
 
@@ -264,7 +263,7 @@ static xbt_dynar_t rulebased_get_onelink_routes(AS_t rc)
 /* Business methods */
 static void rulebased_get_route_and_latency(AS_t rc,
     sg_routing_edge_t src, sg_routing_edge_t dst,
-    route_t route, double *lat)
+    sg_platf_route_cbarg_t route, double *lat)
 {
   XBT_DEBUG("rulebased_get_route_and_latency from '%s' to '%s'",src->name,dst->name);
   xbt_assert(rc && src
@@ -351,12 +350,12 @@ static void rulebased_get_route_and_latency(AS_t rc,
         (rule_route_extended_t) ruleroute;
     char *gw_src_name = remplace(ruleroute_extended->re_src_gateway, list_src, rc_src,
         list_dst, rc_dst);
-    route->src_gateway = sg_routing_edge_by_name_or_null(gw_src_name);
+    route->gw_src = sg_routing_edge_by_name_or_null(gw_src_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 = sg_routing_edge_by_name_or_null(gw_dst_name);
+    route->gw_dst = sg_routing_edge_by_name_or_null(gw_dst_name);
     xbt_free(gw_dst_name);
   }
 
@@ -366,7 +365,7 @@ static void rulebased_get_route_and_latency(AS_t rc,
     pcre_free_substring_list(list_dst);
 }
 
-static route_t rulebased_get_bypass_route(AS_t rc, sg_routing_edge_t src, sg_routing_edge_t dst, double *lat) {
+static sg_platf_route_cbarg_t rulebased_get_bypass_route(AS_t rc, sg_routing_edge_t src, sg_routing_edge_t dst, double *lat) {
   return NULL;
 }
 
index 3b97eaa..2079a80 100644 (file)
@@ -18,7 +18,7 @@ static XBT_INLINE double euclidean_dist_comp(int index, xbt_dynar_t src, xbt_dyn
 
 static void vivaldi_get_route_and_latency(
     AS_t rc, sg_routing_edge_t src_p, sg_routing_edge_t dst_p,
-    route_t route, double *lat)
+    sg_platf_route_cbarg_t route, double *lat)
 {
   s_surf_parsing_link_up_down_t info;
 
@@ -27,8 +27,8 @@ static void vivaldi_get_route_and_latency(
   char *dst = (char*)dst_p->name;
 
   if(src_p->rc_type == SURF_NETWORK_ELEMENT_AS) {
-    route->src_gateway = xbt_lib_get_or_null(as_router_lib,ROUTER_PEER(src),ROUTING_ASR_LEVEL);
-    route->dst_gateway = xbt_lib_get_or_null(as_router_lib,ROUTER_PEER(dst),ROUTING_ASR_LEVEL);
+    route->gw_src = xbt_lib_get_or_null(as_router_lib,ROUTER_PEER(src),ROUTING_ASR_LEVEL);
+    route->gw_dst = xbt_lib_get_or_null(as_router_lib,ROUTER_PEER(dst),ROUTING_ASR_LEVEL);
   }
 
   double euclidean_dist;
index 8693579..af741dc 100644 (file)
@@ -482,6 +482,7 @@ void STag_surfxml_route(void){
       A_surfxml_route_src, A_surfxml_route_dst);
   parsed_link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
 }
+
 void STag_surfxml_ASroute(void){
   xbt_assert(strlen(A_surfxml_ASroute_src) > 0 || strlen(A_surfxml_ASroute_dst) > 0
       || strlen(A_surfxml_ASroute_gw_src) > 0 || strlen(A_surfxml_ASroute_gw_dst) > 0,
@@ -490,12 +491,14 @@ void STag_surfxml_ASroute(void){
       A_surfxml_ASroute_gw_src,A_surfxml_ASroute_gw_dst);
   parsed_link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
 }
+
 void STag_surfxml_bypassRoute(void){
   xbt_assert(strlen(A_surfxml_bypassRoute_src) > 0 || strlen(A_surfxml_bypassRoute_dst) > 0,
       "Missing end-points while defining bupass route \"%s\"->\"%s\"",
       A_surfxml_bypassRoute_src, A_surfxml_bypassRoute_dst);
   parsed_link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
 }
+
 void STag_surfxml_bypassASroute(void){
   xbt_assert(strlen(A_surfxml_bypassASroute_src) > 0 || strlen(A_surfxml_bypassASroute_dst) > 0
       || strlen(A_surfxml_bypassASroute_gw_src) > 0 || strlen(A_surfxml_bypassASroute_gw_dst) > 0,