+#include <pcre.h> /* regular expression library */
+#include "surf_routing_private.h"
+#include "surf/surf_routing.h"
+#include "surf/surfxml_parse_values.h"
+
+xbt_lib_t host_lib;
+int ROUTING_HOST_LEVEL; //Routing level
+int SURF_CPU_LEVEL; //Surf cpu level
+int SURF_WKS_LEVEL; //Surf workstation level
+int SIMIX_HOST_LEVEL; //Simix level
+int MSG_HOST_LEVEL; //Msg level
+int SD_HOST_LEVEL; //Simdag level
+int COORD_HOST_LEVEL; //Coordinates level
+int NS3_HOST_LEVEL; //host node for ns3
+
+xbt_lib_t link_lib;
+int SD_LINK_LEVEL; //Simdag level
+int SURF_LINK_LEVEL; //Surf level
+int NS3_LINK_LEVEL; //link for ns3
+
+xbt_lib_t as_router_lib;
+int ROUTING_ASR_LEVEL; //Routing level
+int COORD_ASR_LEVEL; //Coordinates level
+int NS3_ASR_LEVEL; //host node for ns3
+
+static xbt_dict_t patterns = NULL;
+static xbt_dict_t random_value = NULL;
+
+/* Global vars */
+routing_global_t global_routing = NULL;
+routing_component_t current_routing = NULL;
+model_type_t current_routing_model = NULL;
+
+/* global parse functions */
+xbt_dynar_t link_list = NULL; /* temporary store of current list link of a route */
+static const char *src = NULL; /* temporary store the source name of a route */
+static const char *dst = NULL; /* temporary store the destination name of a route */
+static char *gw_src = NULL; /* temporary store the gateway source name of a route */
+static char *gw_dst = NULL; /* temporary store the gateway destination name of a route */
+static double_f_cpvoid_t get_link_latency = NULL;
+xbt_dict_t cluster_host_link = NULL; /* for tag cluster */
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf");
+
+static void routing_parse_Speer(void); /* peer bypass */
+static void routing_parse_Srandom(void); /* random bypass */
+static void routing_parse_Erandom(void); /* random bypass */
+
+static void routing_parse_Sconfig(void); /* config Tag */
+static void routing_parse_Econfig(void); /* config Tag */
+
+static char* replace_random_parameter(char * chaine);
+static void clean_routing_after_parse(void);
+
+/* this lines are only for replace use like index in the model table */
+typedef enum {
+ SURF_MODEL_FULL = 0,
+ SURF_MODEL_FLOYD,
+ SURF_MODEL_DIJKSTRA,
+ SURF_MODEL_DIJKSTRACACHE,
+ SURF_MODEL_NONE,
+ SURF_MODEL_RULEBASED,
+ SURF_MODEL_VIVALDI,
+ SURF_MODEL_CLUSTER
+} e_routing_types;
+
+struct s_model_type routing_models[] = { {"Full",
+ "Full routing data (fast, large memory requirements, fully expressive)",
+ model_full_create,
+ model_full_load,
+ model_full_unload,
+ model_full_end},
+{"Floyd",
+ "Floyd routing data (slow initialization, fast lookup, lesser memory requirements, shortest path routing only)",
+ model_floyd_create, model_floyd_load, model_floyd_unload,
+ model_floyd_end},
+{"Dijkstra",
+ "Dijkstra routing data (fast initialization, slow lookup, small memory requirements, shortest path routing only)",
+ model_dijkstra_create, model_dijkstra_both_load,
+ model_dijkstra_both_unload, model_dijkstra_both_end},
+{"DijkstraCache",
+ "Dijkstra routing data (fast initialization, fast lookup, small memory requirements, shortest path routing only)",
+ model_dijkstracache_create, model_dijkstra_both_load,
+ model_dijkstra_both_unload, model_dijkstra_both_end},
+{"none", "No routing (usable with Constant network only)",
+ model_none_create, model_none_load, model_none_unload, model_none_end},
+{"RuleBased", "Rule-Based routing data (...)", model_rulebased_create,
+ model_rulebased_load, model_rulebased_unload, model_rulebased_end},
+{"Vivaldi", "Vivaldi routing", model_rulebased_create,
+ model_rulebased_load, model_rulebased_unload, model_rulebased_end},
+{"Cluster", "Cluster routing", model_cluster_create,
+ model_rulebased_load, model_rulebased_unload, model_rulebased_end},
+{NULL, NULL, NULL, NULL, NULL, NULL}