Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
NS3.25 is out now
[simgrid.git] / src / surf / ns3 / ns3_interface.h
1 /* Copyright (c) 2007-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 #ifndef _NS3_INTERFACE_H
8 #define _NS3_INTERFACE_H
9
10 #include "xbt/log.h"
11 #include "xbt/dynar.h"
12 #include "xbt/misc.h"
13 #include "xbt/sysdep.h"
14 #include <xbt/Extendable.hpp>
15
16 #include <simgrid/s4u/host.hpp>
17 #include <surf/surf_routing.h>
18
19 namespace simgrid{
20   namespace surf{
21     class NetworkNS3Action;
22   }
23 }
24
25 typedef struct ns3_node {
26   int node_num;
27 } s_ns3_node_t, *ns3_node_t;
28
29 XBT_PUBLIC_DATA(int) NS3_EXTENSION_ID;
30
31 SG_BEGIN_DECL()
32
33 XBT_PUBLIC(void)   ns3_initialize(const char* TcpProtocol);
34 XBT_PUBLIC(void)   ns3_create_flow(const char* a,const char *b,double start,u_int32_t TotalBytes,simgrid::surf::NetworkNS3Action * action);
35 XBT_PUBLIC(void)   ns3_simulator(double maxSeconds);
36 XBT_PUBLIC(void *) ns3_add_host_cluster(const char * id);
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(char * bw,char * lat,const char *id);
40
41 inline
42 ns3_node_t ns3_find_host(const char* id)
43 {
44   sg_host_t host = sg_host_by_name(id);
45   if (host == nullptr)
46     return nullptr;
47   else
48     return (ns3_node_t) host->extension(NS3_EXTENSION_ID);
49 }
50
51 SG_END_DECL()
52
53 #endif