1 /* Copyright (c) 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
11 #include "surf/surfxml_parse_private.h"
12 #include "surf/surf_private.h"
14 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf,
15 "Logging specific to the SURF parsing module");
17 #include "simgrid_dtd.c"
19 /* Initialize the parsing globals */
21 xbt_dict_t traces_set_list = NULL;
22 //xbt_dynar_t traces_connect_list = NULL;
23 xbt_dict_t trace_connect_list_host_avail = NULL;
24 xbt_dict_t trace_connect_list_power = NULL;
25 xbt_dict_t trace_connect_list_link_avail = NULL;
26 xbt_dict_t trace_connect_list_bandwidth = NULL;
27 xbt_dict_t trace_connect_list_latency = NULL;
29 /* This buffer is used to store the original buffer before substituing it by out own buffer. Usefull for the foreach tag */
30 static xbt_dynar_t surfxml_bufferstack_stack = NULL;
31 int surfxml_bufferstack_size = 2048;
32 static char *old_buff = NULL;
33 static void surf_parse_error(char *msg);
35 void surfxml_bufferstack_push(int new)
38 old_buff = surfxml_bufferstack;
40 xbt_dynar_push(surfxml_bufferstack_stack, &surfxml_bufferstack);
41 surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
45 void surfxml_bufferstack_pop(int new)
48 surfxml_bufferstack = old_buff;
50 free(surfxml_bufferstack);
51 xbt_dynar_pop(surfxml_bufferstack_stack, &surfxml_bufferstack);
55 /* Stores the set name reffered to by the foreach tag */
56 static char *foreach_set_name;
57 static xbt_dynar_t main_STag_surfxml_host_cb_list = NULL;
58 static xbt_dynar_t main_STag_surfxml_link_cb_list = NULL;
60 /* make sure these symbols are defined as strong ones in this file so that the linked can resolve them */
61 xbt_dynar_t STag_surfxml_platform_cb_list = NULL;
62 xbt_dynar_t ETag_surfxml_platform_cb_list = NULL;
63 xbt_dynar_t STag_surfxml_host_cb_list = NULL;
64 xbt_dynar_t ETag_surfxml_host_cb_list = NULL;
65 xbt_dynar_t STag_surfxml_router_cb_list = NULL;
66 xbt_dynar_t ETag_surfxml_router_cb_list = NULL;
67 xbt_dynar_t STag_surfxml_link_cb_list = NULL;
68 xbt_dynar_t ETag_surfxml_link_cb_list = NULL;
69 xbt_dynar_t STag_surfxml_route_cb_list = NULL;
70 xbt_dynar_t ETag_surfxml_route_cb_list = NULL;
71 xbt_dynar_t STag_surfxml_link_c_ctn_cb_list = NULL;
72 xbt_dynar_t ETag_surfxml_link_c_ctn_cb_list = NULL;
73 xbt_dynar_t STag_surfxml_process_cb_list = NULL;
74 xbt_dynar_t ETag_surfxml_process_cb_list = NULL;
75 xbt_dynar_t STag_surfxml_argument_cb_list = NULL;
76 xbt_dynar_t ETag_surfxml_argument_cb_list = NULL;
77 xbt_dynar_t STag_surfxml_prop_cb_list = NULL;
78 xbt_dynar_t ETag_surfxml_prop_cb_list = NULL;
79 xbt_dynar_t STag_surfxml_set_cb_list = NULL;
80 xbt_dynar_t ETag_surfxml_set_cb_list = NULL;
81 xbt_dynar_t STag_surfxml_foreach_cb_list = NULL;
82 xbt_dynar_t ETag_surfxml_foreach_cb_list = NULL;
83 xbt_dynar_t STag_surfxml_route_c_multi_cb_list = NULL;
84 xbt_dynar_t ETag_surfxml_route_c_multi_cb_list = NULL;
85 xbt_dynar_t STag_surfxml_cluster_cb_list = NULL;
86 xbt_dynar_t ETag_surfxml_cluster_cb_list = NULL;
87 xbt_dynar_t STag_surfxml_trace_cb_list = NULL;
88 xbt_dynar_t ETag_surfxml_trace_cb_list = NULL;
89 xbt_dynar_t STag_surfxml_trace_c_connect_cb_list = NULL;
90 xbt_dynar_t ETag_surfxml_trace_c_connect_cb_list = NULL;
91 xbt_dynar_t STag_surfxml_random_cb_list = NULL;
92 xbt_dynar_t ETag_surfxml_random_cb_list = NULL;
93 xbt_dynar_t STag_surfxml_AS_cb_list = NULL; // addded by david
94 xbt_dynar_t ETag_surfxml_AS_cb_list = NULL; // addded by david
95 xbt_dynar_t STag_surfxml_gateway_cb_list = NULL; // addded by david
96 xbt_dynar_t ETag_surfxml_gateway_cb_list = NULL; // addded by david
99 /* Stores the sets defined in the XML */
100 xbt_dict_t set_list = NULL;
102 xbt_dict_t current_property_set = NULL;
104 /* For the route:multi tag */
105 xbt_dict_t route_table = NULL;
106 xbt_dict_t route_multi_table = NULL;
107 xbt_dynar_t route_multi_elements = NULL;
108 static xbt_dynar_t route_link_list = NULL;
109 xbt_dynar_t links = NULL;
110 xbt_dynar_t keys = NULL;
112 xbt_dict_t random_data_list = NULL;
114 static xbt_dynar_t surf_input_buffer_stack = NULL;
115 static xbt_dynar_t surf_file_to_parse_stack = NULL;
117 static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t);
119 YY_BUFFER_STATE surf_input_buffer;
120 FILE *surf_file_to_parse = NULL;
122 static void convert_route_multi_to_routes(void);
123 static void parse_route_elem(void);
124 static void parse_Stag_foreach(void);
125 static void parse_sets(void);
126 static void parse_Stag_route_multi(void);
127 static void parse_Etag_route_multi(void);
128 static void parse_Stag_trace(void);
129 static void parse_Etag_trace(void);
130 static void parse_Stag_trace_c_connect(void);
131 static void init_randomness(void);
132 static void add_randomness(void);
134 void surf_parse_free_callbacks(void)
136 xbt_dynar_free(&STag_surfxml_platform_cb_list);
137 xbt_dynar_free(&ETag_surfxml_platform_cb_list);
138 xbt_dynar_free(&STag_surfxml_host_cb_list);
139 xbt_dynar_free(&ETag_surfxml_host_cb_list);
140 xbt_dynar_free(&STag_surfxml_router_cb_list);
141 xbt_dynar_free(&ETag_surfxml_router_cb_list);
142 xbt_dynar_free(&STag_surfxml_link_cb_list);
143 xbt_dynar_free(&ETag_surfxml_link_cb_list);
144 xbt_dynar_free(&STag_surfxml_route_cb_list);
145 xbt_dynar_free(&ETag_surfxml_route_cb_list);
146 xbt_dynar_free(&STag_surfxml_link_c_ctn_cb_list);
147 xbt_dynar_free(&ETag_surfxml_link_c_ctn_cb_list);
148 xbt_dynar_free(&STag_surfxml_process_cb_list);
149 xbt_dynar_free(&ETag_surfxml_process_cb_list);
150 xbt_dynar_free(&STag_surfxml_argument_cb_list);
151 xbt_dynar_free(&ETag_surfxml_argument_cb_list);
152 xbt_dynar_free(&STag_surfxml_prop_cb_list);
153 xbt_dynar_free(&ETag_surfxml_prop_cb_list);
154 xbt_dynar_free(&STag_surfxml_set_cb_list);
155 xbt_dynar_free(&ETag_surfxml_set_cb_list);
156 xbt_dynar_free(&STag_surfxml_foreach_cb_list);
157 xbt_dynar_free(&ETag_surfxml_foreach_cb_list);
158 xbt_dynar_free(&STag_surfxml_route_c_multi_cb_list);
159 xbt_dynar_free(&ETag_surfxml_route_c_multi_cb_list);
160 xbt_dynar_free(&STag_surfxml_cluster_cb_list);
161 xbt_dynar_free(&ETag_surfxml_cluster_cb_list);
162 xbt_dynar_free(&STag_surfxml_trace_cb_list);
163 xbt_dynar_free(&ETag_surfxml_trace_cb_list);
164 xbt_dynar_free(&STag_surfxml_trace_c_connect_cb_list);
165 xbt_dynar_free(&ETag_surfxml_trace_c_connect_cb_list);
166 xbt_dynar_free(&STag_surfxml_random_cb_list);
167 xbt_dynar_free(&ETag_surfxml_random_cb_list);
168 xbt_dynar_free(&STag_surfxml_AS_cb_list); // addded by david
169 xbt_dynar_free(&ETag_surfxml_AS_cb_list); // addded by david
170 xbt_dynar_free(&STag_surfxml_gateway_cb_list); // addded by david
171 xbt_dynar_free(&ETag_surfxml_gateway_cb_list); // addded by david
174 void surf_parse_reset_parser(void)
176 surf_parse_free_callbacks();
177 STag_surfxml_platform_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
178 ETag_surfxml_platform_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
179 STag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
180 ETag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
181 STag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
182 ETag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
183 STag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
184 ETag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
185 STag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
186 ETag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
187 STag_surfxml_link_c_ctn_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
188 ETag_surfxml_link_c_ctn_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
189 STag_surfxml_process_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
190 ETag_surfxml_process_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
191 STag_surfxml_argument_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
192 ETag_surfxml_argument_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
193 STag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
194 ETag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
195 STag_surfxml_set_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
196 ETag_surfxml_set_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
197 STag_surfxml_foreach_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
198 ETag_surfxml_foreach_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
199 STag_surfxml_route_c_multi_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
200 ETag_surfxml_route_c_multi_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
201 STag_surfxml_cluster_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
202 ETag_surfxml_cluster_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
203 STag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
204 ETag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
205 STag_surfxml_trace_c_connect_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
206 ETag_surfxml_trace_c_connect_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
207 STag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
208 ETag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
209 STag_surfxml_AS_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); // addded by david
210 ETag_surfxml_AS_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); // addded by david
211 STag_surfxml_gateway_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); // addded by david
212 ETag_surfxml_gateway_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL); // addded by david
215 void STag_surfxml_include(void)
217 xbt_dynar_push(surf_input_buffer_stack, &surf_input_buffer);
218 xbt_dynar_push(surf_file_to_parse_stack, &surf_file_to_parse);
220 surf_file_to_parse = surf_fopen(A_surfxml_include_file, "r");
221 xbt_assert1((surf_file_to_parse), "Unable to open \"%s\"\n",
222 A_surfxml_include_file);
223 surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, 10);
224 surf_parse__switch_to_buffer(surf_input_buffer);
229 void ETag_surfxml_include(void)
233 surf_parse__delete_buffer(surf_input_buffer);
234 fclose(surf_file_to_parse);
235 xbt_dynar_pop(surf_file_to_parse_stack, &surf_file_to_parse);
236 xbt_dynar_pop(surf_input_buffer_stack, &surf_input_buffer);
239 void STag_surfxml_platform(void)
241 double version = 0.0;
243 sscanf(A_surfxml_platform_version, "%lg", &version);
245 xbt_assert0((version >= 1.0), "******* BIG FAT WARNING *********\n "
246 "You're using an ancient XML file. "
247 "Since SimGrid 3.1, units are Bytes, Flops, and seconds "
248 "instead of MBytes, MFlops and seconds. "
249 "A script (surfxml_update.pl) to help you convert your old "
251 "is available in the contrib/platform_generation directory "
252 "of the simgrid repository. Please check also out the "
253 "SURF section of the ChangeLog for the 3.1 version. "
254 "Last, do not forget to also update your values for "
255 "the calls to MSG_task_create (if any).");
256 xbt_assert0((version >= 2.0), "******* BIG FAT WARNING *********\n "
257 "You're using an old XML file. "
258 "A script (surfxml_update.pl) to help you convert your old "
260 "is available in the contrib/platform_generation directory "
261 "of the simgrid repository.");
263 surfxml_call_cb_functions(STag_surfxml_platform_cb_list);
267 void ETag_surfxml_platform(void)
269 convert_route_multi_to_routes();
271 surfxml_call_cb_functions(ETag_surfxml_platform_cb_list);
273 xbt_dict_free(&random_data_list);
276 void STag_surfxml_host(void)
278 surfxml_call_cb_functions(STag_surfxml_host_cb_list);
282 void ETag_surfxml_host(void)
284 surfxml_call_cb_functions(ETag_surfxml_host_cb_list);
287 void STag_surfxml_router(void)
289 surfxml_call_cb_functions(STag_surfxml_router_cb_list);
292 void ETag_surfxml_router(void)
294 surfxml_call_cb_functions(ETag_surfxml_router_cb_list);
297 void STag_surfxml_link(void)
299 surfxml_call_cb_functions(STag_surfxml_link_cb_list);
302 void ETag_surfxml_link(void)
304 surfxml_call_cb_functions(ETag_surfxml_link_cb_list);
307 void STag_surfxml_route(void)
309 surfxml_call_cb_functions(STag_surfxml_route_cb_list);
312 void ETag_surfxml_route(void)
314 surfxml_call_cb_functions(ETag_surfxml_route_cb_list);
317 void STag_surfxml_link_c_ctn(void)
319 surfxml_call_cb_functions(STag_surfxml_link_c_ctn_cb_list);
322 void ETag_surfxml_link_c_ctn(void)
324 surfxml_call_cb_functions(ETag_surfxml_link_c_ctn_cb_list);
327 void STag_surfxml_process(void)
329 surfxml_call_cb_functions(STag_surfxml_process_cb_list);
332 void ETag_surfxml_process(void)
334 surfxml_call_cb_functions(ETag_surfxml_process_cb_list);
337 void STag_surfxml_argument(void)
339 surfxml_call_cb_functions(STag_surfxml_argument_cb_list);
342 void ETag_surfxml_argument(void)
344 surfxml_call_cb_functions(ETag_surfxml_argument_cb_list);
347 void STag_surfxml_prop(void)
349 surfxml_call_cb_functions(STag_surfxml_prop_cb_list);
352 void ETag_surfxml_prop(void)
354 surfxml_call_cb_functions(ETag_surfxml_prop_cb_list);
357 void STag_surfxml_set(void)
359 surfxml_call_cb_functions(STag_surfxml_set_cb_list);
362 void ETag_surfxml_set(void)
364 surfxml_call_cb_functions(ETag_surfxml_set_cb_list);
367 void STag_surfxml_foreach(void)
369 /* Save the current buffer */
370 surfxml_bufferstack_push(0);
371 surfxml_call_cb_functions(STag_surfxml_foreach_cb_list);
374 void ETag_surfxml_foreach(void)
376 surfxml_call_cb_functions(ETag_surfxml_foreach_cb_list);
378 /* free the temporary dynar and restore original */
379 xbt_dynar_free(&STag_surfxml_host_cb_list);
380 STag_surfxml_host_cb_list = main_STag_surfxml_host_cb_list;
382 /* free the temporary dynar and restore original */
383 xbt_dynar_free(&STag_surfxml_link_cb_list);
384 STag_surfxml_link_cb_list = main_STag_surfxml_link_cb_list;
387 void STag_surfxml_route_c_multi(void)
389 surfxml_call_cb_functions(STag_surfxml_route_c_multi_cb_list);
392 void ETag_surfxml_route_c_multi(void)
394 surfxml_call_cb_functions(ETag_surfxml_route_c_multi_cb_list);
397 void STag_surfxml_cluster(void)
399 surfxml_call_cb_functions(STag_surfxml_cluster_cb_list);
402 void ETag_surfxml_cluster(void)
404 surfxml_call_cb_functions(ETag_surfxml_cluster_cb_list);
407 void STag_surfxml_trace(void)
409 surfxml_call_cb_functions(STag_surfxml_trace_cb_list);
412 void ETag_surfxml_trace(void)
414 surfxml_call_cb_functions(ETag_surfxml_trace_cb_list);
417 void STag_surfxml_trace_c_connect(void)
419 surfxml_call_cb_functions(STag_surfxml_trace_c_connect_cb_list);
422 void ETag_surfxml_trace_c_connect(void)
424 surfxml_call_cb_functions(ETag_surfxml_trace_c_connect_cb_list);
427 void STag_surfxml_random(void)
429 surfxml_call_cb_functions(STag_surfxml_random_cb_list);
432 void ETag_surfxml_random(void)
434 surfxml_call_cb_functions(ETag_surfxml_random_cb_list);
437 void STag_surfxml_AS(void) // addded by david
439 surfxml_call_cb_functions(STag_surfxml_AS_cb_list);
442 void ETag_surfxml_AS(void) // addded by david
444 surfxml_call_cb_functions(ETag_surfxml_AS_cb_list);
447 void STag_surfxml_gateway(void) // addded by david
449 surfxml_call_cb_functions(STag_surfxml_gateway_cb_list);
452 void ETag_surfxml_gateway(void) // addded by david
454 surfxml_call_cb_functions(ETag_surfxml_gateway_cb_list);
457 void surf_parse_open(const char *file)
459 static int warned = 0; /* warn only once */
463 ("Bypassing the XML parser since surf_parse_open received a NULL pointer. If it is not what you want, go fix your code.");
468 surf_file_to_parse = surf_fopen(file, "r");
469 xbt_assert1((surf_file_to_parse), "Unable to open \"%s\"\n", file);
471 if (!surf_input_buffer_stack)
472 surf_input_buffer_stack = xbt_dynar_new(sizeof(YY_BUFFER_STATE), NULL);
473 if (!surf_file_to_parse_stack)
474 surf_file_to_parse_stack = xbt_dynar_new(sizeof(FILE *), NULL);
476 surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, 10);
477 surf_parse__switch_to_buffer(surf_input_buffer);
478 surf_parse_lineno = 1;
481 void surf_parse_close(void)
483 if (surf_input_buffer_stack)
484 xbt_dynar_free(&surf_input_buffer_stack);
485 if (surf_file_to_parse_stack)
486 xbt_dynar_free(&surf_file_to_parse_stack);
488 if (surf_file_to_parse) {
489 surf_parse__delete_buffer(surf_input_buffer);
490 fclose(surf_file_to_parse);
494 static int _surf_parse(void)
496 return surf_parse_lex();
499 int_f_void_t surf_parse = _surf_parse;
501 void surf_parse_error(char *msg)
503 fprintf(stderr, "Parse error on line %d: %s\n", surf_parse_lineno, msg);
508 void surf_parse_get_double(double *value, const char *string)
512 ret = sscanf(string, "%lg", value);
514 surf_parse_error(bprintf("%s is not a double", string));
517 void surf_parse_get_int(int *value, const char *string)
521 ret = sscanf(string, "%d", value);
523 surf_parse_error(bprintf("%s is not an integer", string));
526 void parse_properties(void)
530 if (!current_property_set)
531 current_property_set = xbt_dict_new();
533 value = xbt_strdup(A_surfxml_prop_value);
534 xbt_dict_set(current_property_set, A_surfxml_prop_id, value, free);
537 void surfxml_add_callback(xbt_dynar_t cb_list, void_f_void_t function)
539 xbt_dynar_push(cb_list, &function);
542 void surfxml_del_callback(xbt_dynar_t* p_cb_list, void_f_void_t function)
544 xbt_dynar_t new_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
547 xbt_dynar_foreach(*p_cb_list,it,func) {
548 if( func != function )
549 xbt_dynar_push(new_cb_list, &func);
551 xbt_dynar_free(p_cb_list);
552 *p_cb_list = new_cb_list;
555 static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list)
557 unsigned int iterator;
559 xbt_dynar_foreach(cb_list, iterator, fun) {
564 static void parse_route_set_endpoints(void)
566 route_link_list = xbt_dynar_new(sizeof(char *), NULL);
569 static void init_data(void)
571 xbt_dict_free(&route_table);
572 xbt_dynar_free(&route_link_list);
573 route_table = xbt_dict_new();
575 if (!surfxml_bufferstack_stack)
576 surfxml_bufferstack_stack = xbt_dynar_new(sizeof(char *), NULL);
577 route_multi_table = xbt_dict_new();
578 route_multi_elements = xbt_dynar_new(sizeof(char *), NULL);
579 traces_set_list = xbt_dict_new();
580 if (set_list == NULL)
581 set_list = xbt_dict_new();
583 trace_connect_list_host_avail = xbt_dict_new();
584 trace_connect_list_power = xbt_dict_new();
585 trace_connect_list_link_avail = xbt_dict_new();
586 trace_connect_list_bandwidth = xbt_dict_new();
587 trace_connect_list_latency = xbt_dict_new();
589 random_data_list = xbt_dict_new();
591 // commented by david
593 // surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
594 // surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
595 // surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
596 // surfxml_add_callback(STag_surfxml_set_cb_list, &parse_sets);
597 // surfxml_add_callback(STag_surfxml_route_c_multi_cb_list, &parse_Stag_route_multi);
598 // surfxml_add_callback(ETag_surfxml_route_c_multi_cb_list, &parse_Etag_route_multi);
599 // surfxml_add_callback(STag_surfxml_foreach_cb_list, &parse_Stag_foreach);
600 // surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_Stag_trace);
601 // surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_Etag_trace);
602 // surfxml_add_callback(STag_surfxml_trace_c_connect_cb_list, &parse_Stag_trace_c_connect);
603 // surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness);
604 // surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness);
608 static void free_data(void)
611 xbt_dict_cursor_t cursor = NULL;
613 unsigned int cpt = 0;
615 xbt_dict_foreach(route_table, cursor, key, data) {
616 xbt_dynar_t links = (xbt_dynar_t) data;
618 unsigned int cpt = 0;
620 xbt_dynar_foreach(links, cpt, name) free(name);
621 xbt_dynar_free(&links);
623 xbt_dict_free(&route_table);
624 route_link_list = NULL;
626 xbt_dict_free(&route_multi_table);
628 xbt_dynar_foreach(route_multi_elements, cpt, name) free(name);
629 xbt_dynar_free(&route_multi_elements);
631 xbt_dict_foreach(set_list, cursor, key, data) {
632 xbt_dynar_t set = (xbt_dynar_t) data;
634 xbt_dynar_foreach(set, cpt, name) free(name);
635 xbt_dynar_free(&set);
637 xbt_dict_free(&set_list);
639 xbt_dynar_free(&surfxml_bufferstack_stack);
641 xbt_dict_free(&traces_set_list);
642 xbt_dict_free(&trace_connect_list_host_avail);
643 xbt_dict_free(&trace_connect_list_power);
644 xbt_dict_free(&trace_connect_list_link_avail);
645 xbt_dict_free(&trace_connect_list_bandwidth);
646 xbt_dict_free(&trace_connect_list_latency);
647 xbt_dict_free(&traces_set_list);
650 void parse_platform_file(const char *file)
653 surf_parse_open(file);
655 parse_status = surf_parse();
659 xbt_dict_free(&random_data_list);
660 xbt_assert1(!parse_status, "Parse error in %s", file);
663 /* Functions to bypass route tag. Used by the route:multi tag */
665 static void parse_make_temporary_route(const char *src, const char *dst,
670 A_surfxml_route_action = action;
671 SURFXML_BUFFER_SET(route_src, src);
672 SURFXML_BUFFER_SET(route_dst, dst);
675 /* Functions for the sets and foreach tags */
677 static void parse_sets(void)
679 char *id, *suffix, *prefix, *radical;
681 xbt_dynar_t radical_elements;
682 xbt_dynar_t radical_ends;
683 xbt_dynar_t current_set;
684 char *value, *groups;
688 id = xbt_strdup(A_surfxml_set_id);
689 prefix = xbt_strdup(A_surfxml_set_prefix);
690 suffix = xbt_strdup(A_surfxml_set_suffix);
691 radical = xbt_strdup(A_surfxml_set_radical);
693 if (xbt_dict_get_or_null(set_list, id))
694 surf_parse_error(bprintf
695 ("Set '%s' declared several times in the platform file.",
698 current_set = xbt_dynar_new(sizeof(char *), NULL);
700 radical_elements = xbt_str_split(radical, ",");
701 xbt_dynar_foreach(radical_elements, iter, groups) {
703 radical_ends = xbt_str_split(groups, "-");
704 switch (xbt_dynar_length(radical_ends)) {
706 surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char *));
707 value = bprintf("%s%d%s", prefix, start, suffix);
708 xbt_dynar_push(current_set, &value);
713 surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char *));
714 surf_parse_get_int(&end, xbt_dynar_get_as(radical_ends, 1, char *));
717 for (i = start; i <= end; i++) {
718 value = bprintf("%s%d%s", prefix, i, suffix);
719 xbt_dynar_push(current_set, &value);
724 surf_parse_error(xbt_strdup("Malformed radical"));
727 xbt_dynar_free(&radical_ends);
730 xbt_dict_set(set_list, id, current_set, NULL);
732 xbt_dynar_free(&radical_elements);
739 static void parse_host_foreach(void){
741 xbt_dynar_t names = NULL;
742 unsigned int cpt = 0;
744 xbt_dict_cursor_t cursor = NULL;
747 const char *surfxml_host_power = A_surfxml_host_power;
748 const char *surfxml_host_availability = A_surfxml_host_availability;
749 const char *surfxml_host_availability_file = A_surfxml_host_availability_file;
750 const char *surfxml_host_state_file = A_surfxml_host_state_file;
752 xbt_dict_t cluster_host_props = current_property_set;
754 names = xbt_dict_get_or_null(set_list, foreach_set_name);
756 surf_parse_error(bprintf("Set name '%s' used in <foreach> not found.",
758 if (strcmp(A_surfxml_host_id, "$1"))
759 surf_parse_error(bprintf
760 ("The host id within <foreach> should point to the foreach set_id (use $1 instead of %s)",
764 /* foreach name in set call the main host callback */
765 xbt_dynar_foreach(names, cpt, name) {
766 int AX_ptr = 0; /* needed by the SURFXML_BUFFER_SET macro */
768 surfxml_bufferstack_push(1);
770 SURFXML_BUFFER_SET(host_id, name);
771 SURFXML_BUFFER_SET(host_power, surfxml_host_power /*hostPower */ );
772 SURFXML_BUFFER_SET(host_availability, surfxml_host_availability);
773 SURFXML_BUFFER_SET(host_availability_file, surfxml_host_availability_file);
774 SURFXML_BUFFER_SET(host_state_file, surfxml_host_state_file);
776 surfxml_call_cb_functions(main_STag_surfxml_host_cb_list);
778 xbt_dict_foreach(cluster_host_props, cursor, key, data) {
779 xbt_dict_set(current_property_set, xbt_strdup(key), xbt_strdup(data),
783 /* Call the (unmodified) callbacks of </host>, if any */
784 surfxml_call_cb_functions(ETag_surfxml_host_cb_list);
785 surfxml_bufferstack_pop(1);
788 current_property_set = xbt_dict_new();
790 surfxml_bufferstack_pop(0);
793 static void parse_link_foreach(void) {
794 const char *surfxml_link_bandwidth = A_surfxml_link_bandwidth;
795 const char *surfxml_link_bandwidth_file = A_surfxml_link_bandwidth_file;
796 const char *surfxml_link_latency = A_surfxml_link_latency;
797 const char *surfxml_link_latency_file = A_surfxml_link_latency_file;
798 const char *surfxml_link_state_file = A_surfxml_link_state_file;
800 xbt_dynar_t names = NULL;
801 unsigned int cpt = 0;
803 xbt_dict_cursor_t cursor = NULL;
806 xbt_dict_t cluster_link_props = current_property_set;
808 names = xbt_dict_get_or_null(set_list, foreach_set_name);
810 surf_parse_error(bprintf("Set name '%s' used in <foreach> not found.",
812 if (strcmp(A_surfxml_link_id, "$1"))
813 surf_parse_error(bprintf
814 ("The host id within <foreach> should point to the foreach set_id (use $1 instead of %s)",
817 /* for each name in set call the main link callback */
818 xbt_dynar_foreach(names, cpt, name) {
819 int AX_ptr = 0; /* needed by the SURFXML_BUFFER_SET */
821 surfxml_bufferstack_push(1);
823 SURFXML_BUFFER_SET(link_id, name);
824 SURFXML_BUFFER_SET(link_bandwidth, surfxml_link_bandwidth);
825 SURFXML_BUFFER_SET(link_bandwidth_file, surfxml_link_bandwidth_file);
826 SURFXML_BUFFER_SET(link_latency, surfxml_link_latency);
827 SURFXML_BUFFER_SET(link_latency_file, surfxml_link_latency_file);
828 SURFXML_BUFFER_SET(link_state_file, surfxml_link_state_file);
830 surfxml_call_cb_functions(main_STag_surfxml_link_cb_list);
832 xbt_dict_foreach(cluster_link_props, cursor, key, data) {
833 xbt_dict_set(current_property_set, xbt_strdup(key), xbt_strdup(data),
837 /* Call the (unmodified) callbacks of </link>, if any */
838 surfxml_call_cb_functions(ETag_surfxml_link_cb_list);
839 surfxml_bufferstack_pop(1);
842 current_property_set = xbt_dict_new();
844 surfxml_bufferstack_pop(0);
845 free(foreach_set_name);
846 foreach_set_name = NULL;
849 static void parse_Stag_foreach(void)
851 /* save the host & link callbacks */
852 main_STag_surfxml_host_cb_list = STag_surfxml_host_cb_list;
853 main_STag_surfxml_link_cb_list = STag_surfxml_link_cb_list;
855 /* redefine host & link callbacks to be used only by the foreach tag */
856 STag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
857 STag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
859 surfxml_add_callback(STag_surfxml_host_cb_list, &parse_host_foreach);
860 surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_foreach);
863 foreach_set_name = xbt_strdup(A_surfxml_foreach_set_id);
866 /* Route:multi functions */
868 static int route_multi_size = 0;
869 static char *src_name, *dst_name;
870 static int is_symmetric_route;
872 static void parse_route_elem(void)
876 val = xbt_strdup(A_surfxml_link_c_ctn_id);
878 xbt_dynar_push(route_link_list, &val);
879 //INFO2("Push %s (size now:%ld)",val,xbt_dynar_length(route_link_list));
882 static void parse_Stag_route_multi(void)
884 src_name = xbt_strdup(A_surfxml_route_c_multi_src);
885 dst_name = xbt_strdup(A_surfxml_route_c_multi_dst);
886 route_action = A_surfxml_route_c_multi_action;
887 is_symmetric_route = A_surfxml_route_c_multi_symmetric;
890 route_link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
894 This function is used to append or override the contents of an already existing route in the case a new one with its name is found.
895 The decision is based upon the value of action specified in the xml route:multi attribute action
897 void manage_route(xbt_dict_t routing_table, const char *route_name,
898 int action, int isMultiRoute)
904 /* get already existing list if it exists */
905 links = xbt_dict_get_or_null(routing_table, route_name);
906 DEBUG3("ROUTE: %s (action:%s; len:%ld)", route_name,
907 (action==A_surfxml_route_action_OVERRIDE?"override":(
908 action==A_surfxml_route_action_PREPEND?"prepend":"postpend")),
909 (links?xbt_dynar_length(links):0));
913 case A_surfxml_route_action_PREPEND: /* add existing links at the end; route_link_list + links */
914 xbt_dynar_foreach(links, cpt, value) {
915 xbt_dynar_push(route_link_list, &value);
917 xbt_dynar_free(&links);
919 case A_surfxml_route_action_POSTPEND: /* add existing links in front; links + route_link_list */
920 xbt_dynar_foreach(route_link_list, cpt, value) {
921 xbt_dynar_push(links, &value);
923 xbt_dynar_free(&route_link_list);
924 route_link_list = links;
926 case A_surfxml_route_action_OVERRIDE:
927 xbt_dynar_free(&links);
930 xbt_die(bprintf("While dealing with routes of %s, got action=%d. Please report this bug.",
936 /* this is the final route; do not add if name is a set; add only if name is in set list */
938 xbt_dict_set(routing_table, route_name, route_link_list, NULL);
942 static void parse_Etag_route_multi(void)
947 bprintf("%s#%s#%d#%d#%d", src_name, dst_name, route_action,
948 is_symmetric_route, route_multi_size);
950 xbt_dynar_push(route_multi_elements, &route_name);
953 xbt_dict_set(route_multi_table, route_name, route_link_list, NULL);
954 /* add symmetric if it is the case */
955 if (is_symmetric_route == 1) {
956 char *symmetric_name =
957 bprintf("%s#%s#%d#%d#%d", dst_name, src_name, route_action,
958 !is_symmetric_route, route_multi_size);
960 xbt_dict_set(route_multi_table, symmetric_name, route_link_list, NULL);
961 xbt_dynar_push(route_multi_elements, &symmetric_name);
962 is_symmetric_route = 0;
968 static void add_multi_links(const char *src, const char *dst,
969 xbt_dynar_t links, const char *src_name,
970 const char *dst_name)
975 surfxml_bufferstack_push(1);
977 parse_make_temporary_route(src_name, dst_name, route_action);
978 surfxml_call_cb_functions(STag_surfxml_route_cb_list);
979 DEBUG2("\tADDING ROUTE: %s -> %s", src_name, dst_name);
980 /* Build link list */
981 xbt_dynar_foreach(links, cpt, value) {
982 if (strcmp(value, src) == 0)
983 val = xbt_strdup(src_name);
984 else if (strcmp(value, dst) == 0)
985 val = xbt_strdup(dst_name);
986 else if (strcmp(value, "$dst") == 0)
987 val = xbt_strdup(dst_name);
988 else if (strcmp(value, "$src") == 0)
989 val = xbt_strdup(src_name);
991 val = xbt_strdup(value);
992 DEBUG1("\t\tELEMENT: %s", val);
993 xbt_dynar_push(route_link_list, &val);
995 surfxml_call_cb_functions(ETag_surfxml_route_cb_list);
996 surfxml_bufferstack_pop(1);
999 static void convert_route_multi_to_routes(void)
1001 xbt_dict_cursor_t cursor_w;
1003 unsigned int cpt, cpt2, cursor;
1004 char *src_host_name, *dst_host_name, *key, *src, *dst, *val, *key_w,
1006 const char *sep = "#";
1007 xbt_dict_t set = NULL;
1008 xbt_dynar_t src_names = NULL, dst_names = NULL, links;
1010 if (!route_multi_elements)
1014 set = surf_model_resource_set(surf_cpu_model);
1015 if (surf_workstation_model != NULL &&
1016 surf_model_resource_set(surf_workstation_model) != NULL &&
1017 xbt_dict_length(surf_model_resource_set(surf_workstation_model)) > 0)
1018 set = surf_model_resource_set(surf_workstation_model);
1021 surfxml_bufferstack_push(0);
1022 /* Get all routes in the exact order they were entered in the platform file */
1023 xbt_dynar_foreach(route_multi_elements, cursor, key) {
1024 /* Get links for the route */
1025 links = (xbt_dynar_t) xbt_dict_get_or_null(route_multi_table, key);
1026 keys = xbt_str_split_str(key, sep);
1027 /* Get route ends */
1028 src = xbt_dynar_get_as(keys, 0, char *);
1029 dst = xbt_dynar_get_as(keys, 1, char *);
1030 route_action = atoi(xbt_dynar_get_as(keys, 2, char *));
1031 symmetric = atoi(xbt_dynar_get_as(keys, 3, char *));
1033 /* Create the dynar of src and dst hosts for the new routes */
1034 /* NOTE: src and dst can be either set names or simple host names */
1035 src_names = (xbt_dynar_t) xbt_dict_get_or_null(set_list, src);
1036 dst_names = (xbt_dynar_t) xbt_dict_get_or_null(set_list, dst);
1037 /* Add to dynar even if they are simple names */
1038 if (src_names == NULL) {
1039 src_names = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
1040 val = xbt_strdup(src);
1041 xbt_dynar_push(src_names, &val);
1042 if (strcmp(val, "$*") != 0 && NULL == xbt_dict_get_or_null(set, val))
1043 THROW3(unknown_error, 0,
1044 "(In route:multi (%s -> %s) source %s does not exist (not a set or a host)",
1047 if (dst_names == NULL) {
1048 dst_names = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
1049 val = xbt_strdup(dst);
1050 if (strcmp(val, "$*") != 0 && NULL == xbt_dict_get_or_null(set, val))
1051 THROW3(unknown_error, 0,
1052 "(In route:multi (%s -> %s) destination %s does not exist (not a set or a host)",
1054 xbt_dynar_push(dst_names, &val);
1057 /* Build the routes */
1058 DEBUG2("ADDING MULTI ROUTE: %s -> %s", xbt_dynar_get_as(keys, 0, char *),
1059 xbt_dynar_get_as(keys, 1, char *));
1060 xbt_dynar_foreach(src_names, cpt, src_host_name) {
1061 xbt_dynar_foreach(dst_names, cpt2, dst_host_name) {
1062 /* If dst is $* then set this route to have its dst point to all hosts */
1063 if (strcmp(src_host_name, "$*") != 0
1064 && strcmp(dst_host_name, "$*") == 0) {
1065 xbt_dict_foreach(set, cursor_w, key_w, data_w) {
1066 //int n = xbt_dynar_member(src_names, (char*)key_w);
1067 add_multi_links(src, dst, links, src_host_name, key_w);
1070 /* If src is $* then set this route to have its dst point to all hosts */
1071 if (strcmp(src_host_name, "$*") == 0
1072 && strcmp(dst_host_name, "$*") != 0) {
1073 xbt_dict_foreach(set, cursor_w, key_w, data_w) {
1074 // if (!symmetric || (symmetric && !contains(dst_names, key_w)))
1075 add_multi_links(src, dst, links, key_w, dst_host_name);
1078 /* if none of them are equal to $* */
1079 if (strcmp(src_host_name, "$*") != 0
1080 && strcmp(dst_host_name, "$*") != 0) {
1081 add_multi_links(src, dst, links, src_host_name, dst_host_name);
1085 xbt_dynar_free(&keys);
1087 surfxml_bufferstack_pop(0);
1091 /* Trace management functions */
1093 static double trace_periodicity = -1.0;
1094 static char *trace_file = NULL;
1095 static char *trace_id;
1097 static void parse_Stag_trace(void)
1099 trace_id = strdup(A_surfxml_trace_id);
1100 trace_file = strdup(A_surfxml_trace_file);
1101 surf_parse_get_double(&trace_periodicity, A_surfxml_trace_periodicity);
1104 static void parse_Etag_trace(void)
1107 if (!trace_file || strcmp(trace_file, "") != 0) {
1108 trace = tmgr_trace_new(trace_file);
1110 if (strcmp(surfxml_pcdata, "") == 0)
1114 tmgr_trace_new_from_string(trace_id, surfxml_pcdata,
1117 xbt_dict_set(traces_set_list, trace_id, (void *) trace, NULL);
1120 static void parse_Stag_trace_c_connect(void)
1122 xbt_assert2(xbt_dict_get_or_null
1123 (traces_set_list, A_surfxml_trace_c_connect_trace),
1124 "Cannot connect trace %s to %s: trace unknown",
1125 A_surfxml_trace_c_connect_trace,
1126 A_surfxml_trace_c_connect_element);
1128 switch (A_surfxml_trace_c_connect_kind) {
1129 case A_surfxml_trace_c_connect_kind_HOST_AVAIL:
1130 xbt_dict_set(trace_connect_list_host_avail,
1131 A_surfxml_trace_c_connect_trace,
1132 xbt_strdup(A_surfxml_trace_c_connect_element), free);
1134 case A_surfxml_trace_c_connect_kind_POWER:
1135 xbt_dict_set(trace_connect_list_power, A_surfxml_trace_c_connect_trace,
1136 xbt_strdup(A_surfxml_trace_c_connect_element), free);
1138 case A_surfxml_trace_c_connect_kind_LINK_AVAIL:
1139 xbt_dict_set(trace_connect_list_link_avail,
1140 A_surfxml_trace_c_connect_trace,
1141 xbt_strdup(A_surfxml_trace_c_connect_element), free);
1143 case A_surfxml_trace_c_connect_kind_BANDWIDTH:
1144 xbt_dict_set(trace_connect_list_bandwidth,
1145 A_surfxml_trace_c_connect_trace,
1146 xbt_strdup(A_surfxml_trace_c_connect_element), free);
1148 case A_surfxml_trace_c_connect_kind_LATENCY:
1149 xbt_dict_set(trace_connect_list_latency, A_surfxml_trace_c_connect_trace,
1150 xbt_strdup(A_surfxml_trace_c_connect_element), free);
1153 xbt_die(bprintf("Cannot connect trace %s to %s: kind of trace unknown",
1154 A_surfxml_trace_c_connect_trace,
1155 A_surfxml_trace_c_connect_element));
1159 /* Random tag functions */
1161 double get_cpu_power(const char *power)
1163 double power_scale = 0.0;
1166 random_data_t random = NULL;
1167 /* randomness is inserted like this: power="$rand(my_random)" */
1168 if (((p = strstr(power, "$rand(")) != NULL)
1169 && ((q = strstr(power, ")")) != NULL)) {
1171 generator = xbt_malloc(q - (p + 6) + 1);
1172 memcpy(generator, p + 6, q - (p + 6));
1173 generator[q - (p + 6)] = '\0';
1174 xbt_assert1((random =
1175 xbt_dict_get_or_null(random_data_list, generator)),
1176 "Random generator %s undefined", generator);
1177 power_scale = random_generate(random);
1180 surf_parse_get_double(&power_scale, power);
1185 double random_min, random_max, random_mean, random_std_deviation,
1189 static void init_randomness(void)
1191 random_id = A_surfxml_random_id;
1192 surf_parse_get_double(&random_min, A_surfxml_random_min);
1193 surf_parse_get_double(&random_max, A_surfxml_random_max);
1194 surf_parse_get_double(&random_mean, A_surfxml_random_mean);
1195 surf_parse_get_double(&random_std_deviation,
1196 A_surfxml_random_std_deviation);
1197 random_generator = A_surfxml_random_generator;
1200 static void add_randomness(void)
1202 /* If needed aditional properties can be added by using the prop tag */
1203 random_data_t random =
1204 random_new(random_generator, 0, random_min, random_max, random_mean,
1205 random_std_deviation);
1206 xbt_dict_set(random_data_list, random_id, (void *) random, NULL);
1210 * create CPU resource via CPU Model
1212 void surf_host_create_resource(char *name, double power_peak,
1214 tmgr_trace_t power_trace,
1215 e_surf_resource_state_t state_initial,
1216 tmgr_trace_t state_trace,
1217 xbt_dict_t cpu_properties)
1219 return surf_cpu_model->extension.cpu.
1220 create_resource(name,power_peak,power_scale,power_trace,state_initial,state_trace,cpu_properties);
1224 * create CPU resource via worsktation_ptask_L07 model
1227 void surf_wsL07_host_create_resource(char *name, double power_peak,
1229 tmgr_trace_t power_trace,
1230 e_surf_resource_state_t state_initial,
1231 tmgr_trace_t state_trace,
1232 xbt_dict_t cpu_properties)
1234 surf_workstation_model->extension.workstation.
1235 cpu_create_resource(name,power_peak,power_scale,power_trace,state_initial,state_trace,cpu_properties);
1238 * create link resource via network Model
1240 void surf_link_create_resource(char *name,
1242 tmgr_trace_t bw_trace,
1244 tmgr_trace_t lat_trace,
1245 e_surf_resource_state_t
1247 tmgr_trace_t state_trace,
1248 e_surf_link_sharing_policy_t policy,
1249 xbt_dict_t properties)
1251 return surf_network_model->extension.network.
1252 create_resource(name,bw_initial,bw_trace,lat_initial,lat_trace,
1253 state_initial,state_trace,policy,properties);
1258 * create link resource via workstation_ptask_L07 model
1261 void surf_wsL07_link_create_resource(char *name,
1263 tmgr_trace_t bw_trace,
1265 tmgr_trace_t lat_trace,
1266 e_surf_resource_state_t
1268 tmgr_trace_t state_trace,
1269 e_surf_link_sharing_policy_t
1270 policy, xbt_dict_t properties)
1272 return surf_workstation_model->extension.workstation.
1273 link_create_resource(name,bw_initial,bw_trace,lat_initial,lat_trace,
1274 state_initial,state_trace,policy,properties);
1279 * Route: add route element bypassing the parser :
1280 * same job as parse_route_elem
1283 void surf_add_route_element(char* link_ctn_id)
1286 val = xbt_strdup(link_ctn_id);
1287 xbt_dynar_push(route_link_list,&val);
1292 void surf_route_set_resource(char *source_id,char *destination_id,xbt_dynar_t links_id,int action)
1294 route_link_list = xbt_dynar_new(sizeof(char *), NULL);
1295 routing_add_route(source_id,destination_id,links_id,action);
1300 * add host to routing host list
1302 void surf_route_add_host(char *host_id)
1304 routing_add_host(host_id);
1310 void surf_add_host_traces(void)
1312 return surf_cpu_model->extension.cpu.
1316 void surf_add_link_traces(void)
1318 return surf_network_model->extension.network.
1322 void surf_wsL07_add_traces(void)
1324 return surf_workstation_model->extension.workstation.
1330 void surf_set_routes(void)
1332 routing_set_routes();