model_type_t current_routing_model = NULL;
/* Prototypes of each model */
-static void* model_full_create(); /* create structures for full routing model */
-static void model_full_load(); /* load parse functions for full routing model */
-static void model_full_unload(); /* unload parse functions for full routing model */
-static void model_full_end(); /* finalize the creation of full routing model */
-
-static void* model_floyd_create(); /* create structures for floyd routing model */
-static void model_floyd_load(); /* load parse functions for floyd routing model */
-static void model_floyd_unload(); /* unload parse functions for floyd routing model */
-static void model_floyd_end(); /* finalize the creation of floyd routing model */
-
-static void* model_dijkstra_create(); /* create structures for dijkstra routing model */
-static void model_dijkstra_load(); /* load parse functions for dijkstra routing model */
-static void model_dijkstra_unload(); /* unload parse functions for dijkstra routing model */
-static void model_dijkstra_end(); /* finalize the creation of dijkstra routing model */
-
-static void* model_dijkstracache_create(); /* create structures for dijkstracache routing model */
-static void model_dijkstracache_load(); /* load parse functions for dijkstracache routing model */
-static void model_dijkstracache_unload(); /* unload parse functions for dijkstracache routing model */
-static void model_dijkstracache_end(); /* finalize the creation of dijkstracache routing model */
-
-static void* model_none_create(); /* none routing model */
-static void model_none_load(); /* none routing model */
-static void model_none_unload(); /* none routing model */
-static void model_none_end(); /* none routing model */
+static void* model_full_create(void); /* create structures for full routing model */
+static void model_full_load(void); /* load parse functions for full routing model */
+static void model_full_unload(void); /* unload parse functions for full routing model */
+static void model_full_end(void); /* finalize the creation of full routing model */
+
+static void* model_floyd_create(void); /* create structures for floyd routing model */
+static void model_floyd_load(void); /* load parse functions for floyd routing model */
+static void model_floyd_unload(void); /* unload parse functions for floyd routing model */
+static void model_floyd_end(void); /* finalize the creation of floyd routing model */
+
+static void* model_dijkstra_create(void); /* create structures for dijkstra routing model */
+static void model_dijkstra_load(void); /* load parse functions for dijkstra routing model */
+static void model_dijkstra_unload(void); /* unload parse functions for dijkstra routing model */
+static void model_dijkstra_end(void); /* finalize the creation of dijkstra routing model */
+
+static void* model_dijkstracache_create(void); /* create structures for dijkstracache routing model */
+static void model_dijkstracache_load(void); /* load parse functions for dijkstracache routing model */
+static void model_dijkstracache_unload(void); /* unload parse functions for dijkstracache routing model */
+static void model_dijkstracache_end(void); /* finalize the creation of dijkstracache routing model */
+
+static void* model_none_create(void); /* none routing model */
+static void model_none_load(void); /* none routing model */
+static void model_none_unload(void); /* none routing model */
+static void model_none_end(void); /* none routing model */
/* Table of routing models */
/* must be finish with null and carefull if change de order */
xbt_dict_set(global_routing->where_network_elements,rc->name,rc->routing_father,NULL);
xbt_dict_cursor_t cursor = NULL;
char *key;
- int *val;
routing_component_t elem;
xbt_dict_foreach(rc->routing_sons, cursor, key, elem) {
_add_parse_AS(elem);
routing_component_t src_as, dst_as;
int index_src, index_dst, index_father_src, index_father_dst;
- int *src_id, *dst_id;
+ int count_src, count_dst;
xbt_dynar_t path_src = NULL;
xbt_dynar_t path_dst = NULL;
char *current_router_src, *current_router_dst;
void* link;
route_extended_t route_center_links;
xbt_dynar_t path_src_links, path_dst_links, path_first, path_last;
- int cpt;
+ unsigned int cpt;
xbt_dynar_reset(global_routing->last_route);
current_router_dst = route_center_links->src_gateway; /* first router in the reverse path */
current_src_father = xbt_dynar_get_ptr(path_src,index_src);
index_src--;
- for(index_src;index_src>=0;index_src--) {
- current_src = xbt_dynar_get_ptr(path_src,index_src);
+ for(count_src=index_src;count_src>=0;count_src--) {
+ current_src = xbt_dynar_get_ptr(path_src,count_src);
xbt_assert1((*current_src_father)->get_route, "Invalid \"get_route\" for \"%s\"",(*current_src_father)->name);
tmp_route = (*((*current_src_father)->get_route))(*current_src_father,(*current_src)->name,current_router_dst);
xbt_assert3(tmp_route, "there is no route between \"%s\" and \"%s\" in \"%s\"",
current_router_src = route_center_links->dst_gateway; /* last router in the reverse path */
current_dst_father = xbt_dynar_get_ptr(path_dst,index_dst);
index_dst--;
- for(index_dst;index_dst>=0;index_dst--) {
- current_dst = xbt_dynar_get_ptr(path_dst,index_dst);
+ for(count_dst=index_dst;count_dst>=0;count_dst--) {
+ current_dst = xbt_dynar_get_ptr(path_dst,count_dst);
xbt_assert1((*current_dst_father)->get_route, "Invalid \"get_route\" for \"%s\"",(*current_dst_father)->name);
tmp_route = (*((*current_dst_father)->get_route))(*current_dst_father,current_router_src,(*current_dst)->name);
xbt_assert3(tmp_route, "there is no route between \"%s\" and \"%s\" in \"%s\"",
static void model_full_end() {
- char *key, *end, *link_name, *src_name, *dst_name, *src_gw_name, *dst_gw_name;
+ char *key, *link_name, *src_name, *dst_name, *src_gw_name, *dst_gw_name;
const char* sep = "#";
- network_element_t src_id, dst_id, src_gw_id, dst_gw_id, ne;
+ network_element_t src_id, dst_id, ne;
route_extended_t new_e_route;
- int i, j, cpt;
+ unsigned int i, j, cpt;
routing_component_t component;
xbt_dynar_t links;
xbt_dict_cursor_t cursor = NULL;
routing_component_floyd_t routing = ((routing_component_floyd_t)current_routing);
const char *sep = "#";
- char *key, *key_gw, *end, *link_name, *keyX, *keyY;
+ char *key, *key_gw, *link_name, *keyX, *keyY;
char *src_name, *dst_name, *src_gw_name, *dst_gw_name;
double * cost_table;
unsigned int i,j;
void *data = NULL;
void *link = NULL;
e_surf_network_element_type_t *type_gw;
- network_element_t ne, ne_gw, new_ne, src_ne, dst_ne, src_gw_ne, dst_gw_ne, neX, neY;
+ network_element_t ne, new_ne, src_ne, dst_ne, src_gw_ne, dst_gw_ne, neX, neY;
xbt_dict_cursor_t cursor=NULL, cursor_gw=NULL, cursorX=NULL, cursorY=NULL;
xbt_dynar_t links, keys;
routing_component_t component;
/* Creation routing model functions */
static void* model_dijkstra_create() {
+ return NULL;
}
static void model_dijkstra_load() {
}
static void* model_dijkstracache_create() {
+ return NULL;
}
static void model_dijkstracache_load() {
/* The minimal configuration of a new routing model need the next functions,
* also you need to set at the start of the file, the new model in the model
* list. Remember keep the null ending of the list.
-
+ */
/* Routing model structure */
typedef struct {
s_routing_component_t generic_routing;
static void NEW_parse_S_host(void) {} /* example*/
/* Business methods */
-static route_extended_t NEW_get_route(routing_component_t rc, const char* src,const char* dst) {} /* mandatory */
+static route_extended_t NEW_get_route(routing_component_t rc, const char* src,const char* dst) {return NULL;} /* mandatory */
static void NEW_finalize(routing_component_t rc) {} /* mandatory */
/* Creation routing model functions */
-static void* model_NEW_create() {} /* mandatory */
+static void* model_NEW_create() {return NULL;} /* mandatory */
static void model_NEW_load() {} /* mandatory */
static void model_NEW_unload() {} /* mandatory */
static void model_NEW_end() {} /* mandatory */
// char* names[] = { "142.A","142.B","142.C", "11.A","11.B","11.C","141.A","141.B","143.A","143.B","11.A","11.B","11.C","121.A","121.B","122.A","13.A","13.B"};
// int i,j,total = 3+4+8+3;
- char* names[] = { "11.A","11.B","11.C",
- "121.A","121.B",
- "122.A",
- "13.A","13.B",
- "141.A","141.B",
- "142.A","142.B","142.C",
- "143.A","143.B",
- "15.A","15.B","15.C"};
- int i,j,total = 3+2+1+2+2+3+2+3;
+ const char* names[] = { "11.A","11.B","11.C",
+ "121.A","121.B",
+ "122.A",
+ "13.A","13.B",
+ "141.A","141.B",
+ "142.A","142.B","142.C",
+ "143.A","143.B",
+ "15.A","15.B","15.C"};
+ unsigned int i,j,total = 3+2+1+2+2+3+2+3;
printf("-- print all the example routes --\n");
xbt_dynar_t links;
for(j=0;j<total;j++) {
links = (*(global_routing->get_route))(names[i],names[j]);
printf("route from %s to %s >>> ",names[i],names[j]);
- int cpt=0;
+ unsigned int cpt=0;
xbt_dynar_foreach(links, cpt, link) {
s_surf_resource_t* generic_resource = link;
printf(" %s",generic_resource->name);
xbt_dynar_t ETag_surfxml_trace_c_connect_cb_list = NULL;
xbt_dynar_t STag_surfxml_random_cb_list = NULL;
xbt_dynar_t ETag_surfxml_random_cb_list = NULL;
+xbt_dynar_t STag_surfxml_AS_cb_list = NULL; // addded by david
+xbt_dynar_t ETag_surfxml_AS_cb_list = NULL; // addded by david
+xbt_dynar_t STag_surfxml_gateway_cb_list = NULL; // addded by david
+xbt_dynar_t ETag_surfxml_gateway_cb_list = NULL; // addded by david
/* Stores the sets defined in the XML */
xbt_dict_t set_list = NULL;
xbt_dynar_free(&ETag_surfxml_trace_c_connect_cb_list);
xbt_dynar_free(&STag_surfxml_random_cb_list);
xbt_dynar_free(&ETag_surfxml_random_cb_list);
+ xbt_dynar_free(&STag_surfxml_AS_cb_list); // addded by david
+ xbt_dynar_free(&ETag_surfxml_AS_cb_list); // addded by david
+ xbt_dynar_free(&STag_surfxml_gateway_cb_list); // addded by david
+ xbt_dynar_free(&ETag_surfxml_gateway_cb_list); // addded by david
}
void surf_parse_reset_parser(void)
xbt_dynar_new(sizeof(void_f_void_t), NULL);
STag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
ETag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+ STag_surfxml_AS_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); // addded by david
+ ETag_surfxml_AS_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); // addded by david
+ STag_surfxml_gateway_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); // addded by david
+ ETag_surfxml_gateway_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); // addded by david
}
void STag_surfxml_include(void)
surfxml_call_cb_functions(ETag_surfxml_random_cb_list);
}
+void STag_surfxml_AS(void) // addded by david
+{
+ surfxml_call_cb_functions(STag_surfxml_AS_cb_list);
+}
+
+void ETag_surfxml_AS(void) // addded by david
+{
+ surfxml_call_cb_functions(ETag_surfxml_AS_cb_list);
+}
+
+void STag_surfxml_gateway(void) // addded by david
+{
+ surfxml_call_cb_functions(STag_surfxml_gateway_cb_list);
+}
+
+void ETag_surfxml_gateway(void) // addded by david
+{
+ surfxml_call_cb_functions(ETag_surfxml_gateway_cb_list);
+}
+
void surf_parse_open(const char *file)
{
static int warned = 0; /* warn only once */
xbt_dynar_push(cb_list, &function);
}
+void surfxml_del_callback(xbt_dynar_t* p_cb_list, void_f_void_t function)
+{
+ xbt_dynar_t new_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+ unsigned int it;
+ void_f_void_t func;
+ xbt_dynar_foreach(*p_cb_list,it,func) {
+ if( func != function )
+ xbt_dynar_push(new_cb_list, &func);
+ }
+ xbt_dynar_free(p_cb_list);
+ *p_cb_list = new_cb_list;
+}
+
static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list)
{
unsigned int iterator;
void surf_route_set_resource(char *source_id,char *destination_id,xbt_dynar_t links_id,int action)
{
route_link_list = xbt_dynar_new(sizeof(char *), NULL);
- routing_add_route(source_id,destination_id,links_id,action);
+ //routing_add_route(source_id,destination_id,links_id,action); // COMMENTED BY DAVID
}
*/
void surf_route_add_host(char *host_id)
{
- routing_add_host(host_id);
+ //routing_add_host(host_id); // COMMENTED BY DAVID
}
/*
*/
void surf_set_routes(void)
{
- routing_set_routes();
+ //routing_set_routes(); // COMMENTED BY DAVID
}