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);
18 /* Note: As and RoutingEdge are declard as struct instead of class, to keep
19 compatibility with C files where they are mentioned. */
23 class RoutingModelDescription;
24 typedef RoutingModelDescription *RoutingModelDescriptionPtr;
27 typedef RoutingEdge *RoutingEdgePtr;
30 typedef Onelink *OnelinkPtr;
33 typedef RoutingPlatf *RoutingPlatfPtr;
35 /** @ingroup SURF_routing_interface
36 * @brief The Autonomous System (AS) routing interface
41 xbt_dynar_t p_indexNetworkElm;
42 xbt_dict_t p_bypassRoutes; /* store bypass routes */
43 routing_model_description_t p_modelDesc;
44 e_surf_routing_hierarchy_t p_hierarchy;
46 AsPtr p_routingFather;
47 xbt_dict_t p_routingSons;
48 RoutingEdgePtr p_netElem;
49 xbt_dynar_t p_linkUpDownList;
52 * @brief The As constructor
57 * @brief The As destructor
64 * @brief Get the route and latency between two RoutingEdgs
65 * @details [long description]
67 * @param src [description]
68 * @param dst [description]
69 * @param into [description]
70 * @param latency [description]
72 virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency)=0;
73 virtual xbt_dynar_t getOneLinkRoutes()=0;
74 virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)=0;
75 virtual sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat)=0;
77 /* The parser calls the following functions to inform the routing models
78 * that a new element is added to the AS currently built.
80 * Of course, only the routing model of this AS is informed, not every ones */
81 virtual int parsePU(RoutingEdgePtr elm)=0; /* A host or a router, whatever */
82 virtual int parseAS( RoutingEdgePtr elm)=0;
83 virtual void parseRoute(sg_platf_route_cbarg_t route)=0;
84 virtual void parseASroute(sg_platf_route_cbarg_t route)=0;
85 virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
88 /** @ingroup SURF_routing_interface
89 * @brief A routing edge
90 * @details [long description]
94 ~RoutingEdge() { xbt_free(p_name);};
96 e_surf_network_element_type_t p_rcType;
102 /** @ingroup SURF_routing_interface
103 * @brief Link of lenght 1, alongside with its source and destination. This is mainly usefull in the bindings to gtnets and ns3
107 Onelink(void *link, RoutingEdgePtr src, RoutingEdgePtr dst)
108 : p_src(src), p_dst(dst), p_link(link) {};
109 RoutingEdgePtr p_src;
110 RoutingEdgePtr p_dst;
114 /** @ingroup SURF_routing_interface
115 * @brief The class representing a whole routing platform
122 xbt_dynar_t p_lastRoute;
123 xbt_dynar_t getOneLinkRoutes(void);
124 xbt_dynar_t recursiveGetOneLinkRoutes(AsPtr rc);
125 void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, xbt_dynar_t * links, double *latency);
128 #endif /* NETWORK_ROUTING_HPP_ */