Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add "attach" attribute to storage tag in platform description
[simgrid.git] / src / surf / network_ns3.hpp
1 /* Copyright (c) 2004-2014. The SimGrid Team.
2  *
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5 #include "network_interface.hpp"
6 #include "surf/ns3/ns3_interface.h"
7
8 #ifndef NETWORK_NS3_HPP_
9 #define NETWORK_NS3_HPP_
10
11 /***********
12  * Classes *
13  ***********/
14 class NetworkNS3Model;
15 typedef NetworkNS3Model *NetworkNS3ModelPtr;
16
17 class NetworkNS3Link;
18 typedef NetworkNS3Link *NetworkNS3LinkPtr;
19
20 class NetworkNS3Action;
21 typedef NetworkNS3Action *NetworkNS3ActionPtr;
22
23 /*********
24  * Tools *
25  *********/
26
27 void net_define_callbacks(void);
28
29 /*********
30  * Model *
31  *********/
32
33 class NetworkNS3Model : public NetworkModel {
34 public:
35   NetworkNS3Model();
36
37   ~NetworkNS3Model();
38   NetworkLinkPtr createResource(const char *name,
39                                          double bw_initial,
40                                          tmgr_trace_t bw_trace,
41                                          double lat_initial,
42                                          tmgr_trace_t lat_trace,
43                                          e_surf_resource_state_t state_initial,
44                                          tmgr_trace_t state_trace,
45                                          e_surf_link_sharing_policy_t policy,
46                                          xbt_dict_t properties);
47   xbt_dynar_t getRoute(RoutingEdgePtr src, RoutingEdgePtr dst);
48   ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
49                                            double size, double rate);
50   double shareResources(double now);
51   void updateActionsState(double now, double delta);
52 };
53
54 /************
55  * Resource *
56  ************/
57 class NetworkNS3Link : public NetworkLink {
58 public:
59   NetworkNS3Link(NetworkNS3ModelPtr 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();
65   double getBandwidth();
66
67 //private:
68  char *p_id;
69  char *p_lat;
70  char *p_bdw;
71  int m_created;
72 };
73
74 /**********
75  * Action *
76  **********/
77 class NetworkNS3Action : public NetworkAction {
78 public:
79   NetworkNS3Action(ModelPtr model, double cost, bool failed);
80
81 #ifdef HAVE_LATENCY_BOUND_TRACKING
82   int getLatencyLimited();
83 #endif
84
85 bool isSuspended();
86 int unref();
87 void suspend();
88 void resume();
89
90 //private:
91 #ifdef HAVE_TRACING
92   double m_lastSent;
93   RoutingEdgePtr p_srcElm;
94   RoutingEdgePtr p_dstElm;
95 #endif //HAVE_TRACING
96 };
97
98
99 #endif /* NETWORK_NS3_HPP_ */