Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
96b091e10db896a11f7cf0dc03b0857430d9c442
[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, tmgr_trace_t bw_trace,
48       double lat_initial, tmgr_trace_t lat_trace,
49       e_surf_link_sharing_policy_t policy,
50       xbt_dict_t properties) override;
51   Action *communicate(NetCard *src, NetCard *dst, double size, double rate);
52   double next_occuring_event(double now) override;
53   bool next_occuring_event_isIdempotent() {return false;}
54   void updateActionsState(double now, double delta) override;
55 };
56
57 /************
58  * Resource *
59  ************/
60 class NetworkNS3Link : public Link {
61 public:
62   NetworkNS3Link(NetworkNS3Model *model, const char *name, xbt_dict_t props,
63                double bw_initial, double lat_initial);
64   ~NetworkNS3Link();
65
66   void apply_event(tmgr_trace_iterator_t event, double value) override;
67   void updateBandwidth(double value) override {THROW_UNIMPLEMENTED;}
68   void updateLatency(double value) override {THROW_UNIMPLEMENTED;}
69
70 //private:
71  int m_created;
72 };
73
74 /**********
75  * Action *
76  **********/
77 class NetworkNS3Action : public NetworkAction {
78 public:
79   NetworkNS3Action(Model *model, double cost, bool failed);
80
81 bool isSuspended();
82 int unref();
83 void suspend();
84 void resume();
85
86 //private:
87   double m_lastSent;
88   NetCard *p_srcElm;
89   NetCard *p_dstElm;
90 };
91
92 }
93 }
94
95 #endif /* NETWORK_NS3_HPP_ */