Replace char* gw_src/dst for edge.
int symmetrical;
const char *src;
const char *dst;
+ sg_routing_edge_t gw_src;
+ sg_routing_edge_t gw_dst;
xbt_dynar_t link_list;
} s_sg_platf_route_cbarg_t;
-typedef struct s_sg_platf_ASroute_cbarg *sg_platf_ASroute_cbarg_t;
-typedef struct s_sg_platf_ASroute_cbarg {
- int symmetrical;
- const char *src;
- const char *dst;
- const char *gw_src;
- const char *gw_dst;
- xbt_dynar_t link_list;
-} s_sg_platf_ASroute_cbarg_t;
-
-typedef struct s_sg_platf_bypassRoute_cbarg *sg_platf_bypassRoute_cbarg_t;
-typedef struct s_sg_platf_bypassRoute_cbarg {
- const char *src;
- const char *dst;
- xbt_dynar_t link_list;
-} s_sg_platf_bypassRoute_cbarg_t;
-
-typedef struct s_sg_platf_bypassASroute_cbarg *sg_platf_bypassASroute_cbarg_t;
-typedef struct s_sg_platf_bypassASroute_cbarg {
- const char *src;
- const char *dst;
- const char *gw_src;
- const char *gw_dst;
- xbt_dynar_t link_list;
-} s_sg_platf_bypassASroute_cbarg_t;
-
typedef struct s_sg_platf_cluster_cbarg *sg_platf_cluster_cbarg_t;
typedef struct s_sg_platf_cluster_cbarg {
const char* id;
XBT_PUBLIC(void) sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet); // Add a cabinet to the currently described AS
XBT_PUBLIC(void) sg_platf_new_route (sg_platf_route_cbarg_t route); // Add a route
-XBT_PUBLIC(void) sg_platf_new_ASroute (sg_platf_ASroute_cbarg_t ASroute); // Add an ASroute
-XBT_PUBLIC(void) sg_platf_new_bypassRoute (sg_platf_bypassRoute_cbarg_t bypassroute); // Add a bypassRoute
-XBT_PUBLIC(void) sg_platf_new_bypassASroute (sg_platf_bypassASroute_cbarg_t bypassASroute); // Add an bypassASroute
+XBT_PUBLIC(void) sg_platf_new_ASroute (sg_platf_route_cbarg_t ASroute); // Add an ASroute
+XBT_PUBLIC(void) sg_platf_new_bypassRoute (sg_platf_route_cbarg_t bypassroute); // Add a bypassRoute
+XBT_PUBLIC(void) sg_platf_new_bypassASroute (sg_platf_route_cbarg_t bypassASroute); // Add an bypassASroute
XBT_PUBLIC(void) sg_platf_new_prop (sg_platf_prop_cbarg_t prop); // Add a prop
XBT_PUBLIC(void) sg_platf_new_trace(sg_platf_trace_cbarg_t trace);
XBT_PUBLIC(void) sg_platf_route_begin (sg_platf_route_cbarg_t route); // Initialize route
XBT_PUBLIC(void) sg_platf_route_end (sg_platf_route_cbarg_t route); // Finalize and add a route
-XBT_PUBLIC(void) sg_platf_ASroute_begin (sg_platf_ASroute_cbarg_t ASroute); // Initialize ASroute
-XBT_PUBLIC(void) sg_platf_ASroute_end (sg_platf_ASroute_cbarg_t ASroute); // Finalize and add a ASroute
+XBT_PUBLIC(void) sg_platf_ASroute_begin (sg_platf_route_cbarg_t ASroute); // Initialize ASroute
+XBT_PUBLIC(void) sg_platf_ASroute_end (sg_platf_route_cbarg_t ASroute); // Finalize and add a ASroute
XBT_PUBLIC(void) sg_platf_route_add_link (const char* link_id, sg_platf_route_cbarg_t route); // Add a link to link list
-XBT_PUBLIC(void) sg_platf_ASroute_add_link (const char* link_id, sg_platf_ASroute_cbarg_t ASroute); // Add a link to link list
+XBT_PUBLIC(void) sg_platf_ASroute_add_link (const char* link_id, sg_platf_route_cbarg_t ASroute); // Add a link to link list
#endif /* SG_PLATF_H */
typedef void (*sg_platf_prop_cb_t)(sg_platf_prop_cbarg_t);
typedef void (*sg_platf_route_cb_t)(sg_platf_route_cbarg_t);
-typedef void (*sg_platf_ASroute_cb_t)(sg_platf_ASroute_cbarg_t);
-typedef void (*sg_platf_bypassRoute_cb_t)(sg_platf_bypassRoute_cbarg_t);
-typedef void (*sg_platf_bypassASroute_cb_t)(sg_platf_bypassASroute_cbarg_t);
typedef void (*sg_platf_trace_cb_t)(sg_platf_trace_cbarg_t);
typedef void (*sg_platf_trace_connect_cb_t)(sg_platf_trace_connect_cbarg_t);
void sg_platf_prop_add_cb(sg_platf_prop_cb_t fct);
void sg_platf_route_add_cb(sg_platf_route_cb_t);
-void sg_platf_ASroute_add_cb(sg_platf_ASroute_cb_t);
-void sg_platf_bypassRoute_add_cb(sg_platf_bypassRoute_cb_t);
-void sg_platf_bypassASroute_add_cb(sg_platf_bypassASroute_cb_t);
+void sg_platf_ASroute_add_cb(sg_platf_route_cb_t);
+void sg_platf_bypassRoute_add_cb(sg_platf_route_cb_t);
+void sg_platf_bypassASroute_add_cb(sg_platf_route_cb_t);
void sg_platf_trace_add_cb(sg_platf_trace_cb_t);
void sg_platf_trace_connect_add_cb(sg_platf_trace_connect_cb_t);
sg_platf_prop_cb_list = xbt_dynar_new(sizeof(sg_platf_prop_cb_t),NULL);
sg_platf_route_cb_list = xbt_dynar_new(sizeof(sg_platf_route_cb_t), NULL);
- sg_platf_ASroute_cb_list = xbt_dynar_new(sizeof(sg_platf_ASroute_cb_t), NULL);
- sg_platf_bypassRoute_cb_list = xbt_dynar_new(sizeof(sg_platf_bypassRoute_cb_t), NULL);
- sg_platf_bypassASroute_cb_list = xbt_dynar_new(sizeof(sg_platf_bypassASroute_cb_t), NULL);
+ sg_platf_ASroute_cb_list = xbt_dynar_new(sizeof(sg_platf_route_cb_t), NULL);
+ sg_platf_bypassRoute_cb_list = xbt_dynar_new(sizeof(sg_platf_route_cb_t), NULL);
+ sg_platf_bypassASroute_cb_list = xbt_dynar_new(sizeof(sg_platf_route_cb_t), NULL);
sg_platf_trace_cb_list = xbt_dynar_new(sizeof(sg_platf_trace_cb_t), NULL);
sg_platf_trace_connect_cb_list = xbt_dynar_new(sizeof(sg_platf_trace_connect_cb_t), NULL);
xbt_dynar_foreach(sg_platf_route_cb_list, iterator, fun) {
fun(route);
}
-}void sg_platf_new_ASroute(sg_platf_ASroute_cbarg_t ASroute) {
+}void sg_platf_new_ASroute(sg_platf_route_cbarg_t ASroute) {
unsigned int iterator;
- sg_platf_ASroute_cb_t fun;
+ sg_platf_route_cb_t fun;
xbt_dynar_foreach(sg_platf_ASroute_cb_list, iterator, fun) {
fun(ASroute);
}
}
-void sg_platf_new_bypassRoute(sg_platf_bypassRoute_cbarg_t bypassRoute) {
+void sg_platf_new_bypassRoute(sg_platf_route_cbarg_t bypassRoute) {
unsigned int iterator;
- sg_platf_bypassRoute_cb_t fun;
+ sg_platf_route_cb_t fun;
xbt_dynar_foreach(sg_platf_bypassRoute_cb_list, iterator, fun) {
fun(bypassRoute);
}
-}void sg_platf_new_bypassASroute(sg_platf_bypassASroute_cbarg_t bypassASroute) {
+}void sg_platf_new_bypassASroute(sg_platf_route_cbarg_t bypassASroute) {
unsigned int iterator;
- sg_platf_bypassASroute_cb_t fun;
+ sg_platf_route_cb_t fun;
xbt_dynar_foreach(sg_platf_bypassASroute_cb_list, iterator, fun) {
fun(bypassASroute);
}
void sg_platf_route_begin (sg_platf_route_cbarg_t route){
route->link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
}
-void sg_platf_ASroute_begin (sg_platf_ASroute_cbarg_t ASroute){
+void sg_platf_ASroute_begin (sg_platf_route_cbarg_t ASroute){
ASroute->link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
}
void sg_platf_route_end (sg_platf_route_cbarg_t route){
sg_platf_new_route(route);
}
-void sg_platf_ASroute_end (sg_platf_ASroute_cbarg_t ASroute){
+void sg_platf_ASroute_end (sg_platf_route_cbarg_t ASroute){
sg_platf_new_ASroute(ASroute);
}
char *link_name = xbt_strdup(link_id);
xbt_dynar_push(route->link_list, &link_name);
}
-void sg_platf_ASroute_add_link (const char* link_id, sg_platf_ASroute_cbarg_t ASroute){
+void sg_platf_ASroute_add_link (const char* link_id, sg_platf_route_cbarg_t ASroute){
char *link_name = xbt_strdup(link_id);
xbt_dynar_push(ASroute->link_list, &link_name);
}
void sg_platf_route_add_cb(sg_platf_route_cb_t fct) {
xbt_dynar_push(sg_platf_route_cb_list, &fct);
}
-void sg_platf_ASroute_add_cb(sg_platf_ASroute_cb_t fct) {
+void sg_platf_ASroute_add_cb(sg_platf_route_cb_t fct) {
xbt_dynar_push(sg_platf_ASroute_cb_list, &fct);
}
-void sg_platf_bypassRoute_add_cb(sg_platf_bypassRoute_cb_t fct) {
+void sg_platf_bypassRoute_add_cb(sg_platf_route_cb_t fct) {
xbt_dynar_push(sg_platf_bypassRoute_cb_list, &fct);
}
-void sg_platf_bypassASroute_add_cb(sg_platf_bypassASroute_cb_t fct) {
+void sg_platf_bypassASroute_add_cb(sg_platf_route_cb_t fct) {
xbt_dynar_push(sg_platf_bypassASroute_cb_list, &fct);
}
void sg_platf_prop_add_cb(sg_platf_prop_cb_t fct) {
/**
* \brief Store the ASroute by calling the set_ASroute function of the current routing component
*/
-static void parse_E_ASroute(sg_platf_ASroute_cbarg_t ASroute)
+static void parse_E_ASroute(sg_platf_route_cbarg_t ASroute)
{
route_t e_route = xbt_new0(s_route_t, 1);
e_route->link_list = ASroute->link_list;
+ e_route->src_gateway = ASroute->gw_src;
+ e_route->dst_gateway = ASroute->gw_dst;
- if (!strcmp(current_routing->model_desc->name,"RuleBased")) {
- // DIRTY PERL HACK AHEAD: with the rulebased routing, the {src,dst}_gateway fields
- // store the provided name instead of the entity directly (model_rulebased_parse_ASroute knows)
- //
- // This is because the user will provide something like "^AS_(.*)$" instead of the proper name of a given entity
- e_route->src_gateway = (sg_routing_edge_t) ASroute->gw_src;
- e_route->dst_gateway = (sg_routing_edge_t) ASroute->gw_dst;
- } else {
- e_route->src_gateway = sg_routing_edge_by_name_or_null(ASroute->gw_src);
- e_route->dst_gateway = sg_routing_edge_by_name_or_null(ASroute->gw_dst);
- }
xbt_assert(current_routing->parse_ASroute,
"no defined method \"set_ASroute\" in \"%s\"",
current_routing->name);
/**
* \brief Store the bypass route by calling the set_bypassroute function of the current routing component
*/
-static void parse_E_bypassRoute(sg_platf_bypassRoute_cbarg_t route)
+static void parse_E_bypassRoute(sg_platf_route_cbarg_t route)
{
route_t e_route = xbt_new0(s_route_t, 1);
e_route->link_list = route->link_list;
/**
* \brief Store the bypass route by calling the set_bypassroute function of the current routing component
*/
-static void parse_E_bypassASroute(sg_platf_bypassASroute_cbarg_t ASroute)
+static void parse_E_bypassASroute(sg_platf_route_cbarg_t ASroute)
{
route_t e_route = xbt_new0(s_route_t, 1);
e_route->link_list = ASroute->link_list;
- e_route->src_gateway = sg_routing_edge_by_name_or_null(ASroute->gw_src);
- e_route->dst_gateway = sg_routing_edge_by_name_or_null(ASroute->gw_dst);
+ e_route->src_gateway = ASroute->gw_src;
+ e_route->dst_gateway = ASroute->gw_dst;
xbt_assert(current_routing->parse_bypassroute,
"Bypassing mechanism not implemented by routing '%s'",
current_routing->name);
char* surf_parsed_filename = NULL; // to locate parse error messages
xbt_dynar_t parsed_link_list = NULL; /* temporary store of current list link of a route */
-
+extern AS_t current_routing;
/*
* Helping functions
*/
route.src = A_surfxml_route_src;
route.dst = A_surfxml_route_dst;
+ route.gw_src = NULL;
+ route.gw_dst = NULL;
route.link_list = parsed_link_list;
switch (A_surfxml_route_symmetrical) {
}
void ETag_surfxml_ASroute(void){
- s_sg_platf_ASroute_cbarg_t ASroute;
+ s_sg_platf_route_cbarg_t ASroute;
memset(&ASroute,0,sizeof(ASroute));
ASroute.src = A_surfxml_ASroute_src;
ASroute.dst = A_surfxml_ASroute_dst;
- ASroute.gw_src = A_surfxml_ASroute_gw_src;
- ASroute.gw_dst = A_surfxml_ASroute_gw_dst;
+
+ if (!strcmp(current_routing->model_desc->name,"RuleBased")) {
+ // DIRTY PERL HACK AHEAD: with the rulebased routing, the {src,dst}_gateway fields
+ // store the provided name instead of the entity directly (model_rulebased_parse_ASroute knows)
+ //
+ // This is because the user will provide something like "^AS_(.*)$" instead of the proper name of a given entity
+ ASroute.gw_src = (sg_routing_edge_t) A_surfxml_ASroute_gw_src;
+ ASroute.gw_dst = (sg_routing_edge_t) A_surfxml_ASroute_gw_dst;
+ } else {
+ ASroute.gw_src = sg_routing_edge_by_name_or_null(A_surfxml_ASroute_gw_src);
+ ASroute.gw_dst = sg_routing_edge_by_name_or_null(A_surfxml_ASroute_gw_dst);
+ }
+
ASroute.link_list = parsed_link_list;
switch (A_surfxml_ASroute_symmetrical) {
}
void ETag_surfxml_bypassRoute(void){
- s_sg_platf_bypassRoute_cbarg_t route;
+ s_sg_platf_route_cbarg_t route;
memset(&route,0,sizeof(route));
route.src = A_surfxml_bypassRoute_src;
route.dst = A_surfxml_bypassRoute_dst;
+ route.gw_src = NULL;
+ route.gw_dst = NULL;
route.link_list = parsed_link_list;
+ route.symmetrical = FALSE;
sg_platf_new_bypassRoute(&route);
parsed_link_list = NULL;
}
void ETag_surfxml_bypassASroute(void){
- s_sg_platf_bypassASroute_cbarg_t ASroute;
+ s_sg_platf_route_cbarg_t ASroute;
memset(&ASroute,0,sizeof(ASroute));
ASroute.src = A_surfxml_bypassASroute_src;
ASroute.dst = A_surfxml_bypassASroute_dst;
- ASroute.gw_src = A_surfxml_bypassASroute_gw_src;
- ASroute.gw_dst = A_surfxml_bypassASroute_gw_dst;
ASroute.link_list = parsed_link_list;
+ ASroute.symmetrical = FALSE;
+
+ if (!strcmp(current_routing->model_desc->name,"RuleBased")) {
+ // DIRTY PERL HACK AHEAD: with the rulebased routing, the {src,dst}_gateway fields
+ // store the provided name instead of the entity directly (model_rulebased_parse_ASroute knows)
+ //
+ // This is because the user will provide something like "^AS_(.*)$" instead of the proper name of a given entity
+ ASroute.gw_src = (sg_routing_edge_t) A_surfxml_bypassASroute_gw_src;
+ ASroute.gw_dst = (sg_routing_edge_t) A_surfxml_bypassASroute_gw_dst;
+ } else {
+ ASroute.gw_src = sg_routing_edge_by_name_or_null(A_surfxml_bypassASroute_gw_src);
+ ASroute.gw_dst = sg_routing_edge_by_name_or_null(A_surfxml_bypassASroute_gw_dst);
+ }
sg_platf_new_bypassASroute(&ASroute);
parsed_link_list = NULL;