Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
No need for the AS creation callback
[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 #ifndef NETWORK_NS3_HPP_
7 #define NETWORK_NS3_HPP_
8
9
10 #include <xbt/base.h>
11
12 #include "network_interface.hpp"
13 #include "src/surf/ns3/ns3_interface.h"
14
15 namespace simgrid {
16 namespace surf {
17
18 class NetworkNS3Model : public NetworkModel {
19 public:
20   NetworkNS3Model();
21   ~NetworkNS3Model();
22   Link* createLink(const char* name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy) override;
23   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
24   double nextOccuringEvent(double now) override;
25   bool nextOccuringEventIsIdempotent() {return false;}
26   void updateActionsState(double now, double delta) override;
27 };
28
29 /************
30  * Resource *
31  ************/
32 class LinkNS3 : public Link {
33 public:
34   explicit LinkNS3(NetworkNS3Model* model, const char* name, double bandwidth, double latency);
35   ~LinkNS3();
36
37   void apply_event(tmgr_trace_iterator_t event, double value) override;
38   void setBandwidth(double value) override { THROW_UNIMPLEMENTED; }
39   void setLatency(double value) override { THROW_UNIMPLEMENTED; }
40   void setBandwidthTrace(tmgr_trace_t trace) override;
41   void setLatencyTrace(tmgr_trace_t trace) override;
42 };
43
44 /**********
45  * Action *
46  **********/
47 class XBT_PRIVATE NetworkNS3Action : public NetworkAction {
48 public:
49   NetworkNS3Action(Model* model, double cost, s4u::Host* src, s4u::Host* dst);
50
51   bool isSuspended();
52   int unref();
53   void suspend();
54   void resume();
55
56 //private:
57   double lastSent_ = 0;
58   s4u::Host* src_;
59   s4u::Host* dst_;
60 };
61
62 }
63 }
64
65 #endif /* NETWORK_NS3_HPP_ */