Logo AND Algorithmique Numérique Distribuée

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