Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename some routing logic fields to make them more explicit (hopefully)
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 10 Nov 2011 11:12:44 +0000 (12:12 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 10 Nov 2011 11:12:44 +0000 (12:12 +0100)
src/surf/surf_private.h
src/surf/surf_routing.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

index bc442cb..c25e118 100644 (file)
@@ -155,13 +155,17 @@ typedef struct s_routing_component {
    route_extended_t(*get_bypass_route) (routing_component_t rc,
                                         const char *src, const char *dst);
   void (*finalize) (routing_component_t rc);
-  void (*set_processing_unit) (routing_component_t rc, const char *name);
-  void (*set_autonomous_system) (routing_component_t rc, const char *name);
-  void (*set_route) (routing_component_t rc, const char *src,
+  /* 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,
                      const char *dst, name_route_extended_t route);
-  void (*set_ASroute) (routing_component_t rc, const char *src,
+  void (*parse_ASroute) (routing_component_t rc, const char *src,
                        const char *dst, name_route_extended_t route);
-  void (*set_bypassroute) (routing_component_t rc, const char *src,
+  void (*parse_bypassroute) (routing_component_t rc, const char *src,
                            const char *dst, route_extended_t e_route);
 } s_routing_component_t;
 
index 1777929..0ac0e57 100644 (file)
@@ -102,7 +102,7 @@ static void parse_S_host(sg_platf_host_cbarg_t host)
   xbt_assert(!xbt_lib_get_or_null(host_lib, host->id, ROUTING_HOST_LEVEL),
              "Reading a host, processing unit \"%s\" already exists", host->id);
 
-  (*(current_routing->set_processing_unit)) (current_routing, host->id);
+  (*(current_routing->parse_PU)) (current_routing, host->id);
   info = xbt_new0(s_network_element_info_t, 1);
   info->rc_component = current_routing;
   info->rc_type = SURF_NETWORK_ELEMENT_HOST;
@@ -129,7 +129,7 @@ static void parse_S_router(sg_platf_router_cbarg_t router)
              "Reading a router, processing unit \"%s\" already exists",
              router->id);
 
-  (*(current_routing->set_processing_unit)) (current_routing, router->id);
+  (*(current_routing->parse_PU)) (current_routing, router->id);
   info = xbt_new0(s_network_element_info_t, 1);
   info->rc_component = current_routing;
   info->rc_type = SURF_NETWORK_ELEMENT_ROUTER;
@@ -230,10 +230,10 @@ static void routing_parse_E_route(void)
 {
   name_route_extended_t route = xbt_new0(s_name_route_extended_t, 1);
   route->generic_route.link_list = link_list;
-  xbt_assert(current_routing->set_route,
+  xbt_assert(current_routing->parse_route,
              "no defined method \"set_route\" in \"%s\"",
              current_routing->name);
-  (*(current_routing->set_route)) (current_routing, src, dst, route);
+  (*(current_routing->parse_route)) (current_routing, src, dst, route);
   link_list = NULL;
   src = NULL;
   dst = NULL;
@@ -248,10 +248,10 @@ static void routing_parse_E_ASroute(void)
   e_route->generic_route.link_list = link_list;
   e_route->src_gateway = xbt_strdup(gw_src);
   e_route->dst_gateway = xbt_strdup(gw_dst);
-  xbt_assert(current_routing->set_ASroute,
+  xbt_assert(current_routing->parse_ASroute,
              "no defined method \"set_ASroute\" in \"%s\"",
              current_routing->name);
-  (*(current_routing->set_ASroute)) (current_routing, src, dst, e_route);
+  (*(current_routing->parse_ASroute)) (current_routing, src, dst, e_route);
   link_list = NULL;
   src = NULL;
   dst = NULL;
@@ -268,10 +268,10 @@ static void routing_parse_E_bypassRoute(void)
   e_route->generic_route.link_list = link_list;
   e_route->src_gateway = xbt_strdup(gw_src);
   e_route->dst_gateway = xbt_strdup(gw_dst);
-  xbt_assert(current_routing->set_bypassroute,
+  xbt_assert(current_routing->parse_bypassroute,
              "Bypassing mechanism not implemented by routing '%s'",
              current_routing->name);
-  (*(current_routing->set_bypassroute)) (current_routing, src, dst, e_route);
+  (*(current_routing->parse_bypassroute)) (current_routing, src, dst, e_route);
   link_list = NULL;
   src = NULL;
   dst = NULL;
@@ -341,7 +341,7 @@ void routing_AS_open(const char *AS_id, const char *wanted_routing_type)
     xbt_dict_set(current_routing->routing_sons, AS_id,
                  (void *) new_routing, NULL);
     /* add to the father element list */
-    (*(current_routing->set_autonomous_system)) (current_routing, AS_id);
+    (*(current_routing->parse_AS)) (current_routing, AS_id);
     /* unload the prev parse rules */
     if (current_routing->routing->unload)
       (*(current_routing->routing->unload)) ();
index 9e58253..341012c 100644 (file)
@@ -448,8 +448,8 @@ routing_component_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));
 
-  new_component->generic_routing.set_route = model_dijkstra_both_set_route;
-  new_component->generic_routing.set_ASroute = model_dijkstra_both_set_route;
+  new_component->generic_routing.parse_route = model_dijkstra_both_parse_route;
+  new_component->generic_routing.parse_ASroute = model_dijkstra_both_parse_route;
   new_component->generic_routing.get_route = dijkstra_get_route;
   new_component->generic_routing.get_onelink_routes =
       dijkstra_get_onelink_routes;
@@ -500,7 +500,7 @@ void model_dijkstra_both_end(void)
   }
 
 }
