X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7da44b26eb7f4da0d4ce7672f479dea4d01767b3..3072be2de56fbf379bb67604b4aef9701cc76244:/src/surf/surf_routing_rulebased.c diff --git a/src/surf/surf_routing_rulebased.c b/src/surf/surf_routing_rulebased.c index 404335d042..2e5a948502 100644 --- a/src/surf/surf_routing_rulebased.c +++ b/src/surf/surf_routing_rulebased.c @@ -8,8 +8,8 @@ /* Global vars */ extern routing_global_t global_routing; -extern routing_component_t current_routing; -extern model_type_t current_routing_model; +extern AS_t current_routing; +extern routing_model_description_t current_routing_model; extern xbt_dynar_t link_list; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_rulebased, surf, "Routing part of surf"); @@ -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_set_processing_unit(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_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(AS_t rc, const char *name) { routing_component_rulebased_t routing = @@ -84,9 +84,9 @@ 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(AS_t rc, const char *src, const char *dst, - name_route_extended_t route) + route_extended_t route) { routing_component_rulebased_t routing = (routing_component_rulebased_t) rc; @@ -112,9 +112,9 @@ 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(AS_t rc, const char *src, const char *dst, - name_route_extended_t route) + route_extended_t route) { routing_component_rulebased_t routing = (routing_component_rulebased_t) rc; @@ -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(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,23 +394,20 @@ static void rulebased_finalize(routing_component_t rc) } /* Creation routing model functions */ -void *model_rulebased_create(void) -{ - routing_component_rulebased_t new_component = - xbt_new0(s_routing_component_rulebased_t, 1); - 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; +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)); + + 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_latency = generic_get_link_latency; new_component->generic_routing.get_bypass_route = rulebased_get_bypass_route; new_component->generic_routing.finalize = rulebased_finalize; - new_component->generic_routing.get_network_element_type = get_network_element_type; /* initialization of internal structures */ new_component->dict_processing_units = xbt_dict_new(); new_component->dict_autonomous_systems = xbt_dict_new(); @@ -418,19 +415,6 @@ void *model_rulebased_create(void) new_component->list_ASroute = xbt_dynar_new(sizeof(rule_route_extended_t), &rule_route_extended_free); - return new_component; -} -void model_rulebased_load(void) -{ - /* use "surfxml_add_callback" to add a parse function call */ -} - -void model_rulebased_unload(void) -{ - /* use "surfxml_del_callback" to remove a parse function call */ -} - -void model_rulebased_end(void) -{ + return (AS_t) new_component; }