Logo AND Algorithmique Numérique Distribuée

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