Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[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 namespace simgrid {
16 namespace surf {
17
18 class XBT_PRIVATE NetworkNS3Model : public NetworkModel {
19 public:
20   NetworkNS3Model();
21   ~NetworkNS3Model();
22   Link* createLink(const char *name, double bandwidth, double latency,
23       e_surf_link_sharing_policy_t policy, xbt_dict_t properties) override;
24   Action *communicate(NetCard *src, NetCard *dst, double size, double rate);
25   double next_occuring_event(double now) override;
26   bool next_occuring_event_isIdempotent() {return false;}
27   void updateActionsState(double now, double delta) override;
28 };
29
30 /************
31  * Resource *
32  ************/
33 class LinkNS3 : public Link {
34 public:
35   LinkNS3(NetworkNS3Model *model, const char *name, xbt_dict_t props, double bandwidth, double latency);
36   ~LinkNS3();
37
38   void apply_event(tmgr_trace_iterator_t event, double value) override;
39   void updateBandwidth(double value) override {THROW_UNIMPLEMENTED;}
40   void updateLatency(double value) override {THROW_UNIMPLEMENTED;}
41   void setBandwidthTrace(tmgr_trace_t trace) override;
42   void setLatencyTrace(tmgr_trace_t trace) override;
43 };
44
45 /**********
46  * Action *
47  **********/
48 class XBT_PRIVATE NetworkNS3Action : public NetworkAction {
49 public:
50   NetworkNS3Action(Model *model, double cost, NetCard *src, NetCard *dst);
51
52   bool isSuspended();
53   int unref();
54   void suspend();
55   void resume();
56
57 //private:
58   double lastSent_ = 0;
59   NetCard *src_;
60   NetCard *dst_;
61 };
62
63 }
64 }
65
66 #endif /* NETWORK_NS3_HPP_ */