From 02b7b97c6140acd91203e555f3ee999f7abf353c Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 4 Nov 2011 22:21:43 +0100 Subject: [PATCH 1/1] Register the generic callback soon enough - It is generic because it calls routing_AS_init() with the arguments from AX_* - soon enough is right at the beginning of the parsing process, not deep after the models are inited --- src/surf/surf_routing.c | 20 -------------------- src/surf/surfxml_parseplatf.c | 12 ++++++++++++ 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index e5e66a034b..349b8cf2a0 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -487,15 +487,6 @@ void routing_AS_init(const char *AS_id, const char *wanted_routing_type) current_routing = new_routing; } -/* - * Detect the routing model type of the routing component from XML platforms - */ -static void parse_S_AS(void) -{ - routing_AS_init(A_surfxml_AS_id, A_surfxml_AS_routing); -} - - /** * \brief Finish the creation of a new routing component * @@ -524,14 +515,6 @@ void routing_AS_end(const char *AS_id) } } -/* - * \brief Finish the creation of a new routing component from XML - */ -static void parse_E_AS(void) -{ - routing_AS_end(A_surfxml_AS_id); -} - /* Aux Business methods */ /** @@ -991,9 +974,6 @@ void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_ surfxml_add_callback(ETag_surfxml_bypassRoute_cb_list, &parse_E_bypassRoute_store_route); - surfxml_add_callback(STag_surfxml_AS_cb_list, &parse_S_AS); - surfxml_add_callback(ETag_surfxml_AS_cb_list, &parse_E_AS); - surfxml_add_callback(STag_surfxml_cluster_cb_list, &routing_parse_Scluster); diff --git a/src/surf/surfxml_parseplatf.c b/src/surf/surfxml_parseplatf.c index d37459aa28..3d2ff37d3d 100644 --- a/src/surf/surfxml_parseplatf.c +++ b/src/surf/surfxml_parseplatf.c @@ -142,6 +142,14 @@ static void parse_Stag_trace_connect(void) } } +/* Call the right C function when we see the tags */ +static void parse_S_AS(void) { + routing_AS_init(A_surfxml_AS_id, A_surfxml_AS_routing); +} +static void parse_E_AS(void) { + routing_AS_end(A_surfxml_AS_id); +} + /* Init and free parse data */ @@ -161,6 +169,10 @@ static void init_data(void) surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_Etag_trace); surfxml_add_callback(STag_surfxml_trace_connect_cb_list, &parse_Stag_trace_connect); + + /* we care about the ASes while parsing the platf. Incredible, isnt it? */ + surfxml_add_callback(STag_surfxml_AS_cb_list, &parse_S_AS); + surfxml_add_callback(ETag_surfxml_AS_cb_list, &parse_E_AS); } static void free_data(void) -- 2.20.1