Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
960314f2bccf37cf4f484986228b55b734dc6776
[simgrid.git] / src / surf / surf_routing.hpp
1 #include "surf.hpp"
2
3 #ifndef NETWORK_ROUTING_HPP_
4 #define NETWORK_ROUTING_HPP_
5
6 void routing_model_create( void *loopback);
7
8 /***********
9  * Classes *
10  ***********/
11 class As;
12 typedef As *AsPtr;
13
14 class RoutingModelDescription;
15 typedef RoutingModelDescription *RoutingModelDescriptionPtr;
16
17 class RoutingEdge;
18 typedef RoutingEdge *RoutingEdgePtr;
19
20 class Onelink;
21 typedef Onelink *OnelinkPtr;
22
23 class RoutingPlatf;
24 typedef RoutingPlatf *RoutingPlatfPtr;
25
26
27 /*FIXME:class RoutingModelDescription {
28   const char *p_name;
29   const char *p_desc;
30   AsPtr create();
31   void end(AsPtr as);
32 };*/
33
34 class As {
35 public:
36   xbt_dynar_t p_indexNetworkElm;
37   xbt_dict_t p_bypassRoutes;    /* store bypass routes */
38   routing_model_description_t p_modelDesc;
39   e_surf_routing_hierarchy_t p_hierarchy;
40   char *p_name;
41   AsPtr p_routingFather;
42   xbt_dict_t p_routingSons;
43   RoutingEdgePtr p_netElem;
44   xbt_dynar_t p_linkUpDownList;
45
46   As(){};
47   ~As(){};
48   virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency)=0;
49   virtual xbt_dynar_t getOneLinkRoutes()=0;
50   virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)=0;
51   virtual sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat)=0;
52
53   /* The parser calls the following functions to inform the routing models
54    * that a new element is added to the AS currently built.
55    *
56    * Of course, only the routing model of this AS is informed, not every ones */
57   virtual int parsePU(RoutingEdgePtr elm)=0; /* A host or a router, whatever */
58   virtual int parseAS( RoutingEdgePtr elm)=0;
59   virtual void parseRoute(sg_platf_route_cbarg_t route)=0;
60   virtual void parseASroute(sg_platf_route_cbarg_t route)=0;
61   virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
62 };
63
64 class RoutingEdge {
65 public:
66   AsPtr p_rcComponent;
67   e_surf_network_element_type_t p_rcType;
68   int m_id;
69   char *p_name;
70 };
71
72 /*
73  * Link of lenght 1, alongside with its source and destination. This is mainly usefull in the bindings to gtnets and ns3
74  */
75 class Onelink {
76 public:
77   RoutingEdgePtr p_src;
78   RoutingEdgePtr p_dst;
79   void *p_linkPtr;
80 };
81
82 class RoutingPlatf {
83 public:
84   AsPtr p_root;
85   void *p_loopback;
86   xbt_dynar_t p_lastRoute;
87   xbt_dynar_t getOneLinkRoutes(void);
88   void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, xbt_dynar_t * links, double *latency);
89 };
90
91 #endif /* NETWORK_ROUTING_HPP_ */