X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3072be2de56fbf379bb67604b4aef9701cc76244..1059053df344f90ee74d4fc9af05efce32022813:/src/surf/surf_routing_cluster.c diff --git a/src/surf/surf_routing_cluster.c b/src/surf/surf_routing_cluster.c index 8a25091a3d..ccdfea6d51 100644 --- a/src/surf/surf_routing_cluster.c +++ b/src/surf/surf_routing_cluster.c @@ -14,7 +14,13 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf" * 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_as_t generic_routing; + void *backbone; +} s_as_cluster_t, *as_cluster_t; + + +static xbt_dict_t cluster_host_link = NULL; /* Business methods */ static route_extended_t cluster_get_route(AS_t as, @@ -28,8 +34,8 @@ static route_extended_t cluster_get_route(AS_t as, 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,as->name); - if(info) xbt_dynar_push_as(links_list,void*,info->link_up); //link_bb + if ( ((as_cluster_t)as)->backbone ) + xbt_dynar_push_as(links_list,void*, ((as_cluster_t)as)->backbone) ; info = xbt_dict_get_or_null(cluster_host_link,dst); if(info) xbt_dynar_push_as(links_list,void*,info->link_down); //link_down @@ -41,11 +47,17 @@ static route_extended_t cluster_get_route(AS_t as, return new_e_route; } +static void model_cluster_finalize(AS_t as) { + xbt_dict_free(&cluster_host_link); + model_none_finalize(as); +} /* Creation routing model functions */ AS_t model_cluster_create(void) { - AS_t result = model_none_create(); + AS_t result = model_none_create_sized(sizeof(s_as_cluster_t)); result->get_route = cluster_get_route; + result->get_latency = generic_get_link_latency; + result->finalize = model_cluster_finalize; return (AS_t) result; } @@ -56,3 +68,7 @@ void surf_routing_cluster_add_link(const char* host_id,surf_parsing_link_up_down xbt_dict_set(cluster_host_link,host_id,info,xbt_free); } + +void surf_routing_cluster_add_backbone(AS_t as, void* bb) { + ((as_cluster_t)as)->backbone = bb; +}