Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://github.com/mpoquet/simgrid
[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)   ns3_create_flow(const char* a,const char *b,double start,u_int32_t TotalBytes,simgrid::surf::NetworkNS3Action * action);
36 XBT_PUBLIC(void)   ns3_simulator(double maxSeconds);
37 XBT_PUBLIC(void *) ns3_add_router(const char * id);
38 XBT_PUBLIC(void)   ns3_add_link(int src, int dst, char * bw,char * lat);
39 XBT_PUBLIC(void) ns3_add_cluster(const char* id, char* bw, char* lat);
40
41 inline HostNs3* ns3_find_host(const char* id)
42 {
43   sg_host_t host = sg_host_by_name(id);
44   if (host == nullptr)
45     return nullptr;
46   else
47     return host->extension<HostNs3>();
48 }
49
50 SG_END_DECL()
51
52 #endif