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;
+
/*
* Platform creation functions. Instead of passing 123 arguments to the creation functions
* (one for each possible XML attribute), we pass structures containing them all. It removes the
typedef struct s_sg_platf_linkctn_cbarg *sg_platf_linkctn_cbarg_t;
typedef struct s_sg_platf_linkctn_cbarg {
const char *id;
- const char *direction;
+ e_surf_link_ctn_direction_t direction;
} s_sg_platf_linkctn_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_cb_list = xbt_dynar_new(sizeof(sg_platf_host_cb_t), NULL);
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_host_cb_t), NULL);
- sg_platf_link_cb_list = xbt_dynar_new(sizeof(sg_platf_host_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);
fun(link);
}
}
+
+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);
}
src, dst,gw_src,gw_dst);
parsed_link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
}
-/**
- * \brief Set a new link on the actual list of link for a route or ASroute from XML
- */
-
-static void routing_parse_link_ctn(void)
-{
- char *link_id;
- switch (A_surfxml_link_ctn_direction) {
- case AU_surfxml_link_ctn_direction:
- case A_surfxml_link_ctn_direction_NONE:
- link_id = xbt_strdup(A_surfxml_link_ctn_id);
- break;
- case A_surfxml_link_ctn_direction_UP:
- link_id = bprintf("%s_UP", A_surfxml_link_ctn_id);
- break;
- case A_surfxml_link_ctn_direction_DOWN:
- link_id = bprintf("%s_DOWN", A_surfxml_link_ctn_id);
- break;
- }
- xbt_dynar_push(parsed_link_list, &link_id);
-}
/**
* \brief Store the route by calling the set_route function of the current routing component
gw_src = NULL;
gw_dst = 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;
+ }
+ xbt_dynar_push(parsed_link_list, &link_id);
+}
+
/**
* \brief Store the bypass route by calling the set_bypassroute function of the current routing component
*/
surfxml_add_callback(STag_surfxml_bypassASroute_cb_list,
&routing_parse_S_bypassASroute);
- surfxml_add_callback(ETag_surfxml_link_ctn_cb_list, &routing_parse_link_ctn);
-
surfxml_add_callback(ETag_surfxml_route_cb_list, &routing_parse_E_route);
surfxml_add_callback(ETag_surfxml_ASroute_cb_list, &routing_parse_E_ASroute);
surfxml_add_callback(ETag_surfxml_bypassRoute_cb_list,
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);
/* make sure these symbols are defined as strong ones in this file so that the linker can resolve them */
xbt_dynar_t STag_surfxml_route_cb_list = NULL;
xbt_dynar_t ETag_surfxml_route_cb_list = NULL;
-xbt_dynar_t STag_surfxml_link_ctn_cb_list = NULL;
xbt_dynar_t ETag_surfxml_link_ctn_cb_list = NULL;
xbt_dynar_t STag_surfxml_process_cb_list = NULL;
xbt_dynar_t ETag_surfxml_process_cb_list = NULL;
STag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
ETag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
- STag_surfxml_link_ctn_cb_list =
- xbt_dynar_new(sizeof(void_f_void_t), NULL);
- ETag_surfxml_link_ctn_cb_list =
- xbt_dynar_new(sizeof(void_f_void_t), NULL);
STag_surfxml_process_cb_list =
xbt_dynar_new(sizeof(void_f_void_t), NULL);
ETag_surfxml_process_cb_list =
xbt_dynar_free(&STag_surfxml_route_cb_list);
xbt_dynar_free(&ETag_surfxml_route_cb_list);
- xbt_dynar_free(&STag_surfxml_link_ctn_cb_list);
- xbt_dynar_free(&ETag_surfxml_link_ctn_cb_list);
xbt_dynar_free(&STag_surfxml_process_cb_list);
xbt_dynar_free(&ETag_surfxml_process_cb_list);
xbt_dynar_free(&STag_surfxml_argument_cb_list);
current_property_set = NULL;
}
+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;
+
+ 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;
+ break;
+ case A_surfxml_link_ctn_direction_UP:
+ linkctn.direction = SURF_LINK_DIRECTION_UP;
+ break;
+ case A_surfxml_link_ctn_direction_DOWN:
+ linkctn.direction = SURF_LINK_DIRECTION_DOWN;
+ break;
+ }
+ sg_platf_new_linkctn(&linkctn);
+
+}
+
+void ETag_surfxml_link_ctn(void){
+ // NOTHING TO DO
+}
void ETag_surfxml_backbone(void){
s_sg_platf_link_cbarg_t link;
memset(&link,0,sizeof(link));
void STag_surfxml_route(void){
surfxml_call_cb_functions(STag_surfxml_route_cb_list);
}
-void STag_surfxml_link_ctn(void){
- surfxml_call_cb_functions(STag_surfxml_link_ctn_cb_list);
-}
void STag_surfxml_process(void){
surfxml_call_cb_functions(STag_surfxml_process_cb_list);
}
void type##Tag_surfxml_##name(void)
parse_method(E, route);
-parse_method(E, link_ctn);
parse_method(E, process);
parse_method(E, argument);
parse_method(E, prop);