new_pajeEndLink(SIMIX_get_clock(), father, link_type, dst, "G", key);
}
-static void recursiveGraphExtraction (routing_component_t rc, container_t container, xbt_dict_t filter)
+static void recursiveGraphExtraction (AS_t rc, container_t container, xbt_dict_t filter)
{
if (xbt_dict_length (rc->routing_sons)){
xbt_dict_cursor_t cursor = NULL;
- routing_component_t rc_son;
+ AS_t rc_son;
char *child_name;
//bottom-up recursion
xbt_dict_foreach(rc->routing_sons, cursor, child_name, rc_son) {
}
static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges,
- routing_component_t rc, container_t container)
+ AS_t rc, container_t container)
{
if (xbt_dict_length (rc->routing_sons)){
xbt_dict_cursor_t cursor = NULL;
- routing_component_t rc_son;
+ AS_t rc_son;
char *child_name;
//bottom-up recursion
xbt_dict_foreach(rc->routing_sons, cursor, child_name, rc_son) {
xbt_dynar_free(&host_list);
}
-static void create_hierarchy(routing_component_t current_comp,
+static void create_hierarchy(AS_t current_comp,
jed_simgrid_container_t current_container) {
xbt_dict_cursor_t cursor = NULL;
char *key;
- routing_component_t elem;
+ AS_t elem;
network_element_t network_elem;
if( xbt_dict_length(current_comp->routing_sons) == 0 ) {
void jedule_setup_platform() {
- routing_component_t root_comp;
+ AS_t root_comp;
// e_surf_network_element_type_t type;
jed_simgrid_container_t root_container;
/**
* Routing logic
*/
-typedef struct s_routing_component *routing_component_t;
+typedef struct s_as *AS_t;
typedef struct s_model_type {
const char *name;
const char *desc;
- routing_component_t (*create) ();
+ AS_t (*create) ();
void (*end) ();
} s_routing_model_description_t, *routing_model_description_t;
SURF_ROUTING_RECURSIVE /**< Recursive case: also return gateway informations */
} e_surf_routing_hierarchy_t;
-typedef struct s_routing_component {
+typedef struct s_as {
xbt_dict_t to_index; /* char* -> network_element_t */
xbt_dict_t bypassRoutes; /* store bypass routes */
routing_model_description_t routing;
e_surf_routing_hierarchy_t hierarchy;
char *name;
- struct s_routing_component *routing_father;
+ struct s_as *routing_father;
xbt_dict_t routing_sons;
- route_extended_t(*get_route) (routing_component_t rc, const char *src,
+ route_extended_t(*get_route) (AS_t as, const char *src,
const char *dst);
- double(*get_latency) (routing_component_t rc, const char *src,
+ double(*get_latency) (AS_t as, const char *src,
const char *dst, route_extended_t e_route);
- xbt_dynar_t(*get_onelink_routes) (routing_component_t rc);
+ xbt_dynar_t(*get_onelink_routes) (AS_t as);
e_surf_network_element_type_t(*get_network_element_type) (const char *name);
- route_extended_t(*get_bypass_route) (routing_component_t rc,
+ route_extended_t(*get_bypass_route) (AS_t as,
const char *src, const char *dst);
- void (*finalize) (routing_component_t rc);
+ void (*finalize) (AS_t as);
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
- void (*parse_PU) (routing_component_t rc, const char *name); /* A host or a router, whatever */
- void (*parse_AS) (routing_component_t rc, const char *name);
- void (*parse_route) (routing_component_t rc, const char *src,
+ void (*parse_PU) (AS_t as, const char *name); /* A host or a router, whatever */
+ void (*parse_AS) (AS_t as, const char *name);
+ void (*parse_route) (AS_t as, const char *src,
const char *dst, route_extended_t route);
- void (*parse_ASroute) (routing_component_t rc, const char *src,
+ void (*parse_ASroute) (AS_t as, const char *src,
const char *dst, route_extended_t route);
- void (*parse_bypassroute) (routing_component_t rc, const char *src,
+ void (*parse_bypassroute) (AS_t as, const char *src,
const char *dst, route_extended_t e_route);
-} s_routing_component_t;
+} s_as_t;
typedef struct s_network_element_info {
- routing_component_t rc_component;
+ AS_t rc_component;
e_surf_network_element_type_t rc_type;
} s_network_element_info_t, *network_element_info_t;
typedef int *network_element_t;
struct s_routing_global {
- routing_component_t root;
+ AS_t root;
void *loopback;
size_t size_of_link;
xbt_dynar_t(*get_route) (const char *src, const char *dst);
/* Global vars */
routing_global_t global_routing = NULL;
-routing_component_t current_routing = NULL;
+AS_t current_routing = NULL;
routing_model_description_t current_routing_model = NULL;
/* global parse functions */
*/
void routing_AS_begin(const char *AS_id, const char *wanted_routing_type)
{
- routing_component_t new_routing;
+ AS_t new_routing;
routing_model_description_t model = NULL;
int cpt;
}
/* make a new routing component */
- new_routing = (routing_component_t) (*(model->create)) ();
+ new_routing = (AS_t) (*(model->create)) ();
new_routing->routing = model;
new_routing->hierarchy = SURF_ROUTING_NULL;
new_routing->name = xbt_strdup(AS_id);
* father in the chain
*/
static void elements_father(const char *src, const char *dst,
- routing_component_t * res_father,
- routing_component_t * res_src,
- routing_component_t * res_dst)
+ AS_t * res_father,
+ AS_t * res_src,
+ AS_t * res_dst)
{
xbt_assert(src && dst, "bad parameters for \"elements_father\" method");
#define ELEMENTS_FATHER_MAXDEPTH 16 /* increase if it is not enough */
- routing_component_t src_as, dst_as;
- routing_component_t path_src[ELEMENTS_FATHER_MAXDEPTH];
- routing_component_t path_dst[ELEMENTS_FATHER_MAXDEPTH];
+ AS_t src_as, dst_as;
+ AS_t path_src[ELEMENTS_FATHER_MAXDEPTH];
+ AS_t path_dst[ELEMENTS_FATHER_MAXDEPTH];
int index_src = 0;
int index_dst = 0;
- routing_component_t current;
- routing_component_t current_src;
- routing_component_t current_dst;
- routing_component_t father;
+ AS_t current;
+ AS_t current_src;
+ AS_t current_dst;
+ AS_t father;
/* (1) find the as where the src and dst are located */
network_element_info_t src_data = xbt_lib_get_or_null(host_lib, src,
XBT_DEBUG("Solve route/latency \"%s\" to \"%s\"", src, dst);
xbt_assert(src && dst, "bad parameters for \"_get_route_latency\" method");
- routing_component_t common_father;
- routing_component_t src_father;
- routing_component_t dst_father;
+ AS_t common_father;
+ AS_t src_father;
+ AS_t dst_father;
elements_father(src, dst, &common_father, &src_father, &dst_father);
if (src_father == dst_father) { /* SURF_ROUTING_BASE */
* This fuction is call by "finalize". It allow to finalize the
* AS or routing components. It delete all the structures.
*/
-static void _finalize(routing_component_t rc)
+static void _finalize(AS_t rc)
{
if (rc) {
xbt_dict_cursor_t cursor = NULL;
char *key;
- routing_component_t elem;
+ AS_t elem;
xbt_dict_foreach(rc->routing_sons, cursor, key, elem) {
_finalize(elem);
}
xbt_free(global_routing);
}
-static xbt_dynar_t recursive_get_onelink_routes(routing_component_t rc)
+static xbt_dynar_t recursive_get_onelink_routes(AS_t rc)
{
xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
//recursing
char *key;
xbt_dict_cursor_t cursor = NULL;
- routing_component_t rc_child;
+ AS_t rc_child;
xbt_dict_foreach(rc->routing_sons, cursor, key, rc_child) {
xbt_dynar_t onelink_child = recursive_get_onelink_routes(rc_child);
if (onelink_child) {
static xbt_dict_t cluster_host_link = NULL; /* for tag cluster */
/* Business methods */
-static route_extended_t cluster_get_route(routing_component_t rc,
- const char *src,
- const char *dst) {
+static route_extended_t cluster_get_route(AS_t as,
+ const char *src,
+ const char *dst) {
xbt_dynar_t links_list = xbt_dynar_new(global_routing->size_of_link, NULL);
info = xbt_dict_get_or_null(cluster_host_link,src);
if(info) xbt_dynar_push_as(links_list,void*,info->link_up); //link_up
- info = xbt_dict_get_or_null(cluster_host_link,rc->name);
+ info = xbt_dict_get_or_null(cluster_host_link,as->name);
if(info) xbt_dynar_push_as(links_list,void*,info->link_up); //link_bb
info = xbt_dict_get_or_null(cluster_host_link,dst);
}
/* Creation routing model functions */
-routing_component_t model_cluster_create(void)
+AS_t model_cluster_create(void)
{
- routing_component_t new_component = model_none_create();
- new_component->get_route = cluster_get_route;
+ AS_t result = model_none_create();
+ result->get_route = cluster_get_route;
- return (routing_component_t) new_component;
+ return (AS_t) result;
}
void surf_routing_cluster_add_link(const char* host_id,surf_parsing_link_up_down_t info) {
/* Global vars */
extern routing_global_t global_routing;
-extern routing_component_t current_routing;
+extern AS_t current_routing;
extern routing_model_description_t current_routing_model;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_dijkstra, surf, "Routing part of surf -- dijkstra routing logic");
typedef struct {
- s_routing_component_t generic_routing;
+ s_as_t generic_routing;
xbt_graph_t route_graph; /* xbt_graph */
xbt_dict_t graph_node_map; /* map */
xbt_dict_t route_cache; /* use in cache mode */
int cached;
-} s_routing_component_dijkstra_t, *routing_component_dijkstra_t;
+} s_as_dijkstra_t, *as_dijkstra_t;
typedef struct graph_node_data {
/* Utility functions */
-static xbt_node_t route_graph_new_node(routing_component_dijkstra_t rc,
+static xbt_node_t route_graph_new_node(as_dijkstra_t as,
int id, int graph_id)
{
- routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
xbt_node_t node = NULL;
graph_node_data_t data = NULL;
graph_node_map_element_t elm = NULL;
data = xbt_new0(struct graph_node_data, 1);
data->id = id;
data->graph_id = graph_id;
- node = xbt_graph_new_node(routing->route_graph, data);
+ node = xbt_graph_new_node(as->route_graph, data);
elm = xbt_new0(struct graph_node_map_element, 1);
elm->node = node;
- xbt_dict_set_ext(routing->graph_node_map, (char *) (&id), sizeof(int),
+ xbt_dict_set_ext(as->graph_node_map, (char *) (&id), sizeof(int),
(xbt_set_elm_t) elm, &graph_node_map_elem_free);
return node;
}
static graph_node_map_element_t
-graph_node_map_search(routing_component_dijkstra_t rc, int id)
+graph_node_map_search(as_dijkstra_t as, int id)
{
- routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
graph_node_map_element_t elm = (graph_node_map_element_t)
- xbt_dict_get_or_null_ext(routing->graph_node_map,
+ xbt_dict_get_or_null_ext(as->graph_node_map,
(char *) (&id),
sizeof(int));
return elm;
/* Parsing */
-static void route_new_dijkstra(routing_component_dijkstra_t rc, int src_id,
+static void route_new_dijkstra(as_dijkstra_t as, int src_id,
int dst_id, route_extended_t e_route)
{
- routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
XBT_DEBUG("Load Route from \"%d\" to \"%d\"", src_id, dst_id);
xbt_node_t src = NULL;
xbt_node_t dst = NULL;
graph_node_map_element_t src_elm = (graph_node_map_element_t)
- xbt_dict_get_or_null_ext(routing->graph_node_map,
+ xbt_dict_get_or_null_ext(as->graph_node_map,
(char *) (&src_id),
sizeof(int));
graph_node_map_element_t dst_elm = (graph_node_map_element_t)
- xbt_dict_get_or_null_ext(routing->graph_node_map,
+ xbt_dict_get_or_null_ext(as->graph_node_map,
(char *) (&dst_id),
sizeof(int));
/* add nodes if they don't exist in the graph */
if (src_id == dst_id && src == NULL && dst == NULL) {
- src = route_graph_new_node(rc, src_id, -1);
+ src = route_graph_new_node(as, src_id, -1);
dst = src;
} else {
if (src == NULL) {
- src = route_graph_new_node(rc, src_id, -1);
+ src = route_graph_new_node(as, src_id, -1);
}
if (dst == NULL) {
- dst = route_graph_new_node(rc, dst_id, -1);
+ dst = route_graph_new_node(as, dst_id, -1);
}
}
/* add link as edge to graph */
- xbt_graph_new_edge(routing->route_graph, src, dst, e_route);
+ xbt_graph_new_edge(as->route_graph, src, dst, e_route);
}
-static void add_loopback_dijkstra(routing_component_dijkstra_t rc)
-{
- routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
-
- xbt_dynar_t nodes = xbt_graph_get_nodes(routing->route_graph);
+static void add_loopback_dijkstra(as_dijkstra_t as) {
+ xbt_dynar_t nodes = xbt_graph_get_nodes(as->route_graph);
xbt_node_t node = NULL;
unsigned int cursor2;
xbt_dynar_new(global_routing->size_of_link, NULL);
xbt_dynar_push(e_route->generic_route.link_list,
&global_routing->loopback);
- xbt_graph_new_edge(routing->route_graph, node, node, e_route);
+ xbt_graph_new_edge(as->route_graph, node, node, e_route);
}
}
}
-static route_extended_t dijkstra_get_route(routing_component_t rc,
+static route_extended_t dijkstra_get_route(AS_t as_generic,
const char *src,
const char *dst);
-static xbt_dynar_t dijkstra_get_onelink_routes(routing_component_t rc)
+static xbt_dynar_t dijkstra_get_onelink_routes(AS_t as)
{
// xbt_die("\"dijkstra_get_onelink_routes\" function not implemented yet");
xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
- routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
//size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
xbt_dict_cursor_t c1 = NULL, c2 = NULL;
char *k1, *d1, *k2, *d2;
- xbt_dict_foreach(routing->generic_routing.to_index, c1, k1, d1) {
- xbt_dict_foreach(routing->generic_routing.to_index, c2, k2, d2) {
- route_extended_t route = dijkstra_get_route(rc, k1, k2);
+ xbt_dict_foreach(as->to_index, c1, k1, d1) {
+ xbt_dict_foreach(as->to_index, c2, k2, d2) {
+ route_extended_t route = dijkstra_get_route(as, k1, k2);
if (route) {
if (xbt_dynar_length(route->generic_route.link_list) == 1) {
void *link =
0);
onelink_t onelink = xbt_new0(s_onelink_t, 1);
onelink->link_ptr = link;
- if (routing->generic_routing.hierarchy == SURF_ROUTING_BASE) {
+ if (as->hierarchy == SURF_ROUTING_BASE) {
onelink->src = xbt_strdup(k1);
onelink->dst = xbt_strdup(k2);
- } else if (routing->generic_routing.hierarchy ==
+ } else if (as->hierarchy ==
SURF_ROUTING_RECURSIVE) {
onelink->src = xbt_strdup(route->src_gateway);
onelink->dst = xbt_strdup(route->dst_gateway);
return ret;
}
-static route_extended_t dijkstra_get_route(routing_component_t rc,
+static route_extended_t dijkstra_get_route(AS_t asg,
const char *src,
const char *dst)
{
- xbt_assert(rc && src
+ xbt_assert(asg && src
&& dst,
"Invalid params for \"get_route\" function at AS \"%s\"",
- rc->name);
+ asg->name);
/* set utils vars */
- routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
+ as_dijkstra_t as = (as_dijkstra_t) asg;
- generic_src_dst_check(rc, src, dst);
- int *src_id = xbt_dict_get_or_null(routing->generic_routing.to_index, src);
- int *dst_id = xbt_dict_get_or_null(routing->generic_routing.to_index, dst);
+ generic_src_dst_check(asg, src, dst);
+ int *src_id = xbt_dict_get_or_null(asg->to_index, src);
+ int *dst_id = xbt_dict_get_or_null(asg->to_index, dst);
xbt_assert(src_id
&& dst_id,
"Ask for route \"from\"(%s) or \"to\"(%s) no found in the local table",
void *link;
xbt_dynar_t links = NULL;
route_cache_element_t elm = NULL;
- xbt_dynar_t nodes = xbt_graph_get_nodes(routing->route_graph);
+ xbt_dynar_t nodes = xbt_graph_get_nodes(as->route_graph);
/* Use the graph_node id mapping set to quickly find the nodes */
graph_node_map_element_t src_elm =
- graph_node_map_search(routing, *src_id);
+ graph_node_map_search(as, *src_id);
graph_node_map_element_t dst_elm =
- graph_node_map_search(routing, *dst_id);
+ graph_node_map_search(as, *dst_id);
xbt_assert(src_elm != NULL
&& dst_elm != NULL, "src %d or dst %d does not exist",
*src_id, *dst_id);
xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src_node_id, xbt_node_t);
xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst_node_id, xbt_node_t);
xbt_edge_t edge =
- xbt_graph_get_edge(routing->route_graph, node_s_v, node_e_v);
+ xbt_graph_get_edge(as->route_graph, node_s_v, node_e_v);
xbt_assert(edge != NULL, "no route between host %d and %d", *src_id,
*dst_id);
return new_e_route;
}
- if (routing->cached) {
+ if (as->cached) {
/*check if there is a cached predecessor list avail */
elm = (route_cache_element_t)
- xbt_dict_get_or_null_ext(routing->route_cache, (char *) (&src_id),
+ xbt_dict_get_or_null_ext(as->route_cache, (char *) (&src_id),
sizeof(int));
}
xbt_dynar_get_as(nodes, pred_arr[v], xbt_node_t);
xbt_node_t node_v = xbt_dynar_get_as(nodes, v, xbt_node_t);
xbt_edge_t edge =
- xbt_graph_get_edge(routing->route_graph, node_pred_v, node_v);
+ xbt_graph_get_edge(as->route_graph, node_pred_v, node_v);
xbt_assert(edge != NULL, "no route between host %d and %d", *src_id,
*dst_id);
if (v == dst_node_id)
first_gw = gw_dst;
- if (rc->hierarchy == SURF_ROUTING_RECURSIVE && v != dst_node_id
+ if (asg->hierarchy == SURF_ROUTING_RECURSIVE && v != dst_node_id
&& strcmp(gw_dst, prev_gw_src)) {
xbt_dynar_t e_route_as_to_as =
(*(global_routing->get_route)) (gw_dst, prev_gw_src);
size++;
}
- if (rc->hierarchy == SURF_ROUTING_RECURSIVE) {
+ if (asg->hierarchy == SURF_ROUTING_RECURSIVE) {
new_e_route->src_gateway = xbt_strdup(gw_src);
new_e_route->dst_gateway = xbt_strdup(first_gw);
}
- if (routing->cached && elm == NULL) {
+ if (as->cached && elm == NULL) {
/* add to predecessor list of the current src-host to cache */
elm = xbt_new0(struct route_cache_element, 1);
elm->pred_arr = pred_arr;
elm->size = size;
- xbt_dict_set_ext(routing->route_cache, (char *) (&src_id), sizeof(int),
+ xbt_dict_set_ext(as->route_cache, (char *) (&src_id), sizeof(int),
(xbt_set_elm_t) elm, &route_cache_elem_free);
}
- if (!routing->cached)
+ if (!as->cached)
xbt_free(pred_arr);
return new_e_route;
}
-static void dijkstra_finalize(routing_component_t rc)
+static void dijkstra_finalize(AS_t asg)
{
- routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
+ as_dijkstra_t as = (as_dijkstra_t) asg;
- if (routing) {
- xbt_graph_free_graph(routing->route_graph, &xbt_free,
+ if (as) {
+ xbt_graph_free_graph(as->route_graph, &xbt_free,
&graph_edge_data_free, &xbt_free);
- xbt_dict_free(&routing->graph_node_map);
- if (routing->cached)
- xbt_dict_free(&routing->route_cache);
+ xbt_dict_free(&as->graph_node_map);
+ if (as->cached)
+ xbt_dict_free(&as->route_cache);
/* Delete bypass dict */
- xbt_dict_free(&routing->generic_routing.bypassRoutes);
+ xbt_dict_free(&as->generic_routing.bypassRoutes);
/* Delete index dict */
- xbt_dict_free(&(routing->generic_routing.to_index));
+ xbt_dict_free(&(as->generic_routing.to_index));
/* Delete structure */
- xbt_free(routing);
+ xbt_free(as);
}
}
/* Creation routing model functions */
-routing_component_t model_dijkstra_both_create(int cached)
+AS_t model_dijkstra_both_create(int cached)
{
- routing_component_dijkstra_t new_component = (routing_component_dijkstra_t)
- routmod_generic_create(sizeof(s_routing_component_dijkstra_t));
+ as_dijkstra_t new_component = (as_dijkstra_t)
+ routmod_generic_create(sizeof(s_as_dijkstra_t));
new_component->generic_routing.parse_route = model_dijkstra_both_parse_route;
new_component->generic_routing.parse_ASroute = model_dijkstra_both_parse_route;
new_component->generic_routing.finalize = dijkstra_finalize;
new_component->cached = cached;
- return (routing_component_t)new_component;
+ return (AS_t)new_component;
}
-routing_component_t model_dijkstra_create(void)
+AS_t model_dijkstra_create(void)
{
return model_dijkstra_both_create(0);
}
-routing_component_t model_dijkstracache_create(void)
+AS_t model_dijkstracache_create(void)
{
return model_dijkstra_both_create(1);
}
void model_dijkstra_both_end(void)
{
- routing_component_dijkstra_t routing =
- (routing_component_dijkstra_t) current_routing;
+ as_dijkstra_t routing =
+ (as_dijkstra_t) current_routing;
xbt_node_t node = NULL;
unsigned int cursor2;
}
}
-void model_dijkstra_both_parse_route (routing_component_t rc, const char *src,
+void model_dijkstra_both_parse_route (AS_t asg, const char *src,
const char *dst, route_extended_t route)
{
- routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
+ as_dijkstra_t as = (as_dijkstra_t) asg;
int *src_id, *dst_id;
- src_id = xbt_dict_get_or_null(rc->to_index, src);
- dst_id = xbt_dict_get_or_null(rc->to_index, dst);
+ src_id = xbt_dict_get_or_null(asg->to_index, src);
+ dst_id = xbt_dict_get_or_null(asg->to_index, dst);
xbt_assert(src_id, "Network elements %s not found", src);
xbt_assert(dst_id, "Network elements %s not found", dst);
/* Create the topology graph */
- if(!routing->route_graph)
- routing->route_graph = xbt_graph_new_graph(1, NULL);
- if(!routing->graph_node_map)
- routing->graph_node_map = xbt_dict_new();
+ if(!as->route_graph)
+ as->route_graph = xbt_graph_new_graph(1, NULL);
+ if(!as->graph_node_map)
+ as->graph_node_map = xbt_dict_new();
- if (routing->cached && !routing->route_cache)
- routing->route_cache = xbt_dict_new();
+ if (as->cached && !as->route_cache)
+ as->route_cache = xbt_dict_new();
if( A_surfxml_route_symmetrical == A_surfxml_route_symmetrical_YES
|| A_surfxml_ASroute_symmetrical == A_surfxml_ASroute_symmetrical_YES )
route_extended_t e_route =
generic_new_extended_route(current_routing->hierarchy, route, 1);
- route_new_dijkstra(routing, *src_id, *dst_id, e_route);
+ route_new_dijkstra(as, *src_id, *dst_id, e_route);
}
/* Global vars */
extern routing_global_t global_routing;
-extern routing_component_t current_routing;
+extern AS_t current_routing;
extern routing_model_description_t current_routing_model;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf");
-#define TO_FLOYD_COST(i,j) (routing->cost_table)[(i)+(j)*table_size]
-#define TO_FLOYD_PRED(i,j) (routing->predecessor_table)[(i)+(j)*table_size]
-#define TO_FLOYD_LINK(i,j) (routing->link_table)[(i)+(j)*table_size]
+#define TO_FLOYD_COST(i,j) (as->cost_table)[(i)+(j)*table_size]
+#define TO_FLOYD_PRED(i,j) (as->predecessor_table)[(i)+(j)*table_size]
+#define TO_FLOYD_LINK(i,j) (as->link_table)[(i)+(j)*table_size]
/* Routing model structure */
typedef struct {
- s_routing_component_t generic_routing;
+ s_as_t generic_routing;
/* vars for calculate the floyd algorith. */
int *predecessor_table;
double *cost_table;
- route_extended_t *link_table; /* char* -> int* */
-} s_routing_component_floyd_t, *routing_component_floyd_t;
+ route_extended_t *link_table;
+} s_as_floyd_t, *as_floyd_t;
-static route_extended_t floyd_get_route(routing_component_t rc,
+static route_extended_t floyd_get_route(AS_t asg,
const char *src, const char *dst);
/* Business methods */
-static xbt_dynar_t floyd_get_onelink_routes(routing_component_t rc)
+static xbt_dynar_t floyd_get_onelink_routes(AS_t asg)
{
xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
- routing_component_floyd_t routing = (routing_component_floyd_t) rc;
- //size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
xbt_dict_cursor_t c1 = NULL, c2 = NULL;
char *k1, *d1, *k2, *d2;
- xbt_dict_foreach(routing->generic_routing.to_index, c1, k1, d1) {
- xbt_dict_foreach(routing->generic_routing.to_index, c2, k2, d2) {
- route_extended_t route = floyd_get_route(rc, k1, k2);
+ xbt_dict_foreach(asg->to_index, c1, k1, d1) {
+ xbt_dict_foreach(asg->to_index, c2, k2, d2) {
+ route_extended_t route = floyd_get_route(asg, k1, k2);
if (route) {
if (xbt_dynar_length(route->generic_route.link_list) == 1) {
void *link =
0);
onelink_t onelink = xbt_new0(s_onelink_t, 1);
onelink->link_ptr = link;
- if (routing->generic_routing.hierarchy == SURF_ROUTING_BASE) {
+ if (asg->hierarchy == SURF_ROUTING_BASE) {
onelink->src = xbt_strdup(k1);
onelink->dst = xbt_strdup(k2);
- } else if (routing->generic_routing.hierarchy ==
- SURF_ROUTING_RECURSIVE) {
+ } else if (asg->hierarchy == SURF_ROUTING_RECURSIVE) {
onelink->src = xbt_strdup(route->src_gateway);
onelink->dst = xbt_strdup(route->dst_gateway);
}
return ret;
}
-static route_extended_t floyd_get_route(routing_component_t rc,
+static route_extended_t floyd_get_route(AS_t asg,
const char *src, const char *dst)
{
- xbt_assert(rc && src
+ xbt_assert(asg && src
&& dst,
"Invalid params for \"get_route\" function at AS \"%s\"",
- rc->name);
+ asg->name);
/* set utils vars */
- routing_component_floyd_t routing = (routing_component_floyd_t) rc;
- size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
+ as_floyd_t as = (as_floyd_t)asg;
+ size_t table_size = xbt_dict_length(asg->to_index);
- generic_src_dst_check(rc, src, dst);
- int *src_id = xbt_dict_get_or_null(routing->generic_routing.to_index, src);
- int *dst_id = xbt_dict_get_or_null(routing->generic_routing.to_index, dst);
+ generic_src_dst_check(asg, src, dst);
+ int *src_id = xbt_dict_get_or_null(asg->to_index, src);
+ int *dst_id = xbt_dict_get_or_null(asg->to_index, dst);
xbt_assert(src_id
&& dst_id,
"Ask for route \"from\"(%s) or \"to\"(%s) no found in the local table",
if (first)
first_gw = gw_dst;
- if (rc->hierarchy == SURF_ROUTING_RECURSIVE && !first
+ if (asg->hierarchy == SURF_ROUTING_RECURSIVE && !first
&& strcmp(gw_dst, prev_gw_src)) {
xbt_dynar_t e_route_as_to_as =
(*(global_routing->get_route)) (gw_dst, prev_gw_src);
xbt_assert(pred != -1, "no route from host %d to %d (\"%s\" to \"%s\")",
*src_id, *dst_id, src, dst);
- if (rc->hierarchy == SURF_ROUTING_RECURSIVE) {
+ if (asg->hierarchy == SURF_ROUTING_RECURSIVE) {
new_e_route->src_gateway = xbt_strdup(gw_src);
new_e_route->dst_gateway = xbt_strdup(first_gw);
}
return new_e_route;
}
-static void floyd_finalize(routing_component_t rc)
+static void floyd_finalize(AS_t rc)
{
- routing_component_floyd_t routing = (routing_component_floyd_t) rc;
+ as_floyd_t as = (as_floyd_t) rc;
int i, j;
size_t table_size;
- if (routing) {
- table_size = xbt_dict_length(routing->generic_routing.to_index);
+ if (as) {
+ table_size = xbt_dict_length(as->generic_routing.to_index);
/* Delete link_table */
for (i = 0; i < table_size; i++)
for (j = 0; j < table_size; j++)
generic_free_extended_route(TO_FLOYD_LINK(i, j));
- xbt_free(routing->link_table);
+ xbt_free(as->link_table);
/* Delete bypass dict */
- xbt_dict_free(&routing->generic_routing.bypassRoutes);
+ xbt_dict_free(&as->generic_routing.bypassRoutes);
/* Delete index dict */
- xbt_dict_free(&(routing->generic_routing.to_index));
+ xbt_dict_free(&(as->generic_routing.to_index));
/* Delete dictionary index dict, predecessor and links table */
- xbt_free(routing->predecessor_table);
+ xbt_free(as->predecessor_table);
/* Delete structure */
xbt_free(rc);
}
}
-routing_component_t model_floyd_create(void)
+AS_t model_floyd_create(void)
{
- routing_component_floyd_t new_component = (routing_component_floyd_t)routmod_generic_create(sizeof(s_routing_component_floyd_t));
+ as_floyd_t new_component = (as_floyd_t)routmod_generic_create(sizeof(s_as_floyd_t));
new_component->generic_routing.parse_route = model_floyd_parse_route;
new_component->generic_routing.parse_ASroute = model_floyd_parse_route;
new_component->generic_routing.get_route = floyd_get_route;
new_component->generic_routing.get_onelink_routes =
floyd_get_onelink_routes;
new_component->generic_routing.finalize = floyd_finalize;
- return (routing_component_t)new_component;
+ return (AS_t)new_component;
}
void model_floyd_end(void)
{
- routing_component_floyd_t routing =
- ((routing_component_floyd_t) current_routing);
+ as_floyd_t as =
+ ((as_floyd_t) current_routing);
unsigned int i, j, a, b, c;
/* set the size of table routing */
- size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
+ size_t table_size = xbt_dict_length(as->generic_routing.to_index);
- if(!routing->link_table)
+ if(!as->link_table)
{
/* Create Cost, Predecessor and Link tables */
- routing->cost_table = xbt_new0(double, table_size * table_size); /* link cost from host to host */
- routing->predecessor_table = xbt_new0(int, table_size * table_size); /* predecessor host numbers */
- routing->link_table = xbt_new0(route_extended_t, table_size * table_size); /* actual link between src and dst */
+ as->cost_table = xbt_new0(double, table_size * table_size); /* link cost from host to host */
+ as->predecessor_table = xbt_new0(int, table_size * table_size); /* predecessor host numbers */
+ as->link_table = xbt_new0(route_extended_t, table_size * table_size); /* actual link between src and dst */
/* Initialize costs and predecessors */
for (i = 0; i < table_size; i++)
//FIXME: kill dupplicates in next function with full routing
-void model_floyd_parse_route(routing_component_t rc, const char *src,
+void model_floyd_parse_route(AS_t rc, const char *src,
const char *dst, route_extended_t route)
{
- routing_component_floyd_t routing = (routing_component_floyd_t) rc;
+ as_floyd_t as = (as_floyd_t) rc;
/* set the size of table routing */
size_t table_size = xbt_dict_length(rc->to_index);
xbt_assert(src_id, "Network elements %s not found", src);
xbt_assert(dst_id, "Network elements %s not found", dst);
- if(!routing->link_table)
+ if(!as->link_table)
{
/* Create Cost, Predecessor and Link tables */
- routing->cost_table = xbt_new0(double, table_size * table_size); /* link cost from host to host */
- routing->predecessor_table = xbt_new0(int, table_size * table_size); /* predecessor host numbers */
- routing->link_table = xbt_new0(route_extended_t, table_size * table_size); /* actual link between src and dst */
+ as->cost_table = xbt_new0(double, table_size * table_size); /* link cost from host to host */
+ as->predecessor_table = xbt_new0(int, table_size * table_size); /* predecessor host numbers */
+ as->link_table = xbt_new0(route_extended_t, table_size * table_size); /* actual link between src and dst */
/* Initialize costs and predecessors */
for (i = 0; i < table_size; i++)
/* Global vars */
extern routing_global_t global_routing;
-extern routing_component_t current_routing;
+extern AS_t current_routing;
extern routing_model_description_t current_routing_model;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
/* Routing model structure */
typedef struct s_routing_component_full {
- s_routing_component_t generic_routing;
+ s_as_t generic_routing;
route_extended_t *routing_table;
} s_routing_component_full_t, *routing_component_full_t;
/* Business methods */
-static xbt_dynar_t full_get_onelink_routes(routing_component_t rc)
+static xbt_dynar_t full_get_onelink_routes(AS_t rc)
{
xbt_dynar_t ret = xbt_dynar_new(sizeof(onelink_t), xbt_free);
return ret;
}
-static route_extended_t full_get_route(routing_component_t rc,
+static route_extended_t full_get_route(AS_t rc,
const char *src, const char *dst)
{
xbt_assert(rc && src
return new_e_route;
}
-static void full_finalize(routing_component_t rc)
+static void full_finalize(AS_t rc)
{
routing_component_full_t routing = (routing_component_full_t) rc;
size_t table_size = xbt_dict_length(routing->generic_routing.to_index);
/* Creation routing model functions */
-routing_component_t model_full_create(void)
+AS_t model_full_create(void)
{
routing_component_full_t new_component = (routing_component_full_t)
routmod_generic_create(sizeof(s_routing_component_full_t));
full_get_onelink_routes;
new_component->generic_routing.finalize = full_finalize;
- return (routing_component_t) new_component;
+ return (AS_t) new_component;
}
void model_full_end(void)
return a != b;
}
-void model_full_set_route(routing_component_t rc, const char *src,
+void model_full_set_route(AS_t rc, const char *src,
const char *dst, route_extended_t route)
{
int *src_id, *dst_id;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
-extern routing_component_t current_routing;
+extern AS_t current_routing;
-routing_component_t routmod_generic_create(size_t childsize) {
- routing_component_t new_component = xbt_malloc0(childsize);
+AS_t routmod_generic_create(size_t childsize) {
+ AS_t new_component = xbt_malloc0(childsize);
new_component->parse_PU = generic_parse_PU;
new_component->parse_AS = generic_parse_AS;
}
-void generic_parse_PU(routing_component_t rc, const char *name)
+void generic_parse_PU(AS_t rc, const char *name)
{
XBT_DEBUG("Load process unit \"%s\"", name);
int *id = xbt_new0(int, 1);
xbt_dict_set(_to_index, name, id, xbt_free);
}
-void generic_parse_AS(routing_component_t rc, const char *name)
+void generic_parse_AS(AS_t rc, const char *name)
{
XBT_DEBUG("Load Autonomous system \"%s\"", name);
int *id = xbt_new0(int, 1);
xbt_dict_set(_to_index, name, id, xbt_free);
}
-void generic_parse_bypassroute(routing_component_t rc,
+void generic_parse_bypassroute(AS_t rc,
const char *src, const char *dst,
route_extended_t e_route)
{
/* ************************************************************************** */
/* *********************** GENERIC BUSINESS METHODS ************************* */
-double generic_get_link_latency(routing_component_t rc,
+double generic_get_link_latency(AS_t rc,
const char *src, const char *dst,
route_extended_t route)
{
return latency;
}
-xbt_dynar_t generic_get_onelink_routes(routing_component_t rc)
+xbt_dynar_t generic_get_onelink_routes(AS_t rc)
{
xbt_die("\"generic_get_onelink_routes\" not implemented yet");
}
-route_extended_t generic_get_bypassroute(routing_component_t rc,
+route_extended_t generic_get_bypassroute(AS_t rc,
const char *src, const char *dst)
{
xbt_dict_t dict_bypassRoutes = rc->bypassRoutes;
- routing_component_t src_as, dst_as;
+ AS_t src_as, dst_as;
int index_src, index_dst;
xbt_dynar_t path_src = NULL;
xbt_dynar_t path_dst = NULL;
- routing_component_t current = NULL;
- routing_component_t *current_src = NULL;
- routing_component_t *current_dst = NULL;
+ AS_t current = NULL;
+ AS_t *current_src = NULL;
+ AS_t *current_dst = NULL;
/* (1) find the as where the src and dst are located */
void *src_data = xbt_lib_get_or_null(host_lib, src, ROUTING_HOST_LEVEL);
dst_as = ((network_element_info_t) dst_data)->rc_component;
/* (2) find the path to the root routing component */
- path_src = xbt_dynar_new(sizeof(routing_component_t), NULL);
+ path_src = xbt_dynar_new(sizeof(AS_t), NULL);
current = src_as;
while (current != NULL) {
xbt_dynar_push(path_src, ¤t);
current = current->routing_father;
}
- path_dst = xbt_dynar_new(sizeof(routing_component_t), NULL);
+ path_dst = xbt_dynar_new(sizeof(AS_t), NULL);
current = dst_as;
while (current != NULL) {
xbt_dynar_push(path_dst, ¤t);
for (i = 0; i < max; i++) {
if (i <= max_index_src && max <= max_index_dst) {
char *route_name = bprintf("%s#%s",
- (*(routing_component_t *)
+ (*(AS_t *)
(xbt_dynar_get_ptr(path_src, i)))->name,
- (*(routing_component_t *)
+ (*(AS_t *)
(xbt_dynar_get_ptr(path_dst, max)))->name);
e_route_bypass = xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
break;
if (max <= max_index_src && i <= max_index_dst) {
char *route_name = bprintf("%s#%s",
- (*(routing_component_t *)
+ (*(AS_t *)
(xbt_dynar_get_ptr(path_src, max)))->name,
- (*(routing_component_t *)
+ (*(AS_t *)
(xbt_dynar_get_ptr(path_dst, i)))->name);
e_route_bypass = xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
if (max <= max_index_src && max <= max_index_dst) {
char *route_name = bprintf("%s#%s",
- (*(routing_component_t *)
+ (*(AS_t *)
(xbt_dynar_get_ptr(path_src, max)))->name,
- (*(routing_component_t *)
+ (*(AS_t *)
(xbt_dynar_get_ptr(path_dst, max)))->name);
e_route_bypass = xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
}
}
-static routing_component_t generic_as_exist(routing_component_t find_from,
- routing_component_t to_find)
+static AS_t generic_as_exist(AS_t find_from,
+ AS_t to_find)
{
//return to_find; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
xbt_dict_cursor_t cursor = NULL;
char *key;
int found = 0;
- routing_component_t elem;
+ AS_t elem;
xbt_dict_foreach(find_from->routing_sons, cursor, key, elem) {
if (to_find == elem || generic_as_exist(elem, to_find)) {
found = 1;
return NULL;
}
-routing_component_t
-generic_autonomous_system_exist(routing_component_t rc, char *element)
+AS_t
+generic_autonomous_system_exist(AS_t rc, char *element)
{
//return rc; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
- routing_component_t element_as, result, elem;
+ AS_t element_as, result, elem;
xbt_dict_cursor_t cursor = NULL;
char *key;
element_as = ((network_element_info_t)
xbt_lib_get_or_null(as_router_lib, element,
ROUTING_ASR_LEVEL))->rc_component;
- result = ((routing_component_t) - 1);
+ result = ((AS_t) - 1);
if (element_as != rc)
result = generic_as_exist(rc, element_as);
return NULL;
}
-routing_component_t
-generic_processing_units_exist(routing_component_t rc, char *element)
+AS_t
+generic_processing_units_exist(AS_t rc, char *element)
{
- routing_component_t element_as;
+ AS_t element_as;
element_as = ((network_element_info_t)
xbt_lib_get_or_null(host_lib,
element, ROUTING_HOST_LEVEL))->rc_component;
return generic_as_exist(rc, element_as);
}
-void generic_src_dst_check(routing_component_t rc, const char *src,
+void generic_src_dst_check(AS_t rc, const char *src,
const char *dst)
{
xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
src, dst, rc->name);
- routing_component_t src_as =
+ AS_t src_as =
((network_element_info_t) src_data)->rc_component;
- routing_component_t dst_as =
+ AS_t dst_as =
((network_element_info_t) dst_data)->rc_component;
if (src_as != dst_as)
/* Global vars */
extern routing_global_t global_routing;
-extern routing_component_t current_routing;
+extern AS_t current_routing;
extern routing_model_description_t current_routing_model;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_none, surf, "Routing part of surf");
/* Routing model structure */
/* Business methods */
-static xbt_dynar_t none_get_onelink_routes(routing_component_t rc)
+static xbt_dynar_t none_get_onelink_routes(AS_t rc)
{
return NULL;
}
-static route_extended_t none_get_route(routing_component_t rc,
+static route_extended_t none_get_route(AS_t rc,
const char *src, const char *dst)
{
return NULL;
}
-static route_extended_t none_get_bypass_route(routing_component_t rc,
+static route_extended_t none_get_bypass_route(AS_t rc,
const char *src,
const char *dst)
{
return NULL;
}
-static void none_finalize(routing_component_t rc)
+static void none_finalize(AS_t rc)
{
xbt_free(rc);
}
-static void none_parse_PU(routing_component_t rc,
+static void none_parse_PU(AS_t rc,
const char *name)
{
}
-static void none_parse_AS(routing_component_t rc,
+static void none_parse_AS(AS_t rc,
const char *name)
{
}
/* Creation routing model functions */
-routing_component_t model_none_create(void)
+AS_t model_none_create(void)
{
- routing_component_t new_component = xbt_new(s_routing_component_t, 1);
+ AS_t new_component = xbt_new(s_as_t, 1);
new_component->parse_PU = none_parse_PU;
new_component->parse_AS = none_parse_AS;
new_component->parse_route = NULL;
/* ************************************************************************** */
/* ***************** GENERIC PARSE FUNCTIONS (declarations) ***************** */
-routing_component_t routmod_generic_create(size_t childsize);
+AS_t routmod_generic_create(size_t childsize);
-void generic_parse_PU(routing_component_t rc,
+void generic_parse_PU(AS_t rc,
const char *name);
-void generic_parse_AS(routing_component_t rc,
+void generic_parse_AS(AS_t rc,
const char *name);
-void generic_parse_bypassroute(routing_component_t rc,
+void generic_parse_bypassroute(AS_t rc,
const char *src, const char *dst,
route_extended_t e_route);
/* ************************************************************************** */
/* *************** GENERIC BUSINESS METHODS (declarations) ****************** */
-double generic_get_link_latency(routing_component_t rc, const char *src, const char *dst,
+double generic_get_link_latency(AS_t rc, const char *src, const char *dst,
route_extended_t e_route);
-xbt_dynar_t generic_get_onelink_routes(routing_component_t rc);
-route_extended_t generic_get_bypassroute(routing_component_t rc,
+xbt_dynar_t generic_get_onelink_routes(AS_t rc);
+route_extended_t generic_get_bypassroute(AS_t rc,
const char *src,
const char *dst);
void *data, int order);
void generic_free_route(route_t route);
void generic_free_extended_route(route_extended_t e_route);
-routing_component_t
-generic_autonomous_system_exist(routing_component_t rc, char *element);
-routing_component_t
-generic_processing_units_exist(routing_component_t rc, char *element);
-void generic_src_dst_check(routing_component_t rc, const char *src,
+AS_t
+generic_autonomous_system_exist(AS_t rc, char *element);
+AS_t
+generic_processing_units_exist(AS_t rc, char *element);
+void generic_src_dst_check(AS_t rc, const char *src,
const char *dst);
/* ************************************************************************** */
/* *************************** FLOYD ROUTING ******************************** */
-routing_component_t model_floyd_create(void); /* create structures for floyd routing model */
+AS_t model_floyd_create(void); /* create structures for floyd routing model */
void model_floyd_end(void); /* finalize the creation of floyd routing model */
-void model_floyd_parse_route(routing_component_t rc, const char *src,
+void model_floyd_parse_route(AS_t rc, const char *src,
const char *dst, route_extended_t route);
/* ************************************************** */
/* ************** RULE-BASED ROUTING **************** */
-routing_component_t model_rulebased_create(void); /* create structures for rulebased routing model */
+AS_t model_rulebased_create(void); /* create structures for rulebased routing model */
/* ************************************************** */
/* ************** Cluster ROUTING **************** */
-routing_component_t model_cluster_create(void); /* create structures for cluster routing model */
+AS_t model_cluster_create(void); /* create structures for cluster routing model */
void surf_routing_cluster_add_link(const char* host_id,surf_parsing_link_up_down_t info);
/* ************************************************** */
/* ************** Vivaldi ROUTING **************** */
-routing_component_t model_vivaldi_create(void); /* create structures for vivaldi routing model */
+AS_t model_vivaldi_create(void); /* create structures for vivaldi routing model */
#define HOST_PEER(peername) bprintf("peer_%s", peername)
#define ROUTER_PEER(peername) bprintf("router_%s", peername)
#define LINK_UP_PEER(peername) bprintf("link_%s_up", peername)
/* ************************************************************************** */
/* ********** Dijkstra & Dijkstra Cached ROUTING **************************** */
-routing_component_t model_dijkstra_both_create(int cached); /* create by calling dijkstra or dijkstracache */
-routing_component_t model_dijkstra_create(void); /* create structures for dijkstra routing model */
-routing_component_t model_dijkstracache_create(void); /* create structures for dijkstracache routing model */
+AS_t model_dijkstra_both_create(int cached); /* create by calling dijkstra or dijkstracache */
+AS_t model_dijkstra_create(void); /* create structures for dijkstra routing model */
+AS_t model_dijkstracache_create(void); /* create structures for dijkstracache routing model */
void model_dijkstra_both_end(void); /* finalize the creation of dijkstra routing model */
-void model_dijkstra_both_parse_route (routing_component_t rc, const char *src,
+void model_dijkstra_both_parse_route (AS_t rc, const char *src,
const char *dst, route_extended_t route);
/* ************************************************************************** */
/* *************************** FULL ROUTING ********************************* */
-routing_component_t model_full_create(void); /* create structures for full routing model */
+AS_t model_full_create(void); /* create structures for full routing model */
void model_full_end(void); /* finalize the creation of full routing model */
void model_full_set_route( /* Set the route and ASroute between src and dst */
- routing_component_t rc, const char *src, const char *dst, route_extended_t route);
+ AS_t rc, const char *src, const char *dst, route_extended_t route);
/* ************************************************************************** */
/* ******************************* NO ROUTING ******************************* */
-routing_component_t model_none_create(void); /* none routing model */
+AS_t model_none_create(void); /* none routing model */
#endif /* _SURF_SURF_ROUTING_PRIVATE_H */
/* Global vars */
extern routing_global_t global_routing;
-extern routing_component_t current_routing;
+extern AS_t current_routing;
extern routing_model_description_t current_routing_model;
extern xbt_dynar_t link_list;
/* Routing model structure */
typedef struct {
- s_routing_component_t generic_routing;
+ s_as_t generic_routing;
xbt_dict_t dict_processing_units;
xbt_dict_t dict_autonomous_systems;
xbt_dynar_t list_route;
/* Parse routing model functions */
-static void model_rulebased_parse_PU(routing_component_t rc,
+static void model_rulebased_parse_PU(AS_t rc,
const char *name)
{
routing_component_rulebased_t routing =
xbt_dict_set(routing->dict_processing_units, name, (void *) (-1), NULL);
}
-static void model_rulebased_parse_AS(routing_component_t rc,
+static void model_rulebased_parse_AS(AS_t rc,
const char *name)
{
routing_component_rulebased_t routing =
NULL);
}
-static void model_rulebased_parse_route(routing_component_t rc,
+static void model_rulebased_parse_route(AS_t rc,
const char *src, const char *dst,
route_extended_t route)
{
xbt_free(route);
}
-static void model_rulebased_parse_ASroute(routing_component_t rc,
+static void model_rulebased_parse_ASroute(AS_t rc,
const char *src, const char *dst,
route_extended_t route)
{
xbt_free(route);
}
-static void model_rulebased_parse_bypassroute(routing_component_t rc,
+static void model_rulebased_parse_bypassroute(AS_t rc,
const char *src,
const char *dst,
route_extended_t e_route)
return memcpy(res, result, i_res);
}
-static route_extended_t rulebased_get_route(routing_component_t rc,
+static route_extended_t rulebased_get_route(AS_t rc,
const char *src,
const char *dst);
-static xbt_dynar_t rulebased_get_onelink_routes(routing_component_t rc)
+static xbt_dynar_t rulebased_get_onelink_routes(AS_t rc)
{
xbt_dynar_t ret = xbt_dynar_new (sizeof(onelink_t), xbt_free);
}
/* Business methods */
-static route_extended_t rulebased_get_route(routing_component_t rc,
+static route_extended_t rulebased_get_route(AS_t rc,
const char *src,
const char *dst)
{
return new_e_route;
}
-static route_extended_t rulebased_get_bypass_route(routing_component_t rc,
+static route_extended_t rulebased_get_bypass_route(AS_t rc,
const char *src,
const char *dst)
{
return NULL;
}
-static void rulebased_finalize(routing_component_t rc)
+static void rulebased_finalize(AS_t rc)
{
routing_component_rulebased_t routing =
(routing_component_rulebased_t) rc;
}
/* Creation routing model functions */
-routing_component_t model_rulebased_create(void) {
+AS_t model_rulebased_create(void) {
routing_component_rulebased_t new_component = (routing_component_rulebased_t)
routmod_generic_create(sizeof(s_routing_component_rulebased_t));
xbt_dynar_new(sizeof(rule_route_extended_t),
&rule_route_extended_free);
- return (routing_component_t) new_component;
+ return (AS_t) new_component;
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_vivaldi, surf, "Routing part of surf");
/* Business methods */
-static route_extended_t vivaldi_get_route(routing_component_t rc,
+static route_extended_t vivaldi_get_route(AS_t rc,
const char *src,
const char *dst)
{
return euclidean_dist / 1000;
}
-static double vivaldi_get_link_latency (routing_component_t rc,const char *src, const char *dst, route_extended_t e_route)
+static double vivaldi_get_link_latency (AS_t rc,const char *src, const char *dst, route_extended_t e_route)
{
if(get_network_element_type(src) == SURF_NETWORK_ELEMENT_AS) {
int need_to_clean = e_route?0:1;
}
/* Creation routing model functions */
-routing_component_t model_vivaldi_create(void)
+AS_t model_vivaldi_create(void)
{
- routing_component_t new_component = model_none_create();
+ AS_t new_component = model_none_create();
new_component->get_route = vivaldi_get_route;
new_component->get_latency = vivaldi_get_link_latency;
return new_component;