Logo AND Algorithmique Numérique Distribuée

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