Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make an As::onRouteCreation signal so that NS3 does not need getOneLinkRoutes afterward
[simgrid.git] / src / surf / ns3 / ns3_interface.h
1 /* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved.          */
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
6 #ifndef _NS3_INTERFACE_H
7 #define _NS3_INTERFACE_H
8
9 #include "xbt/log.h"
10 #include "xbt/dynar.h"
11 #include "xbt/misc.h"
12 #include "xbt/sysdep.h"
13 #include <xbt/Extendable.hpp>
14
15 #include <simgrid/s4u/host.hpp>
16 #include <surf/surf_routing.h>
17
18 namespace simgrid{
19   namespace surf{
20     class NetworkNS3Action;
21   }
22 }
23
24 class HostNs3 {
25 public:
26   static simgrid::xbt::Extension<simgrid::s4u::Host, HostNs3> EXTENSION_ID;
27
28   explicit HostNs3();
29   int node_num;
30 };
31
32 SG_BEGIN_DECL()
33
34 XBT_PUBLIC(void)   ns3_initialize(const char* TcpProtocol);
35 XBT_PUBLIC(void)
36 ns3_create_flow(sg_host_t src, sg_host_t dst, double start, u_int32_t TotalBytes,
37                 simgrid::surf::NetworkNS3Action* action);
38 XBT_PUBLIC(void)   ns3_simulator(double maxSeconds);
39 XBT_PUBLIC(void *) ns3_add_router(const char * id);
40 XBT_PUBLIC(void)   ns3_add_link(int src, int dst, char * bw,char * lat);
41 XBT_PUBLIC(void) ns3_add_cluster(const char* id, char* bw, char* lat);
42
43 inline HostNs3* ns3_find_host(const char* id)
44 {
45   sg_host_t host = sg_host_by_name(id);
46   if (host == nullptr)
47     return nullptr;
48   else
49     return host->extension<HostNs3>();
50 }
51
52 SG_END_DECL()
53
54 #endif