static char *gw_src = NULL; /* temporary store the gateway source name of a route */
static char *gw_dst = NULL; /* temporary store the gateway destination name of a route */
static xbt_dynar_t link_list = NULL; /* temporary store of current list link of a route */
+
+static xbt_dict_t coordinates = NULL;
+
/**
* \brief Add a "host" to the network element list
*/
-static void parse_S_host(char *host_id)
+static void parse_S_host(char *host_id, char* coord)
{
network_element_info_t info = NULL;
if (current_routing->hierarchy == SURF_ROUTING_NULL)
info->rc_type = SURF_NETWORK_ELEMENT_HOST;
xbt_dict_set(global_routing->where_network_elements, host_id,
(void *) info, NULL);
+
+ if (strcmp(coord,"")) {
+ xbt_dynar_t ctn = xbt_str_split_str(coord, " ");
+ xbt_dynar_shrink(ctn,0);
+ xbt_dict_set (coordinates,host_id,ctn,NULL);
+ }
}
/*
*/
static void parse_S_host_XML(void)
{
- parse_S_host(A_surfxml_host_id);
+ parse_S_host(A_surfxml_host_id, A_surfxml_host_coordinates);
}
/*
* \brief Add a host to the network element list from lua script
*/
-static void parse_S_host_lua(char *host_id)
+static void parse_S_host_lua(char *host_id, char *coord)
{
- parse_S_host(host_id);
+ parse_S_host(host_id, coord);
}
_finalize(global_routing->root);
/* delete "where" dict */
xbt_dict_free(&(global_routing->where_network_elements));
+ xbt_dict_free(&(coordinates));
/* delete last_route */
xbt_dynar_free(&(global_routing->last_route));
/* delete global routing structure */
/* no current routing at moment */
current_routing = NULL;
+ coordinates = xbt_dict_new();
+
/* parse generic elements */
surfxml_add_callback(STag_surfxml_host_cb_list, &parse_S_host_XML);
surfxml_add_callback(STag_surfxml_router_cb_list, &parse_S_router);
void routing_add_host(const char *host_id)
{
- parse_S_host_lua((char *) host_id);
+ parse_S_host_lua((char *) host_id, (char*)""); // FIXME propagate coordinate system to lua
}
/*