SURF_LINK_FATPIPE = 0
} e_surf_link_sharing_policy_t;
-typedef enum {
- SURF_LINK_DIRECTION_NONE = 2,
- SURF_LINK_DIRECTION_UP = 1,
- SURF_LINK_DIRECTION_DOWN = 0
-} e_surf_link_ctn_direction_t;
-
typedef enum {
SURF_TRACE_CONNECT_KIND_HOST_AVAIL = 4,
SURF_TRACE_CONNECT_KIND_POWER = 3,
tmgr_trace_t state_trace;
} s_sg_platf_peer_cbarg_t;
-typedef struct s_sg_platf_linkctn_cbarg *sg_platf_linkctn_cbarg_t;
-typedef struct s_sg_platf_linkctn_cbarg {
- const char *id;
- e_surf_link_ctn_direction_t direction;
-} s_sg_platf_linkctn_cbarg_t;
-
typedef struct s_sg_platf_route_cbarg *sg_platf_route_cbarg_t;
typedef struct s_sg_platf_route_cbarg {
int symmetrical;
const char *src;
const char *dst;
+ xbt_dynar_t link_list;
} s_sg_platf_route_cbarg_t;
typedef struct s_sg_platf_ASroute_cbarg *sg_platf_ASroute_cbarg_t;
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;
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;
XBT_PUBLIC(void) sg_platf_new_host_link(sg_platf_host_link_cbarg_t h); // Add an host_link to the currently described AS
XBT_PUBLIC(void) sg_platf_new_router (sg_platf_router_cbarg_t router); // Add a router to the currently described AS
XBT_PUBLIC(void) sg_platf_new_link (sg_platf_link_cbarg_t link); // Add a link to the currently described AS
-XBT_PUBLIC(void) sg_platf_new_linkctn (sg_platf_linkctn_cbarg_t linkctn); // Add a linkctn
XBT_PUBLIC(void) sg_platf_new_peer (sg_platf_peer_cbarg_t peer); // Add a peer to the currently described AS
XBT_PUBLIC(void) sg_platf_new_cluster(sg_platf_cluster_cbarg_t clust); // Add a cluster to the currently described AS
XBT_PUBLIC(void) sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet); // Add a cabinet to the currently described AS
typedef void (*sg_platf_host_link_cb_t)(sg_platf_host_link_cbarg_t);
typedef void (*sg_platf_router_cb_t)(sg_platf_router_cbarg_t);
typedef void (*sg_platf_link_cb_t)(sg_platf_link_cbarg_t);
-typedef void (*sg_platf_linkctn_cb_t)(sg_platf_linkctn_cbarg_t);
typedef void (*sg_platf_peer_cb_t)(sg_platf_peer_cbarg_t);
typedef void (*sg_platf_cluster_cb_t)(sg_platf_cluster_cbarg_t);
typedef void (*sg_platf_cabinet_cb_t)(sg_platf_cabinet_cbarg_t);
void sg_platf_host_link_add_cb(sg_platf_host_link_cb_t);
void sg_platf_router_add_cb(sg_platf_router_cb_t);
void sg_platf_link_add_cb(sg_platf_link_cb_t);
-void sg_platf_linkctn_add_cb(sg_platf_linkctn_cb_t fct);
void sg_platf_peer_add_cb(sg_platf_peer_cb_t fct);
void sg_platf_cluster_add_cb(sg_platf_cluster_cb_t fct);
void sg_platf_cabinet_add_cb(sg_platf_cabinet_cb_t fct);
xbt_dynar_t sg_platf_host_cb_list = NULL; // of sg_platf_host_cb_t
xbt_dynar_t sg_platf_host_link_cb_list = NULL; // of sg_platf_host_link_cb_t
xbt_dynar_t sg_platf_link_cb_list = NULL; // of sg_platf_link_cb_t
-xbt_dynar_t sg_platf_linkctn_cb_list = NULL; // of sg_platf_linkctn_cb_t
xbt_dynar_t sg_platf_router_cb_list = NULL; // of sg_platf_router_cb_t
xbt_dynar_t sg_platf_peer_cb_list = NULL; // of sg_platf_peer_cb_t
xbt_dynar_t sg_platf_cluster_cb_list = NULL; // of sg_platf_cluster_cb_t
sg_platf_host_link_cb_list = xbt_dynar_new(sizeof(sg_platf_host_link_cb_t), NULL);
sg_platf_router_cb_list = xbt_dynar_new(sizeof(sg_platf_router_cb_t), NULL);
sg_platf_link_cb_list = xbt_dynar_new(sizeof(sg_platf_link_cb_t), NULL);
- sg_platf_linkctn_cb_list = xbt_dynar_new(sizeof(sg_platf_linkctn_cb_t), NULL);
sg_platf_peer_cb_list = xbt_dynar_new(sizeof(sg_platf_peer_cb_t), NULL);
sg_platf_cluster_cb_list = xbt_dynar_new(sizeof(sg_platf_cluster_cb_t), NULL);
sg_platf_cabinet_cb_list = xbt_dynar_new(sizeof(sg_platf_cabinet_cb_t), NULL);
xbt_dynar_free(&sg_platf_host_link_cb_list);
xbt_dynar_free(&sg_platf_router_cb_list);
xbt_dynar_free(&sg_platf_link_cb_list);
- xbt_dynar_free(&sg_platf_linkctn_cb_list);
xbt_dynar_free(&sg_platf_postparse_cb_list);
xbt_dynar_free(&sg_platf_peer_cb_list);
xbt_dynar_free(&sg_platf_cluster_cb_list);
}
}
-void sg_platf_new_linkctn(sg_platf_linkctn_cbarg_t linkctn){
- unsigned int iterator;
- sg_platf_linkctn_cb_t fun;
- xbt_dynar_foreach(sg_platf_linkctn_cb_list, iterator, fun) {
- fun(linkctn);
- }
-}
void sg_platf_new_peer(sg_platf_peer_cbarg_t peer){
unsigned int iterator;
sg_platf_peer_cb_t fun;
void sg_platf_link_add_cb(sg_platf_link_cb_t fct) {
xbt_dynar_push(sg_platf_link_cb_list, &fct);
}
-void sg_platf_linkctn_add_cb(sg_platf_linkctn_cb_t fct) {
- xbt_dynar_push(sg_platf_linkctn_cb_list, &fct);
-}
void sg_platf_router_add_cb(sg_platf_router_cb_t fct) {
xbt_dynar_push(sg_platf_router_cb_list, &fct);
}
AS_t current_routing = NULL;
/* global parse functions */
-xbt_dynar_t parsed_link_list = NULL; /* temporary store of current list link of a route */
extern xbt_dynar_t mount_list;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf");
static void parse_E_route(sg_platf_route_cbarg_t route)
{
route_t created_route = xbt_new0(s_route_t, 1);
- created_route->link_list = parsed_link_list;
+ created_route->link_list = route->link_list;
xbt_assert(current_routing->parse_route,
"no defined method \"set_route\" in \"%s\"",
current_routing->parse_route(current_routing,
route->src, route->dst, created_route);
generic_free_route(created_route);
- parsed_link_list = NULL;
}
/**
static void parse_E_ASroute(sg_platf_ASroute_cbarg_t ASroute)
{
route_t e_route = xbt_new0(s_route_t, 1);
- e_route->link_list = parsed_link_list;
+ e_route->link_list = ASroute->link_list;
if (!strcmp(current_routing->model_desc->name,"RuleBased")) {
// DIRTY PERL HACK AHEAD: with the rulebased routing, the {src,dst}_gateway fields
current_routing->name);
current_routing->parse_ASroute(current_routing, ASroute->src, ASroute->dst, e_route);
generic_free_route(e_route);
- parsed_link_list = NULL;
}
/**
static void parse_E_bypassRoute(sg_platf_bypassRoute_cbarg_t route)
{
route_t e_route = xbt_new0(s_route_t, 1);
- e_route->link_list = parsed_link_list;
+ e_route->link_list = route->link_list;
xbt_assert(current_routing->parse_bypassroute,
"Bypassing mechanism not implemented by routing '%s'",
current_routing->name);
current_routing->parse_bypassroute(current_routing, route->src, route->dst, e_route);
- parsed_link_list = NULL;
}
/**
static void parse_E_bypassASroute(sg_platf_bypassASroute_cbarg_t ASroute)
{
route_t e_route = xbt_new0(s_route_t, 1);
- e_route->link_list = parsed_link_list;
+ 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);
xbt_assert(current_routing->parse_bypassroute,
"Bypassing mechanism not implemented by routing '%s'",
current_routing->name);
current_routing->parse_bypassroute(current_routing, ASroute->src, ASroute->dst, e_route);
- parsed_link_list = NULL;
-}
-
-/**
- * \brief Set a new link on the actual list of link for a route or ASroute from XML
- */
-
-static void routing_parse_link_ctn(sg_platf_linkctn_cbarg_t linkctn)
-{
- char *link_id;
- switch (linkctn->direction) {
- case SURF_LINK_DIRECTION_NONE:
- link_id = xbt_strdup(linkctn->id);
- break;
- case SURF_LINK_DIRECTION_UP:
- link_id = bprintf("%s_UP", linkctn->id);
- break;
- case SURF_LINK_DIRECTION_DOWN:
- link_id = bprintf("%s_DOWN", linkctn->id);
- break;
- }
-
- if(parsed_link_list == NULL)
- parsed_link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
-
- xbt_dynar_push(parsed_link_list, &link_id);
}
static void routing_parse_trace(sg_platf_trace_cbarg_t trace)
sg_platf_peer_add_cb(routing_parse_peer);
sg_platf_postparse_add_cb(routing_parse_postparse);
- sg_platf_linkctn_add_cb(routing_parse_link_ctn);
-
/* we care about the ASes while parsing the platf. Incredible, isnt it? */
sg_platf_AS_end_add_cb(routing_AS_end);
sg_platf_AS_begin_add_cb(routing_AS_begin);
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 */
+
/*
* Helping functions
*/
}
void STag_surfxml_link_ctn(void){
- s_sg_platf_linkctn_cbarg_t linkctn;
- memset(&linkctn,0,sizeof(linkctn));
-
- linkctn.id = A_surfxml_link_ctn_id;
+ char *link_id;
switch (A_surfxml_link_ctn_direction) {
case AU_surfxml_link_ctn_direction:
case A_surfxml_link_ctn_direction_NONE:
- linkctn.direction = SURF_LINK_DIRECTION_NONE;
+ link_id = xbt_strdup(A_surfxml_link_ctn_id);
break;
case A_surfxml_link_ctn_direction_UP:
- linkctn.direction = SURF_LINK_DIRECTION_UP;
+ link_id = bprintf("%s_UP", A_surfxml_link_ctn_id);
break;
case A_surfxml_link_ctn_direction_DOWN:
- linkctn.direction = SURF_LINK_DIRECTION_DOWN;
+ link_id = bprintf("%s_DOWN", A_surfxml_link_ctn_id);
break;
}
- sg_platf_new_linkctn(&linkctn);
+ // FIXME we should push the surf link object but it don't
+ // work because of model rulebased
+ xbt_dynar_push(parsed_link_list, &link_id);
}
void ETag_surfxml_backbone(void){
xbt_assert(strlen(A_surfxml_route_src) > 0 || strlen(A_surfxml_route_dst) > 0,
"Missing end-points while defining route \"%s\"->\"%s\"",
A_surfxml_route_src, A_surfxml_route_dst);
+ parsed_link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
}
void STag_surfxml_ASroute(void){
xbt_assert(strlen(A_surfxml_ASroute_src) > 0 || strlen(A_surfxml_ASroute_dst) > 0
"Missing end-points while defining route \"%s\"->\"%s\" (with %s and %s as gateways)",
A_surfxml_ASroute_src, A_surfxml_ASroute_dst,
A_surfxml_ASroute_gw_src,A_surfxml_ASroute_gw_dst);
+ parsed_link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
}
void STag_surfxml_bypassRoute(void){
xbt_assert(strlen(A_surfxml_bypassRoute_src) > 0 || strlen(A_surfxml_bypassRoute_dst) > 0,
"Missing end-points while defining bupass route \"%s\"->\"%s\"",
A_surfxml_bypassRoute_src, A_surfxml_bypassRoute_dst);
+ parsed_link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
}
void STag_surfxml_bypassASroute(void){
xbt_assert(strlen(A_surfxml_bypassASroute_src) > 0 || strlen(A_surfxml_bypassASroute_dst) > 0
"Missing end-points while defining route \"%s\"->\"%s\" (with %s and %s as gateways)",
A_surfxml_bypassASroute_src, A_surfxml_bypassASroute_dst,
A_surfxml_bypassASroute_gw_src,A_surfxml_bypassASroute_gw_dst);
+ parsed_link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
}
void ETag_surfxml_route(void){
route.src = A_surfxml_route_src;
route.dst = A_surfxml_route_dst;
+ route.link_list = parsed_link_list;
switch (A_surfxml_route_symmetrical) {
case AU_surfxml_route_symmetrical:
}
sg_platf_new_route(&route);
+ parsed_link_list = NULL;
}
void ETag_surfxml_ASroute(void){
ASroute.dst = A_surfxml_ASroute_dst;
ASroute.gw_src = A_surfxml_ASroute_gw_src;
ASroute.gw_dst = A_surfxml_ASroute_gw_dst;
+ ASroute.link_list = parsed_link_list;
switch (A_surfxml_ASroute_symmetrical) {
case AU_surfxml_ASroute_symmetrical:
}
sg_platf_new_ASroute(&ASroute);
+ parsed_link_list = NULL;
}
void ETag_surfxml_bypassRoute(void){
route.src = A_surfxml_bypassRoute_src;
route.dst = A_surfxml_bypassRoute_dst;
+ route.link_list = parsed_link_list;
sg_platf_new_bypassRoute(&route);
+ parsed_link_list = NULL;
}
void ETag_surfxml_bypassASroute(void){
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;
sg_platf_new_bypassASroute(&ASroute);
+ parsed_link_list = NULL;
}
void ETag_surfxml_trace(void){