Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename routing_component to as, since that's just an AS at the end of the day
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 10 Nov 2011 15:51:03 +0000 (16:51 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 10 Nov 2011 17:44:53 +0000 (18:44 +0100)
13 files changed:
src/instr/instr_routing.c
src/instr/jedule/jedule_sd_binding.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 df7e05b..d41eca0 100644 (file)
@@ -83,11 +83,11 @@ static void linkContainers (container_t father, container_t src, container_t dst
   new_pajeEndLink(SIMIX_get_clock(), father, link_type, dst, "G", key);
 }
 
-static void recursiveGraphExtraction (routing_component_t rc, container_t container, xbt_dict_t filter)
+static void recursiveGraphExtraction (AS_t rc, container_t container, xbt_dict_t filter)
 {
   if (xbt_dict_length (rc->routing_sons)){
     xbt_dict_cursor_t cursor = NULL;
-    routing_component_t rc_son;
+    AS_t rc_son;
     char *child_name;
     //bottom-up recursion
     xbt_dict_foreach(rc->routing_sons, cursor, child_name, rc_son) {
@@ -386,11 +386,11 @@ static xbt_edge_t new_xbt_graph_edge (xbt_graph_t graph, xbt_node_t s, xbt_node_
 }
 
 static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges,
-    routing_component_t rc, container_t container)
+    AS_t rc, container_t container)
 {
   if (xbt_dict_length (rc->routing_sons)){
     xbt_dict_cursor_t cursor = NULL;
-    routing_component_t rc_son;
+    AS_t rc_son;
     char *child_name;
     //bottom-up recursion
     xbt_dict_foreach(rc->routing_sons, cursor, child_name, rc_son) {
index 8894bb9..8cf0f77 100644 (file)
@@ -53,11 +53,11 @@ void jedule_log_sd_event(SD_task_t task) {
        xbt_dynar_free(&host_list);
 }
 
-static void create_hierarchy(routing_component_t current_comp,
+static void create_hierarchy(AS_t current_comp,
                jed_simgrid_container_t current_container) {
        xbt_dict_cursor_t cursor = NULL;
        char *key;
-       routing_component_t elem;
+       AS_t elem;
        network_element_t network_elem;
 
        if( xbt_dict_length(current_comp->routing_sons) == 0 ) {
@@ -90,7 +90,7 @@ static void create_hierarchy(routing_component_t current_comp,
 
 void jedule_setup_platform() {
 
-       routing_component_t root_comp;
+       AS_t root_comp;
        // e_surf_network_element_type_t type;
 
        jed_simgrid_container_t root_container;
index 1ffe22c..0da0771 100644 (file)
@@ -101,12 +101,12 @@ typedef struct s_onelink {
 /**
  * Routing logic
  */
-typedef struct s_routing_component *routing_component_t;
+typedef struct s_as *AS_t;
 
 typedef struct s_model_type {
   const char *name;
   const char *desc;
-  routing_component_t (*create) ();
+  AS_t (*create) ();
   void (*end) ();
 } s_routing_model_description_t, *routing_model_description_t;
 
@@ -127,46 +127,46 @@ typedef enum {
   SURF_ROUTING_RECURSIVE   /**< Recursive case: also return gateway informations */
 } e_surf_routing_hierarchy_t;
 
-typedef struct s_routing_component {
+typedef struct s_as {
   xbt_dict_t to_index;                 /* char* -> network_element_t */
   xbt_dict_t bypassRoutes;             /* store bypass routes */
   routing_model_description_t routing;
   e_surf_routing_hierarchy_t hierarchy;
   char *name;
-  struct s_routing_component *routing_father;
+  struct s_as *routing_father;
   xbt_dict_t routing_sons;
-  route_extended_t(*get_route) (routing_component_t rc, const char *src,
+  route_extended_t(*get_route) (AS_t as, const char *src,
                                 const char *dst);
-  double(*get_latency) (routing_component_t rc, const char *src,
+  double(*get_latency) (AS_t as, const char *src,
                         const char *dst, route_extended_t e_route);
-  xbt_dynar_t(*get_onelink_routes) (routing_component_t rc);
+  xbt_dynar_t(*get_onelink_routes) (AS_t as);
   e_surf_network_element_type_t(*get_network_element_type) (const char *name);
-  route_extended_t(*get_bypass_route) (routing_component_t rc,
+  route_extended_t(*get_bypass_route) (AS_t as,
                                        const char *src, const char *dst);
-  void (*finalize) (routing_component_t rc);
+  void (*finalize) (AS_t as);
   /* The parser calls the following functions to inform the routing models
    * that a new element is added to the AS currently built.
    *
    * Of course, only the routing model of this AS is informed, not every ones */
-  void (*parse_PU) (routing_component_t rc, const char *name); /* A host or a router, whatever */
-  void (*parse_AS) (routing_component_t rc, const char *name);
-  void (*parse_route) (routing_component_t rc, const char *src,
+  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);
-  void (*parse_ASroute) (routing_component_t rc, const char *src,
+  void (*parse_ASroute) (AS_t as, const char *src,
                        const char *dst, route_extended_t route);
-  void (*parse_bypassroute) (routing_component_t rc, const char *src,
+  void (*parse_bypassroute) (AS_t as, const char *src,
                            const char *dst, route_extended_t e_route);
-} s_routing_component_t;
+} s_as_t;
 
 typedef struct s_network_element_info {
-  routing_component_t rc_component;
+  AS_t rc_component;
   e_surf_network_element_type_t rc_type;
 } s_network_element_info_t, *network_element_info_t;
 
 typedef int *network_element_t;
 
 struct s_routing_global {
-  routing_component_t root;
+  AS_t root;
   void *loopback;
   size_t size_of_link;
   xbt_dynar_t(*get_route) (const char *src, const char *dst);
index 434ddf1..f7bd97d 100644 (file)
@@ -37,7 +37,7 @@ static xbt_dict_t random_value = NULL;
 
 /* Global vars */
 routing_global_t global_routing = NULL;
-routing_component_t current_routing = NULL;
+AS_t current_routing = NULL;
 routing_model_description_t current_routing_model = NULL;
 
 /* global parse functions */
@@ -294,7 +294,7 @@ static void routing_parse_E_bypassRoute(void)
  */
 void routing_AS_begin(const char *AS_id, const char *wanted_routing_type)
 {
-  routing_component_t new_routing;
+  AS_t new_routing;
   routing_model_description_t model = NULL;
   int cpt;
 
@@ -313,7 +313,7 @@ void routing_AS_begin(const char *AS_id, const char *wanted_routing_type)
   }
 
   /* make a new routing component */
-  new_routing = (routing_component_t) (*(model->create)) ();
+  new_routing = (AS_t) (*(model->create)) ();
   new_routing->routing = model;
   new_routing->hierarchy = SURF_ROUTING_NULL;
   new_routing->name = xbt_strdup(AS_id);
@@ -392,21 +392,21 @@ void routing_AS_end()
  * father in the chain
  */
 static void elements_father(const char *src, const char *dst,
-                            routing_component_t * res_father,
-                            routing_component_t * res_src,
-                            routing_component_t * res_dst)
+                            AS_t * res_father,
+                            AS_t * res_src,
+                            AS_t * res_dst)
 {
   xbt_assert(src && dst, "bad parameters for \"elements_father\" method");
 #define ELEMENTS_FATHER_MAXDEPTH 16     /* increase if it is not enough */
-  routing_component_t src_as, dst_as;
-  routing_component_t path_src[ELEMENTS_FATHER_MAXDEPTH];
-  routing_component_t path_dst[ELEMENTS_FATHER_MAXDEPTH];
+  AS_t src_as, dst_as;
+  AS_t path_src[ELEMENTS_FATHER_MAXDEPTH];
+  AS_t path_dst[ELEMENTS_FATHER_MAXDEPTH];
   int index_src = 0;
   int index_dst = 0;
-  routing_component_t current;
-  routing_component_t current_src;
-  routing_component_t current_dst;
-  routing_component_t father;
+  AS_t current;
+  AS_t current_src;
+  AS_t current_dst;
+  AS_t father;
 
   /* (1) find the as where the src and dst are located */
   network_element_info_t src_data = xbt_lib_get_or_null(host_lib, src,
@@ -474,9 +474,9 @@ static void _get_route_latency(const char *src, const char *dst,
   XBT_DEBUG("Solve route/latency  \"%s\" to \"%s\"", src, dst);
   xbt_assert(src && dst, "bad parameters for \"_get_route_latency\" method");
 
-  routing_component_t common_father;
-  routing_component_t src_father;
-  routing_component_t dst_father;
+  AS_t common_father;
+  AS_t src_father;
+  AS_t dst_father;
   elements_father(src, dst, &common_father, &src_father, &dst_father);
 
   if (src_father == dst_father) {       /* SURF_ROUTING_BASE */
@@ -677,12 +677,12 @@ static double get_latency(const char *src, const char *dst)
  * This fuction is call by "finalize". It allow to finalize the 
  * AS or routing components. It delete all the structures.
  */
-static void _finalize(routing_component_t rc)
+static void _finalize(AS_t rc)
 {
   if (rc) {
     xbt_dict_cursor_t cursor = NULL;
     char *key;
-    routing_component_t elem;
+    AS_t elem;
     xbt_dict_foreach(rc->routing_sons, cursor, key, elem) {
       _finalize(elem);
     }
@@ -712,7 +712,7 @@ static void finalize(void)
   xbt_free(global_routing);
 }
 
-static xbt_dynar_t recursive_get_onelink_routes(routing_component_t rc)
+static xbt_dynar_t recursive_get_onelink_routes(AS_t rc)
 {
   xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
 
@@ -728,7 +728,7 @@ static xbt_dynar_t recursive_get_onelink_routes(routing_component_t rc)
   //recursing
   char *key;
   xbt_dict_cursor_t cursor = NULL;
-  routing_component_t rc_child;
+  AS_t rc_child;
   xbt_dict_foreach(rc->routing_sons, cursor, key, rc_child) {
     xbt_dynar_t onelink_child = recursive_get_onelink_routes(rc_child);
     if (onelink_child) {
index d4f3fbd..8a25091 100644 (file)
@@ -17,9 +17,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"
 static xbt_dict_t cluster_host_link = NULL; /* for tag cluster */
 
 /* Business methods */
-static route_extended_t cluster_get_route(routing_component_t rc,
-                                            const char *src,
-                                            const char *dst) {
+static route_extended_t cluster_get_route(AS_t as,
+                                          const char *src,
+                                          const char *dst) {
 
          xbt_dynar_t links_list = xbt_dynar_new(global_routing->size_of_link, NULL);
 
@@ -28,7 +28,7 @@ static route_extended_t cluster_get_route(routing_component_t rc,
          info = xbt_dict_get_or_null(cluster_host_link,src);
          if(info) xbt_dynar_push_as(links_list,void*,info->link_up); //link_up
 
-         info = xbt_dict_get_or_null(cluster_host_link,rc->name);
+         info = xbt_dict_get_or_null(cluster_host_link,as->name);
          if(info)  xbt_dynar_push_as(links_list,void*,info->link_up); //link_bb
 
          info = xbt_dict_get_or_null(cluster_host_link,dst);
@@ -42,12 +42,12 @@ static route_extended_t cluster_get_route(routing_component_t rc,
 }
 
 /* Creation routing model functions */
-routing_component_t model_cluster_create(void)
+AS_t model_cluster_create(void)
 {
-  routing_component_t new_component = model_none_create();
-  new_component->get_route = cluster_get_route;
+  AS_t result = model_none_create();
+  result->get_route = cluster_get_route;
 
-  return (routing_component_t) new_component;
+  return (AS_t) result;
 }
 
 void surf_routing_cluster_add_link(const char* host_id,surf_parsing_link_up_down_t info) {
index c2224b4..0c6c78c 100644 (file)
@@ -8,18 +8,18 @@
 
 /* Global vars */
 extern routing_global_t global_routing;
-extern routing_component_t current_routing;
+extern AS_t current_routing;
 extern routing_model_description_t current_routing_model;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf -- dijkstra routing logic");
 
 typedef struct {
-  s_routing_component_t generic_routing;
+  s_as_t generic_routing;
   xbt_graph_t route_graph;      /* xbt_graph */
   xbt_dict_t graph_node_map;    /* map */
   xbt_dict_t route_cache;       /* use in cache mode */
   int cached;
-} s_routing_component_dijkstra_t, *routing_component_dijkstra_t;
+} s_as_dijkstra_t, *as_dijkstra_t;
 
 
 typedef struct graph_node_data {
@@ -66,10 +66,9 @@ static void graph_edge_data_free(void *e)
 
 /* Utility functions */
 
-static xbt_node_t route_graph_new_node(routing_component_dijkstra_t rc,
+static xbt_node_t route_graph_new_node(as_dijkstra_t as,
                                        int id, int graph_id)
 {
-  routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
   xbt_node_t node = NULL;
   graph_node_data_t data = NULL;
   graph_node_map_element_t elm = NULL;
@@ -77,22 +76,21 @@ static xbt_node_t route_graph_new_node(routing_component_dijkstra_t rc,
   data = xbt_new0(struct graph_node_data, 1);
   data->id = id;
   data->graph_id = graph_id;
-  node = xbt_graph_new_node(routing->route_graph, data);
+  node = xbt_graph_new_node(as->route_graph, data);
 
   elm = xbt_new0(struct graph_node_map_element, 1);
   elm->node = node;
-  xbt_dict_set_ext(routing->graph_node_map, (char *) (&id), sizeof(int),
+  xbt_dict_set_ext(as->graph_node_map, (char *) (&id), sizeof(int),
                    (xbt_set_elm_t) elm, &graph_node_map_elem_free);
 
   return node;
 }
 
 static graph_node_map_element_t
-graph_node_map_search(routing_component_dijkstra_t rc, int id)
+graph_node_map_search(as_dijkstra_t as, int id)
 {
-  routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
   graph_node_map_element_t elm = (graph_node_map_element_t)
-      xbt_dict_get_or_null_ext(routing->graph_node_map,
+      xbt_dict_get_or_null_ext(as->graph_node_map,
                                (char *) (&id),
                                sizeof(int));
   return elm;
@@ -100,20 +98,19 @@ graph_node_map_search(routing_component_dijkstra_t rc, int id)
 
 /* Parsing */
 
-static void route_new_dijkstra(routing_component_dijkstra_t rc, int src_id,
+static void route_new_dijkstra(as_dijkstra_t as, int src_id,
                                int dst_id, route_extended_t e_route)
 {
-  routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
   XBT_DEBUG("Load Route from \"%d\" to \"%d\"", src_id, dst_id);
   xbt_node_t src = NULL;
   xbt_node_t dst = NULL;
 
   graph_node_map_element_t src_elm = (graph_node_map_element_t)
-      xbt_dict_get_or_null_ext(routing->graph_node_map,
+      xbt_dict_get_or_null_ext(as->graph_node_map,
                                (char *) (&src_id),
                                sizeof(int));
   graph_node_map_element_t dst_elm = (graph_node_map_element_t)
-      xbt_dict_get_or_null_ext(routing->graph_node_map,
+      xbt_dict_get_or_null_ext(as->graph_node_map,
                                (char *) (&dst_id),
                                sizeof(int));
 
@@ -126,26 +123,23 @@ static void route_new_dijkstra(routing_component_dijkstra_t rc, int src_id,
 
   /* add nodes if they don't exist in the graph */
   if (src_id == dst_id && src == NULL && dst == NULL) {
-    src = route_graph_new_node(rc, src_id, -1);
+    src = route_graph_new_node(as, src_id, -1);
     dst = src;
   } else {
     if (src == NULL) {
-      src = route_graph_new_node(rc, src_id, -1);
+      src = route_graph_new_node(as, src_id, -1);
     }
     if (dst == NULL) {
-      dst = route_graph_new_node(rc, dst_id, -1);
+      dst = route_graph_new_node(as, dst_id, -1);
     }
   }
 
   /* add link as edge to graph */
-  xbt_graph_new_edge(routing->route_graph, src, dst, e_route);
+  xbt_graph_new_edge(as->route_graph, src, dst, e_route);
 }
 
-static void add_loopback_dijkstra(routing_component_dijkstra_t rc)
-{
-  routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
-
-  xbt_dynar_t nodes = xbt_graph_get_nodes(routing->route_graph);
+static void add_loopback_dijkstra(as_dijkstra_t as) {
+  xbt_dynar_t nodes = xbt_graph_get_nodes(as->route_graph);
 
   xbt_node_t node = NULL;
   unsigned int cursor2;
@@ -171,27 +165,26 @@ static void add_loopback_dijkstra(routing_component_dijkstra_t rc)
           xbt_dynar_new(global_routing->size_of_link, NULL);
       xbt_dynar_push(e_route->generic_route.link_list,
                      &global_routing->loopback);
-      xbt_graph_new_edge(routing->route_graph, node, node, e_route);
+      xbt_graph_new_edge(as->route_graph, node, node, e_route);
     }
   }
 }
 
-static route_extended_t dijkstra_get_route(routing_component_t rc,
+static route_extended_t dijkstra_get_route(AS_t as_generic,
         const char *src,
         const char *dst);
 
-static xbt_dynar_t dijkstra_get_onelink_routes(routing_component_t rc)
+static xbt_dynar_t dijkstra_get_onelink_routes(AS_t as)
 {
  // xbt_die("\"dijkstra_get_onelink_routes\" function not implemented yet");
          xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
 
-         routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
          //size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
          xbt_dict_cursor_t c1 = NULL, c2 = NULL;
          char *k1, *d1, *k2, *d2;
-         xbt_dict_foreach(routing->generic_routing.to_index, c1, k1, d1) {
-           xbt_dict_foreach(routing->generic_routing.to_index, c2, k2, d2) {
-             route_extended_t route = dijkstra_get_route(rc, k1, k2);
+         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);
              if (route) {
                if (xbt_dynar_length(route->generic_route.link_list) == 1) {
                  void *link =
@@ -199,10 +192,10 @@ static xbt_dynar_t dijkstra_get_onelink_routes(routing_component_t rc)
                                                   0);
                  onelink_t onelink = xbt_new0(s_onelink_t, 1);
                  onelink->link_ptr = link;
-                 if (routing->generic_routing.hierarchy == SURF_ROUTING_BASE) {
+                 if (as->hierarchy == SURF_ROUTING_BASE) {
                    onelink->src = xbt_strdup(k1);
                    onelink->dst = xbt_strdup(k2);
-                 } else if (routing->generic_routing.hierarchy ==
+                 } else if (as->hierarchy ==
                             SURF_ROUTING_RECURSIVE) {
                    onelink->src = xbt_strdup(route->src_gateway);
                    onelink->dst = xbt_strdup(route->dst_gateway);
@@ -215,21 +208,21 @@ static xbt_dynar_t dijkstra_get_onelink_routes(routing_component_t rc)
          return ret;
 }
 
-static route_extended_t dijkstra_get_route(routing_component_t rc,
+static route_extended_t dijkstra_get_route(AS_t asg,
                                            const char *src,
                                            const char *dst)
 {
-  xbt_assert(rc && src
+  xbt_assert(asg && src
               && dst,
               "Invalid params for \"get_route\" function at AS \"%s\"",
-              rc->name);
+              asg->name);
 
   /* set utils vars */
-  routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
+  as_dijkstra_t as = (as_dijkstra_t) asg;
 
-  generic_src_dst_check(rc, src, dst);
-  int *src_id = xbt_dict_get_or_null(routing->generic_routing.to_index, src);
-  int *dst_id = xbt_dict_get_or_null(routing->generic_routing.to_index, dst);
+  generic_src_dst_check(asg, src, dst);
+  int *src_id = xbt_dict_get_or_null(asg->to_index, src);
+  int *dst_id = xbt_dict_get_or_null(asg->to_index, dst);
   xbt_assert(src_id
               && dst_id,
               "Ask for route \"from\"(%s)  or \"to\"(%s) no found in the local table",
@@ -253,13 +246,13 @@ static route_extended_t dijkstra_get_route(routing_component_t rc,
   void *link;
   xbt_dynar_t links = NULL;
   route_cache_element_t elm = NULL;
-  xbt_dynar_t nodes = xbt_graph_get_nodes(routing->route_graph);
+  xbt_dynar_t nodes = xbt_graph_get_nodes(as->route_graph);
 
   /* Use the graph_node id mapping set to quickly find the nodes */
   graph_node_map_element_t src_elm =
-      graph_node_map_search(routing, *src_id);
+      graph_node_map_search(as, *src_id);
   graph_node_map_element_t dst_elm =
-      graph_node_map_search(routing, *dst_id);
+      graph_node_map_search(as, *dst_id);
   xbt_assert(src_elm != NULL
               && dst_elm != NULL, "src %d or dst %d does not exist",
               *src_id, *dst_id);
@@ -274,7 +267,7 @@ static route_extended_t dijkstra_get_route(routing_component_t rc,
     xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src_node_id, xbt_node_t);
     xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst_node_id, xbt_node_t);
     xbt_edge_t edge =
-        xbt_graph_get_edge(routing->route_graph, node_s_v, node_e_v);
+        xbt_graph_get_edge(as->route_graph, node_s_v, node_e_v);
 
     xbt_assert(edge != NULL, "no route between host %d and %d", *src_id,
                 *dst_id);
@@ -289,10 +282,10 @@ static route_extended_t dijkstra_get_route(routing_component_t rc,
     return new_e_route;
   }
 
-  if (routing->cached) {
+  if (as->cached) {
     /*check if there is a cached predecessor list avail */
     elm = (route_cache_element_t)
-        xbt_dict_get_or_null_ext(routing->route_cache, (char *) (&src_id),
+        xbt_dict_get_or_null_ext(as->route_cache, (char *) (&src_id),
                                  sizeof(int));
   }
 
@@ -366,7 +359,7 @@ static route_extended_t dijkstra_get_route(routing_component_t rc,
         xbt_dynar_get_as(nodes, pred_arr[v], xbt_node_t);
     xbt_node_t node_v = xbt_dynar_get_as(nodes, v, xbt_node_t);
     xbt_edge_t edge =
-        xbt_graph_get_edge(routing->route_graph, node_pred_v, node_v);
+        xbt_graph_get_edge(as->route_graph, node_pred_v, node_v);
 
     xbt_assert(edge != NULL, "no route between host %d and %d", *src_id,
                 *dst_id);
@@ -380,7 +373,7 @@ static route_extended_t dijkstra_get_route(routing_component_t rc,
     if (v == dst_node_id)
       first_gw = gw_dst;
 
-    if (rc->hierarchy == SURF_ROUTING_RECURSIVE && v != dst_node_id
+    if (asg->hierarchy == SURF_ROUTING_RECURSIVE && v != dst_node_id
         && strcmp(gw_dst, prev_gw_src)) {
       xbt_dynar_t e_route_as_to_as =
           (*(global_routing->get_route)) (gw_dst, prev_gw_src);
@@ -402,51 +395,51 @@ static route_extended_t dijkstra_get_route(routing_component_t rc,
     size++;
   }
 
-  if (rc->hierarchy == SURF_ROUTING_RECURSIVE) {
+  if (asg->hierarchy == SURF_ROUTING_RECURSIVE) {
     new_e_route->src_gateway = xbt_strdup(gw_src);
     new_e_route->dst_gateway = xbt_strdup(first_gw);
   }
 
-  if (routing->cached && elm == NULL) {
+  if (as->cached && elm == NULL) {
     /* add to predecessor list of the current src-host to cache */
     elm = xbt_new0(struct route_cache_element, 1);
     elm->pred_arr = pred_arr;
     elm->size = size;
-    xbt_dict_set_ext(routing->route_cache, (char *) (&src_id), sizeof(int),
+    xbt_dict_set_ext(as->route_cache, (char *) (&src_id), sizeof(int),
                      (xbt_set_elm_t) elm, &route_cache_elem_free);
   }
 
-  if (!routing->cached)
+  if (!as->cached)
     xbt_free(pred_arr);
 
   return new_e_route;
 }
 
-static void dijkstra_finalize(routing_component_t rc)
+static void dijkstra_finalize(AS_t asg)
 {
-  routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
+  as_dijkstra_t as = (as_dijkstra_t) asg;
 
-  if (routing) {
-    xbt_graph_free_graph(routing->route_graph, &xbt_free,
+  if (as) {
+    xbt_graph_free_graph(as->route_graph, &xbt_free,
                          &graph_edge_data_free, &xbt_free);
-    xbt_dict_free(&routing->graph_node_map);
-    if (routing->cached)
-      xbt_dict_free(&routing->route_cache);
+    xbt_dict_free(&as->graph_node_map);
+    if (as->cached)
+      xbt_dict_free(&as->route_cache);
     /* Delete bypass dict */
-    xbt_dict_free(&routing->generic_routing.bypassRoutes);
+    xbt_dict_free(&as->generic_routing.bypassRoutes);
     /* Delete index dict */
-    xbt_dict_free(&(routing->generic_routing.to_index));
+    xbt_dict_free(&(as->generic_routing.to_index));
     /* Delete structure */
-    xbt_free(routing);
+    xbt_free(as);
   }
 }
 
 /* Creation routing model functions */
 
-routing_component_t model_dijkstra_both_create(int cached)
+AS_t model_dijkstra_both_create(int cached)
 {
-  routing_component_dijkstra_t new_component = (routing_component_dijkstra_t)
-      routmod_generic_create(sizeof(s_routing_component_dijkstra_t));
+  as_dijkstra_t new_component = (as_dijkstra_t)
+      routmod_generic_create(sizeof(s_as_dijkstra_t));
 
   new_component->generic_routing.parse_route = model_dijkstra_both_parse_route;
   new_component->generic_routing.parse_ASroute = model_dijkstra_both_parse_route;
@@ -456,23 +449,23 @@ routing_component_t model_dijkstra_both_create(int cached)
   new_component->generic_routing.finalize = dijkstra_finalize;
   new_component->cached = cached;
 
-  return (routing_component_t)new_component;
+  return (AS_t)new_component;
 }
 
-routing_component_t model_dijkstra_create(void)
+AS_t model_dijkstra_create(void)
 {
   return model_dijkstra_both_create(0);
 }
 
-routing_component_t model_dijkstracache_create(void)
+AS_t model_dijkstracache_create(void)
 {
   return model_dijkstra_both_create(1);
 }
 
 void model_dijkstra_both_end(void)
 {
-  routing_component_dijkstra_t routing =
-      (routing_component_dijkstra_t) current_routing;
+  as_dijkstra_t routing =
+      (as_dijkstra_t) current_routing;
 
   xbt_node_t node = NULL;
   unsigned int cursor2;
@@ -500,25 +493,25 @@ void model_dijkstra_both_end(void)
   }
 
 }
-void model_dijkstra_both_parse_route (routing_component_t rc, const char *src,
+void model_dijkstra_both_parse_route (AS_t asg, const char *src,
                      const char *dst, route_extended_t route)
 {
-       routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
+       as_dijkstra_t as = (as_dijkstra_t) asg;
        int *src_id, *dst_id;
-       src_id = xbt_dict_get_or_null(rc->to_index, src);
-       dst_id = xbt_dict_get_or_null(rc->to_index, dst);
+       src_id = xbt_dict_get_or_null(asg->to_index, src);
+       dst_id = xbt_dict_get_or_null(asg->to_index, dst);
 
        xbt_assert(src_id, "Network elements %s not found", src);
        xbt_assert(dst_id, "Network elements %s not found", dst);
 
     /* Create the topology graph */
-       if(!routing->route_graph)
-       routing->route_graph = xbt_graph_new_graph(1, NULL);
-       if(!routing->graph_node_map)
-       routing->graph_node_map = xbt_dict_new();
+       if(!as->route_graph)
+       as->route_graph = xbt_graph_new_graph(1, NULL);
+       if(!as->graph_node_map)
+       as->graph_node_map = xbt_dict_new();
 
-       if (routing->cached && !routing->route_cache)
-       routing->route_cache = xbt_dict_new();
+       if (as->cached && !as->route_cache)
+       as->route_cache = xbt_dict_new();
 
        if( A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES
                || A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES )
@@ -537,5 +530,5 @@ void model_dijkstra_both_parse_route (routing_component_t rc, const char *src,
 
        route_extended_t e_route =
                generic_new_extended_route(current_routing->hierarchy, route, 1);
-       route_new_dijkstra(routing, *src_id, *dst_id, e_route);
+       route_new_dijkstra(as, *src_id, *dst_id, e_route);
 }
index b478c2a..b441684 100644 (file)
@@ -8,40 +8,38 @@
 
 /* Global vars */
 extern routing_global_t global_routing;
-extern routing_component_t current_routing;
+extern AS_t current_routing;
 extern routing_model_description_t current_routing_model;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf");
 
-#define TO_FLOYD_COST(i,j) (routing->cost_table)[(i)+(j)*table_size]
-#define TO_FLOYD_PRED(i,j) (routing->predecessor_table)[(i)+(j)*table_size]
-#define TO_FLOYD_LINK(i,j) (routing->link_table)[(i)+(j)*table_size]
+#define TO_FLOYD_COST(i,j) (as->cost_table)[(i)+(j)*table_size]
+#define TO_FLOYD_PRED(i,j) (as->predecessor_table)[(i)+(j)*table_size]
+#define TO_FLOYD_LINK(i,j) (as->link_table)[(i)+(j)*table_size]
 
 /* Routing model structure */
 
 typedef struct {
-  s_routing_component_t generic_routing;
+  s_as_t generic_routing;
   /* vars for calculate the floyd algorith. */
   int *predecessor_table;
   double *cost_table;
-  route_extended_t *link_table; /* char* -> int* */
-} s_routing_component_floyd_t, *routing_component_floyd_t;
+  route_extended_t *link_table;
+} s_as_floyd_t, *as_floyd_t;
 
-static route_extended_t floyd_get_route(routing_component_t rc,
+static route_extended_t floyd_get_route(AS_t asg,
                                         const char *src, const char *dst);
 
 /* Business methods */
-static xbt_dynar_t floyd_get_onelink_routes(routing_component_t rc)
+static xbt_dynar_t floyd_get_onelink_routes(AS_t asg)
 {
   xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
 
-  routing_component_floyd_t routing = (routing_component_floyd_t) rc;
-  //size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
   xbt_dict_cursor_t c1 = NULL, c2 = NULL;
   char *k1, *d1, *k2, *d2;
-  xbt_dict_foreach(routing->generic_routing.to_index, c1, k1, d1) {
-    xbt_dict_foreach(routing->generic_routing.to_index, c2, k2, d2) {
-      route_extended_t route = floyd_get_route(rc, k1, k2);
+  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);
       if (route) {
         if (xbt_dynar_length(route->generic_route.link_list) == 1) {
           void *link =
@@ -49,11 +47,10 @@ static xbt_dynar_t floyd_get_onelink_routes(routing_component_t rc)
                                            0);
           onelink_t onelink = xbt_new0(s_onelink_t, 1);
           onelink->link_ptr = link;
-          if (routing->generic_routing.hierarchy == SURF_ROUTING_BASE) {
+          if (asg->hierarchy == SURF_ROUTING_BASE) {
             onelink->src = xbt_strdup(k1);
             onelink->dst = xbt_strdup(k2);
-          } else if (routing->generic_routing.hierarchy ==
-                     SURF_ROUTING_RECURSIVE) {
+          } else if (asg->hierarchy == SURF_ROUTING_RECURSIVE) {
             onelink->src = xbt_strdup(route->src_gateway);
             onelink->dst = xbt_strdup(route->dst_gateway);
           }
@@ -65,21 +62,21 @@ static xbt_dynar_t floyd_get_onelink_routes(routing_component_t rc)
   return ret;
 }
 
-static route_extended_t floyd_get_route(routing_component_t rc,
+static route_extended_t floyd_get_route(AS_t asg,
                                         const char *src, const char *dst)
 {
-  xbt_assert(rc && src
+  xbt_assert(asg && src
               && dst,
               "Invalid params for \"get_route\" function at AS \"%s\"",
-              rc->name);
+              asg->name);
 
   /* set utils vars */
-  routing_component_floyd_t routing = (routing_component_floyd_t) rc;
-  size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
+  as_floyd_t as = (as_floyd_t)asg;
+  size_t table_size = xbt_dict_length(asg->to_index);
 
-  generic_src_dst_check(rc, src, dst);
-  int *src_id = xbt_dict_get_or_null(routing->generic_routing.to_index, src);
-  int *dst_id = xbt_dict_get_or_null(routing->generic_routing.to_index, dst);
+  generic_src_dst_check(asg, src, dst);
+  int *src_id = xbt_dict_get_or_null(asg->to_index, src);
+  int *dst_id = xbt_dict_get_or_null(asg->to_index, dst);
   xbt_assert(src_id
               && dst_id,
               "Ask for route \"from\"(%s)  or \"to\"(%s) no found in the local table",
@@ -118,7 +115,7 @@ static route_extended_t floyd_get_route(routing_component_t rc,
     if (first)
       first_gw = gw_dst;
 
-    if (rc->hierarchy == SURF_ROUTING_RECURSIVE && !first
+    if (asg->hierarchy == SURF_ROUTING_RECURSIVE && !first
         && strcmp(gw_dst, prev_gw_src)) {
       xbt_dynar_t e_route_as_to_as =
           (*(global_routing->get_route)) (gw_dst, prev_gw_src);
@@ -143,7 +140,7 @@ static route_extended_t floyd_get_route(routing_component_t rc,
   xbt_assert(pred != -1, "no route from host %d to %d (\"%s\" to \"%s\")",
               *src_id, *dst_id, src, dst);
 
-  if (rc->hierarchy == SURF_ROUTING_RECURSIVE) {
+  if (asg->hierarchy == SURF_ROUTING_RECURSIVE) {
     new_e_route->src_gateway = xbt_strdup(gw_src);
     new_e_route->dst_gateway = xbt_strdup(first_gw);
   }
@@ -151,58 +148,58 @@ static route_extended_t floyd_get_route(routing_component_t rc,
   return new_e_route;
 }
 
-static void floyd_finalize(routing_component_t rc)
+static void floyd_finalize(AS_t rc)
 {
-  routing_component_floyd_t routing = (routing_component_floyd_t) rc;
+  as_floyd_t as = (as_floyd_t) rc;
   int i, j;
   size_t table_size;
-  if (routing) {
-    table_size = xbt_dict_length(routing->generic_routing.to_index);
+  if (as) {
+    table_size = xbt_dict_length(as->generic_routing.to_index);
     /* 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));
-    xbt_free(routing->link_table);
+    xbt_free(as->link_table);
     /* Delete bypass dict */
-    xbt_dict_free(&routing->generic_routing.bypassRoutes);
+    xbt_dict_free(&as->generic_routing.bypassRoutes);
     /* Delete index dict */
-    xbt_dict_free(&(routing->generic_routing.to_index));
+    xbt_dict_free(&(as->generic_routing.to_index));
     /* Delete dictionary index dict, predecessor and links table */
-    xbt_free(routing->predecessor_table);
+    xbt_free(as->predecessor_table);
     /* Delete structure */
     xbt_free(rc);
   }
 }
 
-routing_component_t model_floyd_create(void)
+AS_t model_floyd_create(void)
 {
-  routing_component_floyd_t new_component = (routing_component_floyd_t)routmod_generic_create(sizeof(s_routing_component_floyd_t));
+  as_floyd_t new_component = (as_floyd_t)routmod_generic_create(sizeof(s_as_floyd_t));
   new_component->generic_routing.parse_route = model_floyd_parse_route;
   new_component->generic_routing.parse_ASroute = model_floyd_parse_route;
   new_component->generic_routing.get_route = floyd_get_route;
   new_component->generic_routing.get_onelink_routes =
       floyd_get_onelink_routes;
   new_component->generic_routing.finalize = floyd_finalize;
-  return (routing_component_t)new_component;
+  return (AS_t)new_component;
 }
 
 void model_floyd_end(void)
 {
 
-       routing_component_floyd_t routing =
-         ((routing_component_floyd_t) current_routing);
+       as_floyd_t as =
+         ((as_floyd_t) current_routing);
 
        unsigned int i, j, a, b, c;
 
        /* set the size of table routing */
-       size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
+       size_t table_size = xbt_dict_length(as->generic_routing.to_index);
 
-       if(!routing->link_table)
+       if(!as->link_table)
        {
                /* Create Cost, Predecessor and Link tables */
-               routing->cost_table = xbt_new0(double, table_size * table_size);       /* link cost from host to host */
-               routing->predecessor_table = xbt_new0(int, table_size * table_size);  /* predecessor host numbers */
-               routing->link_table = xbt_new0(route_extended_t, table_size * table_size);    /* actual link between src and dst */
+               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 */
 
                /* Initialize costs and predecessors */
                for (i = 0; i < table_size; i++)
@@ -255,10 +252,10 @@ 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(routing_component_t rc, const char *src,
+void model_floyd_parse_route(AS_t rc, const char *src,
         const char *dst, route_extended_t route)
 {
-       routing_component_floyd_t routing = (routing_component_floyd_t) rc;
+       as_floyd_t as = (as_floyd_t) rc;
 
        /* set the size of table routing */
        size_t table_size = xbt_dict_length(rc->to_index);
@@ -271,12 +268,12 @@ void model_floyd_parse_route(routing_component_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);
 
-       if(!routing->link_table)
+       if(!as->link_table)
        {
                /* Create Cost, Predecessor and Link tables */
-               routing->cost_table = xbt_new0(double, table_size * table_size);       /* link cost from host to host */
-               routing->predecessor_table = xbt_new0(int, table_size * table_size);  /* predecessor host numbers */
-               routing->link_table = xbt_new0(route_extended_t, table_size * table_size);    /* actual link between src and dst */
+               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 */
 
                /* Initialize costs and predecessors */
                for (i = 0; i < table_size; i++)
index d8ceada..1b439de 100644 (file)
@@ -8,7 +8,7 @@
 
 /* Global vars */
 extern routing_global_t global_routing;
-extern routing_component_t current_routing;
+extern AS_t current_routing;
 extern routing_model_description_t current_routing_model;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
@@ -18,12 +18,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
 /* Routing model structure */
 
 typedef struct s_routing_component_full {
-  s_routing_component_t generic_routing;
+  s_as_t generic_routing;
   route_extended_t *routing_table;
 } s_routing_component_full_t, *routing_component_full_t;
 
 /* Business methods */
-static xbt_dynar_t full_get_onelink_routes(routing_component_t rc)
+static xbt_dynar_t full_get_onelink_routes(AS_t rc)
 {
   xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
 
@@ -63,7 +63,7 @@ static xbt_dynar_t full_get_onelink_routes(routing_component_t rc)
   return ret;
 }
 
-static route_extended_t full_get_route(routing_component_t rc,
+static route_extended_t full_get_route(AS_t rc,
                                        const char *src, const char *dst)
 {
   xbt_assert(rc && src
@@ -102,7 +102,7 @@ static route_extended_t full_get_route(routing_component_t rc,
   return new_e_route;
 }
 
-static void full_finalize(routing_component_t rc)
+static void full_finalize(AS_t rc)
 {
   routing_component_full_t routing = (routing_component_full_t) rc;
   size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
@@ -124,7 +124,7 @@ static void full_finalize(routing_component_t rc)
 
 /* Creation routing model functions */
 
-routing_component_t model_full_create(void)
+AS_t model_full_create(void)
 {
   routing_component_full_t new_component = (routing_component_full_t)
       routmod_generic_create(sizeof(s_routing_component_full_t));
@@ -136,7 +136,7 @@ routing_component_t model_full_create(void)
       full_get_onelink_routes;
   new_component->generic_routing.finalize = full_finalize;
 
-  return (routing_component_t) new_component;
+  return (AS_t) new_component;
 }
 
 void model_full_end(void)
@@ -175,7 +175,7 @@ static int surf_pointer_resource_cmp(const void *a, const void *b) {
   return a != b;
 }
 
-void model_full_set_route(routing_component_t rc, const char *src,
+void model_full_set_route(AS_t rc, const char *src,
                const char *dst, route_extended_t route)
 {
        int *src_id, *dst_id;
index 780ef52..5b771d5 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
 
-extern routing_component_t current_routing;
+extern AS_t current_routing;
 
-routing_component_t routmod_generic_create(size_t childsize) {
-  routing_component_t new_component = xbt_malloc0(childsize);
+AS_t routmod_generic_create(size_t childsize) {
+  AS_t new_component = xbt_malloc0(childsize);
 
   new_component->parse_PU = generic_parse_PU;
   new_component->parse_AS = generic_parse_AS;
@@ -38,7 +38,7 @@ routing_component_t routmod_generic_create(size_t childsize) {
 }
 
 
-void generic_parse_PU(routing_component_t rc, const char *name)
+void generic_parse_PU(AS_t rc, const char *name)
 {
   XBT_DEBUG("Load process unit \"%s\"", name);
   int *id = xbt_new0(int, 1);
@@ -48,7 +48,7 @@ void generic_parse_PU(routing_component_t rc, const char *name)
   xbt_dict_set(_to_index, name, id, xbt_free);
 }
 
-void generic_parse_AS(routing_component_t rc, const char *name)
+void generic_parse_AS(AS_t rc, const char *name)
 {
   XBT_DEBUG("Load Autonomous system \"%s\"", name);
   int *id = xbt_new0(int, 1);
@@ -58,7 +58,7 @@ void generic_parse_AS(routing_component_t rc, const char *name)
   xbt_dict_set(_to_index, name, id, xbt_free);
 }
 
-void generic_parse_bypassroute(routing_component_t rc,
+void generic_parse_bypassroute(AS_t rc,
                              const char *src, const char *dst,
                              route_extended_t e_route)
 {
@@ -87,7 +87,7 @@ void generic_parse_bypassroute(routing_component_t rc,
 /* ************************************************************************** */
 /* *********************** GENERIC BUSINESS METHODS ************************* */
 
-double generic_get_link_latency(routing_component_t rc,
+double generic_get_link_latency(AS_t rc,
                                 const char *src, const char *dst,
                                 route_extended_t route)
 {
@@ -106,22 +106,22 @@ double generic_get_link_latency(routing_component_t rc,
   return latency;
 }
 
-xbt_dynar_t generic_get_onelink_routes(routing_component_t rc)
+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(routing_component_t rc,
+route_extended_t generic_get_bypassroute(AS_t rc,
                                          const char *src, const char *dst)
 {
   xbt_dict_t dict_bypassRoutes = rc->bypassRoutes;
-  routing_component_t src_as, dst_as;
+  AS_t src_as, dst_as;
   int index_src, index_dst;
   xbt_dynar_t path_src = NULL;
   xbt_dynar_t path_dst = NULL;
-  routing_component_t current = NULL;
-  routing_component_t *current_src = NULL;
-  routing_component_t *current_dst = NULL;
+  AS_t current = NULL;
+  AS_t *current_src = NULL;
+  AS_t *current_dst = NULL;
 
   /* (1) find the as where the src and dst are located */
   void *src_data = xbt_lib_get_or_null(host_lib, src, ROUTING_HOST_LEVEL);
@@ -139,13 +139,13 @@ route_extended_t generic_get_bypassroute(routing_component_t rc,
   dst_as = ((network_element_info_t) dst_data)->rc_component;
 
   /* (2) find the path to the root routing component */
-  path_src = xbt_dynar_new(sizeof(routing_component_t), NULL);
+  path_src = xbt_dynar_new(sizeof(AS_t), NULL);
   current = src_as;
   while (current != NULL) {
     xbt_dynar_push(path_src, &current);
     current = current->routing_father;
   }
-  path_dst = xbt_dynar_new(sizeof(routing_component_t), NULL);
+  path_dst = xbt_dynar_new(sizeof(AS_t), NULL);
   current = dst_as;
   while (current != NULL) {
     xbt_dynar_push(path_dst, &current);
@@ -178,9 +178,9 @@ route_extended_t generic_get_bypassroute(routing_component_t rc,
     for (i = 0; i < max; i++) {
       if (i <= max_index_src && max <= max_index_dst) {
         char *route_name = bprintf("%s#%s",
-                                   (*(routing_component_t *)
+                                   (*(AS_t *)
                                     (xbt_dynar_get_ptr(path_src, i)))->name,
-                                   (*(routing_component_t *)
+                                   (*(AS_t *)
                                     (xbt_dynar_get_ptr(path_dst, max)))->name);
         e_route_bypass = xbt_dict_get_or_null(dict_bypassRoutes, route_name);
         xbt_free(route_name);
@@ -189,9 +189,9 @@ route_extended_t generic_get_bypassroute(routing_component_t rc,
         break;
       if (max <= max_index_src && i <= max_index_dst) {
         char *route_name = bprintf("%s#%s",
-                                   (*(routing_component_t *)
+                                   (*(AS_t *)
                                     (xbt_dynar_get_ptr(path_src, max)))->name,
-                                   (*(routing_component_t *)
+                                   (*(AS_t *)
                                     (xbt_dynar_get_ptr(path_dst, i)))->name);
         e_route_bypass = xbt_dict_get_or_null(dict_bypassRoutes, route_name);
         xbt_free(route_name);
@@ -205,9 +205,9 @@ route_extended_t generic_get_bypassroute(routing_component_t rc,
 
     if (max <= max_index_src && max <= max_index_dst) {
       char *route_name = bprintf("%s#%s",
-                                 (*(routing_component_t *)
+                                 (*(AS_t *)
                                   (xbt_dynar_get_ptr(path_src, max)))->name,
-                                 (*(routing_component_t *)
+                                 (*(AS_t *)
                                   (xbt_dynar_get_ptr(path_dst, max)))->name);
       e_route_bypass = xbt_dict_get_or_null(dict_bypassRoutes, route_name);
       xbt_free(route_name);
@@ -348,14 +348,14 @@ void generic_free_extended_route(route_extended_t e_route)
   }
 }
 
-static routing_component_t generic_as_exist(routing_component_t find_from,
-                                            routing_component_t to_find)
+static AS_t generic_as_exist(AS_t find_from,
+                                            AS_t to_find)
 {
   //return to_find; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
   xbt_dict_cursor_t cursor = NULL;
   char *key;
   int found = 0;
-  routing_component_t elem;
+  AS_t elem;
   xbt_dict_foreach(find_from->routing_sons, cursor, key, elem) {
     if (to_find == elem || generic_as_exist(elem, to_find)) {
       found = 1;
@@ -367,17 +367,17 @@ static routing_component_t generic_as_exist(routing_component_t find_from,
   return NULL;
 }
 
-routing_component_t
-generic_autonomous_system_exist(routing_component_t rc, char *element)
+AS_t
+generic_autonomous_system_exist(AS_t rc, char *element)
 {
   //return rc; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
-  routing_component_t element_as, result, elem;
+  AS_t element_as, result, elem;
   xbt_dict_cursor_t cursor = NULL;
   char *key;
   element_as = ((network_element_info_t)
                 xbt_lib_get_or_null(as_router_lib, element,
                                     ROUTING_ASR_LEVEL))->rc_component;
-  result = ((routing_component_t) - 1);
+  result = ((AS_t) - 1);
   if (element_as != rc)
     result = generic_as_exist(rc, element_as);
 
@@ -394,10 +394,10 @@ generic_autonomous_system_exist(routing_component_t rc, char *element)
   return NULL;
 }
 
-routing_component_t
-generic_processing_units_exist(routing_component_t rc, char *element)
+AS_t
+generic_processing_units_exist(AS_t rc, char *element)
 {
-  routing_component_t element_as;
+  AS_t element_as;
   element_as = ((network_element_info_t)
                 xbt_lib_get_or_null(host_lib,
                                     element, ROUTING_HOST_LEVEL))->rc_component;
@@ -406,7 +406,7 @@ generic_processing_units_exist(routing_component_t rc, char *element)
   return generic_as_exist(rc, element_as);
 }
 
-void generic_src_dst_check(routing_component_t rc, const char *src,
+void generic_src_dst_check(AS_t rc, const char *src,
                            const char *dst)
 {
 
@@ -421,9 +421,9 @@ void generic_src_dst_check(routing_component_t rc, const char *src,
     xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
             src, dst, rc->name);
 
-  routing_component_t src_as =
+  AS_t src_as =
       ((network_element_info_t) src_data)->rc_component;
-  routing_component_t dst_as =
+  AS_t dst_as =
       ((network_element_info_t) dst_data)->rc_component;
 
   if (src_as != dst_as)
index ca02726..21ed6cd 100644 (file)
@@ -8,50 +8,50 @@
 
 /* Global vars */
 extern routing_global_t global_routing;
-extern routing_component_t current_routing;
+extern AS_t current_routing;
 extern routing_model_description_t current_routing_model;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_none, surf, "Routing part of surf");
 
 /* Routing model structure */
 /* Business methods */
-static xbt_dynar_t none_get_onelink_routes(routing_component_t rc)
+static xbt_dynar_t none_get_onelink_routes(AS_t rc)
 {
   return NULL;
 }
 
-static route_extended_t none_get_route(routing_component_t rc,
+static route_extended_t none_get_route(AS_t rc,
                                        const char *src, const char *dst)
 {
   return NULL;
 }
 
-static route_extended_t none_get_bypass_route(routing_component_t rc,
+static route_extended_t none_get_bypass_route(AS_t rc,
                                               const char *src,
                                               const char *dst)
 {
   return NULL;
 }
 
-static void none_finalize(routing_component_t rc)
+static void none_finalize(AS_t rc)
 {
   xbt_free(rc);
 }
 
-static void none_parse_PU(routing_component_t rc,
+static void none_parse_PU(AS_t rc,
                                      const char *name)
 {
 }
 
-static void none_parse_AS(routing_component_t rc,
+static void none_parse_AS(AS_t rc,
                                        const char *name)
 {
 }
 
 /* Creation routing model functions */
-routing_component_t model_none_create(void)
+AS_t model_none_create(void)
 {
-  routing_component_t new_component = xbt_new(s_routing_component_t, 1);
+  AS_t new_component = xbt_new(s_as_t, 1);
   new_component->parse_PU = none_parse_PU;
   new_component->parse_AS = none_parse_AS;
   new_component->parse_route = NULL;
index 152d7c2..311dbb7 100644 (file)
 
 /* ************************************************************************** */
 /* ***************** GENERIC PARSE FUNCTIONS (declarations) ***************** */
-routing_component_t routmod_generic_create(size_t childsize);
+AS_t routmod_generic_create(size_t childsize);
 
-void generic_parse_PU(routing_component_t rc,
+void generic_parse_PU(AS_t rc,
                                         const char *name);
-void generic_parse_AS(routing_component_t rc,
+void generic_parse_AS(AS_t rc,
                                           const char *name);
-void generic_parse_bypassroute(routing_component_t rc,
+void generic_parse_bypassroute(AS_t rc,
                                     const char *src, const char *dst,
                                     route_extended_t e_route);
 
 /* ************************************************************************** */
 /* *************** GENERIC BUSINESS METHODS (declarations) ****************** */
 
-double generic_get_link_latency(routing_component_t rc, const char *src, const char *dst,
+double generic_get_link_latency(AS_t rc, const char *src, const char *dst,
                                                                                route_extended_t e_route);
-xbt_dynar_t generic_get_onelink_routes(routing_component_t rc);
-route_extended_t generic_get_bypassroute(routing_component_t rc,
+xbt_dynar_t generic_get_onelink_routes(AS_t rc);
+route_extended_t generic_get_bypassroute(AS_t rc,
                                                 const char *src,
                                                 const char *dst);
 
@@ -52,34 +52,34 @@ 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);
-routing_component_t
-generic_autonomous_system_exist(routing_component_t rc, char *element);
-routing_component_t
-generic_processing_units_exist(routing_component_t rc, char *element);
-void generic_src_dst_check(routing_component_t rc, const char *src,
+AS_t
+generic_autonomous_system_exist(AS_t rc, char *element);
+AS_t
+generic_processing_units_exist(AS_t rc, char *element);
+void generic_src_dst_check(AS_t rc, const char *src,
                                   const char *dst);
 
 
 /* ************************************************************************** */
 /* *************************** FLOYD ROUTING ******************************** */
-routing_component_t model_floyd_create(void);  /* create structures for floyd routing model */
+AS_t model_floyd_create(void);  /* create structures for floyd routing model */
 void model_floyd_end(void);      /* finalize the creation of floyd routing model */
-void model_floyd_parse_route(routing_component_t rc, const char *src,
+void model_floyd_parse_route(AS_t rc, const char *src,
         const char *dst, route_extended_t route);
 
 /* ************************************************** */
 /* ************** RULE-BASED ROUTING **************** */
-routing_component_t model_rulebased_create(void);      /* create structures for rulebased routing model */
+AS_t model_rulebased_create(void);      /* create structures for rulebased routing model */
 
 /* ************************************************** */
 /* **************  Cluster ROUTING   **************** */
-routing_component_t model_cluster_create(void);      /* create structures for cluster routing model */
+AS_t model_cluster_create(void);      /* create structures for cluster routing model */
 
 void surf_routing_cluster_add_link(const char* host_id,surf_parsing_link_up_down_t info);
 
 /* ************************************************** */
 /* **************  Vivaldi ROUTING   **************** */
-routing_component_t model_vivaldi_create(void);      /* create structures for vivaldi routing model */
+AS_t model_vivaldi_create(void);      /* create structures for vivaldi routing model */
 #define HOST_PEER(peername) bprintf("peer_%s", peername)
 #define ROUTER_PEER(peername) bprintf("router_%s", peername)
 #define LINK_UP_PEER(peername) bprintf("link_%s_up", peername)
@@ -87,22 +87,22 @@ routing_component_t model_vivaldi_create(void);      /* create structures for vi
 
 /* ************************************************************************** */
 /* ********** Dijkstra & Dijkstra Cached ROUTING **************************** */
-routing_component_t model_dijkstra_both_create(int cached);    /* create by calling dijkstra or dijkstracache */
-routing_component_t model_dijkstra_create(void);       /* create structures for dijkstra routing model */
-routing_component_t model_dijkstracache_create(void);  /* create structures for dijkstracache routing model */
+AS_t model_dijkstra_both_create(int cached);    /* create by calling dijkstra or dijkstracache */
+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(void);      /* finalize the creation of dijkstra routing model */
-void model_dijkstra_both_parse_route (routing_component_t rc, const char *src,
+void model_dijkstra_both_parse_route (AS_t rc, const char *src,
                      const char *dst, route_extended_t route);
 
 /* ************************************************************************** */
 /* *************************** FULL ROUTING ********************************* */
-routing_component_t model_full_create(void);   /* create structures for full routing model */
+AS_t model_full_create(void);   /* create structures for full routing model */
 void model_full_end(void);       /* finalize the creation of full routing model */
 void model_full_set_route(     /* Set the route and ASroute between src and dst */
-               routing_component_t rc, const char *src, const char *dst, route_extended_t route);
+               AS_t rc, const char *src, const char *dst, route_extended_t route);
 
 /* ************************************************************************** */
 /* ******************************* NO ROUTING ******************************* */
-routing_component_t model_none_create(void);           /* none routing model */
+AS_t model_none_create(void);           /* none routing model */
 
 #endif                          /* _SURF_SURF_ROUTING_PRIVATE_H */
index aee6a7d..2e5a948 100644 (file)
@@ -8,7 +8,7 @@
 
 /* Global vars */
 extern routing_global_t global_routing;
-extern routing_component_t current_routing;
+extern AS_t current_routing;
 extern routing_model_description_t current_routing_model;
 extern xbt_dynar_t link_list;
 
@@ -17,7 +17,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_rulebased, surf, "Routing part of sur
 /* Routing model structure */
 
 typedef struct {
-  s_routing_component_t generic_routing;
+  s_as_t generic_routing;
   xbt_dict_t dict_processing_units;
   xbt_dict_t dict_autonomous_systems;
   xbt_dynar_t list_route;
@@ -67,7 +67,7 @@ static void rule_route_extended_free(void *e)
 
 /* Parse routing model functions */
 
-static void model_rulebased_parse_PU(routing_component_t rc,
+static void model_rulebased_parse_PU(AS_t rc,
                                                 const char *name)
 {
   routing_component_rulebased_t routing =
@@ -75,7 +75,7 @@ static void model_rulebased_parse_PU(routing_component_t rc,
   xbt_dict_set(routing->dict_processing_units, name, (void *) (-1), NULL);
 }
 
-static void model_rulebased_parse_AS(routing_component_t rc,
+static void model_rulebased_parse_AS(AS_t rc,
                                                   const char *name)
 {
   routing_component_rulebased_t routing =
@@ -84,7 +84,7 @@ static void model_rulebased_parse_AS(routing_component_t rc,
                NULL);
 }
 
-static void model_rulebased_parse_route(routing_component_t rc,
+static void model_rulebased_parse_route(AS_t rc,
                                       const char *src, const char *dst,
                                       route_extended_t route)
 {
@@ -112,7 +112,7 @@ static void model_rulebased_parse_route(routing_component_t rc,
   xbt_free(route);
 }
 
-static void model_rulebased_parse_ASroute(routing_component_t rc,
+static void model_rulebased_parse_ASroute(AS_t rc,
                                         const char *src, const char *dst,
                                         route_extended_t route)
 {
@@ -147,7 +147,7 @@ static void model_rulebased_parse_ASroute(routing_component_t rc,
   xbt_free(route);
 }
 
-static void model_rulebased_parse_bypassroute(routing_component_t rc,
+static void model_rulebased_parse_bypassroute(AS_t rc,
                                             const char *src,
                                             const char *dst,
                                             route_extended_t e_route)
@@ -213,10 +213,10 @@ 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(routing_component_t rc,
+static route_extended_t rulebased_get_route(AS_t rc,
                                             const char *src,
                                             const char *dst);
-static xbt_dynar_t rulebased_get_onelink_routes(routing_component_t rc)
+static xbt_dynar_t rulebased_get_onelink_routes(AS_t rc)
 {
   xbt_dynar_t ret = xbt_dynar_new (sizeof(onelink_t), xbt_free);
 
@@ -267,7 +267,7 @@ static xbt_dynar_t rulebased_get_onelink_routes(routing_component_t rc)
 }
 
 /* Business methods */
-static route_extended_t rulebased_get_route(routing_component_t rc,
+static route_extended_t rulebased_get_route(AS_t rc,
                                             const char *src,
                                             const char *dst)
 {
@@ -372,14 +372,14 @@ static route_extended_t rulebased_get_route(routing_component_t rc,
   return new_e_route;
 }
 
-static route_extended_t rulebased_get_bypass_route(routing_component_t rc,
+static route_extended_t rulebased_get_bypass_route(AS_t rc,
                                                    const char *src,
                                                    const char *dst)
 {
   return NULL;
 }
 
-static void rulebased_finalize(routing_component_t rc)
+static void rulebased_finalize(AS_t rc)
 {
   routing_component_rulebased_t routing =
       (routing_component_rulebased_t) rc;
@@ -394,7 +394,7 @@ static void rulebased_finalize(routing_component_t rc)
 }
 
 /* Creation routing model functions */
-routing_component_t model_rulebased_create(void) {
+AS_t model_rulebased_create(void) {
 
   routing_component_rulebased_t new_component = (routing_component_rulebased_t)
       routmod_generic_create(sizeof(s_routing_component_rulebased_t));
@@ -416,5 +416,5 @@ routing_component_t model_rulebased_create(void) {
       xbt_dynar_new(sizeof(rule_route_extended_t),
                     &rule_route_extended_free);
 
-  return (routing_component_t) new_component;
+  return (AS_t) new_component;
 }
index 85b8fab..687bc87 100644 (file)
@@ -8,7 +8,7 @@
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_vivaldi, surf, "Routing part of surf");
 
 /* Business methods */
-static route_extended_t vivaldi_get_route(routing_component_t rc,
+static route_extended_t vivaldi_get_route(AS_t rc,
                                             const char *src,
                                             const char *dst)
 {
@@ -56,7 +56,7 @@ static double base_vivaldi_get_latency (const char *src, const char *dst)
   return euclidean_dist / 1000;
 }
 
-static double vivaldi_get_link_latency (routing_component_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_extended_t e_route)
 {
   if(get_network_element_type(src) == SURF_NETWORK_ELEMENT_AS) {
          int need_to_clean = e_route?0:1;
@@ -71,9 +71,9 @@ static double vivaldi_get_link_latency (routing_component_t rc,const char *src,
 }
 
 /* Creation routing model functions */
-routing_component_t model_vivaldi_create(void)
+AS_t model_vivaldi_create(void)
 {
-         routing_component_t new_component = model_none_create();
+         AS_t new_component = model_none_create();
          new_component->get_route = vivaldi_get_route;
          new_component->get_latency = vivaldi_get_link_latency;
          return new_component;