Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
1923e55e5c77400f2d90a8cd6a6e719550593b8b
[simgrid.git] / src / surf / network_ns3.hpp
1 /* Copyright (c) 2004-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #include <xbt/base.h>
8
9 #include "network_interface.hpp"
10 #include "src/surf/ns3/ns3_interface.h"
11
12 #ifndef NETWORK_NS3_HPP_
13 #define NETWORK_NS3_HPP_
14
15 /***********
16  * Classes *
17  ***********/
18
19 namespace simgrid {
20 namespace surf {
21
22 class XBT_PRIVATE NetworkNS3Model;
23 class XBT_PRIVATE NetworkNS3Action;
24
25 }
26 }
27
28 /*********
29  * Tools *
30  *********/
31
32 XBT_PRIVATE void net_define_callbacks(void);
33
34 /*********
35  * Model *
36  *********/
37
38 namespace simgrid {
39 namespace surf {
40
41 class NetworkNS3Model : public NetworkModel {
42 public:
43   NetworkNS3Model();
44
45   ~NetworkNS3Model();
46   Link* createLink(const char *name,
47                                          double bw_initial,
48                                          tmgr_trace_t bw_trace,
49                                          double lat_initial,
50                                          tmgr_trace_t lat_trace,
51                                          e_surf_resource_state_t state_initial,
52                                          tmgr_trace_t state_trace,
53                                          e_surf_link_sharing_policy_t policy,
54                                          xbt_dict_t properties);
55   xbt_dynar_t getRoute(RoutingEdge *src, RoutingEdge *dst);
56   Action *communicate(RoutingEdge *src, RoutingEdge *dst,
57                                            double size, double rate);
58   double shareResources(double now);
59   void updateActionsState(double now, double delta);
60   void addTraces(){DIE_IMPOSSIBLE;}
61   bool shareResourcesIsIdempotent() {return false;}
62 };
63
64 /************
65  * Resource *
66  ************/
67 class NetworkNS3Link : public Link {
68 public:
69   NetworkNS3Link(NetworkNS3Model *model, const char *name, xbt_dict_t props,
70                          double bw_initial, double lat_initial);
71   ~NetworkNS3Link();
72
73   void updateState(tmgr_trace_event_t event_type, double value, double date);
74   double getLatency(){THROW_UNIMPLEMENTED;}
75   double getBandwidth(){THROW_UNIMPLEMENTED;}
76   void updateBandwidth(double value, double date=surf_get_clock()){THROW_UNIMPLEMENTED;}
77   void updateLatency(double value, double date=surf_get_clock()){THROW_UNIMPLEMENTED;}
78
79 //private:
80  char *p_id;
81  char *p_lat;
82  char *p_bdw;
83  int m_created;
84 };
85
86 /**********
87  * Action *
88  **********/
89 class NetworkNS3Action : public NetworkAction {
90 public:
91   NetworkNS3Action(Model *model, double cost, bool failed);
92
93 #ifdef HAVE_LATENCY_BOUND_TRACKING
94   int getLatencyLimited();
95 #endif
96
97 bool isSuspended();
98 int unref();
99 void suspend();
100 void resume();
101
102 //private:
103   double m_lastSent;
104   RoutingEdge *p_srcElm;
105   RoutingEdge *p_dstElm;
106 };
107
108 }
109 }
110
111 #endif /* NETWORK_NS3_HPP_ */