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 / ns3 / ns3_simulator.h
1 /* Copyright (c) 2007, 2008, 2009, 2010. 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 #ifndef _NS3_SIM_H
8 #define _NS3_SIM_H
9
10 #ifdef __cplusplus
11
12 #include "ns3/core-module.h"
13 #ifdef _HAVE_NS3_RED
14 #include "my-point-to-point-helper.h"
15 #endif
16
17 #ifdef _NS3_3_10
18         /*NS3 3.10*/
19         #include "ns3/helper-module.h"
20         #include "ns3/simulator-module.h"
21         #include "ns3/node-module.h"
22         #include "ns3/helper-module.h"
23         #include "ns3/global-routing-module.h"
24         #include "ns3/tcp-socket-factory.h"
25 #else
26         /*NS3 3.12*/
27         #include "ns3/node.h"
28         #include "ns3/global-route-manager.h"
29         #include "ns3/csma-helper.h"
30         #include "ns3/internet-stack-helper.h"
31         #include "ns3/ipv4-address-helper.h"
32         #include "ns3/point-to-point-helper.h"
33         #include "ns3/packet-sink-helper.h"
34         #include "ns3/inet-socket-address.h"
35         #include "ns3/tcp-socket-factory.h"
36 #endif
37
38 using namespace ns3;
39 using namespace std;
40
41 struct MySocket{
42   uint32_t bufferedBytes;
43   uint32_t sentBytes;
44   uint32_t remaining;
45   uint32_t totalBytes;
46   char finished;
47   void* action;
48 };
49
50 //Simulator s;
51 class NS3Sim {
52
53 private:
54
55 public:
56         NS3Sim();
57         ~NS3Sim();
58         void create_flow_NS3(Ptr<Node> src,
59                                                 Ptr<Node> dst,
60                                                 uint16_t port_number,
61                                                 double start,
62                                                 const char *addr,
63                                                 uint32_t TotalBytes,
64                                                 void * action);
65         void simulator_start(double min);
66         void* get_action_from_socket(void *socket);
67         double get_remains_from_socket(void *socket);
68         double get_sent_from_socket(void *socket);
69         char get_finished(void *socket);
70 };
71
72 #endif                          /* __cplusplus */
73
74 #endif