1 #include "surf_interface.hpp"
4 #ifndef NETWORK_ROUTING_HPP_
5 #define NETWORK_ROUTING_HPP_
7 void routing_model_create( void *loopback);
9 /* ************************************************************************** */
10 /* ************************* GRAPH EXPORTING FUNCTIONS ********************** */
11 xbt_node_t new_xbt_graph_node (xbt_graph_t graph, const char *name, xbt_dict_t nodes);
12 xbt_edge_t new_xbt_graph_edge (xbt_graph_t graph, xbt_node_t s, xbt_node_t d, xbt_dict_t edges);
20 class RoutingModelDescription;
21 typedef RoutingModelDescription *RoutingModelDescriptionPtr;
24 typedef RoutingEdge *RoutingEdgePtr;
27 typedef Onelink *OnelinkPtr;
30 typedef RoutingPlatf *RoutingPlatfPtr;
34 xbt_dynar_t p_indexNetworkElm;
35 xbt_dict_t p_bypassRoutes; /* store bypass routes */
36 routing_model_description_t p_modelDesc;
37 e_surf_routing_hierarchy_t p_hierarchy;
39 AsPtr p_routingFather;
40 xbt_dict_t p_routingSons;
41 RoutingEdgePtr p_netElem;
42 xbt_dynar_t p_linkUpDownList;
49 virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency)=0;
50 virtual xbt_dynar_t getOneLinkRoutes()=0;
51 virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)=0;
52 virtual sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat)=0;
54 /* The parser calls the following functions to inform the routing models
55 * that a new element is added to the AS currently built.
57 * Of course, only the routing model of this AS is informed, not every ones */
58 virtual int parsePU(RoutingEdgePtr elm)=0; /* A host or a router, whatever */
59 virtual int parseAS( RoutingEdgePtr elm)=0;
60 virtual void parseRoute(sg_platf_route_cbarg_t route)=0;
61 virtual void parseASroute(sg_platf_route_cbarg_t route)=0;
62 virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
67 ~RoutingEdge() { xbt_free(p_name);};
69 e_surf_network_element_type_t p_rcType;
75 * Link of lenght 1, alongside with its source and destination. This is mainly usefull in the bindings to gtnets and ns3
79 Onelink(void *link, RoutingEdgePtr src, RoutingEdgePtr dst)
80 : p_src(src), p_dst(dst), p_link(link) {};
91 xbt_dynar_t p_lastRoute;
92 xbt_dynar_t getOneLinkRoutes(void);
93 xbt_dynar_t recursiveGetOneLinkRoutes(AsPtr rc);
94 void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, xbt_dynar_t * links, double *latency);
97 #endif /* NETWORK_ROUTING_HPP_ */