#include "simgrid/platf_interface.h" // platform creation API internal interface
#include "surf_routing_generic.hpp"
#include "simgrid/platf_interface.h" // platform creation API internal interface
#include "surf_routing_generic.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
-void AsGeneric::getRouteAndLatency(RoutingEdgePtr /*src*/, RoutingEdgePtr /*dst*/, sg_platf_route_cbarg_t /*into*/, double */*latency*/){
+void AsGeneric::getRouteAndLatency(RoutingEdge */*src*/, RoutingEdge */*dst*/, sg_platf_route_cbarg_t /*into*/, double */*latency*/){
- XBT_DEBUG("Load process unit \"%s\"", elm->p_name);
- xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+ XBT_DEBUG("Load process unit \"%s\"", elm->getName());
+ xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
- XBT_DEBUG("Load Autonomous system \"%s\"", elm->p_name);
- xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+ XBT_DEBUG("Load Autonomous system \"%s\"", elm->getName());
+ xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
src, dst);
xbt_assert(!xbt_dict_get_or_null(dict_bypassRoutes, route_name),
"The bypass route between \"%s\"(\"%s\") and \"%s\"(\"%s\") already exists",
src, dst);
xbt_assert(!xbt_dict_get_or_null(dict_bypassRoutes, route_name),
"The bypass route between \"%s\"(\"%s\") and \"%s\"(\"%s\") already exists",
- src, e_route->gw_src->p_name, dst, e_route->gw_dst->p_name);
+ src, e_route->gw_src->getName(), dst, e_route->gw_dst->getName());
- RoutingEdgePtr my_src =
- xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdgePtr);
+ RoutingEdge *my_src =
+ xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdge*);
- RoutingEdgePtr my_dst =
- xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdgePtr);
+ RoutingEdge *my_dst =
+ xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdge*);
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
getRouteAndLatency(my_src, my_dst, route, NULL);
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
getRouteAndLatency(my_src, my_dst, route, NULL);
- previous = new_xbt_graph_node(graph, route->gw_src->p_name, nodes);
- previous_name = route->gw_src->p_name;
+ previous = new_xbt_graph_node(graph, route->gw_src->getName(), nodes);
+ previous_name = route->gw_src->getName();
- previous = new_xbt_graph_node(graph, my_src->p_name, nodes);
- previous_name = my_src->p_name;
+ previous = new_xbt_graph_node(graph, my_src->getName(), nodes);
+ previous_name = my_src->getName();
current = new_xbt_graph_node(graph, link_name, nodes);
current_name = link_name;
new_xbt_graph_edge(graph, previous, current, edges);
current = new_xbt_graph_node(graph, link_name, nodes);
current_name = link_name;
new_xbt_graph_edge(graph, previous, current, edges);
- current = new_xbt_graph_node(graph, route->gw_dst->p_name, nodes);
- current_name = route->gw_dst->p_name;
+ current = new_xbt_graph_node(graph, route->gw_dst->getName(), nodes);
+ current_name = route->gw_dst->getName();
- current = new_xbt_graph_node(graph, my_dst->p_name, nodes);
- current_name = my_dst->p_name;
+ current = new_xbt_graph_node(graph, my_dst->getName(), nodes);
+ current_name = my_dst->getName();
}
new_xbt_graph_edge(graph, previous, current, edges);
XBT_DEBUG (" %s -> %s", previous_name, current_name);
}
new_xbt_graph_edge(graph, previous, current, edges);
XBT_DEBUG (" %s -> %s", previous_name, current_name);
if (no_bypassroute_declared)
return NULL;
sg_platf_route_cbarg_t e_route_bypass = NULL;
xbt_dict_t dict_bypassRoutes = p_bypassRoutes;
if (no_bypassroute_declared)
return NULL;
sg_platf_route_cbarg_t e_route_bypass = NULL;
xbt_dict_t dict_bypassRoutes = p_bypassRoutes;
- if(dst->p_rcComponent == this && src->p_rcComponent == this ){
- char *route_name = bprintf("%s#%s", src->p_name, dst->p_name);
+ if(dst->getRcComponent() == this && src->getRcComponent() == this ){
+ char *route_name = bprintf("%s#%s", src->getName(), dst->getName());
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
if(e_route_bypass)
XBT_DEBUG("Find bypass route with %ld links",xbt_dynar_length(e_route_bypass->link_list));
free(route_name);
}
else{
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
if(e_route_bypass)
XBT_DEBUG("Find bypass route with %ld links",xbt_dynar_length(e_route_bypass->link_list));
free(route_name);
}
else{
int index_src, index_dst;
xbt_dynar_t path_src = NULL;
xbt_dynar_t path_dst = NULL;
int index_src, index_dst;
xbt_dynar_t path_src = NULL;
xbt_dynar_t path_dst = NULL;
if (src == NULL || dst == NULL)
xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
if (src == NULL || dst == NULL)
xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
- src->p_name, dst->p_name, p_name);
+ src ? src->getName() : "(null)",
+ dst ? dst->getName() : "(null)", p_name);
current = src_as;
while (current != NULL) {
xbt_dynar_push(path_src, ¤t);
current = current->p_routingFather;
}
current = src_as;
while (current != NULL) {
xbt_dynar_push(path_src, ¤t);
current = current->p_routingFather;
}
current = dst_as;
while (current != NULL) {
xbt_dynar_push(path_dst, ¤t);
current = dst_as;
while (current != NULL) {
xbt_dynar_push(path_dst, ¤t);
/* (3) find the common father */
index_src = path_src->used - 1;
index_dst = path_dst->used - 1;
/* (3) find the common father */
index_src = path_src->used - 1;
index_dst = path_dst->used - 1;
- current_src = (AsPtr *) xbt_dynar_get_ptr(path_src, index_src);
- current_dst = (AsPtr *) xbt_dynar_get_ptr(path_dst, index_dst);
+ current_src = (As **) xbt_dynar_get_ptr(path_src, index_src);
+ current_dst = (As **) xbt_dynar_get_ptr(path_dst, index_dst);
while (index_src >= 0 && index_dst >= 0 && *current_src == *current_dst) {
xbt_dynar_pop_ptr(path_src);
xbt_dynar_pop_ptr(path_dst);
index_src--;
index_dst--;
while (index_src >= 0 && index_dst >= 0 && *current_src == *current_dst) {
xbt_dynar_pop_ptr(path_src);
xbt_dynar_pop_ptr(path_dst);
index_src--;
index_dst--;
- current_src = (AsPtr *) xbt_dynar_get_ptr(path_src, index_src);
- current_dst = (AsPtr *) xbt_dynar_get_ptr(path_dst, index_dst);
+ current_src = (As **) xbt_dynar_get_ptr(path_src, index_src);
+ current_dst = (As **) xbt_dynar_get_ptr(path_dst, index_dst);
for (i = 0; i < max; i++) {
if (i <= max_index_src && max <= max_index_dst) {
char *route_name = bprintf("%s#%s",
for (i = 0; i < max; i++) {
if (i <= max_index_src && max <= max_index_dst) {
char *route_name = bprintf("%s#%s",
(xbt_dynar_get_ptr(path_dst, max)))->p_name);
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
(xbt_dynar_get_ptr(path_dst, max)))->p_name);
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
break;
if (max <= max_index_src && i <= max_index_dst) {
char *route_name = bprintf("%s#%s",
break;
if (max <= max_index_src && i <= max_index_dst) {
char *route_name = bprintf("%s#%s",
(xbt_dynar_get_ptr(path_dst, i)))->p_name);
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
(xbt_dynar_get_ptr(path_dst, i)))->p_name);
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
if (max <= max_index_src && max <= max_index_dst) {
char *route_name = bprintf("%s#%s",
if (max <= max_index_src && max <= max_index_dst) {
char *route_name = bprintf("%s#%s",
(xbt_dynar_get_ptr(path_dst, max)))->p_name);
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
(xbt_dynar_get_ptr(path_dst, max)))->p_name);
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
unsigned int cpt = 0;
new_e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
new_e_route->gw_src = e_route_bypass->gw_src;
unsigned int cpt = 0;
new_e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
new_e_route->gw_src = e_route_bypass->gw_src;
xbt_assert(routearg->gw_src && routearg->gw_dst,
"NULL is obviously a bad gateway");
xbt_assert(routearg->gw_src && routearg->gw_dst,
"NULL is obviously a bad gateway");
result->gw_src = routearg->gw_src;
result->gw_dst = routearg->gw_dst;
}
xbt_dynar_foreach(routearg->link_list, cpt, link_name) {
result->gw_src = routearg->gw_src;
result->gw_dst = routearg->gw_dst;
}
xbt_dynar_foreach(routearg->link_list, cpt, link_name) {
if (link) {
if (change_order)
xbt_dynar_push(result->link_list, &link);
else
xbt_dynar_unshift(result->link_list, &link);
} else
if (link) {
if (change_order)
xbt_dynar_push(result->link_list, &link);
else
xbt_dynar_unshift(result->link_list, &link);
} else
- THROWF(mismatch_error, 0, "Link %s not found", link_name);
+ THROWF(mismatch_error, 0, "Link '%s' not found", link_name);
xbt_dict_foreach(p_routingSons, cursor, key, elem) {
if (to_find == elem || elem->asExist(to_find)) {
found = 1;
xbt_dict_foreach(p_routingSons, cursor, key, elem) {
if (to_find == elem || elem->asExist(to_find)) {
found = 1;
- AsPtr element_as;
- element_as = ((RoutingEdgePtr)
- xbt_lib_get_or_null(host_lib,
- element, ROUTING_HOST_LEVEL))->p_rcComponent;
+ As *element_as = sg_host_edge(sg_host_by_name(element)) ->getRcComponent();
- src->p_name, src_as->p_name,
- dst->p_name, dst_as->p_name);
+ src->getName(), src_as->p_name,
+ dst->getName(), dst_as->p_name);