Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
start refreshing and fixing the GTNetS interface (WIP)
[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 NetworkNS3Action;
20 typedef NetworkNS3Action *NetworkNS3ActionPtr;
21
22 /*********
23  * Tools *
24  *********/
25
26 void net_define_callbacks(void);
27
28 /*********
29  * Model *
30  *********/
31
32 class NetworkNS3Model : public NetworkModel {
33 public:
34   NetworkNS3Model();
35
36   ~NetworkNS3Model();
37   Link* createLink(const char *name,
38                                          double bw_initial,
39                                          tmgr_trace_t bw_trace,
40                                          double lat_initial,
41                                          tmgr_trace_t lat_trace,
42                                          e_surf_resource_state_t state_initial,
43                                          tmgr_trace_t state_trace,
44                                          e_surf_link_sharing_policy_t policy,
45                                          xbt_dict_t properties);
46   xbt_dynar_t getRoute(RoutingEdgePtr src, RoutingEdgePtr dst);
47   ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
48                                            double size, double rate);
49   double shareResources(double now);
50   void updateActionsState(double now, double delta);
51   void addTraces(){DIE_IMPOSSIBLE;}
52 };
53
54 /************
55  * Resource *
56  ************/
57 class NetworkNS3Link : public Link {
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(){THROW_UNIMPLEMENTED;}
65   double getBandwidth(){THROW_UNIMPLEMENTED;}
66   void updateBandwidth(double value, double date=surf_get_clock()){THROW_UNIMPLEMENTED;}
67   void updateLatency(double value, double date=surf_get_clock()){THROW_UNIMPLEMENTED;}
68
69 //private:
70  char *p_id;
71  char *p_lat;
72  char *p_bdw;
73  int m_created;
74 };
75
76 /**********
77  * Action *
78  **********/
79 class NetworkNS3Action : public NetworkAction {
80 public:
81   NetworkNS3Action(ModelPtr model, double cost, bool failed);
82
83 #ifdef HAVE_LATENCY_BOUND_TRACKING
84   int getLatencyLimited();
85 #endif
86
87 bool isSuspended();
88 int unref();
89 void suspend();
90 void resume();
91
92 //private:
93   double m_lastSent;
94   RoutingEdgePtr p_srcElm;
95   RoutingEdgePtr p_dstElm;
96 };
97
98
99 #endif /* NETWORK_NS3_HPP_ */