Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix bug #17132 (surf.c:366: The Impossible Did Happen (yet again)).
[simgrid.git] / src / surf / network_ns3.hpp
1 /* Copyright (c) 2004-2014. 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 "network_interface.hpp"
8 #include "surf/ns3/ns3_interface.h"
9
10 #ifndef NETWORK_NS3_HPP_
11 #define NETWORK_NS3_HPP_
12
13 /***********
14  * Classes *
15  ***********/
16 class NetworkNS3Model;
17 typedef NetworkNS3Model *NetworkNS3ModelPtr;
18
19 class NetworkNS3Link;
20 typedef NetworkNS3Link *NetworkNS3LinkPtr;
21
22 class NetworkNS3Action;
23 typedef NetworkNS3Action *NetworkNS3ActionPtr;
24
25 /*********
26  * Tools *
27  *********/
28
29 void net_define_callbacks(void);
30
31 /*********
32  * Model *
33  *********/
34
35 class NetworkNS3Model : public NetworkModel {
36 public:
37   NetworkNS3Model();
38
39   ~NetworkNS3Model();
40   NetworkLinkPtr createResource(const char *name,
41                                          double bw_initial,
42                                          tmgr_trace_t bw_trace,
43                                          double lat_initial,
44                                          tmgr_trace_t lat_trace,
45                                          e_surf_resource_state_t state_initial,
46                                          tmgr_trace_t state_trace,
47                                          e_surf_link_sharing_policy_t policy,
48                                          xbt_dict_t properties);
49   xbt_dynar_t getRoute(RoutingEdgePtr src, RoutingEdgePtr dst);
50   ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
51                                            double size, double rate);
52   double shareResources(double now);
53   void updateActionsState(double now, double delta);
54 };
55
56 /************
57  * Resource *
58  ************/
59 class NetworkNS3Link : public NetworkLink {
60 public:
61   NetworkNS3Link(NetworkNS3ModelPtr model, const char *name, xbt_dict_t props,
62                          double bw_initial, double lat_initial);
63   ~NetworkNS3Link();
64
65   void updateState(tmgr_trace_event_t event_type, double value, double date);
66   double getLatency(){THROW_UNIMPLEMENTED;}
67   double getBandwidth(){THROW_UNIMPLEMENTED;}
68   void updateBandwidth(double value, double date=surf_get_clock()){THROW_UNIMPLEMENTED;}
69   void updateLatency(double value, double date=surf_get_clock()){THROW_UNIMPLEMENTED;}
70
71 //private:
72  char *p_id;
73  char *p_lat;
74  char *p_bdw;
75  int m_created;
76 };
77
78 /**********
79  * Action *
80  **********/
81 class NetworkNS3Action : public NetworkAction {
82 public:
83   NetworkNS3Action(ModelPtr model, double cost, bool failed);
84
85 #ifdef HAVE_LATENCY_BOUND_TRACKING
86   int getLatencyLimited();
87 #endif
88
89 bool isSuspended();
90 int unref();
91 void suspend();
92 void resume();
93
94 //private:
95 #ifdef HAVE_TRACING
96   double m_lastSent;
97   RoutingEdgePtr p_srcElm;
98   RoutingEdgePtr p_dstElm;
99 #endif //HAVE_TRACING
100 };
101
102
103 #endif /* NETWORK_NS3_HPP_ */