X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/70388188c97f56fbe2b645c9b00dcb05d0b86509..e93a91fdbfece38a7de51e9da40c6388cdd0d6c8:/src/surf/surf_routing_cluster.c diff --git a/src/surf/surf_routing_cluster.c b/src/surf/surf_routing_cluster.c index 5236ef762c..45f09cc486 100644 --- a/src/surf/surf_routing_cluster.c +++ b/src/surf/surf_routing_cluster.c @@ -7,14 +7,14 @@ /* Global vars */ extern routing_global_t global_routing; -extern routing_component_t current_routing; -extern model_type_t current_routing_model; -extern xbt_dynar_t link_list; -extern xbt_dict_t cluster_host_link; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"); -/* Routing model structure */ +/* This routing is specifically setup to represent clusters, aka homogeneous sets of machines + * Note that a router is created, easing the interconnexion with the rest of the world. + */ + +static xbt_dict_t cluster_host_link = NULL; /* for tag cluster */ typedef struct { s_routing_component_t generic_routing; @@ -22,22 +22,10 @@ typedef struct { xbt_dict_t dict_autonomous_systems; } s_routing_component_cluster_t, *routing_component_cluster_t; -/* Parse routing model functions */ - -static route_extended_t cluster_get_route(routing_component_t rc, - const char *src, - const char *dst); - /* Business methods */ static route_extended_t cluster_get_route(routing_component_t rc, const char *src, - const char *dst) -{ - xbt_assert(rc && src - && dst, - "Invalid params for \"get_route\" function at AS \"%s\"", - rc->name); - + const char *dst) { xbt_dynar_t links_list = xbt_dynar_new(global_routing->size_of_link, NULL); @@ -60,10 +48,20 @@ static route_extended_t cluster_get_route(routing_component_t rc, } /* Creation routing model functions */ -void *model_cluster_create(void) +routing_component_t model_cluster_create(void) { - routing_component_cluster_t new_component = model_rulebased_create(); - new_component->generic_routing.get_route = cluster_get_route; + routing_component_t new_component = model_rulebased_create(); + new_component->get_route = cluster_get_route; + + return (routing_component_t) new_component; +} +void model_cluster_unload(void) { +// xbt_dict_free(&cluster_host_link); //FIXME: do it once the module management is clean in routing +} + +void surf_routing_cluster_add_link(const char* host_id,surf_parsing_link_up_down_t info) { + if(!cluster_host_link) + cluster_host_link = xbt_dict_new(); - return new_component; + xbt_dict_set(cluster_host_link,host_id,info,xbt_free); }