-void model_dijkstra_both_set_route (routing_component_t rc, const char *src,
+void model_dijkstra_both_parse_route (routing_component_t rc, const char *src,
                      const char *dst, name_route_extended_t route)
 {
        routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
index 88e5537..081f747 100644 (file)
@@ -177,8 +177,8 @@ static void floyd_finalize(routing_component_t rc)
 routing_component_t model_floyd_create(void)
 {
   routing_component_floyd_t new_component = (routing_component_floyd_t)routmod_generic_create(sizeof(s_routing_component_floyd_t));
-  new_component->generic_routing.set_route = model_floyd_set_route;
-  new_component->generic_routing.set_ASroute = model_floyd_set_route;
+  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;
@@ -255,7 +255,7 @@ static int surf_pointer_resource_cmp(const void *a, const void *b) {
 
 //FIXME: kill dupplicates in next function with full routing
 
-void model_floyd_set_route(routing_component_t rc, const char *src,
+void model_floyd_parse_route(routing_component_t rc, const char *src,
         const char *dst, name_route_extended_t route)
 {
        routing_component_floyd_t routing = (routing_component_floyd_t) rc;
index 5457e71..157718e 100644 (file)
@@ -129,8 +129,8 @@ routing_component_t model_full_create(void)
   routing_component_full_t new_component = (routing_component_full_t)
       routmod_generic_create(sizeof(s_routing_component_full_t));
 
-  new_component->generic_routing.set_route = model_full_set_route;
-  new_component->generic_routing.set_ASroute = model_full_set_route;
+  new_component->generic_routing.parse_route = model_full_set_route;
+  new_component->generic_routing.parse_ASroute = model_full_set_route;
   new_component->generic_routing.get_route = full_get_route;
   new_component->generic_routing.get_onelink_routes =
       full_get_onelink_routes;
index a3abea8..780ef52 100644 (file)
@@ -19,11 +19,11 @@ extern routing_component_t current_routing;
 routing_component_t routmod_generic_create(size_t childsize) {
   routing_component_t new_component = xbt_malloc0(childsize);
 
-  new_component->set_processing_unit = generic_set_processing_unit;
-  new_component->set_autonomous_system = generic_set_autonomous_system;
-  new_component->set_route = NULL;
-  new_component->set_ASroute = NULL;
-  new_component->set_bypassroute = generic_set_bypassroute;
+  new_component->parse_PU = generic_parse_PU;
+  new_component->parse_AS = generic_parse_AS;
+  new_component->parse_route = NULL;
+  new_component->parse_ASroute = NULL;
+  new_component->parse_bypassroute = generic_parse_bypassroute;
   new_component->get_route = NULL;
   new_component->get_latency = generic_get_link_latency;
   new_component->get_onelink_routes = NULL;
@@ -38,7 +38,7 @@ routing_component_t routmod_generic_create(size_t childsize) {
 }
 
 
-void generic_set_processing_unit(routing_component_t rc, const char *name)
+void generic_parse_PU(routing_component_t rc, const char *name)
 {
   XBT_DEBUG("Load process unit \"%s\"", name);
   int *id = xbt_new0(int, 1);
@@ -48,7 +48,7 @@ void generic_set_processing_unit(routing_component_t rc, const char *name)
   xbt_dict_set(_to_index, name, id, xbt_free);
 }
 
-void generic_set_autonomous_system(routing_component_t rc, const char *name)
+void generic_parse_AS(routing_component_t rc, const char *name)
 {
   XBT_DEBUG("Load Autonomous system \"%s\"", name);
   int *id = xbt_new0(int, 1);
@@ -58,7 +58,7 @@ void generic_set_autonomous_system(routing_component_t rc, const char *name)
   xbt_dict_set(_to_index, name, id, xbt_free);
 }
 
-void generic_set_bypassroute(routing_component_t rc,
+void generic_parse_bypassroute(routing_component_t rc,
                              const char *src, const char *dst,
                              route_extended_t e_route)
 {
index 025dec0..0341778 100644 (file)
@@ -38,12 +38,12 @@ static void none_finalize(routing_component_t rc)
   xbt_free(rc);
 }
 
-static void none_set_processing_unit(routing_component_t rc,
+static void none_parse_PU(routing_component_t rc,
                                      const char *name)
 {
 }
 
-static void none_set_autonomous_system(routing_component_t rc,
+static void none_parse_AS(routing_component_t rc,
                                        const char *name)
 {
 }
@@ -52,11 +52,11 @@ static void none_set_autonomous_system(routing_component_t rc,
 routing_component_t model_none_create(void)
 {
   routing_component_t new_component = xbt_new(s_routing_component_t, 1);
-  new_component->set_processing_unit = none_set_processing_unit;
-  new_component->set_autonomous_system = none_set_autonomous_system;
-  new_component->set_route = NULL;
-  new_component->set_ASroute = NULL;
-  new_component->set_bypassroute = NULL;
+  new_component->parse_PU = none_parse_PU;
+  new_component->parse_AS = none_parse_AS;
+  new_component->parse_route = NULL;
+  new_component->parse_ASroute = NULL;
+  new_component->parse_bypassroute = NULL;
   new_component->get_route = none_get_route;
   new_component->get_onelink_routes = none_get_onelink_routes;
   new_component->get_bypass_route = none_get_bypass_route;
index 269de6b..c2445cf 100644 (file)
 /* ***************** GENERIC PARSE FUNCTIONS (declarations) ***************** */
 routing_component_t routmod_generic_create(size_t childsize);
 
-void generic_set_processing_unit(routing_component_t rc,
+void generic_parse_PU(routing_component_t rc,
                                         const char *name);
-void generic_set_autonomous_system(routing_component_t rc,
+void generic_parse_AS(routing_component_t rc,
                                           const char *name);
-void generic_set_bypassroute(routing_component_t rc,
+void generic_parse_bypassroute(routing_component_t rc,
                                     const char *src, const char *dst,
                                     route_extended_t e_route);
 
@@ -64,7 +64,7 @@ void generic_src_dst_check(routing_component_t rc, const char *src,
 /* *************************** FLOYD ROUTING ******************************** */
 routing_component_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_set_route(routing_component_t rc, const char *src,
+void model_floyd_parse_route(routing_component_t rc, const char *src,
         const char *dst, name_route_extended_t route);
 
 /* ************************************************** */
@@ -91,7 +91,7 @@ routing_component_t model_dijkstra_both_create(int cached);    /* create by call
 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 */
 void model_dijkstra_both_end(void);      /* finalize the creation of dijkstra routing model */
-void model_dijkstra_both_set_route (routing_component_t rc, const char *src,
+void model_dijkstra_both_parse_route (routing_component_t rc, const char *src,
                      const char *dst, name_route_extended_t route);
 
 /* ************************************************************************** */
index 23581f4..b6c16c4 100644 (file)
@@ -67,7 +67,7 @@ static void rule_route_extended_free(void *e)
 
 /* Parse routing model functions */
 
-static void model_rulebased_set_processing_unit(routing_component_t rc,
+static void model_rulebased_parse_PU(routing_component_t rc,
                                                 const char *name)
 {
   routing_component_rulebased_t routing =
@@ -75,7 +75,7 @@ static void model_rulebased_set_processing_unit(routing_component_t rc,
   xbt_dict_set(routing->dict_processing_units, name, (void *) (-1), NULL);
 }
 
-static void model_rulebased_set_autonomous_system(routing_component_t rc,
+static void model_rulebased_parse_AS(routing_component_t rc,
                                                   const char *name)
 {
   routing_component_rulebased_t routing =
@@ -84,7 +84,7 @@ static void model_rulebased_set_autonomous_system(routing_component_t rc,
                NULL);
 }
 
-static void model_rulebased_set_route(routing_component_t rc,
+static void model_rulebased_parse_route(routing_component_t rc,
                                       const char *src, const char *dst,
                                       name_route_extended_t route)
 {
@@ -112,7 +112,7 @@ static void model_rulebased_set_route(routing_component_t rc,
   xbt_free(route);
 }
 
-static void model_rulebased_set_ASroute(routing_component_t rc,
+static void model_rulebased_parse_ASroute(routing_component_t rc,
                                         const char *src, const char *dst,
                                         name_route_extended_t route)
 {
@@ -147,7 +147,7 @@ static void model_rulebased_set_ASroute(routing_component_t rc,
   xbt_free(route);
 }
 
-static void model_rulebased_set_bypassroute(routing_component_t rc,
+static void model_rulebased_parse_bypassroute(routing_component_t rc,
                                             const char *src,
                                             const char *dst,
                                             route_extended_t e_route)
@@ -399,13 +399,11 @@ routing_component_t model_rulebased_create(void) {
   routing_component_rulebased_t new_component = (routing_component_rulebased_t)
       routmod_generic_create(sizeof(s_routing_component_rulebased_t));
 
-  new_component->generic_routing.set_processing_unit =
-      model_rulebased_set_processing_unit;
-  new_component->generic_routing.set_autonomous_system =
-      model_rulebased_set_autonomous_system;
-  new_component->generic_routing.set_route = model_rulebased_set_route;
-  new_component->generic_routing.set_ASroute = model_rulebased_set_ASroute;
-  new_component->generic_routing.set_bypassroute = model_rulebased_set_bypassroute;
+  new_component->generic_routing.parse_PU = model_rulebased_parse_PU;
+  new_component->generic_routing.parse_AS = model_rulebased_parse_AS;
+  new_component->generic_routing.parse_route = model_rulebased_parse_route;
+  new_component->generic_routing.parse_ASroute = model_rulebased_parse_ASroute;
+  new_component->generic_routing.parse_bypassroute = model_rulebased_parse_bypassroute;
   new_component->generic_routing.get_onelink_routes = rulebased_get_onelink_routes;
   new_component->generic_routing.get_route = rulebased_get_route;
   new_component->generic_routing.get_bypass_route = rulebased_get_bypass_route;